mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-16 07:42:37 +00:00
More blinkenlights work for Thinknode-m3
This commit is contained in:
@@ -805,11 +805,11 @@ void NodeDB::installDefaultModuleConfig()
|
|||||||
moduleConfig.external_notification.output_ms = 500;
|
moduleConfig.external_notification.output_ms = 500;
|
||||||
moduleConfig.external_notification.nag_timeout = 2;
|
moduleConfig.external_notification.nag_timeout = 2;
|
||||||
#endif
|
#endif
|
||||||
#if defined(RAK4630) || defined(RAK11310) || defined(RAK3312) || defined(MUZI_BASE)
|
#if defined(RAK4630) || defined(RAK11310) || defined(RAK3312) || defined(MUZI_BASE) || defined(ELECROW_ThinkNode_M3)
|
||||||
// Default to RAK led pin 2 (blue)
|
// Default to RAK led pin 2 (blue)
|
||||||
moduleConfig.external_notification.enabled = true;
|
moduleConfig.external_notification.enabled = true;
|
||||||
moduleConfig.external_notification.output = PIN_LED2;
|
moduleConfig.external_notification.output = PIN_LED2;
|
||||||
#if defined(MUZI_BASE)
|
#if defined(MUZI_BASE) || defined(ELECROW_ThinkNode_M3)
|
||||||
moduleConfig.external_notification.active = false;
|
moduleConfig.external_notification.active = false;
|
||||||
#else
|
#else
|
||||||
moduleConfig.external_notification.active = true;
|
moduleConfig.external_notification.active = true;
|
||||||
|
|||||||
@@ -26,7 +26,11 @@ int StatusLEDModule::handleStatusUpdate(const meshtastic::Status *arg)
|
|||||||
power_state = charged;
|
power_state = charged;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
power_state = discharging;
|
if (powerStatus->getBatteryChargePercent() > 5) {
|
||||||
|
power_state = discharging;
|
||||||
|
} else {
|
||||||
|
power_state = critical;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -58,16 +62,33 @@ int StatusLEDModule::handleStatusUpdate(const meshtastic::Status *arg)
|
|||||||
|
|
||||||
int32_t StatusLEDModule::runOnce()
|
int32_t StatusLEDModule::runOnce()
|
||||||
{
|
{
|
||||||
|
my_interval = 1000;
|
||||||
|
|
||||||
if (power_state == charging) {
|
if (power_state == charging) {
|
||||||
CHARGE_LED_state = !CHARGE_LED_state;
|
CHARGE_LED_state = !CHARGE_LED_state;
|
||||||
} else if (power_state == charged) {
|
} else if (power_state == charged) {
|
||||||
CHARGE_LED_state = LED_STATE_ON;
|
CHARGE_LED_state = LED_STATE_ON;
|
||||||
|
} else if (power_state == critical) {
|
||||||
|
if (POWER_LED_starttime + 30000 < millis() && !doing_fast_blink) {
|
||||||
|
doing_fast_blink = true;
|
||||||
|
POWER_LED_starttime = millis();
|
||||||
|
}
|
||||||
|
if (doing_fast_blink) {
|
||||||
|
PAIRING_LED_state = LED_STATE_OFF;
|
||||||
|
CHARGE_LED_state = !CHARGE_LED_state;
|
||||||
|
my_interval = 250;
|
||||||
|
if (POWER_LED_starttime + 2000 < millis()) {
|
||||||
|
doing_fast_blink = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
CHARGE_LED_state = LED_STATE_OFF;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
CHARGE_LED_state = LED_STATE_OFF;
|
CHARGE_LED_state = LED_STATE_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.bluetooth.enabled || PAIRING_LED_starttime + 30 * 1000 < millis()) {
|
if (!config.bluetooth.enabled || PAIRING_LED_starttime + 30 * 1000 < millis() || doing_fast_blink) {
|
||||||
PAIRING_LED_state = LED_STATE_OFF;
|
PAIRING_LED_state = LED_STATE_OFF;
|
||||||
} else if (ble_state == unpaired) {
|
} else if (ble_state == unpaired) {
|
||||||
if (slowTrack) {
|
if (slowTrack) {
|
||||||
|
|||||||
@@ -31,8 +31,10 @@ class StatusLEDModule : private concurrency::OSThread
|
|||||||
bool PAIRING_LED_state = LED_STATE_OFF;
|
bool PAIRING_LED_state = LED_STATE_OFF;
|
||||||
|
|
||||||
uint32_t PAIRING_LED_starttime = 0;
|
uint32_t PAIRING_LED_starttime = 0;
|
||||||
|
uint32_t POWER_LED_starttime = 0;
|
||||||
|
bool doing_fast_blink = false;
|
||||||
|
|
||||||
enum PowerState { discharging, charging, charged };
|
enum PowerState { discharging, charging, charged, critical };
|
||||||
|
|
||||||
PowerState power_state = discharging;
|
PowerState power_state = discharging;
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ extern "C" {
|
|||||||
#define LED_POWER red_LED_PIN
|
#define LED_POWER red_LED_PIN
|
||||||
#define LED_CHARGE LED_POWER // Signals the Status LED Module to handle this LED
|
#define LED_CHARGE LED_POWER // Signals the Status LED Module to handle this LED
|
||||||
#define green_LED_PIN 35
|
#define green_LED_PIN 35
|
||||||
|
#define PIN_LED2 green_LED_PIN
|
||||||
#define LED_BLUE 37
|
#define LED_BLUE 37
|
||||||
#define LED_PAIRING LED_BLUE // Signals the Status LED Module to handle this LED
|
#define LED_PAIRING LED_BLUE // Signals the Status LED Module to handle this LED
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user