Added NeoPixel intensity control

This commit is contained in:
Mark Qvist 2024-09-27 20:08:05 +02:00
parent d2133ba5e0
commit a134cbfb9c
4 changed files with 66 additions and 1 deletions

View file

@ -78,6 +78,10 @@ void setup() {
Serial.begin(serial_baudrate);
#if HAS_NP
led_init();
#endif
#if BOARD_MODEL != BOARD_RAK4631 && BOARD_MODEL != BOARD_RNODE_NG_22
// Some boards need to wait until the hardware UART is set up before booting
// the full firmware. In the case of the RAK4631, the line below will wait
@ -962,6 +966,40 @@ void serialCallback(uint8_t sbyte) {
da_conf_save(display_addr);
}
#endif
} else if (command == CMD_DISP_BLNK) {
#if HAS_NP
if (sbyte == FESC) {
ESCAPE = true;
} else {
if (ESCAPE) {
if (sbyte == TFEND) sbyte = FEND;
if (sbyte == TFESC) sbyte = FESC;
ESCAPE = false;
}
if (sbyte == 0x00) {
db_conf_save(0x00);
} else {
db_conf_save(0x01);
}
}
#endif
} else if (command == CMD_NP_INT) {
#if HAS_NP
if (sbyte == FESC) {
ESCAPE = true;
} else {
if (ESCAPE) {
if (sbyte == TFEND) sbyte = FEND;
if (sbyte == TFESC) sbyte = FESC;
ESCAPE = false;
}
npi = sbyte;
led_set_intensity(npi);
np_int_conf_save(npi);
}
#endif
}
}