diff --git a/src/modules/StatusLEDModule.cpp b/src/modules/StatusLEDModule.cpp index aca94292a..3cd898c8c 100644 --- a/src/modules/StatusLEDModule.cpp +++ b/src/modules/StatusLEDModule.cpp @@ -111,6 +111,19 @@ int32_t StatusLEDModule::runOnce() #endif } +// If we want a LED to be dedicated to the simple hearbeat, we can use that instead of the charge LED +#if defined(LED_HEARTBEAT) + if (!config.device.led_heartbeat_disabled) { + if (HEARTBEAT_LED_state == LED_STATE_ON) { + HEARTBEAT_LED_state = LED_STATE_OFF; + my_interval = 999; + } else { + HEARTBEAT_LED_state = LED_STATE_ON; + my_interval = 1; + } + digitalWrite(LED_HEARTBEAT, HEARTBEAT_LED_state); + } +#endif if (!config.bluetooth.enabled || PAIRING_LED_starttime + 30 * 1000 < millis() || doing_fast_blink) { PAIRING_LED_state = LED_STATE_OFF; } else if (ble_state == unpaired) { diff --git a/src/modules/StatusLEDModule.h b/src/modules/StatusLEDModule.h index 98020cb32..32805fdda 100644 --- a/src/modules/StatusLEDModule.h +++ b/src/modules/StatusLEDModule.h @@ -34,6 +34,9 @@ class StatusLEDModule : private concurrency::OSThread private: bool CHARGE_LED_state = LED_STATE_OFF; bool PAIRING_LED_state = LED_STATE_OFF; +#if defined(LED_HEARTBEAT) + bool HEARTBEAT_LED_state = LED_STATE_OFF; +#endif uint32_t PAIRING_LED_starttime = 0; uint32_t lastUserbuttonTime = 0; diff --git a/variants/nrf52840/ELECROW-ThinkNode-M4/variant.h b/variants/nrf52840/ELECROW-ThinkNode-M4/variant.h index faca5b075..e448f7ec1 100644 --- a/variants/nrf52840/ELECROW-ThinkNode-M4/variant.h +++ b/variants/nrf52840/ELECROW-ThinkNode-M4/variant.h @@ -43,6 +43,7 @@ extern "C" { #define LED_BUILTIN -1 #define LED_BLUE -1 #define PIN_LED2 (32 + 9) +#define LED_HEARTBEAT PIN_LED2 #define LED_PAIRING (13) #define Battery_LED_1 (15)