Unfinished button calibration
This commit is contained in:
@ -529,8 +529,6 @@ idf_component_register(
|
|||||||
${dependencies}
|
${dependencies}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(bobbyboardcomputer ${BOBBY_SOURCES} ${BOBBY_HEADERS})
|
|
||||||
|
|
||||||
execute_process(COMMAND git rev-parse HEAD
|
execute_process(COMMAND git rev-parse HEAD
|
||||||
OUTPUT_VARIABLE GIT_REV ERROR_QUIET
|
OUTPUT_VARIABLE GIT_REV ERROR_QUIET
|
||||||
)
|
)
|
||||||
|
@ -17,7 +17,7 @@ namespace {
|
|||||||
constexpr const char TAG[] = "BUTTON";
|
constexpr const char TAG[] = "BUTTON";
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
/*
|
||||||
std::string ButtonCalibrateDisplay::text() const
|
std::string ButtonCalibrateDisplay::text() const
|
||||||
{
|
{
|
||||||
return "Button calibrate";
|
return "Button calibrate";
|
||||||
@ -220,4 +220,4 @@ void ButtonCalibrateDisplay::buttonReleased(espgui::Button button)
|
|||||||
{
|
{
|
||||||
//Base::buttonReleased(button);
|
//Base::buttonReleased(button);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "modeinterface.h"
|
#include "modeinterface.h"
|
||||||
#include "modes/ignoreinputmode.h"
|
#include "modes/ignoreinputmode.h"
|
||||||
|
|
||||||
|
/*
|
||||||
class ButtonCalibrateDisplay : public espgui::DisplayWithTitle
|
class ButtonCalibrateDisplay : public espgui::DisplayWithTitle
|
||||||
{
|
{
|
||||||
using Base = espgui::DisplayWithTitle;
|
using Base = espgui::DisplayWithTitle;
|
||||||
@ -52,4 +52,4 @@ private:
|
|||||||
|
|
||||||
bool m_finished;
|
bool m_finished;
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
@ -106,10 +106,7 @@ void Lockscreen::redraw()
|
|||||||
{
|
{
|
||||||
if (isValid1stPin(m_numbers))
|
if (isValid1stPin(m_numbers))
|
||||||
{
|
{
|
||||||
if (!gas || !brems || *gas > 200.f || *brems > 200.f)
|
espgui::popScreen();
|
||||||
espgui::switchScreen<PotisCalibrateDisplay>(true);
|
|
||||||
else
|
|
||||||
espgui::popScreen();
|
|
||||||
#ifdef LOCKSCREEN_PLUGIN
|
#ifdef LOCKSCREEN_PLUGIN
|
||||||
#include LOCKSCREEN_PLUGIN
|
#include LOCKSCREEN_PLUGIN
|
||||||
LOCKSCREEN_PLUGIN_FIXES_1
|
LOCKSCREEN_PLUGIN_FIXES_1
|
||||||
@ -118,10 +115,7 @@ LOCKSCREEN_PLUGIN_FIXES_1
|
|||||||
}
|
}
|
||||||
else if(isValid2ndPin(m_numbers))
|
else if(isValid2ndPin(m_numbers))
|
||||||
{
|
{
|
||||||
if (!gas || !brems || *gas > 200.f || *brems > 200.f)
|
espgui::popScreen();
|
||||||
espgui::switchScreen<PotisCalibrateDisplay>(true);
|
|
||||||
else
|
|
||||||
espgui::popScreen();
|
|
||||||
#ifdef LOCKSCREEN_PLUGIN_FIXES_2
|
#ifdef LOCKSCREEN_PLUGIN_FIXES_2
|
||||||
LOCKSCREEN_PLUGIN_FIXES_2
|
LOCKSCREEN_PLUGIN_FIXES_2
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "displays/menus/setupquickactionsmenu.h"
|
#include "displays/menus/setupquickactionsmenu.h"
|
||||||
#include "displays/menus/timersmenu.h"
|
#include "displays/menus/timersmenu.h"
|
||||||
#include "displays/potiscalibratedisplay.h"
|
#include "displays/potiscalibratedisplay.h"
|
||||||
|
#include "displays/setupdisplay.h"
|
||||||
#include "icons/lock.h"
|
#include "icons/lock.h"
|
||||||
|
|
||||||
#ifdef FEATURE_JOYSTICK
|
#ifdef FEATURE_JOYSTICK
|
||||||
@ -192,12 +193,12 @@ using namespace espgui;
|
|||||||
BoardcomputerHardwareSettingsMenu::BoardcomputerHardwareSettingsMenu()
|
BoardcomputerHardwareSettingsMenu::BoardcomputerHardwareSettingsMenu()
|
||||||
{
|
{
|
||||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LOCKSCREENSETTINGS>, PushScreenAction<LockscreenSettingsMenu>, StaticMenuItemIcon<&bobbyicons::lock>>>();
|
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LOCKSCREENSETTINGS>, PushScreenAction<LockscreenSettingsMenu>, StaticMenuItemIcon<&bobbyicons::lock>>>();
|
||||||
// constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BUTTONCALIBRATE>, PushScreenAction<ButtonCalibrateDisplay>>>();
|
constructMenuItem<makeComponentArgs<MenuItem, PushSetupDisplayAction, StaticText<TEXT_BUTTONCALIBRATE>>>(SetupStep::BASIC_BUTTONS, true);
|
||||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_EXTRABUTTONCALIBRATE>, PushScreenAction<ExtraButtonCalibrateMenu>>>();
|
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_EXTRABUTTONCALIBRATE>, PushScreenAction<ExtraButtonCalibrateMenu>>>();
|
||||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_QUICKACTIONS>, PushScreenAction<SetupQuickActionsMenu>>>();
|
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_QUICKACTIONS>, PushScreenAction<SetupQuickActionsMenu>>>();
|
||||||
constructMenuItem<makeComponent<MenuItem, GasText, DisabledColor, StaticFont<2>, DummyAction>>();
|
constructMenuItem<makeComponent<MenuItem, GasText, DisabledColor, StaticFont<2>, DummyAction>>();
|
||||||
constructMenuItem<makeComponent<MenuItem, BremsText, DisabledColor, StaticFont<2>, DummyAction>>();
|
constructMenuItem<makeComponent<MenuItem, BremsText, DisabledColor, StaticFont<2>, DummyAction>>();
|
||||||
// constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POTISCALIBRATE>, PushScreenAction<PotisCalibrateDisplay>>>();
|
constructMenuItem<makeComponentArgs<MenuItem, PushSetupDisplayAction, StaticText<TEXT_POTISCALIBRATE>>>(SetupStep::CALIBRATE_POTIS, true);
|
||||||
#ifdef FEATURE_JOYSTICK
|
#ifdef FEATURE_JOYSTICK
|
||||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_JOYSTICK>, PushScreenAction<JoystickDebugDisplay>>>();
|
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_JOYSTICK>, PushScreenAction<JoystickDebugDisplay>>>();
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,7 +16,7 @@ namespace {
|
|||||||
constexpr char TEXT_CALIBRATE[] = "Potis Calibrate";
|
constexpr char TEXT_CALIBRATE[] = "Potis Calibrate";
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
/*
|
||||||
std::string PotisCalibrateDisplay::text() const
|
std::string PotisCalibrateDisplay::text() const
|
||||||
{
|
{
|
||||||
return TEXT_CALIBRATE;
|
return TEXT_CALIBRATE;
|
||||||
@ -321,3 +321,4 @@ void PotisCalibrateDisplay::copyToSettings()
|
|||||||
configs.write_config(configs.bremsMin, m_bremsMin);
|
configs.write_config(configs.bremsMin, m_bremsMin);
|
||||||
configs.write_config(configs.bremsMax, m_bremsMax);
|
configs.write_config(configs.bremsMax, m_bremsMax);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include "modeinterface.h"
|
#include "modeinterface.h"
|
||||||
#include "modes/ignoreinputmode.h"
|
#include "modes/ignoreinputmode.h"
|
||||||
|
|
||||||
|
/*
|
||||||
class PotisCalibrateDisplay : public BobbyDisplayWithTitle
|
class PotisCalibrateDisplay : public BobbyDisplayWithTitle
|
||||||
{
|
{
|
||||||
using Base = BobbyDisplayWithTitle;
|
using Base = BobbyDisplayWithTitle;
|
||||||
@ -91,3 +91,4 @@ private:
|
|||||||
;
|
;
|
||||||
std::optional<float> m_gas, m_brems;
|
std::optional<float> m_gas, m_brems;
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
@ -6,17 +6,31 @@
|
|||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include <tftinstance.h>
|
#include <tftinstance.h>
|
||||||
|
|
||||||
|
// local includes
|
||||||
|
#include "globals.h"
|
||||||
|
|
||||||
using namespace espgui;
|
using namespace espgui;
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
namespace setupdisplay {
|
namespace setupdisplay {
|
||||||
constexpr char const InformationText[] = "Congratulations on your new\nbobbycar! This guide will help\nyou through initial setup,\ncalibrate everything and\nget you ready!";
|
constexpr char const InformationText[] = "Congratulations on your new\nbobbycar! This guide will help\nyou through initial setup,\ncalibrate everything and\nget you ready!";
|
||||||
|
constexpr char const ButtonText[] = "Please press the highlighted\n buttons!";
|
||||||
} // setupdisplay
|
} // setupdisplay
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
constexpr const char * const TAG = "SETUPDISPLAY";
|
||||||
|
} // namespace
|
||||||
|
|
||||||
void SetupDisplay::start()
|
void SetupDisplay::start()
|
||||||
{
|
{
|
||||||
Base::start();
|
Base::start();
|
||||||
m_menu_opened_timestamp = espchrono::millis_clock::now();
|
m_menu_opened_timestamp = espchrono::millis_clock::now();
|
||||||
|
|
||||||
|
m_oldMode = currentMode;
|
||||||
|
currentMode = &m_mode;
|
||||||
|
m_lastButton = std::nullopt;
|
||||||
|
m_button_cal_status = setupdisplay::LEFT;
|
||||||
|
m_button_cal_finished = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupDisplay::initScreen()
|
void SetupDisplay::initScreen()
|
||||||
@ -27,15 +41,22 @@ void SetupDisplay::initScreen()
|
|||||||
void SetupDisplay::update()
|
void SetupDisplay::update()
|
||||||
{
|
{
|
||||||
Base::update();
|
Base::update();
|
||||||
|
|
||||||
|
switch(m_current_setupStep)
|
||||||
|
{
|
||||||
|
case SetupStep::BASIC_BUTTONS:
|
||||||
|
break;
|
||||||
|
default:;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupDisplay::redraw()
|
void SetupDisplay::redraw()
|
||||||
{
|
{
|
||||||
Base::redraw();
|
Base::redraw();
|
||||||
|
|
||||||
if (m_current_setupStep != m_last_setupStep || initialRender)
|
if (m_current_setupStep != m_last_setupStep || m_initialRender)
|
||||||
{
|
{
|
||||||
initialRender = false;
|
m_initialRender = false;
|
||||||
m_last_setupStep = m_current_setupStep;
|
m_last_setupStep = m_current_setupStep;
|
||||||
|
|
||||||
switch(m_current_setupStep)
|
switch(m_current_setupStep)
|
||||||
@ -44,7 +65,9 @@ void SetupDisplay::redraw()
|
|||||||
drawLargeText(setupdisplay::InformationText);
|
drawLargeText(setupdisplay::InformationText);
|
||||||
break;
|
break;
|
||||||
case SetupStep::BASIC_BUTTONS:
|
case SetupStep::BASIC_BUTTONS:
|
||||||
clearLargeText();
|
clearArea();
|
||||||
|
drawLargeText(setupdisplay::ButtonText);
|
||||||
|
drawButtons(m_button_cal_status);
|
||||||
break;
|
break;
|
||||||
case SetupStep::CALIBRATE_POTIS:
|
case SetupStep::CALIBRATE_POTIS:
|
||||||
break;
|
break;
|
||||||
@ -70,13 +93,99 @@ void SetupDisplay::redraw()
|
|||||||
void SetupDisplay::stop()
|
void SetupDisplay::stop()
|
||||||
{
|
{
|
||||||
Base::stop();
|
Base::stop();
|
||||||
|
|
||||||
|
if (currentMode == &m_mode)
|
||||||
|
{
|
||||||
|
// to avoid crash after deconstruction
|
||||||
|
m_mode.stop();
|
||||||
|
lastMode = nullptr;
|
||||||
|
|
||||||
|
currentMode = m_oldMode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupDisplay::buttonPressed(espgui::Button button)
|
void SetupDisplay::buttonPressed(espgui::Button button)
|
||||||
{
|
{
|
||||||
|
if (m_current_setupStep == SetupStep::BASIC_BUTTONS)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Base::buttonPressed(button);
|
Base::buttonPressed(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetupDisplay::buttonReleased(espgui::Button button)
|
||||||
|
{
|
||||||
|
if (m_current_setupStep == SetupStep::BASIC_BUTTONS)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Base::buttonReleased(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetupDisplay::rawButtonPressed(uint8_t button)
|
||||||
|
{
|
||||||
|
Base::rawButtonPressed(button);
|
||||||
|
|
||||||
|
if (m_current_setupStep != SetupStep::BASIC_BUTTONS)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_button_cal_status == setupdisplay::FINISHED)
|
||||||
|
{
|
||||||
|
if (button == m_rightButton)
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "correct button");
|
||||||
|
m_button_cal_finished = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ESP_LOGI(TAG, "wrong button");
|
||||||
|
}
|
||||||
|
else if (!m_lastButton || *m_lastButton != button)
|
||||||
|
m_lastButton = button;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (m_button_cal_status)
|
||||||
|
{
|
||||||
|
case setupdisplay::LEFT:
|
||||||
|
m_leftButton = button;
|
||||||
|
m_lastButton = std::nullopt;
|
||||||
|
m_button_cal_status = setupdisplay::RIGHT;
|
||||||
|
break;
|
||||||
|
case setupdisplay::RIGHT:
|
||||||
|
m_rightButton = button;
|
||||||
|
m_lastButton = std::nullopt;
|
||||||
|
m_button_cal_status = setupdisplay::UP;
|
||||||
|
break;
|
||||||
|
case setupdisplay::UP:
|
||||||
|
m_upButton = button;
|
||||||
|
m_lastButton = std::nullopt;
|
||||||
|
m_button_cal_status = setupdisplay::DOWN;
|
||||||
|
break;
|
||||||
|
case setupdisplay::DOWN:
|
||||||
|
m_downButton = button;
|
||||||
|
m_lastButton = std::nullopt;
|
||||||
|
m_button_cal_status = setupdisplay::FINISHED;
|
||||||
|
break;
|
||||||
|
case setupdisplay::FINISHED:;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
drawButtons(m_button_cal_status);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetupDisplay::saveButtons()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetupDisplay::rawButtonReleased(uint8_t button)
|
||||||
|
{
|
||||||
|
// Base::rawButtonReleased(button);
|
||||||
|
}
|
||||||
|
|
||||||
std::string SetupDisplay::text() const
|
std::string SetupDisplay::text() const
|
||||||
{
|
{
|
||||||
switch (m_current_setupStep)
|
switch (m_current_setupStep)
|
||||||
@ -164,7 +273,61 @@ void SetupDisplay::nextStep()
|
|||||||
ESP_LOGI("SetupDisplay", "nextStep after (%s)", toString(m_current_setupStep).c_str());
|
ESP_LOGI("SetupDisplay", "nextStep after (%s)", toString(m_current_setupStep).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupDisplay::clearLargeText()
|
void SetupDisplay::clearArea()
|
||||||
{
|
{
|
||||||
tft.fillRect(0, 50, tft.width(), tft.height()-50, TFT_BLACK);
|
tft.fillRect(0, 50, tft.width(), tft.height()-50, TFT_BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetupDisplay::drawButtons(setupdisplay::CurrentButton button)
|
||||||
|
{
|
||||||
|
const int16_t x_mid = tft.width() / 2;
|
||||||
|
const int16_t y_mid = tft.height() / 2;
|
||||||
|
|
||||||
|
const auto offset = 40;
|
||||||
|
const auto radius = 15;
|
||||||
|
const auto subtract = 2;
|
||||||
|
|
||||||
|
const auto up_x = x_mid;
|
||||||
|
const auto up_y = y_mid - offset;
|
||||||
|
|
||||||
|
const auto down_x = x_mid;
|
||||||
|
const auto down_y = y_mid + offset;
|
||||||
|
|
||||||
|
const auto left_x = x_mid - offset;
|
||||||
|
const auto left_y = y_mid;
|
||||||
|
|
||||||
|
const auto right_x = x_mid + offset;
|
||||||
|
const auto right_y = y_mid;
|
||||||
|
|
||||||
|
tft.fillCircle(up_x, up_y, radius-subtract, TFT_BLACK);
|
||||||
|
tft.fillCircle(down_x, down_y, radius-subtract, TFT_BLACK);
|
||||||
|
tft.fillCircle(left_x, left_y, radius-subtract, TFT_BLACK);
|
||||||
|
tft.fillCircle(right_x, right_y, radius-subtract, TFT_BLACK);
|
||||||
|
|
||||||
|
tft.drawCircle(up_x, up_y, radius, TFT_WHITE);
|
||||||
|
tft.drawCircle(down_x, down_y, radius, TFT_WHITE);
|
||||||
|
tft.drawCircle(left_x, left_y, radius, TFT_WHITE);
|
||||||
|
tft.drawCircle(right_x, right_y, radius, TFT_WHITE);
|
||||||
|
|
||||||
|
switch(button)
|
||||||
|
{
|
||||||
|
case setupdisplay::UP:
|
||||||
|
tft.fillCircle(up_x, up_y, radius-subtract, m_lastButton ? TFT_YELLOW : TFT_WHITE);
|
||||||
|
break;
|
||||||
|
case setupdisplay::DOWN:
|
||||||
|
tft.fillCircle(down_x, down_y, radius-subtract, m_lastButton ? TFT_YELLOW : TFT_WHITE);
|
||||||
|
break;
|
||||||
|
case setupdisplay::LEFT:
|
||||||
|
tft.fillCircle(left_x, left_y, radius-subtract, m_lastButton ? TFT_YELLOW : TFT_WHITE);
|
||||||
|
break;
|
||||||
|
case setupdisplay::RIGHT:
|
||||||
|
tft.fillCircle(right_x, right_y, radius-subtract, m_lastButton ? TFT_YELLOW : TFT_WHITE);
|
||||||
|
break;
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_button_cal_status == setupdisplay::FINISHED)
|
||||||
|
{
|
||||||
|
tft.fillCircle(right_x, right_y, radius-subtract, TFT_GREEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -2,13 +2,18 @@
|
|||||||
|
|
||||||
// system includes
|
// system includes
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
|
#include <actioninterface.h>
|
||||||
#include <espchrono.h>
|
#include <espchrono.h>
|
||||||
|
#include <screenmanager.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "bobbydisplaywithtitle.h"
|
#include "bobbydisplaywithtitle.h"
|
||||||
#include "bobbytypesafeenum.h"
|
#include "bobbytypesafeenum.h"
|
||||||
|
#include "modeinterface.h"
|
||||||
|
#include "modes/ignoreinputmode.h"
|
||||||
|
|
||||||
#define SetupStepValues(x) \
|
#define SetupStepValues(x) \
|
||||||
x(INFORMATION) \
|
x(INFORMATION) \
|
||||||
@ -22,13 +27,25 @@
|
|||||||
|
|
||||||
DECLARE_BOBBYTYPESAFE_ENUM(SetupStep, : uint8_t, SetupStepValues);
|
DECLARE_BOBBYTYPESAFE_ENUM(SetupStep, : uint8_t, SetupStepValues);
|
||||||
|
|
||||||
|
namespace setupdisplay {
|
||||||
|
enum CurrentButton : int8_t
|
||||||
|
{
|
||||||
|
UP,
|
||||||
|
DOWN,
|
||||||
|
LEFT,
|
||||||
|
RIGHT,
|
||||||
|
FINISHED
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
class SetupDisplay : public BobbyDisplayWithTitle
|
class SetupDisplay : public BobbyDisplayWithTitle
|
||||||
{
|
{
|
||||||
using Base = BobbyDisplayWithTitle;
|
using Base = BobbyDisplayWithTitle;
|
||||||
public:
|
public:
|
||||||
explicit SetupDisplay(SetupStep initialStep = SetupStep::INFORMATION) :
|
explicit SetupDisplay(SetupStep initialStep = SetupStep::INFORMATION, bool early_return = false) :
|
||||||
m_current_setupStep{initialStep},
|
m_current_setupStep{initialStep},
|
||||||
m_last_setupStep{initialStep}
|
m_last_setupStep{initialStep},
|
||||||
|
m_early_return{early_return}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
@ -37,16 +54,48 @@ public:
|
|||||||
void update() override;
|
void update() override;
|
||||||
void stop() override;
|
void stop() override;
|
||||||
|
|
||||||
|
void rawButtonPressed(uint8_t button) override;
|
||||||
|
void rawButtonReleased(uint8_t button) override;
|
||||||
void buttonPressed(espgui::Button button) override;
|
void buttonPressed(espgui::Button button) override;
|
||||||
|
void buttonReleased(espgui::Button button) override;
|
||||||
|
|
||||||
std::string text() const override;
|
std::string text() const override;
|
||||||
private:
|
private:
|
||||||
SetupStep m_current_setupStep;
|
SetupStep m_current_setupStep;
|
||||||
SetupStep m_last_setupStep;
|
SetupStep m_last_setupStep;
|
||||||
espchrono::millis_clock::time_point m_menu_opened_timestamp;
|
espchrono::millis_clock::time_point m_menu_opened_timestamp;
|
||||||
bool initialRender{true};
|
bool m_initialRender{true};
|
||||||
|
const bool m_early_return;
|
||||||
|
|
||||||
static void drawLargeText(const std::string&& text);
|
static void drawLargeText(const std::string&& text);
|
||||||
static void clearLargeText();
|
static void clearArea();
|
||||||
|
void drawButtons(setupdisplay::CurrentButton button);
|
||||||
void nextStep();
|
void nextStep();
|
||||||
|
|
||||||
|
// button calibration
|
||||||
|
ModeInterface *m_oldMode;
|
||||||
|
IgnoreInputMode m_mode{0, bobbycar::protocol::ControlType::FieldOrientedControl, bobbycar::protocol::ControlMode::Torque};
|
||||||
|
|
||||||
|
std::optional<uint8_t> m_lastButton;
|
||||||
|
|
||||||
|
setupdisplay::CurrentButton m_button_cal_status;
|
||||||
|
uint8_t m_leftButton, m_rightButton, m_upButton, m_downButton;
|
||||||
|
bool m_button_cal_finished;
|
||||||
|
void saveButtons();
|
||||||
|
};
|
||||||
|
|
||||||
|
class PushSetupDisplayAction : public virtual espgui::ActionInterface {
|
||||||
|
public:
|
||||||
|
explicit PushSetupDisplayAction(SetupStep setupStep, bool early_return = false) :
|
||||||
|
m_setupStep{setupStep},
|
||||||
|
m_early_return{early_return}
|
||||||
|
{}
|
||||||
|
|
||||||
|
void triggered() override
|
||||||
|
{
|
||||||
|
espgui::pushScreen<SetupDisplay>(m_setupStep, m_early_return);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
const SetupStep m_setupStep;
|
||||||
|
const bool m_early_return;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user