add 5wire_2out dpad, peters config
This commit is contained in:
94
config_peter.cmake
Normal file
94
config_peter.cmake
Normal file
@ -0,0 +1,94 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_peter)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
||||
-DLOAD_GLCD=1
|
||||
-DLOAD_FONT2=1
|
||||
-DLOAD_FONT4=1
|
||||
-DLOAD_FONT7=1
|
||||
-DILI9341_DRIVER=1
|
||||
-DTFT_MOSI=13
|
||||
-DTFT_SCLK=15
|
||||
-DTFT_CS=14
|
||||
-DTFT_DC=12
|
||||
-DTFT_RST=2
|
||||
-DSPI_FREQUENCY=27000000
|
||||
)
|
||||
|
||||
set(BOBBYCAR_BUILDFLAGS
|
||||
-DFEATURE_ADC_IN
|
||||
-DPINS_GAS=34
|
||||
-DPINS_BREMS=35
|
||||
-DDEFAULT_SWAPSCREENBYTES=false
|
||||
-DFEATURE_CAN
|
||||
# -DFEATURE_SERIAL
|
||||
# -DPINS_RX1=4
|
||||
# -DPINS_TX1=5
|
||||
# -DPINS_RX2=22
|
||||
# -DPINS_TX2=23
|
||||
-DDEFAULT_INVERTFRONTLEFT=false
|
||||
-DDEFAULT_INVERTFRONTRIGHT=true
|
||||
-DDEFAULT_INVERTBACKLEFT=false
|
||||
-DDEFAULT_INVERTBACKRIGHT=true
|
||||
-DDEFAULT_WHEELDIAMETER=200
|
||||
# -DFEATURE_MOSFETS
|
||||
# -DPINS_MOSFET0=18
|
||||
# -DPINS_MOSFET1=19
|
||||
# -DPINS_MOSFET2=21
|
||||
-DDEFAULT_IMOTMAX=28
|
||||
-DDEFAULT_IDCMAX=30
|
||||
-DDEFAULT_NMOTMAX=2000
|
||||
-DDEFAULT_FIELDWEAKMAX=7
|
||||
-DDEFAULT_FIELDADVMAX=40
|
||||
-DDEVICE_PREFIX=peter_bobbyquad
|
||||
-DAP_PASSWORD=Passwort_123
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
-DFEATURE_DPAD_5WIRESW_2OUT
|
||||
-DPINS_DPAD_5WIRESW_OUT1=18
|
||||
-DPINS_DPAD_5WIRESW_OUT2=19
|
||||
-DPINS_DPAD_5WIRESW_IN1=4
|
||||
-DPINS_DPAD_5WIRESW_IN2=5
|
||||
-DPINS_DPAD_5WIRESW_IN3=27
|
||||
-DDPAD_5WIRESW_UP=4
|
||||
-DDPAD_5WIRESW_DOWN=7
|
||||
-DDPAD_5WIRESW_CONFIRM=1
|
||||
-DDPAD_5WIRESW_BACK=10
|
||||
-DDPAD_5WIRESW_PROFILE0=11
|
||||
-DDPAD_5WIRESW_PROFILE1=8
|
||||
-DDPAD_5WIRESW_PROFILE2=5
|
||||
-DDPAD_5WIRESW_PROFILE3=2
|
||||
-DDPAD_5WIRESW_BLINK_LEFT=9
|
||||
-DDPAD_5WIRESW_BLINK_RIGHT=0
|
||||
-DDPAD_5WIRESW_QUICKACTION_DOWN=3
|
||||
-DDPAD_5WIRESW_QUICKACTION_UP=6
|
||||
# -DDPAD_5WIRESW_DEBUG
|
||||
-DDEFAULT_GASMIN=842
|
||||
-DDEFAULT_GASMAX=2480
|
||||
-DDEFAULT_BREMSMIN=826
|
||||
-DDEFAULT_BREMSMAX=2502
|
||||
-DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
# -DPINS_GAMETRAKX=34
|
||||
# -DPINS_GAMETRAKY=39
|
||||
# -DPINS_GAMETRAKDIST=36
|
||||
# -DDEFAULT_GAMETRAKXMIN=0
|
||||
# -DDEFAULT_GAMETRAKXMAX=4095
|
||||
# -DDEFAULT_GAMETRAKYMIN=0
|
||||
# -DDEFAULT_GAMETRAKYMAX=4095
|
||||
# -DDEFAULT_GAMETRAKDISTMIN=0
|
||||
# -DDEFAULT_GAMETRAKDISTMAX=4095
|
||||
# -DFEATURE_POWERSUPPLY
|
||||
# -DFEATURE_CLOUD
|
||||
-DFEATURE_LEDBACKLIGHT
|
||||
-DPINS_LEDBACKLIGHT=23
|
||||
-DLEDBACKLIGHT_INVERTED
|
||||
# -DFEATURE_GARAGE
|
||||
# -DFEATURE_NTP
|
||||
-DFEATURE_WIRELESS_CONFIG
|
||||
-DFEATURE_LEDSTRIP
|
||||
-DPINS_LEDSTRIP=33
|
||||
-DLEDSTRIP_LENGTH=288
|
||||
)
|
@ -23,7 +23,7 @@ set(headers
|
||||
actions/switchprofileaction.h
|
||||
actions/updateswapfrontbackaction.h
|
||||
bluetoothmode.h
|
||||
ble.h
|
||||
bobby_ble.h
|
||||
bletexthelpers.h
|
||||
bmsutils.h
|
||||
changevaluedisplay_bluetoothmode.h
|
||||
|
@ -101,7 +101,7 @@ struct GasMinAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRe
|
||||
struct GasMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.gasMax; } };
|
||||
struct BremsMinAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.bremsMin; } };
|
||||
struct BremsMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.bremsMax; } };
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW)
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW) || defined(FEATURE_DPAD_5WIRESW_2OUT)
|
||||
struct DPadDebounceAccessor : public RefAccessorSaveSettings<uint8_t> { uint8_t &getRef() const override { return settings.boardcomputerHardware.dpadDebounce; } };
|
||||
#endif
|
||||
#ifdef FEATURE_GAMETRAK
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
// local includes
|
||||
#include "textinterface.h"
|
||||
#include "ble.h"
|
||||
#include "bobby_ble.h"
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLE
|
||||
|
94
main/displays/dpad5wire2outdebugdisplay.h
Normal file
94
main/displays/dpad5wire2outdebugdisplay.h
Normal file
@ -0,0 +1,94 @@
|
||||
#pragma once
|
||||
|
||||
#include "display.h"
|
||||
#include "globals.h"
|
||||
#include "widgets/label.h"
|
||||
#include "dpad5wire_2out.h"
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_DPAD_5WIRESW_2OUT
|
||||
class DPad5Wire2OutDebugDisplay : public Display, public virtual DummyConfirm, public virtual DummyBack
|
||||
{
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
|
||||
private:
|
||||
Label m_labelRaw{0, 50};
|
||||
Label m_labelUp{175, 75};
|
||||
Label m_labelDown{175, 100};
|
||||
Label m_labelBack{175, 125};
|
||||
Label m_labelConfirm{175, 150};
|
||||
Label m_labelProfile0{175, 175};
|
||||
Label m_labelProfile1{175, 200};
|
||||
Label m_labelProfile2{175, 225};
|
||||
Label m_labelProfile3{175, 250};
|
||||
Label m_labelGas{175, 275};
|
||||
Label m_labelBrems{175, 300};
|
||||
};
|
||||
|
||||
void DPad5Wire2OutDebugDisplay::initScreen()
|
||||
{
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextFont(4);
|
||||
tft.setTextColor(TFT_YELLOW);
|
||||
|
||||
tft.drawString("DPad 5wire debug", 5, 5);
|
||||
|
||||
tft.fillRect(0, 34, tft.width(), 3, TFT_WHITE);
|
||||
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
tft.drawString("UP:", 30, 75);
|
||||
tft.drawString("DOWN:", 30, 100);
|
||||
tft.drawString("CONFIRM:", 30, 125);
|
||||
tft.drawString("BACK:", 30, 150);
|
||||
tft.drawString("PROFILE0:", 30, 175);
|
||||
tft.drawString("PROFILE1:", 30, 200);
|
||||
tft.drawString("PROFILE2:", 30, 225);
|
||||
tft.drawString("PROFILE3:", 30, 250);
|
||||
tft.drawString("GAS:", 30, 275);
|
||||
tft.drawString("BREMS:", 30, 300);
|
||||
|
||||
m_labelRaw.start();
|
||||
m_labelUp.start();
|
||||
m_labelDown.start();
|
||||
m_labelBack.start();
|
||||
m_labelConfirm.start();
|
||||
m_labelProfile0.start();
|
||||
m_labelProfile1.start();
|
||||
m_labelProfile2.start();
|
||||
m_labelProfile3.start();
|
||||
m_labelGas.start();
|
||||
m_labelBrems.start();
|
||||
}
|
||||
|
||||
void DPad5Wire2OutDebugDisplay::redraw()
|
||||
{
|
||||
m_labelRaw.redraw(std::string{} +
|
||||
(std::get<0>(dpad5wire_2out::lastState) ? '1' : '0') + ' ' +
|
||||
(std::get<1>(dpad5wire_2out::lastState) ? '1' : '0') + ' ' +
|
||||
(std::get<2>(dpad5wire_2out::lastState) ? '1' : '0') + ' ' +
|
||||
(std::get<3>(dpad5wire_2out::lastState) ? '1' : '0') + ' ' +
|
||||
(std::get<4>(dpad5wire_2out::lastState) ? '1' : '0') + ' ' +
|
||||
(std::get<5>(dpad5wire_2out::lastState) ? '1' : '0') + ' ' +
|
||||
(std::get<6>(dpad5wire_2out::lastState) ? '1' : '0') + ' ' +
|
||||
(std::get<7>(dpad5wire_2out::lastState) ? '1' : '0') + ' ' +
|
||||
(std::get<8>(dpad5wire_2out::lastState) ? '1' : '0') + ' ' +
|
||||
(std::get<9>(dpad5wire_2out::lastState) ? '1' : '0') + ' ' +
|
||||
(std::get<10>(dpad5wire_2out::lastState) ? '1' : '0') + ' ' +
|
||||
(std::get<11>(dpad5wire_2out::lastState) ? '1' : '0'));
|
||||
|
||||
m_labelUp.redraw(std::get<DPAD_5WIRESW_UP>(dpad5wire_2out::lastState) ? "1" : "0");
|
||||
m_labelDown.redraw(std::get<DPAD_5WIRESW_DOWN>(dpad5wire_2out::lastState) ? "1" : "0");
|
||||
m_labelBack.redraw(std::get<DPAD_5WIRESW_BACK>(dpad5wire_2out::lastState) ? "1" : "0");
|
||||
m_labelConfirm.redraw(std::get<DPAD_5WIRESW_CONFIRM>(dpad5wire_2out::lastState) ? "1" : "0");
|
||||
m_labelProfile0.redraw(std::get<DPAD_5WIRESW_PROFILE0>(dpad5wire_2out::lastState) ? "1" : "0");
|
||||
m_labelProfile1.redraw(std::get<DPAD_5WIRESW_PROFILE1>(dpad5wire_2out::lastState) ? "1" : "0");
|
||||
m_labelProfile2.redraw(std::get<DPAD_5WIRESW_PROFILE2>(dpad5wire_2out::lastState) ? "1" : "0");
|
||||
m_labelProfile3.redraw(std::get<DPAD_5WIRESW_PROFILE3>(dpad5wire_2out::lastState) ? "1" : "0");
|
||||
m_labelGas.redraw(raw_gas ? std::to_string(*raw_gas) : "?");
|
||||
m_labelBrems.redraw(raw_brems ? std::to_string(*raw_brems) : "?");
|
||||
}
|
||||
#endif
|
||||
}
|
@ -84,7 +84,7 @@ using BremsMaxChangeScreen = makeComponent<
|
||||
SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||
>;
|
||||
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW)
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW) || defined(FEATURE_DPAD_5WIRESW_2OUT)
|
||||
using DPadDebounceChangeScreen = makeComponent<
|
||||
ChangeValueDisplay<uint8_t>,
|
||||
StaticText<TEXT_DPADDEBOUNCE>,
|
||||
@ -168,7 +168,7 @@ public:
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_GASMAX, GasMaxAccessor>, SwitchScreenAction<GasMaxChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_BREMSMIN, BremsMinAccessor>, SwitchScreenAction<BremsMinChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_BREMSMAX, BremsMaxAccessor>, SwitchScreenAction<BremsMaxChangeScreen>>>();
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW)
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW) || defined(FEATURE_DPAD_5WIRESW_2OUT)
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_DPADDEBOUNCE, DPadDebounceAccessor>, SwitchScreenAction<DPadDebounceChangeScreen>>>();
|
||||
#endif
|
||||
#ifdef FEATURE_GAMETRAK
|
||||
|
254
main/dpad5wire_2out.h
Normal file
254
main/dpad5wire_2out.h
Normal file
@ -0,0 +1,254 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <array>
|
||||
|
||||
// Arduino includes
|
||||
#include <Arduino.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <espchrono.h>
|
||||
#include <tickchrono.h>
|
||||
|
||||
// local includes
|
||||
#include "buttons.h"
|
||||
#include "types.h"
|
||||
|
||||
namespace {
|
||||
namespace dpad5wire_2out {
|
||||
|
||||
#ifdef FEATURE_DPAD_5WIRESW_2OUT
|
||||
class State : public std::array<bool, 12>
|
||||
{
|
||||
public:
|
||||
State() : std::array<bool, 12>{false, false, false, false, false, false, false, false, false, false, false, false} {}
|
||||
State(const std::array<bool, 12> &other) : std::array<bool, 12>{} {}
|
||||
|
||||
State &operator=(const std::array<bool, 12> &other)
|
||||
{
|
||||
std::array<bool, 12>::operator=(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
State &operator=(const State &other)
|
||||
{
|
||||
std::array<bool, 12>::operator=(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool &up{this->at(DPAD_5WIRESW_UP)};
|
||||
bool &down{this->at(DPAD_5WIRESW_DOWN)};
|
||||
bool &confirm{this->at(DPAD_5WIRESW_CONFIRM)};
|
||||
bool &back{this->at(DPAD_5WIRESW_BACK)};
|
||||
bool &profile0{this->at(DPAD_5WIRESW_PROFILE0)};
|
||||
bool &profile1{this->at(DPAD_5WIRESW_PROFILE1)};
|
||||
bool &profile2{this->at(DPAD_5WIRESW_PROFILE2)};
|
||||
bool &profile3{this->at(DPAD_5WIRESW_PROFILE3)};
|
||||
|
||||
bool &blink_left{this->at(DPAD_5WIRESW_BLINK_RIGHT)};
|
||||
bool &blink_right{this->at(DPAD_5WIRESW_BLINK_LEFT)};
|
||||
bool &quickaction_down{this->at(DPAD_5WIRESW_QUICKACTION_DOWN)};
|
||||
bool &quickaction_up{this->at(DPAD_5WIRESW_QUICKACTION_UP)};
|
||||
};
|
||||
|
||||
template<pin_t OUT, pin_t IN1, pin_t IN2, pin_t IN3, pin_t IN4>
|
||||
class Helper
|
||||
{
|
||||
public:
|
||||
static constexpr auto OutPin = OUT;
|
||||
static constexpr auto In1Pin = IN1;
|
||||
static constexpr auto In2Pin = IN2;
|
||||
static constexpr auto In3Pin = IN3;
|
||||
static constexpr auto In4Pin = IN4;
|
||||
|
||||
void begin();
|
||||
|
||||
State read();
|
||||
};
|
||||
|
||||
template<pin_t OUT1, pin_t OUT2, pin_t IN1, pin_t IN2, pin_t IN3>
|
||||
void Helper<OUT1, OUT2, IN1, IN2, IN3>::begin()
|
||||
{
|
||||
}
|
||||
|
||||
template<pin_t OUT1, pin_t OUT2, pin_t IN1, pin_t IN2, pin_t IN3>
|
||||
State Helper<OUT1, OUT2, IN1, IN2, IN3>::read()
|
||||
{
|
||||
State result;
|
||||
|
||||
pinMode(OUT1, OUTPUT);
|
||||
pinMode(OUT2, INPUT);
|
||||
|
||||
digitalWrite(OUT1, LOW);
|
||||
|
||||
pinMode(IN1, INPUT_PULLUP);
|
||||
pinMode(IN2, INPUT_PULLUP);
|
||||
pinMode(IN3, INPUT_PULLUP);
|
||||
|
||||
vPortYield();
|
||||
|
||||
result[0] = digitalRead(IN1)==LOW;
|
||||
result[1] = digitalRead(IN2)==LOW;
|
||||
result[2] = digitalRead(IN3)==LOW;
|
||||
|
||||
digitalWrite(OUT1, HIGH);
|
||||
|
||||
pinMode(IN1, INPUT_PULLDOWN);
|
||||
pinMode(IN2, INPUT_PULLDOWN);
|
||||
pinMode(IN3, INPUT_PULLDOWN);
|
||||
|
||||
vPortYield();
|
||||
|
||||
result[3] = digitalRead(IN1);
|
||||
result[4] = digitalRead(IN2);
|
||||
result[5] = digitalRead(IN3);
|
||||
|
||||
pinMode(OUT1, INPUT);
|
||||
pinMode(OUT2, OUTPUT);
|
||||
|
||||
digitalWrite(OUT2, LOW);
|
||||
|
||||
pinMode(IN1, INPUT_PULLUP);
|
||||
pinMode(IN2, INPUT_PULLUP);
|
||||
pinMode(IN3, INPUT_PULLUP);
|
||||
|
||||
vPortYield();
|
||||
|
||||
result[6] = digitalRead(IN1)==LOW;
|
||||
result[7] = digitalRead(IN2)==LOW;
|
||||
result[8] = digitalRead(IN3)==LOW;
|
||||
|
||||
digitalWrite(OUT2, HIGH);
|
||||
|
||||
pinMode(IN1, INPUT_PULLDOWN);
|
||||
pinMode(IN2, INPUT_PULLDOWN);
|
||||
pinMode(IN3, INPUT_PULLDOWN);
|
||||
|
||||
vPortYield();
|
||||
|
||||
result[9] = digitalRead(IN1);
|
||||
result[10] = digitalRead(IN2);
|
||||
result[11] = digitalRead(IN3);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Helper<PINS_DPAD_5WIRESW_OUT1, PINS_DPAD_5WIRESW_OUT2, PINS_DPAD_5WIRESW_IN1, PINS_DPAD_5WIRESW_IN2, PINS_DPAD_5WIRESW_IN3> helper;
|
||||
State lastState;
|
||||
espchrono::millis_clock::time_point debounceUp, debounceDown, debounceConfirm, debounceBack, debounceProfile0, debounceProfile1, debounceProfile2, debounceProfile3, debounceBlinkLeft, debounceBlinkRight, debounceQuickactionDown, debounceQuickactionUp;
|
||||
|
||||
void init()
|
||||
{
|
||||
helper.begin();
|
||||
debounceUp =
|
||||
debounceDown =
|
||||
debounceConfirm =
|
||||
debounceBack =
|
||||
debounceProfile0 =
|
||||
debounceProfile1 =
|
||||
debounceProfile2 =
|
||||
debounceProfile3 =
|
||||
debounceBlinkLeft=
|
||||
debounceBlinkRight =
|
||||
debounceQuickactionDown =
|
||||
debounceQuickactionUp =
|
||||
espchrono::millis_clock::now();
|
||||
}
|
||||
|
||||
void update()
|
||||
{
|
||||
const auto newState = helper.read();
|
||||
|
||||
#ifdef DPAD_5WIRESW_DEBUG
|
||||
lastState = newState;
|
||||
return;
|
||||
#endif
|
||||
|
||||
const auto now = espchrono::millis_clock::now();
|
||||
|
||||
const std::chrono::milliseconds dpadDebounce{settings.boardcomputerHardware.dpadDebounce};
|
||||
|
||||
if (lastState.up != newState.up && now - debounceUp > dpadDebounce)
|
||||
{
|
||||
lastState.up = newState.up;
|
||||
InputDispatcher::upButton(newState.up);
|
||||
debounceUp = now;
|
||||
}
|
||||
|
||||
if (lastState.down != newState.down && now - debounceDown > dpadDebounce)
|
||||
{
|
||||
lastState.down = newState.down;
|
||||
InputDispatcher::downButton(newState.down);
|
||||
debounceDown = now;
|
||||
}
|
||||
|
||||
if (lastState.confirm != newState.confirm && now - debounceConfirm > dpadDebounce)
|
||||
{
|
||||
lastState.confirm = newState.confirm;
|
||||
InputDispatcher::confirmButton(newState.confirm);
|
||||
debounceConfirm = now;
|
||||
}
|
||||
|
||||
if (lastState.back != newState.back && now - debounceBack > dpadDebounce)
|
||||
{
|
||||
lastState.back = newState.back;
|
||||
InputDispatcher::backButton(newState.back);
|
||||
debounceBack = now;
|
||||
}
|
||||
|
||||
if (lastState.profile0 != newState.profile0 && now - debounceProfile0 > dpadDebounce)
|
||||
{
|
||||
lastState.profile0 = newState.profile0;
|
||||
InputDispatcher::profileButton(0, newState.profile0);
|
||||
debounceProfile0 = now;
|
||||
}
|
||||
|
||||
if (lastState.profile1 != newState.profile1 && now - debounceProfile1 > dpadDebounce)
|
||||
{
|
||||
lastState.profile1 = newState.profile1;
|
||||
InputDispatcher::profileButton(1, newState.profile1);
|
||||
debounceProfile1 = now;
|
||||
}
|
||||
|
||||
if (lastState.profile2 != newState.profile2 && now - debounceProfile2 > dpadDebounce)
|
||||
{
|
||||
lastState.profile2 = newState.profile2;
|
||||
InputDispatcher::profileButton(2, newState.profile2);
|
||||
debounceProfile2 = now;
|
||||
}
|
||||
|
||||
if (lastState.profile3 != newState.profile3 && now - debounceProfile3 > dpadDebounce)
|
||||
{
|
||||
lastState.profile3 = newState.profile3;
|
||||
InputDispatcher::profileButton(3, newState.profile3);
|
||||
debounceProfile3 = now;
|
||||
}
|
||||
|
||||
if (lastState.blink_left != newState.blink_left && now - debounceBlinkLeft > dpadDebounce)
|
||||
{
|
||||
lastState.blink_left = newState.blink_left;
|
||||
debounceBlinkLeft = now;
|
||||
}
|
||||
|
||||
if (lastState.blink_right != newState.blink_right && now - debounceBlinkRight > dpadDebounce)
|
||||
{
|
||||
lastState.blink_right = newState.blink_right;
|
||||
debounceBlinkRight = now;
|
||||
}
|
||||
|
||||
if (lastState.quickaction_down != newState.quickaction_down && now - debounceQuickactionDown > dpadDebounce)
|
||||
{
|
||||
lastState.quickaction_down = newState.quickaction_down;
|
||||
debounceQuickactionDown = now;
|
||||
}
|
||||
|
||||
if (lastState.quickaction_up != newState.quickaction_up && now - debounceQuickactionUp > dpadDebounce)
|
||||
{
|
||||
lastState.quickaction_up = newState.quickaction_up;
|
||||
debounceQuickactionUp = now;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace dpad5wire_2out
|
||||
} // namespace
|
@ -81,6 +81,9 @@ using namespace std::chrono_literals;
|
||||
#ifdef FEATURE_DPAD_5WIRESW
|
||||
#include "displays/dpad5wiredebugdisplay.h"
|
||||
#endif
|
||||
#ifdef FEATURE_DPAD_5WIRESW_2OUT
|
||||
#include "displays/dpad5wire2outdebugdisplay.h"
|
||||
#endif
|
||||
#include "displays/gameoflifedisplay.h"
|
||||
#ifdef FEATURE_GARAGE
|
||||
#include "displays/garagedisplay.h"
|
||||
@ -107,6 +110,9 @@ using namespace std::chrono_literals;
|
||||
#ifdef FEATURE_DPAD_5WIRESW
|
||||
#include "dpad5wire.h"
|
||||
#endif
|
||||
#ifdef FEATURE_DPAD_5WIRESW_2OUT
|
||||
#include "dpad5wire_2out.h"
|
||||
#endif
|
||||
#ifdef FEATURE_ROTARY
|
||||
#include "rotary.h"
|
||||
#endif
|
||||
@ -124,7 +130,7 @@ using namespace std::chrono_literals;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FEATURE_BLE
|
||||
#include "ble.h"
|
||||
#include "bobby_ble.h"
|
||||
#endif
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
#include "webserver.h"
|
||||
@ -223,6 +229,11 @@ extern "C" void app_main()
|
||||
dpad5wire::init();
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_DPAD_5WIRESW_2OUT
|
||||
bootLabel.redraw("dpad5wire_2out");
|
||||
dpad5wire_2out::init();
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_ROTARY
|
||||
bootLabel.redraw("rotary");
|
||||
initRotary();
|
||||
@ -324,6 +335,8 @@ extern "C" void app_main()
|
||||
|
||||
#if defined(FEATURE_DPAD_5WIRESW) && defined(DPAD_5WIRESW_DEBUG)
|
||||
switchScreen<DPad5WireDebugDisplay>();
|
||||
#elif defined(FEATURE_DPAD_5WIRESW_2OUT) && defined(DPAD_5WIRESW_DEBUG)
|
||||
switchScreen<DPad5Wire2OutDebugDisplay>();
|
||||
#else
|
||||
|
||||
if (!gas || !brems || *gas > 200.f || *brems > 200.f)
|
||||
@ -356,6 +369,9 @@ extern "C" void app_main()
|
||||
#ifdef FEATURE_DPAD_5WIRESW
|
||||
dpad5wire::update();
|
||||
#endif
|
||||
#ifdef FEATURE_DPAD_5WIRESW_2OUT
|
||||
dpad5wire_2out::update();
|
||||
#endif
|
||||
|
||||
if (!lastPotiRead || now - *lastPotiRead >= 1000ms/settings.boardcomputerHardware.timersSettings.potiReadRate)
|
||||
{
|
||||
|
@ -152,7 +152,7 @@ constexpr Settings::BoardcomputerHardware defaultBoardcomputerHardware {
|
||||
.gasMax = DEFAULT_GASMAX,
|
||||
.bremsMin = DEFAULT_BREMSMIN,
|
||||
.bremsMax = DEFAULT_BREMSMAX,
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW)
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW) || defined(FEATURE_DPAD_5WIRESW_2OUT)
|
||||
.dpadDebounce = 25,
|
||||
#endif
|
||||
#ifdef FEATURE_GAMETRAK
|
||||
|
@ -93,7 +93,7 @@ struct Settings
|
||||
struct BoardcomputerHardware {
|
||||
int16_t sampleCount;
|
||||
int16_t gasMin, gasMax, bremsMin, bremsMax;
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW)
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW) || defined(FEATURE_DPAD_5WIRESW_2OUT)
|
||||
uint8_t dpadDebounce;
|
||||
#endif
|
||||
#ifdef FEATURE_GAMETRAK
|
||||
@ -211,7 +211,7 @@ void Settings::executeForEveryCommonSetting(T &&callable)
|
||||
callable("gasMax", boardcomputerHardware.gasMax);
|
||||
callable("bremsMin", boardcomputerHardware.bremsMin);
|
||||
callable("bremsMax", boardcomputerHardware.bremsMax);
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW)
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW) || defined(FEATURE_DPAD_5WIRESW_2OUT)
|
||||
callable("dpadDebounce", boardcomputerHardware.dpadDebounce);
|
||||
#endif
|
||||
#ifdef FEATURE_GAMETRAK
|
||||
|
1502
sdkconfig_peter
Normal file
1502
sdkconfig_peter
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
VALID_CONFIGS=(feedc0de comred mick)
|
||||
VALID_CONFIGS=(feedc0de comred mick peter)
|
||||
|
||||
print_usage() {
|
||||
echo "usage: ./switchconf.sh ${VALID_CONFIGS[@]}"
|
||||
|
Reference in New Issue
Block a user