set leds on/off

This commit is contained in:
liquidraver
2026-07-31 08:27:10 +02:00
parent aa14944a93
commit 4e880df81a
15 changed files with 259 additions and 23 deletions
+10
View File
@@ -38,6 +38,7 @@ LOG_MODULE_REGISTER(zephcore_observer_main, CONFIG_ZEPHCORE_MAIN_LOG_LEVEL);
#include <ZephyrWiFiStation.h>
#include <ZephyrMQTTPublisher.h>
#include "observer_creds.h"
#include <helpers/led_gate.h>
/* ========== LED (optional) ========== */
@@ -357,6 +358,15 @@ int main(void)
data_store.savePrefs(*prefs);
}
/* Apply the persisted LED master switch. The observer has no CLI of its own
* to change it, but a unit reflashed from a repeater build keeps the setting
* — and it still drives lora-tx-led on TX-capable boards. */
{
bool leds_off = prefs->leds_disabled != 0;
zephcore_leds_set_disabled(leds_off);
LOG_INF("LEDs: %s (from prefs)", leds_off ? "disabled" : "enabled");
}
/* Initialize USB serial for CLI */
#if ZEPHCORE_USB_STACK && DT_HAS_COMPAT_STATUS_OKAY(zephyr_cdc_acm_uart)
usb_dev = DEVICE_DT_GET_ONE(zephyr_cdc_acm_uart);