#include "changevaluedisplay_controltype.h" // system includes #include // esp-idf includes #include // 3rdparty lib includes #include #include #include // local includes #include "utils.h" namespace espgui { namespace { constexpr const char * const TAG = "ESPGUI"; constexpr char TEXT_COMMUTATION[] = "Commutation"; constexpr char TEXT_SINUSOIDAL[] = "Sinusoidal"; constexpr char TEXT_FIELDORIENTEDCONTROL[] = "Field oriented control"; constexpr char TEXT_BACK[] = "Back"; } // namespace ChangeValueDisplay::ChangeValueDisplay() { using bobbycar::protocol::ControlType; constructMenuItem, StaticText>>(ControlType::Commutation, *this, *this, *this); constructMenuItem, StaticText>>(ControlType::Sinusoidal, *this, *this, *this); constructMenuItem, StaticText>>(ControlType::FieldOrientedControl, *this, *this, *this); constructMenuItem, StaticMenuItemIcon<&espgui::icons::back>>>(*this); } void ChangeValueDisplay::start() { Base::start(); switch (const auto value = getValue()) { using bobbycar::protocol::ControlType; case ControlType::Commutation: setSelectedIndex(0); break; case ControlType::Sinusoidal: setSelectedIndex(1); break; case ControlType::FieldOrientedControl: setSelectedIndex(2); break; default: ESP_LOGW(TAG, "Unknown ControlType: %i", std::to_underlying(value)); setSelectedIndex(3); } } } // namespace espgui