Cleanups
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -58,3 +58,6 @@
|
|||||||
[submodule "components/esp-gui-lib"]
|
[submodule "components/esp-gui-lib"]
|
||||||
path = components/esp-gui-lib
|
path = components/esp-gui-lib
|
||||||
url = ../../0xFEEDC0DE64/esp-gui-lib.git
|
url = ../../0xFEEDC0DE64/esp-gui-lib.git
|
||||||
|
[submodule "components/espconfiglib"]
|
||||||
|
path = components/espconfiglib
|
||||||
|
url = ../../0xFEEDC0DE64/espconfiglib.git
|
||||||
|
Submodule components/esp-gui-lib updated: 1bf5aec0fd...aad3fcedcb
1
components/espconfiglib
Submodule
1
components/espconfiglib
Submodule
Submodule components/espconfiglib added at 6c79bf7fee
@@ -30,6 +30,7 @@ set(headers
|
|||||||
globals.h
|
globals.h
|
||||||
ledstripdefines.h
|
ledstripdefines.h
|
||||||
ledstrip.h
|
ledstrip.h
|
||||||
|
newsettings.h
|
||||||
macros_bobbycar.h
|
macros_bobbycar.h
|
||||||
modeinterface.h
|
modeinterface.h
|
||||||
ota.h
|
ota.h
|
||||||
@@ -59,6 +60,7 @@ set(headers
|
|||||||
accessors/globalaccessors.h
|
accessors/globalaccessors.h
|
||||||
accessors/settingsaccessors.h
|
accessors/settingsaccessors.h
|
||||||
accessors/wifiaccessors.h
|
accessors/wifiaccessors.h
|
||||||
|
actions/assertaction.h
|
||||||
actions/bluetoothbeginaction.h
|
actions/bluetoothbeginaction.h
|
||||||
actions/bluetoothbeginmasteraction.h
|
actions/bluetoothbeginmasteraction.h
|
||||||
actions/bluetoothconnectbmsaction.h
|
actions/bluetoothconnectbmsaction.h
|
||||||
@@ -69,6 +71,7 @@ set(headers
|
|||||||
actions/bmsturnoffdischargeaction.h
|
actions/bmsturnoffdischargeaction.h
|
||||||
actions/bmsturnonchargeaction.h
|
actions/bmsturnonchargeaction.h
|
||||||
actions/bmsturnondischargeaction.h
|
actions/bmsturnondischargeaction.h
|
||||||
|
actions/dividebyzeroaction.h
|
||||||
actions/erasenvsaction.h
|
actions/erasenvsaction.h
|
||||||
actions/ledstripanimationactions.h
|
actions/ledstripanimationactions.h
|
||||||
actions/ledstripblinkactions.h
|
actions/ledstripblinkactions.h
|
||||||
@@ -91,6 +94,7 @@ set(headers
|
|||||||
displays/gametrakcalibratedisplay.h
|
displays/gametrakcalibratedisplay.h
|
||||||
displays/garagedisplay.h
|
displays/garagedisplay.h
|
||||||
displays/graphdisplay.h
|
displays/graphdisplay.h
|
||||||
|
displays/ledstripcolorsdisplay.h
|
||||||
displays/lockscreen.h
|
displays/lockscreen.h
|
||||||
displays/menus/aboutmenu.h
|
displays/menus/aboutmenu.h
|
||||||
displays/menus/accesspointwifisettingsmenu.h
|
displays/menus/accesspointwifisettingsmenu.h
|
||||||
@@ -116,7 +120,6 @@ set(headers
|
|||||||
displays/menus/invertmenu.h
|
displays/menus/invertmenu.h
|
||||||
displays/menus/larsmmodesettingsmenu.h
|
displays/menus/larsmmodesettingsmenu.h
|
||||||
displays/menus/ledstripmenu.h
|
displays/menus/ledstripmenu.h
|
||||||
displays/menus/ledstripcolorsmenu.h
|
|
||||||
displays/menus/ledstripselectanimationmenu.h
|
displays/menus/ledstripselectanimationmenu.h
|
||||||
displays/menus/ledstripselectblinkmenu.h
|
displays/menus/ledstripselectblinkmenu.h
|
||||||
displays/menus/limitssettingsmenu.h
|
displays/menus/limitssettingsmenu.h
|
||||||
@@ -211,6 +214,7 @@ set(sources
|
|||||||
globals.cpp
|
globals.cpp
|
||||||
ledstrip.cpp
|
ledstrip.cpp
|
||||||
ledstripdefines.cpp
|
ledstripdefines.cpp
|
||||||
|
newsettings.cpp
|
||||||
macros_bobbycar.cpp
|
macros_bobbycar.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
modeinterface.cpp
|
modeinterface.cpp
|
||||||
@@ -241,6 +245,7 @@ set(sources
|
|||||||
accessors/globalaccessors.cpp
|
accessors/globalaccessors.cpp
|
||||||
accessors/settingsaccessors.cpp
|
accessors/settingsaccessors.cpp
|
||||||
accessors/wifiaccessors.cpp
|
accessors/wifiaccessors.cpp
|
||||||
|
actions/assertaction.cpp
|
||||||
actions/bluetoothbeginaction.cpp
|
actions/bluetoothbeginaction.cpp
|
||||||
actions/bluetoothbeginmasteraction.cpp
|
actions/bluetoothbeginmasteraction.cpp
|
||||||
actions/bluetoothconnectbmsaction.cpp
|
actions/bluetoothconnectbmsaction.cpp
|
||||||
@@ -251,6 +256,7 @@ set(sources
|
|||||||
actions/bmsturnoffdischargeaction.cpp
|
actions/bmsturnoffdischargeaction.cpp
|
||||||
actions/bmsturnonchargeaction.cpp
|
actions/bmsturnonchargeaction.cpp
|
||||||
actions/bmsturnondischargeaction.cpp
|
actions/bmsturnondischargeaction.cpp
|
||||||
|
actions/dividebyzeroaction.cpp
|
||||||
actions/erasenvsaction.cpp
|
actions/erasenvsaction.cpp
|
||||||
actions/ledstripanimationactions.cpp
|
actions/ledstripanimationactions.cpp
|
||||||
actions/ledstripblinkactions.cpp
|
actions/ledstripblinkactions.cpp
|
||||||
@@ -273,6 +279,7 @@ set(sources
|
|||||||
displays/gametrakcalibratedisplay.cpp
|
displays/gametrakcalibratedisplay.cpp
|
||||||
displays/garagedisplay.cpp
|
displays/garagedisplay.cpp
|
||||||
displays/graphdisplay.cpp
|
displays/graphdisplay.cpp
|
||||||
|
displays/ledstripcolorsdisplay.cpp
|
||||||
displays/lockscreen.cpp
|
displays/lockscreen.cpp
|
||||||
displays/menus/aboutmenu.cpp
|
displays/menus/aboutmenu.cpp
|
||||||
displays/menus/accesspointwifisettingsmenu.cpp
|
displays/menus/accesspointwifisettingsmenu.cpp
|
||||||
@@ -362,7 +369,7 @@ set(dependencies
|
|||||||
libsodium freertos nvs_flash esp_http_server esp_https_ota mdns app_update esp_system esp_websocket_client driver
|
libsodium freertos nvs_flash esp_http_server esp_https_ota mdns app_update esp_system esp_websocket_client driver
|
||||||
arduino-esp32 ArduinoJson esp-nimble-cpp FastLED-idf TFT_eSPI
|
arduino-esp32 ArduinoJson esp-nimble-cpp FastLED-idf TFT_eSPI
|
||||||
bobbycar-protocol cpputils cxx-ring-buffer date
|
bobbycar-protocol cpputils cxx-ring-buffer date
|
||||||
espasynchttpreq espasyncota espchrono espcpputils esp-gui-lib esphttpdutils espwifistack expected fmt
|
espasynchttpreq espasyncota espchrono espcpputils espconfiglib esp-gui-lib esphttpdutils espwifistack expected fmt
|
||||||
)
|
)
|
||||||
|
|
||||||
idf_component_register(
|
idf_component_register(
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
#include "globalaccessors.h"
|
||||||
|
@@ -5,14 +5,8 @@
|
|||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "modes/tempomatmode.h"
|
#include "modes/tempomatmode.h"
|
||||||
|
|
||||||
using namespace espgui;
|
struct AvgSpeedAccessor : public espgui::RefAccessor<float> { float &getRef() const override { return avgSpeed; } };
|
||||||
|
struct AvgSpeedKmhAccessor : public espgui::RefAccessor<float> { float &getRef() const override { return avgSpeedKmh; } };
|
||||||
|
struct SumCurrentAccessor : public espgui::RefAccessor<float> { float &getRef() const override { return sumCurrent; } };
|
||||||
|
|
||||||
namespace {
|
struct TempomatModeCruiseMotTgtAccessor : public espgui::RefAccessor<int16_t> { int16_t &getRef() const override { return modes::tempomatMode.nCruiseMotTgt; } };
|
||||||
|
|
||||||
struct AvgSpeedAccessor : public RefAccessor<float> { float &getRef() const override { return avgSpeed; } };
|
|
||||||
struct AvgSpeedKmhAccessor : public RefAccessor<float> { float &getRef() const override { return avgSpeedKmh; } };
|
|
||||||
struct SumCurrentAccessor : public RefAccessor<float> { float &getRef() const override { return sumCurrent; } };
|
|
||||||
|
|
||||||
struct TempomatModeCruiseMotTgtAccessor : public RefAccessor<int16_t> { int16_t &getRef() const override { return modes::tempomatMode.nCruiseMotTgt; } };
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
#include "settingsaccessors.h"
|
||||||
|
@@ -1,18 +1,17 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// 3rdparty lib includes
|
||||||
|
#include <accessorinterface.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "accessorinterface.h"
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
using namespace espgui;
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
//! Special type of RefAccessor that also saves settings after setValue()
|
//! Special type of RefAccessor that also saves settings after setValue()
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct RefAccessorSaveSettings : public virtual RefAccessor<T>
|
struct RefAccessorSaveSettings : public virtual espgui::RefAccessor<T>
|
||||||
{
|
{
|
||||||
void setValue(T value) override { RefAccessor<T>::setValue(value); saveSettings(); };
|
void setValue(T value) override { espgui::RefAccessor<T>::setValue(value); saveSettings(); };
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
@@ -26,7 +25,7 @@ struct ReverseBeepDuration1Accessor : public RefAccessorSaveSettings<int16_t> {
|
|||||||
|
|
||||||
struct IMotMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.iMotMax; } };
|
struct IMotMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.iMotMax; } };
|
||||||
struct IDcMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.iDcMax; } };
|
struct IDcMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.iDcMax; } };
|
||||||
struct NMotMaxKmhAccessor : public virtual AccessorInterface<int16_t>
|
struct NMotMaxKmhAccessor : public virtual espgui::AccessorInterface<int16_t>
|
||||||
{
|
{
|
||||||
int16_t getValue() const override { return convertToKmh(settings.limits.nMotMax); }
|
int16_t getValue() const override { return convertToKmh(settings.limits.nMotMax); }
|
||||||
void setValue(int16_t value) override { settings.limits.nMotMax = convertFromKmh(value); saveSettings(); }
|
void setValue(int16_t value) override { settings.limits.nMotMax = convertFromKmh(value); saveSettings(); }
|
||||||
@@ -50,7 +49,7 @@ struct CloudEnabledAccessor : public RefAccessorSaveSettings<bool> { bool &getRe
|
|||||||
struct CloudTransmitTimeoutAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.cloudSettings.cloudTransmitTimeout; } };
|
struct CloudTransmitTimeoutAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.cloudSettings.cloudTransmitTimeout; } };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct TimezoneOffsetAccessor : public virtual AccessorInterface<int32_t>
|
struct TimezoneOffsetAccessor : public virtual espgui::AccessorInterface<int32_t>
|
||||||
{
|
{
|
||||||
int32_t getValue() const override { return settings.timeSettings.timezoneOffset.count(); }
|
int32_t getValue() const override { return settings.timeSettings.timezoneOffset.count(); }
|
||||||
void setValue(int32_t value) override { settings.timeSettings.timezoneOffset = espchrono::minutes32{value}; saveSettings(); }
|
void setValue(int32_t value) override { settings.timeSettings.timezoneOffset = espchrono::minutes32{value}; saveSettings(); }
|
||||||
@@ -59,7 +58,7 @@ struct DaylightSavingModeAccessor : public RefAccessorSaveSettings<espchrono::Da
|
|||||||
#ifdef FEATURE_NTP
|
#ifdef FEATURE_NTP
|
||||||
struct TimeServerEnabledAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.timeSettings.timeServerEnabled; } };
|
struct TimeServerEnabledAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.timeSettings.timeServerEnabled; } };
|
||||||
struct TimeSyncModeAccessor : public RefAccessorSaveSettings<sntp_sync_mode_t> { sntp_sync_mode_t &getRef() const override { return settings.timeSettings.timeSyncMode; } };
|
struct TimeSyncModeAccessor : public RefAccessorSaveSettings<sntp_sync_mode_t> { sntp_sync_mode_t &getRef() const override { return settings.timeSettings.timeSyncMode; } };
|
||||||
struct TimeSyncIntervalAccessor : public virtual AccessorInterface<int32_t>
|
struct TimeSyncIntervalAccessor : public virtual espgui::AccessorInterface<int32_t>
|
||||||
{
|
{
|
||||||
int32_t getValue() const override { return settings.timeSettings.timeSyncInterval.count(); }
|
int32_t getValue() const override { return settings.timeSettings.timeSyncInterval.count(); }
|
||||||
void setValue(int32_t value) override { settings.timeSettings.timeSyncInterval = espchrono::milliseconds32{value}; saveSettings(); }
|
void setValue(int32_t value) override { settings.timeSettings.timeSyncInterval = espchrono::milliseconds32{value}; saveSettings(); }
|
||||||
@@ -77,7 +76,7 @@ struct BackLeftInvertedAccessor : public RefAccessorSaveSettings<bool> { bool &g
|
|||||||
struct BackRightInvertedAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.invertBackRight; } };
|
struct BackRightInvertedAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.invertBackRight; } };
|
||||||
|
|
||||||
struct WheelDiameterMmAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.controllerHardware.wheelDiameter; } };
|
struct WheelDiameterMmAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.controllerHardware.wheelDiameter; } };
|
||||||
struct WheelDiameterInchAccessor : public virtual AccessorInterface<float>
|
struct WheelDiameterInchAccessor : public virtual espgui::AccessorInterface<float>
|
||||||
{
|
{
|
||||||
float getValue() const override { return convertToInch(settings.controllerHardware.wheelDiameter); }
|
float getValue() const override { return convertToInch(settings.controllerHardware.wheelDiameter); }
|
||||||
void setValue(float value) override { settings.controllerHardware.wheelDiameter = convertFromInch(value); saveSettings(); }
|
void setValue(float value) override { settings.controllerHardware.wheelDiameter = convertFromInch(value); saveSettings(); }
|
||||||
@@ -183,4 +182,3 @@ struct BatteryApplyCalibrationAccessor : public RefAccessorSaveSettings<bool> {
|
|||||||
struct LockscreenAllowPresetSwitchAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.lockscreen.allowPresetSwitch; } };
|
struct LockscreenAllowPresetSwitchAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.lockscreen.allowPresetSwitch; } };
|
||||||
template<uint8_t index>
|
template<uint8_t index>
|
||||||
struct LockscreenPinDigitAccessor : public RefAccessorSaveSettings<int8_t> { int8_t &getRef() const override { return settings.lockscreen.pin[index]; } };
|
struct LockscreenPinDigitAccessor : public RefAccessorSaveSettings<int8_t> { int8_t &getRef() const override { return settings.lockscreen.pin[index]; } };
|
||||||
}
|
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
#include "wifiaccessors.h"
|
||||||
|
@@ -2,8 +2,3 @@
|
|||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "accessorinterface.h"
|
#include "accessorinterface.h"
|
||||||
|
|
||||||
using namespace espgui;
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
}
|
|
||||||
|
9
main/actions/assertaction.cpp
Normal file
9
main/actions/assertaction.cpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include "assertaction.h"
|
||||||
|
|
||||||
|
// system includes
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
void AssertAction::triggered()
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
10
main/actions/assertaction.h
Normal file
10
main/actions/assertaction.h
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// 3rdparty lib includes
|
||||||
|
#include "actioninterface.h"
|
||||||
|
|
||||||
|
class AssertAction : public virtual espgui::ActionInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void triggered() override;
|
||||||
|
};
|
12
main/actions/dividebyzeroaction.cpp
Normal file
12
main/actions/dividebyzeroaction.cpp
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#include "dividebyzeroaction.h"
|
||||||
|
|
||||||
|
// esp-idf includes
|
||||||
|
#include <esp_log.h>
|
||||||
|
|
||||||
|
void DivideByZeroAction::triggered()
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
i--;
|
||||||
|
int goodbye = 42 / i;
|
||||||
|
ESP_LOGW("BOBBY", "divide by zero %i", goodbye);
|
||||||
|
}
|
10
main/actions/dividebyzeroaction.h
Normal file
10
main/actions/dividebyzeroaction.h
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// 3rdparty lib includes
|
||||||
|
#include "actioninterface.h"
|
||||||
|
|
||||||
|
class DivideByZeroAction : public virtual espgui::ActionInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void triggered() override;
|
||||||
|
};
|
0
main/displays/ledstripcolorsdisplay.cpp
Normal file
0
main/displays/ledstripcolorsdisplay.cpp
Normal file
@@ -1,31 +1,31 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// esp-idf includes
|
||||||
|
#include <esp_log.h>
|
||||||
|
|
||||||
|
// 3rdparty lib includes
|
||||||
#include <TFT_eSPI.h>
|
#include <TFT_eSPI.h>
|
||||||
#include <FastLED.h>
|
#include <FastLED.h>
|
||||||
#include <cpputils.h>
|
#include <cpputils.h>
|
||||||
|
#include <menuitem.h>
|
||||||
|
#include <actions/switchscreenaction.h>
|
||||||
|
#include <actioninterface.h>
|
||||||
|
|
||||||
// Local includes
|
// local includes
|
||||||
#include "menudisplay.h"
|
#include "menudisplay.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "menuitem.h"
|
|
||||||
#include "ledstrip.h"
|
#include "ledstrip.h"
|
||||||
#include "icons/back.h"
|
#include "icons/back.h"
|
||||||
#include "icons/bobbycar.h"
|
#include "icons/bobbycar.h"
|
||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
#include "actions/dummyaction.h"
|
#include "actions/dummyaction.h"
|
||||||
#include "actions/switchscreenaction.h"
|
|
||||||
#include "actioninterface.h"
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "esp_log.h"
|
|
||||||
|
|
||||||
using namespace espgui;
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class LedstripMenu;
|
class LedstripMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
static int8_t selected_side = 7;
|
static int8_t selected_side = 7;
|
||||||
static int8_t selected_color;
|
static int8_t selected_color;
|
||||||
bool state_select_color{false};
|
bool state_select_color{false};
|
||||||
@@ -53,46 +53,56 @@ const std::array<uint16_t, 8> tft_colors = {
|
|||||||
TFT_MAGENTA
|
TFT_MAGENTA
|
||||||
};
|
};
|
||||||
|
|
||||||
class LedstripColorsMenuBackAction : ActionInterface
|
class LedstripColorsDisplay : public espgui::DisplayWithTitle
|
||||||
{
|
{
|
||||||
public:
|
using Base = espgui::DisplayWithTitle;
|
||||||
void triggered() {
|
|
||||||
if(!state_select_color)
|
|
||||||
{
|
|
||||||
switchScreen<LedstripMenu>();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
state_select_color = false;
|
|
||||||
tft.fillRect(0, 228, tft.width(), ((tft.width() - 40) / 8) + 4, TFT_BLACK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class LedstripColorsMenu :
|
|
||||||
public MenuDisplay,
|
|
||||||
public StaticText<TEXT_LEDSTRIPCOLORMENU>,
|
|
||||||
public BackActionInterface<LedstripColorsMenuBackAction>
|
|
||||||
{
|
|
||||||
using Base = MenuDisplay;
|
|
||||||
public:
|
public:
|
||||||
|
std::string text() const override;
|
||||||
|
void back() override;
|
||||||
|
void initScreen() override;
|
||||||
void redraw() override;
|
void redraw() override;
|
||||||
void rotate(int offset) override;
|
void rotate(int offset) override;
|
||||||
void confirm() override;
|
void confirm() override;
|
||||||
|
|
||||||
void drawColors();
|
void drawColors();
|
||||||
void drawSide(Bobbycar_Side side, unsigned int color);
|
void drawSide(Bobbycar_Side side, unsigned int color);
|
||||||
void clearSides();
|
void clearSides();
|
||||||
LedstripColorsMenu() {}
|
|
||||||
private:
|
private:
|
||||||
bool already_drew_circle{false};
|
bool already_drew_circle{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
void LedstripColorsMenu::redraw()
|
std::string LedstripColorsDisplay::text() const
|
||||||
{
|
{
|
||||||
Base::redraw();
|
return TEXT_LEDSTRIPCOLORMENU;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LedstripColorsDisplay::back()
|
||||||
|
{
|
||||||
|
if(!state_select_color)
|
||||||
|
{
|
||||||
|
switchScreen<LedstripMenu>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
state_select_color = false;
|
||||||
|
tft.fillRect(0, 228, tft.width(), ((tft.width() - 40) / 8) + 4, TFT_BLACK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LedstripColorsDisplay::initScreen()
|
||||||
|
{
|
||||||
|
Base::initScreen();
|
||||||
|
|
||||||
tft.setSwapBytes(true);
|
tft.setSwapBytes(true);
|
||||||
tft.pushImage(70, 60, bobbyicons::bobbycar.WIDTH, bobbyicons::bobbycar.HEIGHT, bobbyicons::bobbycar.buffer);
|
tft.pushImage(70, 60, bobbyicons::bobbycar.WIDTH, bobbyicons::bobbycar.HEIGHT, bobbyicons::bobbycar.buffer);
|
||||||
tft.setSwapBytes(false);
|
tft.setSwapBytes(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LedstripColorsDisplay::redraw()
|
||||||
|
{
|
||||||
|
Base::redraw();
|
||||||
|
|
||||||
auto y_pos = ((tft.width() - 40) / 8 + 4) + 240;
|
auto y_pos = ((tft.width() - 40) / 8 + 4) + 240;
|
||||||
if (last_state != state_select_color)
|
if (last_state != state_select_color)
|
||||||
@@ -103,22 +113,19 @@ void LedstripColorsMenu::redraw()
|
|||||||
|
|
||||||
tft.setTextFont(2);
|
tft.setTextFont(2);
|
||||||
tft.setTextColor(TFT_WHITE);
|
tft.setTextColor(TFT_WHITE);
|
||||||
if(state_select_color)
|
|
||||||
|
tft.drawString(state_select_color ?
|
||||||
|
"Please select a color!" :
|
||||||
|
"Please select a side!", 50, y_pos);
|
||||||
|
|
||||||
|
if (!already_drew_circle)
|
||||||
{
|
{
|
||||||
tft.drawString("Please select a color!", 50, y_pos);
|
drawSide(static_cast<Bobbycar_Side>(selected_side), TFT_GOLD);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tft.drawString("Please select a side!", 50, y_pos);
|
|
||||||
}
|
|
||||||
if(!already_drew_circle)
|
|
||||||
{
|
|
||||||
this->drawSide(static_cast<Bobbycar_Side>(selected_side), TFT_GOLD);
|
|
||||||
already_drew_circle = true;
|
already_drew_circle = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedstripColorsMenu::rotate(int offset)
|
void LedstripColorsDisplay::rotate(int offset)
|
||||||
{
|
{
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
{
|
{
|
||||||
@@ -161,22 +168,22 @@ void LedstripColorsMenu::rotate(int offset)
|
|||||||
|
|
||||||
if (state_select_color)
|
if (state_select_color)
|
||||||
{
|
{
|
||||||
this->drawColors();
|
drawColors();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tft.fillRect(0, 228, tft.width(), ((tft.width() - 40) / 8) + 4, TFT_BLACK);
|
tft.fillRect(0, 228, tft.width(), ((tft.width() - 40) / 8) + 4, TFT_BLACK);
|
||||||
this->clearSides();
|
clearSides();
|
||||||
this->drawSide(static_cast<Bobbycar_Side>(selected_side), TFT_GOLD);
|
drawSide(static_cast<Bobbycar_Side>(selected_side), TFT_GOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedstripColorsMenu::confirm()
|
void LedstripColorsDisplay::confirm()
|
||||||
{
|
{
|
||||||
if(!state_select_color)
|
if(!state_select_color)
|
||||||
{
|
{
|
||||||
state_select_color = true;
|
state_select_color = true;
|
||||||
this->drawColors();
|
drawColors();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -189,7 +196,7 @@ void LedstripColorsMenu::confirm()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedstripColorsMenu::drawColors()
|
void LedstripColorsDisplay::drawColors()
|
||||||
{
|
{
|
||||||
uint16_t width = (tft.width() - 40);
|
uint16_t width = (tft.width() - 40);
|
||||||
auto cube_width = width / 8;
|
auto cube_width = width / 8;
|
||||||
@@ -205,15 +212,15 @@ void LedstripColorsMenu::drawColors()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedstripColorsMenu::clearSides()
|
void LedstripColorsDisplay::clearSides()
|
||||||
{
|
{
|
||||||
for(int index = 0; index < 8; index++)
|
for(int index = 0; index < 8; index++)
|
||||||
{
|
{
|
||||||
this->drawSide(static_cast<Bobbycar_Side>(index), TFT_BLACK);
|
drawSide(static_cast<Bobbycar_Side>(index), TFT_BLACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedstripColorsMenu::drawSide(Bobbycar_Side side, unsigned int color)
|
void LedstripColorsDisplay::drawSide(Bobbycar_Side side, unsigned int color)
|
||||||
{
|
{
|
||||||
const auto middle = tft.width() / 2;
|
const auto middle = tft.width() / 2;
|
||||||
const auto width = bobbyicons::bobbycar.WIDTH;
|
const auto width = bobbyicons::bobbycar.WIDTH;
|
@@ -4,19 +4,14 @@
|
|||||||
#include "menudisplay.h"
|
#include "menudisplay.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "actions/dummyaction.h"
|
#include "actions/dummyaction.h"
|
||||||
|
#include "actions/assertaction.h"
|
||||||
|
#include "actions/dividebyzeroaction.h"
|
||||||
#include "icons/back.h"
|
#include "icons/back.h"
|
||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
#include <esp_log.h>
|
|
||||||
|
|
||||||
|
|
||||||
// forward declares
|
// forward declares
|
||||||
namespace {
|
namespace {
|
||||||
class SettingsMenu;
|
class SettingsMenu;
|
||||||
|
|
||||||
class AssertAction : public virtual ActionInterface { public: void triggered() override { assert(0); } };
|
|
||||||
class DivideByZeroAction : public virtual ActionInterface { public: void triggered() override { int goodbye = 42 / 0; ESP_LOGW("divByZero", "%i", goodbye); } };
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
using namespace espgui;
|
using namespace espgui;
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
// forward declares
|
// forward declares
|
||||||
namespace {
|
namespace {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
class LedstripColorsMenu;
|
class LedstripColorsDisplay;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
using namespace espgui;
|
using namespace espgui;
|
||||||
@@ -124,7 +124,7 @@ class LedstripMenu :
|
|||||||
public:
|
public:
|
||||||
LedstripMenu()
|
LedstripMenu()
|
||||||
{
|
{
|
||||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIPCOLORMENU>, SwitchScreenAction<LedstripColorsMenu>>>();
|
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIPCOLORMENU>, SwitchScreenAction<LedstripColorsDisplay>>>();
|
||||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDANIMATION>, ToggleBoolAction, CheckboxIcon, EnableLedAnimationAccessor>>();
|
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDANIMATION>, ToggleBoolAction, CheckboxIcon, EnableLedAnimationAccessor>>();
|
||||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BRAKELIGHTS>, ToggleBoolAction, CheckboxIcon, EnableBrakeLightsAccessor>>();
|
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BRAKELIGHTS>, ToggleBoolAction, CheckboxIcon, EnableBrakeLightsAccessor>>();
|
||||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLINKBEEP>, ToggleBoolAction, CheckboxIcon, EnableBeepWhenBlinkAccessor>>();
|
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLINKBEEP>, ToggleBoolAction, CheckboxIcon, EnableBeepWhenBlinkAccessor>>();
|
||||||
|
@@ -62,7 +62,7 @@ using namespace std::chrono_literals;
|
|||||||
#include "displays/menus/tempomatmodesettingsmenu.h"
|
#include "displays/menus/tempomatmodesettingsmenu.h"
|
||||||
#include "displays/menus/modessettingsmenu.h"
|
#include "displays/menus/modessettingsmenu.h"
|
||||||
#ifdef FEATURE_LEDSTRIP
|
#ifdef FEATURE_LEDSTRIP
|
||||||
#include "displays/menus/ledstripcolorsmenu.h"
|
#include "displays/ledstripcolorsdisplay.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEATURE_MOSFETS
|
#ifdef FEATURE_MOSFETS
|
||||||
#include "displays/menus/mosfetsmenu.h"
|
#include "displays/menus/mosfetsmenu.h"
|
||||||
|
0
main/newsettings.cpp
Normal file
0
main/newsettings.cpp
Normal file
0
main/newsettings.h
Normal file
0
main/newsettings.h
Normal file
@@ -180,6 +180,19 @@ CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_INFO=y
|
|||||||
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
|
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
|
||||||
# end of Simple Async HTTP Request
|
# end of Simple Async HTTP Request
|
||||||
|
|
||||||
|
#
|
||||||
|
# ESP Config lib settings
|
||||||
|
#
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_NONE is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_ERROR is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_WARN is not set
|
||||||
|
CONFIG_LOG_LOCAL_LEVEL_CONFIG_INFO=y
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_DEBUG is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_VERBOSE is not set
|
||||||
|
CONFIG_LOG_LOCAL_LEVEL_CONFIG=3
|
||||||
|
# CONFIG_SEPARATE_FACTORY_NVS_PARTITION is not set
|
||||||
|
# end of ESP Config lib settings
|
||||||
|
|
||||||
#
|
#
|
||||||
# espcpputils settings
|
# espcpputils settings
|
||||||
#
|
#
|
||||||
|
@@ -180,6 +180,19 @@ CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_INFO=y
|
|||||||
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
|
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
|
||||||
# end of Simple Async HTTP Request
|
# end of Simple Async HTTP Request
|
||||||
|
|
||||||
|
#
|
||||||
|
# ESP Config lib settings
|
||||||
|
#
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_NONE is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_ERROR is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_WARN is not set
|
||||||
|
CONFIG_LOG_LOCAL_LEVEL_CONFIG_INFO=y
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_DEBUG is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_VERBOSE is not set
|
||||||
|
CONFIG_LOG_LOCAL_LEVEL_CONFIG=3
|
||||||
|
# CONFIG_SEPARATE_FACTORY_NVS_PARTITION is not set
|
||||||
|
# end of ESP Config lib settings
|
||||||
|
|
||||||
#
|
#
|
||||||
# espcpputils settings
|
# espcpputils settings
|
||||||
#
|
#
|
||||||
|
@@ -180,6 +180,19 @@ CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_INFO=y
|
|||||||
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
|
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
|
||||||
# end of Simple Async HTTP Request
|
# end of Simple Async HTTP Request
|
||||||
|
|
||||||
|
#
|
||||||
|
# ESP Config lib settings
|
||||||
|
#
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_NONE is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_ERROR is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_WARN is not set
|
||||||
|
CONFIG_LOG_LOCAL_LEVEL_CONFIG_INFO=y
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_DEBUG is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_VERBOSE is not set
|
||||||
|
CONFIG_LOG_LOCAL_LEVEL_CONFIG=3
|
||||||
|
# CONFIG_SEPARATE_FACTORY_NVS_PARTITION is not set
|
||||||
|
# end of ESP Config lib settings
|
||||||
|
|
||||||
#
|
#
|
||||||
# espcpputils settings
|
# espcpputils settings
|
||||||
#
|
#
|
||||||
|
@@ -180,6 +180,19 @@ CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_INFO=y
|
|||||||
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
|
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
|
||||||
# end of Simple Async HTTP Request
|
# end of Simple Async HTTP Request
|
||||||
|
|
||||||
|
#
|
||||||
|
# ESP Config lib settings
|
||||||
|
#
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_NONE is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_ERROR is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_WARN is not set
|
||||||
|
CONFIG_LOG_LOCAL_LEVEL_CONFIG_INFO=y
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_DEBUG is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_VERBOSE is not set
|
||||||
|
CONFIG_LOG_LOCAL_LEVEL_CONFIG=3
|
||||||
|
# CONFIG_SEPARATE_FACTORY_NVS_PARTITION is not set
|
||||||
|
# end of ESP Config lib settings
|
||||||
|
|
||||||
#
|
#
|
||||||
# espcpputils settings
|
# espcpputils settings
|
||||||
#
|
#
|
||||||
|
@@ -180,6 +180,19 @@ CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_INFO=y
|
|||||||
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
|
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
|
||||||
# end of Simple Async HTTP Request
|
# end of Simple Async HTTP Request
|
||||||
|
|
||||||
|
#
|
||||||
|
# ESP Config lib settings
|
||||||
|
#
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_NONE is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_ERROR is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_WARN is not set
|
||||||
|
CONFIG_LOG_LOCAL_LEVEL_CONFIG_INFO=y
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_DEBUG is not set
|
||||||
|
# CONFIG_LOG_LOCAL_LEVEL_CONFIG_VERBOSE is not set
|
||||||
|
CONFIG_LOG_LOCAL_LEVEL_CONFIG=3
|
||||||
|
# CONFIG_SEPARATE_FACTORY_NVS_PARTITION is not set
|
||||||
|
# end of ESP Config lib settings
|
||||||
|
|
||||||
#
|
#
|
||||||
# espcpputils settings
|
# espcpputils settings
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user