Added gametrak driving mode
This commit is contained in:
@@ -85,6 +85,7 @@ build_flags =
|
|||||||
-DDEFAULT_BREMSMIN=1300
|
-DDEFAULT_BREMSMIN=1300
|
||||||
-DDEFAULT_BREMSMAX=4000
|
-DDEFAULT_BREMSMAX=4000
|
||||||
-DFEATURE_BMS
|
-DFEATURE_BMS
|
||||||
|
-DFEATURE_GAMETRAK
|
||||||
|
|
||||||
[env:feedc0de_usb]
|
[env:feedc0de_usb]
|
||||||
platform = ${common_env_data.platform}
|
platform = ${common_env_data.platform}
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
#include "modes/defaultmode.h"
|
#include "modes/defaultmode.h"
|
||||||
#include "modes/tempomatmode.h"
|
#include "modes/tempomatmode.h"
|
||||||
#include "modes/larsmmode.h"
|
#include "modes/larsmmode.h"
|
||||||
|
#include "modes/gametrakmode.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class MainMenu;
|
class MainMenu;
|
||||||
@@ -27,6 +28,9 @@ public:
|
|||||||
using SetDefaultModeAction = SetterAction<ModeInterface*, currentMode, DefaultMode*, &modes::defaultMode>;
|
using SetDefaultModeAction = SetterAction<ModeInterface*, currentMode, DefaultMode*, &modes::defaultMode>;
|
||||||
using SetTempomatModeAction = SetterAction<ModeInterface*, currentMode, TempomatMode*, &modes::tempomatMode>;
|
using SetTempomatModeAction = SetterAction<ModeInterface*, currentMode, TempomatMode*, &modes::tempomatMode>;
|
||||||
using SetLarsmModeAction = SetterAction<ModeInterface*, currentMode, LarsmMode*, &modes::larsmMode>;
|
using SetLarsmModeAction = SetterAction<ModeInterface*, currentMode, LarsmMode*, &modes::larsmMode>;
|
||||||
|
#ifdef FEATURE_GAMETRAK
|
||||||
|
using SetGametrakModeAction = SetterAction<ModeInterface*, currentMode, GametrakMode*, &modes::gametrakMode>;
|
||||||
|
#endif
|
||||||
|
|
||||||
class SelectModeMenu :
|
class SelectModeMenu :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
@@ -36,6 +40,9 @@ class SelectModeMenu :
|
|||||||
makeComponent<MenuItem, StaticText<TEXT_DEFAULT>, MultiAction<SetDefaultModeAction, SwitchScreenAction<MainMenu>>>,
|
makeComponent<MenuItem, StaticText<TEXT_DEFAULT>, MultiAction<SetDefaultModeAction, SwitchScreenAction<MainMenu>>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_TEMPOMAT>, MultiAction<SetTempomatModeAction, SwitchScreenAction<MainMenu>>>,
|
makeComponent<MenuItem, StaticText<TEXT_TEMPOMAT>, MultiAction<SetTempomatModeAction, SwitchScreenAction<MainMenu>>>,
|
||||||
makeComponent<MenuItem, StaticText<TEXT_LARSM>, MultiAction<SetLarsmModeAction, SwitchScreenAction<MainMenu>>>,
|
makeComponent<MenuItem, StaticText<TEXT_LARSM>, MultiAction<SetLarsmModeAction, SwitchScreenAction<MainMenu>>>,
|
||||||
|
#ifdef FEATURE_GAMETRAK
|
||||||
|
makeComponent<MenuItem, StaticText<TEXT_GAMETRAK>, MultiAction<SetGametrakModeAction, SwitchScreenAction<MainMenu>>>,
|
||||||
|
#endif
|
||||||
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<MainMenu>, StaticMenuItemIcon<&icons::back>>
|
makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<MainMenu>, StaticMenuItemIcon<&icons::back>>
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
|
37
src/modes/gametrakmode.h
Normal file
37
src/modes/gametrakmode.h
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "modeinterface.h"
|
||||||
|
#include "globals.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include "bobbycar-protocol/protocol.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
#ifdef FEATURE_GAMETRAK
|
||||||
|
class GametrakMode : public ModeInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void update() override;
|
||||||
|
|
||||||
|
const char *displayName() const override { return "Gametrak"; }
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace modes {
|
||||||
|
GametrakMode gametrakMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GametrakMode::update()
|
||||||
|
{
|
||||||
|
for (MotorState &motor : motors())
|
||||||
|
{
|
||||||
|
motor.ctrlTyp = ControlType::FieldOrientedControl;
|
||||||
|
motor.ctrlMod = ControlMode::Speed;
|
||||||
|
motor.pwm = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixCommonParams();
|
||||||
|
|
||||||
|
sendCommands();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
@@ -246,7 +246,7 @@ constexpr char TEXT_RACE[] = "Race";
|
|||||||
constexpr char TEXT_DEFAULT[] = "Default";
|
constexpr char TEXT_DEFAULT[] = "Default";
|
||||||
constexpr char TEXT_TEMPOMAT[] = "Tempomat";
|
constexpr char TEXT_TEMPOMAT[] = "Tempomat";
|
||||||
constexpr char TEXT_LARSM[] = "Larsm";
|
constexpr char TEXT_LARSM[] = "Larsm";
|
||||||
constexpr char TEXT_BLUETOOTH[] = "Bluetooth";
|
constexpr char TEXT_GAMETRAK[] = "Gametrak";
|
||||||
//constexpr char TEXT_BACK[] = "Back";
|
//constexpr char TEXT_BACK[] = "Back";
|
||||||
|
|
||||||
//ChangeValueDisplay<bool>
|
//ChangeValueDisplay<bool>
|
||||||
|
Reference in New Issue
Block a user