RF-Positioning-System V0.1
by Max Heinekamp
Loading...
Searching...
No Matches
scpi_commands.cpp File Reference

This file contains the function definitions for the SCPI commands that are available for the instrument. More...

#include "flash.h"
#include "scpi.h"

Go to the source code of this file.

Functions

void Identify (SCPI_C commands, SCPI_P parameters, Stream &interface)
 Sends an identification message over the given interface.
void Reset (SCPI_C commands, SCPI_P parameters, Stream &interface)
 Triggers a full reset of the ESP32.
void OPC (SCPI_C commands, SCPI_P parameters, Stream &interface)
 Sends a 1 over the given interface to indicate that the previous command has finished executing.
void GetError (SCPI_C commands, SCPI_P parameters, Stream &interface)
 Sends the oldest error message over the given interface.
void GetHelp (SCPI_C commands, SCPI_P parameters, Stream &interface)
 Sends a help message with all available SCPI commands over the given interface.
void GetHelpSyntax (SCPI_C commands, SCPI_P parameters, Stream &interface)
 Sends syntax help for a single command header, given as a parameter (e.g. SYSTem:HELP:SYNTax? *IDN?), over the given interface.
void GetVersion (SCPI_C commands, SCPI_P parameters, Stream &interface)
 Sends the current firmware version of the device over the given interface.
void GetDebug (SCPI_C commands, SCPI_P parameters, Stream &interface)
 Sends the debug information from Vrekrer-SCPI-Parser over the given interface.
void Preset (SCPI_C commands, SCPI_P parameters, Stream &interface)
 Rewrites the parameters stored in flash memory with the defaults from the config.h file.
void SetPort (SCPI_C commands, SCPI_P parameters, Stream &interface)
void GetPort (SCPI_C commands, SCPI_P parameters, Stream &interface)
void SetIP (SCPI_C commands, SCPI_P parameters, Stream &interface)
void GetIP (SCPI_C commands, SCPI_P parameters, Stream &interface)
void SetMAC (SCPI_C commands, SCPI_P parameters, Stream &interface)
void GetMAC (SCPI_C commands, SCPI_P parameters, Stream &interface)
void GetGW (SCPI_C commands, SCPI_P parameters, Stream &interface)
void Perpetual (SCPI_C commands, SCPI_P parameters, Stream &interface)
void Step (SCPI_C commands, SCPI_P parameters, Stream &interface)
void SetRelativePosition (SCPI_C commands, SCPI_P parameters, Stream &interface)
void GetAbsolutePosition (SCPI_C commands, SCPI_P parameters, Stream &interface)
void SetAbsolutePosition (SCPI_C commands, SCPI_P parameters, Stream &interface)
void SetDirection (SCPI_C commands, SCPI_P parameters, Stream &interface)
void GetDirection (SCPI_C commands, SCPI_P parameters, Stream &interface)
void SetRMSCurrent (SCPI_C commands, SCPI_P parameters, Stream &interface)
void GetRMSCurrent (SCPI_C commands, SCPI_P parameters, Stream &interface)
void SetHoldCurrent (SCPI_C commands, SCPI_P parameters, Stream &interface)
void GetHoldCurrent (SCPI_C commands, SCPI_P parameters, Stream &interface)
void SetMicrosteps (SCPI_C commands, SCPI_P parameters, Stream &interface)
void GetMicrosteps (SCPI_C commands, SCPI_P parameters, Stream &interface)
void SetSpeed (SCPI_C commands, SCPI_P parameters, Stream &interface)
void GetSpeed (SCPI_C commands, SCPI_P parameters, Stream &interface)
void SetAcceleration (SCPI_C commands, SCPI_P parameters, Stream &interface)
void GetAcceleration (SCPI_C commands, SCPI_P parameters, Stream &interface)
void DebugMotorPins (SCPI_C commands, SCPI_P parameters, Stream &interface)
void GetMotorDebug (SCPI_C commands, SCPI_P parameters, Stream &interface)
void ResetEthernet (SCPI_C commands, SCPI_P parameters, Stream &interface)
void GetSessionList (SCPI_C commands, SCPI_P parameters, Stream &interface)
 Sends the live SCPI Ethernet session table over the given interface.
void GetSessionLog (SCPI_C commands, SCPI_P parameters, Stream &interface)
 Sends the ring buffer of recent SCPI session closures (with reason) over the given interface.
