Added raw poti graphs

This commit is contained in:
CommanderRedYT
2022-10-21 21:18:31 +02:00
parent 846a5d753a
commit 43c2338dbd
4 changed files with 27 additions and 3 deletions

View File

@ -38,7 +38,7 @@ void BobbyGraphDisplay<COUNT>::rawButtonReleased(uint8_t button)
template<size_t COUNT>
void BobbyGraphDisplay<COUNT>::buttonPressed(espgui::Button button)
{
//Base::buttonPressed(button);
Base::buttonPressed(button);
buttonPressedCommon(button);
}

View File

@ -15,6 +15,8 @@
namespace {
constexpr char TEXT_GRAPHS[] = "Graphs";
constexpr char TEXT_RAW_GAS[] = "Raw Gas";
constexpr char TEXT_RAW_BREMS[] = "Raw Brems";
constexpr char TEXT_GAS[] = "Gas";
constexpr char TEXT_BREMS[] = "Brems";
constexpr char TEXT_POTIS[] = "Potis";
@ -32,6 +34,20 @@ constexpr char TEXT_MOTORCURRENTS[] = "Motor currents";
constexpr char TEXT_RSSI[] = "RSSI";
constexpr char TEXT_BACK[] = "Back";
using RawGasGraphDisplay = espgui::makeComponent<
BobbyGraphDisplay<1>,
espgui::StaticText<TEXT_RAW_GAS>,
espgui::SingleGraphAccessor<RawGasStatistics>,
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction>
>;
using RawBremsGraphDisplay = espgui::makeComponent<
BobbyGraphDisplay<1>,
espgui::StaticText<TEXT_RAW_BREMS>,
espgui::SingleGraphAccessor<RawBremsStatistics>,
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction>
>;
using GasGraphDisplay = espgui::makeComponent<
BobbyGraphDisplay<1>,
espgui::StaticText<TEXT_GAS>,
@ -173,6 +189,8 @@ using RssiGraphDisplay = espgui::makeComponent<
GraphsMenu::GraphsMenu()
{
using namespace espgui;
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_RAW_GAS>, PushScreenAction<RawGasGraphDisplay>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_RAW_BREMS>, PushScreenAction<RawBremsGraphDisplay>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GAS>, PushScreenAction<GasGraphDisplay>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BREMS>, PushScreenAction<BremsGraphDisplay>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POTIS>, PushScreenAction<PotisGraphDisplay>>>();

View File

@ -1,7 +1,7 @@
#include "statistics.h"
namespace statistics {
ContainerType gas, brems, avgSpeed, avgSpeedKmh, sumCurrent, frontVoltage, backVoltage, frontLeftCurrent, frontRightCurrent, backLeftCurrent, backRightCurrent,
ContainerType raw_gas, raw_brems, gas, brems, avgSpeed, avgSpeedKmh, sumCurrent, frontVoltage, backVoltage, frontLeftCurrent, frontRightCurrent, backLeftCurrent, backRightCurrent,
#ifdef FEATURE_BMS
bmsVoltage, bmsCurrent, bmsPower,
#endif
@ -10,6 +10,10 @@ ContainerType gas, brems, avgSpeed, avgSpeedKmh, sumCurrent, frontVoltage, backV
void pushStats()
{
if (raw_gas)
statistics::raw_gas.push_back(*raw_gas);
if (raw_brems)
statistics::raw_brems.push_back(*raw_brems);
if (gas)
statistics::gas.push_back(*gas);
if (brems)

View File

@ -11,7 +11,7 @@
namespace statistics {
using ContainerType = ring_buffer<float, 200>;
extern ContainerType gas, brems, avgSpeed, avgSpeedKmh, sumCurrent, frontVoltage, backVoltage, frontLeftCurrent, frontRightCurrent, backLeftCurrent, backRightCurrent,
extern ContainerType raw_gas, raw_brems, gas, brems, avgSpeed, avgSpeedKmh, sumCurrent, frontVoltage, backVoltage, frontLeftCurrent, frontRightCurrent, backLeftCurrent, backRightCurrent,
#ifdef FEATURE_BMS
bmsVoltage, bmsCurrent, bmsPower,
#endif
@ -33,6 +33,8 @@ public:
const statistics::ContainerType &getBuffer() const override { return T; }
};
using RawGasStatistics = BufferAccessorImpl<statistics::raw_gas>;
using RawBremsStatistics = BufferAccessorImpl<statistics::raw_brems>;
using GasStatistics = BufferAccessorImpl<statistics::gas>;
using BremsStatistics = BufferAccessorImpl<statistics::brems>;
using AvgSpeedStatistics = BufferAccessorImpl<statistics::avgSpeed>;