diff --git a/JumperlessNano/src/MachineCommands.cpp b/JumperlessNano/src/MachineCommands.cpp index 824a783..388c9ed 100644 --- a/JumperlessNano/src/MachineCommands.cpp +++ b/JumperlessNano/src/MachineCommands.cpp @@ -22,7 +22,7 @@ ArduinoJson::DynamicJsonDocument machineModeJson(8000); enum machineModeInstruction lastReceivedInstruction = unknown; -char machineModeInstructionString[NUMBEROFINSTRUCTIONS][20] = {"unknown", "netlist", "getnetlist", "bridgelist", "getbridgelist", "lightnode", "lightnet", "getmeasurement", "gpio", "uart", "arduinoflash", "setnetcolor", "setnodecolor", "setsupplyswitch"}; +char machineModeInstructionString[NUMBEROFINSTRUCTIONS][20] = {"unknown", "netlist", "getnetlist", "bridgelist", "getbridgelist", "lightnode", "lightnet", "getmeasurement", "gpio", "uart", "arduinoflash", "setnetcolor", "setnodecolor", "setsupplyswitch", "getsupplyswitch"}; enum machineModeInstruction parseMachineInstructions(int *sequenceNumber) { @@ -495,6 +495,12 @@ void lightUpNodesFromInputBuffer(void) } } +void printSupplySwitch(int supplySwitchPos) { + const char *positionString[] = { "3.3V", "5V", "8V" }; + Serial.print("::supplyswitch["); + Serial.print(positionString[supplySwitchPos]); + Serial.println("]"); +} int setSupplySwitch(void) { diff --git a/JumperlessNano/src/MachineCommands.h b/JumperlessNano/src/MachineCommands.h index 7d8ad92..6d4fee0 100644 --- a/JumperlessNano/src/MachineCommands.h +++ b/JumperlessNano/src/MachineCommands.h @@ -1,7 +1,7 @@ #ifndef MACHINECOMMANDS_H #define MACHINECOMMANDS_H -#define NUMBEROFINSTRUCTIONS 15 +#define NUMBEROFINSTRUCTIONS 16 enum machineModeInstruction { @@ -18,7 +18,8 @@ enum machineModeInstruction arduinoflash, setnetcolor, setnodecolor, - setsupplyswitch + setsupplyswitch, + getsupplyswitch }; extern char inputBuffer[INPUTBUFFERLENGTH]; @@ -39,6 +40,7 @@ void lightUpNodesFromInputBuffer(void); void lightUpNetsFromInputBuffer(void); +void printSupplySwitch(int supplySwitchPos); int setSupplySwitch(void); void listNetsMachine(void); diff --git a/JumperlessNano/src/main.cpp b/JumperlessNano/src/main.cpp index b58fc32..60a2461 100644 --- a/JumperlessNano/src/main.cpp +++ b/JumperlessNano/src/main.cpp @@ -543,6 +543,10 @@ void machineMode(void) // read in commands in machine readable format showLEDsCore2 = 1; break; + case getsupplyswitch: + printSupplySwitch(supplySwitchPosition); + break; + // case gpio: // break;