void GetSocketList (SCPI_C commands, SCPI_P parameters, Stream &interface)
 Sends the raw state of all W5500 hardware sockets over the given interface.
void GetDiagSystem (SCPI_C commands, SCPI_P parameters, Stream &interface)
 Sends system/reset health diagnostics (uptime, heap, reset reason, boot count) over the given interface.

Variables

FLASH flash_memory
SCPI * scpi_instrument
STEPPER * stepper1
STEPPER * stepper2

Detailed Description

This file contains the function definitions for the SCPI commands that are available for the instrument.

Author
Max Heinekamp

The functions are called when a SCPI command is received. They handle the command and send a response back to the client.

Version
0.1
Date
29-04-2025

Definition in file scpi_commands.cpp.

Function Documentation

◆ DebugMotorPins()

void DebugMotorPins ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 500 of file scpi_commands.cpp.

◆ GetAbsolutePosition()

void GetAbsolutePosition ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 223 of file scpi_commands.cpp.

◆ GetAcceleration()

void GetAcceleration ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 493 of file scpi_commands.cpp.

◆ GetDebug()

void GetDebug ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Sends the debug information from Vrekrer-SCPI-Parser over the given interface.

Parameters
commandsThe SCPI commands that were received.
parametersThe parameters that were passed with the SCPI command.
interfacePointer to the Stream interface where the SCPI command was received.

Definition at line 58 of file scpi_commands.cpp.

◆ GetDiagSystem()

void GetDiagSystem ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Sends system/reset health diagnostics (uptime, heap, reset reason, boot count) over the given interface.

Parameters
commandsThe SCPI commands that were received.
parametersThe parameters that were passed with the SCPI command.
interfacePointer to the Stream interface where the SCPI command was received.

Definition at line 553 of file scpi_commands.cpp.

◆ GetDirection()

void GetDirection ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 344 of file scpi_commands.cpp.

◆ GetError()

void GetError ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Sends the oldest error message over the given interface.

Parameters
commandsThe SCPI commands that were received.
parametersThe parameters that were passed with the SCPI command.
interfacePointer to the Stream interface where the SCPI command was received.

Definition at line 37 of file scpi_commands.cpp.

◆ GetGW()

void GetGW ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 133 of file scpi_commands.cpp.

◆ GetHelp()

void GetHelp ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Sends a help message with all available SCPI commands over the given interface.

Parameters
commandsThe SCPI commands that were received.
parametersThe parameters that were passed with the SCPI command.
interfacePointer to the Stream interface where the SCPI command was received.

Definition at line 43 of file scpi_commands.cpp.

◆ GetHelpSyntax()

void GetHelpSyntax ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Sends syntax help for a single command header, given as a parameter (e.g. SYSTem:HELP:SYNTax? *IDN?), over the given interface.

Parameters
commandsThe SCPI commands that were received.
parametersThe parameters that were passed with the SCPI command — parameters[0] is the header to look up, matched against its full spelling as printed by SYSTem:HELP:HEADers?.
interfacePointer to the Stream interface where the SCPI command was received.

Definition at line 47 of file scpi_commands.cpp.

◆ GetHoldCurrent()

void GetHoldCurrent ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 427 of file scpi_commands.cpp.

◆ GetIP()

void GetIP ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 105 of file scpi_commands.cpp.

◆ GetMAC()

void GetMAC ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 121 of file scpi_commands.cpp.

◆ GetMicrosteps()

void GetMicrosteps ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 451 of file scpi_commands.cpp.

◆ GetMotorDebug()

void GetMotorDebug ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 511 of file scpi_commands.cpp.

◆ GetPort()

void GetPort ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 83 of file scpi_commands.cpp.

◆ GetRMSCurrent()

void GetRMSCurrent ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 403 of file scpi_commands.cpp.

◆ GetSessionList()

void GetSessionList ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Sends the live SCPI Ethernet session table over the given interface.

Parameters
commandsThe SCPI commands that were received.
parametersThe parameters that were passed with the SCPI command.
interfacePointer to the Stream interface where the SCPI command was received.

Definition at line 541 of file scpi_commands.cpp.

◆ GetSessionLog()

void GetSessionLog ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Sends the ring buffer of recent SCPI session closures (with reason) over the given interface.

