Merge pull request #22 from nilclass/machine-command-getsupplyswitch

machine-mode: getsupplyswitch
This commit is contained in:
Kevin Santo Cappuccio 2024-01-06 07:52:59 -08:00 committed by GitHub
commit f4dc793289
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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;