Feature Garage
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -49,3 +49,6 @@
|
||||
[submodule "components/esphttpdutils"]
|
||||
path = components/esphttpdutils
|
||||
url = git@github.com:0xFEEDC0DE64/esphttpdutils.git
|
||||
[submodule "components/espasynchttpreq"]
|
||||
path = components/espasynchttpreq
|
||||
url = git@github.com:0xFEEDC0DE64/espasynchttpreq.git
|
||||
|
Submodule components/TFT_eSPI updated: 95458b3875...b6f9d19349
1
components/espasynchttpreq
Submodule
1
components/espasynchttpreq
Submodule
Submodule components/espasynchttpreq added at 8b05591702
@ -73,8 +73,10 @@ add_definitions(
|
||||
# -DDEFAULT_GAMETRAKYMAX=4095
|
||||
# -DDEFAULT_GAMETRAKDISTMIN=0
|
||||
# -DDEFAULT_GAMETRAKDISTMAX=4095
|
||||
-DFEATURE_POWERSUPPLY
|
||||
-DFEATURE_CLOUD
|
||||
-DFEATURE_LEDBACKLIGHT
|
||||
-DPINS_LEDBACKLIGHT=23
|
||||
-DLEDBACKLIGHT_INVERTED
|
||||
-DFEATURE_GARAGE
|
||||
)
|
||||
|
@ -89,6 +89,7 @@ set(headers
|
||||
displays/calibratedisplay.h
|
||||
displays/dpad5wiredebugdisplay.h
|
||||
displays/gametrakcalibratedisplay.h
|
||||
displays/garagedisplay.h
|
||||
displays/lockscreen.h
|
||||
displays/metersdisplay.h
|
||||
displays/powersupplydisplay.h
|
||||
@ -181,7 +182,7 @@ set(dependencies
|
||||
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
|
||||
bobbycar-protocol cpputils cxx-ring-buffer date
|
||||
espasyncota espchrono espcpputils esphttpdutils espwifistack expected fmt TFT_eSPI
|
||||
espasynchttpreq espasyncota espchrono espcpputils esphttpdutils espwifistack expected fmt TFT_eSPI
|
||||
)
|
||||
|
||||
idf_component_register(
|
||||
|
62
main/displays/garagedisplay.h
Normal file
62
main/displays/garagedisplay.h
Normal file
@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <fmt/core.h>
|
||||
|
||||
// local includes
|
||||
#include "display.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "globals.h"
|
||||
#include "texts.h"
|
||||
#include "widgets/label.h"
|
||||
|
||||
namespace {
|
||||
class MainMenu;
|
||||
}
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_GARAGE
|
||||
class GarageDisplay : public Display, public BackActionInterface<SwitchScreenAction<MainMenu>>
|
||||
{
|
||||
public:
|
||||
void start() override;
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void confirm() override;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
void GarageDisplay::start()
|
||||
{
|
||||
}
|
||||
|
||||
void GarageDisplay::initScreen()
|
||||
{
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextFont(4);
|
||||
tft.setTextColor(TFT_YELLOW);
|
||||
|
||||
tft.drawString(TEXT_GARAGE, 5, 5, 4);
|
||||
|
||||
tft.fillRect(0, 34, tft.width(), 3, TFT_WHITE);
|
||||
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
tft.drawString("Garage", 20, 100);
|
||||
}
|
||||
|
||||
void GarageDisplay::redraw()
|
||||
{
|
||||
}
|
||||
|
||||
void GarageDisplay::confirm()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
}
|
@ -11,11 +11,15 @@
|
||||
#include "icons/modes.h"
|
||||
#include "icons/presets.h"
|
||||
#include "icons/graph.h"
|
||||
#ifdef FEATURE_BMS
|
||||
#include "icons/bms.h"
|
||||
#endif
|
||||
#include "icons/settings.h"
|
||||
#include "icons/lock.h"
|
||||
#include "icons/demos.h"
|
||||
#ifdef FEATURE_OTA
|
||||
#include "icons/update.h"
|
||||
#endif
|
||||
#include "icons/poweroff.h"
|
||||
#include "icons/reboot.h"
|
||||
|
||||
@ -32,6 +36,7 @@ class SettingsMenu;
|
||||
class Lockscreen;
|
||||
class MosfetsMenu;
|
||||
class DemosMenu;
|
||||
class GarageDisplay;
|
||||
class UpdateDisplay;
|
||||
class PoweroffDisplay;
|
||||
class DebugMenu;
|
||||
@ -52,10 +57,10 @@ public:
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_PRESETS>, SwitchScreenAction<PresetsMenu>, StaticMenuItemIcon<&icons::presets>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_PROFILES>, SwitchScreenAction<ProfilesMenu>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GRAPHS>, SwitchScreenAction<GraphsMenu>, StaticMenuItemIcon<&icons::graph>>>();
|
||||
#ifdef FEATURE_CAN
|
||||
#if defined(FEATURE_CAN) && defined(FEATURE_POWERSUPPLY)
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POWERSUPPLY>, SwitchScreenAction<PowerSupplyDisplay>>>();
|
||||
#endif
|
||||
#ifdef FEATURE_BMS
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BMS>, SwitchScreenAction<BmsMenu>, StaticMenuItemIcon<&icons::bms>>>();
|
||||
#endif
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SETTINGS>, SwitchScreenAction<SettingsMenu>, StaticMenuItemIcon<&icons::settings>>>();
|
||||
@ -64,7 +69,12 @@ public:
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MOSFETS>, SwitchScreenAction<MosfetsMenu>>>();
|
||||
#endif
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DEMOS>, SwitchScreenAction<DemosMenu>, StaticMenuItemIcon<&icons::demos>>>();
|
||||
#ifdef FEATURE_GARAGE
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GARAGE>, SwitchScreenAction<GarageDisplay>>>();
|
||||
#endif
|
||||
#ifdef FEATURE_OTA
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UPDATE>, SwitchScreenAction<UpdateDisplay>, StaticMenuItemIcon<&icons::update>>>();
|
||||
#endif
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POWEROFF>, SwitchScreenAction<PoweroffDisplay>, StaticMenuItemIcon<&icons::poweroff>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_REBOOT>, RebootAction, StaticMenuItemIcon<&icons::reboot>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DEBUG>, SwitchScreenAction<DebugMenu>>>();
|
||||
|
@ -1,7 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
// Arduino includes
|
||||
#include <Arduino.h>
|
||||
|
||||
// local includes
|
||||
#include "display.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "globals.h"
|
||||
@ -13,15 +15,14 @@ class MetersDisplay;
|
||||
class StatusDisplay;
|
||||
}
|
||||
namespace {
|
||||
#ifdef FEATURE_CAN
|
||||
class PowerSupplyDisplay : public Display
|
||||
#if defined(FEATURE_CAN) && defined(FEATURE_POWERSUPPLY)
|
||||
class PowerSupplyDisplay : public Display, public DummyConfirm, public BackActionInterface<SwitchScreenAction<MainMenu>>
|
||||
{
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
|
||||
void confirm() override;
|
||||
void back() override;
|
||||
void rotate(int offset) override;
|
||||
|
||||
Label m_voltageLabel{120, 50};
|
||||
@ -49,20 +50,12 @@ void PowerSupplyDisplay::redraw()
|
||||
|
||||
void PowerSupplyDisplay::confirm()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PowerSupplyDisplay::back()
|
||||
{
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void PowerSupplyDisplay::rotate(int offset)
|
||||
{
|
||||
// if (offset < 0)
|
||||
// switchScreen<MetersDisplay>();
|
||||
// else if (offset > 0)
|
||||
// switchScreen<StatusDisplay>();
|
||||
// TODO
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ class DemosMenu;
|
||||
}
|
||||
|
||||
namespace {
|
||||
class SpiroDisplay : public Display, public SwitchScreenAction<DemosMenu>, public DummyConfirm, public BackActionInterface<SwitchScreenAction<DemosMenu>>
|
||||
class SpiroDisplay : public Display, public DummyConfirm, public BackActionInterface<SwitchScreenAction<DemosMenu>>
|
||||
{
|
||||
public:
|
||||
void initScreen() override;
|
||||
|
@ -10,8 +10,8 @@
|
||||
// 3rdparty lib includes
|
||||
#ifdef FEATURE_OTA
|
||||
#include <espasyncota.h>
|
||||
#include <esp_ota_ops.h>
|
||||
#endif
|
||||
#include <fmt/core.h>
|
||||
|
||||
// local includes
|
||||
#include "display.h"
|
||||
@ -40,8 +40,11 @@ private:
|
||||
Label m_statusLabel{120, 75};
|
||||
Label m_progressLabel{120, 100};
|
||||
Label m_totalLabel{120, 125};
|
||||
Label m_messageLabel{20, 150};
|
||||
|
||||
ProgressBar m_progressBar{20, 200, 200, 10, 0, 100};
|
||||
|
||||
Label m_newVersionLabel{20, 275};
|
||||
};
|
||||
|
||||
void UpdateDisplay::start()
|
||||
@ -69,7 +72,18 @@ void UpdateDisplay::initScreen()
|
||||
tft.drawString("Total:", 20, m_totalLabel.y());
|
||||
m_totalLabel.start();
|
||||
|
||||
m_messageLabel.start();
|
||||
|
||||
m_progressBar.start();
|
||||
|
||||
if (const esp_app_desc_t *app_desc = esp_ota_get_app_description())
|
||||
{
|
||||
tft.setTextColor(TFT_ORANGE, TFT_BLACK);
|
||||
tft.drawString(app_desc->version, 20, 250);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
}
|
||||
|
||||
m_newVersionLabel.start();
|
||||
}
|
||||
|
||||
void UpdateDisplay::redraw()
|
||||
@ -89,22 +103,32 @@ void UpdateDisplay::redraw()
|
||||
m_totalLabel.clear();
|
||||
m_progressBar.redraw(0);
|
||||
}
|
||||
m_messageLabel.redraw(asyncOta->message());
|
||||
|
||||
if (const auto &appDesc = asyncOta->appDesc())
|
||||
{
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
m_newVersionLabel.redraw(appDesc->version);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
}
|
||||
else
|
||||
m_newVersionLabel.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_statusLabel.clear();
|
||||
m_progressLabel.clear();
|
||||
m_totalLabel.clear();
|
||||
m_messageLabel.clear();
|
||||
|
||||
m_progressBar.redraw(0);
|
||||
|
||||
m_newVersionLabel.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateDisplay::confirm()
|
||||
{
|
||||
//if (m_finished)
|
||||
// switchScreen<StatusDisplay>();
|
||||
|
||||
if (const auto result = triggerOta(stringSettings.otaUrl); !result)
|
||||
ESP_LOGE("BOBBY", "triggerOta() failed with %.*s", result.error().size(), result.error().data());
|
||||
}
|
||||
|
@ -33,7 +33,9 @@ using namespace std::chrono_literals;
|
||||
#ifdef FEATURE_CLOUD
|
||||
#include "displays/menus/cloudsettingsmenu.h"
|
||||
#endif
|
||||
#ifdef FEATURE_BMS
|
||||
#include "displays/menus/bmsmenu.h"
|
||||
#endif
|
||||
#include "displays/menus/buzzermenu.h"
|
||||
#include "displays/menus/commanddebugmenu.h"
|
||||
#include "displays/menus/debugmenu.h"
|
||||
@ -42,7 +44,9 @@ using namespace std::chrono_literals;
|
||||
#include "displays/menus/dynamicdebugmenu.h"
|
||||
#include "displays/menus/enablemenu.h"
|
||||
#include "displays/menus/feedbackdebugmenu.h"
|
||||
#ifdef FEATURE_GAMETRAK
|
||||
#include "displays/menus/gametrakmodesettingsmenu.h"
|
||||
#endif
|
||||
#include "displays/menus/genericwifisettingsmenu.h"
|
||||
#include "displays/menus/graphsmenu.h"
|
||||
#include "displays/menus/controllerhardwaresettingsmenu.h"
|
||||
@ -52,7 +56,9 @@ using namespace std::chrono_literals;
|
||||
#include "displays/menus/mainmenu.h"
|
||||
#include "displays/menus/tempomatmodesettingsmenu.h"
|
||||
#include "displays/menus/modessettingsmenu.h"
|
||||
#ifdef FEATURE_MOSFETS
|
||||
#include "displays/menus/mosfetsmenu.h"
|
||||
#endif
|
||||
#include "displays/menus/motorfeedbackdebugmenu.h"
|
||||
#include "displays/menus/motorstatedebugmenu.h"
|
||||
#include "displays/menus/profilesmenu.h"
|
||||
@ -64,11 +70,20 @@ using namespace std::chrono_literals;
|
||||
#include "displays/menus/timersmenu.h"
|
||||
#include "displays/menus/wifiscanmenu.h"
|
||||
#include "displays/menus/wifisettingsmenu.h"
|
||||
#ifdef FEATURE_BMS
|
||||
#include "displays/bmsdisplay.h"
|
||||
#endif
|
||||
#include "displays/calibratedisplay.h"
|
||||
#ifdef FEATURE_DPAD_5WIRESW
|
||||
#include "displays/dpad5wiredebugdisplay.h"
|
||||
#endif
|
||||
#include "displays/gameoflifedisplay.h"
|
||||
#ifdef FEATURE_GARAGE
|
||||
#include "displays/garagedisplay.h"
|
||||
#endif
|
||||
#ifdef FEATURE_LOCKSCREEN
|
||||
#include "displays/gametrakcalibratedisplay.h"
|
||||
#endif
|
||||
#include "displays/lockscreen.h"
|
||||
#include "displays/metersdisplay.h"
|
||||
#include "displays/pingpongdisplay.h"
|
||||
@ -77,21 +92,33 @@ using namespace std::chrono_literals;
|
||||
#include "displays/spirodisplay.h"
|
||||
#include "displays/starfielddisplay.h"
|
||||
#include "displays/statusdisplay.h"
|
||||
#ifdef FEATURE_OTA
|
||||
#include "displays/updatedisplay.h"
|
||||
#endif
|
||||
#include "screens.h"
|
||||
#include "dpad.h"
|
||||
#ifdef FEATURE_DPAD_3WIRESW
|
||||
#include "dpad3wire.h"
|
||||
#endif
|
||||
#ifdef FEATURE_DPAD_5WIRESW
|
||||
#include "dpad5wire.h"
|
||||
#endif
|
||||
#ifdef FEATURE_ROTARY
|
||||
#include "rotary.h"
|
||||
#endif
|
||||
#include "serialhandler.h"
|
||||
#ifdef FEATURE_OTA
|
||||
#include "ota.h"
|
||||
#endif
|
||||
#include "presets.h"
|
||||
#include "statistics.h"
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "actions/bluetoothbeginaction.h"
|
||||
#include "actions/bluetoothbeginmasteraction.h"
|
||||
#ifdef FEATURE_BMS
|
||||
#include "actions/bluetoothconnectbmsaction.h"
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FEATURE_BLE
|
||||
#include "ble.h"
|
||||
#endif
|
||||
|
@ -234,6 +234,9 @@ StringSettings makeDefaultStringSettings()
|
||||
#endif
|
||||
#ifdef FEATURE_OTA
|
||||
.otaUrl = {},
|
||||
#endif
|
||||
#ifdef FEATURE_GARAGE
|
||||
.garageUrl = "http://insecure.brunner.ninja/tor.php",
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
@ -22,6 +22,10 @@ struct StringSettings
|
||||
std::string otaUrl;
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_GARAGE
|
||||
std::string garageUrl;
|
||||
#endif
|
||||
|
||||
|
||||
template<typename T>
|
||||
void executeForEveryCommonSetting(T &&callable);
|
||||
@ -61,6 +65,10 @@ void StringSettings::executeForEveryCommonSetting(T &&callable)
|
||||
#ifdef FEATURE_OTA
|
||||
callable("otaUrl", otaUrl);
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_GARAGE
|
||||
callable("garageUrl", garageUrl);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@ -79,6 +79,7 @@ constexpr char TEXT_SETTINGS[] = "Settings";
|
||||
constexpr char TEXT_LOCKVEHICLE[] = "Lock vehicle";
|
||||
constexpr char TEXT_MOSFETS[] = "Mosfets";
|
||||
constexpr char TEXT_DEMOS[] = "Demos";
|
||||
constexpr char TEXT_GARAGE[] = "Garage";
|
||||
constexpr char TEXT_UPDATE[] = "Update";
|
||||
constexpr char TEXT_POWEROFF[] = "Poweroff";
|
||||
constexpr char TEXT_REBOOT[] = "Reboot";
|
||||
|
@ -155,6 +155,18 @@ CONFIG_ARDUINO_SELECTIVE_SPI=y
|
||||
CONFIG_ARDUINO_SELECTIVE_Wire=y
|
||||
# end of Arduino Configuration
|
||||
|
||||
#
|
||||
# Simple Async HTTP Request
|
||||
#
|
||||
# CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_NONE is not set
|
||||
# CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_ERROR is not set
|
||||
# CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_WARN is not set
|
||||
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_INFO=y
|
||||
# CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_DEBUG is not set
|
||||
# CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_VERBOSE is not set
|
||||
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
|
||||
# end of Simple Async HTTP Request
|
||||
|
||||
#
|
||||
# Simple WiFi Stack settings
|
||||
#
|
||||
|
Reference in New Issue
Block a user