Parameters
commandsThe SCPI commands that were received.
parametersThe parameters that were passed with the SCPI command.
interfacePointer to the Stream interface where the SCPI command was received.

Definition at line 545 of file scpi_commands.cpp.

◆ GetSocketList()

void GetSocketList ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Sends the raw state of all W5500 hardware sockets over the given interface.

Parameters
commandsThe SCPI commands that were received.
parametersThe parameters that were passed with the SCPI command.
interfacePointer to the Stream interface where the SCPI command was received.

Definition at line 549 of file scpi_commands.cpp.

◆ GetSpeed()

void GetSpeed ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 472 of file scpi_commands.cpp.

◆ GetVersion()

void GetVersion ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Sends the current firmware version of the device over the given interface.

Parameters
commandsThe SCPI commands that were received.
parametersThe parameters that were passed with the SCPI command.
interfacePointer to the Stream interface where the SCPI command was received.
Todo
This could be exapnded to also include a hardware version, which would be set in the config.h file.
Note
The firmware version is defined in the config.h file.

Definition at line 51 of file scpi_commands.cpp.

◆ Identify()

void Identify ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Sends an identification message over the given interface.

Parameters
commandsThe SCPI commands that were received.
parametersThe parameters that were passed with the SCPI command.
interfacePointer to the Stream interface where the SCPI command was received.

Definition at line 21 of file scpi_commands.cpp.

◆ OPC()

void OPC ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Sends a 1 over the given interface to indicate that the previous command has finished executing.

Parameters
commandsThe SCPI commands that were received.
parametersThe parameters that were passed with the SCPI command.
interfacePointer to the Stream interface where the SCPI command was received.

As the programm is run sequentially on a single core, this function works by immediately sending a 1 over the interface, as soon controller gets around to processing the command.

Definition at line 32 of file scpi_commands.cpp.

◆ Perpetual()

void Perpetual ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 139 of file scpi_commands.cpp.

◆ Preset()

void Preset ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Rewrites the parameters stored in flash memory with the defaults from the config.h file.

Parameters
commandsThe SCPI commands that were received.
parametersThe parameters that were passed with the SCPI command.
interfacePointer to the Stream interface where the SCPI command was received.

Definition at line 63 of file scpi_commands.cpp.

◆ Reset()

void Reset ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Triggers a full reset of the ESP32.

Parameters
commandsThe SCPI commands that were received.
parametersThe parameters that were passed with the SCPI command.
interfacePointer to the Stream interface where the SCPI command was received.

Definition at line 28 of file scpi_commands.cpp.

◆ ResetEthernet()

void ResetEthernet ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 524 of file scpi_commands.cpp.

◆ SetAbsolutePosition()

void SetAbsolutePosition ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 254 of file scpi_commands.cpp.

◆ SetAcceleration()

void SetAcceleration ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 479 of file scpi_commands.cpp.

◆ SetDirection()

void SetDirection ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 291 of file scpi_commands.cpp.

◆ SetHoldCurrent()

void SetHoldCurrent ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 409 of file scpi_commands.cpp.

◆ SetIP()

void SetIP ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 90 of file scpi_commands.cpp.

◆ SetMAC()

void SetMAC ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 111 of file scpi_commands.cpp.

◆ SetMicrosteps()

void SetMicrosteps ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 433 of file scpi_commands.cpp.

◆ SetPort()

void SetPort ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 69 of file scpi_commands.cpp.

◆ SetRelativePosition()

void SetRelativePosition ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 185 of file scpi_commands.cpp.

◆ SetRMSCurrent()

void SetRMSCurrent ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 385 of file scpi_commands.cpp.

◆ SetSpeed()

void SetSpeed ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 458 of file scpi_commands.cpp.

◆ Step()

void Step ( SCPI_C commands,
SCPI_P parameters,
Stream & interface )

Definition at line 148 of file scpi_commands.cpp.

Variable Documentation

◆ flash_memory

FLASH flash_memory
extern

Definition at line 30 of file main.cpp.

◆ scpi_instrument

SCPI* scpi_instrument
extern

Definition at line 33 of file main.cpp.

◆ stepper1

STEPPER* stepper1
extern

Definition at line 34 of file main.cpp.

◆ stepper2

STEPPER* stepper2
extern

Definition at line 35 of file main.cpp.