diff --git a/interface/src/project/EMSESPSettingsController.tsx b/interface/src/project/EMSESPSettingsController.tsx
index 3e203f9ba..6481a29ad 100644
--- a/interface/src/project/EMSESPSettingsController.tsx
+++ b/interface/src/project/EMSESPSettingsController.tsx
@@ -76,6 +76,16 @@ function EMSESPSettingsControllerForm(props: EMSESPSettingsControllerFormProps)
+
+ }
+ label="Hide LED"
+ />
read(
[&](WiFiSettings & wifiSettings) { LOG_INFO(F("System %s booted (EMS-ESP version %s)"), wifiSettings.hostname.c_str(), EMSESP_APP_VERSION); });
- syslog_init(); // init SysLog
+ syslog_init(); // init SysLog
+ set_led(); // init LED
+ EMSESP::init_tx(); // start UART
+}
- if (LED_GPIO) {
- pinMode(LED_GPIO, OUTPUT); // LED pin, 0 means disabled
- }
-
- EMSESP::emsespSettingsService.read([&](EMSESPSettings & settings) { tx_mode_ = settings.tx_mode; });
-#ifndef EMSESP_FORCE_SERIAL
- EMSuart::start(tx_mode_); // start UART
-#endif
+// set the LED to on or off when in normal operating mode
+void System::set_led() {
+ EMSESP::emsespSettingsService.read([&](EMSESPSettings & settings) {
+ hide_led_ = settings.hide_led;
+ if (LED_GPIO) {
+ pinMode(LED_GPIO, OUTPUT); // LED_GPIO 0 means disabled
+ digitalWrite(LED_GPIO, hide_led_ ? !LED_ON : LED_ON); // LED on, for ever
+ }
+ });
}
// returns true if OTA is uploading
@@ -261,7 +266,7 @@ void System::system_check() {
if (!system_healthy_) {
system_healthy_ = true;
if (LED_GPIO) {
- digitalWrite(LED_GPIO, LED_ON); // LED on, for ever
+ digitalWrite(LED_GPIO, hide_led_ ? !LED_ON : LED_ON); // LED on, for ever
}
}
}
@@ -555,7 +560,7 @@ void System::console_commands(Shell & shell, unsigned int context) {
shell.printfln(F_(wifi_password_fmt), wifiSettings.ssid.isEmpty() ? F_(unset) : F_(asterisks));
});
});
-/*
+ /*
EMSESPShell::commands->add_command(ShellContext::SYSTEM,
CommandFlags::USER,
flash_string_vector{F_(show), F_(mqtt)},
diff --git a/src/system.h b/src/system.h
index 9cb62f9ab..6ecb63ba7 100644
--- a/src/system.h
+++ b/src/system.h
@@ -63,6 +63,8 @@ class System {
static void show_mem(const char * note);
+ static void set_led();
+
void check_upgrade();
private:
@@ -115,11 +117,11 @@ class System {
static bool upload_status_; // true if we're in the middle of a OTA firmware upload
// settings
- uint8_t tx_mode_;
- bool system_heartbeat_;
- uint8_t syslog_level_;
- uint32_t syslog_mark_interval_;
- String syslog_host_;
+ bool system_heartbeat_;
+ static bool hide_led_;
+ uint8_t syslog_level_;
+ uint32_t syslog_mark_interval_;
+ String syslog_host_;
};
} // namespace emsesp