Even more more fixes
This commit is contained in:
@ -8,15 +8,15 @@
|
||||
|
||||
void RebootAction::triggered()
|
||||
{
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
espgui::tft.setTextColor(TFT_YELLOW);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextColor(TFT_YELLOW);
|
||||
|
||||
espgui::tft.drawString("Reboot", 5, 5, 4);
|
||||
tft.drawString("Reboot", 5, 5, 4);
|
||||
|
||||
espgui::tft.fillRect(0, 34, espgui::tft.width(), 3, TFT_WHITE);
|
||||
tft.fillRect(0, 34, tft.width(), 3, TFT_WHITE);
|
||||
|
||||
espgui::tft.setTextColor(TFT_WHITE);
|
||||
espgui::tft.drawString("Rebooting now...", 0, 50, 4);
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
tft.drawString("Rebooting now...", 0, 50, 4);
|
||||
|
||||
esp_restart();
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <actioninterface.h>
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "newsettings.h"
|
||||
@ -18,15 +17,15 @@ public:
|
||||
{
|
||||
if (reboot)
|
||||
{
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
espgui::tft.setTextColor(TFT_YELLOW);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextColor(TFT_YELLOW);
|
||||
|
||||
espgui::tft.drawString("Reboot", 5, 5, 4);
|
||||
tft.drawString("Reboot", 5, 5, 4);
|
||||
|
||||
espgui::tft.fillRect(0, 34, espgui::tft.width(), 3, TFT_WHITE);
|
||||
tft.fillRect(0, 34, tft.width(), 3, TFT_WHITE);
|
||||
|
||||
espgui::tft.setTextColor(TFT_WHITE);
|
||||
espgui::tft.drawString("Rebooting now...", 0, 50, 4);
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
tft.drawString("Rebooting now...", 0, 50, 4);
|
||||
|
||||
configs.reset();
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <esp32-hal-gpio.h>
|
||||
#include <screenmanager.h>
|
||||
#include <changevaluedisplay.h>
|
||||
@ -117,7 +116,7 @@ void handleNormalChar(char c)
|
||||
{
|
||||
case 'i':
|
||||
case 'I':
|
||||
espgui::tft.init();
|
||||
tft.init();
|
||||
break;
|
||||
case 'p':
|
||||
case 'P':
|
||||
|
@ -3,7 +3,6 @@ constexpr const char * const TAG = "BatteryGraphDisplay";
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <screenmanager.h>
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "battery.h"
|
||||
@ -18,9 +17,9 @@ namespace {
|
||||
constexpr const uint8_t TOP_OFFSET = 40;
|
||||
} // namespace
|
||||
|
||||
void BatteryGraphDisplay::initScreen()
|
||||
void BatteryGraphDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
drawBatteryCurve();
|
||||
}
|
||||
|
||||
@ -76,8 +75,8 @@ void BatteryGraphDisplay::buttonPressed(espgui::Button button)
|
||||
void BatteryGraphDisplay::drawBatteryCurve()
|
||||
{
|
||||
const auto points = count_curve_points(configs.battery.cellType.value());
|
||||
const auto max_height = espgui::tft.height() - 1;
|
||||
const auto max_width = espgui::tft.width() - 4;
|
||||
const auto max_height = tft.height() - 1;
|
||||
const auto max_width = tft.width() - 4;
|
||||
const uint16_t part = max_width / points;
|
||||
const auto min_voltage = getMinBatCellVoltage(configs.battery.cellType.value());
|
||||
const auto max_voltage = getMaxBatCellVoltage(configs.battery.cellType.value());
|
||||
@ -89,7 +88,7 @@ void BatteryGraphDisplay::drawBatteryCurve()
|
||||
const int y1 = float_map(point->minVoltage / 100.f, min_voltage, max_voltage, max_height, TOP_OFFSET);
|
||||
const int x2 = 2 + part * (points - i);
|
||||
const int y2 = float_map(point->maxVoltage / 100.f, min_voltage, max_voltage, max_height, TOP_OFFSET);
|
||||
espgui::tft.drawLine(x1, y1, x2, y2, TFT_WHITE);
|
||||
tft.drawLine(x1, y1, x2, y2, TFT_WHITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ class BatteryGraphDisplay : public BobbyDisplayWithTitle {
|
||||
|
||||
public:
|
||||
std::string text() const override;
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <screenmanager.h>
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "battery.h"
|
||||
@ -14,10 +13,10 @@
|
||||
|
||||
// display with big battery and ten bars (0-100%)
|
||||
|
||||
void BatteryInfoDisplay::initScreen()
|
||||
void BatteryInfoDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
using namespace espgui;
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
tft.drawRoundRect(m_offset, m_offset, tft.width() - (m_offset * 2), tft.height() - (m_offset * 2), 10, TFT_WHITE);
|
||||
tft.drawRoundRect((tft.width() / 2) - (m_offset / 2), m_offset / 2, m_offset, m_offset / 2, 3, TFT_WHITE);
|
||||
|
@ -8,8 +8,8 @@ class BatteryInfoDisplay : public BobbyDisplay
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
private:
|
||||
|
@ -5,13 +5,12 @@
|
||||
#include "displays/speedinfodisplay.h"
|
||||
#include "displays/statusdisplay.h"
|
||||
#include "screenmanager.h"
|
||||
#include "tftinstance.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
void BmsDisplay::initScreen()
|
||||
void BmsDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
@ -18,8 +18,8 @@ class BmsDisplay :
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "confiscationdisplay.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
#include <esprandom.h>
|
||||
#include <randomutils.h>
|
||||
@ -29,27 +28,27 @@ void ConfiscationDisplay::start()
|
||||
m_nextRestart = espchrono::millis_clock::now() + std::chrono::seconds{cpputils::randomNumber(3, 7, espcpputils::esp_random_device{})};
|
||||
}
|
||||
|
||||
void ConfiscationDisplay::initScreen()
|
||||
void ConfiscationDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
espgui::tft.setSwapBytes(true);
|
||||
espgui::tft.pushImage(10, 70, bobbyicons::shortcircuit.WIDTH, bobbyicons::shortcircuit.HEIGHT, bobbyicons::shortcircuit.buffer);
|
||||
espgui::tft.setSwapBytes(false);
|
||||
tft.setSwapBytes(true);
|
||||
tft.pushImage(10, 70, bobbyicons::shortcircuit.WIDTH, bobbyicons::shortcircuit.HEIGHT, bobbyicons::shortcircuit.buffer);
|
||||
tft.setSwapBytes(false);
|
||||
|
||||
m_progressBar.start();
|
||||
|
||||
m_label.start();
|
||||
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
espgui::tft.setTextFont(2);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextFont(2);
|
||||
|
||||
auto y = 235;
|
||||
constexpr auto lineheight = 15;
|
||||
espgui::tft.drawString("Bei erneuter, widerrechtlicher", 10, y+=lineheight);
|
||||
espgui::tft.drawString("Beschlagnahmung wird die Selbst-", 10, y+=lineheight);
|
||||
espgui::tft.drawString("Vernichtung durch Kurzschluss", 10, y+=lineheight);
|
||||
espgui::tft.drawString(fmt::format("der Batterie eingeleitet (ca {:.2f}MJ)", calculateMegaJoules()), 10, y+=lineheight);
|
||||
tft.drawString("Bei erneuter, widerrechtlicher", 10, y+=lineheight);
|
||||
tft.drawString("Beschlagnahmung wird die Selbst-", 10, y+=lineheight);
|
||||
tft.drawString("Vernichtung durch Kurzschluss", 10, y+=lineheight);
|
||||
tft.drawString(fmt::format("der Batterie eingeleitet (ca {:.2f}MJ)", calculateMegaJoules()), 10, y+=lineheight);
|
||||
}
|
||||
|
||||
void ConfiscationDisplay::redraw()
|
||||
@ -58,9 +57,9 @@ void ConfiscationDisplay::redraw()
|
||||
|
||||
m_progressBar.redraw(m_progress);
|
||||
|
||||
espgui::tft.setTextColor(TFT_YELLOW, TFT_BLACK);
|
||||
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
|
||||
|
||||
espgui::tft.setTextFont(2);
|
||||
tft.setTextFont(2);
|
||||
m_label.redraw([](){
|
||||
if (const auto period = espchrono::millis_clock::now().time_since_epoch() % 6000ms; period < 2000ms)
|
||||
return "Halten Sie 10m Abstand.";
|
||||
|
@ -16,8 +16,8 @@ class ConfiscationDisplay : public BobbyDisplayWithTitle
|
||||
public:
|
||||
void start() override;
|
||||
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
void update() override;
|
||||
void stop() override;
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
// 3rdparty lib includes
|
||||
#include <randomutils.h>
|
||||
#include <esprandom.h>
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
@ -17,14 +16,14 @@ void GameOfLifeDisplay::start()
|
||||
m_newgrid = std::make_unique<std::bitset<GRIDX*GRIDY>>();
|
||||
}
|
||||
|
||||
void GameOfLifeDisplay::initScreen()
|
||||
void GameOfLifeDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
disableScreenFlip(true);
|
||||
|
||||
espgui::tft.setRotation(3);
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
tft.setRotation(3);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
}
|
||||
|
||||
void GameOfLifeDisplay::redraw()
|
||||
@ -33,7 +32,7 @@ void GameOfLifeDisplay::redraw()
|
||||
|
||||
if (gen == 0)
|
||||
{
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
initGrid();
|
||||
}
|
||||
|
||||
@ -80,7 +79,7 @@ void GameOfLifeDisplay::drawGrid()
|
||||
color = 0xFFFF; //random(0xFFFF);
|
||||
else
|
||||
color = 0;
|
||||
espgui::tft.fillRect(CELLXY * x, CELLXY * y, CELLXY, CELLXY, color);
|
||||
tft.fillRect(CELLXY * x, CELLXY * y, CELLXY, CELLXY, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ class GameOfLifeDisplay : public BobbyDisplay
|
||||
|
||||
public:
|
||||
void start() override;
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
void stop() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
@ -21,8 +21,8 @@ class GametrakCalibrateDisplay : public BobbyDisplay, public ConfirmActionInterf
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
|
||||
private:
|
||||
std::array<Label, 6> m_labels {{
|
||||
@ -41,9 +41,9 @@ private:
|
||||
}};
|
||||
};
|
||||
|
||||
void GametrakCalibrateDisplay::initScreen()
|
||||
void GametrakCalibrateDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextFont(4);
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "joystickdebugdisplay.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <cpputils.h>
|
||||
#include <menuitem.h>
|
||||
#include <actioninterface.h>
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
#include <actions/dummyaction.h>
|
||||
|
||||
@ -54,30 +53,30 @@ std::string LedstripColorsDisplay::text() const
|
||||
return TEXT_LEDSTRIPCOLORMENU;
|
||||
}
|
||||
|
||||
void LedstripColorsDisplay::initScreen()
|
||||
void LedstripColorsDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
espgui::tft.setSwapBytes(true);
|
||||
espgui::tft.pushImage(70, 60, bobbyicons::bobbycar.WIDTH, bobbyicons::bobbycar.HEIGHT, bobbyicons::bobbycar.buffer);
|
||||
espgui::tft.setSwapBytes(false);
|
||||
tft.setSwapBytes(true);
|
||||
tft.pushImage(70, 60, bobbyicons::bobbycar.WIDTH, bobbyicons::bobbycar.HEIGHT, bobbyicons::bobbycar.buffer);
|
||||
tft.setSwapBytes(false);
|
||||
}
|
||||
|
||||
void LedstripColorsDisplay::redraw()
|
||||
{
|
||||
Base::redraw();
|
||||
|
||||
auto y_pos = ((espgui::tft.width() - 40) / 8 + 4) + 240;
|
||||
auto y_pos = ((tft.width() - 40) / 8 + 4) + 240;
|
||||
if (last_state != state_select_color)
|
||||
{
|
||||
espgui::tft.fillRect(0,y_pos - 1, espgui::tft.width(), 20, TFT_BLACK);
|
||||
tft.fillRect(0,y_pos - 1, tft.width(), 20, TFT_BLACK);
|
||||
last_state = state_select_color;
|
||||
}
|
||||
|
||||
espgui::tft.setTextFont(2);
|
||||
espgui::tft.setTextColor(TFT_WHITE);
|
||||
tft.setTextFont(2);
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
|
||||
espgui::tft.drawString(state_select_color ?
|
||||
tft.drawString(state_select_color ?
|
||||
"Please select a color!" :
|
||||
"Please select a side!", 50, y_pos);
|
||||
|
||||
@ -103,7 +102,7 @@ void LedstripColorsDisplay::buttonPressed(espgui::Button button)
|
||||
else
|
||||
{
|
||||
state_select_color = false;
|
||||
espgui::tft.fillRect(0, 228, espgui::tft.width(), ((espgui::tft.width() - 40) / 8) + 4, TFT_BLACK);
|
||||
tft.fillRect(0, 228, tft.width(), ((tft.width() - 40) / 8) + 4, TFT_BLACK);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -119,7 +118,7 @@ void LedstripColorsDisplay::buttonPressed(espgui::Button button)
|
||||
// Uncomment to close select color menu on color select
|
||||
/*
|
||||
state_select_color = false;
|
||||
espgui::tft.fillRect(0, 228, espgui::tft.width(), ((espgui::tft.width() - 40) / 8) + 4, TFT_BLACK);
|
||||
tft.fillRect(0, 228, tft.width(), ((tft.width() - 40) / 8) + 4, TFT_BLACK);
|
||||
*/
|
||||
}
|
||||
break;
|
||||
@ -148,7 +147,7 @@ void LedstripColorsDisplay::buttonPressed(espgui::Button button)
|
||||
}
|
||||
else
|
||||
{
|
||||
espgui::tft.fillRect(0, 228, espgui::tft.width(), ((espgui::tft.width() - 40) / 8) + 4, TFT_BLACK);
|
||||
tft.fillRect(0, 228, tft.width(), ((tft.width() - 40) / 8) + 4, TFT_BLACK);
|
||||
clearSides();
|
||||
drawSide(static_cast<Bobbycar_Side>(selected_side), TFT_GOLD);
|
||||
}
|
||||
@ -179,7 +178,7 @@ void LedstripColorsDisplay::buttonPressed(espgui::Button button)
|
||||
}
|
||||
else
|
||||
{
|
||||
espgui::tft.fillRect(0, 228, espgui::tft.width(), ((espgui::tft.width() - 40) / 8) + 4, TFT_BLACK);
|
||||
tft.fillRect(0, 228, tft.width(), ((tft.width() - 40) / 8) + 4, TFT_BLACK);
|
||||
clearSides();
|
||||
drawSide(static_cast<Bobbycar_Side>(selected_side), TFT_GOLD);
|
||||
}
|
||||
@ -190,17 +189,17 @@ void LedstripColorsDisplay::buttonPressed(espgui::Button button)
|
||||
|
||||
void LedstripColorsDisplay::drawColors()
|
||||
{
|
||||
uint16_t width = (espgui::tft.width() - 40);
|
||||
uint16_t width = (tft.width() - 40);
|
||||
auto cube_width = width / 8;
|
||||
|
||||
espgui::tft.fillRect(0, 228, espgui::tft.width(), cube_width + 4, TFT_BLACK);
|
||||
espgui::tft.fillRect(21, 231, width - 1, cube_width - 1, TFT_WHITE);
|
||||
tft.fillRect(0, 228, tft.width(), cube_width + 4, TFT_BLACK);
|
||||
tft.fillRect(21, 231, width - 1, cube_width - 1, TFT_WHITE);
|
||||
|
||||
espgui::tft.fillRect(20 + (selected_color * cube_width - 1), 228, cube_width + 4, cube_width + 4, TFT_YELLOW);
|
||||
tft.fillRect(20 + (selected_color * cube_width - 1), 228, cube_width + 4, cube_width + 4, TFT_YELLOW);
|
||||
for (int index = 0; index < 8; index++)
|
||||
{
|
||||
auto offset = index * (cube_width);
|
||||
espgui::tft.fillRect(22 + offset, 232, cube_width - 4, cube_width - 4, tft_colors[index]);
|
||||
tft.fillRect(22 + offset, 232, cube_width - 4, cube_width - 4, tft_colors[index]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,7 +213,7 @@ void LedstripColorsDisplay::clearSides()
|
||||
|
||||
void LedstripColorsDisplay::drawSide(Bobbycar_Side side, unsigned int color)
|
||||
{
|
||||
const auto middle = espgui::tft.width() / 2;
|
||||
const auto middle = tft.width() / 2;
|
||||
const auto width = bobbyicons::bobbycar.WIDTH;
|
||||
const auto height = bobbyicons::bobbycar.HEIGHT;
|
||||
const auto left = middle - (width / 2);
|
||||
@ -224,33 +223,33 @@ void LedstripColorsDisplay::drawSide(Bobbycar_Side side, unsigned int color)
|
||||
|
||||
switch (side) {
|
||||
case Bobbycar_Side::FRONT:
|
||||
espgui::tft.fillRect(left, above, width, 5, color);
|
||||
tft.fillRect(left, above, width, 5, color);
|
||||
break;
|
||||
case Bobbycar_Side::FRONT_LEFT:
|
||||
espgui::tft.fillRect(left - 10, above + 10, 5, height / 2, color);
|
||||
espgui::tft.fillRect(left, above, width / 2, 5, color);
|
||||
tft.fillRect(left - 10, above + 10, 5, height / 2, color);
|
||||
tft.fillRect(left, above, width / 2, 5, color);
|
||||
break;
|
||||
case Bobbycar_Side::LEFT:
|
||||
espgui::tft.fillRect(left - 10, above + 10, 5, height, color);
|
||||
tft.fillRect(left - 10, above + 10, 5, height, color);
|
||||
break;
|
||||
case Bobbycar_Side::BACK_LEFT:
|
||||
espgui::tft.fillRect(left - 10, above + 10 + (height / 2), 5, height / 2, color);
|
||||
espgui::tft.fillRect(left, bellow + 5, width / 2, 5, color);
|
||||
tft.fillRect(left - 10, above + 10 + (height / 2), 5, height / 2, color);
|
||||
tft.fillRect(left, bellow + 5, width / 2, 5, color);
|
||||
break;
|
||||
case Bobbycar_Side::BACK:
|
||||
espgui::tft.fillRect(left, bellow + 5, width, 5, color);
|
||||
tft.fillRect(left, bellow + 5, width, 5, color);
|
||||
break;
|
||||
case Bobbycar_Side::BACK_RIGHT:
|
||||
espgui::tft.fillRect(right + 5, above + 10 + (height / 2), 5, height / 2, color);
|
||||
espgui::tft.fillRect(middle, bellow + 5, width / 2, 5, color);
|
||||
tft.fillRect(right + 5, above + 10 + (height / 2), 5, height / 2, color);
|
||||
tft.fillRect(middle, bellow + 5, width / 2, 5, color);
|
||||
break;
|
||||
case Bobbycar_Side::RIGHT:
|
||||
espgui::tft.fillRect(right + 5, above + 10, 5, height, color);
|
||||
tft.fillRect(right + 5, above + 10, 5, height, color);
|
||||
break;
|
||||
case Bobbycar_Side::FRONT_RIGHT:
|
||||
espgui::tft.fillRect(right + 5, above + 10, 5, height / 2, color);
|
||||
espgui::tft.fillRect(middle, above, width / 2, 5, color);
|
||||
tft.fillRect(right + 5, above + 10, 5, height / 2, color);
|
||||
tft.fillRect(middle, above, width / 2, 5, color);
|
||||
break;
|
||||
}
|
||||
// espgui::tft.fillCircle(espgui::tft.width() / 2, 140, 100, TFT_BLACK);
|
||||
// tft.fillCircle(tft.width() / 2, 140, 100, TFT_BLACK);
|
||||
}
|
||||
|
@ -16,8 +16,8 @@ class LedstripColorsDisplay : public BobbyDisplayWithTitle
|
||||
|
||||
public:
|
||||
std::string text() const override;
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <algorithm>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
@ -57,18 +56,18 @@ void Lockscreen::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen(tft);
|
||||
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
espgui::tft.setTextFont(4);
|
||||
espgui::tft.setTextColor(TFT_YELLOW);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextFont(4);
|
||||
tft.setTextColor(TFT_YELLOW);
|
||||
|
||||
espgui::tft.drawString("Lock vehicle", 5, 5);
|
||||
tft.drawString("Lock vehicle", 5, 5);
|
||||
|
||||
espgui::tft.fillRect(0, 34, espgui::tft.width(), 3, TFT_WHITE);
|
||||
tft.fillRect(0, 34, tft.width(), 3, TFT_WHITE);
|
||||
|
||||
espgui::tft.setTextColor(TFT_WHITE);
|
||||
espgui::tft.drawString("Enter code to unlock:", 0, 50);
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
tft.drawString("Enter code to unlock:", 0, 50);
|
||||
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
for(int i = 0; i <= 3; i++)
|
||||
{
|
||||
@ -79,7 +78,7 @@ void Lockscreen::initScreen(espgui::TftInterface &tft)
|
||||
for (auto &label : m_labels)
|
||||
label.start();
|
||||
|
||||
espgui::tft.setTextFont(7);
|
||||
tft.setTextFont(7);
|
||||
|
||||
drawRect(m_currentIndex, 1, TFT_YELLOW);
|
||||
drawRect(m_currentIndex, 2, TFT_YELLOW);
|
||||
@ -207,5 +206,5 @@ void Lockscreen::buttonPressed(espgui::Button button)
|
||||
|
||||
void Lockscreen::drawRect(int index, int offset, uint32_t color) const
|
||||
{
|
||||
espgui::tft.drawRect(m_labels[index].x()-offset, m_labels[index].y()-offset, boxWidth+(offset*2), boxHeight+(offset*2), color);
|
||||
tft.drawRect(m_labels[index].x()-offset, m_labels[index].y()-offset, boxWidth+(offset*2), boxHeight+(offset*2), color);
|
||||
}
|
||||
|
@ -10,8 +10,6 @@
|
||||
#include <textwithvaluehelper.h>
|
||||
#include <fmt/core.h>
|
||||
|
||||
#include <tftinstance.h>
|
||||
|
||||
// Local includes
|
||||
#include "utils.h"
|
||||
#include "icons/settings.h"
|
||||
@ -98,9 +96,9 @@ std::string BatteryMenu::text() const
|
||||
return TEXT_BATTERY;
|
||||
}
|
||||
|
||||
void BatteryMenu::initScreen()
|
||||
void BatteryMenu::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
m_batPercentBootLabel.start();
|
||||
m_batPercentNowLabel.start();
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ public:
|
||||
|
||||
std::string text() const override;
|
||||
|
||||
void initScreen() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void start() override;
|
||||
void redraw() override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
void back() override;
|
||||
|
||||
private:
|
||||
|
@ -141,7 +141,7 @@ DefaultModeSettingsMenu::DefaultModeSettingsMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string DefaultModeSettingsMenu::text() const
|
||||
std::string DefaultModeSettingsMenu::title() const
|
||||
{
|
||||
return TEXT_DEFAULTMODESETTIGNS;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ class DefaultModeSettingsMenu : public BobbyMenuDisplay
|
||||
public:
|
||||
DefaultModeSettingsMenu();
|
||||
|
||||
std::string text() const override;
|
||||
std::string title() const override;
|
||||
|
||||
void back() override;
|
||||
};
|
||||
|
@ -54,7 +54,7 @@ LarsmModeSettingsMenu::LarsmModeSettingsMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string LarsmModeSettingsMenu::text() const
|
||||
std::string LarsmModeSettingsMenu::title() const
|
||||
{
|
||||
return TEXT_LARSMMODESETTINGS;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ class LarsmModeSettingsMenu : public BobbyMenuDisplay
|
||||
public:
|
||||
LarsmModeSettingsMenu();
|
||||
|
||||
std::string text() const override;
|
||||
std::string title() const override;
|
||||
|
||||
void back() override;
|
||||
};
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <actions/pushscreenaction.h>
|
||||
#include <actions/popscreenaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/menus/selectmodemenu.h"
|
||||
|
@ -43,7 +43,7 @@ MickModeSettingsMenu::MickModeSettingsMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string MickModeSettingsMenu::text() const
|
||||
std::string MickModeSettingsMenu::title() const
|
||||
{
|
||||
return TEXT_MICKMODESETTINGS;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ class MickModeSettingsMenu : public BobbyMenuDisplay
|
||||
public:
|
||||
MickModeSettingsMenu();
|
||||
|
||||
std::string text() const override;
|
||||
std::string title() const override;
|
||||
|
||||
void back() override;
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ MotortestModeSettingsMenu::MotortestModeSettingsMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string MotortestModeSettingsMenu::text() const
|
||||
std::string MotortestModeSettingsMenu::title() const
|
||||
{
|
||||
return TEXT_MOTORTESTMODESETTINGS;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ class MotortestModeSettingsMenu : public BobbyMenuDisplay
|
||||
public:
|
||||
MotortestModeSettingsMenu();
|
||||
|
||||
std::string text() const override;
|
||||
std::string title() const override;
|
||||
|
||||
void back() override;
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ RemoteControlModeSettingsMenu::RemoteControlModeSettingsMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string RemoteControlModeSettingsMenu::text() const
|
||||
std::string RemoteControlModeSettingsMenu::title() const
|
||||
{
|
||||
return TEXT_REMOTEMODESETTINGS;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ class RemoteControlModeSettingsMenu : public BobbyMenuDisplay
|
||||
public:
|
||||
RemoteControlModeSettingsMenu();
|
||||
|
||||
std::string text() const override;
|
||||
std::string title() const override;
|
||||
|
||||
void back() override;
|
||||
};
|
||||
|
@ -50,7 +50,7 @@ TempomatModeSettingsMenu::TempomatModeSettingsMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string TempomatModeSettingsMenu::text() const
|
||||
std::string TempomatModeSettingsMenu::title() const
|
||||
{
|
||||
return TEXT_TEMPOMATMODESETTINGS;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ class TempomatModeSettingsMenu : public BobbyMenuDisplay
|
||||
public:
|
||||
TempomatModeSettingsMenu();
|
||||
|
||||
std::string text() const override;
|
||||
std::string title() const override;
|
||||
|
||||
void back() override;
|
||||
};
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "metersdisplay.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <fmt/core.h>
|
||||
|
||||
// local includes
|
||||
@ -13,9 +12,9 @@
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
void MetersDisplay::initScreen()
|
||||
void MetersDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
|
@ -19,8 +19,8 @@ class MetersDisplay : public BobbyDisplay
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
// 3rdparty lib includes
|
||||
#include <randomutils.h>
|
||||
#include <esprandom.h>
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
@ -18,14 +17,14 @@ PingPongDisplay::PingPongDisplay() :
|
||||
calc_target_y();
|
||||
}
|
||||
|
||||
void PingPongDisplay::initScreen()
|
||||
void PingPongDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
disableScreenFlip(true);
|
||||
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
espgui::tft.setRotation(1);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setRotation(1);
|
||||
|
||||
midline();
|
||||
}
|
||||
@ -68,29 +67,29 @@ void PingPongDisplay::midline()
|
||||
// If the ball is not on the line then don't redraw the line
|
||||
if ((ball_x<dashline_x-ball_w) && (ball_x > dashline_x+dashline_w)) return;
|
||||
|
||||
espgui::tft.startWrite();
|
||||
tft.startWrite();
|
||||
|
||||
// Quick way to draw a dashed line
|
||||
espgui::tft.setAddrWindow(dashline_x, 0, dashline_w, h);
|
||||
tft.setAddrWindow(dashline_x, 0, dashline_w, h);
|
||||
|
||||
for (int16_t i = 0; i < dashline_n; i+=2)
|
||||
{
|
||||
espgui::tft.pushColor(WHITE, dashline_w*dashline_h); // push dash pixels
|
||||
espgui::tft.pushColor(BLACK, dashline_w*dashline_h); // push gap pixels
|
||||
tft.pushColor(WHITE, dashline_w*dashline_h); // push dash pixels
|
||||
tft.pushColor(BLACK, dashline_w*dashline_h); // push gap pixels
|
||||
}
|
||||
|
||||
espgui::tft.endWrite();
|
||||
tft.endWrite();
|
||||
}
|
||||
|
||||
void PingPongDisplay::lpaddle()
|
||||
{
|
||||
if (lpaddle_d == 1)
|
||||
{
|
||||
espgui::tft.fillRect(lpaddle_x, lpaddle_y, paddle_w, 1, BLACK);
|
||||
tft.fillRect(lpaddle_x, lpaddle_y, paddle_w, 1, BLACK);
|
||||
}
|
||||
else if (lpaddle_d == -1)
|
||||
{
|
||||
espgui::tft.fillRect(lpaddle_x, lpaddle_y + paddle_h - 1, paddle_w, 1, BLACK);
|
||||
tft.fillRect(lpaddle_x, lpaddle_y + paddle_h - 1, paddle_w, 1, BLACK);
|
||||
}
|
||||
|
||||
lpaddle_y = lpaddle_y + lpaddle_d;
|
||||
@ -107,15 +106,15 @@ void PingPongDisplay::lpaddle()
|
||||
if (lpaddle_y + paddle_h >= h && lpaddle_d == 1) lpaddle_d = 0;
|
||||
else if (lpaddle_y <= 0 && lpaddle_d == -1) lpaddle_d = 0;
|
||||
|
||||
espgui::tft.fillRect(lpaddle_x, lpaddle_y, paddle_w, paddle_h, WHITE);
|
||||
tft.fillRect(lpaddle_x, lpaddle_y, paddle_w, paddle_h, WHITE);
|
||||
}
|
||||
|
||||
void PingPongDisplay::rpaddle()
|
||||
{
|
||||
if (rpaddle_d == 1)
|
||||
espgui::tft.fillRect(rpaddle_x, rpaddle_y, paddle_w, 1, BLACK);
|
||||
tft.fillRect(rpaddle_x, rpaddle_y, paddle_w, 1, BLACK);
|
||||
else if (rpaddle_d == -1)
|
||||
espgui::tft.fillRect(rpaddle_x, rpaddle_y + paddle_h - 1, paddle_w, 1, BLACK);
|
||||
tft.fillRect(rpaddle_x, rpaddle_y + paddle_h - 1, paddle_w, 1, BLACK);
|
||||
|
||||
rpaddle_y = rpaddle_y + rpaddle_d;
|
||||
|
||||
@ -133,7 +132,7 @@ void PingPongDisplay::rpaddle()
|
||||
else if (rpaddle_y <= 0 && rpaddle_d == -1)
|
||||
rpaddle_d = 0;
|
||||
|
||||
espgui::tft.fillRect(rpaddle_x, rpaddle_y, paddle_w, paddle_h, WHITE);
|
||||
tft.fillRect(rpaddle_x, rpaddle_y, paddle_w, paddle_h, WHITE);
|
||||
}
|
||||
|
||||
void PingPongDisplay::calc_target_y()
|
||||
@ -180,8 +179,8 @@ void PingPongDisplay::ball()
|
||||
}
|
||||
|
||||
//tft.fillRect(oldball_x, oldball_y, ball_w, ball_h, BLACK);
|
||||
espgui::tft.drawRect(oldball_x, oldball_y, ball_w, ball_h, BLACK); // Less TFT refresh aliasing than line above for large balls
|
||||
espgui::tft.fillRect( ball_x, ball_y, ball_w, ball_h, WHITE);
|
||||
tft.drawRect(oldball_x, oldball_y, ball_w, ball_h, BLACK); // Less TFT refresh aliasing than line above for large balls
|
||||
tft.fillRect( ball_x, ball_y, ball_w, ball_h, WHITE);
|
||||
oldball_x = ball_x;
|
||||
oldball_y = ball_y;
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ class PingPongDisplay : public BobbyDisplay
|
||||
public:
|
||||
PingPongDisplay();
|
||||
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
void stop() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
@ -1,8 +1,5 @@
|
||||
#include "potiscalibratedisplay.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "displays/menus/boardcomputerhardwaresettingsmenu.h"
|
||||
@ -35,15 +32,15 @@ void PotisCalibrateDisplay::start()
|
||||
m_brems = std::nullopt;
|
||||
}
|
||||
|
||||
void PotisCalibrateDisplay::initScreen()
|
||||
void PotisCalibrateDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
espgui::tft.setTextFont(4);
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextFont(4);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
espgui::tft.drawString("gas:", 25, 47);
|
||||
espgui::tft.drawString("brems:", 25, 147);
|
||||
tft.drawString("gas:", 25, 47);
|
||||
tft.drawString("brems:", 25, 147);
|
||||
|
||||
for (auto &label : m_labels)
|
||||
label.start();
|
||||
@ -76,30 +73,30 @@ void PotisCalibrateDisplay::redraw()
|
||||
m_labels[0].redraw(m_gas ? fmt::format("{:.02f}", *m_gas) : "?");
|
||||
m_labels[1].redraw(raw_gas ? std::to_string(*raw_gas) : "?");
|
||||
if (m_status == Status::GasMin)
|
||||
espgui::tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
m_labels[2].redraw(std::to_string(m_gasMin));
|
||||
if (m_status == Status::GasMin)
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
if (m_status == Status::GasMax)
|
||||
espgui::tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
m_labels[3].redraw(std::to_string(m_gasMax));
|
||||
if (m_status == Status::GasMax)
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
m_progressBars[0].redraw(m_gas ? *m_gas : 0);
|
||||
|
||||
m_labels[4].redraw(m_brems ? fmt::format("{:.02f}", *m_brems) : "?");
|
||||
m_labels[5].redraw(raw_brems ? std::to_string(*raw_brems) : "?");
|
||||
if (m_status == Status::BremsMin)
|
||||
espgui::tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
m_labels[6].redraw(std::to_string(m_bremsMin));
|
||||
if (m_status == Status::BremsMin)
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
if (m_status == Status::BremsMax)
|
||||
espgui::tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
m_labels[7].redraw(std::to_string(m_bremsMax));
|
||||
if (m_status == Status::BremsMax)
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
m_progressBars[1].redraw(m_brems ? *m_brems : 0);
|
||||
|
||||
@ -122,7 +119,7 @@ void PotisCalibrateDisplay::redraw()
|
||||
{
|
||||
const auto failed = !m_gas || !m_brems || (m_status == Status::Confirm && (*m_gas > 100 || *m_brems > 100));
|
||||
const auto color = failed ? TFT_DARKGREY : TFT_WHITE;
|
||||
espgui::tft.setTextColor(color, TFT_BLACK);
|
||||
tft.setTextColor(color, TFT_BLACK);
|
||||
m_labels[9].redraw([&](){
|
||||
switch (m_status)
|
||||
{
|
||||
@ -140,10 +137,10 @@ void PotisCalibrateDisplay::redraw()
|
||||
}());
|
||||
|
||||
if (m_selectedButton != m_renderedButton && (m_selectedButton == 0 || m_renderedButton == 0))
|
||||
espgui::tft.drawRect(3, 275, 100, 27, m_selectedButton == 0 ? color : TFT_BLACK);
|
||||
tft.drawRect(3, 275, 100, 27, m_selectedButton == 0 ? color : TFT_BLACK);
|
||||
}
|
||||
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
m_labels[10].redraw([&](){
|
||||
switch (m_status)
|
||||
{
|
||||
@ -161,7 +158,7 @@ void PotisCalibrateDisplay::redraw()
|
||||
}());
|
||||
|
||||
if (m_selectedButton != m_renderedButton && (m_selectedButton == 1 || m_renderedButton == 1))
|
||||
espgui::tft.drawRect(123, 275, 100, 27, m_selectedButton == 1 ? TFT_WHITE : TFT_BLACK);
|
||||
tft.drawRect(123, 275, 100, 27, m_selectedButton == 1 ? TFT_WHITE : TFT_BLACK);
|
||||
|
||||
m_renderedButton = m_selectedButton;
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ public:
|
||||
|
||||
std::string text() const override;
|
||||
void start() override;
|
||||
void initScreen() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void update() override;
|
||||
void redraw() override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
void stop() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "poweroffdisplay.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
@ -20,21 +19,21 @@ void PoweroffDisplay::start()
|
||||
controller.command.poweroff = true;
|
||||
}
|
||||
|
||||
void PoweroffDisplay::initScreen()
|
||||
void PoweroffDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
espgui::tft.setTextColor(TFT_YELLOW);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextColor(TFT_YELLOW);
|
||||
|
||||
espgui::tft.drawString("Poweroff", 5, 5, 4);
|
||||
tft.drawString("Poweroff", 5, 5, 4);
|
||||
|
||||
espgui::tft.fillRect(0, 34, espgui::tft.width(), 3, TFT_WHITE);
|
||||
tft.fillRect(0, 34, tft.width(), 3, TFT_WHITE);
|
||||
|
||||
espgui::tft.setTextColor(TFT_WHITE);
|
||||
espgui::tft.drawString("Trying to turn off", 15, 50, 4);
|
||||
espgui::tft.drawString("both controllers", 25, 75, 4);
|
||||
espgui::tft.drawString("Please stand still...", 20, 125, 4);
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
tft.drawString("Trying to turn off", 15, 50, 4);
|
||||
tft.drawString("both controllers", 25, 75, 4);
|
||||
tft.drawString("Please stand still...", 20, 125, 4);
|
||||
}
|
||||
|
||||
void PoweroffDisplay::update()
|
||||
|
@ -12,7 +12,7 @@ class PoweroffDisplay : public BobbyDisplay
|
||||
|
||||
public:
|
||||
void start() override;
|
||||
void initScreen() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void update() override;
|
||||
void stop() override;
|
||||
|
||||
|
@ -1,25 +1,24 @@
|
||||
#include "powersupplydisplay.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
|
||||
#if defined(FEATURE_CAN) && defined(FEATURE_POWERSUPPLY)
|
||||
void PowerSupplyDisplay::initScreen()
|
||||
void PowerSupplyDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
espgui::tft.setTextFont(4);
|
||||
tft.setTextFont(4);
|
||||
|
||||
espgui::tft.drawString("Voltage:", 0, m_voltageLabel.y());
|
||||
tft.drawString("Voltage:", 0, m_voltageLabel.y());
|
||||
m_voltageLabel.start();
|
||||
espgui::tft.drawString("Current:", 0, m_currentLabel.y());
|
||||
tft.drawString("Current:", 0, m_currentLabel.y());
|
||||
m_currentLabel.start();
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,8 @@ class PowerSupplyDisplay : public BobbyDisplay
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <fmt/core.h>
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
@ -15,9 +14,9 @@ QrCodeDebugDisplay::QrCodeDebugDisplay()
|
||||
{
|
||||
}
|
||||
|
||||
void QrCodeDebugDisplay::initScreen()
|
||||
void QrCodeDebugDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
}
|
||||
|
||||
void QrCodeDebugDisplay::buttonPressed(espgui::Button button)
|
||||
|
@ -14,7 +14,7 @@ class QrCodeDebugDisplay :
|
||||
public:
|
||||
QrCodeDebugDisplay();
|
||||
|
||||
void initScreen() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
|
||||
private:
|
||||
bool m_waitingForResult{false};
|
||||
espgui::Label m_statuslabel{5,(espgui::tft.height() / 2)-espgui::tft.fontHeight(4)};
|
||||
espgui::Label m_statuslabel{5,(tft.height() / 2)-tft.fontHeight(4)};
|
||||
|
||||
std::expected<std::string, std::string> m_result;
|
||||
std::string m_nvs_key;
|
||||
|
@ -13,9 +13,9 @@ namespace {
|
||||
constexpr char const askSetupOtherButtonsText[] = "Do you want to setup other\nbuttons?\n(Blinker, Profile Buttons, etc.)\n\nPress LEFT to skip other buttons.\nPress RIGHT to setup buttons.";
|
||||
} // namespace
|
||||
|
||||
void SetupAskCalibrateOtherButtonsDisplay::initScreen()
|
||||
void SetupAskCalibrateOtherButtonsDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
drawLargeText(askSetupOtherButtonsText);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ class SetupAskCalibrateOtherButtonsDisplay : public virtual BobbyDisplayWithTitl
|
||||
{
|
||||
using Base = BobbyDisplayWithTitle;
|
||||
public:
|
||||
void initScreen() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void start() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
@ -14,9 +14,9 @@ namespace {
|
||||
constexpr char const askCloudText[] = "Do you want to setup cloud?\nWith this, you will be able\nto send data to graphana,\nremote control things like Buttons\nand NVS and more!\n\nPress LEFT to skip cloud.\nPress RIGHT to setup cloud.";
|
||||
} // namespace
|
||||
|
||||
void SetupAskSetupCloudsDisplay::initScreen()
|
||||
void SetupAskSetupCloudsDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(espgui::TftInterface &tft);
|
||||
|
||||
drawLargeText(askCloudText);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ class SetupAskSetupCloudsDisplay : public virtual BobbyDisplayWithTitle
|
||||
{
|
||||
using Base = BobbyDisplayWithTitle;
|
||||
public:
|
||||
void initScreen() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void start() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <screenmanager.h>
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbyerrorhandler.h"
|
||||
|
@ -3,7 +3,6 @@
|
||||
// 3rdparty lib includes
|
||||
#include <cpputils.h>
|
||||
#include <screenmanager.h>
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/setup/ask_setup_clouds.h"
|
||||
@ -65,30 +64,30 @@ void SetupCalibratePotisDisplay::redraw(espgui::TftInterface &tft)
|
||||
m_labels[0].redraw(m_gas ? fmt::format("{:.02f}", *m_gas) : "?");
|
||||
m_labels[1].redraw(raw_gas ? std::to_string(*raw_gas) : "?");
|
||||
if (m_status == Status::GasMin)
|
||||
espgui::tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
m_labels[2].redraw(std::to_string(m_gasMin));
|
||||
if (m_status == Status::GasMin)
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
if (m_status == Status::GasMax)
|
||||
espgui::tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
m_labels[3].redraw(std::to_string(m_gasMax));
|
||||
if (m_status == Status::GasMax)
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
m_progressBars[0].redraw(m_gas ? *m_gas : 0);
|
||||
|
||||
m_labels[4].redraw(m_brems ? fmt::format("{:.02f}", *m_brems) : "?");
|
||||
m_labels[5].redraw(raw_brems ? std::to_string(*raw_brems) : "?");
|
||||
if (m_status == Status::BremsMin)
|
||||
espgui::tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
m_labels[6].redraw(std::to_string(m_bremsMin));
|
||||
if (m_status == Status::BremsMin)
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
if (m_status == Status::BremsMax)
|
||||
espgui::tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
m_labels[7].redraw(std::to_string(m_bremsMax));
|
||||
if (m_status == Status::BremsMax)
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
m_progressBars[1].redraw(m_brems ? *m_brems : 0);
|
||||
|
||||
@ -111,7 +110,7 @@ void SetupCalibratePotisDisplay::redraw(espgui::TftInterface &tft)
|
||||
{
|
||||
const auto failed = !m_gas || !m_brems || (m_status == Status::Confirm && (*m_gas > 100 || *m_brems > 100));
|
||||
const auto color = failed ? TFT_DARKGREY : TFT_WHITE;
|
||||
espgui::tft.setTextColor(color, TFT_BLACK);
|
||||
tft.setTextColor(color, TFT_BLACK);
|
||||
m_labels[9].redraw([&](){
|
||||
switch (m_status)
|
||||
{
|
||||
@ -129,10 +128,10 @@ void SetupCalibratePotisDisplay::redraw(espgui::TftInterface &tft)
|
||||
}());
|
||||
|
||||
if (m_selectedButton != m_renderedButton && (m_selectedButton == 0 || m_renderedButton == 0))
|
||||
espgui::tft.drawRect(3, 275, 100, 27, m_selectedButton == 0 ? color : TFT_BLACK);
|
||||
tft.drawRect(3, 275, 100, 27, m_selectedButton == 0 ? color : TFT_BLACK);
|
||||
}
|
||||
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
m_labels[10].redraw([&](){
|
||||
switch (m_status)
|
||||
{
|
||||
@ -150,7 +149,7 @@ void SetupCalibratePotisDisplay::redraw(espgui::TftInterface &tft)
|
||||
}());
|
||||
|
||||
if (m_selectedButton != m_renderedButton && (m_selectedButton == 1 || m_renderedButton == 1))
|
||||
espgui::tft.drawRect(123, 275, 100, 27, m_selectedButton == 1 ? TFT_WHITE : TFT_BLACK);
|
||||
tft.drawRect(123, 275, 100, 27, m_selectedButton == 1 ? TFT_WHITE : TFT_BLACK);
|
||||
|
||||
m_renderedButton = m_selectedButton;
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ namespace {
|
||||
constexpr char const finalInformationText[] = "Setup is done!\nIf cloud is setup, go to\nhttps://service.bobbycar.cloud/\nand register this bobbycar!\nThis is also used\nto setup udp cloud.\nPress any button to exit.";
|
||||
} // namespace
|
||||
|
||||
void SetupFinalInformationDisplay::initScreen()
|
||||
void SetupFinalInformationDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
drawLargeText(finalInformationText);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ class SetupFinalInformationDisplay : public virtual BobbyDisplayWithTitle
|
||||
{
|
||||
using Base = BobbyDisplayWithTitle;
|
||||
public:
|
||||
void initScreen() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void start() override;
|
||||
void stop() override;
|
||||
|
||||
|
@ -14,9 +14,9 @@ namespace {
|
||||
constexpr char const informationText[] = "Congratulations on your new\nbobbycar! This guide will help\nyou through initial setup,\ncalibrate everything and\nget you ready!";
|
||||
} // namespace
|
||||
|
||||
void SetupInformationDisplay::initScreen()
|
||||
void SetupInformationDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
m_init_text_progressbar.start();
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <espchrono.h>
|
||||
#include <tftinstance.h>
|
||||
#include <widgets/progressbar.h>
|
||||
|
||||
// local includes
|
||||
@ -12,15 +11,15 @@ class SetupInformationDisplay : public virtual BobbyDisplayWithTitle
|
||||
{
|
||||
using Base = BobbyDisplayWithTitle;
|
||||
public:
|
||||
void initScreen() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void start() override;
|
||||
void update() override;
|
||||
void redraw() override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
[[nodiscard]] std::string text() const override;
|
||||
private:
|
||||
espchrono::millis_clock::time_point m_menu_opened_timestamp;
|
||||
espgui::ProgressBar m_init_text_progressbar{10, espgui::tft.height()/2, espgui::tft.width()-20, 30, 0, 100};
|
||||
espgui::ProgressBar m_init_text_progressbar{10, tft.height()/2, tft.width()-20, 30, 0, 100};
|
||||
};
|
||||
|
@ -10,9 +10,9 @@
|
||||
#include "displays/statusdisplay.h"
|
||||
#include "drivingstatistics.h"
|
||||
|
||||
void SpeedInfoDisplay::initScreen()
|
||||
void SpeedInfoDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
m_labelSpeed.start();
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <widgets/label.h>
|
||||
#include <widgets/progressbar.h>
|
||||
#include <widgets/reverseprogressbar.h>
|
||||
@ -14,15 +13,15 @@ class SpeedInfoDisplay : public BobbyDisplay
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
private:
|
||||
espgui::Label m_labelSpeed{5, 5};
|
||||
|
||||
espgui::ReverseProgressBar m_dischargingBar{10, 110, espgui::tft.width()/2 - 10, 25, 0, 40, TFT_GREEN};
|
||||
espgui::ProgressBar m_chargingBar{espgui::tft.width()/2, 110, espgui::tft.width()/2 - 10, 25, 0, 40, TFT_RED};
|
||||
espgui::ReverseProgressBar m_dischargingBar{10, 110, tft.width()/2 - 10, 25, 0, 40, TFT_GREEN};
|
||||
espgui::ProgressBar m_chargingBar{tft.width()/2, 110, tft.width()/2 - 10, 25, 0, 40, TFT_RED};
|
||||
|
||||
#define START_Y 150
|
||||
espgui::Label m_batteryPercentLabel{5, START_Y};
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <esprandom.h>
|
||||
#include <randomutils.h>
|
||||
#include <screenmanager.h>
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "screens.h"
|
||||
@ -14,23 +13,23 @@ namespace {
|
||||
typedef unsigned char byte;
|
||||
} // namespace
|
||||
|
||||
void SpiroDisplay::initScreen()
|
||||
void SpiroDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
disableScreenFlip(true);
|
||||
espgui::tft.setRotation(3);
|
||||
tft.setRotation(3);
|
||||
}
|
||||
|
||||
void SpiroDisplay::redraw()
|
||||
void SpiroDisplay::redraw(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::redraw();
|
||||
Base::redraw(tft);
|
||||
|
||||
for (int j = 0; j < std::max(1, n); j++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
n = cpputils::randomNumber<uint8_t>(2, 23, espcpputils::esp_random_device{});
|
||||
r = cpputils::randomNumber<uint8_t>(20, 100, espcpputils::esp_random_device{});
|
||||
colour = 0; //rainbow();
|
||||
@ -48,7 +47,7 @@ void SpiroDisplay::redraw()
|
||||
sx = std::sin(((i % 360) - 90) * DEG2RAD);
|
||||
x1 = sx * r + x0;
|
||||
yy1 = sy * r + yy0;
|
||||
espgui::tft.drawPixel(x1, yy1, rainbow(cpputils::mapValue<uint16_t>(i%360,0,360,0,127))); //colour);
|
||||
tft.drawPixel(x1, yy1, rainbow(cpputils::mapValue<uint16_t>(i%360,0,360,0,127))); //colour);
|
||||
}
|
||||
|
||||
if (i == (360 * n))
|
||||
@ -70,7 +69,7 @@ void SpiroDisplay::redraw()
|
||||
sx = std::sin(((new_i % 360) - 90) * DEG2RAD);
|
||||
x1 = sx * r + x0;
|
||||
yy1 = sy * r + yy0;
|
||||
espgui::tft.drawPixel(x1, yy1, rainbow(cpputils::mapValue<uint16_t>(new_i%360,0,360,0,127))); //colour);
|
||||
tft.drawPixel(x1, yy1, rainbow(cpputils::mapValue<uint16_t>(new_i%360,0,360,0,127))); //colour);
|
||||
}
|
||||
|
||||
i++;
|
||||
|
@ -11,8 +11,8 @@ class SpiroDisplay : public BobbyDisplay
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
void stop() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
@ -3,7 +3,6 @@
|
||||
// 3rdparty lib includes
|
||||
#include <randomutils.h>
|
||||
#include <esprandom.h>
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
@ -19,14 +18,14 @@ StarfieldDisplay::StarfieldDisplay() :
|
||||
{
|
||||
}
|
||||
|
||||
void StarfieldDisplay::initScreen()
|
||||
void StarfieldDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(espgui::TftInterface &tft);
|
||||
|
||||
disableScreenFlip(true);
|
||||
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
espgui::tft.setRotation(1);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setRotation(1);
|
||||
|
||||
// fastSetup() must be used immediately before fastPixel() to prepare screen
|
||||
// It must be called after any other graphics drawing function call if fastPixel()
|
||||
@ -54,7 +53,7 @@ void StarfieldDisplay::redraw()
|
||||
int old_screen_y = ((int)sy[i] - 120) * 256 / sz[i] + 120;
|
||||
|
||||
// This is a faster pixel drawing function for occassions where many single pixels must be drawn
|
||||
espgui::tft.drawPixel(old_screen_x, old_screen_y,TFT_BLACK);
|
||||
tft.drawPixel(old_screen_x, old_screen_y,TFT_BLACK);
|
||||
|
||||
sz[i] -= 2;
|
||||
if (sz[i] > 1)
|
||||
@ -66,7 +65,7 @@ void StarfieldDisplay::redraw()
|
||||
{
|
||||
uint8_t r, g, b;
|
||||
r = g = b = 255 - sz[i];
|
||||
espgui::tft.drawPixel(screen_x, screen_y, color565(r,g,b));
|
||||
tft.drawPixel(screen_x, screen_y, color565(r,g,b));
|
||||
}
|
||||
else
|
||||
sz[i] = 0; // Out of screen, die.
|
||||
|
@ -13,8 +13,8 @@ class StarfieldDisplay : public BobbyDisplay
|
||||
public:
|
||||
StarfieldDisplay();
|
||||
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
void stop() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
@ -6,7 +6,6 @@
|
||||
// 3rdparty lib includes
|
||||
#include <espwifistack.h>
|
||||
#include <fmt/core.h>
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/batteryinfodisplay.h"
|
||||
@ -29,9 +28,9 @@ namespace {
|
||||
constexpr const char * const TAG = "STATUS";
|
||||
} // namespace
|
||||
|
||||
void StatusDisplay::initScreen()
|
||||
void StatusDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(tft);
|
||||
|
||||
tft.setTextFont(2);
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
|
@ -21,8 +21,8 @@ class StatusDisplay : public BobbyDisplay
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
#include <espasyncota.h>
|
||||
#include <esp_ota_ops.h>
|
||||
@ -18,26 +17,26 @@
|
||||
#include "ota.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
void UpdateDisplay::initScreen()
|
||||
void UpdateDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
Base::initScreen(espgui::TftInterface &tft);
|
||||
|
||||
espgui::tft.setTextFont(4);
|
||||
espgui::tft.setTextColor(TFT_YELLOW);
|
||||
tft.setTextFont(4);
|
||||
tft.setTextColor(TFT_YELLOW);
|
||||
|
||||
espgui::tft.drawString("Update", 5, 5, 4);
|
||||
tft.drawString("Update", 5, 5, 4);
|
||||
|
||||
espgui::tft.fillRect(0, 34, espgui::tft.width(), 3, TFT_WHITE);
|
||||
tft.fillRect(0, 34, tft.width(), 3, TFT_WHITE);
|
||||
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
espgui::tft.drawString("Status:", 20, m_statusLabel.y());
|
||||
tft.drawString("Status:", 20, m_statusLabel.y());
|
||||
m_statusLabel.start();
|
||||
|
||||
espgui::tft.drawString("Progress:", 20, m_progressLabel.y());
|
||||
tft.drawString("Progress:", 20, m_progressLabel.y());
|
||||
m_progressLabel.start();
|
||||
|
||||
espgui::tft.drawString("Total:", 20, m_totalLabel.y());
|
||||
tft.drawString("Total:", 20, m_totalLabel.y());
|
||||
m_totalLabel.start();
|
||||
|
||||
m_messageLabel.start();
|
||||
@ -46,9 +45,9 @@ void UpdateDisplay::initScreen()
|
||||
|
||||
if (const esp_app_desc_t *app_desc = esp_ota_get_app_description())
|
||||
{
|
||||
espgui::tft.setTextColor(TFT_ORANGE, TFT_BLACK);
|
||||
espgui::tft.drawString(app_desc->version, 20, 250);
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_ORANGE, TFT_BLACK);
|
||||
tft.drawString(app_desc->version, 20, 250);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
}
|
||||
|
||||
m_newVersionLabel.start();
|
||||
@ -77,9 +76,9 @@ void UpdateDisplay::redraw()
|
||||
|
||||
if (const auto &appDesc = asyncOta->appDesc())
|
||||
{
|
||||
espgui::tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
m_newVersionLabel.redraw(appDesc->version);
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
}
|
||||
else
|
||||
m_newVersionLabel.clear();
|
||||
|
@ -12,8 +12,8 @@ class UpdateDisplay : public BobbyDisplay
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
|
@ -3,24 +3,23 @@
|
||||
// 3rdparty lib includes
|
||||
#include <fmt/core.h>
|
||||
#include <screenmanager.h>
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbybuttons.h"
|
||||
|
||||
XYDebugDisplay::XYDebugDisplay() : m_labelCoordinates{5, 5} {}
|
||||
|
||||
void XYDebugDisplay::initScreen()
|
||||
void XYDebugDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
Base::initScreen();
|
||||
m_labelCoordinates.start();
|
||||
Base::initScreen(tft);
|
||||
m_labelCoordinates.start(tft);
|
||||
}
|
||||
|
||||
void XYDebugDisplay::redraw()
|
||||
void XYDebugDisplay::redraw(espgui::TftInterface &tft)
|
||||
{
|
||||
using namespace espgui;
|
||||
|
||||
Base::redraw();
|
||||
Base::redraw(tft);
|
||||
m_labelCoordinates.redraw(fmt::format("X: {}, Y: {}", m_current_cursor.x, m_current_cursor.y));
|
||||
|
||||
if (m_current_cursor.x != m_last_cursor.x || m_current_cursor.y != m_last_cursor.y)
|
||||
@ -55,7 +54,7 @@ void XYDebugDisplay::buttonPressed(espgui::Button button)
|
||||
}
|
||||
break;
|
||||
case BobbyButton::Right2:
|
||||
if (m_current_cursor.x < espgui::tft.width() - 1)
|
||||
if (m_current_cursor.x < tft.width() - 1)
|
||||
{
|
||||
++m_current_cursor.x;
|
||||
}
|
||||
@ -67,7 +66,7 @@ void XYDebugDisplay::buttonPressed(espgui::Button button)
|
||||
}
|
||||
break;
|
||||
case BobbyButton::Down2:
|
||||
if (m_current_cursor.y < espgui::tft.height() - 1)
|
||||
if (m_current_cursor.y < tft.height() - 1)
|
||||
{
|
||||
++m_current_cursor.y;
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ class XYDebugDisplay : public BobbyDisplay
|
||||
|
||||
public:
|
||||
XYDebugDisplay();
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "screens.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
@ -25,9 +24,9 @@ void initScreen()
|
||||
tft.setTextColor(TFT_BLACK, TFT_WHITE);
|
||||
tft.setTextFont(4);
|
||||
tft.setRotation(configs.boardcomputerHardware.flipScreen.value() ? 2 : 0);
|
||||
espgui::tft.setSwapBytes(true);
|
||||
tft.setSwapBytes(true);
|
||||
tft.pushImage(0, 40, bobbyicons::logo.WIDTH, bobbyicons::logo.HEIGHT, bobbyicons::logo.buffer);
|
||||
espgui::tft.setSwapBytes(false);
|
||||
tft.setSwapBytes(false);
|
||||
tft.drawString("Bobbycar-OS", 32, 200);
|
||||
tft.drawString("booting...", 32, 225);
|
||||
tft.setTextFont(2);
|
||||
|
@ -3,9 +3,6 @@
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "newsettings.h"
|
||||
|
@ -3,9 +3,6 @@
|
||||
// 3rdparty lib includes
|
||||
#include <cpputils.h>
|
||||
|
||||
// local includes
|
||||
#include "tftinstance.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
namespace bobbygui {
|
||||
|
Reference in New Issue
Block a user