Added powersupply menu for huawei
This commit is contained in:
@ -25,6 +25,7 @@ class SelectModeMenu;
|
||||
class ProfilesMenu;
|
||||
class PresetsMenu;
|
||||
class GraphsMenu;
|
||||
class PowerSupplyDisplay;
|
||||
class BmsMenu;
|
||||
class SettingsMenu;
|
||||
class Lockscreen;
|
||||
@ -49,6 +50,9 @@ public:
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_PRESETS>, SwitchScreenAction<PresetsMenu>, StaticMenuItemIcon<&icons::presets>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_PROFILES>, SwitchScreenAction<ProfilesMenu>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GRAPHS>, SwitchScreenAction<GraphsMenu>, StaticMenuItemIcon<&icons::graph>>>();
|
||||
#ifdef FEATURE_CAN
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POWERSUPPLY>, SwitchScreenAction<PowerSupplyDisplay>>>();
|
||||
#endif
|
||||
#ifdef FEATURE_BMS
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BMS>, SwitchScreenAction<BmsMenu>, StaticMenuItemIcon<&icons::bms>>>();
|
||||
#endif
|
||||
|
68
src/displays/powersupplydisplay.h
Normal file
68
src/displays/powersupplydisplay.h
Normal file
@ -0,0 +1,68 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "display.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "globals.h"
|
||||
#include "widgets/label.h"
|
||||
|
||||
namespace {
|
||||
class MainMenu;
|
||||
class MetersDisplay;
|
||||
class StatusDisplay;
|
||||
}
|
||||
namespace {
|
||||
#ifdef FEATURE_CAN
|
||||
class PowerSupplyDisplay : public Display
|
||||
{
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
|
||||
void confirm() override;
|
||||
void back() override;
|
||||
void rotate(int offset) override;
|
||||
|
||||
Label m_voltageLabel{120, 50};
|
||||
Label m_currentLabel{120, 75};
|
||||
};
|
||||
|
||||
void PowerSupplyDisplay::initScreen()
|
||||
{
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
tft.setTextFont(4);
|
||||
|
||||
tft.drawString("Voltage:", 0, m_voltageLabel.y());
|
||||
m_voltageLabel.start();
|
||||
tft.drawString("Current:", 0, m_currentLabel.y());
|
||||
m_currentLabel.start();
|
||||
}
|
||||
|
||||
void PowerSupplyDisplay::redraw()
|
||||
{
|
||||
m_voltageLabel.redraw(String{50.4} + 'V');
|
||||
m_currentLabel.redraw(String{15.1} + 'A');
|
||||
}
|
||||
|
||||
void PowerSupplyDisplay::confirm()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PowerSupplyDisplay::back()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PowerSupplyDisplay::rotate(int offset)
|
||||
{
|
||||
// if (offset < 0)
|
||||
// switchScreen<MetersDisplay>();
|
||||
// else if (offset > 0)
|
||||
// switchScreen<StatusDisplay>();
|
||||
}
|
||||
#endif
|
||||
}
|
@ -63,6 +63,7 @@
|
||||
#include "displays/metersdisplay.h"
|
||||
#include "displays/pingpongdisplay.h"
|
||||
#include "displays/poweroffdisplay.h"
|
||||
#include "displays/powersupplydisplay.h"
|
||||
#include "displays/spirodisplay.h"
|
||||
#include "displays/starfielddisplay.h"
|
||||
#include "displays/statusdisplay.h"
|
||||
|
@ -363,4 +363,8 @@ constexpr char TEXT_WIFI_POWER_5dBm[] = "5dBm";
|
||||
constexpr char TEXT_WIFI_POWER_2dBm[] = "2dBm";
|
||||
constexpr char TEXT_WIFI_POWER_MINUS_1dBm[] = "-1dBm";
|
||||
//constexpr char TEXT_BACK[] = "Back";
|
||||
|
||||
#ifdef FEATURE_CAN
|
||||
constexpr char TEXT_POWERSUPPLY[] = "Powersupply";
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user