diff --git a/software/wordclock/src/src/Iot.cpp b/software/wordclock/src/src/Iot.cpp index 4918321..063e870 100644 --- a/software/wordclock/src/src/Iot.cpp +++ b/software/wordclock/src/src/Iot.cpp @@ -267,7 +267,12 @@ void Iot::updateClockFromParams_() parseColorValue(color_value_, RgbColor(255, 255, 255))); display_->setShowAmPm(parseBooleanValue(show_ampm_value_)); display_->setSensorSentivity(parseNumberValue(ldr_sensitivity_value_, 0, 10, 5)); + + updateClockRTCFromParams_(); +} +void Iot::updateClockRTCFromParams_() +{ if (parseBooleanValue(ntp_enabled_value_)) { maybeSetRTCfromNTP_(); @@ -610,6 +615,7 @@ void Iot::handleConfigSaved_() DLOGLN("Configuration was updated."); if (parseBooleanValue(mqtt_enabled_value_)) { + updateClockRTCFromParams_(); needs_reboot_ = true; } else diff --git a/software/wordclock/src/src/Iot.h b/software/wordclock/src/src/Iot.h index dd263ab..31f18bb 100644 --- a/software/wordclock/src/src/Iot.h +++ b/software/wordclock/src/src/Iot.h @@ -36,6 +36,8 @@ class Iot void clearTransientParams_(); // Updates word clock's state to match the current configuration values. void updateClockFromParams_(); + // Updates the RTC based on current configuration + void updateClockRTCFromParams_(); // Checks for NTP setting and if enabled, attempts to update the RTC. void maybeSetRTCfromNTP_(); // Sets the RTC from manual input