LED color change

This commit is contained in:
Klaus K Wilting 2018-10-16 08:48:09 +02:00
parent ec024b4676
commit ebfc16219b
2 changed files with 13 additions and 2 deletions

View File

@ -122,7 +122,18 @@ void ledLoop(void *parameter) {
LEDState =
((millis() % 200) < 20) ? LED_ON : LED_OFF; // TX data pending
} else if (LMIC.opmode & (OP_TXDATA | OP_TXRXPEND)) {
LEDColor = COLOR_BLUE;
// select color to blink by message port
switch (LMIC.pendTxPort) {
case STATUSPORT:
LEDColor = COLOR_RED;
break;
case CONFIGPORT:
LEDColor = COLOR_CYAN;
break;
default:
LEDColor = COLOR_BLUE;
break;
}
// small blink 10ms on each 1/2sec (not when joining)
LEDState = ((millis() % 500) < 10) ? LED_ON : LED_OFF;
// This should not happen so indicate a problem

View File

@ -53,7 +53,7 @@
#define COUNTERPORT 1 // Port on which device sends counts
#define RCMDPORT 2 // Port on which device listenes for remote commands
#define STATUSPORT 2 // Port on which device sends remote command results
#define CONFIGPORT 3 // Port on which device sends gps query results
#define CONFIGPORT 3 // Port on which device sends config query results
#define GPSPORT 4 // Port on which device sends gps query results
#define BUTTONPORT 5 // Port on which device sends button pressed signal
#define LPP1PORT 1 // Port for Cayenne LPP 1.0 dynamic sensor encoding