This commit is contained in:
MichaelDvP
2024-05-04 19:39:00 +02:00
52 changed files with 310 additions and 836 deletions

View File

@@ -364,11 +364,6 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
Settings.enabled = enable;
return StateUpdateResult::CHANGED;
});
} else if (arguments.front() == "ota") {
to_app(shell).esp8266React.getOTASettingsService()->update([&](OTASettings & Settings) {
Settings.enabled = enable;
return StateUpdateResult::CHANGED;
});
} else if (arguments.front() == "ntp") {
to_app(shell).esp8266React.getNTPSettingsService()->update([&](NTPSettings & Settings) {
Settings.enabled = enable;

View File

@@ -160,7 +160,7 @@ MAKE_WORD_CUSTOM(new_password_prompt2, "Retype new password: ")
MAKE_WORD_CUSTOM(password_prompt, "Password: ")
MAKE_WORD_CUSTOM(unset, "<unset>")
MAKE_WORD_CUSTOM(enable_mandatory, "<enable | disable>")
MAKE_WORD_CUSTOM(service_mandatory, "<ota | ap | mqtt | ntp>")
MAKE_WORD_CUSTOM(service_mandatory, "<ap | mqtt | ntp>")
// more common names that don't need translations
MAKE_NOTRANSLATION(1x3min, "1x3min")

View File

@@ -836,6 +836,9 @@ void System::commands_init() {
}
// uses LED to show system health
// 1 x flash = the EMS bus is not connected
// 2 x flash = the network (wifi or ethernet) is not connected
// 3 x flash = both EMS bus and network are failing. This is a critical error!
void System::led_monitor() {
// we only need to run the LED healthcheck if there are errors
if (!healthcheck_ || !led_gpio_) {
@@ -849,7 +852,6 @@ void System::led_monitor() {
// first long pause before we start flashing
if (led_long_timer_ && (uint32_t)(current_time - led_long_timer_) >= HEALTHCHECK_LED_LONG_DUARATION) {
// Serial.println("starting the flash check");
led_short_timer_ = current_time; // start the short timer
led_long_timer_ = 0; // stop long timer
led_flash_step_ = 1; // enable the short flash timer
@@ -863,7 +865,6 @@ void System::led_monitor() {
if (++led_flash_step_ == 8) {
// reset the whole sequence
// Serial.println("resetting flash check");
led_long_timer_ = uuid::get_uptime();
led_flash_step_ = 0;
#if defined(ARDUINO_LOLIN_C3_MINI) && !defined(BOARD_C3_MINI_V1)
@@ -1100,7 +1101,6 @@ bool System::check_restore() {
reboot_required |= saveSettings(NTP_SETTINGS_FILE, "NTP", input);
reboot_required |= saveSettings(SECURITY_SETTINGS_FILE, "Security", input);
reboot_required |= saveSettings(EMSESP_SETTINGS_FILE, "Settings", input);
reboot_required |= saveSettings(OTA_SETTINGS_FILE, "OTA", input);
} else if (settings_type == "customizations") {
// it's a customization file, just replace it and there's no need to reboot
saveSettings(EMSESP_CUSTOMIZATION_FILE, "Customizations", input);
@@ -1343,13 +1343,6 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
node["tz label"] = settings.tzLabel;
// node["tz format"] = settings.tzFormat;
});
// OTA status
node = output["OTA Info"].to<JsonObject>();
EMSESP::esp8266React.getOTASettingsService()->read([&](OTASettings & settings) {
node["enabled"] = settings.enabled;
node["port"] = settings.port;
});
#endif
// MQTT Status

View File

@@ -225,8 +225,7 @@ class EMSbus {
}
last_bus_activity_ = timestamp;
bus_connected_ = true;
bus_connected_ = true;
}
// return bus uptime in seconds

View File

@@ -181,7 +181,6 @@ void WebAPIService::getSettings(AsyncWebServerRequest * request) {
System::extractSettings(AP_SETTINGS_FILE, "AP", root);
System::extractSettings(MQTT_SETTINGS_FILE, "MQTT", root);
System::extractSettings(NTP_SETTINGS_FILE, "NTP", root);
System::extractSettings(OTA_SETTINGS_FILE, "OTA", root);
System::extractSettings(SECURITY_SETTINGS_FILE, "Security", root);
System::extractSettings(EMSESP_SETTINGS_FILE, "Settings", root);

View File

@@ -20,9 +20,7 @@
namespace emsesp {
WebDataService::WebDataService(AsyncWebServer * server, SecurityManager * securityManager)
{
WebDataService::WebDataService(AsyncWebServer * server, SecurityManager * securityManager) {
// write endpoints
server->on(WRITE_DEVICE_VALUE_SERVICE_PATH,
securityManager->wrapCallback([this](AsyncWebServerRequest * request, JsonVariant json) { write_device_value(request, json); },

View File

@@ -53,8 +53,7 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) {
root["num_analogs"] = EMSESP::analogsensor_.no_sensors();
root["free_heap"] = EMSESP::system_.getHeapMem();
root["uptime"] = uuid::get_uptime_sec();
EMSESP::esp8266React.getOTASettingsService()->read([root](OTASettings & otaSettings) { root["ota_status"] = otaSettings.enabled; });
root["mqtt_status"] = EMSESP::mqtt_.connected();
root["mqtt_status"] = EMSESP::mqtt_.connected();
#ifndef EMSESP_STANDALONE
root["ntp_status"] = [] {