Skip to content

Commit e350039

Browse files
Merge pull request #27 from nilclass/machinecommand-for-chipstatus
Add command 'getchipstatus'
2 parents 64defca + 4765efc commit e350039

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

JumperlessNano/src/MachineCommands.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ArduinoJson::DynamicJsonDocument machineModeJson(8000);
2222

2323
enum machineModeInstruction lastReceivedInstruction = unknown;
2424

25-
char machineModeInstructionString[NUMBEROFINSTRUCTIONS][20] = {"unknown", "netlist", "getnetlist", "bridgelist", "getbridgelist", "lightnode", "lightnet", "getmeasurement", "gpio", "uart", "arduinoflash", "setnetcolor", "setnodecolor", "setsupplyswitch", "getsupplyswitch"};
25+
char machineModeInstructionString[NUMBEROFINSTRUCTIONS][20] = {"unknown", "netlist", "getnetlist", "bridgelist", "getbridgelist", "lightnode", "lightnet", "getmeasurement", "gpio", "uart", "arduinoflash", "setnetcolor", "setnodecolor", "setsupplyswitch", "getsupplyswitch", "getchipstatus"};
2626

2727
enum machineModeInstruction parseMachineInstructions(int *sequenceNumber)
2828
{
@@ -810,3 +810,24 @@ void listBridgesMachine(void)
810810
}
811811
Serial.println("]");
812812
}
813+
814+
void printChipStatusMachine() {
815+
Serial.println("::chipstatus-begin");
816+
for (int i = 0; i < 12; i++) {
817+
Serial.print("::chipstatus[");
818+
Serial.print(chipNumToChar(i));
819+
Serial.print(",");
820+
for (int j = 0; j < 16; j++) {
821+
Serial.print(ch[i].xStatus[j]);
822+
Serial.print(",");
823+
}
824+
for (int j = 0; j < 8; j++) {
825+
Serial.print(ch[i].yStatus[j]);
826+
if (j != 7) {
827+
Serial.print(",");
828+
}
829+
}
830+
Serial.println("]");
831+
}
832+
Serial.println("::chipstatus-end");
833+
}

JumperlessNano/src/MachineCommands.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#ifndef MACHINECOMMANDS_H
33
#define MACHINECOMMANDS_H
44

5-
#define NUMBEROFINSTRUCTIONS 16
5+
#define NUMBEROFINSTRUCTIONS 17
66

77
enum machineModeInstruction
88
{
@@ -20,7 +20,8 @@ enum machineModeInstruction
2020
setnetcolor,
2121
setnodecolor,
2222
setsupplyswitch,
23-
getsupplyswitch
23+
getsupplyswitch,
24+
getchipstatus
2425
};
2526

2627
extern char inputBuffer[INPUTBUFFERLENGTH];
@@ -48,4 +49,6 @@ int setSupplySwitch(void);
4849
void listNetsMachine(void);
4950
void listBridgesMachine(void);
5051

52+
void printChipStatusMachine();
53+
5154
#endif

JumperlessNano/src/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,10 @@ if (millis() - lastTimeCommandRecieved > 100)
705705
}
706706
break;
707707

708+
case getchipstatus:
709+
printChipStatusMachine();
710+
break;
711+
708712
// case gpio:
709713
// break;
710714

0 commit comments

Comments
 (0)