vesc control
This commit is contained in:
@@ -85,6 +85,7 @@ build_flags =
|
|||||||
-DDEVICE_PREFIX=bobbyquad
|
-DDEVICE_PREFIX=bobbyquad
|
||||||
-DFEATURE_WEBSERVER
|
-DFEATURE_WEBSERVER
|
||||||
-DFEATURE_3WIRESW
|
-DFEATURE_3WIRESW
|
||||||
|
-DGLUMP_CONTROLLER
|
||||||
-DPINS_3WIRESW_OUT=0
|
-DPINS_3WIRESW_OUT=0
|
||||||
-DPINS_3WIRESW_IN1=16
|
-DPINS_3WIRESW_IN1=16
|
||||||
-DPINS_3WIRESW_IN2=27
|
-DPINS_3WIRESW_IN2=27
|
||||||
@@ -198,6 +199,7 @@ build_flags =
|
|||||||
${peters_platine.build_flags}
|
${peters_platine.build_flags}
|
||||||
${default_limits.build_flags}
|
${default_limits.build_flags}
|
||||||
-DDEVICE_PREFIX=bobbyquad
|
-DDEVICE_PREFIX=bobbyquad
|
||||||
|
-DVESC_CONTROLLER
|
||||||
-DFEATURE_WEBSERVER
|
-DFEATURE_WEBSERVER
|
||||||
; -DFEATURE_3WIRESW
|
; -DFEATURE_3WIRESW
|
||||||
; -DPINS_3WIRESW_OUT=0
|
; -DPINS_3WIRESW_OUT=0
|
||||||
|
@@ -137,8 +137,10 @@ void ChangeValueDisplay<Tvalue>::confirm()
|
|||||||
|
|
||||||
#include "changevaluedisplay_bool.h"
|
#include "changevaluedisplay_bool.h"
|
||||||
#include "changevaluedisplay_bluetoothmode.h"
|
#include "changevaluedisplay_bluetoothmode.h"
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
#include "changevaluedisplay_controlmode.h"
|
#include "changevaluedisplay_controlmode.h"
|
||||||
#include "changevaluedisplay_controltype.h"
|
#include "changevaluedisplay_controltype.h"
|
||||||
#include "changevaluedisplay_larsmmode_mode.h"
|
#include "changevaluedisplay_larsmmode_mode.h"
|
||||||
|
#endif
|
||||||
#include "changevaluedisplay_wifi_mode_t.h"
|
#include "changevaluedisplay_wifi_mode_t.h"
|
||||||
#include "changevaluedisplay_wifi_power_t.h"
|
#include "changevaluedisplay_wifi_power_t.h"
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#include "icons/back.h"
|
#include "icons/back.h"
|
||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
template<>
|
template<>
|
||||||
class ChangeValueDisplay<ControlMode> :
|
class ChangeValueDisplay<ControlMode> :
|
||||||
@@ -62,3 +63,4 @@ void ChangeValueDisplay<ControlMode>::itemPressed(int index)
|
|||||||
triggered();
|
triggered();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -8,6 +8,7 @@
|
|||||||
#include "icons/back.h"
|
#include "icons/back.h"
|
||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
template<>
|
template<>
|
||||||
class ChangeValueDisplay<ControlType> :
|
class ChangeValueDisplay<ControlType> :
|
||||||
@@ -58,3 +59,4 @@ void ChangeValueDisplay<ControlType>::itemPressed(int index)
|
|||||||
triggered();
|
triggered();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -9,6 +9,7 @@
|
|||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
#include "modes/larsmmode.h"
|
#include "modes/larsmmode.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
template<>
|
template<>
|
||||||
class ChangeValueDisplay<LarsmModeMode> :
|
class ChangeValueDisplay<LarsmModeMode> :
|
||||||
@@ -63,3 +64,4 @@ void ChangeValueDisplay<LarsmModeMode>::itemPressed(int index)
|
|||||||
triggered();
|
triggered();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -2,13 +2,19 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <WString.h>
|
||||||
|
|
||||||
#include "bobbycar-protocol/protocol.h"
|
#include "bobbycar-protocol/protocol.h"
|
||||||
|
|
||||||
#include "feedbackparser.h"
|
#include "feedbackparser.h"
|
||||||
|
#include "VescUartControl-VESC6/VescUart.h"
|
||||||
|
|
||||||
class HardwareSerial;
|
class HardwareSerial;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
|
|
||||||
struct Controller {
|
struct Controller {
|
||||||
Controller(HardwareSerial &serial, bool &enableLeft, bool &enableRight, bool &invertLeft, bool &invertRight) :
|
Controller(HardwareSerial &serial, bool &enableLeft, bool &enableRight, bool &invertLeft, bool &invertRight) :
|
||||||
serial{serial}, enableLeft{enableLeft}, enableRight{enableRight}, invertLeft{invertLeft}, invertRight{invertRight}
|
serial{serial}, enableLeft{enableLeft}, enableRight{enableRight}, invertLeft{invertLeft}, invertRight{invertRight}
|
||||||
@@ -25,4 +31,37 @@ struct Controller {
|
|||||||
|
|
||||||
FeedbackParser parser{serial, feedbackValid, feedback};
|
FeedbackParser parser{serial, feedbackValid, feedback};
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
struct VescController {
|
||||||
|
VescController(HardwareSerial &serial, bool &enable) :
|
||||||
|
serial{serial}, enable{enable}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
std::reference_wrapper<HardwareSerial> serial;
|
||||||
|
bool &enable;
|
||||||
|
|
||||||
|
bldcMeasure values;
|
||||||
|
|
||||||
|
float pwm = 0;
|
||||||
|
|
||||||
|
// Command command{};
|
||||||
|
//
|
||||||
|
// bool feedbackValid{};
|
||||||
|
// Feedback feedback{};
|
||||||
|
//
|
||||||
|
// FeedbackParser parser{serial, feedbackValid, feedback};
|
||||||
|
|
||||||
|
void update() {
|
||||||
|
SetSerialPort(&serial.get());
|
||||||
|
SetDebugSerialPort(NULL);
|
||||||
|
|
||||||
|
VescUartGetValue(values);
|
||||||
|
|
||||||
|
Serial.println(String{"Duty now "} + values.dutyNow);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
#include "colorinterface.h"
|
#include "colorinterface.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
template<Controller &Tcontroller, int TsuccessColor>
|
template<Controller &Tcontroller, int TsuccessColor>
|
||||||
class FeedbackColor : public virtual ColorInterface { public: int color() const { return Tcontroller.feedbackValid ? TsuccessColor : TFT_RED; } };
|
class FeedbackColor : public virtual ColorInterface { public: int color() const { return Tcontroller.feedbackValid ? TsuccessColor : TFT_RED; } };
|
||||||
@@ -13,3 +14,4 @@ using FrontFeedbackColor = FeedbackColor<front, TsuccessColor>;
|
|||||||
template<int TsuccessColor>
|
template<int TsuccessColor>
|
||||||
using BackFeedbackColor = FeedbackColor<back, TsuccessColor>;
|
using BackFeedbackColor = FeedbackColor<back, TsuccessColor>;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
template<Controller &controller>
|
template<Controller &controller>
|
||||||
struct ControllerTexts
|
struct ControllerTexts
|
||||||
@@ -88,3 +89,4 @@ struct ControllerTexts
|
|||||||
using FrontTexts = ControllerTexts<front>;
|
using FrontTexts = ControllerTexts<front>;
|
||||||
using BackTexts = ControllerTexts<back>;
|
using BackTexts = ControllerTexts<back>;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@@ -38,7 +38,13 @@ public:
|
|||||||
private:
|
private:
|
||||||
const bool m_bootup{false};
|
const bool m_bootup{false};
|
||||||
ModeInterface *m_oldMode;
|
ModeInterface *m_oldMode;
|
||||||
IgnoreInputMode m_mode{0, ControlType::FieldOrientedControl, ControlMode::Torque};
|
IgnoreInputMode m_mode{
|
||||||
|
0,
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
|
ControlType::FieldOrientedControl,
|
||||||
|
ControlMode::Torque
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
std::array<Label, 4> m_labels {{
|
std::array<Label, 4> m_labels {{
|
||||||
Label{25, 50}, // 100, 23
|
Label{25, 50}, // 100, 23
|
||||||
@@ -104,14 +110,24 @@ void CalibrateDisplay::stop()
|
|||||||
void CalibrateDisplay::back()
|
void CalibrateDisplay::back()
|
||||||
{
|
{
|
||||||
if (!m_bootup)
|
if (!m_bootup)
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
switchScreen<BoardcomputerHardwareSettingsMenu>();
|
switchScreen<BoardcomputerHardwareSettingsMenu>();
|
||||||
|
#endif
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
switchScreen<StatusDisplay>();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrateDisplay::triggered()
|
void CalibrateDisplay::triggered()
|
||||||
{
|
{
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
if (m_bootup)
|
if (m_bootup)
|
||||||
switchScreen<StatusDisplay>();
|
switchScreen<StatusDisplay>();
|
||||||
else
|
else
|
||||||
switchScreen<BoardcomputerHardwareSettingsMenu>();
|
switchScreen<BoardcomputerHardwareSettingsMenu>();
|
||||||
|
#endif
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
switchScreen<StatusDisplay>();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,13 @@ private:
|
|||||||
int m_rotated;
|
int m_rotated;
|
||||||
|
|
||||||
ModeInterface *m_oldMode;
|
ModeInterface *m_oldMode;
|
||||||
IgnoreInputMode m_mode{0, ControlType::FieldOrientedControl, ControlMode::Speed};
|
IgnoreInputMode m_mode{
|
||||||
|
0,
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
|
ControlType::FieldOrientedControl,
|
||||||
|
ControlMode::Speed
|
||||||
|
#endif
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
void Lockscreen::start()
|
void Lockscreen::start()
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "settingsaccessors.h"
|
#include "settingsaccessors.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
class BuzzerMenu;
|
class BuzzerMenu;
|
||||||
class SettingsMenu;
|
class SettingsMenu;
|
||||||
@@ -102,3 +103,4 @@ class BuzzerMenu :
|
|||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
#include "debugtexthelpers.h"
|
#include "debugtexthelpers.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
class DebugMenu;
|
class DebugMenu;
|
||||||
}
|
}
|
||||||
@@ -32,3 +33,4 @@ class CommandDebugMenu :
|
|||||||
class FrontCommandDebugMenu : public CommandDebugMenu<TEXT_FRONTCOMMAND, FrontTexts> {};
|
class FrontCommandDebugMenu : public CommandDebugMenu<TEXT_FRONTCOMMAND, FrontTexts> {};
|
||||||
class BackCommandDebugMenu : public CommandDebugMenu<TEXT_BACKCOMMAND, BackTexts> {};
|
class BackCommandDebugMenu : public CommandDebugMenu<TEXT_BACKCOMMAND, BackTexts> {};
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@@ -56,7 +56,9 @@ class ControllerHardwareSettingsMenu :
|
|||||||
makeComponent<MenuItem, StaticText<TEXT_WHEELDIAMETERMM>, SwitchScreenAction<WheelDiameterMmChangeScreen>>,
|
makeComponent<MenuItem, StaticText<TEXT_WHEELDIAMETERMM>, SwitchScreenAction<WheelDiameterMmChangeScreen>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_WHEELDIAMETERINCH>, SwitchScreenAction<WheelDiameterInchChangeScreen>>,
|
makeComponent<MenuItem, StaticText<TEXT_WHEELDIAMETERINCH>, SwitchScreenAction<WheelDiameterInchChangeScreen>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_NUMMAGNETPOLES>, SwitchScreenAction<NumMagnetPolesChangeScreen>>,
|
makeComponent<MenuItem, StaticText<TEXT_NUMMAGNETPOLES>, SwitchScreenAction<NumMagnetPolesChangeScreen>>,
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SWAPFRONTBACK>, ToggleBoolAction, CheckboxIcon, SwapFrontBackAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_SWAPFRONTBACK>, ToggleBoolAction, CheckboxIcon, SwapFrontBackAccessor>,
|
||||||
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<SettingsMenu>, StaticMenuItemIcon<&icons::back>>
|
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<SettingsMenu>, StaticMenuItemIcon<&icons::back>>
|
||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class MainMenu;
|
class MainMenu;
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
class FrontCommandDebugMenu;
|
class FrontCommandDebugMenu;
|
||||||
class BackCommandDebugMenu;
|
class BackCommandDebugMenu;
|
||||||
class FrontLeftMotorStateDebugMenu;
|
class FrontLeftMotorStateDebugMenu;
|
||||||
@@ -29,6 +30,7 @@ class FrontLeftMotorFeedbackDebugMenu;
|
|||||||
class FrontRightMotorFeedbackDebugMenu;
|
class FrontRightMotorFeedbackDebugMenu;
|
||||||
class BackLeftMotorFeedbackDebugMenu;
|
class BackLeftMotorFeedbackDebugMenu;
|
||||||
class BackRightMotorFeedbackDebugMenu;
|
class BackRightMotorFeedbackDebugMenu;
|
||||||
|
#endif
|
||||||
class DynamicDebugMenu;
|
class DynamicDebugMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,6 +43,7 @@ class DebugMenu :
|
|||||||
makeComponent<MenuItem, StaticText<TEXT_LOADSETTINGS>, LoadSettingsAction>,
|
makeComponent<MenuItem, StaticText<TEXT_LOADSETTINGS>, LoadSettingsAction>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SAVESETTINGS>, SaveSettingsAction>,
|
makeComponent<MenuItem, StaticText<TEXT_SAVESETTINGS>, SaveSettingsAction>,
|
||||||
makeComponent<MenuItem, StaticText<nullptr>, DummyAction>,
|
makeComponent<MenuItem, StaticText<nullptr>, DummyAction>,
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
makeComponent<MenuItem, StaticText<TEXT_FRONTCOMMAND>, SwitchScreenAction<FrontCommandDebugMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_FRONTCOMMAND>, SwitchScreenAction<FrontCommandDebugMenu>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BACKCOMMAND>, SwitchScreenAction<BackCommandDebugMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_BACKCOMMAND>, SwitchScreenAction<BackCommandDebugMenu>>,
|
||||||
makeComponent<MenuItem, StaticText<nullptr>, DummyAction>,
|
makeComponent<MenuItem, StaticText<nullptr>, DummyAction>,
|
||||||
@@ -56,6 +59,7 @@ class DebugMenu :
|
|||||||
makeComponent<MenuItem, StaticText<TEXT_FRONTRIGHTFEEDBACK>, SwitchScreenAction<FrontRightMotorFeedbackDebugMenu>, FrontFeedbackColor<TFT_WHITE>>,
|
makeComponent<MenuItem, StaticText<TEXT_FRONTRIGHTFEEDBACK>, SwitchScreenAction<FrontRightMotorFeedbackDebugMenu>, FrontFeedbackColor<TFT_WHITE>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BACKLEFTFEEDBACK>, SwitchScreenAction<BackLeftMotorFeedbackDebugMenu>, BackFeedbackColor<TFT_WHITE>>,
|
makeComponent<MenuItem, StaticText<TEXT_BACKLEFTFEEDBACK>, SwitchScreenAction<BackLeftMotorFeedbackDebugMenu>, BackFeedbackColor<TFT_WHITE>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BACKRIGHTFEEDBACK>, SwitchScreenAction<BackRightMotorFeedbackDebugMenu>, BackFeedbackColor<TFT_WHITE>>,
|
makeComponent<MenuItem, StaticText<TEXT_BACKRIGHTFEEDBACK>, SwitchScreenAction<BackRightMotorFeedbackDebugMenu>, BackFeedbackColor<TFT_WHITE>>,
|
||||||
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<nullptr>, DummyAction>,
|
makeComponent<MenuItem, StaticText<nullptr>, DummyAction>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_DYNAMICMENU>, SwitchScreenAction<DynamicDebugMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_DYNAMICMENU>, SwitchScreenAction<DynamicDebugMenu>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<MainMenu>, StaticMenuItemIcon<&icons::back>>
|
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<MainMenu>, StaticMenuItemIcon<&icons::back>>
|
||||||
|
@@ -18,6 +18,7 @@ class ModesSettingsMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
using DefaultModeCtrlTypChangeDisplay = makeComponent<
|
using DefaultModeCtrlTypChangeDisplay = makeComponent<
|
||||||
ChangeValueDisplay<ControlType>,
|
ChangeValueDisplay<ControlType>,
|
||||||
StaticText<TEXT_SETCONTROLTYPE>,
|
StaticText<TEXT_SETCONTROLTYPE>,
|
||||||
@@ -32,6 +33,7 @@ using DefaultModeCtrlModChangeDisplay = makeComponent<
|
|||||||
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
SwitchScreenAction<DefaultModeSettingsMenu>
|
SwitchScreenAction<DefaultModeSettingsMenu>
|
||||||
>;
|
>;
|
||||||
|
#endif
|
||||||
using DefaultModeSmoothingChangeDisplay = makeComponent<
|
using DefaultModeSmoothingChangeDisplay = makeComponent<
|
||||||
ChangeValueDisplay<int16_t>,
|
ChangeValueDisplay<int16_t>,
|
||||||
StaticText<TEXT_SETSMOOTHING>,
|
StaticText<TEXT_SETSMOOTHING>,
|
||||||
@@ -39,6 +41,7 @@ using DefaultModeSmoothingChangeDisplay = makeComponent<
|
|||||||
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
SwitchScreenAction<DefaultModeSettingsMenu>
|
SwitchScreenAction<DefaultModeSettingsMenu>
|
||||||
>;
|
>;
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
using DefaultModeFrontPercentageChangeDisplay = makeComponent<
|
using DefaultModeFrontPercentageChangeDisplay = makeComponent<
|
||||||
ChangeValueDisplay<int16_t>,
|
ChangeValueDisplay<int16_t>,
|
||||||
StaticText<TEXT_SETFRONTPERCENTAGE>,
|
StaticText<TEXT_SETFRONTPERCENTAGE>,
|
||||||
@@ -53,6 +56,7 @@ using DefaultModeBackPercentageChangeDisplay = makeComponent<
|
|||||||
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
BackActionInterface<SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
SwitchScreenAction<DefaultModeSettingsMenu>
|
SwitchScreenAction<DefaultModeSettingsMenu>
|
||||||
>;
|
>;
|
||||||
|
#endif
|
||||||
using DefaultModeAddSchwelleChangeDisplay = makeComponent<
|
using DefaultModeAddSchwelleChangeDisplay = makeComponent<
|
||||||
ChangeValueDisplay<int16_t>,
|
ChangeValueDisplay<int16_t>,
|
||||||
StaticText<TEXT_SETADDSCHWELLE>,
|
StaticText<TEXT_SETADDSCHWELLE>,
|
||||||
@@ -94,12 +98,16 @@ class DefaultModeSettingsMenu :
|
|||||||
public StaticText<TEXT_DEFAULTMODESETTIGNS>,
|
public StaticText<TEXT_DEFAULTMODESETTIGNS>,
|
||||||
public BackActionInterface<SwitchScreenAction<ModesSettingsMenu>>,
|
public BackActionInterface<SwitchScreenAction<ModesSettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETCONTROLTYPE>, SwitchScreenAction<DefaultModeCtrlTypChangeDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETCONTROLTYPE>, SwitchScreenAction<DefaultModeCtrlTypChangeDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETCONTROLMODE>, SwitchScreenAction<DefaultModeCtrlModChangeDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETCONTROLMODE>, SwitchScreenAction<DefaultModeCtrlModChangeDisplay>>,
|
||||||
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<TEXT_ENABLESMOOTHING>, ToggleBoolAction, CheckboxIcon, DefaultModeEnableSmoothingAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_ENABLESMOOTHING>, ToggleBoolAction, CheckboxIcon, DefaultModeEnableSmoothingAccessor>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETSMOOTHING>, SwitchScreenAction<DefaultModeSmoothingChangeDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETSMOOTHING>, SwitchScreenAction<DefaultModeSmoothingChangeDisplay>>,
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETFRONTPERCENTAGE>, SwitchScreenAction<DefaultModeFrontPercentageChangeDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETFRONTPERCENTAGE>, SwitchScreenAction<DefaultModeFrontPercentageChangeDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETBACKPERCENTAGE>, SwitchScreenAction<DefaultModeBackPercentageChangeDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETBACKPERCENTAGE>, SwitchScreenAction<DefaultModeBackPercentageChangeDisplay>>,
|
||||||
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETADDSCHWELLE>, SwitchScreenAction<DefaultModeAddSchwelleChangeDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETADDSCHWELLE>, SwitchScreenAction<DefaultModeAddSchwelleChangeDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETGAS1WERT>, SwitchScreenAction<DefaultModeGas1WertChangeDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETGAS1WERT>, SwitchScreenAction<DefaultModeGas1WertChangeDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SETGAS2WERT>, SwitchScreenAction<DefaultModeGas2WertChangeDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_SETGAS2WERT>, SwitchScreenAction<DefaultModeGas2WertChangeDisplay>>,
|
||||||
|
@@ -21,11 +21,17 @@ class EnableMenu :
|
|||||||
public StaticText<TEXT_SETENABLED>,
|
public StaticText<TEXT_SETENABLED>,
|
||||||
public BackActionInterface<SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
public BackActionInterface<SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
makeComponent<MenuItem, StaticText<TEXT_ENABLEFRONTLEFT>, ToggleBoolAction, CheckboxIcon, FrontLeftEnabledAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_ENABLEFRONTLEFT>, ToggleBoolAction, CheckboxIcon, FrontLeftEnabledAccessor>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_ENABLEFRONTRIGHT>, ToggleBoolAction, CheckboxIcon, FrontRightEnabledAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_ENABLEFRONTRIGHT>, ToggleBoolAction, CheckboxIcon, FrontRightEnabledAccessor>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_ENABLEBACKLEFT>, ToggleBoolAction, CheckboxIcon, BackLeftEnabledAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_ENABLEBACKLEFT>, ToggleBoolAction, CheckboxIcon, BackLeftEnabledAccessor>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_ENABLEBACKRIGHT>, ToggleBoolAction, CheckboxIcon, BackRightEnabledAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_ENABLEBACKRIGHT>, ToggleBoolAction, CheckboxIcon, BackRightEnabledAccessor>,
|
||||||
|
#endif
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
makeComponent<MenuItem, StaticText<TEXT_ENABLEBACKRIGHT>, ToggleBoolAction, CheckboxIcon, OneEnabledAccessor>,
|
||||||
|
makeComponent<MenuItem, StaticText<TEXT_ENABLEBACKRIGHT>, ToggleBoolAction, CheckboxIcon, TwoEnabledAccessor>,
|
||||||
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<ControllerHardwareSettingsMenu>, StaticMenuItemIcon<&icons::back>>
|
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<ControllerHardwareSettingsMenu>, StaticMenuItemIcon<&icons::back>>
|
||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
}
|
}
|
@@ -11,6 +11,7 @@
|
|||||||
#include "debugtexthelpers.h"
|
#include "debugtexthelpers.h"
|
||||||
#include "debugcolorhelpers.h"
|
#include "debugcolorhelpers.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
class DebugMenu;
|
class DebugMenu;
|
||||||
}
|
}
|
||||||
@@ -33,3 +34,4 @@ class FeedbackDebugMenu :
|
|||||||
|
|
||||||
class FrontFeedbackDebugMenu : public FeedbackDebugMenu<TEXT_FRONTFEEDBACK, FrontTexts, FrontFeedbackColor> {};
|
class FrontFeedbackDebugMenu : public FeedbackDebugMenu<TEXT_FRONTFEEDBACK, FrontTexts, FrontFeedbackColor> {};
|
||||||
class BackFeedbackDebugMenu : public FeedbackDebugMenu<TEXT_BACKFEEDBACK, BackTexts, FrontFeedbackColor> {}; }
|
class BackFeedbackDebugMenu : public FeedbackDebugMenu<TEXT_BACKFEEDBACK, BackTexts, FrontFeedbackColor> {}; }
|
||||||
|
#endif
|
||||||
|
@@ -21,8 +21,12 @@ using AvgSpeedGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_AVGS
|
|||||||
using AvgSpeedKmhGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_AVGSPEEDKMH>, MultiStatisticsSingleImpl, AvgSpeedKmhStatistics>;
|
using AvgSpeedKmhGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_AVGSPEEDKMH>, MultiStatisticsSingleImpl, AvgSpeedKmhStatistics>;
|
||||||
using SumCurrentGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_SUMCURRENT>, MultiStatisticsSingleImpl, SumCurrentStatistics>;
|
using SumCurrentGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_SUMCURRENT>, MultiStatisticsSingleImpl, SumCurrentStatistics>;
|
||||||
using SumAbsoluteCurrentGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_SUMABSOLUTECURRENT>, MultiStatisticsSingleImpl, SumAbsoluteCurrentStatistics>;
|
using SumAbsoluteCurrentGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_SUMABSOLUTECURRENT>, MultiStatisticsSingleImpl, SumAbsoluteCurrentStatistics>;
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
using FrontVoltageGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_FRONTVOLTAGE>, MultiStatisticsSingleImpl, FrontVoltageStatistics>;
|
using FrontVoltageGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_FRONTVOLTAGE>, MultiStatisticsSingleImpl, FrontVoltageStatistics>;
|
||||||
using BackVoltageGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_BACKVOLTAGE>, MultiStatisticsSingleImpl, BackVoltageStatistics>;
|
using BackVoltageGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_BACKVOLTAGE>, MultiStatisticsSingleImpl, BackVoltageStatistics>;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
using BmsVoltageGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_BMSVOLTAGE>, MultiStatisticsSingleImpl, BmsVoltageStatistics>;
|
using BmsVoltageGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_BMSVOLTAGE>, MultiStatisticsSingleImpl, BmsVoltageStatistics>;
|
||||||
using BmsCurrentGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_BMSCURRENT>, MultiStatisticsSingleImpl, BmsCurrentStatistics>;
|
using BmsCurrentGraphDisplay = makeComponent<GraphDisplay<1>, StaticText<TEXT_BMSCURRENT>, MultiStatisticsSingleImpl, BmsCurrentStatistics>;
|
||||||
@@ -37,7 +41,7 @@ class SumCurrentsComparisonStatistics : public virtual MultiStatisticsInterface<
|
|||||||
};
|
};
|
||||||
using SumCurrentsComparisonGraphDisplay = makeComponent<GraphDisplay<2>, StaticText<TEXT_SUMCURRENTSCOMPARISON>, SumCurrentsComparisonStatistics>;
|
using SumCurrentsComparisonGraphDisplay = makeComponent<GraphDisplay<2>, StaticText<TEXT_SUMCURRENTSCOMPARISON>, SumCurrentsComparisonStatistics>;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
class MotorCurrentsStatistics : public virtual MultiStatisticsInterface<4>
|
class MotorCurrentsStatistics : public virtual MultiStatisticsInterface<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
|
||||||
@@ -46,6 +50,7 @@ class MotorCurrentsStatistics : public virtual MultiStatisticsInterface<4>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
using MotorCurrentsGraphDisplay = makeComponent<GraphDisplay<4>, StaticText<TEXT_MOTORCURRENTS>, MotorCurrentsStatistics>;
|
using MotorCurrentsGraphDisplay = makeComponent<GraphDisplay<4>, StaticText<TEXT_MOTORCURRENTS>, MotorCurrentsStatistics>;
|
||||||
|
#endif
|
||||||
|
|
||||||
class GraphsMenu :
|
class GraphsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
@@ -58,15 +63,19 @@ class GraphsMenu :
|
|||||||
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_SUMABSOLUTECURRENT>, SwitchScreenAction<SumAbsoluteCurrentGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_SUMABSOLUTECURRENT>, SwitchScreenAction<SumAbsoluteCurrentGraphDisplay>>,
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
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>>,
|
||||||
|
#endif
|
||||||
#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>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BMSPOWER>, SwitchScreenAction<BmsPowerGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_BMSPOWER>, SwitchScreenAction<BmsPowerGraphDisplay>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SUMCURRENTSCOMPARISON>, SwitchScreenAction<SumCurrentsComparisonGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_SUMCURRENTSCOMPARISON>, SwitchScreenAction<SumCurrentsComparisonGraphDisplay>>,
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
makeComponent<MenuItem, StaticText<TEXT_MOTORCURRENTS>, SwitchScreenAction<MotorCurrentsGraphDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_MOTORCURRENTS>, SwitchScreenAction<MotorCurrentsGraphDisplay>>,
|
||||||
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<TEXT_DUALGRAPHS>, SwitchScreenAction<DualGraphDisplay>>,
|
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>>
|
||||||
>
|
>
|
||||||
|
@@ -21,11 +21,17 @@ class InvertMenu :
|
|||||||
public StaticText<TEXT_SETINVERTED>,
|
public StaticText<TEXT_SETINVERTED>,
|
||||||
public BackActionInterface<SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
public BackActionInterface<SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
makeComponent<MenuItem, StaticText<TEXT_INVERTFRONTLEFT>, ToggleBoolAction, CheckboxIcon, FrontLeftInvertedAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_INVERTFRONTLEFT>, ToggleBoolAction, CheckboxIcon, FrontLeftInvertedAccessor>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_INVERTFRONTRIGHT>, ToggleBoolAction, CheckboxIcon, FrontRightInvertedAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_INVERTFRONTRIGHT>, ToggleBoolAction, CheckboxIcon, FrontRightInvertedAccessor>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_INVERTBACKLEFT>, ToggleBoolAction, CheckboxIcon, BackLeftInvertedAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_INVERTBACKLEFT>, ToggleBoolAction, CheckboxIcon, BackLeftInvertedAccessor>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_INVERTBACKRIGHT>, ToggleBoolAction, CheckboxIcon, BackRightInvertedAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_INVERTBACKRIGHT>, ToggleBoolAction, CheckboxIcon, BackRightInvertedAccessor>,
|
||||||
|
#endif
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
makeComponent<MenuItem, StaticText<TEXT_INVERTFRONTLEFT>, ToggleBoolAction, CheckboxIcon, OneInvertedAccessor>,
|
||||||
|
makeComponent<MenuItem, StaticText<TEXT_INVERTFRONTRIGHT>, ToggleBoolAction, CheckboxIcon, TwoInvertedAccessor>,
|
||||||
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<ControllerHardwareSettingsMenu>, StaticMenuItemIcon<&icons::back>>
|
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<ControllerHardwareSettingsMenu>, StaticMenuItemIcon<&icons::back>>
|
||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
}
|
}
|
@@ -10,6 +10,7 @@
|
|||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
#include "settingsaccessors.h"
|
#include "settingsaccessors.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
class LarsmModeSettingsMenu;
|
class LarsmModeSettingsMenu;
|
||||||
class ModesSettingsMenu;
|
class ModesSettingsMenu;
|
||||||
@@ -42,3 +43,4 @@ class LarsmModeSettingsMenu :
|
|||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@@ -38,7 +38,9 @@ class MainMenu :
|
|||||||
public BackActionInterface<SwitchScreenAction<StatusDisplay>>,
|
public BackActionInterface<SwitchScreenAction<StatusDisplay>>,
|
||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_STATUS>, SwitchScreenAction<StatusDisplay>, StaticMenuItemIcon<&icons::back>>,
|
makeComponent<MenuItem, StaticText<TEXT_STATUS>, SwitchScreenAction<StatusDisplay>, StaticMenuItemIcon<&icons::back>>,
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SELECTMODE>, SwitchScreenAction<SelectModeMenu>, StaticMenuItemIcon<&icons::modes>>,
|
makeComponent<MenuItem, StaticText<TEXT_SELECTMODE>, SwitchScreenAction<SelectModeMenu>, StaticMenuItemIcon<&icons::modes>>,
|
||||||
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<TEXT_PRESETS>, SwitchScreenAction<PresetsMenu>, StaticMenuItemIcon<&icons::presets>>,
|
makeComponent<MenuItem, StaticText<TEXT_PRESETS>, SwitchScreenAction<PresetsMenu>, StaticMenuItemIcon<&icons::presets>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_GRAPHS>, SwitchScreenAction<GraphsMenu>, StaticMenuItemIcon<&icons::graph>>,
|
makeComponent<MenuItem, StaticText<TEXT_GRAPHS>, SwitchScreenAction<GraphsMenu>, StaticMenuItemIcon<&icons::graph>>,
|
||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
@@ -50,7 +52,9 @@ class MainMenu :
|
|||||||
makeComponent<MenuItem, StaticText<TEXT_MOSFETS>, SwitchScreenAction<MosfetsMenu>, StaticMenuItemIcon<&icons::lock>>, // TODO icon
|
makeComponent<MenuItem, StaticText<TEXT_MOSFETS>, SwitchScreenAction<MosfetsMenu>, StaticMenuItemIcon<&icons::lock>>, // TODO icon
|
||||||
#endif
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<TEXT_DEMOS>, SwitchScreenAction<DemosMenu>, StaticMenuItemIcon<&icons::demos>>,
|
makeComponent<MenuItem, StaticText<TEXT_DEMOS>, SwitchScreenAction<DemosMenu>, StaticMenuItemIcon<&icons::demos>>,
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
makeComponent<MenuItem, StaticText<TEXT_POWEROFF>, SwitchScreenAction<PoweroffDisplay>, StaticMenuItemIcon<&icons::poweroff>>,
|
makeComponent<MenuItem, StaticText<TEXT_POWEROFF>, SwitchScreenAction<PoweroffDisplay>, StaticMenuItemIcon<&icons::poweroff>>,
|
||||||
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<TEXT_REBOOT>, RebootAction, StaticMenuItemIcon<&icons::reboot>>,
|
makeComponent<MenuItem, StaticText<TEXT_REBOOT>, RebootAction, StaticMenuItemIcon<&icons::reboot>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_DEBUG>, SwitchScreenAction<DebugMenu>>
|
makeComponent<MenuItem, StaticText<TEXT_DEBUG>, SwitchScreenAction<DebugMenu>>
|
||||||
>
|
>
|
||||||
|
@@ -10,7 +10,9 @@
|
|||||||
namespace {
|
namespace {
|
||||||
class DefaultModeSettingsMenu;
|
class DefaultModeSettingsMenu;
|
||||||
class TempomatModeSettingsMenu;
|
class TempomatModeSettingsMenu;
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
class LarsmModeSettingsMenu;
|
class LarsmModeSettingsMenu;
|
||||||
|
#endif
|
||||||
class GametrakModeSettingsMenu;
|
class GametrakModeSettingsMenu;
|
||||||
class SettingsMenu;
|
class SettingsMenu;
|
||||||
}
|
}
|
||||||
@@ -23,7 +25,9 @@ class ModesSettingsMenu :
|
|||||||
public StaticMenuDefinition<
|
public StaticMenuDefinition<
|
||||||
makeComponent<MenuItem, StaticText<TEXT_DEFAULTMODESETTIGNS>, SwitchScreenAction<DefaultModeSettingsMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_DEFAULTMODESETTIGNS>, SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_TEMPOMATMODESETTINGS>, SwitchScreenAction<TempomatModeSettingsMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_TEMPOMATMODESETTINGS>, SwitchScreenAction<TempomatModeSettingsMenu>>,
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
makeComponent<MenuItem, StaticText<TEXT_LARSMMODESETTINGS>, SwitchScreenAction<LarsmModeSettingsMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_LARSMMODESETTINGS>, SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||||
|
#endif
|
||||||
#ifdef FEATURE_GAMETRAK
|
#ifdef FEATURE_GAMETRAK
|
||||||
makeComponent<MenuItem, StaticText<TEXT_GAMETRAKMODESETTINGS>, SwitchScreenAction<GametrakModeSettingsMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_GAMETRAKMODESETTINGS>, SwitchScreenAction<GametrakModeSettingsMenu>>,
|
||||||
#endif
|
#endif
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
#include "debugtexthelpers.h"
|
#include "debugtexthelpers.h"
|
||||||
#include "debugcolorhelpers.h"
|
#include "debugcolorhelpers.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
class DebugMenu;
|
class DebugMenu;
|
||||||
}
|
}
|
||||||
@@ -39,3 +40,4 @@ class FrontRightMotorFeedbackDebugMenu : public MotorFeedbackDebugMenu<TEXT_FRON
|
|||||||
class BackLeftMotorFeedbackDebugMenu : public MotorFeedbackDebugMenu<TEXT_BACKLEFTFEEDBACK, BackTexts::LeftFeedback, BackFeedbackColor> {};
|
class BackLeftMotorFeedbackDebugMenu : public MotorFeedbackDebugMenu<TEXT_BACKLEFTFEEDBACK, BackTexts::LeftFeedback, BackFeedbackColor> {};
|
||||||
class BackRightMotorFeedbackDebugMenu : public MotorFeedbackDebugMenu<TEXT_BACKRIGHTFEEDBACK, BackTexts::RightFeedback, BackFeedbackColor> {};
|
class BackRightMotorFeedbackDebugMenu : public MotorFeedbackDebugMenu<TEXT_BACKRIGHTFEEDBACK, BackTexts::RightFeedback, BackFeedbackColor> {};
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -10,6 +10,7 @@
|
|||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
#include "debugtexthelpers.h"
|
#include "debugtexthelpers.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
class DebugMenu;
|
class DebugMenu;
|
||||||
}
|
}
|
||||||
@@ -39,3 +40,4 @@ class FrontRightMotorStateDebugMenu : public MotorStateDebugMenu<TEXT_FRONTRIGHT
|
|||||||
class BackLeftMotorStateDebugMenu : public MotorStateDebugMenu<TEXT_BACKLEFTCOMMAND, BackTexts::LeftCommand> {};
|
class BackLeftMotorStateDebugMenu : public MotorStateDebugMenu<TEXT_BACKLEFTCOMMAND, BackTexts::LeftCommand> {};
|
||||||
class BackRightMotorStateDebugMenu : public MotorStateDebugMenu<TEXT_BACKRIGHTCOMMAND, BackTexts::RightCommand> {};
|
class BackRightMotorStateDebugMenu : public MotorStateDebugMenu<TEXT_BACKRIGHTCOMMAND, BackTexts::RightCommand> {};
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -55,7 +55,9 @@ class PresetsMenu :
|
|||||||
makeComponent<MenuItem, StaticText<TEXT_KIDSLIMITS>, ApplyLimitsPresetAction<&presets::kidsLimits>>,
|
makeComponent<MenuItem, StaticText<TEXT_KIDSLIMITS>, ApplyLimitsPresetAction<&presets::kidsLimits>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_DEFAULTCONTROLLERHARDWARE>, ApplyControllerHardwarePresetAction<&presets::defaultControllerHardware>>,
|
makeComponent<MenuItem, StaticText<TEXT_DEFAULTCONTROLLERHARDWARE>, ApplyControllerHardwarePresetAction<&presets::defaultControllerHardware>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_MOSFETSOFFCONTROLLERHARDWARE>, ApplyControllerHardwarePresetAction<&presets::mosfetsOffControllerHardware>>,
|
makeComponent<MenuItem, StaticText<TEXT_MOSFETSOFFCONTROLLERHARDWARE>, ApplyControllerHardwarePresetAction<&presets::mosfetsOffControllerHardware>>,
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SPINNERCONTROLLERHARDWARE>, ApplyControllerHardwarePresetAction<&presets::spinnerControllerHardware>>,
|
makeComponent<MenuItem, StaticText<TEXT_SPINNERCONTROLLERHARDWARE>, ApplyControllerHardwarePresetAction<&presets::spinnerControllerHardware>>,
|
||||||
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<TEXT_DEFAULTBOARDCOMPUTERHARDWARE>, ApplyBoardcomputerHardwarePresetAction<&presets::defaultBoardcomputerHardware>>,
|
makeComponent<MenuItem, StaticText<TEXT_DEFAULTBOARDCOMPUTERHARDWARE>, ApplyBoardcomputerHardwarePresetAction<&presets::defaultBoardcomputerHardware>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_STREET>, DisabledColor, DummyAction>,
|
makeComponent<MenuItem, StaticText<TEXT_STREET>, DisabledColor, DummyAction>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_SIDEWALK>, DisabledColor, DummyAction>,
|
makeComponent<MenuItem, StaticText<TEXT_SIDEWALK>, DisabledColor, DummyAction>,
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#include "modes/larsmmode.h"
|
#include "modes/larsmmode.h"
|
||||||
#include "modes/gametrakmode.h"
|
#include "modes/gametrakmode.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
class MainMenu;
|
class MainMenu;
|
||||||
}
|
}
|
||||||
@@ -69,3 +70,4 @@ void SelectModeMenu::start()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -32,6 +32,7 @@ class MainMenu;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
class SettingsMenu;
|
class SettingsMenu;
|
||||||
using BluetoothModeChangeDisplay = makeComponent<
|
using BluetoothModeChangeDisplay = makeComponent<
|
||||||
ChangeValueDisplay<BluetoothMode>,
|
ChangeValueDisplay<BluetoothMode>,
|
||||||
@@ -43,6 +44,7 @@ using BluetoothModeChangeDisplay = makeComponent<
|
|||||||
|
|
||||||
struct FrontLedAccessor : public RefAccessor<bool> { bool &getRef() const override { return front.command.led; } };
|
struct FrontLedAccessor : public RefAccessor<bool> { bool &getRef() const override { return front.command.led; } };
|
||||||
struct BackLedAccessor : public RefAccessor<bool> { bool &getRef() const override { return back.command.led; } };
|
struct BackLedAccessor : public RefAccessor<bool> { bool &getRef() const override { return back.command.led; } };
|
||||||
|
#endif
|
||||||
|
|
||||||
class SettingsMenu :
|
class SettingsMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
@@ -52,16 +54,20 @@ class SettingsMenu :
|
|||||||
makeComponent<MenuItem, StaticText<TEXT_LIMITSSETTINGS>, SwitchScreenAction<LimitsSettingsMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_LIMITSSETTINGS>, SwitchScreenAction<LimitsSettingsMenu>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_WIFISETTINGS>, SwitchScreenAction<WifiSettingsMenu>, StaticMenuItemIcon<&icons::wifi>>,
|
makeComponent<MenuItem, StaticText<TEXT_WIFISETTINGS>, SwitchScreenAction<WifiSettingsMenu>, StaticMenuItemIcon<&icons::wifi>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BLUETOOTHSETTINGS>, SwitchScreenAction<BluetoothSettingsMenu>, StaticMenuItemIcon<&icons::bluetooth>>,
|
makeComponent<MenuItem, StaticText<TEXT_BLUETOOTHSETTINGS>, SwitchScreenAction<BluetoothSettingsMenu>, StaticMenuItemIcon<&icons::bluetooth>>,
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
makeComponent<MenuItem, StaticText<TEXT_MODESSETTINGS>, SwitchScreenAction<ModesSettingsMenu>>,
|
makeComponent<MenuItem, StaticText<TEXT_MODESSETTINGS>, SwitchScreenAction<ModesSettingsMenu>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_CONTROLLERHARDWARESETTINGS>, SwitchScreenAction<ControllerHardwareSettingsMenu>, StaticMenuItemIcon<&icons::hardware>>,
|
makeComponent<MenuItem, StaticText<TEXT_CONTROLLERHARDWARESETTINGS>, SwitchScreenAction<ControllerHardwareSettingsMenu>, StaticMenuItemIcon<&icons::hardware>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BOARDCOMPUTERHARDWARESETTINGS>, SwitchScreenAction<BoardcomputerHardwareSettingsMenu>, StaticMenuItemIcon<&icons::hardware>>,
|
makeComponent<MenuItem, StaticText<TEXT_BOARDCOMPUTERHARDWARESETTINGS>, SwitchScreenAction<BoardcomputerHardwareSettingsMenu>, StaticMenuItemIcon<&icons::hardware>>,
|
||||||
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BLUETOOTHMODE>, SwitchScreenAction<BluetoothModeChangeDisplay>>,
|
makeComponent<MenuItem, StaticText<TEXT_BLUETOOTHMODE>, SwitchScreenAction<BluetoothModeChangeDisplay>>,
|
||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
makeComponent<MenuItem, StaticText<TEXT_AUTOCONNECTBMS>, ToggleBoolAction, CheckboxIcon, AutoConnectBmsAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_AUTOCONNECTBMS>, ToggleBoolAction, CheckboxIcon, AutoConnectBmsAccessor>,
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BUZZER>, SwitchScreenAction<BuzzerMenu>, StaticMenuItemIcon<&icons::buzzer>>,
|
makeComponent<MenuItem, StaticText<TEXT_BUZZER>, SwitchScreenAction<BuzzerMenu>, StaticMenuItemIcon<&icons::buzzer>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_FRONTLED>, ToggleBoolAction, CheckboxIcon, FrontLedAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_FRONTLED>, ToggleBoolAction, CheckboxIcon, FrontLedAccessor>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BACKLED>, ToggleBoolAction, CheckboxIcon, BackLedAccessor>,
|
makeComponent<MenuItem, StaticText<TEXT_BACKLED>, ToggleBoolAction, CheckboxIcon, BackLedAccessor>,
|
||||||
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<TEXT_ABOUT>, SwitchScreenAction<AboutMenu>, StaticMenuItemIcon<&icons::info>>,
|
makeComponent<MenuItem, StaticText<TEXT_ABOUT>, SwitchScreenAction<AboutMenu>, StaticMenuItemIcon<&icons::info>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<MainMenu>, StaticMenuItemIcon<&icons::back>>
|
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<MainMenu>, StaticMenuItemIcon<&icons::back>>
|
||||||
>
|
>
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
#include "settingsaccessors.h"
|
#include "settingsaccessors.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
class TempomatModeSettingsMenu;
|
class TempomatModeSettingsMenu;
|
||||||
class ModesSettingsMenu;
|
class ModesSettingsMenu;
|
||||||
@@ -42,3 +43,4 @@ class TempomatModeSettingsMenu :
|
|||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -7,6 +7,7 @@
|
|||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
class MainMenu;
|
class MainMenu;
|
||||||
}
|
}
|
||||||
@@ -60,3 +61,4 @@ void PoweroffDisplay::stop()
|
|||||||
controller.command.poweroff = false;
|
controller.command.poweroff = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -35,21 +35,34 @@ private:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BoardStatus(int y) :
|
BoardStatus(int y) :
|
||||||
m_y{y},
|
m_y{y}
|
||||||
m_labelLeftPwm{65, y}, // 80, 22
|
#ifdef GLUMP_CONTROLLER
|
||||||
|
,m_labelLeftPwm{65, y}, // 80, 22
|
||||||
m_labelRightPwm{155, y}, // 80, 22
|
m_labelRightPwm{155, y}, // 80, 22
|
||||||
m_labelVoltage{30, y+25}, // 85, 22
|
m_labelVoltage{30, y+25}, // 85, 22
|
||||||
m_labelTemperature{150, y+25}, // 85, 22
|
m_labelTemperature{150, y+25}, // 85, 22
|
||||||
m_leftMotor{y+50},
|
m_leftMotor{y+50},
|
||||||
m_rightMotor{y+75}
|
m_rightMotor{y+75}
|
||||||
|
#endif
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
,m_labelPwm{65, y}, // 80, 22
|
||||||
|
m_labelSpeed{135, y+50}
|
||||||
|
#endif
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
void redraw(const Controller &controller);
|
void redraw(const Controller &controller);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
void redraw(const VescController &controller);
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void drawWarning();
|
void drawWarning();
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
class MotorStatus
|
class MotorStatus
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -69,9 +82,16 @@ private:
|
|||||||
Label m_labelSpeed;
|
Label m_labelSpeed;
|
||||||
Label m_labelHallSensors;
|
Label m_labelHallSensors;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
const int m_y;
|
const int m_y;
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
Label m_labelPwm;
|
||||||
|
Label m_labelSpeed;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
bool m_lastFeedbackValid{};
|
bool m_lastFeedbackValid{};
|
||||||
|
|
||||||
Label m_labelLeftPwm;
|
Label m_labelLeftPwm;
|
||||||
@@ -82,6 +102,7 @@ private:
|
|||||||
|
|
||||||
MotorStatus m_leftMotor;
|
MotorStatus m_leftMotor;
|
||||||
MotorStatus m_rightMotor;
|
MotorStatus m_rightMotor;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
Label m_labelRawGas{45, 0}; // 40, 15
|
Label m_labelRawGas{45, 0}; // 40, 15
|
||||||
@@ -92,18 +113,27 @@ private:
|
|||||||
Label m_labelBrems{90, 15}; // 60, 15
|
Label m_labelBrems{90, 15}; // 60, 15
|
||||||
ProgressBar m_progressBarBrems{150, 15, 90, 15, 0, 1000};
|
ProgressBar m_progressBarBrems{150, 15, 90, 15, 0, 1000};
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
BoardStatus m_frontStatus{42};
|
BoardStatus m_frontStatus{42};
|
||||||
BoardStatus m_backStatus{142};
|
BoardStatus m_backStatus{142};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
BoardStatus m_one{42};
|
||||||
|
BoardStatus m_two{142};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static const constexpr int bottomLines[4] { 251, 266, 281, 296 };
|
||||||
|
|
||||||
Label m_labelWifiStatus{35, bottomLines[0]}; // 120, 15
|
Label m_labelWifiStatus{35, bottomLines[0]}; // 120, 15
|
||||||
Label m_labelLimit0{205, bottomLines[0]}; // 35, 15
|
Label m_labelLimit0{205, bottomLines[0]}; // 35, 15
|
||||||
Label m_labelIpAddress{25, bottomLines[1]}; // 130, 15
|
Label m_labelIpAddress{25, bottomLines[1]}; // 130, 15
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
Label m_labelLimit1{205, bottomLines[1]}; // 35, 15
|
Label m_labelLimit1{205, bottomLines[1]}; // 35, 15
|
||||||
|
#endif
|
||||||
Label m_labelPerformance{85, bottomLines[2]}; // 40, 15
|
Label m_labelPerformance{85, bottomLines[2]}; // 40, 15
|
||||||
Label m_labelMode{165, bottomLines[2]}; // 75, 15
|
Label m_labelMode{165, bottomLines[2]}; // 75, 15
|
||||||
Label m_labelName{40, bottomLines[3]}; // 40, 15
|
Label m_labelName{40, bottomLines[3]}; // 40, 15
|
||||||
|
|
||||||
static const constexpr int bottomLines[4] { 251, 266, 281, 296 };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void StatusDisplay::initScreen()
|
void StatusDisplay::initScreen()
|
||||||
@@ -121,8 +151,15 @@ void StatusDisplay::initScreen()
|
|||||||
m_labelBrems.start();
|
m_labelBrems.start();
|
||||||
m_progressBarBrems.start();
|
m_progressBarBrems.start();
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
m_frontStatus.start();
|
m_frontStatus.start();
|
||||||
m_backStatus.start();
|
m_backStatus.start();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
m_one.start();
|
||||||
|
m_two.start();
|
||||||
|
#endif
|
||||||
|
|
||||||
tft.setTextFont(2);
|
tft.setTextFont(2);
|
||||||
tft.drawString("WiFi:", 0, bottomLines[0]);
|
tft.drawString("WiFi:", 0, bottomLines[0]);
|
||||||
@@ -131,9 +168,17 @@ void StatusDisplay::initScreen()
|
|||||||
m_labelLimit0.start();
|
m_labelLimit0.start();
|
||||||
tft.drawString("IP:", 0, bottomLines[1]);
|
tft.drawString("IP:", 0, bottomLines[1]);
|
||||||
m_labelIpAddress.start();
|
m_labelIpAddress.start();
|
||||||
|
<<<<<<< HEAD
|
||||||
tft.drawString("Limit1:", 160, bottomLines[1]);
|
tft.drawString("Limit1:", 160, bottomLines[1]);
|
||||||
m_labelLimit1.start();
|
m_labelLimit1.start();
|
||||||
tft.drawString("Performance:", 0, bottomLines[2]);
|
tft.drawString("Performance:", 0, bottomLines[2]);
|
||||||
|
=======
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
|
tft.drawString("Limit1:", 160, 281);
|
||||||
|
m_labelLimit1.start();
|
||||||
|
#endif
|
||||||
|
tft.drawString("Performance:", 0, 296);
|
||||||
|
>>>>>>> b343056... vesc control
|
||||||
m_labelPerformance.start();
|
m_labelPerformance.start();
|
||||||
tft.drawString("Mode:", 125, bottomLines[2]);
|
tft.drawString("Mode:", 125, bottomLines[2]);
|
||||||
m_labelMode.start();
|
m_labelMode.start();
|
||||||
@@ -153,14 +198,28 @@ void StatusDisplay::redraw()
|
|||||||
m_labelBrems.redraw(String{brems});
|
m_labelBrems.redraw(String{brems});
|
||||||
m_progressBarBrems.redraw(brems);
|
m_progressBarBrems.redraw(brems);
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
m_frontStatus.redraw(::front);
|
m_frontStatus.redraw(::front);
|
||||||
m_backStatus.redraw(::back);
|
m_backStatus.redraw(::back);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
m_one.redraw(::one);
|
||||||
|
m_two.redraw(::two);
|
||||||
|
#endif
|
||||||
|
|
||||||
tft.setTextFont(2);
|
tft.setTextFont(2);
|
||||||
m_labelWifiStatus.redraw(toString(WiFi.status()));
|
m_labelWifiStatus.redraw(toString(WiFi.status()));
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
m_labelLimit0.redraw(String{front.command.left.iMotMax} + "A");
|
m_labelLimit0.redraw(String{front.command.left.iMotMax} + "A");
|
||||||
|
#endif
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
m_labelLimit0.redraw(String{settings.limits.iMotMax} + "A");
|
||||||
|
#endif
|
||||||
m_labelIpAddress.redraw(WiFi.localIP().toString());
|
m_labelIpAddress.redraw(WiFi.localIP().toString());
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
m_labelLimit1.redraw(String{front.command.left.iDcMax} + "A");
|
m_labelLimit1.redraw(String{front.command.left.iDcMax} + "A");
|
||||||
|
#endif
|
||||||
m_labelPerformance.redraw(String{performance.last});
|
m_labelPerformance.redraw(String{performance.last});
|
||||||
m_labelMode.redraw(currentMode->displayName());
|
m_labelMode.redraw(currentMode->displayName());
|
||||||
m_labelName.redraw(&deviceName[0]);
|
m_labelName.redraw(&deviceName[0]);
|
||||||
@@ -181,12 +240,15 @@ void StatusDisplay::rotate(int offset)
|
|||||||
void StatusDisplay::BoardStatus::start()
|
void StatusDisplay::BoardStatus::start()
|
||||||
{
|
{
|
||||||
tft.setTextFont(4);
|
tft.setTextFont(4);
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
tft.drawString("pwm:", 0, m_y);
|
tft.drawString("pwm:", 0, m_y);
|
||||||
m_labelLeftPwm.start();
|
m_labelLeftPwm.start();
|
||||||
m_labelRightPwm.start();
|
m_labelRightPwm.start();
|
||||||
drawWarning();
|
drawWarning();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
void StatusDisplay::BoardStatus::redraw(const Controller &controller)
|
void StatusDisplay::BoardStatus::redraw(const Controller &controller)
|
||||||
{
|
{
|
||||||
tft.setTextFont(4);
|
tft.setTextFont(4);
|
||||||
@@ -227,6 +289,24 @@ void StatusDisplay::BoardStatus::redraw(const Controller &controller)
|
|||||||
m_rightMotor.redraw(controller.feedback.right);
|
m_rightMotor.redraw(controller.feedback.right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
void StatusDisplay::BoardStatus::redraw(const VescController &controller) {
|
||||||
|
tft.setTextFont(4);
|
||||||
|
|
||||||
|
m_labelPwm.redraw(String{controller.pwm});
|
||||||
|
|
||||||
|
tft.fillRect(0, m_y+25, tft.width(), 75, TFT_BLACK);
|
||||||
|
|
||||||
|
tft.setTextColor(TFT_WHITE);
|
||||||
|
|
||||||
|
m_labelSpeed.redraw(String{convertToKmh(controller.values.rpm)});
|
||||||
|
|
||||||
|
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void StatusDisplay::BoardStatus::drawWarning()
|
void StatusDisplay::BoardStatus::drawWarning()
|
||||||
{
|
{
|
||||||
@@ -239,6 +319,7 @@ void StatusDisplay::BoardStatus::drawWarning()
|
|||||||
tft.setSwapBytes(settings.boardcomputerHardware.swapScreenBytes);
|
tft.setSwapBytes(settings.boardcomputerHardware.swapScreenBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
void StatusDisplay::BoardStatus::MotorStatus::start()
|
void StatusDisplay::BoardStatus::MotorStatus::start()
|
||||||
{
|
{
|
||||||
m_labelError.start();
|
m_labelError.start();
|
||||||
@@ -262,4 +343,5 @@ void StatusDisplay::BoardStatus::MotorStatus::redraw(const MotorFeedback &motor)
|
|||||||
|
|
||||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "bobbycar-protocol/protocol.h"
|
#include "bobbycar-protocol/protocol.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
class FeedbackParser
|
class FeedbackParser
|
||||||
{
|
{
|
||||||
@@ -84,3 +85,4 @@ private:
|
|||||||
Feedback &m_feedback, m_newFeedback;
|
Feedback &m_feedback, m_newFeedback;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -29,8 +29,15 @@ char deviceName[32];
|
|||||||
Settings settings;
|
Settings settings;
|
||||||
SettingsSaver settingsSaver;
|
SettingsSaver settingsSaver;
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
Controller front{Serial1, settings.controllerHardware.enableFrontLeft, settings.controllerHardware.enableFrontRight, settings.controllerHardware.invertFrontLeft, settings.controllerHardware.invertFrontRight};
|
Controller front{Serial1, settings.controllerHardware.enableFrontLeft, settings.controllerHardware.enableFrontRight, settings.controllerHardware.invertFrontLeft, settings.controllerHardware.invertFrontRight};
|
||||||
Controller back{Serial2, settings.controllerHardware.enableBackLeft, settings.controllerHardware.enableBackRight, settings.controllerHardware.invertBackLeft, settings.controllerHardware.invertBackRight};
|
Controller back{Serial2, settings.controllerHardware.enableBackLeft, settings.controllerHardware.enableBackRight, settings.controllerHardware.invertBackLeft, settings.controllerHardware.invertBackRight};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
VescController one{Serial1, settings.controllerHardware.enableOne};
|
||||||
|
VescController two{Serial2, settings.controllerHardware.enableTwo};
|
||||||
|
#endif
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
unsigned long lastTime = millis();
|
unsigned long lastTime = millis();
|
||||||
|
19
src/main.cpp
19
src/main.cpp
@@ -72,7 +72,9 @@ void setup()
|
|||||||
if (settingsSaver.init())
|
if (settingsSaver.init())
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
updateSwapFrontBack();
|
updateSwapFrontBack();
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
uint8_t macAddress[6];
|
uint8_t macAddress[6];
|
||||||
@@ -107,16 +109,26 @@ void setup()
|
|||||||
} else if (settings.bluetoothMode == BluetoothMode::Slave)
|
} else if (settings.bluetoothMode == BluetoothMode::Slave)
|
||||||
BluetoothBeginAction{}.triggered();
|
BluetoothBeginAction{}.triggered();
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
front.serial.get().begin(38400, SERIAL_8N1, PINS_RX1, PINS_TX1);
|
front.serial.get().begin(38400, SERIAL_8N1, PINS_RX1, PINS_TX1);
|
||||||
back.serial.get().begin(38400, SERIAL_8N1, PINS_RX2, PINS_TX2);
|
back.serial.get().begin(38400, SERIAL_8N1, PINS_RX2, PINS_TX2);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
one.serial.get().begin(57600, SERIAL_8N1, PINS_RX1, PINS_TX1);
|
||||||
|
two.serial.get().begin(57600, SERIAL_8N1, PINS_RX2, PINS_TX2);
|
||||||
|
Serial.println("vesc begin");
|
||||||
|
#endif
|
||||||
|
|
||||||
raw_gas = 0;
|
raw_gas = 0;
|
||||||
raw_brems = 0;
|
raw_brems = 0;
|
||||||
gas = 0;
|
gas = 0;
|
||||||
brems = 0;
|
brems = 0;
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
for (Controller &controller : controllers())
|
for (Controller &controller : controllers())
|
||||||
controller.command.buzzer = {};
|
controller.command.buzzer = {};
|
||||||
|
#endif
|
||||||
|
|
||||||
currentMode = &modes::defaultMode;
|
currentMode = &modes::defaultMode;
|
||||||
|
|
||||||
@@ -194,8 +206,15 @@ void loop()
|
|||||||
performance.lastTime = now;
|
performance.lastTime = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
for (Controller &controller : controllers())
|
for (Controller &controller : controllers())
|
||||||
controller.parser.update();
|
controller.parser.update();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
for (VescController &controller : controllers())
|
||||||
|
controller.update();
|
||||||
|
#endif
|
||||||
|
|
||||||
handleSerial();
|
handleSerial();
|
||||||
|
|
||||||
|
@@ -75,6 +75,7 @@ void DefaultMode::update()
|
|||||||
lastPwm = pwm;
|
lastPwm = pwm;
|
||||||
lastTime = now;
|
lastTime = now;
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
for (Controller &controller : controllers())
|
for (Controller &controller : controllers())
|
||||||
for (MotorState &motor : motorsInController(controller))
|
for (MotorState &motor : motorsInController(controller))
|
||||||
{
|
{
|
||||||
@@ -82,8 +83,18 @@ void DefaultMode::update()
|
|||||||
motor.ctrlMod = settings.defaultMode.ctrlMod;
|
motor.ctrlMod = settings.defaultMode.ctrlMod;
|
||||||
motor.pwm = pwm / 100. * (&controller == &front ? settings.defaultMode.frontPercentage : settings.defaultMode.backPercentage);
|
motor.pwm = pwm / 100. * (&controller == &front ? settings.defaultMode.frontPercentage : settings.defaultMode.backPercentage);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
for (VescController &controller : controllers()) {
|
||||||
|
controller.pwm = pwm;
|
||||||
|
Serial.println(String{"new pwm "} + pwm);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
fixCommonParams();
|
fixCommonParams();
|
||||||
|
#endif
|
||||||
|
|
||||||
sendCommands();
|
sendCommands();
|
||||||
}
|
}
|
||||||
|
@@ -5,15 +5,26 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#include "bobbycar-protocol/protocol.h"
|
#include "bobbycar-protocol/protocol.h"
|
||||||
|
#include "../controller.h"
|
||||||
|
#include "../utils.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class IgnoreInputMode : public ModeInterface
|
class IgnoreInputMode : public ModeInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
IgnoreInputMode(int16_t pwm, ControlType ctrlTyp, ControlMode ctrlMod) :
|
IgnoreInputMode(int16_t pwm, ControlType ctrlTyp, ControlMode ctrlMod) :
|
||||||
m_pwm{pwm}, m_ctrlTyp{ctrlTyp}, m_ctrlMod{ctrlMod}
|
m_pwm{pwm}, m_ctrlTyp{ctrlTyp}, m_ctrlMod{ctrlMod}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
IgnoreInputMode(int16_t pwm) :
|
||||||
|
m_pwm{pwm}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void update() override;
|
void update() override;
|
||||||
|
|
||||||
@@ -21,12 +32,15 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const int16_t m_pwm;
|
const int16_t m_pwm;
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
const ControlType m_ctrlTyp;
|
const ControlType m_ctrlTyp;
|
||||||
const ControlMode m_ctrlMod;
|
const ControlMode m_ctrlMod;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
void IgnoreInputMode::update()
|
void IgnoreInputMode::update()
|
||||||
{
|
{
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
for (MotorState &motor : motors())
|
for (MotorState &motor : motors())
|
||||||
{
|
{
|
||||||
motor.ctrlTyp = m_ctrlTyp;
|
motor.ctrlTyp = m_ctrlTyp;
|
||||||
@@ -35,6 +49,13 @@ void IgnoreInputMode::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
fixCommonParams();
|
fixCommonParams();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
for (VescController &controller : controllers()) {
|
||||||
|
controller.pwm = m_pwm;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
sendCommands();
|
sendCommands();
|
||||||
}
|
}
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "bobbycar-protocol/protocol.h"
|
#include "bobbycar-protocol/protocol.h"
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
namespace {
|
namespace {
|
||||||
class LarsmMode : public ModeInterface
|
class LarsmMode : public ModeInterface
|
||||||
{
|
{
|
||||||
@@ -108,3 +109,4 @@ void LarsmMode::update()
|
|||||||
sendCommands();
|
sendCommands();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -42,7 +42,7 @@ void TempomatMode::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
pwm += (gas/1000.) - (brems/1000.);
|
pwm += (gas/1000.) - (brems/1000.);
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
for (MotorState &motor : motors())
|
for (MotorState &motor : motors())
|
||||||
{
|
{
|
||||||
motor.ctrlTyp = settings.tempomatMode.ctrlTyp;
|
motor.ctrlTyp = settings.tempomatMode.ctrlTyp;
|
||||||
@@ -51,6 +51,13 @@ void TempomatMode::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
fixCommonParams();
|
fixCommonParams();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
for (VescController &controller : controllers()) {
|
||||||
|
controller.pwm = pwm;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
sendCommands();
|
sendCommands();
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,7 @@ constexpr Settings::Limits kidsLimits {
|
|||||||
};
|
};
|
||||||
|
|
||||||
constexpr Settings::ControllerHardware defaultControllerHardware {
|
constexpr Settings::ControllerHardware defaultControllerHardware {
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
.enableFrontLeft = true,
|
.enableFrontLeft = true,
|
||||||
.enableFrontRight = true,
|
.enableFrontRight = true,
|
||||||
.enableBackLeft = true,
|
.enableBackLeft = true,
|
||||||
@@ -30,12 +31,23 @@ constexpr Settings::ControllerHardware defaultControllerHardware {
|
|||||||
.invertBackLeft = false,
|
.invertBackLeft = false,
|
||||||
.invertBackRight = true,
|
.invertBackRight = true,
|
||||||
|
|
||||||
|
.swapFrontBack = false,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
.enableOne = true,
|
||||||
|
.enableTwo = true,
|
||||||
|
|
||||||
|
.invertOne = true,
|
||||||
|
.invertTwo = true,
|
||||||
|
#endif
|
||||||
|
|
||||||
.wheelDiameter = 165,
|
.wheelDiameter = 165,
|
||||||
.numMagnetPoles = 15,
|
.numMagnetPoles = 15,
|
||||||
.swapFrontBack = false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr Settings::ControllerHardware mosfetsOffControllerHardware {
|
constexpr Settings::ControllerHardware mosfetsOffControllerHardware {
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
.enableFrontLeft = false,
|
.enableFrontLeft = false,
|
||||||
.enableFrontRight = false,
|
.enableFrontRight = false,
|
||||||
.enableBackLeft = false,
|
.enableBackLeft = false,
|
||||||
@@ -46,11 +58,22 @@ constexpr Settings::ControllerHardware mosfetsOffControllerHardware {
|
|||||||
.invertBackLeft = false,
|
.invertBackLeft = false,
|
||||||
.invertBackRight = true,
|
.invertBackRight = true,
|
||||||
|
|
||||||
|
.swapFrontBack = false,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
.enableOne = false,
|
||||||
|
.enableTwo = false,
|
||||||
|
|
||||||
|
.invertOne = false,
|
||||||
|
.invertTwo = false,
|
||||||
|
#endif
|
||||||
|
|
||||||
.wheelDiameter = 165,
|
.wheelDiameter = 165,
|
||||||
.numMagnetPoles = 15,
|
.numMagnetPoles = 15,
|
||||||
.swapFrontBack = false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
constexpr Settings::ControllerHardware spinnerControllerHardware {
|
constexpr Settings::ControllerHardware spinnerControllerHardware {
|
||||||
.enableFrontLeft = true,
|
.enableFrontLeft = true,
|
||||||
.enableFrontRight = true,
|
.enableFrontRight = true,
|
||||||
@@ -62,10 +85,12 @@ constexpr Settings::ControllerHardware spinnerControllerHardware {
|
|||||||
.invertBackLeft = false,
|
.invertBackLeft = false,
|
||||||
.invertBackRight = false,
|
.invertBackRight = false,
|
||||||
|
|
||||||
|
.swapFrontBack = false,
|
||||||
|
|
||||||
.wheelDiameter = 165,
|
.wheelDiameter = 165,
|
||||||
.numMagnetPoles = 15,
|
.numMagnetPoles = 15,
|
||||||
.swapFrontBack = false
|
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
constexpr Settings::BoardcomputerHardware defaultBoardcomputerHardware {
|
constexpr Settings::BoardcomputerHardware defaultBoardcomputerHardware {
|
||||||
.sampleCount = 100,
|
.sampleCount = 100,
|
||||||
@@ -85,8 +110,10 @@ constexpr Settings::BoardcomputerHardware defaultBoardcomputerHardware {
|
|||||||
};
|
};
|
||||||
|
|
||||||
constexpr Settings::DefaultMode defaultDefaultMode {
|
constexpr Settings::DefaultMode defaultDefaultMode {
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
.ctrlTyp = ControlType::FieldOrientedControl,
|
.ctrlTyp = ControlType::FieldOrientedControl,
|
||||||
.ctrlMod = ControlMode::Torque,
|
.ctrlMod = ControlMode::Torque,
|
||||||
|
#endif
|
||||||
.enableSmoothing = true,
|
.enableSmoothing = true,
|
||||||
.smoothing = 20,
|
.smoothing = 20,
|
||||||
.frontPercentage = 100,
|
.frontPercentage = 100,
|
||||||
@@ -98,6 +125,7 @@ constexpr Settings::DefaultMode defaultDefaultMode {
|
|||||||
.brems2_wert = 750
|
.brems2_wert = 750
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
constexpr Settings::TempomatMode defaultTempomatMode {
|
constexpr Settings::TempomatMode defaultTempomatMode {
|
||||||
.ctrlTyp = ControlType::FieldOrientedControl,
|
.ctrlTyp = ControlType::FieldOrientedControl,
|
||||||
.ctrlMod = ControlMode::Speed
|
.ctrlMod = ControlMode::Speed
|
||||||
@@ -107,6 +135,7 @@ constexpr Settings::LarsmMode defaultLarsmMode {
|
|||||||
.mode = LarsmModeMode::Mode4,
|
.mode = LarsmModeMode::Mode4,
|
||||||
.iterations = 100
|
.iterations = 100
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
constexpr Settings defaultSettings{
|
constexpr Settings defaultSettings{
|
||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
@@ -122,7 +151,10 @@ constexpr Settings defaultSettings{
|
|||||||
.controllerHardware = defaultControllerHardware,
|
.controllerHardware = defaultControllerHardware,
|
||||||
.boardcomputerHardware = defaultBoardcomputerHardware,
|
.boardcomputerHardware = defaultBoardcomputerHardware,
|
||||||
.defaultMode = defaultDefaultMode,
|
.defaultMode = defaultDefaultMode,
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
.tempomatMode = defaultTempomatMode,
|
.tempomatMode = defaultTempomatMode,
|
||||||
.larsmMode = defaultLarsmMode
|
.larsmMode = defaultLarsmMode
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -61,26 +61,35 @@ union X {
|
|||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
BmsMenu bmsMenu;
|
BmsMenu bmsMenu;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
BuzzerMenu buzzerMenu;
|
BuzzerMenu buzzerMenu;
|
||||||
FrontCommandDebugMenu frontCommandDebugMenu;
|
FrontCommandDebugMenu frontCommandDebugMenu;
|
||||||
BackCommandDebugMenu backCommandDebugMenu;
|
BackCommandDebugMenu backCommandDebugMenu;
|
||||||
|
#endif
|
||||||
ControllerHardwareSettingsMenu controllerHardwareSettingsMenu;
|
ControllerHardwareSettingsMenu controllerHardwareSettingsMenu;
|
||||||
DebugMenu debugMenu;
|
DebugMenu debugMenu;
|
||||||
DefaultModeSettingsMenu defaultModeSettingsMenu;
|
DefaultModeSettingsMenu defaultModeSettingsMenu;
|
||||||
DemosMenu demosMenu;
|
DemosMenu demosMenu;
|
||||||
DynamicDebugMenu dynamicDebugMenu;
|
DynamicDebugMenu dynamicDebugMenu;
|
||||||
EnableMenu enableMenu;
|
EnableMenu enableMenu;
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
FrontFeedbackDebugMenu frontFeedbackDebugMenu;
|
FrontFeedbackDebugMenu frontFeedbackDebugMenu;
|
||||||
BackFeedbackDebugMenu backFeedbackDebugMenu;
|
BackFeedbackDebugMenu backFeedbackDebugMenu;
|
||||||
|
#endif
|
||||||
#ifdef FEATURE_GAMETRAK
|
#ifdef FEATURE_GAMETRAK
|
||||||
GametrakModeSettingsMenu gametrakModeSettingsMenu;
|
GametrakModeSettingsMenu gametrakModeSettingsMenu;
|
||||||
#endif
|
#endif
|
||||||
GenericWifiSettingsMenu genericWifiSettingsMenu;
|
GenericWifiSettingsMenu genericWifiSettingsMenu;
|
||||||
GraphsMenu graphsMenu;
|
GraphsMenu graphsMenu;
|
||||||
InvertMenu invertMenu;
|
InvertMenu invertMenu;
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
LarsmModeSettingsMenu larsmModeSettingsMenu;
|
LarsmModeSettingsMenu larsmModeSettingsMenu;
|
||||||
|
#endif
|
||||||
|
|
||||||
LimitsSettingsMenu limitsSettingsMenu;
|
LimitsSettingsMenu limitsSettingsMenu;
|
||||||
MainMenu mainMenu;
|
MainMenu mainMenu;
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
TempomatModeSettingsMenu tempomatModeSettingsMenu;
|
TempomatModeSettingsMenu tempomatModeSettingsMenu;
|
||||||
ModesSettingsMenu modesSettingsMenu;
|
ModesSettingsMenu modesSettingsMenu;
|
||||||
#ifdef FEATURE_MOSFETS
|
#ifdef FEATURE_MOSFETS
|
||||||
@@ -95,8 +104,13 @@ union X {
|
|||||||
BackLeftMotorFeedbackDebugMenu backLeftMotorFeedbackDebugMenu;
|
BackLeftMotorFeedbackDebugMenu backLeftMotorFeedbackDebugMenu;
|
||||||
BackRightMotorFeedbackDebugMenu backRightMotorFeedbackDebugMenu;
|
BackRightMotorFeedbackDebugMenu backRightMotorFeedbackDebugMenu;
|
||||||
BoardcomputerHardwareSettingsMenu boardcomputerHardwareSettingsMenu;
|
BoardcomputerHardwareSettingsMenu boardcomputerHardwareSettingsMenu;
|
||||||
|
#endif
|
||||||
PresetsMenu presetsMenu;
|
PresetsMenu presetsMenu;
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
SelectModeMenu selectModeMenu;
|
SelectModeMenu selectModeMenu;
|
||||||
|
#endif
|
||||||
|
|
||||||
SettingsMenu settingsMenu;
|
SettingsMenu settingsMenu;
|
||||||
StationWifiSettingsMenu stationWifiSettingsMenu;
|
StationWifiSettingsMenu stationWifiSettingsMenu;
|
||||||
WifiScanMenu wifiScanMenu;
|
WifiScanMenu wifiScanMenu;
|
||||||
@@ -114,7 +128,9 @@ union X {
|
|||||||
Lockscreen lockScreen;
|
Lockscreen lockScreen;
|
||||||
MetersDisplay metersDisplay;
|
MetersDisplay metersDisplay;
|
||||||
PingPongDisplay pingPongDisplay;
|
PingPongDisplay pingPongDisplay;
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
PoweroffDisplay poweroffDisplay;
|
PoweroffDisplay poweroffDisplay;
|
||||||
|
#endif
|
||||||
SpiroDisplay spiroDisplay;
|
SpiroDisplay spiroDisplay;
|
||||||
StarfieldDisplay starFieldDisplay;
|
StarfieldDisplay starFieldDisplay;
|
||||||
StatusDisplay statusDisplay;
|
StatusDisplay statusDisplay;
|
||||||
@@ -124,6 +140,7 @@ union X {
|
|||||||
|
|
||||||
BluetoothModeChangeDisplay bluetoothModeChangeDisplay;
|
BluetoothModeChangeDisplay bluetoothModeChangeDisplay;
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
FrontFreqChangeScreen changeFrontFreq;
|
FrontFreqChangeScreen changeFrontFreq;
|
||||||
FrontPatternChangeScreen changeFrontPattern;
|
FrontPatternChangeScreen changeFrontPattern;
|
||||||
BackFreqChangeScreen changeBackFreq;
|
BackFreqChangeScreen changeBackFreq;
|
||||||
@@ -132,6 +149,7 @@ union X {
|
|||||||
ReverseBeepFreq1ChangeScreen changeReverseBeepFreq1;
|
ReverseBeepFreq1ChangeScreen changeReverseBeepFreq1;
|
||||||
ReverseBeepDuration0ChangeScreen changeReverseBeepDuration0;
|
ReverseBeepDuration0ChangeScreen changeReverseBeepDuration0;
|
||||||
ReverseBeepDuration1ChangeScreen changeReverseBeepDuration1;
|
ReverseBeepDuration1ChangeScreen changeReverseBeepDuration1;
|
||||||
|
#endif
|
||||||
|
|
||||||
IMotMaxChangeScreen changeIMotMax;
|
IMotMaxChangeScreen changeIMotMax;
|
||||||
IDcMaxChangeScreen changeIDcMax;
|
IDcMaxChangeScreen changeIDcMax;
|
||||||
@@ -144,22 +162,28 @@ union X {
|
|||||||
WheelDiameterInchChangeScreen wheelDiameterInchChangeScreen;
|
WheelDiameterInchChangeScreen wheelDiameterInchChangeScreen;
|
||||||
NumMagnetPolesChangeScreen numMagnetPolesChangeScreen;
|
NumMagnetPolesChangeScreen numMagnetPolesChangeScreen;
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
DefaultModeCtrlTypChangeDisplay changeDefaultModeCtrlTyp;
|
DefaultModeCtrlTypChangeDisplay changeDefaultModeCtrlTyp;
|
||||||
DefaultModeCtrlModChangeDisplay changeDefaultModeCtrlMod;
|
DefaultModeCtrlModChangeDisplay changeDefaultModeCtrlMod;
|
||||||
|
#endif
|
||||||
DefaultModeSmoothingChangeDisplay changeDefaultModeSmoothing;
|
DefaultModeSmoothingChangeDisplay changeDefaultModeSmoothing;
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
DefaultModeFrontPercentageChangeDisplay changeDefaultModeFrontPercentage;
|
DefaultModeFrontPercentageChangeDisplay changeDefaultModeFrontPercentage;
|
||||||
DefaultModeBackPercentageChangeDisplay changeDefaultModeBackPercentage;
|
DefaultModeBackPercentageChangeDisplay changeDefaultModeBackPercentage;
|
||||||
|
#endif
|
||||||
DefaultModeAddSchwelleChangeDisplay changeDefaultModeAddSchwelle;
|
DefaultModeAddSchwelleChangeDisplay changeDefaultModeAddSchwelle;
|
||||||
DefaultModeGas1WertChangeDisplay changeDefaultModeGas1Wert;
|
DefaultModeGas1WertChangeDisplay changeDefaultModeGas1Wert;
|
||||||
DefaultModeGas2WertChangeDisplay changeDefaultModeGas2Wert;
|
DefaultModeGas2WertChangeDisplay changeDefaultModeGas2Wert;
|
||||||
DefaultModeBrems1WertChangeDisplay changeDefaultModeBrems1Wert;
|
DefaultModeBrems1WertChangeDisplay changeDefaultModeBrems1Wert;
|
||||||
DefaultModeBrems2WertChangeDisplay changeDefaultModeBrems2Wert;
|
DefaultModeBrems2WertChangeDisplay changeDefaultModeBrems2Wert;
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
TempomatModeCtrlTypChangeScreen changeManualModeCtrlTyp;
|
TempomatModeCtrlTypChangeScreen changeManualModeCtrlTyp;
|
||||||
TempomatModeCtrlModChangeScreen changeManualModeCtrlMod;
|
TempomatModeCtrlModChangeScreen changeManualModeCtrlMod;
|
||||||
|
|
||||||
LarsmModeModeChangeDisplay larsmModeModeChangeDisplay;
|
LarsmModeModeChangeDisplay larsmModeModeChangeDisplay;
|
||||||
LarsmModeIterationsChangeDisplay larsmModeIterationsChangeDisplay;
|
LarsmModeIterationsChangeDisplay larsmModeIterationsChangeDisplay;
|
||||||
|
#endif
|
||||||
|
|
||||||
SampleCountChangeScreen sampleCountChangeScreen;
|
SampleCountChangeScreen sampleCountChangeScreen;
|
||||||
GasMinChangeScreen changeGasMin;
|
GasMinChangeScreen changeGasMin;
|
||||||
@@ -184,15 +208,19 @@ union X {
|
|||||||
AvgSpeedKmhGraphDisplay avgSpeedKmhGraphDisplay;
|
AvgSpeedKmhGraphDisplay avgSpeedKmhGraphDisplay;
|
||||||
SumCurrentGraphDisplay sumCurrentGraphDisplay;
|
SumCurrentGraphDisplay sumCurrentGraphDisplay;
|
||||||
SumAbsoluteCurrentGraphDisplay sumAbsoluteCurrentGraphDisplay;
|
SumAbsoluteCurrentGraphDisplay sumAbsoluteCurrentGraphDisplay;
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
FrontVoltageGraphDisplay frontVoltageGraphDisplay;
|
FrontVoltageGraphDisplay frontVoltageGraphDisplay;
|
||||||
BackVoltageGraphDisplay backVoltageGraphDisplay;
|
BackVoltageGraphDisplay backVoltageGraphDisplay;
|
||||||
|
#endif
|
||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
BmsVoltageGraphDisplay bmsVoltageGraphDisplay;
|
BmsVoltageGraphDisplay bmsVoltageGraphDisplay;
|
||||||
BmsCurrentGraphDisplay bmsCurrentGraphDisplay;
|
BmsCurrentGraphDisplay bmsCurrentGraphDisplay;
|
||||||
BmsPowerGraphDisplay bmsPowerGraphDisplay;
|
BmsPowerGraphDisplay bmsPowerGraphDisplay;
|
||||||
SumCurrentsComparisonGraphDisplay sumCurrentsComparisonGraphDisplay;
|
SumCurrentsComparisonGraphDisplay sumCurrentsComparisonGraphDisplay;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
MotorCurrentsGraphDisplay motorCurrentsGraphDisplay;
|
MotorCurrentsGraphDisplay motorCurrentsGraphDisplay;
|
||||||
|
#endif
|
||||||
} displays;
|
} displays;
|
||||||
|
|
||||||
template<typename T> T &getRefByType() = delete;
|
template<typename T> T &getRefByType() = delete;
|
||||||
@@ -202,27 +230,35 @@ template<> decltype(displays.bluetoothSettingsMenu) &
|
|||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
template<> decltype(displays.bmsMenu) &getRefByType<decltype(displays.bmsMenu)>() { return displays.bmsMenu; }
|
template<> decltype(displays.bmsMenu) &getRefByType<decltype(displays.bmsMenu)>() { return displays.bmsMenu; }
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
template<> decltype(displays.buzzerMenu) &getRefByType<decltype(displays.buzzerMenu)>() { return displays.buzzerMenu; }
|
template<> decltype(displays.buzzerMenu) &getRefByType<decltype(displays.buzzerMenu)>() { return displays.buzzerMenu; }
|
||||||
template<> decltype(displays.boardcomputerHardwareSettingsMenu) &getRefByType<decltype(displays.boardcomputerHardwareSettingsMenu)>() { return displays.boardcomputerHardwareSettingsMenu; }
|
template<> decltype(displays.boardcomputerHardwareSettingsMenu) &getRefByType<decltype(displays.boardcomputerHardwareSettingsMenu)>() { return displays.boardcomputerHardwareSettingsMenu; }
|
||||||
template<> decltype(displays.controllerHardwareSettingsMenu) &getRefByType<decltype(displays.controllerHardwareSettingsMenu)>() { return displays.controllerHardwareSettingsMenu; }
|
template<> decltype(displays.controllerHardwareSettingsMenu) &getRefByType<decltype(displays.controllerHardwareSettingsMenu)>() { return displays.controllerHardwareSettingsMenu; }
|
||||||
template<> decltype(displays.frontCommandDebugMenu) &getRefByType<decltype(displays.frontCommandDebugMenu)>() { return displays.frontCommandDebugMenu; }
|
template<> decltype(displays.frontCommandDebugMenu) &getRefByType<decltype(displays.frontCommandDebugMenu)>() { return displays.frontCommandDebugMenu; }
|
||||||
template<> decltype(displays.backCommandDebugMenu) &getRefByType<decltype(displays.backCommandDebugMenu)>() { return displays.backCommandDebugMenu; }
|
template<> decltype(displays.backCommandDebugMenu) &getRefByType<decltype(displays.backCommandDebugMenu)>() { return displays.backCommandDebugMenu; }
|
||||||
|
#endif
|
||||||
template<> decltype(displays.debugMenu) &getRefByType<decltype(displays.debugMenu)>() { return displays.debugMenu; }
|
template<> decltype(displays.debugMenu) &getRefByType<decltype(displays.debugMenu)>() { return displays.debugMenu; }
|
||||||
template<> decltype(displays.defaultModeSettingsMenu) &getRefByType<decltype(displays.defaultModeSettingsMenu)>() { return displays.defaultModeSettingsMenu; }
|
template<> decltype(displays.defaultModeSettingsMenu) &getRefByType<decltype(displays.defaultModeSettingsMenu)>() { return displays.defaultModeSettingsMenu; }
|
||||||
template<> decltype(displays.demosMenu) &getRefByType<decltype(displays.demosMenu)>() { return displays.demosMenu; }
|
template<> decltype(displays.demosMenu) &getRefByType<decltype(displays.demosMenu)>() { return displays.demosMenu; }
|
||||||
template<> decltype(displays.dynamicDebugMenu) &getRefByType<decltype(displays.dynamicDebugMenu)>() { return displays.dynamicDebugMenu; }
|
template<> decltype(displays.dynamicDebugMenu) &getRefByType<decltype(displays.dynamicDebugMenu)>() { return displays.dynamicDebugMenu; }
|
||||||
template<> decltype(displays.enableMenu) &getRefByType<decltype(displays.enableMenu)>() { return displays.enableMenu; }
|
template<> decltype(displays.enableMenu) &getRefByType<decltype(displays.enableMenu)>() { return displays.enableMenu; }
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
template<> decltype(displays.frontFeedbackDebugMenu) &getRefByType<decltype(displays.frontFeedbackDebugMenu)>() { return displays.frontFeedbackDebugMenu; }
|
template<> decltype(displays.frontFeedbackDebugMenu) &getRefByType<decltype(displays.frontFeedbackDebugMenu)>() { return displays.frontFeedbackDebugMenu; }
|
||||||
template<> decltype(displays.backFeedbackDebugMenu) &getRefByType<decltype(displays.backFeedbackDebugMenu)>() { return displays.backFeedbackDebugMenu; }
|
template<> decltype(displays.backFeedbackDebugMenu) &getRefByType<decltype(displays.backFeedbackDebugMenu)>() { return displays.backFeedbackDebugMenu; }
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef FEATURE_GAMETRAK
|
#ifdef FEATURE_GAMETRAK
|
||||||
template<> decltype(displays.gametrakModeSettingsMenu) &getRefByType<decltype(displays.gametrakModeSettingsMenu)>() { return displays.gametrakModeSettingsMenu; }
|
template<> decltype(displays.gametrakModeSettingsMenu) &getRefByType<decltype(displays.gametrakModeSettingsMenu)>() { return displays.gametrakModeSettingsMenu; }
|
||||||
#endif
|
#endif
|
||||||
template<> decltype(displays.genericWifiSettingsMenu) &getRefByType<decltype(displays.genericWifiSettingsMenu)>() { return displays.genericWifiSettingsMenu; }
|
template<> decltype(displays.genericWifiSettingsMenu) &getRefByType<decltype(displays.genericWifiSettingsMenu)>() { return displays.genericWifiSettingsMenu; }
|
||||||
template<> decltype(displays.graphsMenu) &getRefByType<decltype(displays.graphsMenu)>() { return displays.graphsMenu; }
|
template<> decltype(displays.graphsMenu) &getRefByType<decltype(displays.graphsMenu)>() { return displays.graphsMenu; }
|
||||||
template<> decltype(displays.invertMenu) &getRefByType<decltype(displays.invertMenu)>() { return displays.invertMenu; }
|
template<> decltype(displays.invertMenu) &getRefByType<decltype(displays.invertMenu)>() { return displays.invertMenu; }
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
template<> decltype(displays.larsmModeSettingsMenu) &getRefByType<decltype(displays.larsmModeSettingsMenu)>() { return displays.larsmModeSettingsMenu; }
|
template<> decltype(displays.larsmModeSettingsMenu) &getRefByType<decltype(displays.larsmModeSettingsMenu)>() { return displays.larsmModeSettingsMenu; }
|
||||||
|
#endif
|
||||||
template<> decltype(displays.limitsSettingsMenu) &getRefByType<decltype(displays.limitsSettingsMenu)>() { return displays.limitsSettingsMenu; }
|
template<> decltype(displays.limitsSettingsMenu) &getRefByType<decltype(displays.limitsSettingsMenu)>() { return displays.limitsSettingsMenu; }
|
||||||
template<> decltype(displays.mainMenu) &getRefByType<decltype(displays.mainMenu)>() { return displays.mainMenu; }
|
template<> decltype(displays.mainMenu) &getRefByType<decltype(displays.mainMenu)>() { return displays.mainMenu; }
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
template<> decltype(displays.tempomatModeSettingsMenu) &getRefByType<decltype(displays.tempomatModeSettingsMenu)>() { return displays.tempomatModeSettingsMenu; }
|
template<> decltype(displays.tempomatModeSettingsMenu) &getRefByType<decltype(displays.tempomatModeSettingsMenu)>() { return displays.tempomatModeSettingsMenu; }
|
||||||
template<> decltype(displays.modesSettingsMenu) &getRefByType<decltype(displays.modesSettingsMenu)>() { return displays.modesSettingsMenu; }
|
template<> decltype(displays.modesSettingsMenu) &getRefByType<decltype(displays.modesSettingsMenu)>() { return displays.modesSettingsMenu; }
|
||||||
#ifdef FEATURE_MOSFETS
|
#ifdef FEATURE_MOSFETS
|
||||||
@@ -236,8 +272,11 @@ template<> decltype(displays.frontLeftMotorFeedbackDebugMenu) &
|
|||||||
template<> decltype(displays.frontRightMotorFeedbackDebugMenu) &getRefByType<decltype(displays.frontRightMotorFeedbackDebugMenu)>() { return displays.frontRightMotorFeedbackDebugMenu; }
|
template<> decltype(displays.frontRightMotorFeedbackDebugMenu) &getRefByType<decltype(displays.frontRightMotorFeedbackDebugMenu)>() { return displays.frontRightMotorFeedbackDebugMenu; }
|
||||||
template<> decltype(displays.backLeftMotorFeedbackDebugMenu) &getRefByType<decltype(displays.backLeftMotorFeedbackDebugMenu)>() { return displays.backLeftMotorFeedbackDebugMenu; }
|
template<> decltype(displays.backLeftMotorFeedbackDebugMenu) &getRefByType<decltype(displays.backLeftMotorFeedbackDebugMenu)>() { return displays.backLeftMotorFeedbackDebugMenu; }
|
||||||
template<> decltype(displays.backRightMotorFeedbackDebugMenu) &getRefByType<decltype(displays.backRightMotorFeedbackDebugMenu)>() { return displays.backRightMotorFeedbackDebugMenu; }
|
template<> decltype(displays.backRightMotorFeedbackDebugMenu) &getRefByType<decltype(displays.backRightMotorFeedbackDebugMenu)>() { return displays.backRightMotorFeedbackDebugMenu; }
|
||||||
|
#endif
|
||||||
template<> decltype(displays.presetsMenu) &getRefByType<decltype(displays.presetsMenu)>() { return displays.presetsMenu; }
|
template<> decltype(displays.presetsMenu) &getRefByType<decltype(displays.presetsMenu)>() { return displays.presetsMenu; }
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
template<> decltype(displays.selectModeMenu) &getRefByType<decltype(displays.selectModeMenu)>() { return displays.selectModeMenu; }
|
template<> decltype(displays.selectModeMenu) &getRefByType<decltype(displays.selectModeMenu)>() { return displays.selectModeMenu; }
|
||||||
|
#endif
|
||||||
template<> decltype(displays.settingsMenu) &getRefByType<decltype(displays.settingsMenu)>() { return displays.settingsMenu; }
|
template<> decltype(displays.settingsMenu) &getRefByType<decltype(displays.settingsMenu)>() { return displays.settingsMenu; }
|
||||||
template<> decltype(displays.stationWifiSettingsMenu) &getRefByType<decltype(displays.stationWifiSettingsMenu)>() { return displays.stationWifiSettingsMenu; }
|
template<> decltype(displays.stationWifiSettingsMenu) &getRefByType<decltype(displays.stationWifiSettingsMenu)>() { return displays.stationWifiSettingsMenu; }
|
||||||
template<> decltype(displays.wifiScanMenu) &getRefByType<decltype(displays.wifiScanMenu)>() { return displays.wifiScanMenu; }
|
template<> decltype(displays.wifiScanMenu) &getRefByType<decltype(displays.wifiScanMenu)>() { return displays.wifiScanMenu; }
|
||||||
@@ -255,7 +294,9 @@ template<> decltype(displays.gametrakCalibrateDisplay) &
|
|||||||
template<> decltype(displays.lockScreen) &getRefByType<decltype(displays.lockScreen)>() { return displays.lockScreen; }
|
template<> decltype(displays.lockScreen) &getRefByType<decltype(displays.lockScreen)>() { return displays.lockScreen; }
|
||||||
template<> decltype(displays.metersDisplay) &getRefByType<decltype(displays.metersDisplay)>() { return displays.metersDisplay; }
|
template<> decltype(displays.metersDisplay) &getRefByType<decltype(displays.metersDisplay)>() { return displays.metersDisplay; }
|
||||||
template<> decltype(displays.pingPongDisplay) &getRefByType<decltype(displays.pingPongDisplay)>() { return displays.pingPongDisplay; }
|
template<> decltype(displays.pingPongDisplay) &getRefByType<decltype(displays.pingPongDisplay)>() { return displays.pingPongDisplay; }
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
template<> decltype(displays.poweroffDisplay) &getRefByType<decltype(displays.poweroffDisplay)>() { return displays.poweroffDisplay; }
|
template<> decltype(displays.poweroffDisplay) &getRefByType<decltype(displays.poweroffDisplay)>() { return displays.poweroffDisplay; }
|
||||||
|
#endif
|
||||||
template<> decltype(displays.spiroDisplay) &getRefByType<decltype(displays.spiroDisplay)>() { return displays.spiroDisplay; }
|
template<> decltype(displays.spiroDisplay) &getRefByType<decltype(displays.spiroDisplay)>() { return displays.spiroDisplay; }
|
||||||
template<> decltype(displays.starFieldDisplay) &getRefByType<decltype(displays.starFieldDisplay)>() { return displays.starFieldDisplay; }
|
template<> decltype(displays.starFieldDisplay) &getRefByType<decltype(displays.starFieldDisplay)>() { return displays.starFieldDisplay; }
|
||||||
template<> decltype(displays.statusDisplay) &getRefByType<decltype(displays.statusDisplay)>() { return displays.statusDisplay; }
|
template<> decltype(displays.statusDisplay) &getRefByType<decltype(displays.statusDisplay)>() { return displays.statusDisplay; }
|
||||||
@@ -265,6 +306,7 @@ template<> decltype(displays.updateDisplay) &
|
|||||||
|
|
||||||
template<> decltype(displays.bluetoothModeChangeDisplay) &getRefByType<decltype(displays.bluetoothModeChangeDisplay)>() { return displays.bluetoothModeChangeDisplay; }
|
template<> decltype(displays.bluetoothModeChangeDisplay) &getRefByType<decltype(displays.bluetoothModeChangeDisplay)>() { return displays.bluetoothModeChangeDisplay; }
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
template<> decltype(displays.changeFrontFreq) &getRefByType<decltype(displays.changeFrontFreq)>() { return displays.changeFrontFreq; }
|
template<> decltype(displays.changeFrontFreq) &getRefByType<decltype(displays.changeFrontFreq)>() { return displays.changeFrontFreq; }
|
||||||
template<> decltype(displays.changeFrontPattern) &getRefByType<decltype(displays.changeFrontPattern)>() { return displays.changeFrontPattern; }
|
template<> decltype(displays.changeFrontPattern) &getRefByType<decltype(displays.changeFrontPattern)>() { return displays.changeFrontPattern; }
|
||||||
template<> decltype(displays.changeBackFreq) &getRefByType<decltype(displays.changeBackFreq)>() { return displays.changeBackFreq; }
|
template<> decltype(displays.changeBackFreq) &getRefByType<decltype(displays.changeBackFreq)>() { return displays.changeBackFreq; }
|
||||||
@@ -273,6 +315,7 @@ template<> decltype(displays.changeReverseBeepFreq0) &
|
|||||||
template<> decltype(displays.changeReverseBeepFreq1) &getRefByType<decltype(displays.changeReverseBeepFreq1)>() { return displays.changeReverseBeepFreq1; }
|
template<> decltype(displays.changeReverseBeepFreq1) &getRefByType<decltype(displays.changeReverseBeepFreq1)>() { return displays.changeReverseBeepFreq1; }
|
||||||
template<> decltype(displays.changeReverseBeepDuration0) &getRefByType<decltype(displays.changeReverseBeepDuration0)>() { return displays.changeReverseBeepDuration0; }
|
template<> decltype(displays.changeReverseBeepDuration0) &getRefByType<decltype(displays.changeReverseBeepDuration0)>() { return displays.changeReverseBeepDuration0; }
|
||||||
template<> decltype(displays.changeReverseBeepDuration1) &getRefByType<decltype(displays.changeReverseBeepDuration1)>() { return displays.changeReverseBeepDuration1; }
|
template<> decltype(displays.changeReverseBeepDuration1) &getRefByType<decltype(displays.changeReverseBeepDuration1)>() { return displays.changeReverseBeepDuration1; }
|
||||||
|
#endif
|
||||||
|
|
||||||
template<> decltype(displays.changeIMotMax) &getRefByType<decltype(displays.changeIMotMax)>() { return displays.changeIMotMax; }
|
template<> decltype(displays.changeIMotMax) &getRefByType<decltype(displays.changeIMotMax)>() { return displays.changeIMotMax; }
|
||||||
template<> decltype(displays.changeIDcMax) &getRefByType<decltype(displays.changeIDcMax)>() { return displays.changeIDcMax; }
|
template<> decltype(displays.changeIDcMax) &getRefByType<decltype(displays.changeIDcMax)>() { return displays.changeIDcMax; }
|
||||||
@@ -285,6 +328,7 @@ template<> decltype(displays.wheelDiameterMmChangeScreen) &
|
|||||||
template<> decltype(displays.wheelDiameterInchChangeScreen) &getRefByType<decltype(displays.wheelDiameterInchChangeScreen)>() { return displays.wheelDiameterInchChangeScreen; }
|
template<> decltype(displays.wheelDiameterInchChangeScreen) &getRefByType<decltype(displays.wheelDiameterInchChangeScreen)>() { return displays.wheelDiameterInchChangeScreen; }
|
||||||
template<> decltype(displays.numMagnetPolesChangeScreen) &getRefByType<decltype(displays.numMagnetPolesChangeScreen)>() { return displays.numMagnetPolesChangeScreen; }
|
template<> decltype(displays.numMagnetPolesChangeScreen) &getRefByType<decltype(displays.numMagnetPolesChangeScreen)>() { return displays.numMagnetPolesChangeScreen; }
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
template<> decltype(displays.changeDefaultModeCtrlTyp) &getRefByType<decltype(displays.changeDefaultModeCtrlTyp)>() { return displays.changeDefaultModeCtrlTyp; }
|
template<> decltype(displays.changeDefaultModeCtrlTyp) &getRefByType<decltype(displays.changeDefaultModeCtrlTyp)>() { return displays.changeDefaultModeCtrlTyp; }
|
||||||
template<> decltype(displays.changeDefaultModeCtrlMod) &getRefByType<decltype(displays.changeDefaultModeCtrlMod)>() { return displays.changeDefaultModeCtrlMod; }
|
template<> decltype(displays.changeDefaultModeCtrlMod) &getRefByType<decltype(displays.changeDefaultModeCtrlMod)>() { return displays.changeDefaultModeCtrlMod; }
|
||||||
template<> decltype(displays.changeDefaultModeSmoothing) &getRefByType<decltype(displays.changeDefaultModeSmoothing)>() { return displays.changeDefaultModeSmoothing; }
|
template<> decltype(displays.changeDefaultModeSmoothing) &getRefByType<decltype(displays.changeDefaultModeSmoothing)>() { return displays.changeDefaultModeSmoothing; }
|
||||||
@@ -301,7 +345,7 @@ template<> decltype(displays.changeManualModeCtrlMod) &
|
|||||||
|
|
||||||
template<> decltype(displays.larsmModeModeChangeDisplay) &getRefByType<decltype(displays.larsmModeModeChangeDisplay)>() { return displays.larsmModeModeChangeDisplay; }
|
template<> decltype(displays.larsmModeModeChangeDisplay) &getRefByType<decltype(displays.larsmModeModeChangeDisplay)>() { return displays.larsmModeModeChangeDisplay; }
|
||||||
template<> decltype(displays.larsmModeIterationsChangeDisplay) &getRefByType<decltype(displays.larsmModeIterationsChangeDisplay)>() { return displays.larsmModeIterationsChangeDisplay; }
|
template<> decltype(displays.larsmModeIterationsChangeDisplay) &getRefByType<decltype(displays.larsmModeIterationsChangeDisplay)>() { return displays.larsmModeIterationsChangeDisplay; }
|
||||||
|
#endif
|
||||||
template<> decltype(displays.sampleCountChangeScreen) &getRefByType<decltype(displays.sampleCountChangeScreen)>() { return displays.sampleCountChangeScreen; }
|
template<> decltype(displays.sampleCountChangeScreen) &getRefByType<decltype(displays.sampleCountChangeScreen)>() { return displays.sampleCountChangeScreen; }
|
||||||
template<> decltype(displays.changeGasMin) &getRefByType<decltype(displays.changeGasMin)>() { return displays.changeGasMin; }
|
template<> decltype(displays.changeGasMin) &getRefByType<decltype(displays.changeGasMin)>() { return displays.changeGasMin; }
|
||||||
template<> decltype(displays.changeGasMax) &getRefByType<decltype(displays.changeGasMax)>() { return displays.changeGasMax; }
|
template<> decltype(displays.changeGasMax) &getRefByType<decltype(displays.changeGasMax)>() { return displays.changeGasMax; }
|
||||||
@@ -325,15 +369,19 @@ template<> decltype(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.sumAbsoluteCurrentGraphDisplay) &getRefByType<decltype(displays.sumAbsoluteCurrentGraphDisplay)>() { return displays.sumAbsoluteCurrentGraphDisplay; }
|
template<> decltype(displays.sumAbsoluteCurrentGraphDisplay) &getRefByType<decltype(displays.sumAbsoluteCurrentGraphDisplay)>() { return displays.sumAbsoluteCurrentGraphDisplay; }
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
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; }
|
||||||
|
#endif
|
||||||
#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; }
|
||||||
template<> decltype(displays.bmsPowerGraphDisplay) &getRefByType<decltype(displays.bmsPowerGraphDisplay)>() { return displays.bmsPowerGraphDisplay; }
|
template<> decltype(displays.bmsPowerGraphDisplay) &getRefByType<decltype(displays.bmsPowerGraphDisplay)>() { return displays.bmsPowerGraphDisplay; }
|
||||||
template<> decltype(displays.sumCurrentsComparisonGraphDisplay) &getRefByType<decltype(displays.sumCurrentsComparisonGraphDisplay)>() { return displays.sumCurrentsComparisonGraphDisplay; }
|
template<> decltype(displays.sumCurrentsComparisonGraphDisplay) &getRefByType<decltype(displays.sumCurrentsComparisonGraphDisplay)>() { return displays.sumCurrentsComparisonGraphDisplay; }
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
template<> decltype(displays.motorCurrentsGraphDisplay) &getRefByType<decltype(displays.motorCurrentsGraphDisplay)>() { return displays.motorCurrentsGraphDisplay; }
|
template<> decltype(displays.motorCurrentsGraphDisplay) &getRefByType<decltype(displays.motorCurrentsGraphDisplay)>() { return displays.motorCurrentsGraphDisplay; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void deconstructScreen()
|
void deconstructScreen()
|
||||||
|
@@ -39,6 +39,7 @@ void handleSerial()
|
|||||||
case 'I':
|
case 'I':
|
||||||
tft.init();
|
tft.init();
|
||||||
break;
|
break;
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
case 'p':
|
case 'p':
|
||||||
case 'P':
|
case 'P':
|
||||||
{
|
{
|
||||||
@@ -55,6 +56,7 @@ void handleSerial()
|
|||||||
controller.command.led = !firstLed;
|
controller.command.led = !firstLed;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
case 'r':
|
case 'r':
|
||||||
case 'R':
|
case 'R':
|
||||||
loadSettings();
|
loadSettings();
|
||||||
@@ -63,6 +65,7 @@ void handleSerial()
|
|||||||
case 'S':
|
case 'S':
|
||||||
saveSettings();
|
saveSettings();
|
||||||
break;
|
break;
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
case '0':
|
case '0':
|
||||||
case '1':
|
case '1':
|
||||||
case '2':
|
case '2':
|
||||||
@@ -76,6 +79,7 @@ void handleSerial()
|
|||||||
for (Controller &controller : controllers())
|
for (Controller &controller : controllers())
|
||||||
controller.command.buzzer.freq = c-'0';
|
controller.command.buzzer.freq = c-'0';
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case 'A':
|
case 'A':
|
||||||
InputDispatcher::rotate(-1);
|
InputDispatcher::rotate(-1);
|
||||||
break;
|
break;
|
||||||
|
@@ -7,7 +7,9 @@
|
|||||||
#include "bluetoothmode.h"
|
#include "bluetoothmode.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
enum class LarsmModeMode : uint8_t { Mode1, Mode2, Mode3, Mode4 };
|
enum class LarsmModeMode : uint8_t { Mode1, Mode2, Mode3, Mode4 };
|
||||||
|
#endif
|
||||||
|
|
||||||
struct Settings
|
struct Settings
|
||||||
{
|
{
|
||||||
@@ -32,12 +34,19 @@ struct Settings
|
|||||||
} limits;
|
} limits;
|
||||||
|
|
||||||
struct ControllerHardware {
|
struct ControllerHardware {
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
bool enableFrontLeft, enableFrontRight, enableBackLeft, enableBackRight;
|
bool enableFrontLeft, enableFrontRight, enableBackLeft, enableBackRight;
|
||||||
bool invertFrontLeft, invertFrontRight, invertBackLeft, invertBackRight;
|
bool invertFrontLeft, invertFrontRight, invertBackLeft, invertBackRight;
|
||||||
|
bool swapFrontBack;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
bool enableOne, enableTwo;
|
||||||
|
bool invertOne, invertTwo;
|
||||||
|
#endif
|
||||||
|
|
||||||
int16_t wheelDiameter; // in mm
|
int16_t wheelDiameter; // in mm
|
||||||
int16_t numMagnetPoles; // virtual RPM per one real RPM
|
int16_t numMagnetPoles; // virtual RPM per one real RPM
|
||||||
bool swapFrontBack;
|
|
||||||
} controllerHardware;
|
} controllerHardware;
|
||||||
|
|
||||||
struct BoardcomputerHardware {
|
struct BoardcomputerHardware {
|
||||||
@@ -50,8 +59,10 @@ struct Settings
|
|||||||
} boardcomputerHardware;
|
} boardcomputerHardware;
|
||||||
|
|
||||||
struct DefaultMode {
|
struct DefaultMode {
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
ControlType ctrlTyp;
|
ControlType ctrlTyp;
|
||||||
ControlMode ctrlMod;
|
ControlMode ctrlMod;
|
||||||
|
#endif
|
||||||
bool enableSmoothing;
|
bool enableSmoothing;
|
||||||
int16_t smoothing;
|
int16_t smoothing;
|
||||||
int16_t frontPercentage;
|
int16_t frontPercentage;
|
||||||
@@ -64,15 +75,18 @@ struct Settings
|
|||||||
} defaultMode;
|
} defaultMode;
|
||||||
|
|
||||||
struct TempomatMode {
|
struct TempomatMode {
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
ControlType ctrlTyp;
|
ControlType ctrlTyp;
|
||||||
ControlMode ctrlMod;
|
ControlMode ctrlMod;
|
||||||
|
#endif
|
||||||
} tempomatMode;
|
} tempomatMode;
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
struct LarsmMode {
|
struct LarsmMode {
|
||||||
LarsmModeMode mode;
|
LarsmModeMode mode;
|
||||||
uint8_t iterations;
|
uint8_t iterations;
|
||||||
} larsmMode;
|
} larsmMode;
|
||||||
|
#endif
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void executeForEverySetting(T &&callable);
|
void executeForEverySetting(T &&callable);
|
||||||
@@ -99,6 +113,7 @@ void Settings::executeForEverySetting(T &&callable)
|
|||||||
callable("fieldWeakMax", limits.fieldWeakMax);
|
callable("fieldWeakMax", limits.fieldWeakMax);
|
||||||
callable("phaseAdvMax", limits.phaseAdvMax);
|
callable("phaseAdvMax", limits.phaseAdvMax);
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
callable("enableFrontLeft", controllerHardware.enableFrontLeft);
|
callable("enableFrontLeft", controllerHardware.enableFrontLeft);
|
||||||
callable("enableFrontRigh", controllerHardware.enableFrontRight);
|
callable("enableFrontRigh", controllerHardware.enableFrontRight);
|
||||||
callable("enableBackLeft", controllerHardware.enableBackLeft);
|
callable("enableBackLeft", controllerHardware.enableBackLeft);
|
||||||
@@ -110,6 +125,12 @@ void Settings::executeForEverySetting(T &&callable)
|
|||||||
callable("invertBackRight", controllerHardware.invertBackRight);
|
callable("invertBackRight", controllerHardware.invertBackRight);
|
||||||
|
|
||||||
callable("swapFrontBack", controllerHardware.swapFrontBack);
|
callable("swapFrontBack", controllerHardware.swapFrontBack);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
callable("enableOne", controllerHardware.enableOne);
|
||||||
|
callable("enableTwo", controllerHardware.enableTwo);
|
||||||
|
#endif
|
||||||
|
|
||||||
callable("sampleCount", boardcomputerHardware.sampleCount);
|
callable("sampleCount", boardcomputerHardware.sampleCount);
|
||||||
callable("gasMin", boardcomputerHardware.gasMin);
|
callable("gasMin", boardcomputerHardware.gasMin);
|
||||||
@@ -126,6 +147,7 @@ void Settings::executeForEverySetting(T &&callable)
|
|||||||
#endif
|
#endif
|
||||||
callable("swapScreenBytes", boardcomputerHardware.swapScreenBytes);
|
callable("swapScreenBytes", boardcomputerHardware.swapScreenBytes);
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
callable("default.ctrlTyp", defaultMode.ctrlTyp);
|
callable("default.ctrlTyp", defaultMode.ctrlTyp);
|
||||||
callable("default.ctrlMod", defaultMode.ctrlMod);
|
callable("default.ctrlMod", defaultMode.ctrlMod);
|
||||||
callable("default.enableS", defaultMode.enableSmoothing);
|
callable("default.enableS", defaultMode.enableSmoothing);
|
||||||
@@ -143,5 +165,6 @@ void Settings::executeForEverySetting(T &&callable)
|
|||||||
|
|
||||||
callable("larsm.mode", larsmMode.mode);
|
callable("larsm.mode", larsmMode.mode);
|
||||||
callable("larsm.iters", larsmMode.iterations);
|
callable("larsm.iters", larsmMode.iterations);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -33,6 +33,7 @@ struct NMotMaxRpmAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &g
|
|||||||
struct FieldWeakMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.fieldWeakMax; } };
|
struct FieldWeakMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.fieldWeakMax; } };
|
||||||
struct PhaseAdvMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.phaseAdvMax; } };
|
struct PhaseAdvMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.phaseAdvMax; } };
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
struct FrontLeftEnabledAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.enableFrontLeft; } };
|
struct FrontLeftEnabledAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.enableFrontLeft; } };
|
||||||
struct FrontRightEnabledAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.enableFrontRight; } };
|
struct FrontRightEnabledAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.enableFrontRight; } };
|
||||||
struct BackLeftEnabledAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.enableBackLeft; } };
|
struct BackLeftEnabledAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.enableBackLeft; } };
|
||||||
@@ -42,6 +43,14 @@ struct FrontLeftInvertedAccessor : public RefAccessorSaveSettings<bool> { bool &
|
|||||||
struct FrontRightInvertedAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.invertFrontRight; } };
|
struct FrontRightInvertedAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.invertFrontRight; } };
|
||||||
struct BackLeftInvertedAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.invertBackLeft; } };
|
struct BackLeftInvertedAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.invertBackLeft; } };
|
||||||
struct BackRightInvertedAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.invertBackRight; } };
|
struct BackRightInvertedAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.invertBackRight; } };
|
||||||
|
#endif
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
struct OneEnabledAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.enableOne; } };
|
||||||
|
struct TwoEnabledAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.enableTwo; } };
|
||||||
|
|
||||||
|
struct OneInvertedAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.invertOne; } };
|
||||||
|
struct TwoInvertedAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.controllerHardware.invertTwo; } };
|
||||||
|
#endif
|
||||||
|
|
||||||
struct WheelDiameterMmAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.controllerHardware.wheelDiameter; } };
|
struct WheelDiameterMmAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.controllerHardware.wheelDiameter; } };
|
||||||
struct WheelDiameterInchAccessor : public virtual AccessorInterface<float>
|
struct WheelDiameterInchAccessor : public virtual AccessorInterface<float>
|
||||||
@@ -50,10 +59,13 @@ struct WheelDiameterInchAccessor : public virtual AccessorInterface<float>
|
|||||||
void setValue(float value) override { settings.controllerHardware.wheelDiameter = convertFromInch(value); saveSettings(); }
|
void setValue(float value) override { settings.controllerHardware.wheelDiameter = convertFromInch(value); saveSettings(); }
|
||||||
};
|
};
|
||||||
struct NumMagnetPolesAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.controllerHardware.numMagnetPoles; } };
|
struct NumMagnetPolesAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.controllerHardware.numMagnetPoles; } };
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
struct SwapFrontBackAccessor : public RefAccessorSaveSettings<bool> {
|
struct SwapFrontBackAccessor : public RefAccessorSaveSettings<bool> {
|
||||||
bool &getRef() const override { return settings.controllerHardware.swapFrontBack; }
|
bool &getRef() const override { return settings.controllerHardware.swapFrontBack; }
|
||||||
void setValue(bool value) override { RefAccessorSaveSettings<bool>::setValue(value); updateSwapFrontBack(); };
|
void setValue(bool value) override { RefAccessorSaveSettings<bool>::setValue(value); updateSwapFrontBack(); };
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
struct SampleCountAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.sampleCount; } };
|
struct SampleCountAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.sampleCount; } };
|
||||||
struct GasMinAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.gasMin; } };
|
struct GasMinAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.gasMin; } };
|
||||||
@@ -70,8 +82,10 @@ struct GametrakDistMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16
|
|||||||
#endif
|
#endif
|
||||||
struct SwapScreenBytesAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.boardcomputerHardware.swapScreenBytes; } };
|
struct SwapScreenBytesAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.boardcomputerHardware.swapScreenBytes; } };
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
struct DefaultModeCtrlTypAccessor : public RefAccessorSaveSettings<ControlType> { ControlType &getRef() const override { return settings.defaultMode.ctrlTyp; } };
|
struct DefaultModeCtrlTypAccessor : public RefAccessorSaveSettings<ControlType> { ControlType &getRef() const override { return settings.defaultMode.ctrlTyp; } };
|
||||||
struct DefaultModeCtrlModAccessor : public RefAccessorSaveSettings<ControlMode> { ControlMode &getRef() const override { return settings.defaultMode.ctrlMod; } };
|
struct DefaultModeCtrlModAccessor : public RefAccessorSaveSettings<ControlMode> { ControlMode &getRef() const override { return settings.defaultMode.ctrlMod; } };
|
||||||
|
#endif
|
||||||
struct DefaultModeEnableSmoothingAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.defaultMode.enableSmoothing; } };
|
struct DefaultModeEnableSmoothingAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.defaultMode.enableSmoothing; } };
|
||||||
struct DefaultModeSmoothingAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.defaultMode.smoothing; } };
|
struct DefaultModeSmoothingAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.defaultMode.smoothing; } };
|
||||||
struct DefaultModeFrontPercentageAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.defaultMode.frontPercentage; } };
|
struct DefaultModeFrontPercentageAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.defaultMode.frontPercentage; } };
|
||||||
@@ -82,9 +96,11 @@ struct DefaultModeGas2WertAccessor : public RefAccessorSaveSettings<int16_t> { i
|
|||||||
struct DefaultModeBrems1WertAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.defaultMode.brems1_wert; } };
|
struct DefaultModeBrems1WertAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.defaultMode.brems1_wert; } };
|
||||||
struct DefaultModeBrems2WertAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.defaultMode.brems2_wert; } };
|
struct DefaultModeBrems2WertAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.defaultMode.brems2_wert; } };
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
struct TempomatModeCtrlTypAccessor : public RefAccessorSaveSettings<ControlType> { ControlType &getRef() const override { return settings.tempomatMode.ctrlTyp; } };
|
struct TempomatModeCtrlTypAccessor : public RefAccessorSaveSettings<ControlType> { ControlType &getRef() const override { return settings.tempomatMode.ctrlTyp; } };
|
||||||
struct TempomatModeCtrlModAccessor : public RefAccessorSaveSettings<ControlMode> { ControlMode &getRef() const override { return settings.tempomatMode.ctrlMod; } };
|
struct TempomatModeCtrlModAccessor : public RefAccessorSaveSettings<ControlMode> { ControlMode &getRef() const override { return settings.tempomatMode.ctrlMod; } };
|
||||||
|
|
||||||
struct LarsmModeModeAccessor : public RefAccessorSaveSettings<LarsmModeMode> { LarsmModeMode &getRef() const override { return settings.larsmMode.mode; } };
|
struct LarsmModeModeAccessor : public RefAccessorSaveSettings<LarsmModeMode> { LarsmModeMode &getRef() const override { return settings.larsmMode.mode; } };
|
||||||
struct LarsmModeIterationsAccessor : public RefAccessorSaveSettings<uint8_t> { uint8_t &getRef() const override { return settings.larsmMode.iterations; } };
|
struct LarsmModeIterationsAccessor : public RefAccessorSaveSettings<uint8_t> { uint8_t &getRef() const override { return settings.larsmMode.iterations; } };
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -68,6 +68,7 @@ template<> struct nvsGetterHelper<bool> { static esp_err_t nvs_get(nvs_handle ha
|
|||||||
*out_value = tempValue;
|
*out_value = tempValue;
|
||||||
return err;
|
return err;
|
||||||
}};
|
}};
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
template<> struct nvsGetterHelper<ControlType> { static esp_err_t nvs_get(nvs_handle handle, const char* key, ControlType* out_value)
|
template<> struct nvsGetterHelper<ControlType> { static esp_err_t nvs_get(nvs_handle handle, const char* key, ControlType* out_value)
|
||||||
{
|
{
|
||||||
uint8_t tempValue;
|
uint8_t tempValue;
|
||||||
@@ -92,6 +93,7 @@ template<> struct nvsGetterHelper<LarsmModeMode> { static esp_err_t nvs_get(nvs_
|
|||||||
*out_value = LarsmModeMode(tempValue);
|
*out_value = LarsmModeMode(tempValue);
|
||||||
return err;
|
return err;
|
||||||
}};
|
}};
|
||||||
|
#endif
|
||||||
template<> struct nvsGetterHelper<BluetoothMode> { static esp_err_t nvs_get(nvs_handle handle, const char* key, BluetoothMode* out_value)
|
template<> struct nvsGetterHelper<BluetoothMode> { static esp_err_t nvs_get(nvs_handle handle, const char* key, BluetoothMode* out_value)
|
||||||
{
|
{
|
||||||
uint8_t tempValue;
|
uint8_t tempValue;
|
||||||
@@ -126,6 +128,7 @@ template<> struct nvsSetterHelper<uint16_t> { static constexpr auto nvs_set = &n
|
|||||||
template<> struct nvsSetterHelper<int32_t> { static constexpr auto nvs_set = &nvs_set_i32; };
|
template<> struct nvsSetterHelper<int32_t> { static constexpr auto nvs_set = &nvs_set_i32; };
|
||||||
template<> struct nvsSetterHelper<uint32_t> { static constexpr auto nvs_set = &nvs_set_u32; };
|
template<> struct nvsSetterHelper<uint32_t> { static constexpr auto nvs_set = &nvs_set_u32; };
|
||||||
template<> struct nvsSetterHelper<bool> { static constexpr auto nvs_set = &nvs_set_u8; };
|
template<> struct nvsSetterHelper<bool> { static constexpr auto nvs_set = &nvs_set_u8; };
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
template<> struct nvsSetterHelper<ControlType> { static esp_err_t nvs_set(nvs_handle handle, const char* key, ControlType value)
|
template<> struct nvsSetterHelper<ControlType> { static esp_err_t nvs_set(nvs_handle handle, const char* key, ControlType value)
|
||||||
{
|
{
|
||||||
return nvs_set_u8(handle, key, uint8_t(value));
|
return nvs_set_u8(handle, key, uint8_t(value));
|
||||||
@@ -138,6 +141,7 @@ template<> struct nvsSetterHelper<LarsmModeMode> { static esp_err_t nvs_set(nvs_
|
|||||||
{
|
{
|
||||||
return nvs_set_u8(handle, key, uint8_t(value));
|
return nvs_set_u8(handle, key, uint8_t(value));
|
||||||
}};
|
}};
|
||||||
|
#endif
|
||||||
template<> struct nvsSetterHelper<BluetoothMode> { static esp_err_t nvs_set(nvs_handle handle, const char* key, BluetoothMode value)
|
template<> struct nvsSetterHelper<BluetoothMode> { static esp_err_t nvs_set(nvs_handle handle, const char* key, BluetoothMode value)
|
||||||
{
|
{
|
||||||
return nvs_set_u8(handle, key, uint8_t(value));
|
return nvs_set_u8(handle, key, uint8_t(value));
|
||||||
|
@@ -9,7 +9,11 @@
|
|||||||
namespace {
|
namespace {
|
||||||
namespace statistics {
|
namespace statistics {
|
||||||
using ContainerType = ring_buffer<float, 200>;
|
using ContainerType = ring_buffer<float, 200>;
|
||||||
ContainerType gas, brems, avgSpeed, avgSpeedKmh, sumCurrent, sumAbsoluteCurrent, frontVoltage, backVoltage, frontLeftCurrent, frontRightCurrent, backLeftCurrent, backRightCurrent
|
ContainerType gas, brems, avgSpeed, avgSpeedKmh, sumCurrent, sumAbsoluteCurrent
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
|
, frontVoltage, backVoltage, frontLeftCurrent, frontRightCurrent, backLeftCurrent, backRightCurrent
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
, bmsVoltage, bmsCurrent, bmsPower
|
, bmsVoltage, bmsCurrent, bmsPower
|
||||||
#endif
|
#endif
|
||||||
@@ -24,6 +28,7 @@ void pushStats()
|
|||||||
statistics::avgSpeedKmh.push_back(avgSpeedKmh);
|
statistics::avgSpeedKmh.push_back(avgSpeedKmh);
|
||||||
statistics::sumCurrent.push_back(sumCurrent);
|
statistics::sumCurrent.push_back(sumCurrent);
|
||||||
statistics::sumAbsoluteCurrent.push_back(sumAbsoluteCurrent);
|
statistics::sumAbsoluteCurrent.push_back(sumAbsoluteCurrent);
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
if (front.feedbackValid)
|
if (front.feedbackValid)
|
||||||
{
|
{
|
||||||
statistics::frontVoltage.push_back(fixBatVoltage(front.feedback.batVoltage));
|
statistics::frontVoltage.push_back(fixBatVoltage(front.feedback.batVoltage));
|
||||||
@@ -36,6 +41,7 @@ void pushStats()
|
|||||||
statistics::backLeftCurrent.push_back(fixCurrent(back.feedback.left.current));
|
statistics::backLeftCurrent.push_back(fixCurrent(back.feedback.left.current));
|
||||||
statistics::backRightCurrent.push_back(fixCurrent(back.feedback.right.current));
|
statistics::backRightCurrent.push_back(fixCurrent(back.feedback.right.current));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
statistics::bmsVoltage.push_back(bms::voltage);
|
statistics::bmsVoltage.push_back(bms::voltage);
|
||||||
statistics::bmsCurrent.push_back(bms::current);
|
statistics::bmsCurrent.push_back(bms::current);
|
||||||
@@ -62,15 +68,19 @@ using AvgSpeedStatistics = BufferAccessorImpl<statistics::avgSpeed>;
|
|||||||
using AvgSpeedKmhStatistics = BufferAccessorImpl<statistics::avgSpeedKmh>;
|
using AvgSpeedKmhStatistics = BufferAccessorImpl<statistics::avgSpeedKmh>;
|
||||||
using SumCurrentStatistics = BufferAccessorImpl<statistics::sumCurrent>;
|
using SumCurrentStatistics = BufferAccessorImpl<statistics::sumCurrent>;
|
||||||
using SumAbsoluteCurrentStatistics = BufferAccessorImpl<statistics::sumAbsoluteCurrent>;
|
using SumAbsoluteCurrentStatistics = BufferAccessorImpl<statistics::sumAbsoluteCurrent>;
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
using FrontVoltageStatistics = BufferAccessorImpl<statistics::frontVoltage>;
|
using FrontVoltageStatistics = BufferAccessorImpl<statistics::frontVoltage>;
|
||||||
using BackVoltageStatistics = BufferAccessorImpl<statistics::backVoltage>;
|
using BackVoltageStatistics = BufferAccessorImpl<statistics::backVoltage>;
|
||||||
|
#endif
|
||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
using BmsVoltageStatistics = BufferAccessorImpl<statistics::bmsVoltage>;
|
using BmsVoltageStatistics = BufferAccessorImpl<statistics::bmsVoltage>;
|
||||||
using BmsCurrentStatistics = BufferAccessorImpl<statistics::bmsCurrent>;
|
using BmsCurrentStatistics = BufferAccessorImpl<statistics::bmsCurrent>;
|
||||||
using BmsPowerStatistics = BufferAccessorImpl<statistics::bmsPower>;
|
using BmsPowerStatistics = BufferAccessorImpl<statistics::bmsPower>;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
using FrontLeftCurrentStatistics = BufferAccessorImpl<statistics::frontLeftCurrent>;
|
using FrontLeftCurrentStatistics = BufferAccessorImpl<statistics::frontLeftCurrent>;
|
||||||
using FrontRightCurrentStatistics = BufferAccessorImpl<statistics::frontRightCurrent>;
|
using FrontRightCurrentStatistics = BufferAccessorImpl<statistics::frontRightCurrent>;
|
||||||
using BackLeftCurrentStatistics = BufferAccessorImpl<statistics::backLeftCurrent>;
|
using BackLeftCurrentStatistics = BufferAccessorImpl<statistics::backLeftCurrent>;
|
||||||
using BackRightCurrentStatistics = BufferAccessorImpl<statistics::backRightCurrent>;
|
using BackRightCurrentStatistics = BufferAccessorImpl<statistics::backRightCurrent>;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
67
src/utils.h
67
src/utils.h
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include "VescUartControl-VESC6/VescUart.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
bool currentlyReverseBeeping;
|
bool currentlyReverseBeeping;
|
||||||
@@ -63,10 +64,12 @@ float fixBoardTemp(int16_t value)
|
|||||||
return value/10.;
|
return value/10.;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
String hallString(const MotorFeedback &motor)
|
String hallString(const MotorFeedback &motor)
|
||||||
{
|
{
|
||||||
return String{} + (motor.hallA ? '1' : '0') + (motor.hallB ? '1' : '0') + (motor.hallC ? '1' : '0');
|
return String{} + (motor.hallA ? '1' : '0') + (motor.hallB ? '1' : '0') + (motor.hallC ? '1' : '0');
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
String toString(T value)
|
String toString(T value)
|
||||||
@@ -80,6 +83,7 @@ String toString<bool>(bool value)
|
|||||||
return value ? "true" : "false";
|
return value ? "true" : "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
template<>
|
template<>
|
||||||
String toString<ControlType>(ControlType value)
|
String toString<ControlType>(ControlType value)
|
||||||
{
|
{
|
||||||
@@ -104,6 +108,7 @@ String toString<ControlMode>(ControlMode value)
|
|||||||
}
|
}
|
||||||
return String("Unknown: ") + int(value);
|
return String("Unknown: ") + int(value);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
String toString<wl_status_t>(wl_status_t value)
|
String toString<wl_status_t>(wl_status_t value)
|
||||||
@@ -138,6 +143,7 @@ String toString<ota_error_t>(ota_error_t value)
|
|||||||
return String("Unknown: ") + int(value);
|
return String("Unknown: ") + int(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
std::array<std::reference_wrapper<Controller>, 2> controllers()
|
std::array<std::reference_wrapper<Controller>, 2> controllers()
|
||||||
{
|
{
|
||||||
return {front, back};
|
return {front, back};
|
||||||
@@ -245,25 +251,44 @@ void sendCommands()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename... Args>
|
|
||||||
void switchScreen(Args&&... args);
|
|
||||||
|
|
||||||
void updateSwapFrontBack()
|
void updateSwapFrontBack()
|
||||||
{
|
{
|
||||||
front.serial = settings.controllerHardware.swapFrontBack ? Serial2 : Serial1;
|
front.serial = settings.controllerHardware.swapFrontBack ? Serial2 : Serial1;
|
||||||
back.serial = settings.controllerHardware.swapFrontBack ? Serial1 : Serial2;
|
back.serial = settings.controllerHardware.swapFrontBack ? Serial1 : Serial2;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void loadSettings()
|
#ifdef VESC_CONTROLLER
|
||||||
|
|
||||||
|
std::array<std::reference_wrapper<VescController>, 2> controllers()
|
||||||
{
|
{
|
||||||
settingsSaver.load(settings);
|
return {one, two};
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveSettings()
|
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max) {
|
||||||
{
|
float r = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||||
settingsSaver.save(settings);
|
if (r < out_min)r = out_min;
|
||||||
|
if (r > out_max)r = out_max;
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sendCommands()
|
||||||
|
{
|
||||||
|
for (VescController &controller : controllers())
|
||||||
|
{
|
||||||
|
SetSerialPort(&controller.serial.get());
|
||||||
|
SetDebugSerialPort(NULL);
|
||||||
|
|
||||||
|
float current = mapfloat(controller.pwm, -1000, 1000, -settings.limits.iMotMax, settings.limits.iMotMax);
|
||||||
|
|
||||||
|
Serial.println(String{"New current "} + current);
|
||||||
|
|
||||||
|
VescUartSetCurrent(current);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void updateAccumulators()
|
void updateAccumulators()
|
||||||
{
|
{
|
||||||
avgSpeed = 0.f;
|
avgSpeed = 0.f;
|
||||||
@@ -271,6 +296,7 @@ void updateAccumulators()
|
|||||||
sumAbsoluteCurrent = 0.f;
|
sumAbsoluteCurrent = 0.f;
|
||||||
uint8_t count{0};
|
uint8_t count{0};
|
||||||
|
|
||||||
|
#ifdef GLUMP_CONTROLLER
|
||||||
for (const Controller &controller : controllers())
|
for (const Controller &controller : controllers())
|
||||||
{
|
{
|
||||||
if (!controller.feedbackValid)
|
if (!controller.feedbackValid)
|
||||||
@@ -290,6 +316,17 @@ void updateAccumulators()
|
|||||||
|
|
||||||
count +=2;
|
count +=2;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VESC_CONTROLLER
|
||||||
|
for (VescController &controller : controllers()) {
|
||||||
|
avgSpeed += controller.values.rpm;
|
||||||
|
sumCurrent += controller.values.avgMotorCurrent;
|
||||||
|
sumAbsoluteCurrent += std::abs(controller.values.avgMotorCurrent);
|
||||||
|
|
||||||
|
count += 2;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (count)
|
if (count)
|
||||||
avgSpeed /= count;
|
avgSpeed /= count;
|
||||||
@@ -300,6 +337,20 @@ void updateAccumulators()
|
|||||||
avgSpeedKmh = convertToKmh(avgSpeed);
|
avgSpeedKmh = convertToKmh(avgSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename T, typename... Args>
|
||||||
|
void switchScreen(Args&&... args);
|
||||||
|
|
||||||
|
void loadSettings()
|
||||||
|
{
|
||||||
|
settingsSaver.load(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
void saveSettings()
|
||||||
|
{
|
||||||
|
settingsSaver.save(settings);
|
||||||
|
}
|
||||||
|
|
||||||
void readPotis()
|
void readPotis()
|
||||||
{
|
{
|
||||||
const auto sampleMultipleTimes = [](int pin){
|
const auto sampleMultipleTimes = [](int pin){
|
||||||
|
Reference in New Issue
Block a user