#include "changevaluedisplay_bobbyquickactions.h" // esp-idf includes #include // 3rdparty lib includes #include #include #include #include // local includes #include "utils.h" namespace espgui { namespace { constexpr const char * const TAG = "ESPGUI"; constexpr char TEXT_QUICKACTION_NONE[] = "None"; constexpr char TEXT_QUICKACTION_BLINK_LEFT[] = "Blink Left"; constexpr char TEXT_QUICKACTION_BLINK_RIGHT[] = "Blink Right"; constexpr char TEXT_QUICKACTION_HANDBREMSE[] = "Handbremse"; constexpr char TEXT_QUICKACTION_OPEN_GARAGE[] = "Open Garage"; constexpr char TEXT_QUICKACTION_WIFI_SCAN[] = "Wifi Scan"; constexpr char TEXT_BACK[] = "Back"; } // namespace ChangeValueDisplay::ChangeValueDisplay() { constructMenuItem, StaticText>>(BobbyQuickActions::NONE, *this, *this, *this); constructMenuItem, StaticText>>(BobbyQuickActions::BLINK_LEFT, *this, *this, *this); constructMenuItem, StaticText>>(BobbyQuickActions::BLINK_RIGHT, *this, *this, *this); constructMenuItem, StaticText>>(BobbyQuickActions::HANDBREMSE, *this, *this, *this); constructMenuItem, StaticText>>(BobbyQuickActions::OPEN_GARAGE, *this, *this, *this); constructMenuItem, StaticText>>(BobbyQuickActions::WIFI_SCAN, *this, *this, *this); constructMenuItem, StaticMenuItemIcon<&espgui::icons::back>>>(*this); } void ChangeValueDisplay::start() { Base::start(); switch (const auto value = getValue()) { case BobbyQuickActions::NONE: setSelectedIndex(0); break; case BobbyQuickActions::BLINK_LEFT: setSelectedIndex(1); break; case BobbyQuickActions::BLINK_RIGHT: setSelectedIndex(2); break; case BobbyQuickActions::HANDBREMSE: setSelectedIndex(3); break; case BobbyQuickActions::OPEN_GARAGE: setSelectedIndex(4); break; case BobbyQuickActions::WIFI_SCAN: setSelectedIndex(5); break; default: ESP_LOGW(TAG, "Unknown BobbyQuickActions: %i", std::to_underlying(value)); setSelectedIndex(6); } } } // namespace espgui