Skip to content

Commit

Permalink
Add extra status to LED
Browse files Browse the repository at this point in the history
  • Loading branch information
netmindz committed Sep 14, 2023
1 parent 79108eb commit 22c5041
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion sensor/src/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@

#define STATUS_BOOT 0
#define STATUS_WIFI 2
#define STATUS_OK 1
#define STATUS_OK 1
#define STATUS_WAITING_DATA 3
#define STATUS_WAITING_PANEL 4
16 changes: 15 additions & 1 deletion sensor/src/sensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ void setPixel(uint8_t color) {
case 2:
pixels.setPixelColor(0, pixels.Color(0,0,255));
break;
case 3:
pixels.setPixelColor(0, pixels.Color(255,255,0));
break;
case 4:
pixels.setPixelColor(0, pixels.Color(255,0,255));
break;
}
pixels.show();
#endif
Expand Down Expand Up @@ -468,6 +474,14 @@ void loop() {
msgLength = 0;
}
}
else {
if(panelDetected) {
setPixel(STATUS_WAITING_DATA);
}
else {
setPixel(STATUS_WAITING_PANEL);
}
}

if (panelSelect == HIGH || !panelDetected) { // Controller talking to other topside panels - we are in effect idle

Expand All @@ -484,7 +498,7 @@ void loop() {

telnetLoop();

if (sendBuffer.isEmpty()) { // Only handle status is we aren't trying to send commands, webserver and websocket
if (sendBuffer.isEmpty() || !panelDetected) { // Only handle status is we aren't trying to send commands, webserver and websocket
// can both block for a long time

webserver.handleClient();
Expand Down

0 comments on commit 22c5041

Please sign in to comment.