Skip to content

Commit

Permalink
Merge pull request #27 from nilclass/machinecommand-for-chipstatus
Browse files Browse the repository at this point in the history
Add command 'getchipstatus'
  • Loading branch information
Architeuthis-Flux authored Feb 9, 2024
2 parents 64defca + 4765efc commit e350039
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
23 changes: 22 additions & 1 deletion JumperlessNano/src/MachineCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", "getsupplyswitch"};
char machineModeInstructionString[NUMBEROFINSTRUCTIONS][20] = {"unknown", "netlist", "getnetlist", "bridgelist", "getbridgelist", "lightnode", "lightnet", "getmeasurement", "gpio", "uart", "arduinoflash", "setnetcolor", "setnodecolor", "setsupplyswitch", "getsupplyswitch", "getchipstatus"};

enum machineModeInstruction parseMachineInstructions(int *sequenceNumber)
{
Expand Down Expand Up @@ -810,3 +810,24 @@ void listBridgesMachine(void)
}
Serial.println("]");
}

void printChipStatusMachine() {
Serial.println("::chipstatus-begin");
for (int i = 0; i < 12; i++) {
Serial.print("::chipstatus[");
Serial.print(chipNumToChar(i));
Serial.print(",");
for (int j = 0; j < 16; j++) {
Serial.print(ch[i].xStatus[j]);
Serial.print(",");
}
for (int j = 0; j < 8; j++) {
Serial.print(ch[i].yStatus[j]);
if (j != 7) {
Serial.print(",");
}
}
Serial.println("]");
}
Serial.println("::chipstatus-end");
}
7 changes: 5 additions & 2 deletions JumperlessNano/src/MachineCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#ifndef MACHINECOMMANDS_H
#define MACHINECOMMANDS_H

#define NUMBEROFINSTRUCTIONS 16
#define NUMBEROFINSTRUCTIONS 17

enum machineModeInstruction
{
Expand All @@ -20,7 +20,8 @@ enum machineModeInstruction
setnetcolor,
setnodecolor,
setsupplyswitch,
getsupplyswitch
getsupplyswitch,
getchipstatus
};

extern char inputBuffer[INPUTBUFFERLENGTH];
Expand Down Expand Up @@ -48,4 +49,6 @@ int setSupplySwitch(void);
void listNetsMachine(void);
void listBridgesMachine(void);

void printChipStatusMachine();

#endif
4 changes: 4 additions & 0 deletions JumperlessNano/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,10 @@ if (millis() - lastTimeCommandRecieved > 100)
}
break;

case getchipstatus:
printChipStatusMachine();
break;

// case gpio:
// break;

Expand Down

0 comments on commit e350039

Please sign in to comment.