Merge pull request #71 from bobbycar-graz/graphs-improvements
Improve graphs
This commit is contained in:
@ -12,11 +12,8 @@ class MultiAction<T> : public virtual ActionInterface
|
|||||||
public:
|
public:
|
||||||
void triggered() override
|
void triggered() override
|
||||||
{
|
{
|
||||||
m_action.triggered();
|
T{}.triggered();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
T m_action;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T, typename ...Tmore>
|
template<typename T, typename ...Tmore>
|
||||||
@ -25,11 +22,8 @@ class MultiAction<T, Tmore...> : public virtual MultiAction<Tmore...>
|
|||||||
public:
|
public:
|
||||||
void triggered() override
|
void triggered() override
|
||||||
{
|
{
|
||||||
m_action.triggered();
|
T{}.triggered();
|
||||||
MultiAction<Tmore...>::triggered();
|
MultiAction<Tmore...>::triggered();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
T m_action;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -11,30 +11,38 @@ class ChangeValueDisplayInterface;
|
|||||||
namespace {
|
namespace {
|
||||||
class ConfirmInterface {
|
class ConfirmInterface {
|
||||||
public:
|
public:
|
||||||
virtual void confirm() {}
|
virtual void confirm() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BackInterface {
|
class BackInterface {
|
||||||
public:
|
public:
|
||||||
virtual void back() {}
|
virtual void back() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class ConfirmActionInterface : public virtual ConfirmInterface
|
class ConfirmActionInterface : public virtual ConfirmInterface
|
||||||
{
|
{
|
||||||
T m_action;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void confirm() override { m_action.triggered(); }
|
void confirm() override { T{}.triggered(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
class DummyConfirm : public virtual ConfirmInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void confirm() override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class BackActionInterface : public virtual BackInterface
|
class BackActionInterface : public virtual BackInterface
|
||||||
{
|
{
|
||||||
T m_action;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void back() override { m_action.triggered(); }
|
void back() override { T{}.triggered(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
class DummyBack : public virtual BackInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void back() override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Display : public virtual ConfirmInterface, public virtual BackInterface {
|
class Display : public virtual ConfirmInterface, public virtual BackInterface {
|
||||||
|
@ -15,7 +15,7 @@ class StatusDisplay;
|
|||||||
}
|
}
|
||||||
namespace {
|
namespace {
|
||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
class BmsDisplay : public Display, public ConfirmActionInterface<SwitchScreenAction<MainMenu>>
|
class BmsDisplay : public Display, public ConfirmActionInterface<SwitchScreenAction<MainMenu>>, public DummyBack
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void initScreen() override;
|
void initScreen() override;
|
||||||
|
@ -189,12 +189,12 @@ void CalibrateDisplay::redraw()
|
|||||||
}
|
}
|
||||||
__builtin_unreachable();
|
__builtin_unreachable();
|
||||||
}());
|
}());
|
||||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
|
||||||
|
|
||||||
if (m_selectedButton != m_renderedButton && (m_selectedButton == 0 || m_renderedButton == 0))
|
if (m_selectedButton != m_renderedButton && (m_selectedButton == 0 || m_renderedButton == 0))
|
||||||
tft.drawRect(23, 275, 100, 27, m_selectedButton == 0 ? color : TFT_BLACK);
|
tft.drawRect(3, 275, 100, 27, m_selectedButton == 0 ? color : TFT_BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||||
m_labels[10].redraw([&](){
|
m_labels[10].redraw([&](){
|
||||||
switch (m_status)
|
switch (m_status)
|
||||||
{
|
{
|
||||||
@ -203,13 +203,13 @@ void CalibrateDisplay::redraw()
|
|||||||
case Status::GasMax:
|
case Status::GasMax:
|
||||||
case Status::BremsMin:
|
case Status::BremsMin:
|
||||||
case Status::BremsMax:
|
case Status::BremsMax:
|
||||||
case Status::Confirm: return "Restart";
|
case Status::Confirm: return "Abort";
|
||||||
}
|
}
|
||||||
__builtin_unreachable();
|
__builtin_unreachable();
|
||||||
}());
|
}());
|
||||||
|
|
||||||
if (m_selectedButton != m_renderedButton && (m_selectedButton == 1 || m_renderedButton == 1))
|
if (m_selectedButton != m_renderedButton && (m_selectedButton == 1 || m_renderedButton == 1))
|
||||||
tft.drawRect(143, 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;
|
m_renderedButton = m_selectedButton;
|
||||||
}
|
}
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "display.h"
|
|
||||||
#include "actions/switchscreenaction.h"
|
|
||||||
#include "textinterface.h"
|
|
||||||
#include "widgets/label.h"
|
|
||||||
#include "widgets/graph.h"
|
|
||||||
#include "globals.h"
|
|
||||||
#include "statistics.h"
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
class GraphsMenu;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
class DualGraphDisplay : public Display, public ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>, public BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void initScreen() override;
|
|
||||||
void redraw() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Label m_titleLabel{5, 5}; // 230, 25
|
|
||||||
|
|
||||||
Graph<200, 1> m_graph0{0, 40, 133};
|
|
||||||
Graph<200, 1> m_graph1{0, 179, 133};
|
|
||||||
};
|
|
||||||
|
|
||||||
void DualGraphDisplay::initScreen()
|
|
||||||
{
|
|
||||||
tft.fillScreen(TFT_BLACK);
|
|
||||||
|
|
||||||
m_titleLabel.start();
|
|
||||||
tft.fillRect(0, 34, tft.width(), 3, TFT_WHITE);
|
|
||||||
|
|
||||||
m_graph0.start({statistics::gas});
|
|
||||||
m_graph1.start({statistics::brems});
|
|
||||||
}
|
|
||||||
|
|
||||||
void DualGraphDisplay::redraw()
|
|
||||||
{
|
|
||||||
tft.setTextFont(4);
|
|
||||||
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
|
|
||||||
m_titleLabel.redraw("Gas/Brems dual");
|
|
||||||
|
|
||||||
m_graph0.redraw({statistics::gas});
|
|
||||||
m_graph1.redraw({statistics::brems});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +1,37 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "actions/switchscreenaction.h"
|
|
||||||
#include "textinterface.h"
|
#include "textinterface.h"
|
||||||
#include "widgets/label.h"
|
#include "widgets/label.h"
|
||||||
#include "widgets/graph.h"
|
#include "widgets/graph.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "statistics.h"
|
#include "statistics.h"
|
||||||
|
|
||||||
namespace {
|
|
||||||
class GraphsMenu;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
template<size_t COUNT>
|
template<size_t COUNT>
|
||||||
class MultiStatisticsInterface
|
class GraphAccessorInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual std::array<std::reference_wrapper<const statistics::ContainerType>, COUNT> getBuffers() const = 0;
|
virtual std::array<std::reference_wrapper<const statistics::ContainerType>, COUNT> getBuffers() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MultiStatisticsSingleImpl : public virtual MultiStatisticsInterface<1>, public virtual BufferAccessorInterface
|
template<typename T>
|
||||||
|
class SingleGraphAccessor : public virtual GraphAccessorInterface<1>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::array<std::reference_wrapper<const statistics::ContainerType>, 1> getBuffers() const
|
Graph<200, 1>::Container getBuffers() const
|
||||||
{
|
{
|
||||||
return {getBuffer()};
|
return {T{}.getBuffer()};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T1, typename T2>
|
||||||
|
class DualGraphAccessor : public virtual GraphAccessorInterface<2>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Graph<200, 2>::Container getBuffers() const
|
||||||
|
{
|
||||||
|
return {T1{}.getBuffer(), T2{}.getBuffer()};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -33,9 +39,7 @@ template<size_t COUNT>
|
|||||||
class GraphDisplay :
|
class GraphDisplay :
|
||||||
public Display,
|
public Display,
|
||||||
public virtual TextInterface,
|
public virtual TextInterface,
|
||||||
public ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
public virtual GraphAccessorInterface<COUNT>
|
||||||
public BackActionInterface<SwitchScreenAction<GraphsMenu>>,
|
|
||||||
public virtual MultiStatisticsInterface<COUNT>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void initScreen() override;
|
void initScreen() override;
|
||||||
@ -58,7 +62,7 @@ void GraphDisplay<COUNT>::initScreen()
|
|||||||
m_titleLabel.start();
|
m_titleLabel.start();
|
||||||
tft.fillRect(0, 34, tft.width(), 3, TFT_WHITE);
|
tft.fillRect(0, 34, tft.width(), 3, TFT_WHITE);
|
||||||
|
|
||||||
m_graph.start(static_cast<const MultiStatisticsInterface<COUNT> &>(*this).getBuffers());
|
m_graph.start(static_cast<const GraphAccessorInterface<COUNT> &>(*this).getBuffers());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<size_t COUNT>
|
template<size_t COUNT>
|
||||||
@ -68,6 +72,6 @@ void GraphDisplay<COUNT>::redraw()
|
|||||||
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
|
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
|
||||||
m_titleLabel.redraw(text());
|
m_titleLabel.redraw(text());
|
||||||
|
|
||||||
m_graph.redraw(static_cast<const MultiStatisticsInterface<COUNT> &>(*this).getBuffers());
|
m_graph.redraw(static_cast<const GraphAccessorInterface<COUNT> &>(*this).getBuffers());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ class MainMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class Lockscreen : public Display
|
class Lockscreen : public Display, public DummyBack
|
||||||
{
|
{
|
||||||
using Base = Display;
|
using Base = Display;
|
||||||
|
|
||||||
|
@ -7,44 +7,143 @@
|
|||||||
#include "icons/back.h"
|
#include "icons/back.h"
|
||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
#include "displays/graphdisplay.h"
|
#include "displays/graphdisplay.h"
|
||||||
|
#include "displays/splitgraphdisplay.h"
|
||||||
#include "statistics.h"
|
#include "statistics.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class MainMenu;
|
class MainMenu;
|
||||||
class DualGraphDisplay;
|
class GraphsMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
using GasGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_GAS>, MultiStatisticsSingleImpl, GasStatistics>;
|
using GasGraphDisplay = makeComponent<
|
||||||
using BremsGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_BREMS>, MultiStatisticsSingleImpl, BremsStatistics>;
|
GraphDisplay<1>,
|
||||||
using AvgSpeedGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_AVGSPEED>, MultiStatisticsSingleImpl, AvgSpeedStatistics>;
|
StaticText<TEXT_GAS>,
|
||||||
using AvgSpeedKmhGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_AVGSPEEDKMH>, MultiStatisticsSingleImpl, AvgSpeedKmhStatistics>;
|
SingleGraphAccessor<GasStatistics>,
|
||||||
using SumCurrentGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_SUMCURRENT>, MultiStatisticsSingleImpl, SumCurrentStatistics>;
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
using FrontVoltageGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_FRONTVOLTAGE>, MultiStatisticsSingleImpl, FrontVoltageStatistics>;
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
using BackVoltageGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_BACKVOLTAGE>, MultiStatisticsSingleImpl, BackVoltageStatistics>;
|
>;
|
||||||
#ifdef FEATURE_BMS
|
using BremsGraphDisplay = makeComponent<
|
||||||
using BmsVoltageGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_BMSVOLTAGE>, MultiStatisticsSingleImpl, BmsVoltageStatistics>;
|
GraphDisplay<1>,
|
||||||
using BmsCurrentGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_BMSCURRENT>, MultiStatisticsSingleImpl, BmsCurrentStatistics>;
|
StaticText<TEXT_BREMS>,
|
||||||
using BmsPowerGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_BMSPOWER>, MultiStatisticsSingleImpl, BmsPowerStatistics>;
|
SingleGraphAccessor<BremsStatistics>,
|
||||||
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
|
>;
|
||||||
|
using PotisGraphDisplay = makeComponent<
|
||||||
|
GraphDisplay<2>,
|
||||||
|
StaticText<TEXT_POTIS>,
|
||||||
|
DualGraphAccessor<GasStatistics, BremsStatistics>,
|
||||||
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
|
>;
|
||||||
|
using PotisSplitGraphDisplay = makeComponent<
|
||||||
|
SplitGraphDisplay<1, 1>,
|
||||||
|
StaticText<TEXT_POTIS>,
|
||||||
|
SingleTopGraphAccessor<GasStatistics>,
|
||||||
|
SingleBottomGraphAccessor<BremsStatistics>,
|
||||||
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
|
>;
|
||||||
|
|
||||||
class SumCurrentsComparisonStatistics : public virtual MultiStatisticsInterface<2>
|
using AvgSpeedGraphDisplay = makeComponent<
|
||||||
{
|
GraphDisplay<1>,
|
||||||
std::array<std::reference_wrapper<const statistics::ContainerType>, 2> getBuffers() const override
|
StaticText<TEXT_AVGSPEED>,
|
||||||
{
|
SingleGraphAccessor<AvgSpeedStatistics>,
|
||||||
return {SumCurrentStatistics{}.getBuffer(), BmsCurrentStatistics{}.getBuffer()};
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
}
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
};
|
>;
|
||||||
using SumCurrentsComparisonGraphDisplay = makeComponent<GraphDisplay<2>, StaticText<TEXT_SUMCURRENTSCOMPARISON>, SumCurrentsComparisonStatistics>;
|
using AvgSpeedKmhGraphDisplay = makeComponent<
|
||||||
|
GraphDisplay<1>,
|
||||||
|
StaticText<TEXT_AVGSPEEDKMH>,
|
||||||
|
SingleGraphAccessor<AvgSpeedKmhStatistics>,
|
||||||
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
using SumCurrentGraphDisplay = makeComponent<
|
||||||
|
GraphDisplay<1>,
|
||||||
|
StaticText<TEXT_SUMCURRENT>,
|
||||||
|
SingleGraphAccessor<SumCurrentStatistics>,
|
||||||
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
using FrontVoltageGraphDisplay = makeComponent<
|
||||||
|
GraphDisplay<1>,
|
||||||
|
StaticText<TEXT_FRONTVOLTAGE>,
|
||||||
|
SingleGraphAccessor<FrontVoltageStatistics>,
|
||||||
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
|
>;
|
||||||
|
using BackVoltageGraphDisplay = makeComponent<
|
||||||
|
GraphDisplay<1>,
|
||||||
|
StaticText<TEXT_BACKVOLTAGE>,
|
||||||
|
SingleGraphAccessor<BackVoltageStatistics>,
|
||||||
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
|
>;
|
||||||
|
using VoltagesGraphDisplay = makeComponent<
|
||||||
|
GraphDisplay<2>,
|
||||||
|
StaticText<TEXT_VOLTAGES>,
|
||||||
|
DualGraphAccessor<FrontVoltageStatistics, BackVoltageStatistics>,
|
||||||
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
|
>;
|
||||||
|
using VoltagesSplitGraphDisplay = makeComponent<
|
||||||
|
SplitGraphDisplay<1, 1>,
|
||||||
|
StaticText<TEXT_VOLTAGES>,
|
||||||
|
SingleTopGraphAccessor<FrontVoltageStatistics>,
|
||||||
|
SingleBottomGraphAccessor<BackVoltageStatistics>,
|
||||||
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
#ifdef FEATURE_BMS
|
||||||
|
using BmsVoltageGraphDisplay = makeComponent<
|
||||||
|
GraphDisplay<1>,
|
||||||
|
StaticText<TEXT_BMSVOLTAGE>,
|
||||||
|
SingleGraphAccessor<BmsVoltageStatistics>,
|
||||||
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
|
>;
|
||||||
|
using BmsCurrentGraphDisplay = makeComponent<
|
||||||
|
GraphDisplay<1>,
|
||||||
|
StaticText<TEXT_BMSCURRENT>,
|
||||||
|
SingleGraphAccessor<BmsCurrentStatistics>,
|
||||||
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
|
>;
|
||||||
|
using BmsPowerGraphDisplay = makeComponent<
|
||||||
|
GraphDisplay<1>,
|
||||||
|
StaticText<TEXT_BMSPOWER>,
|
||||||
|
SingleGraphAccessor<BmsPowerStatistics>,
|
||||||
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
|
>;
|
||||||
|
using SumCurrentsComparisonGraphDisplay = makeComponent<
|
||||||
|
GraphDisplay<2>,
|
||||||
|
StaticText<TEXT_SUMCURRENTSCOMPARISON>,
|
||||||
|
DualGraphAccessor<SumCurrentStatistics, BmsCurrentStatistics>,
|
||||||
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
|
>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class MotorCurrentsStatistics : public virtual MultiStatisticsInterface<4>
|
class MotorCurrentsStatistics : public virtual GraphAccessorInterface<4>
|
||||||
{
|
{
|
||||||
std::array<std::reference_wrapper<const statistics::ContainerType>, 4> getBuffers() const override
|
std::array<std::reference_wrapper<const statistics::ContainerType>, 4> getBuffers() const override
|
||||||
{
|
{
|
||||||
return {FrontLeftCurrentStatistics{}.getBuffer(), FrontRightCurrentStatistics{}.getBuffer(), BackLeftCurrentStatistics{}.getBuffer(), BackRightCurrentStatistics{}.getBuffer()};
|
return {FrontLeftCurrentStatistics{}.getBuffer(), FrontRightCurrentStatistics{}.getBuffer(), BackLeftCurrentStatistics{}.getBuffer(), BackRightCurrentStatistics{}.getBuffer()};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
using MotorCurrentsGraphDisplay = makeComponent<GraphDisplay<4>, StaticText<TEXT_MOTORCURRENTS>, MotorCurrentsStatistics>;
|
using MotorCurrentsGraphDisplay = makeComponent<
|
||||||
|
GraphDisplay<4>,
|
||||||
|
StaticText<TEXT_MOTORCURRENTS>,
|
||||||
|
MotorCurrentsStatistics,
|
||||||
|
ConfirmActionInterface<SwitchScreenAction<GraphsMenu>>,
|
||||||
|
BackActionInterface<SwitchScreenAction<GraphsMenu>>
|
||||||
|
>;
|
||||||
|
|
||||||
class GraphsMenu :
|
class GraphsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
@ -53,11 +152,15 @@ class GraphsMenu :
|
|||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_GAS>, SwitchScreenAction<GasGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_GAS>, SwitchScreenAction<GasGraphDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BREMS>, SwitchScreenAction<BremsGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_BREMS>, SwitchScreenAction<BremsGraphDisplay>>,
|
||||||
|
makeComponent<MenuItem, StaticText<TEXT_POTIS>, SwitchScreenAction<PotisGraphDisplay>>,
|
||||||
|
makeComponent<MenuItem, StaticText<TEXT_POTIS>, SwitchScreenAction<PotisSplitGraphDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_AVGSPEED>, SwitchScreenAction<AvgSpeedGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_AVGSPEED>, SwitchScreenAction<AvgSpeedGraphDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_AVGSPEEDKMH>, SwitchScreenAction<AvgSpeedKmhGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_AVGSPEEDKMH>, SwitchScreenAction<AvgSpeedKmhGraphDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SUMCURRENT>, SwitchScreenAction<SumCurrentGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_SUMCURRENT>, SwitchScreenAction<SumCurrentGraphDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_FRONTVOLTAGE>, SwitchScreenAction<FrontVoltageGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_FRONTVOLTAGE>, SwitchScreenAction<FrontVoltageGraphDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BACKVOLTAGE>, SwitchScreenAction<BackVoltageGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_BACKVOLTAGE>, SwitchScreenAction<BackVoltageGraphDisplay>>,
|
||||||
|
makeComponent<MenuItem, StaticText<TEXT_VOLTAGES>, SwitchScreenAction<VoltagesGraphDisplay>>,
|
||||||
|
makeComponent<MenuItem, StaticText<TEXT_VOLTAGES>, SwitchScreenAction<VoltagesSplitGraphDisplay>>,
|
||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BMSVOLTAGE>, SwitchScreenAction<BmsVoltageGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_BMSVOLTAGE>, SwitchScreenAction<BmsVoltageGraphDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BMSCURRENT>, SwitchScreenAction<BmsCurrentGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_BMSCURRENT>, SwitchScreenAction<BmsCurrentGraphDisplay>>,
|
||||||
@ -65,7 +168,6 @@ class GraphsMenu :
|
|||||||
makeComponent<MenuItem, StaticText<TEXT_SUMCURRENTSCOMPARISON>, SwitchScreenAction<SumCurrentsComparisonGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_SUMCURRENTSCOMPARISON>, SwitchScreenAction<SumCurrentsComparisonGraphDisplay>>,
|
||||||
#endif
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<TEXT_MOTORCURRENTS>, SwitchScreenAction<MotorCurrentsGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_MOTORCURRENTS>, SwitchScreenAction<MotorCurrentsGraphDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_DUALGRAPHS>, SwitchScreenAction<DualGraphDisplay>>,
|
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<MainMenu>, StaticMenuItemIcon<&icons::back>>
|
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<MainMenu>, StaticMenuItemIcon<&icons::back>>
|
||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
|
@ -39,12 +39,12 @@ private:
|
|||||||
|
|
||||||
static constexpr auto x = 40;
|
static constexpr auto x = 40;
|
||||||
std::array<VerticalMeter, 6> meters{{
|
std::array<VerticalMeter, 6> meters{{
|
||||||
VerticalMeter{"U f", "%.1fV", 0*x, 160},
|
VerticalMeter{"U f", "%.1f", 0*x, 160},
|
||||||
VerticalMeter{"U b", "%.1fV", 1*x, 160},
|
VerticalMeter{"U b", "%.1f", 1*x, 160},
|
||||||
VerticalMeter{"Ivl", "%.1fA", 2*x, 160},
|
VerticalMeter{"Ibl", "%.1f", 2*x, 160},
|
||||||
VerticalMeter{"Ivr", "%.1fA", 3*x, 160},
|
VerticalMeter{"Ibr", "%.1f", 3*x, 160},
|
||||||
VerticalMeter{"Ihl", "%.1fA", 4*x, 160},
|
VerticalMeter{"Ihl", "%.1f", 4*x, 160},
|
||||||
VerticalMeter{"Ihr", "%.1fA", 5*x, 160}
|
VerticalMeter{"Ihr", "%.1f", 5*x, 160}
|
||||||
}};
|
}};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ class MainMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class PoweroffDisplay : public Display
|
class PoweroffDisplay : public Display, public DummyConfirm, public DummyBack
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void start() override;
|
void start() override;
|
||||||
|
@ -13,7 +13,7 @@ class DemosMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class SpiroDisplay : public Display, public SwitchScreenAction<DemosMenu>, public BackActionInterface<SwitchScreenAction<DemosMenu>>
|
class SpiroDisplay : public Display, public SwitchScreenAction<DemosMenu>, public DummyConfirm, public BackActionInterface<SwitchScreenAction<DemosMenu>>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void initScreen() override;
|
void initScreen() override;
|
||||||
|
85
src/displays/splitgraphdisplay.h
Normal file
85
src/displays/splitgraphdisplay.h
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "display.h"
|
||||||
|
#include "textinterface.h"
|
||||||
|
#include "widgets/label.h"
|
||||||
|
#include "widgets/graph.h"
|
||||||
|
#include "globals.h"
|
||||||
|
#include "statistics.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
template<std::size_t COUNT>
|
||||||
|
class TopGraphAccessorInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual typename Graph<200, COUNT>::Container getTopBuffers() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class SingleTopGraphAccessor : public virtual TopGraphAccessorInterface<1>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typename Graph<200, 1>::Container getTopBuffers() const override
|
||||||
|
{
|
||||||
|
return {T{}.getBuffer()};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<std::size_t COUNT>
|
||||||
|
class BottomGraphAccessorInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual typename Graph<200, COUNT>::Container getBottomBuffers() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class SingleBottomGraphAccessor : public virtual BottomGraphAccessorInterface<1>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typename Graph<200, 1>::Container getBottomBuffers() const override
|
||||||
|
{
|
||||||
|
return {T{}.getBuffer()};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<std::size_t COUNT0, std::size_t COUNT1>
|
||||||
|
class SplitGraphDisplay :
|
||||||
|
public Display,
|
||||||
|
public virtual TextInterface,
|
||||||
|
public virtual TopGraphAccessorInterface<COUNT0>,
|
||||||
|
public virtual BottomGraphAccessorInterface<COUNT1>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void initScreen() override;
|
||||||
|
void redraw() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Label m_titleLabel{5, 5}; // 230, 25
|
||||||
|
|
||||||
|
Graph<200, COUNT0> m_graph0{0, 40, 133};
|
||||||
|
Graph<200, COUNT1> m_graph1{0, 179, 133};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<std::size_t COUNT0, std::size_t COUNT1>
|
||||||
|
void SplitGraphDisplay<COUNT0, COUNT1>::initScreen()
|
||||||
|
{
|
||||||
|
tft.fillScreen(TFT_BLACK);
|
||||||
|
|
||||||
|
m_titleLabel.start();
|
||||||
|
tft.fillRect(0, 34, tft.width(), 3, TFT_WHITE);
|
||||||
|
|
||||||
|
m_graph0.start(static_cast<const TopGraphAccessorInterface<COUNT0>&>(*this).getTopBuffers());
|
||||||
|
m_graph1.start(static_cast<const BottomGraphAccessorInterface<COUNT1>&>(*this).getBottomBuffers());
|
||||||
|
}
|
||||||
|
|
||||||
|
template<std::size_t COUNT0, std::size_t COUNT1>
|
||||||
|
void SplitGraphDisplay<COUNT0, COUNT1>::redraw()
|
||||||
|
{
|
||||||
|
tft.setTextFont(4);
|
||||||
|
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
|
||||||
|
m_titleLabel.redraw(text());
|
||||||
|
|
||||||
|
m_graph0.redraw(static_cast<const TopGraphAccessorInterface<COUNT0>&>(*this).getTopBuffers());
|
||||||
|
m_graph1.redraw(static_cast<const BottomGraphAccessorInterface<COUNT1>&>(*this).getBottomBuffers());
|
||||||
|
}
|
||||||
|
}
|
@ -20,7 +20,7 @@ class MetersDisplay;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class StatusDisplay : public Display, public ConfirmActionInterface<SwitchScreenAction<MainMenu>>
|
class StatusDisplay : public Display, public ConfirmActionInterface<SwitchScreenAction<MainMenu>>, public DummyBack
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void initScreen() override;
|
void initScreen() override;
|
||||||
|
@ -19,7 +19,7 @@ class StatusDisplay;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
#ifdef FEATURE_OTA
|
#ifdef FEATURE_OTA
|
||||||
class UpdateDisplay : public Display
|
class UpdateDisplay : public Display, public DummyBack
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UpdateDisplay(const String &title);
|
UpdateDisplay(const String &title);
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#include "displays/menus/wifisettingsmenu.h"
|
#include "displays/menus/wifisettingsmenu.h"
|
||||||
#include "displays/bmsdisplay.h"
|
#include "displays/bmsdisplay.h"
|
||||||
#include "displays/calibratedisplay.h"
|
#include "displays/calibratedisplay.h"
|
||||||
#include "displays/dualgraphdisplay.h"
|
|
||||||
#include "displays/gameoflifedisplay.h"
|
#include "displays/gameoflifedisplay.h"
|
||||||
#include "displays/gametrakcalibratedisplay.h"
|
#include "displays/gametrakcalibratedisplay.h"
|
||||||
#include "displays/lockscreen.h"
|
#include "displays/lockscreen.h"
|
||||||
@ -108,7 +107,6 @@ union X {
|
|||||||
BmsDisplay bmsDisplay;
|
BmsDisplay bmsDisplay;
|
||||||
#endif
|
#endif
|
||||||
CalibrateDisplay calibrateDisplay;
|
CalibrateDisplay calibrateDisplay;
|
||||||
DualGraphDisplay dualGraphDisplay;
|
|
||||||
GameOfLifeDisplay gameOfLifeDisplay;
|
GameOfLifeDisplay gameOfLifeDisplay;
|
||||||
#ifdef FEATURE_GAMETRAK
|
#ifdef FEATURE_GAMETRAK
|
||||||
GametrakCalibrateDisplay gametrakCalibrateDisplay;
|
GametrakCalibrateDisplay gametrakCalibrateDisplay;
|
||||||
@ -192,11 +190,15 @@ union X {
|
|||||||
|
|
||||||
GasGraphDisplay gasGraphDisplay;
|
GasGraphDisplay gasGraphDisplay;
|
||||||
BremsGraphDisplay bremsGraphDisplay;
|
BremsGraphDisplay bremsGraphDisplay;
|
||||||
|
PotisGraphDisplay potisGraphDisplay;
|
||||||
|
PotisSplitGraphDisplay potisSplitGraphDisplay;
|
||||||
AvgSpeedGraphDisplay avgSpeedGraphDisplay;
|
AvgSpeedGraphDisplay avgSpeedGraphDisplay;
|
||||||
AvgSpeedKmhGraphDisplay avgSpeedKmhGraphDisplay;
|
AvgSpeedKmhGraphDisplay avgSpeedKmhGraphDisplay;
|
||||||
SumCurrentGraphDisplay sumCurrentGraphDisplay;
|
SumCurrentGraphDisplay sumCurrentGraphDisplay;
|
||||||
FrontVoltageGraphDisplay frontVoltageGraphDisplay;
|
FrontVoltageGraphDisplay frontVoltageGraphDisplay;
|
||||||
BackVoltageGraphDisplay backVoltageGraphDisplay;
|
BackVoltageGraphDisplay backVoltageGraphDisplay;
|
||||||
|
VoltagesGraphDisplay voltagesGraphDisplay;
|
||||||
|
VoltagesSplitGraphDisplay voltagesSplitGraphDisplay;
|
||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
BmsVoltageGraphDisplay bmsVoltageGraphDisplay;
|
BmsVoltageGraphDisplay bmsVoltageGraphDisplay;
|
||||||
BmsCurrentGraphDisplay bmsCurrentGraphDisplay;
|
BmsCurrentGraphDisplay bmsCurrentGraphDisplay;
|
||||||
@ -260,7 +262,6 @@ template<> decltype(displays.wifiSettingsMenu) &
|
|||||||
template<> decltype(displays.bmsDisplay) &getRefByType<decltype(displays.bmsDisplay)>() { return displays.bmsDisplay; }
|
template<> decltype(displays.bmsDisplay) &getRefByType<decltype(displays.bmsDisplay)>() { return displays.bmsDisplay; }
|
||||||
#endif
|
#endif
|
||||||
template<> decltype(displays.calibrateDisplay) &getRefByType<decltype(displays.calibrateDisplay)>() { return displays.calibrateDisplay; }
|
template<> decltype(displays.calibrateDisplay) &getRefByType<decltype(displays.calibrateDisplay)>() { return displays.calibrateDisplay; }
|
||||||
template<> decltype(displays.dualGraphDisplay) &getRefByType<decltype(displays.dualGraphDisplay)>() { return displays.dualGraphDisplay; }
|
|
||||||
template<> decltype(displays.gameOfLifeDisplay) &getRefByType<decltype(displays.gameOfLifeDisplay)>() { return displays.gameOfLifeDisplay; }
|
template<> decltype(displays.gameOfLifeDisplay) &getRefByType<decltype(displays.gameOfLifeDisplay)>() { return displays.gameOfLifeDisplay; }
|
||||||
#ifdef FEATURE_GAMETRAK
|
#ifdef FEATURE_GAMETRAK
|
||||||
template<> decltype(displays.gametrakCalibrateDisplay) &getRefByType<decltype(displays.gametrakCalibrateDisplay)>() { return displays.gametrakCalibrateDisplay; }
|
template<> decltype(displays.gametrakCalibrateDisplay) &getRefByType<decltype(displays.gametrakCalibrateDisplay)>() { return displays.gametrakCalibrateDisplay; }
|
||||||
@ -344,11 +345,15 @@ template<> decltype(displays.wifiTxPowerChangeScreen) &
|
|||||||
|
|
||||||
template<> decltype(displays.gasGraphDisplay) &getRefByType<decltype(displays.gasGraphDisplay)>() { return displays.gasGraphDisplay; }
|
template<> decltype(displays.gasGraphDisplay) &getRefByType<decltype(displays.gasGraphDisplay)>() { return displays.gasGraphDisplay; }
|
||||||
template<> decltype(displays.bremsGraphDisplay) &getRefByType<decltype(displays.bremsGraphDisplay)>() { return displays.bremsGraphDisplay; }
|
template<> decltype(displays.bremsGraphDisplay) &getRefByType<decltype(displays.bremsGraphDisplay)>() { return displays.bremsGraphDisplay; }
|
||||||
|
template<> decltype(displays.potisGraphDisplay) &getRefByType<decltype(displays.potisGraphDisplay)>() { return displays.potisGraphDisplay; }
|
||||||
|
template<> decltype(displays.potisSplitGraphDisplay) &getRefByType<decltype(displays.potisSplitGraphDisplay)>() { return displays.potisSplitGraphDisplay; }
|
||||||
template<> decltype(displays.avgSpeedGraphDisplay) &getRefByType<decltype(displays.avgSpeedGraphDisplay)>() { return displays.avgSpeedGraphDisplay; }
|
template<> decltype(displays.avgSpeedGraphDisplay) &getRefByType<decltype(displays.avgSpeedGraphDisplay)>() { return displays.avgSpeedGraphDisplay; }
|
||||||
template<> decltype(displays.avgSpeedKmhGraphDisplay) &getRefByType<decltype(displays.avgSpeedKmhGraphDisplay)>() { return displays.avgSpeedKmhGraphDisplay; }
|
template<> decltype(displays.avgSpeedKmhGraphDisplay) &getRefByType<decltype(displays.avgSpeedKmhGraphDisplay)>() { return displays.avgSpeedKmhGraphDisplay; }
|
||||||
template<> decltype(displays.sumCurrentGraphDisplay) &getRefByType<decltype(displays.sumCurrentGraphDisplay)>() { return displays.sumCurrentGraphDisplay; }
|
template<> decltype(displays.sumCurrentGraphDisplay) &getRefByType<decltype(displays.sumCurrentGraphDisplay)>() { return displays.sumCurrentGraphDisplay; }
|
||||||
template<> decltype(displays.frontVoltageGraphDisplay) &getRefByType<decltype(displays.frontVoltageGraphDisplay)>() { return displays.frontVoltageGraphDisplay; }
|
template<> decltype(displays.frontVoltageGraphDisplay) &getRefByType<decltype(displays.frontVoltageGraphDisplay)>() { return displays.frontVoltageGraphDisplay; }
|
||||||
template<> decltype(displays.backVoltageGraphDisplay) &getRefByType<decltype(displays.backVoltageGraphDisplay)>() { return displays.backVoltageGraphDisplay; }
|
template<> decltype(displays.backVoltageGraphDisplay) &getRefByType<decltype(displays.backVoltageGraphDisplay)>() { return displays.backVoltageGraphDisplay; }
|
||||||
|
template<> decltype(displays.voltagesGraphDisplay) &getRefByType<decltype(displays.voltagesGraphDisplay)>() { return displays.voltagesGraphDisplay; }
|
||||||
|
template<> decltype(displays.voltagesSplitGraphDisplay) &getRefByType<decltype(displays.voltagesSplitGraphDisplay)>() { return displays.voltagesSplitGraphDisplay; }
|
||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
template<> decltype(displays.bmsVoltageGraphDisplay) &getRefByType<decltype(displays.bmsVoltageGraphDisplay)>() { return displays.bmsVoltageGraphDisplay; }
|
template<> decltype(displays.bmsVoltageGraphDisplay) &getRefByType<decltype(displays.bmsVoltageGraphDisplay)>() { return displays.bmsVoltageGraphDisplay; }
|
||||||
template<> decltype(displays.bmsCurrentGraphDisplay) &getRefByType<decltype(displays.bmsCurrentGraphDisplay)>() { return displays.bmsCurrentGraphDisplay; }
|
template<> decltype(displays.bmsCurrentGraphDisplay) &getRefByType<decltype(displays.bmsCurrentGraphDisplay)>() { return displays.bmsCurrentGraphDisplay; }
|
||||||
|
@ -42,14 +42,14 @@ void pushStats()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
class BufferAccessorInterface
|
class StatisticsAccessorInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual const statistics::ContainerType &getBuffer() const = 0;
|
virtual const statistics::ContainerType &getBuffer() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<const statistics::ContainerType &T>
|
template<const statistics::ContainerType &T>
|
||||||
class BufferAccessorImpl : public virtual BufferAccessorInterface
|
class BufferAccessorImpl : public virtual StatisticsAccessorInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const statistics::ContainerType &getBuffer() const override { return T; }
|
const statistics::ContainerType &getBuffer() const override { return T; }
|
||||||
|
@ -178,17 +178,18 @@ constexpr char TEXT_WIFISCAN[] = "WiFi scan";
|
|||||||
//constexpr char TEXT_GRAPHS[] = "Graphs";
|
//constexpr char TEXT_GRAPHS[] = "Graphs";
|
||||||
constexpr char TEXT_GAS[] = "Gas";
|
constexpr char TEXT_GAS[] = "Gas";
|
||||||
constexpr char TEXT_BREMS[] = "Brems";
|
constexpr char TEXT_BREMS[] = "Brems";
|
||||||
|
constexpr char TEXT_POTIS[] = "Potis";
|
||||||
constexpr char TEXT_AVGSPEED[] = "Avg. speed";
|
constexpr char TEXT_AVGSPEED[] = "Avg. speed";
|
||||||
constexpr char TEXT_AVGSPEEDKMH[] = "Avg. speed KMH";
|
constexpr char TEXT_AVGSPEEDKMH[] = "Avg. speed KMH";
|
||||||
constexpr char TEXT_SUMCURRENT[] = "Sum current";
|
constexpr char TEXT_SUMCURRENT[] = "Sum current";
|
||||||
constexpr char TEXT_FRONTVOLTAGE[] = "Front voltage";
|
constexpr char TEXT_FRONTVOLTAGE[] = "Front voltage";
|
||||||
constexpr char TEXT_BACKVOLTAGE[] = "Back voltage";
|
constexpr char TEXT_BACKVOLTAGE[] = "Back voltage";
|
||||||
|
constexpr char TEXT_VOLTAGES[] = "Voltages";
|
||||||
constexpr char TEXT_BMSVOLTAGE[] = "BMS voltage";
|
constexpr char TEXT_BMSVOLTAGE[] = "BMS voltage";
|
||||||
constexpr char TEXT_BMSCURRENT[] = "BMS current";
|
constexpr char TEXT_BMSCURRENT[] = "BMS current";
|
||||||
constexpr char TEXT_BMSPOWER[] = "BMS power";
|
constexpr char TEXT_BMSPOWER[] = "BMS power";
|
||||||
constexpr char TEXT_SUMCURRENTSCOMPARISON[] = "Sum currents comparison";
|
constexpr char TEXT_SUMCURRENTSCOMPARISON[] = "Sum currents comparison";
|
||||||
constexpr char TEXT_MOTORCURRENTS[] = "Motor currents";
|
constexpr char TEXT_MOTORCURRENTS[] = "Motor currents";
|
||||||
constexpr char TEXT_DUALGRAPHS[] = "Dual graphs";
|
|
||||||
//constexpr char TEXT_BACK[] = "Back";
|
//constexpr char TEXT_BACK[] = "Back";
|
||||||
|
|
||||||
//InvertMenu
|
//InvertMenu
|
||||||
|
@ -15,15 +15,16 @@ class Graph
|
|||||||
static constexpr int leftMargin = 40;
|
static constexpr int leftMargin = 40;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using Container = std::array<std::reference_wrapper<const ring_buffer<float, LENGTH>>, COUNT>;
|
||||||
static constexpr int WIDTH = LENGTH+40;
|
static constexpr int WIDTH = LENGTH+40;
|
||||||
|
|
||||||
Graph(int x, int y, int height);
|
Graph(int x, int y, int height);
|
||||||
|
|
||||||
void start(const std::array<std::reference_wrapper<const ring_buffer<float, LENGTH>>, COUNT> &buffers);
|
void start(const Container &buffers);
|
||||||
void redraw(const std::array<std::reference_wrapper<const ring_buffer<float, LENGTH>>, COUNT> &buffers);
|
void redraw(const Container &buffers);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void render(const std::array<std::reference_wrapper<const ring_buffer<float, LENGTH>>, COUNT> &buffers, bool delta);
|
void render(const Container &buffers, bool delta);
|
||||||
|
|
||||||
const int m_x, m_y, m_height;
|
const int m_x, m_y, m_height;
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ Graph<LENGTH, COUNT>::Graph(int x, int y, int height) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<size_t LENGTH, size_t COUNT>
|
template<size_t LENGTH, size_t COUNT>
|
||||||
void Graph<LENGTH, COUNT>::start(const std::array<std::reference_wrapper<const ring_buffer<float, LENGTH>>, COUNT> &buffers)
|
void Graph<LENGTH, COUNT>::start(const Container &buffers)
|
||||||
{
|
{
|
||||||
m_min = 0.f;
|
m_min = 0.f;
|
||||||
m_max = 10.f;
|
m_max = 10.f;
|
||||||
@ -66,13 +67,13 @@ void Graph<LENGTH, COUNT>::start(const std::array<std::reference_wrapper<const r
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<size_t LENGTH, size_t COUNT>
|
template<size_t LENGTH, size_t COUNT>
|
||||||
void Graph<LENGTH, COUNT>::redraw(const std::array<std::reference_wrapper<const ring_buffer<float, LENGTH>>, COUNT> &buffers)
|
void Graph<LENGTH, COUNT>::redraw(const Container &buffers)
|
||||||
{
|
{
|
||||||
render(buffers, true);
|
render(buffers, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<size_t LENGTH, size_t COUNT>
|
template<size_t LENGTH, size_t COUNT>
|
||||||
void Graph<LENGTH, COUNT>::render(const std::array<std::reference_wrapper<const ring_buffer<float, LENGTH>>, COUNT> &buffers, bool delta)
|
void Graph<LENGTH, COUNT>::render(const Container &buffers, bool delta)
|
||||||
{
|
{
|
||||||
float min{std::numeric_limits<float>::quiet_NaN()}, max{std::numeric_limits<float>::quiet_NaN()};
|
float min{std::numeric_limits<float>::quiet_NaN()}, max{std::numeric_limits<float>::quiet_NaN()};
|
||||||
bool first{true};
|
bool first{true};
|
||||||
|
Reference in New Issue
Block a user