smaller updates
This commit is contained in:
Submodule components/esp-gui-lib updated: ad0d90339e...3a843d9202
@ -19,7 +19,6 @@ set(headers
|
|||||||
actions/rebootaction.h
|
actions/rebootaction.h
|
||||||
actions/savesettingsaction.h
|
actions/savesettingsaction.h
|
||||||
actions/tempomatmodeapplycurrentpeedaction.h
|
actions/tempomatmodeapplycurrentpeedaction.h
|
||||||
actions/toggleboolaction.h
|
|
||||||
actions/wifiscanaction.h
|
actions/wifiscanaction.h
|
||||||
actions/switchprofileaction.h
|
actions/switchprofileaction.h
|
||||||
actions/updateswapfrontbackaction.h
|
actions/updateswapfrontbackaction.h
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "displays/menus/tempomatmodesettingsmenu.h"
|
#include "displays/menus/tempomatmodesettingsmenu.h"
|
||||||
#include "displays/menus/larsmmodesettingsmenu.h"
|
#include "displays/menus/larsmmodesettingsmenu.h"
|
||||||
#include "displays/menus/gametrakmodesettingsmenu.h"
|
#include "displays/menus/gametrakmodesettingsmenu.h"
|
||||||
|
#include "screenmanager.h"
|
||||||
|
|
||||||
using namespace espgui;
|
using namespace espgui;
|
||||||
|
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "actioninterface.h"
|
|
||||||
#include "accessorinterface.h"
|
|
||||||
|
|
||||||
using namespace espgui;
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
class ToggleBoolAction : public virtual ActionInterface, public virtual AccessorInterface<bool>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void triggered() override
|
|
||||||
{
|
|
||||||
setValue(!getValue());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,12 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// Arduino includes
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
// local includes
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "actions/switchscreenaction.h"
|
#include "actions/switchscreenaction.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "bmsutils.h"
|
#include "bmsutils.h"
|
||||||
#include "widgets/label.h"
|
#include "widgets/label.h"
|
||||||
|
#include "screenmanager.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class MainMenu;
|
class MainMenu;
|
||||||
|
@ -89,8 +89,6 @@ BluetoothSerial bluetoothSerial;
|
|||||||
ModeInterface *lastMode{};
|
ModeInterface *lastMode{};
|
||||||
ModeInterface *currentMode{};
|
ModeInterface *currentMode{};
|
||||||
|
|
||||||
std::unique_ptr<Display> currentDisplay;
|
|
||||||
|
|
||||||
#ifdef FEATURE_LEDBACKLIGHT
|
#ifdef FEATURE_LEDBACKLIGHT
|
||||||
constexpr const bool ledBacklightInverted =
|
constexpr const bool ledBacklightInverted =
|
||||||
#ifdef LEDBACKLIGHT_INVERTED
|
#ifdef LEDBACKLIGHT_INVERTED
|
||||||
|
@ -21,7 +21,16 @@ void updateLedStrip()
|
|||||||
{
|
{
|
||||||
EVERY_N_MILLISECONDS( 20 ) { gHue++; }
|
EVERY_N_MILLISECONDS( 20 ) { gHue++; }
|
||||||
|
|
||||||
if (brems && *brems > 50.f)
|
float avgPwm{};
|
||||||
|
for (const Controller &controller : controllers)
|
||||||
|
{
|
||||||
|
avgPwm +=
|
||||||
|
controller.command.left.pwm * (controller.invertLeft ? -1 : 1) +
|
||||||
|
controller.command.right.pwm * (controller.invertRight ? -1 : 1);
|
||||||
|
}
|
||||||
|
avgPwm /= 4;
|
||||||
|
|
||||||
|
if (avgPwm < -50.f)
|
||||||
{
|
{
|
||||||
auto color = avgSpeedKmh < -0.1f ? CRGB{255, 255, 255} : CRGB{255, 0, 0};
|
auto color = avgSpeedKmh < -0.1f ? CRGB{255, 255, 255} : CRGB{255, 0, 0};
|
||||||
constexpr auto kleinerOffset = 4;
|
constexpr auto kleinerOffset = 4;
|
||||||
|
@ -1,49 +1,20 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// system includes
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
|
// local includes
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "widgets/label.h"
|
#include "widgets/label.h"
|
||||||
#include "icons/logo.h"
|
#include "icons/logo.h"
|
||||||
|
#include "screenmanager.h"
|
||||||
|
|
||||||
|
using namespace espgui;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
Label bootLabel{32, 250};
|
Label bootLabel{32, 250};
|
||||||
|
|
||||||
void deconstructScreen()
|
|
||||||
{
|
|
||||||
if (currentDisplay)
|
|
||||||
{
|
|
||||||
currentDisplay->stop();
|
|
||||||
//currentDisplay->~Display();
|
|
||||||
currentDisplay = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, typename... Args>
|
|
||||||
void switchScreenImpl(Args&&... args)
|
|
||||||
{
|
|
||||||
deconstructScreen();
|
|
||||||
|
|
||||||
std::unique_ptr<T> ptr = std::make_unique<T>(std::forward<Args>(args)...);
|
|
||||||
currentDisplay = std::move(ptr);
|
|
||||||
currentDisplay->start();
|
|
||||||
currentDisplay->initScreen();
|
|
||||||
currentDisplay->update();
|
|
||||||
currentDisplay->redraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::function<void()> changeScreenCallback;
|
|
||||||
|
|
||||||
template<typename T, typename... Args>
|
|
||||||
void switchScreen(Args&&... args)
|
|
||||||
{
|
|
||||||
if (currentDisplay)
|
|
||||||
changeScreenCallback = [&args...](){ switchScreenImpl<T>(std::forward<Args>(args)...); };
|
|
||||||
else
|
|
||||||
switchScreenImpl<T>(std::forward<Args>(args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
void initScreen()
|
void initScreen()
|
||||||
{
|
{
|
||||||
tft.init();
|
tft.init();
|
||||||
|
@ -218,9 +218,6 @@ void sendCommands()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename... Args>
|
|
||||||
void switchScreen(Args&&... args);
|
|
||||||
|
|
||||||
#ifdef FEATURE_SERIAL
|
#ifdef FEATURE_SERIAL
|
||||||
void updateSwapFrontBack()
|
void updateSwapFrontBack()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user