Merge pull request #165 from bobbycar-graz/reduce_statusdisplay_fps

Reduce StatusDisplay FPS to increase performance
This commit is contained in:
2021-12-19 18:26:44 +01:00
committed by GitHub
2 changed files with 12 additions and 0 deletions

View File

@ -16,6 +16,7 @@
#include "udpcloud.h"
#include "modes/defaultmode.h"
using namespace std::chrono_literals;
using namespace espgui;
namespace {
@ -70,6 +71,14 @@ void StatusDisplay::initScreen()
void StatusDisplay::redraw()
{
Base::redraw();
{
const auto now = espchrono::millis_clock::now();
if (now - lastRedraw < 50ms)
return;
lastRedraw = now;
}
if (settings.handbremse.enable && settings.handbremse.visualize && handbremse::angezogen)
tft.fillRect(0, tft.height()-6, tft.width(), 6, TFT_RED);
else if (settings.handbremse.enable && settings.handbremse.visualize && handbremse::stateWish == handbremse::StateWish::brake)

View File

@ -8,6 +8,7 @@
#include <actions/switchscreenaction.h>
#include <widgets/label.h>
#include <widgets/progressbar.h>
#include <espchrono.h>
// local includes
#include "modeinterface.h"
@ -69,6 +70,8 @@ private:
MotorStatus m_rightMotor;
};
espchrono::millis_clock::time_point lastRedraw;
espgui::Label m_labelRawGas{45, 0}; // 40, 15
espgui::Label m_labelGas{90, 0}; // 60, 15
espgui::ProgressBar m_progressBarGas{150, 0, 90, 15, 0, 1000};