#include "changevaluedisplay_daylightsavingmode.h" // esp-idf includes #include // 3rdparty lib includes #include // local includes #include "actions/setvalueaction.h" #include "actions/backproxyaction.h" #include "icons/back.h" namespace espgui { namespace { constexpr const char * const TAG = "ESPGUI"; constexpr char TEXT_NONE[] = "None"; constexpr char TEXT_EUROPEANSUMMERTIME[] = "EuropeanSummerTime"; constexpr char TEXT_USDAYLIGHTTIME[] = "UsDaylightTime"; constexpr char TEXT_BACK[] = "Back"; } // namespace ChangeValueDisplay::ChangeValueDisplay() { constructMenuItem, StaticText>>(espchrono::DayLightSavingMode::None, *this, *this, *this); constructMenuItem, StaticText>>(espchrono::DayLightSavingMode::EuropeanSummerTime, *this, *this, *this); constructMenuItem, StaticText>>(espchrono::DayLightSavingMode::UsDaylightTime, *this, *this, *this); constructMenuItem, StaticMenuItemIcon<&icons::back>>>(*this); } void ChangeValueDisplay::start() { Base::start(); switch (const auto value = getValue()) { case espchrono::DayLightSavingMode::None: setSelectedIndex(0); break; case espchrono::DayLightSavingMode::EuropeanSummerTime: setSelectedIndex(1); break; case espchrono::DayLightSavingMode::UsDaylightTime: setSelectedIndex(2); break; default: ESP_LOGW(TAG, "Unknown DayLightSavingMode: %i", std::to_underlying(value)); setSelectedIndex(3); } } }