Compare commits
1 Commits
new-idf
...
gabor-test
Author | SHA1 | Date | |
---|---|---|---|
a6e08af976 |
@ -1,66 +0,0 @@
|
||||
# Generated from CLion C/C++ Code Style settings
|
||||
BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignOperands: Align
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
AllowAllConstructorInitializersOnNextLine: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: Always
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: Always
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: true
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: false
|
||||
AfterUnion: true
|
||||
BeforeCatch: false
|
||||
BeforeElse: true
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakInheritanceList: BeforeColon
|
||||
ColumnLimit: 0
|
||||
CompactNamespaces: false
|
||||
ContinuationIndentWidth: 8
|
||||
IndentCaseLabels: false
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 4
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MaxEmptyLinesToKeep: 2
|
||||
NamespaceIndentation: None
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PointerAlignment: Right
|
||||
ReflowComments: false
|
||||
SpaceAfterCStyleCast: true
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 0
|
||||
SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
2
.github/workflows/workflow.yml
vendored
2
.github/workflows/workflow.yml
vendored
@ -154,7 +154,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node: [feedc0de, feedc0de_new, comred_new, peter, mick, nofeatures, seatbot]
|
||||
node: [feedc0de, comred, comred_new, peter, mick, nofeatures, seatbot, gernot]
|
||||
name: ${{ matrix.node }}
|
||||
needs:
|
||||
- checkout
|
||||
|
22
.gitmodules
vendored
22
.gitmodules
vendored
@ -3,7 +3,7 @@
|
||||
url = ../../0xFEEDC0DE64/espcpputils.git
|
||||
[submodule "esp-idf"]
|
||||
path = esp-idf
|
||||
url = ../../bobbycar-graz/esp-idf.git
|
||||
url = ../../0xFEEDC0DE64/esp-idf.git
|
||||
[submodule "components/cpputils"]
|
||||
path = components/cpputils
|
||||
url = ../../0xFEEDC0DE64/cpputils.git
|
||||
@ -19,9 +19,15 @@
|
||||
[submodule "components/ArduinoJson"]
|
||||
path = components/ArduinoJson
|
||||
url = ../../0xFEEDC0DE64/ArduinoJson.git
|
||||
[submodule "components/TFT_eSPI"]
|
||||
path = components/TFT_eSPI
|
||||
url = ../../0xFEEDC0DE64/TFT_eSPI.git
|
||||
[submodule "components/arduino-esp32"]
|
||||
path = components/arduino-esp32
|
||||
url = ../../0xFEEDC0DE64/arduino-esp32.git
|
||||
[submodule "components/expected"]
|
||||
path = components/expected
|
||||
url = ../../0xFEEDC0DE64/expected.git
|
||||
[submodule "components/bobbycar-protocol"]
|
||||
path = components/bobbycar-protocol
|
||||
url = ../../bobbycar-graz/bobbycar-protocol.git
|
||||
@ -33,7 +39,7 @@
|
||||
url = ../../0xFEEDC0DE64/espwifistack.git
|
||||
[submodule "components/esp-nimble-cpp"]
|
||||
path = components/esp-nimble-cpp
|
||||
url = ../../bobbycar-graz/esp-nimble-cpp.git
|
||||
url = ../../0xFEEDC0DE64/esp-nimble-cpp.git
|
||||
[submodule "components/espasyncota"]
|
||||
path = components/espasyncota
|
||||
url = ../../0xFEEDC0DE64/espasyncota.git
|
||||
@ -61,15 +67,3 @@
|
||||
[submodule "esp-protocols"]
|
||||
path = esp-protocols
|
||||
url = ../../0xFEEDC0DE64/esp-protocols.git
|
||||
[submodule "components/TFT_eSPI"]
|
||||
path = components/TFT_eSPI
|
||||
url = ../../0xFEEDC0DE64/TFT_eSPI.git
|
||||
[submodule "esp_boost"]
|
||||
path = esp_boost
|
||||
url = ../../0xFEEDC0DE64/esp_boost.git
|
||||
[submodule "components/esptftlib"]
|
||||
path = components/esptftlib
|
||||
url = ../../0xFEEDC0DE64/esptftlib.git
|
||||
[submodule "components/espfontlib"]
|
||||
path = components/espfontlib
|
||||
url = ../../0xFEEDC0DE64/espfontlib.git
|
||||
|
@ -22,13 +22,10 @@ include(config.cmake)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
idf_build_set_property(CXX_COMPILE_OPTIONS -std=gnu++23 APPEND)
|
||||
|
||||
set(EXTRA_COMPONENT_DIRS
|
||||
esp_boost
|
||||
esp-protocols/components
|
||||
)
|
||||
|
||||
|
Submodule components/FastLED-idf updated: 6a64e87bc3...76e19791f9
Submodule components/TFT_eSPI updated: 69f86aa4f2...5ca80d8cf8
Submodule components/arduino-esp32 updated: 745ccdeae8...2b2f7cd936
Submodule components/bobbycar-protocol updated: 0734d65146...a74791e2aa
Submodule components/cpputils updated: 96e318fd6d...2a957fb627
Submodule components/esp-gui-lib updated: 53c5f9a0f3...bb02a6c267
Submodule components/esp-nimble-cpp updated: 29f9273c65...641f297120
Submodule components/espasynchttpreq updated: 06ca1a6881...4719a27c5d
Submodule components/espasyncota updated: ee623d78ea...1cc204f1af
Submodule components/espchrono updated: eff94f175c...b83cc027cd
Submodule components/espconfiglib updated: 379533571f...3ca0eb09d6
Submodule components/espcpputils updated: 4cf49eac1d...a155041878
Submodule components/espfontlib deleted from 89048ff162
Submodule components/esphttpdutils updated: 6ed0915d85...c095443979
Submodule components/esptftlib deleted from b779a4c09d
Submodule components/espwifistack updated: e70b509e20...4749a9db5c
1
components/expected
Submodule
1
components/expected
Submodule
Submodule components/expected added at ce14a0fc6e
Submodule components/fmt updated: 32e16173ce...7b25dd172b
@ -1,5 +1,4 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_allfeatures)
|
||||
set(BOBBY_DEFAULT_USERNAME allfeatures)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
||||
@ -18,6 +17,8 @@ add_definitions(
|
||||
|
||||
set(BOBBYCAR_BUILDFLAGS
|
||||
# Pins
|
||||
-DPINS_GAS=34
|
||||
-DPINS_BREMS=35
|
||||
# -DFEATURE_JOYSTICK
|
||||
# -DPINS_RX1=4
|
||||
# -DPINS_TX1=5
|
@ -1,5 +1,4 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_comred)
|
||||
set(BOBBY_DEFAULT_USERNAMENAME comred)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
@ -1,20 +1,19 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_comred_new)
|
||||
set(BOBBY_DEFAULT_USERNAME comred_new)
|
||||
|
||||
# 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=40000000
|
||||
# )
|
||||
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=40000000
|
||||
)
|
||||
|
||||
set(BOBBYCAR_BUILDFLAGS
|
||||
# Pins
|
@ -1,8 +1,24 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_feedc0de)
|
||||
set(BOBBY_DEFAULT_USERNAME feedc0de)
|
||||
|
||||
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=40000000
|
||||
)
|
||||
|
||||
set(BOBBYCAR_BUILDFLAGS
|
||||
# Pins
|
||||
-DPINS_GAS=34
|
||||
-DPINS_BREMS=35
|
||||
# -DFEATURE_JOYSTICK
|
||||
# -DPINS_RX1=4
|
||||
# -DPINS_TX1=5
|
@ -1,5 +1,4 @@
|
||||
set(BOBBY_APP_NAME testdevice)
|
||||
set(BOBBY_DEFAULT_USERNAME testdevice)
|
||||
set(BOBBY_APP_NAME bobbyquad_comred_new)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
||||
@ -88,3 +87,7 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DDPAD_BOARDCOMPUTER_V2_DEBUG
|
||||
)
|
||||
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ignore/lockscreen_plugin.cmake")
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/ignore/lockscreen_plugin.cmake")
|
||||
message(WARNING "Including plugins")
|
||||
endif()
|
@ -1,5 +1,4 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_gernot)
|
||||
set(BOBBY_DEFAULT_USERNAME gernot)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
@ -1,5 +1,4 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_greyhash)
|
||||
set(BOBBY_DEFAULT_USERNAME greyhash)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
@ -1,5 +1,19 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_mick)
|
||||
set(BOBBY_DEFAULT_USERNAME mick)
|
||||
|
||||
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
|
||||
# Pins
|
@ -1,5 +1,4 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_nofeatures)
|
||||
set(BOBBY_DEFAULT_USERNAME nofeatures)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
@ -1,5 +1,4 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_peter)
|
||||
set(BOBBY_DEFAULT_USERNAME peter)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
@ -1,5 +1,4 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_seatbot)
|
||||
set(BOBBY_DEFAULT_USERNAME seatbot)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
||||
@ -46,7 +45,7 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
-DFEATURE_LEDBACKLIGHT
|
||||
|
||||
-DLEDBACKLIGHT_INVERTED
|
||||
-DLEDSTRIP_WRONG_DIRECTION
|
||||
# -DLEDSTRIP_WRONG_DIRECTION
|
||||
-DHEAP_LRGST_CRASH_TEXT_FIX
|
||||
|
||||
# Default values
|
@ -1,90 +0,0 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_aveexy)
|
||||
set(BOBBY_DEFAULT_USERNAME aveexy)
|
||||
|
||||
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=40000000
|
||||
)
|
||||
|
||||
set(BOBBYCAR_BUILDFLAGS
|
||||
# Pins
|
||||
-DPINS_GAS=34
|
||||
-DPINS_BREMS=35
|
||||
# -DFEATURE_JOYSTICK
|
||||
# -DPINS_RX1=4
|
||||
# -DPINS_TX1=5
|
||||
# -DPINS_RX2=22
|
||||
# -DPINS_TX2=23
|
||||
# -DPINS_MOSFET0=18
|
||||
# -DPINS_MOSFET1=19
|
||||
# -DPINS_MOSFET2=21
|
||||
# -DPINS_GAMETRAKX=34
|
||||
# -DPINS_GAMETRAKY=39
|
||||
# -DPINS_GAMETRAKDIST=36
|
||||
-DPINS_LEDBACKLIGHT=23
|
||||
-DPINS_LEDSTRIP=33
|
||||
|
||||
# Config flags
|
||||
-DFEATURE_ADC_IN
|
||||
-DFEATURE_CAN
|
||||
# -DFEATURE_SERIAL
|
||||
# -DFEATURE_MOSFETS
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
# -DFEATURE_POWERSUPPLY
|
||||
-DFEATURE_LEDBACKLIGHT
|
||||
|
||||
-DLEDBACKLIGHT_INVERTED
|
||||
# -DLEDSTRIP_WRONG_DIRECTION
|
||||
-DHEAP_LRGST_CRASH_TEXT_FIX
|
||||
|
||||
# Default values
|
||||
-DDEFAULT_SWAPSCREENBYTES=false
|
||||
-DDEFAULT_INVERTFRONTLEFT=false
|
||||
-DDEFAULT_INVERTFRONTRIGHT=true
|
||||
-DDEFAULT_INVERTBACKLEFT=false
|
||||
-DDEFAULT_INVERTBACKRIGHT=true
|
||||
-DDEFAULT_WHEELDIAMETER=200
|
||||
-DDEFAULT_IMOTMAX=28
|
||||
-DDEFAULT_IDCMAX=30
|
||||
-DDEFAULT_NMOTMAX=2000
|
||||
-DDEFAULT_FIELDWEAKMAX=17
|
||||
-DDEFAULT_FIELDADVMAX=40
|
||||
|
||||
# DPAD
|
||||
# -DFEATURE_DPAD_5WIRESW
|
||||
# -DPINS_DPAD_5WIRESW_OUT=4
|
||||
# -DPINS_DPAD_5WIRESW_IN1=5
|
||||
# -DPINS_DPAD_5WIRESW_IN2=27
|
||||
# -DPINS_DPAD_5WIRESW_IN3=18
|
||||
# -DPINS_DPAD_5WIRESW_IN4=19
|
||||
# -DPINS_DPAD_EXTRASW_IN5=25
|
||||
# -DFEATURE_DPAD_6WIRESW
|
||||
# -DPINS_DPAD_6WIRESW_OUT=4
|
||||
# -DPINS_DPAD_6WIRESW_IN1=5
|
||||
# -DPINS_DPAD_6WIRESW_IN2=27
|
||||
# -DPINS_DPAD_6WIRESW_IN3=18
|
||||
# -DPINS_DPAD_6WIRESW_IN4=19
|
||||
# -DPINS_DPAD_6WIRESW_IN5=26
|
||||
# -DFEATURE_GSCHISSENE_DIODE
|
||||
-DDPAD_BOARDCOMPUTER_V2
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_OUT1=19
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_OUT2=5
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_IN1=4
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_IN2=18
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_IN3=27
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_IN4=16
|
||||
# -DDPAD_BOARDCOMPUTER_V2_DEBUG
|
||||
)
|
||||
|
@ -1,56 +0,0 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_feedc0de)
|
||||
set(BOBBY_DEFAULT_USERNAME feedc0de)
|
||||
|
||||
set(BOBBYCAR_BUILDFLAGS
|
||||
# Pins
|
||||
# -DFEATURE_JOYSTICK
|
||||
# -DPINS_RX1=4
|
||||
# -DPINS_TX1=5
|
||||
# -DPINS_RX2=22
|
||||
# -DPINS_TX2=23
|
||||
-DPINS_MOSFET0=4
|
||||
-DPINS_MOSFET1=5
|
||||
-DPINS_MOSFET2=25
|
||||
# -DPINS_GAMETRAKX=34
|
||||
# -DPINS_GAMETRAKY=39
|
||||
# -DPINS_GAMETRAKDIST=36
|
||||
-DPINS_LEDBACKLIGHT=23
|
||||
-DPINS_LEDSTRIP=26
|
||||
|
||||
# Config flags
|
||||
-DFEATURE_ADC_IN
|
||||
-DFEATURE_CAN
|
||||
# -DFEATURE_SERIAL
|
||||
-DFEATURE_MOSFETS
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
-DFEATURE_POWERSUPPLY
|
||||
-DFEATURE_LEDBACKLIGHT
|
||||
|
||||
# -DLEDBACKLIGHT_INVERTED
|
||||
# -DLEDSTRIP_WRONG_DIRECTION
|
||||
# -DHEAP_LRGST_CRASH_TEXT_FIX
|
||||
|
||||
# Default values
|
||||
-DDEFAULT_SWAPSCREENBYTES=false
|
||||
-DDEFAULT_INVERTFRONTLEFT=false
|
||||
-DDEFAULT_INVERTFRONTRIGHT=true
|
||||
-DDEFAULT_INVERTBACKLEFT=false
|
||||
-DDEFAULT_INVERTBACKRIGHT=true
|
||||
-DDEFAULT_WHEELDIAMETER=255
|
||||
-DDEFAULT_IMOTMAX=40
|
||||
-DDEFAULT_IDCMAX=42
|
||||
-DDEFAULT_NMOTMAX=2000
|
||||
-DDEFAULT_FIELDWEAKMAX=17
|
||||
-DDEFAULT_FIELDADVMAX=40
|
||||
|
||||
# DPAD
|
||||
-DDPAD_BOARDCOMPUTER_V2
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_OUT1=19
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_OUT2=5
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_IN1=4
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_IN2=18
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_IN3=27
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_IN4=16
|
||||
)
|
@ -1,90 +0,0 @@
|
||||
set(BOBBY_APP_NAME testdevice2)
|
||||
set(BOBBY_DEFAULT_USERNAME testdevice2)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
||||
-DLOAD_GLCD=1
|
||||
-DLOAD_FONT2=1
|
||||
-DLOAD_FONT4=1
|
||||
-DLOAD_FONT7=1
|
||||
-DST7789_DRIVER=1
|
||||
-DTFT_MOSI=13
|
||||
-DTFT_SCLK=15
|
||||
-DTFT_CS=14
|
||||
-DTFT_DC=12
|
||||
-DTFT_RST=2
|
||||
-DSPI_FREQUENCY=40000000
|
||||
)
|
||||
|
||||
set(BOBBYCAR_BUILDFLAGS
|
||||
# Pins
|
||||
-DPINS_GAS=34
|
||||
-DPINS_BREMS=35
|
||||
# -DFEATURE_JOYSTICK
|
||||
# -DPINS_RX1=4
|
||||
# -DPINS_TX1=5
|
||||
# -DPINS_RX2=22
|
||||
# -DPINS_TX2=23
|
||||
# -DPINS_MOSFET0=18
|
||||
# -DPINS_MOSFET1=19
|
||||
# -DPINS_MOSFET2=21
|
||||
# -DPINS_GAMETRAKX=34
|
||||
# -DPINS_GAMETRAKY=39
|
||||
# -DPINS_GAMETRAKDIST=36
|
||||
-DPINS_LEDBACKLIGHT=23
|
||||
-DPINS_LEDSTRIP=33
|
||||
|
||||
# Config flags
|
||||
-DFEATURE_ADC_IN
|
||||
-DFEATURE_CAN
|
||||
# -DFEATURE_SERIAL
|
||||
# -DFEATURE_MOSFETS
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
# -DFEATURE_POWERSUPPLY
|
||||
-DFEATURE_LEDBACKLIGHT
|
||||
|
||||
-DLEDBACKLIGHT_INVERTED
|
||||
# -DLEDSTRIP_WRONG_DIRECTION
|
||||
-DHEAP_LRGST_CRASH_TEXT_FIX
|
||||
|
||||
# Default values
|
||||
-DDEFAULT_SWAPSCREENBYTES=false
|
||||
-DDEFAULT_INVERTFRONTLEFT=false
|
||||
-DDEFAULT_INVERTFRONTRIGHT=true
|
||||
-DDEFAULT_INVERTBACKLEFT=false
|
||||
-DDEFAULT_INVERTBACKRIGHT=true
|
||||
-DDEFAULT_WHEELDIAMETER=200
|
||||
-DDEFAULT_IMOTMAX=28
|
||||
-DDEFAULT_IDCMAX=30
|
||||
-DDEFAULT_NMOTMAX=2000
|
||||
-DDEFAULT_FIELDWEAKMAX=17
|
||||
-DDEFAULT_FIELDADVMAX=40
|
||||
|
||||
# DPAD
|
||||
# -DFEATURE_DPAD_5WIRESW
|
||||
# -DPINS_DPAD_5WIRESW_OUT=4
|
||||
# -DPINS_DPAD_5WIRESW_IN1=5
|
||||
# -DPINS_DPAD_5WIRESW_IN2=27
|
||||
# -DPINS_DPAD_5WIRESW_IN3=18
|
||||
# -DPINS_DPAD_5WIRESW_IN4=19
|
||||
# -DPINS_DPAD_EXTRASW_IN5=25
|
||||
# -DFEATURE_DPAD_6WIRESW
|
||||
# -DPINS_DPAD_6WIRESW_OUT=4
|
||||
# -DPINS_DPAD_6WIRESW_IN1=5
|
||||
# -DPINS_DPAD_6WIRESW_IN2=27
|
||||
# -DPINS_DPAD_6WIRESW_IN3=18
|
||||
# -DPINS_DPAD_6WIRESW_IN4=19
|
||||
# -DPINS_DPAD_6WIRESW_IN5=26
|
||||
# -DFEATURE_GSCHISSENE_DIODE
|
||||
-DDPAD_BOARDCOMPUTER_V2
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_OUT1=19
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_OUT2=5
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_IN1=4
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_IN2=18
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_IN3=27
|
||||
-DPINS_DPAD_BOARDCOMPUTER_V2_IN4=16
|
||||
# -DDPAD_BOARDCOMPUTER_V2_DEBUG
|
||||
)
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,15 +1,9 @@
|
||||
dependencies:
|
||||
espressif/esp-idf-cxx:
|
||||
component_hash: df7921090d6601b268b99b5d54d2f53bb5ea25dbd58cc53961ef7784326621de
|
||||
source:
|
||||
service_url: https://api.components.espressif.com/
|
||||
type: service
|
||||
version: 1.0.1-beta
|
||||
idf:
|
||||
component_hash: null
|
||||
source:
|
||||
type: idf
|
||||
version: 5.2.0
|
||||
manifest_hash: 04b1e89bb78c4187b4d7bc0cf9461b7a3475762e58fec6f3bb49a885c56532c2
|
||||
version: 5.0.0
|
||||
manifest_hash: 7c3516d5e235caf076ae74598eb0fa0e7367ac4e40a46f5f1c262bd592a127e4
|
||||
target: esp32
|
||||
version: 1.0.0
|
||||
|
2
esp-idf
2
esp-idf
Submodule esp-idf updated: 14b365579b...d0026946cd
Submodule esp-protocols updated: d38f04b88f...555cd0ab92
Submodule esp_boost deleted from 76e5b5075c
@ -53,4 +53,4 @@ export PATH=$PATH:$(pwd)/tools
|
||||
alias open-ide=open_ide
|
||||
alias switchconf=./switchconf.sh
|
||||
alias bobby-build="idf.py build"
|
||||
|
||||
export PS1="\033[1;32m(bobby-sourced)\033[;0m$PS1"
|
||||
|
@ -1,4 +1,4 @@
|
||||
set(BOBBY_HEADERS
|
||||
set(headers
|
||||
accessorhelpers.h
|
||||
accessors/globalaccessors.h
|
||||
accessors/settingsaccessors.h
|
||||
@ -23,9 +23,8 @@ set(BOBBY_HEADERS
|
||||
actions/loadsettingsaction.h
|
||||
actions/modesettingsaction.h
|
||||
actions/qraction.h
|
||||
actions/resetnvsaction.h
|
||||
actions/rebootaction.h
|
||||
actions/savesettingsaction.h
|
||||
actions/setupactions.h
|
||||
actions/switchprofileaction.h
|
||||
actions/tempomatmodeapplycurrentpeedaction.h
|
||||
actions/updateswapfrontbackaction.h
|
||||
@ -63,7 +62,6 @@ set(BOBBY_HEADERS
|
||||
debuginputhandler.h
|
||||
debugtexthelpers.h
|
||||
displays/batterygraphdisplay.h
|
||||
displays/batteryinfodisplay.h
|
||||
displays/bmsdisplay.h
|
||||
displays/bobbychangevaluedisplay.h
|
||||
displays/bobbydisplay.h
|
||||
@ -72,6 +70,7 @@ set(BOBBY_HEADERS
|
||||
displays/bobbymenudisplay.h
|
||||
displays/bobbypopupdisplay.h
|
||||
displays/bobbysplitgraphdisplay.h
|
||||
displays/buttoncalibratedisplay.h
|
||||
displays/calibratevoltagedisplay.h
|
||||
displays/confiscationdisplay.h
|
||||
displays/gameoflifedisplay.h
|
||||
@ -128,7 +127,6 @@ set(BOBBY_HEADERS
|
||||
displays/menus/networksettingsmenu.h
|
||||
displays/menus/otamenu.h
|
||||
displays/menus/profilesmenu.h
|
||||
displays/menus/recoverymenu.h
|
||||
displays/menus/remotecontrolmodesettingsmenu.h
|
||||
displays/menus/selectbuildserverbranch.h
|
||||
displays/menus/selectbuildservermenu.h
|
||||
@ -158,20 +156,10 @@ set(BOBBY_HEADERS
|
||||
displays/qrcodedebug.h
|
||||
displays/qrdisplay.h
|
||||
displays/qrimportdisplay.h
|
||||
displays/rebootscreen.h
|
||||
displays/setup/ask_calibrate_other_buttons.h
|
||||
displays/setup/ask_setup_clouds.h
|
||||
displays/setup/basic_buttons.h
|
||||
displays/setup/calibrate_potis.h
|
||||
displays/setup/final_information.h
|
||||
displays/setup/information.h
|
||||
displays/setup/setup_cloud.h
|
||||
displays/speedinfodisplay.h
|
||||
displays/spirodisplay.h
|
||||
displays/starfielddisplay.h
|
||||
displays/statusdisplay.h
|
||||
displays/updatedisplay.h
|
||||
displays/xydebugdisplay.h
|
||||
dnsannounce.h
|
||||
dpad.h
|
||||
dpad3wire.h
|
||||
@ -182,7 +170,6 @@ set(BOBBY_HEADERS
|
||||
drivingstatistics.h
|
||||
espnowfunctions.h
|
||||
esptexthelpers.h
|
||||
feedbackemulator.h
|
||||
feedbackparser.h
|
||||
globals.h
|
||||
handbremse.h
|
||||
@ -228,7 +215,6 @@ set(BOBBY_HEADERS
|
||||
modes/tempomatmode.h
|
||||
modes/wheelchairmode.h
|
||||
mosfets.h
|
||||
motorpwmlimiter.h
|
||||
newsettings.h
|
||||
ota.h
|
||||
potis.h
|
||||
@ -240,8 +226,6 @@ set(BOBBY_HEADERS
|
||||
serial_bobby.h
|
||||
settingspersister.h
|
||||
settingsutils.h
|
||||
setup.h
|
||||
softpwmlimiter.h
|
||||
statistics.h
|
||||
statustexthelper.h
|
||||
taskmanager.h
|
||||
@ -251,7 +235,6 @@ set(BOBBY_HEADERS
|
||||
texthelpers/wifistatexthelpers.h
|
||||
time_bobbycar.h
|
||||
types.h
|
||||
typeutils.h
|
||||
udpcloud.h
|
||||
unifiedmodelmode.h
|
||||
utils.h
|
||||
@ -267,7 +250,7 @@ set(BOBBY_HEADERS
|
||||
wifiguiutils.h
|
||||
)
|
||||
|
||||
set(BOBBY_SOURCES
|
||||
set(sources
|
||||
accessors/wifistaconfigaccessors.cpp
|
||||
actions/assertaction.cpp
|
||||
actions/bluetoothbeginaction.cpp
|
||||
@ -287,9 +270,8 @@ set(BOBBY_SOURCES
|
||||
actions/loadsettingsaction.cpp
|
||||
actions/modesettingsaction.cpp
|
||||
actions/qraction.cpp
|
||||
actions/resetnvsaction.cpp
|
||||
actions/rebootaction.cpp
|
||||
actions/savesettingsaction.cpp
|
||||
actions/setupactions.cpp
|
||||
actions/switchprofileaction.cpp
|
||||
actions/tempomatmodeapplycurrentpeedaction.cpp
|
||||
actions/updateswapfrontbackaction.cpp
|
||||
@ -324,7 +306,6 @@ set(BOBBY_SOURCES
|
||||
debuginputhandler.cpp
|
||||
debugtexthelpers.cpp
|
||||
displays/batterygraphdisplay.cpp
|
||||
displays/batteryinfodisplay.cpp
|
||||
displays/bmsdisplay.cpp
|
||||
displays/bobbychangevaluedisplay.cpp
|
||||
displays/bobbydisplay.cpp
|
||||
@ -333,6 +314,7 @@ set(BOBBY_SOURCES
|
||||
displays/bobbymenudisplay.cpp
|
||||
displays/bobbypopupdisplay.cpp
|
||||
displays/bobbysplitgraphdisplay.cpp
|
||||
displays/buttoncalibratedisplay.cpp
|
||||
displays/calibratevoltagedisplay.cpp
|
||||
displays/confiscationdisplay.cpp
|
||||
displays/gameoflifedisplay.cpp
|
||||
@ -387,7 +369,6 @@ set(BOBBY_SOURCES
|
||||
displays/menus/networksettingsmenu.cpp
|
||||
displays/menus/otamenu.cpp
|
||||
displays/menus/profilesmenu.cpp
|
||||
displays/menus/recoverymenu.cpp
|
||||
displays/menus/remotecontrolmodesettingsmenu.cpp
|
||||
displays/menus/selectbuildserverbranch.cpp
|
||||
displays/menus/selectbuildservermenu.cpp
|
||||
@ -417,20 +398,10 @@ set(BOBBY_SOURCES
|
||||
displays/qrcodedebug.cpp
|
||||
displays/qrdisplay.cpp
|
||||
displays/qrimportdisplay.cpp
|
||||
displays/rebootscreen.cpp
|
||||
displays/setup/ask_calibrate_other_buttons.cpp
|
||||
displays/setup/ask_setup_clouds.cpp
|
||||
displays/setup/basic_buttons.cpp
|
||||
displays/setup/calibrate_potis.cpp
|
||||
displays/setup/final_information.cpp
|
||||
displays/setup/information.cpp
|
||||
displays/setup/setup_cloud.cpp
|
||||
displays/speedinfodisplay.cpp
|
||||
displays/spirodisplay.cpp
|
||||
displays/starfielddisplay.cpp
|
||||
displays/statusdisplay.cpp
|
||||
displays/updatedisplay.cpp
|
||||
displays/xydebugdisplay.cpp
|
||||
dnsannounce.cpp
|
||||
dpad.cpp
|
||||
dpad3wire.cpp
|
||||
@ -441,7 +412,6 @@ set(BOBBY_SOURCES
|
||||
drivingstatistics.cpp
|
||||
espnowfunctions.cpp
|
||||
esptexthelpers.cpp
|
||||
feedbackemulator.cpp
|
||||
feedbackparser.cpp
|
||||
globals.cpp
|
||||
handbremse.cpp
|
||||
@ -488,7 +458,6 @@ set(BOBBY_SOURCES
|
||||
modes/tempomatmode.cpp
|
||||
modes/wheelchairmode.cpp
|
||||
mosfets.cpp
|
||||
motorpwmlimiter.cpp
|
||||
newsettings.cpp
|
||||
ota.cpp
|
||||
potis.cpp
|
||||
@ -500,8 +469,6 @@ set(BOBBY_SOURCES
|
||||
serial_bobby.cpp
|
||||
settingspersister.cpp
|
||||
settingsutils.cpp
|
||||
setup.cpp
|
||||
softpwmlimiter.cpp
|
||||
statistics.cpp
|
||||
statustexthelper.cpp
|
||||
taskmanager.cpp
|
||||
@ -527,16 +494,16 @@ set(BOBBY_SOURCES
|
||||
)
|
||||
|
||||
set(dependencies
|
||||
freertos nvs_flash esp_http_server esp_https_ota mdns app_update esp_system esp_websocket_client driver esp_adc
|
||||
freertos nvs_flash esp_http_server esp_https_ota mdns app_update esp_system esp_websocket_client driver
|
||||
arduino-esp32 ArduinoJson esp-nimble-cpp FastLED-idf TFT_eSPI QRCode-esp32
|
||||
bobbycar-protocol cpputils cxx-ring-buffer date sunset
|
||||
espasynchttpreq espasyncota espchrono espcpputils espconfiglib esp-gui-lib esphttpdutils espwifistack fmt
|
||||
espasynchttpreq espasyncota espchrono espcpputils espconfiglib esp-gui-lib esphttpdutils espwifistack expected fmt
|
||||
)
|
||||
|
||||
idf_component_register(
|
||||
SRCS
|
||||
${BOBBY_HEADERS}
|
||||
${BOBBY_SOURCES}
|
||||
${headers}
|
||||
${sources}
|
||||
INCLUDE_DIRS
|
||||
.
|
||||
REQUIRES
|
||||
@ -554,35 +521,13 @@ execute_process(
|
||||
COMMAND git rev-parse --abbrev-ref HEAD
|
||||
OUTPUT_VARIABLE GIT_BRANCH
|
||||
)
|
||||
execute_process(
|
||||
COMMAND git status --short
|
||||
OUTPUT_VARIABLE GIT_STATUS
|
||||
)
|
||||
|
||||
if (NOT GIT_STATUS STREQUAL "")
|
||||
set(GIT_STATUS "dirty")
|
||||
else()
|
||||
set(GIT_STATUS "clean")
|
||||
endif()
|
||||
|
||||
string(STRIP "${GIT_REV}" GIT_REV)
|
||||
string(SUBSTRING "${GIT_REV}" 1 7 GIT_SHORT_REV)
|
||||
string(STRIP "${GIT_MESSAGE}" GIT_MESSAGE)
|
||||
string(REPLACE "\n" " " GIT_MESSAGE "${GIT_MESSAGE}")
|
||||
string(REPLACE "\"" "\\\"" GIT_MESSAGE "${GIT_MESSAGE}")
|
||||
string(SUBSTRING "${GIT_MESSAGE}" 0 100 GIT_MESSAGE)
|
||||
string(STRIP "${GIT_BRANCH}" GIT_BRANCH)
|
||||
|
||||
message(WARNING "Git revision: ${GIT_REV}")
|
||||
message(WARNING "Git short revision: ${GIT_SHORT_REV}")
|
||||
message(WARNING "Git message: ${GIT_MESSAGE}")
|
||||
message(WARNING "Git branch: ${GIT_BRANCH}")
|
||||
message(WARNING "Git status: ${GIT_STATUS}")
|
||||
|
||||
if(NOT DEFINED BOBBY_DEFAULT_USERNAME)
|
||||
message(FATAL_ERROR "Please define BOBBY_DEFAULT_USERNAME")
|
||||
endif()
|
||||
|
||||
target_compile_options(${COMPONENT_TARGET}
|
||||
PRIVATE
|
||||
-fstack-reuse=all
|
||||
@ -596,6 +541,5 @@ target_compile_options(${COMPONENT_TARGET}
|
||||
-DGIT_SHORT_REV="${GIT_SHORT_REV}"
|
||||
-DGIT_MESSAGE="${GIT_MESSAGE}"
|
||||
-DGIT_BRANCH="${GIT_BRANCH}"
|
||||
-DBOBBY_DEFAULT_USERNAME="${BOBBY_DEFAULT_USERNAME}"
|
||||
${BOBBYCAR_BUILDFLAGS}
|
||||
)
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
// system includes
|
||||
#include <cstdint>
|
||||
#include <expected>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <accessorinterface.h>
|
||||
@ -20,7 +19,7 @@ struct RefAccessorSaveSettings : public virtual espgui::RefAccessor<T>
|
||||
espgui::RefAccessor<T>::setValue(value);
|
||||
|
||||
if (!saveProfileSettings())
|
||||
return std::unexpected("saveProfileSettings() failed!");
|
||||
return tl::make_unexpected("saveProfileSettings() failed!");
|
||||
|
||||
return {};
|
||||
};
|
||||
|
@ -1,8 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <expected>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <accessorinterface.h>
|
||||
|
||||
@ -32,7 +29,7 @@ struct NMotMaxKmhAccessor : public virtual espgui::AccessorInterface<int16_t>
|
||||
{
|
||||
profileSettings.limits.nMotMax = convertFromKmh(value);
|
||||
if (!saveProfileSettings())
|
||||
return std::unexpected("saveProfileSettings() failed!");
|
||||
return tl::make_unexpected("saveProfileSettings() failed!");
|
||||
return {};
|
||||
}
|
||||
};
|
||||
@ -42,14 +39,10 @@ struct PhaseAdvMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &
|
||||
|
||||
// Bluetooth Low Energy
|
||||
struct BleEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.bleSettings.bleEnabled; } };
|
||||
struct BleFenceEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.bleSettings.bleFenceEnabled; } };
|
||||
|
||||
// Cloud
|
||||
struct CloudEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.cloudSettings.cloudEnabled; } };
|
||||
struct CloudTransmitTimeoutAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.cloudSettings.cloudTransmitTimeout; } };
|
||||
struct CloudSendStatisticsAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.cloudSettings.sendStatistic; } };
|
||||
struct CloudURLAccessor : public NewSettingsAccessor<std::string> { ConfigWrapper<std::string> &getConfig() const override { return configs.cloudUrl; } };
|
||||
struct CloudKeyAccessor : public NewSettingsAccessor<std::string> { ConfigWrapper<std::string> &getConfig() const override { return configs.cloudSettings.cloudKey; } };
|
||||
|
||||
// Time
|
||||
//struct TimezoneOffsetAccessor : public NewSettingsAccessor<int32_t> { ConfigWrapper<int32_t> &getConfig() const override { return configs.timezoneOffset; } };
|
||||
@ -80,7 +73,7 @@ struct WheelDiameterInchAccessor : public virtual espgui::AccessorInterface<floa
|
||||
{
|
||||
// profileSettings.controllerHardware.wheelDiameter = convertFromInch(value);
|
||||
// if (!saveProfileSettings())
|
||||
// return std::unexpected("saveProfileSettings() failed!");
|
||||
// return tl::make_unexpected("saveProfileSettings() failed!");
|
||||
// return {};
|
||||
return configs.write_config(configs.controllerHardware.wheelDiameter, convertFromInch(value));
|
||||
}
|
||||
@ -132,13 +125,11 @@ struct CloudSendRateAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapp
|
||||
|
||||
struct UdpCloudSendIntervalAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.boardcomputerHardware.timersSettings.udpSendRateMs; } };
|
||||
struct UdpCloudEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.udpCloudSettings.udpCloudEnabled; } };
|
||||
struct UdpCloudDebugEnableAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.udpCloudSettings.enableCloudDebug; } };
|
||||
struct UdpCloudHostAccessor : public NewSettingsAccessor<std::string> { ConfigWrapper<std::string> &getConfig() const override { return configs.udpCloudSettings.udpCloudHost; } };
|
||||
struct UdpCloudPortAccessor : public NewSettingsAccessor<uint16_t> { ConfigWrapper<uint16_t> &getConfig() const override { return configs.udpCloudSettings.udpCloudPort; } };
|
||||
struct CloudDebugEnableAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.udpCloudSettings.enableCloudDebug; } };
|
||||
struct UdpUseStdStringAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.udpCloudSettings.udpUseStdString; } };
|
||||
|
||||
// DefaultMode
|
||||
struct DefaultModeModelModeAccessor : public RefAccessorSaveSettings<UnifiedModelMode> { UnifiedModelMode &getRef() const override { return profileSettings.defaultMode.modelMode; } };
|
||||
struct DefaultModeAllowRemoteControlAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return profileSettings.defaultMode.allowRemoteControl; } };
|
||||
struct DefaultModeSquareGasAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return profileSettings.defaultMode.squareGas; } };
|
||||
struct DefaultModeSquareBremsAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return profileSettings.defaultMode.squareBrems; } };
|
||||
|
||||
@ -208,9 +199,6 @@ struct LedstripEnableBlinkAnimationAccessor : public NewSettingsAccessor<bool> {
|
||||
struct LedstripOtaAnimationAccessor : public NewSettingsAccessor<OtaAnimationModes> { ConfigWrapper<OtaAnimationModes> &getConfig() const override { return configs.ledstrip.otaMode; } };
|
||||
struct LedstripEnableVisualizeBlinkAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableVisualizeBlink; } };
|
||||
struct LedstripAutomaticLightAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.automaticLight; } };
|
||||
struct LedstripBrakeLightUseAccelAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.brakeLights_useAccel; } };
|
||||
struct LedstripBrakeLightUsePowerAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.brakeLights_usePower; } };
|
||||
|
||||
|
||||
// Battery
|
||||
struct BatterySeriesCellsAccessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.battery.cellsSeries; } };
|
||||
@ -271,9 +259,5 @@ struct QuickActionExtra2Accessor : public NewSettingsAccessor<BobbyQuickActions>
|
||||
struct QuickActionExtra3Accessor : public NewSettingsAccessor<BobbyQuickActions> { ConfigWrapper<BobbyQuickActions> &getConfig() const override { return configs.quickActionExtra3; } };
|
||||
struct QuickActionExtra4Accessor : public NewSettingsAccessor<BobbyQuickActions> { ConfigWrapper<BobbyQuickActions> &getConfig() const override { return configs.quickActionExtra4; } };
|
||||
|
||||
// boardcomputer-hardware
|
||||
struct FlipScreenAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.boardcomputerHardware.flipScreen; } };
|
||||
|
||||
// Other
|
||||
struct AnhaengerIdAccessor : public NewSettingsAccessor<uint16_t> { ConfigWrapper<uint16_t> &getConfig() const override { return configs.anhaenger_id; } };
|
||||
struct UsernameAccessor : public NewSettingsAccessor<std::string> { ConfigWrapper<std::string> &getConfig() const override { return configs.otaUsername; } };
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
void triggered() override
|
||||
{
|
||||
if (auto result = configs.write_config(configs.ledstrip.animationType, type); !result)
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -32,6 +32,7 @@ private:
|
||||
std::string m_msg;
|
||||
};
|
||||
|
||||
template<typename TMenu>
|
||||
class PushQrImportDisplayAction : public virtual espgui::ActionInterface
|
||||
{
|
||||
public:
|
||||
@ -40,7 +41,7 @@ public:
|
||||
|
||||
void triggered() override
|
||||
{
|
||||
espgui::pushScreen<QrImportDisplay>(std::move(m_nvskey));
|
||||
espgui::pushScreen<QrImportDisplay<TMenu>>(std::move(m_nvskey));
|
||||
}
|
||||
private:
|
||||
std::string m_nvskey;
|
||||
|
22
main/actions/rebootaction.cpp
Normal file
22
main/actions/rebootaction.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "rebootaction.h"
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_system.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
|
||||
void RebootAction::triggered()
|
||||
{
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
espgui::tft.setTextColor(TFT_YELLOW);
|
||||
|
||||
espgui::tft.drawString("Reboot", 5, 5, 4);
|
||||
|
||||
espgui::tft.fillRect(0, 34, espgui::tft.width(), 3, TFT_WHITE);
|
||||
|
||||
espgui::tft.setTextColor(TFT_WHITE);
|
||||
espgui::tft.drawString("Rebooting now...", 0, 50, 4);
|
||||
|
||||
esp_restart();
|
||||
}
|
10
main/actions/rebootaction.h
Normal file
10
main/actions/rebootaction.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <actioninterface.h>
|
||||
|
||||
class RebootAction : public virtual espgui::ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override;
|
||||
};
|
@ -1,40 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <esp_system.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <actioninterface.h>
|
||||
#include <tftcolors.h>
|
||||
|
||||
// local includes
|
||||
#include "newsettings.h"
|
||||
|
||||
template<bool reboot>
|
||||
class ResetNVSAction : public virtual espgui::ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
if (reboot)
|
||||
{
|
||||
tft.fillScreen(espgui::TFT_BLACK);
|
||||
tft.setTextColor(espgui::TFT_YELLOW);
|
||||
|
||||
tft.drawString("Reboot", 5, 5, 4);
|
||||
|
||||
tft.fillRect(0, 34, tft.width(), 3, espgui::TFT_WHITE);
|
||||
|
||||
tft.setTextColor(espgui::TFT_WHITE);
|
||||
tft.drawString("Rebooting now...", 0, 50, 4);
|
||||
|
||||
configs.reset();
|
||||
|
||||
esp_restart();
|
||||
}
|
||||
else
|
||||
{
|
||||
configs.reset();
|
||||
}
|
||||
}
|
||||
};
|
@ -1,26 +0,0 @@
|
||||
#include "setupactions.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/setup/basic_buttons.h"
|
||||
#include "displays/setup/calibrate_potis.h"
|
||||
|
||||
PushButtonCalibrateDisplayAction::PushButtonCalibrateDisplayAction(const bool early_return) :
|
||||
m_early_return{early_return}
|
||||
{}
|
||||
|
||||
void PushButtonCalibrateDisplayAction::triggered()
|
||||
{
|
||||
espgui::pushScreen<SetupBasicButtonsDisplay>(m_early_return);
|
||||
}
|
||||
|
||||
PushPotiCalibrateDisplayAction::PushPotiCalibrateDisplayAction(const bool early_return) :
|
||||
m_early_return{early_return}
|
||||
{}
|
||||
|
||||
void PushPotiCalibrateDisplayAction::triggered()
|
||||
{
|
||||
// espgui::pushScreen<SetupCalibratePotisDisplay>(m_early_return); // commented out until implemented
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <actioninterface.h>
|
||||
|
||||
class PushButtonCalibrateDisplayAction : public virtual espgui::ActionInterface
|
||||
{
|
||||
public:
|
||||
explicit PushButtonCalibrateDisplayAction(bool early_return);
|
||||
|
||||
void triggered() override;
|
||||
private:
|
||||
const bool m_early_return;
|
||||
};
|
||||
|
||||
class PushPotiCalibrateDisplayAction : public virtual espgui::ActionInterface
|
||||
{
|
||||
public:
|
||||
explicit PushPotiCalibrateDisplayAction(bool early_return);
|
||||
|
||||
void triggered() override;
|
||||
private:
|
||||
const bool m_early_return;
|
||||
};
|
@ -6,11 +6,11 @@
|
||||
// 3rdparty lib includes
|
||||
#include <ArduinoJson.h>
|
||||
#include <wifi_bobbycar.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "ledstrip.h"
|
||||
#include "globals.h"
|
||||
#include "modes/defaultmode.h"
|
||||
#include "modes/remotecontrolmode.h"
|
||||
#include "utils.h"
|
||||
#include "newsettings.h"
|
||||
@ -21,19 +21,19 @@ constexpr const char * const TAG = "BOBBYBLE";
|
||||
class RemoteControlCallbacks : public NimBLECharacteristicCallbacks
|
||||
{
|
||||
public:
|
||||
void onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) override;
|
||||
void onWrite(NimBLECharacteristic* pCharacteristic) override;
|
||||
};
|
||||
|
||||
class WirelessSettingsCallbacks : public NimBLECharacteristicCallbacks
|
||||
{
|
||||
public:
|
||||
void onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) override;
|
||||
void onWrite(NimBLECharacteristic* pCharacteristic) override;
|
||||
};
|
||||
|
||||
class WiFiListCallbacks : public NimBLECharacteristicCallbacks
|
||||
{
|
||||
public:
|
||||
void onRead(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) override;
|
||||
void onRead(NimBLECharacteristic* pCharacteristic) override;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
@ -55,20 +55,14 @@ void createBle()
|
||||
{
|
||||
ESP_LOGI("BOBBY", "called");
|
||||
|
||||
NimBLEDevice::init(configs.bluetoothName.value());
|
||||
BLEDevice::init(configs.bluetoothName.value());
|
||||
|
||||
const auto serviceUuid{"0335e46c-f355-4ce6-8076-017de08cee98"};
|
||||
|
||||
ESP_LOGI(TAG, "Creating BLE server");
|
||||
|
||||
pServer = NimBLEDevice::createServer();
|
||||
|
||||
ESP_LOGI(TAG, "Creating BLE service");
|
||||
pServer = BLEDevice::createServer();
|
||||
|
||||
pService = pServer->createService(serviceUuid);
|
||||
|
||||
ESP_LOGI(TAG, "Creating BLE characteristics");
|
||||
|
||||
livestatsCharacteristic = pService->createCharacteristic("a48321ea-329f-4eab-a401-30e247211524", NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::NOTIFY);
|
||||
remotecontrolCharacteristic = pService->createCharacteristic("4201def0-a264-43e6-946b-6b2d9612dfed", NIMBLE_PROPERTY::WRITE);
|
||||
remotecontrolCharacteristic->setCallbacks(&bleRemoteCallbacks);
|
||||
@ -78,23 +72,19 @@ void createBle()
|
||||
getwifilist = pService->createCharacteristic("4201def2-a264-43e6-946b-6b2d9612dfed", NIMBLE_PROPERTY::READ);
|
||||
getwifilist->setCallbacks(&bleWiFiListCallbacks);
|
||||
|
||||
ESP_LOGI(TAG, "Starting BLE service");
|
||||
|
||||
pService->start();
|
||||
|
||||
ESP_LOGI(TAG, "Starting BLE advertising");
|
||||
|
||||
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
|
||||
BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
|
||||
pAdvertising->addServiceUUID(serviceUuid);
|
||||
pAdvertising->setScanResponse(true);
|
||||
NimBLEDevice::startAdvertising();
|
||||
BLEDevice::startAdvertising();
|
||||
}
|
||||
|
||||
void destroyBle()
|
||||
{
|
||||
ESP_LOGI("BOBBY", "called");
|
||||
|
||||
NimBLEDevice::deinit(true);
|
||||
BLEDevice::deinit(true);
|
||||
|
||||
pServer = {};
|
||||
pService = {};
|
||||
@ -236,9 +226,9 @@ void handleBle()
|
||||
|
||||
namespace {
|
||||
|
||||
void RemoteControlCallbacks::onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo)
|
||||
void RemoteControlCallbacks::onWrite(NimBLECharacteristic* pCharacteristic)
|
||||
{
|
||||
const std::string& val = pCharacteristic->getValue();
|
||||
const auto &val = pCharacteristic->getValue();
|
||||
|
||||
StaticJsonDocument<256> doc;
|
||||
if (const auto error = deserializeJson(doc, val))
|
||||
@ -257,20 +247,18 @@ void RemoteControlCallbacks::onWrite(NimBLECharacteristic* pCharacteristic, NimB
|
||||
|
||||
if (!simplified)
|
||||
{
|
||||
RemoteCommand cmd {
|
||||
modes::remoteControlMode.setCommand(RemoteCommand{
|
||||
.frontLeft = doc[isInverted ? "fr":"fl"].as<int16_t>(),
|
||||
.frontRight = doc[isInverted ? "fl":"fr"].as<int16_t>(),
|
||||
.backLeft = doc["bl"].as<int16_t>(),
|
||||
.backRight = doc["br"].as<int16_t>()
|
||||
};
|
||||
modes::defaultMode.setRemoteCommand(cmd);
|
||||
modes::remoteControlMode.setRemoteCommand(cmd);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void WirelessSettingsCallbacks::onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo)
|
||||
void WirelessSettingsCallbacks::onWrite(NimBLECharacteristic* pCharacteristic)
|
||||
{
|
||||
const std::string& val = pCharacteristic->getValue();
|
||||
const auto &val = pCharacteristic->getValue();
|
||||
|
||||
StaticJsonDocument<256> doc;
|
||||
if (const auto error = deserializeJson(doc, val))
|
||||
@ -283,7 +271,7 @@ void WirelessSettingsCallbacks::onWrite(NimBLECharacteristic* pCharacteristic, N
|
||||
|
||||
if (write_type == "wifi") {
|
||||
const int index = doc["wifi_index"].as<int>();
|
||||
ESP_LOGI(TAG, "Set wifi%i: WiFi-SSID: %s, WiFi-Password: ***", doc["wifi_index"].as<int>(), doc["wifi_ssid"].as<const char*>());
|
||||
ESP_LOGI(TAG, "[ble_config]: Set wifi%i: WiFi-SSID: %s, WiFi-Password: ***", doc["wifi_index"].as<int>(), doc["wifi_ssid"].as<const char*>());
|
||||
configs.write_config(configs.wifi_configs[index].ssid, doc["wifi_ssid"].as<std::string>());
|
||||
configs.write_config(configs.wifi_configs[index].key, doc["wifi_pass"].as<std::string>());
|
||||
} else {
|
||||
@ -292,11 +280,11 @@ void WirelessSettingsCallbacks::onWrite(NimBLECharacteristic* pCharacteristic, N
|
||||
}
|
||||
}
|
||||
|
||||
void WiFiListCallbacks::onRead(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo)
|
||||
void WiFiListCallbacks::onRead(NimBLECharacteristic *pCharacteristic)
|
||||
{
|
||||
StaticJsonDocument<768> responseDoc;
|
||||
auto wifiArray = responseDoc.createNestedArray("wifis");
|
||||
ESP_LOGI(TAG, "Got request for listing wifi ssids.");
|
||||
ESP_LOGI(TAG, "[ble_wifilist] Got request for listing wifi ssids.");
|
||||
for (const auto &wifi : configs.wifi_configs)
|
||||
{
|
||||
wifiArray.add(wifi.ssid.value());
|
||||
|
@ -13,10 +13,3 @@ extern BLECharacteristic *getwifilist;
|
||||
void initBle();
|
||||
|
||||
void handleBle();
|
||||
|
||||
struct RemoteCommand {
|
||||
int16_t frontLeft{};
|
||||
int16_t frontRight{};
|
||||
int16_t backLeft{};
|
||||
int16_t backRight{};
|
||||
};
|
||||
|
@ -60,18 +60,23 @@ namespace bobbyblinker {
|
||||
}
|
||||
if (configs.ledstrip.enableBrakeLights.value() && espchrono::ago(*brake_last_time_sent) > 500ms)
|
||||
{
|
||||
if (brakeLightsStatus == brakeLightsOffSent)
|
||||
float avgPwm{};
|
||||
for (const Controller &controller: controllers) {
|
||||
avgPwm +=
|
||||
controller.command.left.pwm * (controller.invertLeft ? -1 : 1) +
|
||||
controller.command.right.pwm * (controller.invertRight ? -1 : 1);
|
||||
}
|
||||
avgPwm /= 4;
|
||||
|
||||
if (avgPwm < -1.f)
|
||||
{
|
||||
if (brakeLightsStatus)
|
||||
{
|
||||
sendState("BRAKELIGHTSON");
|
||||
brakeLightsOffSent = false;
|
||||
}
|
||||
else if (!brakeLightsOffSent)
|
||||
{
|
||||
sendState("BRAKELIGHTSOFF");
|
||||
brakeLightsOffSent = true;
|
||||
}
|
||||
sendState("BRAKELIGHTSON");
|
||||
brakeLightsOffSent = false;
|
||||
}
|
||||
else if (!brakeLightsOffSent && avgPwm > -1.f)
|
||||
{
|
||||
sendState("BRAKELIGHTSOFF");
|
||||
brakeLightsOffSent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,9 @@
|
||||
// local includes
|
||||
#include "newsettings.h"
|
||||
#include "settingsutils.h"
|
||||
#include "modes/defaultmode.h"
|
||||
#include "ledstripdefines.h"
|
||||
#include "ledstrip.h"
|
||||
|
||||
#include "bobbyquickactions.h"
|
||||
|
||||
@ -110,7 +112,6 @@ void buttonReleasedCommon(espgui::Button button)
|
||||
|
||||
void BobbyButtons::rawButtonPressed(uint8_t button)
|
||||
{
|
||||
ESP_LOGI(TAG, "%hhu", button);
|
||||
//Base::rawButtonPressed(button);
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonPressed(*translated);
|
||||
@ -118,7 +119,6 @@ void BobbyButtons::rawButtonPressed(uint8_t button)
|
||||
|
||||
void BobbyButtons::rawButtonReleased(uint8_t button)
|
||||
{
|
||||
ESP_LOGI(TAG, "%hhu", button);
|
||||
//Base::rawButtonReleased(button);
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonReleased(*translated);
|
||||
|
@ -21,8 +21,7 @@ enum BobbyButton
|
||||
Extra3,
|
||||
Extra4,
|
||||
Confirm = espgui::Button::Right,
|
||||
Back = espgui::Button::Left,
|
||||
ButtonMax = Back
|
||||
Back = espgui::Button::Left
|
||||
};
|
||||
|
||||
[[nodiscard]] std::optional<espgui::Button> translateRawButton(uint8_t button);
|
||||
|
@ -6,11 +6,9 @@
|
||||
// local includes
|
||||
#include "displays/bobbypopupdisplay.h"
|
||||
|
||||
void BobbyErrorHandler::errorOccurred(std::string &&error)
|
||||
void BobbyErrorHandler::errorOccured(std::string &&error)
|
||||
{
|
||||
espgui::changeScreenCallback = [error_ = std::move(error)](espgui::TftInterface &tft) mutable {
|
||||
auto newDisplay = std::make_unique<BobbyPopupDisplay>(std::move(error_), std::move(espgui::currentDisplay));
|
||||
newDisplay->initOverlay(tft);
|
||||
espgui::currentDisplay = std::move(newDisplay);
|
||||
};
|
||||
auto newDisplay = std::make_unique<BobbyPopupDisplay>(std::move(error), std::move(espgui::currentDisplay));
|
||||
newDisplay->initOverlay();
|
||||
espgui::currentDisplay = std::move(newDisplay);
|
||||
}
|
||||
|
@ -5,5 +5,5 @@
|
||||
|
||||
struct BobbyErrorHandler : public virtual espgui::ErrorHandlerInterface
|
||||
{
|
||||
void errorOccurred(std::string &&error) override;
|
||||
void errorOccured(std::string &&error) override;
|
||||
};
|
||||
|
@ -95,9 +95,6 @@ void open_garage()
|
||||
return;
|
||||
for (const auto &config : configs.wireless_door_configs)
|
||||
{
|
||||
if (config.doorId.value().empty() || config.doorToken.value().empty())
|
||||
continue;
|
||||
|
||||
if (const auto error = espnow::send_espnow_message(fmt::format("BOBBYOPEN:{}:{}", config.doorId.value(), config.doorToken.value())); error != ESP_OK)
|
||||
{
|
||||
ESP_LOGE("BOBBY", "send_espnow_message() failed with: %s", esp_err_to_name(error));
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <buttonsinterface.h>
|
||||
#include <cpptypesafeenum.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbytypesafeenum.h"
|
||||
#include "bobbybuttons.h"
|
||||
|
||||
#define BobbyQuickActionsValues(x) \
|
||||
@ -18,7 +18,7 @@
|
||||
x(HUPE) \
|
||||
x(COMPRESSOR_TOGGLE)
|
||||
|
||||
DECLARE_BOBBYTYPESAFE_ENUM(BobbyQuickActions, : uint8_t, BobbyQuickActionsValues)
|
||||
DECLARE_TYPESAFE_ENUM(BobbyQuickActions, : uint8_t, BobbyQuickActionsValues)
|
||||
|
||||
namespace quickactions {
|
||||
|
||||
|
@ -3,42 +3,11 @@
|
||||
// 3rdparty lib includes
|
||||
#include <schedulertask.h>
|
||||
|
||||
#include <esp_log.h>
|
||||
|
||||
class BobbySchedulerTask : public espcpputils::SchedulerTask {
|
||||
public:
|
||||
// using SchedulerTask::SchedulerTask; -> we need to add one more parameter
|
||||
BobbySchedulerTask(const char *name, void (&setupCallback)(), void (&loopCallback)(),
|
||||
espchrono::millis_clock::duration loopInterval, bool use_in_recovery = false,
|
||||
bool intervalImportant = false,
|
||||
std::string (*perfInfo)() = nullptr) :
|
||||
espcpputils::SchedulerTask(name, setupCallback, loopCallback, loopInterval, intervalImportant, perfInfo),
|
||||
m_use_in_recovery{use_in_recovery}
|
||||
{
|
||||
}
|
||||
void setup(bool in_recovery = false)
|
||||
{
|
||||
m_in_recovery = in_recovery;
|
||||
if (in_recovery && !m_use_in_recovery)
|
||||
{
|
||||
ESP_LOGI("BobbySchedulerTask", "Skipping setup of %s (%s)", name(), m_use_in_recovery ? "use in recovery" : "no use in recovery");
|
||||
return;
|
||||
}
|
||||
SchedulerTask::setup();
|
||||
m_wasInitialized = true;
|
||||
ESP_LOGI("BobbySchedulerTask", "Task %s initialized", name());
|
||||
}
|
||||
void loop()
|
||||
{
|
||||
if (!m_in_recovery || m_use_in_recovery)
|
||||
{
|
||||
// ESP_LOGI("BobbySchedulerTask", "Loop %s", name());
|
||||
SchedulerTask::loop();
|
||||
}
|
||||
}
|
||||
using SchedulerTask::SchedulerTask;
|
||||
void setup() const { SchedulerTask::setup(); m_wasInitialized = true; }
|
||||
bool isInitialized() const { return m_wasInitialized; }
|
||||
private:
|
||||
mutable bool m_wasInitialized{false};
|
||||
const bool m_use_in_recovery;
|
||||
bool m_in_recovery{false};
|
||||
};
|
||||
|
@ -155,7 +155,7 @@ namespace buildserver {
|
||||
|
||||
std::string get_hash_url(std::string hash)
|
||||
{
|
||||
return fmt::format("{}{}.bin", url_for_hashes, hash);
|
||||
return fmt::format(url_for_hashes, hash);
|
||||
}
|
||||
|
||||
std::string get_latest_url()
|
||||
@ -197,7 +197,7 @@ namespace buildserver {
|
||||
index = 0;
|
||||
|
||||
url_for_latest = fmt::format("{}{}", configs.otaServerUrl.value(), doc["latest"].as<std::string>());
|
||||
url_for_hashes = fmt::format("{}{}", configs.otaServerUrl.value(), doc["new_url"].as<std::string>());
|
||||
url_for_hashes = fmt::format("{}{}", configs.otaServerUrl.value(), doc["url"].as<std::string>());
|
||||
parsing_finished = true;
|
||||
}
|
||||
|
||||
|
91
main/can.cpp
91
main/can.cpp
@ -4,7 +4,6 @@
|
||||
// system includes
|
||||
#include <cstring>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
// esp-idf
|
||||
#include <driver/twai.h>
|
||||
@ -15,6 +14,7 @@
|
||||
#include <espchrono.h>
|
||||
#include <tickchrono.h>
|
||||
#include <screenmanager.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbycar-can.h"
|
||||
@ -82,11 +82,6 @@ void initCan()
|
||||
|
||||
void updateCan()
|
||||
{
|
||||
if (configs.emulateFeedback.value())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
if (!tryParseCanInput())
|
||||
break;
|
||||
@ -166,18 +161,6 @@ bool parseMotorControllerCanMessage(const twai_message_t &message, Controller &c
|
||||
case MotorController<isBack, true>::Feedback::Temp:
|
||||
controller.feedback.boardTemp = *((int16_t*)message.data);
|
||||
return true;
|
||||
case MotorController<isBack, false>::Feedback::Id:
|
||||
controller.feedback.left.id = *((int16_t*)message.data);
|
||||
return true;
|
||||
case MotorController<isBack, true>::Feedback::Id:
|
||||
controller.feedback.right.id = *((int16_t*)message.data);
|
||||
return true;
|
||||
case MotorController<isBack, false>::Feedback::Iq:
|
||||
controller.feedback.left.iq = *((int16_t*)message.data);
|
||||
return true;
|
||||
case MotorController<isBack, true>::Feedback::Iq:
|
||||
controller.feedback.right.iq = *((int16_t*)message.data);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -270,7 +253,7 @@ bool tryParseCanInput()
|
||||
if (parseBoardcomputerCanMessage(message))
|
||||
return true;
|
||||
|
||||
ESP_LOGW(TAG, "Unknown CAN info received .identifier = %lu", message.identifier);
|
||||
ESP_LOGW(TAG, "Unknown CAN info received .identifier = %u", message.identifier);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -282,9 +265,6 @@ void sendCanCommands()
|
||||
static uint32_t can_sequential_error_cnt = 0;
|
||||
static uint32_t can_sequential_bus_errors = 0;
|
||||
|
||||
if (!configs.controllerHardware.sendFrontCanCmd.value() && !configs.controllerHardware.sendBackCanCmd.value())
|
||||
return;
|
||||
|
||||
constexpr auto send = [](uint32_t addr, auto value){
|
||||
twai_message_t message;
|
||||
twai_status_info_t status_info;
|
||||
@ -301,24 +281,22 @@ void sendCanCommands()
|
||||
const auto status = twai_get_status_info(&status_info);
|
||||
const auto timestamp_after = espchrono::millis_clock::now();
|
||||
|
||||
if ((result == ESP_ERR_TIMEOUT || status_info.state == TWAI_STATE_BUS_OFF) ||
|
||||
(status == ESP_OK && status_info.bus_error_count > can_sequential_bus_errors))
|
||||
if ((result == ESP_ERR_TIMEOUT || status_info.state == TWAI_STATE_BUS_OFF) || (status == ESP_OK && status_info.bus_error_count > can_sequential_bus_errors))
|
||||
{
|
||||
++can_sequential_error_cnt;
|
||||
++can_total_error_cnt;
|
||||
can_sequential_bus_errors = status_info.bus_error_count;
|
||||
|
||||
if (can_total_error_cnt < 500 && (configs.canUninstallOnReset.value() && can_total_error_cnt < 100))
|
||||
ESP_LOGW(TAG, "twai_transmit() failed after %lldms with %s, seq err: %lu, total err: %lu",
|
||||
std::chrono::floor<std::chrono::milliseconds>(timestamp_after - timestamp_before).count(),
|
||||
esp_err_to_name(result),
|
||||
can_sequential_error_cnt,
|
||||
can_total_error_cnt);
|
||||
ESP_LOGW(TAG, "twai_transmit() failed after %lldms with %s, seq err: %d, total err: %d",
|
||||
(timestamp_after - timestamp_before).count(),
|
||||
esp_err_to_name(result),
|
||||
can_sequential_error_cnt,
|
||||
can_total_error_cnt);
|
||||
}
|
||||
else if (result != ESP_OK)
|
||||
{
|
||||
ESP_LOGE(TAG, "twai_transmit() failed after %lldms with %s",
|
||||
std::chrono::floor<std::chrono::milliseconds>(timestamp_after - timestamp_before).count(),
|
||||
ESP_LOGD(TAG, "ERROR: twai_transmit() failed after %lldms with %s",
|
||||
(timestamp_after - timestamp_before).count(),
|
||||
esp_err_to_name(result));
|
||||
}
|
||||
else
|
||||
@ -332,28 +310,28 @@ void sendCanCommands()
|
||||
can_sequential_error_cnt = 0;
|
||||
if (configs.canResetOnError.value())
|
||||
{
|
||||
ESP_LOGW(TAG, "Something isn't right, trying to restart can ic...");
|
||||
ESP_LOGW(TAG, "WARNING: Something isn't right, trying to restart can ic...");
|
||||
if (const auto err = twai_stop(); err != ESP_OK)
|
||||
{
|
||||
ESP_LOGE(TAG, "twai_stop() failed with %s", esp_err_to_name(err));
|
||||
ESP_LOGE(TAG, "ERROR: twai_stop() failed with %s", esp_err_to_name(err));
|
||||
}
|
||||
|
||||
if (configs.canUninstallOnReset.value())
|
||||
{
|
||||
if (const auto err = twai_driver_uninstall(); err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "twai_driver_uninstall() failed with %s", esp_err_to_name(err));
|
||||
ESP_LOGE(TAG, "ERROR: twai_driver_uninstall() failed with %s", esp_err_to_name(err));
|
||||
}
|
||||
twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(GPIO_NUM_21, GPIO_NUM_22,
|
||||
TWAI_MODE_NORMAL);
|
||||
twai_timing_config_t t_config = TWAI_TIMING_CONFIG_250KBITS();
|
||||
twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL();
|
||||
if (const auto err = twai_driver_install(&g_config, &t_config, &f_config); err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "twai_driver_install() failed with %s", esp_err_to_name(err));
|
||||
ESP_LOGE(TAG, "ERROR: twai_driver_install() failed with %s", esp_err_to_name(err));
|
||||
}
|
||||
}
|
||||
if (const auto err = twai_start(); err != ESP_OK)
|
||||
{
|
||||
ESP_LOGE(TAG, "twai_start() failed with %s", esp_err_to_name(err));
|
||||
ESP_LOGE(TAG, "ERROR: twai_start() failed with %s", esp_err_to_name(err));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -393,33 +371,18 @@ void sendCanCommands()
|
||||
|
||||
static struct {
|
||||
struct {
|
||||
struct {
|
||||
int16_t nCruiseMotTgt{};
|
||||
bool cruiseCtrlEna{};
|
||||
} left, right;
|
||||
uint8_t freq{};
|
||||
uint8_t pattern{};
|
||||
uint8_t freq = 0;
|
||||
uint8_t pattern = 0;
|
||||
} front, back;
|
||||
std::underlying_type_t<Boardcomputer::Button> buttonLeds{};
|
||||
} lastValues;
|
||||
|
||||
static int i{};
|
||||
|
||||
// anti aufklatsch when tempomat
|
||||
if ((front && front->command.left.nCruiseMotTgt != lastValues.front.left.nCruiseMotTgt) ||
|
||||
(front && front->command.right.nCruiseMotTgt != lastValues.front.right.nCruiseMotTgt) ||
|
||||
(back && back->command.left.nCruiseMotTgt != lastValues.back.left.nCruiseMotTgt) ||
|
||||
(back && back->command.right.nCruiseMotTgt != lastValues.back.right.nCruiseMotTgt))
|
||||
i = 8;
|
||||
else if ((front && front->command.left.cruiseCtrlEna != lastValues.front.left.cruiseCtrlEna) ||
|
||||
(front && front->command.right.cruiseCtrlEna != lastValues.front.right.cruiseCtrlEna) ||
|
||||
(back && back->command.left.cruiseCtrlEna != lastValues.back.left.cruiseCtrlEna) ||
|
||||
(back && back->command.right.cruiseCtrlEna != lastValues.back.right.cruiseCtrlEna))
|
||||
i = 9;
|
||||
else if ((front && front->command.buzzer.freq != lastValues.front.freq ) ||
|
||||
(front && front->command.buzzer.pattern != lastValues.front.pattern ) ||
|
||||
(back && back->command.buzzer.freq != lastValues.back.freq) ||
|
||||
(back && back->command.buzzer.pattern != lastValues.back.pattern))
|
||||
if ((front && front->command.buzzer.freq != lastValues.front.freq ) ||
|
||||
(front && front->command.buzzer.pattern != lastValues.front.pattern ) ||
|
||||
(back && back->command.buzzer.freq != lastValues.back.freq) ||
|
||||
(back && back->command.buzzer.pattern != lastValues.back.pattern))
|
||||
i = 10;
|
||||
else if (buttonLeds != lastValues.buttonLeds)
|
||||
i = 12;
|
||||
@ -494,17 +457,17 @@ void sendCanCommands()
|
||||
if (back) send(MotorController<true, true>::Command::PhaseAdvMax, back->command.right.phaseAdvMax);
|
||||
break;
|
||||
case 8:
|
||||
if (front) send(MotorController<false, false>::Command::CruiseMotTgt, front->command.left.nCruiseMotTgt);
|
||||
if (front) send(MotorController<false, true>::Command::CruiseMotTgt, front->command.right.nCruiseMotTgt);
|
||||
if (back) send(MotorController<true, false>::Command::CruiseMotTgt, back->command.left.nCruiseMotTgt);
|
||||
if (back) send(MotorController<true, true>::Command::CruiseMotTgt, back->command.right.nCruiseMotTgt);
|
||||
break;
|
||||
case 9:
|
||||
if (front) send(MotorController<false, false>::Command::CruiseCtrlEna, front->command.left.cruiseCtrlEna);
|
||||
if (front) send(MotorController<false, true>::Command::CruiseCtrlEna, front->command.right.cruiseCtrlEna);
|
||||
if (back) send(MotorController<true, false>::Command::CruiseCtrlEna, back->command.left.cruiseCtrlEna);
|
||||
if (back) send(MotorController<true, true>::Command::CruiseCtrlEna, back->command.right.cruiseCtrlEna);
|
||||
break;
|
||||
case 9:
|
||||
if (front) send(MotorController<false, false>::Command::CruiseMotTgt, front->command.left.nCruiseMotTgt);
|
||||
if (front) send(MotorController<false, true>::Command::CruiseMotTgt, front->command.right.nCruiseMotTgt);
|
||||
if (back) send(MotorController<true, false>::Command::CruiseMotTgt, back->command.left.nCruiseMotTgt);
|
||||
if (back) send(MotorController<true, true>::Command::CruiseMotTgt, back->command.right.nCruiseMotTgt);
|
||||
break;
|
||||
case 10:
|
||||
if (front && send(MotorController<false, false>::Command::BuzzerFreq, front->command.buzzer.freq) == ESP_OK)
|
||||
lastValues.front.freq = front->command.buzzer.freq;
|
||||
|
@ -1,8 +1,5 @@
|
||||
#include "changevaluedisplay_bobbyquickactions.h"
|
||||
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
@ -10,6 +7,7 @@
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
@ -1,8 +1,5 @@
|
||||
#include "changevaluedisplay_controlmode.h"
|
||||
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
@ -10,6 +7,7 @@
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
@ -1,8 +1,5 @@
|
||||
#include "changevaluedisplay_controltype.h"
|
||||
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
@ -10,6 +7,7 @@
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
@ -1,8 +1,5 @@
|
||||
#include "changevaluedisplay_handbremsmode.h"
|
||||
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
@ -10,6 +7,7 @@
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
@ -1,8 +1,5 @@
|
||||
#include "changevaluedisplay_larsmmode_mode.h"
|
||||
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
@ -10,6 +7,7 @@
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
@ -1,8 +1,5 @@
|
||||
#include "changevaluedisplay_unifiedmodelmode.h"
|
||||
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
@ -10,6 +7,7 @@
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
1035
main/cloud.cpp
1035
main/cloud.cpp
File diff suppressed because it is too large
Load Diff
@ -7,9 +7,6 @@
|
||||
#include <wrappers/websocket_client.h>
|
||||
#include <espchrono.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbytypesafeenum.h"
|
||||
|
||||
extern espcpputils::websocket_client cloudClient;
|
||||
extern bool cloudStarted;
|
||||
extern espchrono::millis_clock::time_point lastCreateTry;
|
||||
@ -24,5 +21,3 @@ void initCloud();
|
||||
void updateCloud();
|
||||
void cloudCollect();
|
||||
void cloudSend();
|
||||
|
||||
std::string getLoginMessage();
|
||||
|
@ -6,13 +6,12 @@
|
||||
|
||||
// local includes
|
||||
#include "battery.h"
|
||||
#include "bobbyquickactions.h"
|
||||
#include "cloud.h"
|
||||
#include "handbremse.h"
|
||||
#include "ledstrip.h"
|
||||
#include "handbremse.h"
|
||||
#include "bobbyquickactions.h"
|
||||
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(BatteryCellType)
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(BobbyQuickActions)
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(OtaAnimationModes)
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(HandbremseMode)
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(LedstripAnimation)
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(OtaAnimationModes)
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(BobbyQuickActions)
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(BatteryCellType)
|
||||
|
@ -4,8 +4,8 @@
|
||||
#define CONFIGWRAPPER_TOSTRING_USINGS using ::toString;
|
||||
#include <configwrapper_priv.h>
|
||||
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(BatteryCellType)
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(BobbyQuickActions)
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(OtaAnimationModes)
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(HandbremseMode)
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(LedstripAnimation)
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(OtaAnimationModes)
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(BobbyQuickActions)
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(BatteryCellType)
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <esp32-hal-gpio.h>
|
||||
#include <screenmanager.h>
|
||||
#include <changevaluedisplay.h>
|
||||
@ -116,7 +117,7 @@ void handleNormalChar(char c)
|
||||
{
|
||||
case 'i':
|
||||
case 'I':
|
||||
tft.init();
|
||||
espgui::tft.init();
|
||||
break;
|
||||
case 'p':
|
||||
case 'P':
|
||||
|
@ -77,8 +77,6 @@ private:
|
||||
struct DcPhaCFixedText : public virtual TextInterface { public: std::string text() const override { std::string line{"dcPhaC: "}; if (controller::get().feedbackValid) line += fmt::format("{:.2f}A", fixCurrent(MotorFeedbackGetter::get().dcPhaC)); return line; } };
|
||||
struct ChopsText : public virtual TextInterface { public: std::string text() const override { std::string line{"chops: "}; if (controller::get().feedbackValid) line += std::to_string(MotorFeedbackGetter::get().chops); return line; } };
|
||||
struct HallText : public virtual TextInterface { public: std::string text() const override { std::string line{"hall: "}; if (controller::get().feedbackValid) line += hallString(MotorFeedbackGetter::get()); return line; } };
|
||||
struct IdText : public virtual TextInterface { public: std::string text() const override { std::string line{"id: "}; if (controller::get().feedbackValid) line += fmt::format("{:.2f}A", fixCurrent(MotorFeedbackGetter::get().id)); return line; } };
|
||||
struct IqText : public virtual TextInterface { public: std::string text() const override { std::string line{"iq: "}; if (controller::get().feedbackValid) line += fmt::format("{:.2f}A", fixCurrent(MotorFeedbackGetter::get().iq)); return line; } };
|
||||
};
|
||||
|
||||
public:
|
||||
|
@ -3,7 +3,7 @@ constexpr const char * const TAG = "BatteryGraphDisplay";
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <screenmanager.h>
|
||||
#include <tftcolors.h>
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "battery.h"
|
||||
@ -18,13 +18,13 @@ namespace {
|
||||
constexpr const uint8_t TOP_OFFSET = 40;
|
||||
} // namespace
|
||||
|
||||
void BatteryGraphDisplay::initScreen(espgui::TftInterface &tft)
|
||||
void BatteryGraphDisplay::initScreen()
|
||||
{
|
||||
Base::initScreen(tft);
|
||||
drawBatteryCurve(tft);
|
||||
Base::initScreen();
|
||||
drawBatteryCurve();
|
||||
}
|
||||
|
||||
std::string BatteryGraphDisplay::title() const
|
||||
std::string BatteryGraphDisplay::text() const
|
||||
{
|
||||
if (const auto avgVoltage = controllers.getAvgVoltage(); avgVoltage)
|
||||
{
|
||||
@ -33,10 +33,10 @@ std::string BatteryGraphDisplay::title() const
|
||||
return TEXT_BATTERY_GRAPH;
|
||||
}
|
||||
|
||||
void BatteryGraphDisplay::redraw(espgui::TftInterface &tft)
|
||||
void BatteryGraphDisplay::redraw()
|
||||
{
|
||||
using namespace espgui;
|
||||
Base::redraw(tft);
|
||||
Base::redraw();
|
||||
|
||||
if (const auto avgVoltage = controllers.getAvgVoltage(); avgVoltage)
|
||||
{
|
||||
@ -50,10 +50,10 @@ void BatteryGraphDisplay::redraw(espgui::TftInterface &tft)
|
||||
const uint16_t lastXOffset = onePercent * (100 - getBatteryPercentage(m_lastBatVoltage, cellType));
|
||||
|
||||
// clear the old one and draw the new one
|
||||
tft.fillRect(lastXOffset + 2, TOP_OFFSET, onePercent, tft.height() - TOP_OFFSET, espgui::TFT_BLACK);
|
||||
tft.fillRect(xOffset + 2, TOP_OFFSET, onePercent, tft.height() - TOP_OFFSET, espgui::TFT_WHITE);
|
||||
tft.fillRect(lastXOffset + 2, TOP_OFFSET, onePercent, tft.height() - TOP_OFFSET, TFT_BLACK);
|
||||
tft.fillRect(xOffset + 2, TOP_OFFSET, onePercent, tft.height() - TOP_OFFSET, TFT_WHITE);
|
||||
m_lastBatVoltage = *avgVoltage;
|
||||
drawBatteryCurve(tft);
|
||||
drawBatteryCurve();
|
||||
}
|
||||
// tft.drawLine() code
|
||||
}
|
||||
@ -73,11 +73,11 @@ void BatteryGraphDisplay::buttonPressed(espgui::Button button)
|
||||
}
|
||||
}
|
||||
|
||||
void BatteryGraphDisplay::drawBatteryCurve(espgui::TftInterface &tft)
|
||||
void BatteryGraphDisplay::drawBatteryCurve()
|
||||
{
|
||||
const auto points = count_curve_points(configs.battery.cellType.value());
|
||||
const auto max_height = tft.height() - 1;
|
||||
const auto max_width = tft.width() - 4;
|
||||
const auto max_height = espgui::tft.height() - 1;
|
||||
const auto max_width = espgui::tft.width() - 4;
|
||||
const uint16_t part = max_width / points;
|
||||
const auto min_voltage = getMinBatCellVoltage(configs.battery.cellType.value());
|
||||
const auto max_voltage = getMaxBatCellVoltage(configs.battery.cellType.value());
|
||||
@ -89,7 +89,7 @@ void BatteryGraphDisplay::drawBatteryCurve(espgui::TftInterface &tft)
|
||||
const int y1 = float_map(point->minVoltage / 100.f, min_voltage, max_voltage, max_height, TOP_OFFSET);
|
||||
const int x2 = 2 + part * (points - i);
|
||||
const int y2 = float_map(point->maxVoltage / 100.f, min_voltage, max_voltage, max_height, TOP_OFFSET);
|
||||
tft.drawLine(x1, y1, x2, y2, espgui::TFT_WHITE);
|
||||
espgui::tft.drawLine(x1, y1, x2, y2, TFT_WHITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,13 +7,13 @@ class BatteryGraphDisplay : public BobbyDisplayWithTitle {
|
||||
using Base = BobbyDisplayWithTitle;
|
||||
|
||||
public:
|
||||
std::string title() const override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
std::string text() const override;
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
static void drawBatteryCurve(espgui::TftInterface &tft);
|
||||
static void drawBatteryCurve();
|
||||
|
||||
private:
|
||||
float m_lastBatVoltage{0};
|
||||
|
@ -1,80 +0,0 @@
|
||||
#include "batteryinfodisplay.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <screenmanager.h>
|
||||
#include <tftcolors.h>
|
||||
|
||||
// local includes
|
||||
#include "battery.h"
|
||||
#include "displays/menus/mainmenu.h"
|
||||
#include "displays/metersdisplay.h"
|
||||
#include "displays/speedinfodisplay.h"
|
||||
#include "globals.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
// display with big battery and ten bars (0-100%)
|
||||
|
||||
void BatteryInfoDisplay::initScreen(espgui::TftInterface &tft)
|
||||
{
|
||||
using namespace espgui;
|
||||
Base::initScreen(tft);
|
||||
|
||||
tft.drawRoundRect(m_offset, m_offset, tft.width() - (m_offset * 2), tft.height() - (m_offset * 2), 10, espgui::TFT_WHITE);
|
||||
tft.drawRoundRect((tft.width() / 2) - (m_offset / 2), m_offset / 2, m_offset, m_offset / 2, 3, espgui::TFT_WHITE);
|
||||
m_lastBarCount = 0;
|
||||
}
|
||||
|
||||
void BatteryInfoDisplay::redraw(espgui::TftInterface &tft)
|
||||
{
|
||||
using namespace espgui;
|
||||
Base::redraw(tft);
|
||||
|
||||
// calculate height of space available for all bars
|
||||
const auto min_x = m_offset + 3; // leave 2 pixels + 1 pixel for border
|
||||
const auto max_x = tft.width() - m_offset - 3;
|
||||
const auto topY = m_offset + 3;
|
||||
const auto bottomY = tft.height() - m_offset - 3;
|
||||
const auto height = bottomY - topY;
|
||||
const auto width = max_x - min_x;
|
||||
const uint16_t segment_height = (height / 10);
|
||||
|
||||
if (const auto avgVoltage = controllers.getAvgVoltage(); avgVoltage)
|
||||
{
|
||||
const auto cellType = configs.battery.cellType.value();
|
||||
const uint16_t percentage = getBatteryPercentage(*avgVoltage, cellType);
|
||||
const auto segment_count = std::max(percentage / 10, 1);
|
||||
|
||||
if (segment_count != m_lastBarCount)
|
||||
{
|
||||
m_lastBarCount = segment_count;
|
||||
// draw battery
|
||||
for (auto i = 0; i < 10; ++i)
|
||||
{
|
||||
const auto y = bottomY - (i * segment_height) - segment_height;
|
||||
tft.fillRoundRect(min_x, y, width, segment_height - 2, 10, segment_count > i ? espgui::TFT_GREEN : espgui::TFT_DARKGREY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tft.fillRect(0, 0, tft.width(), topY, TFT_CYAN);
|
||||
// tft.fillRect(0, bottomY, tft.width(), tft.height()-bottomY, TFT_YELLOW);
|
||||
}
|
||||
|
||||
void BatteryInfoDisplay::buttonPressed(espgui::Button button)
|
||||
{
|
||||
Base::buttonPressed(button);
|
||||
|
||||
switch (button) {
|
||||
using espgui::Button;
|
||||
case Button::Right:
|
||||
espgui::pushScreen<MainMenu>();
|
||||
break;
|
||||
case Button::Up:
|
||||
espgui::switchScreen<MetersDisplay>();
|
||||
break;
|
||||
case Button::Down:
|
||||
espgui::switchScreen<SpeedInfoDisplay>();
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// local includes
|
||||
#include "bobbydisplay.h"
|
||||
|
||||
class BatteryInfoDisplay : public BobbyDisplay
|
||||
{
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
private:
|
||||
static constexpr const auto m_offset = 40;
|
||||
uint16_t m_lastBarCount{0};
|
||||
};
|
@ -2,15 +2,16 @@
|
||||
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
#include "displays/menus/mainmenu.h"
|
||||
#include "displays/speedinfodisplay.h"
|
||||
#include "displays/metersdisplay.h"
|
||||
#include "displays/statusdisplay.h"
|
||||
#include "screenmanager.h"
|
||||
#include "tftinstance.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
void BmsDisplay::initScreen(espgui::TftInterface &tft)
|
||||
void BmsDisplay::initScreen()
|
||||
{
|
||||
Base::initScreen(tft);
|
||||
Base::initScreen();
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
@ -42,9 +43,9 @@ void BmsDisplay::initScreen(espgui::TftInterface &tft)
|
||||
m_cycleLabel.start();
|
||||
}
|
||||
|
||||
void BmsDisplay::redraw(espgui::TftInterface &tft)
|
||||
void BmsDisplay::redraw()
|
||||
{
|
||||
Base::redraw(tft);
|
||||
Base::redraw();
|
||||
|
||||
if (bluetoothSerial.hasClient())
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
@ -101,7 +102,7 @@ void BmsDisplay::buttonPressed(espgui::Button button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case Button::Right: pushScreen<MainMenu>(); break;
|
||||
case Button::Up: switchScreen<SpeedInfoDisplay>(); break;
|
||||
case Button::Up: switchScreen<MetersDisplay>(); break;
|
||||
case Button::Down: switchScreen<StatusDisplay>(); break;
|
||||
default:;
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ class BmsDisplay :
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
|
@ -48,6 +48,5 @@ void BobbyChangeValueDisplay<Tvalue>::buttonPressed(espgui::Button button)
|
||||
template<typename Tvalue>
|
||||
void BobbyChangeValueDisplay<Tvalue>::buttonReleased(espgui::Button button)
|
||||
{
|
||||
Base::buttonReleased(button);
|
||||
buttonReleasedCommon(button);
|
||||
//Base::buttonReleased(button);
|
||||
}
|
||||
|
@ -26,5 +26,4 @@ void BobbyDisplayWithTitle::buttonPressed(espgui::Button button)
|
||||
void BobbyDisplayWithTitle::buttonReleased(espgui::Button button)
|
||||
{
|
||||
//Base::buttonReleased(button);
|
||||
buttonReleasedCommon(button);
|
||||
}
|
||||
|
@ -46,5 +46,4 @@ template<size_t COUNT>
|
||||
void BobbyGraphDisplay<COUNT>::buttonReleased(espgui::Button button)
|
||||
{
|
||||
//Base::buttonReleased(button);
|
||||
buttonReleasedCommon(button);
|
||||
}
|
||||
|
@ -26,6 +26,6 @@ void BobbyMenuDisplay::buttonPressed(espgui::Button button)
|
||||
|
||||
void BobbyMenuDisplay::buttonReleased(espgui::Button button)
|
||||
{
|
||||
Base::buttonReleased(button);
|
||||
//Base::buttonReleased(button);
|
||||
buttonReleasedCommon(button);
|
||||
}
|
||||
|
@ -26,5 +26,4 @@ void BobbyPopupDisplay::buttonPressed(espgui::Button button)
|
||||
void BobbyPopupDisplay::buttonReleased(espgui::Button button)
|
||||
{
|
||||
//Base::buttonReleased(button);
|
||||
buttonReleasedCommon(button);
|
||||
}
|
||||
|
@ -46,6 +46,5 @@ template<std::size_t COUNT0, std::size_t COUNT1>
|
||||
void BobbySplitGraphDisplay<COUNT0, COUNT1>::buttonReleased(espgui::Button button)
|
||||
{
|
||||
//Base::buttonReleased(button);
|
||||
buttonReleasedCommon(button);
|
||||
}
|
||||
|
||||
|
199
main/displays/buttoncalibratedisplay.cpp
Normal file
199
main/displays/buttoncalibratedisplay.cpp
Normal file
@ -0,0 +1,199 @@
|
||||
#include "buttoncalibratedisplay.h"
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <fmt/core.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
#include "newsettings.h"
|
||||
#include "displays/menus/boardcomputerhardwaresettingsmenu.h"
|
||||
#include "bobbyerrorhandler.h"
|
||||
|
||||
namespace {
|
||||
constexpr const char TAG[] = "BUTTON";
|
||||
} // namespace
|
||||
|
||||
std::string ButtonCalibrateDisplay::text() const
|
||||
{
|
||||
return "Button calibrate";
|
||||
}
|
||||
|
||||
void ButtonCalibrateDisplay::start()
|
||||
{
|
||||
Base::start();
|
||||
|
||||
m_oldMode = currentMode;
|
||||
currentMode = &m_mode;
|
||||
m_lastButton = std::nullopt;
|
||||
m_status = WaitingLeft;
|
||||
|
||||
m_finished = false;
|
||||
}
|
||||
|
||||
void ButtonCalibrateDisplay::initScreen()
|
||||
{
|
||||
Base::initScreen();
|
||||
|
||||
m_labelInstruction.start();
|
||||
m_labelLeft.start();
|
||||
m_labelRight.start();
|
||||
m_labelUp.start();
|
||||
m_labelDown.start();
|
||||
m_labelEnd.start();
|
||||
}
|
||||
|
||||
void ButtonCalibrateDisplay::update()
|
||||
{
|
||||
Base::update();
|
||||
|
||||
if (m_finished)
|
||||
{
|
||||
m_finished = false;
|
||||
|
||||
if (auto result = configs.write_config(configs.dpadMappingLeft, m_leftButton); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
return;
|
||||
}
|
||||
if (auto result = configs.write_config(configs.dpadMappingRight, m_rightButton); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
return;
|
||||
}
|
||||
if (auto result = configs.write_config(configs.dpadMappingUp, m_upButton); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
return;
|
||||
}
|
||||
if (auto result = configs.write_config(configs.dpadMappingDown, m_downButton); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
return;
|
||||
}
|
||||
|
||||
espgui::popScreen();
|
||||
}
|
||||
}
|
||||
|
||||
void ButtonCalibrateDisplay::redraw()
|
||||
{
|
||||
Base::redraw();
|
||||
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
switch (m_status)
|
||||
{
|
||||
case WaitingLeft:
|
||||
if (m_lastButton)
|
||||
m_labelInstruction.redraw("Press LEFT again");
|
||||
else
|
||||
m_labelInstruction.redraw("Press LEFT");
|
||||
break;
|
||||
case WaitingRight:
|
||||
if (m_lastButton)
|
||||
m_labelInstruction.redraw("Press RIGHT again");
|
||||
else
|
||||
m_labelInstruction.redraw("Press RIGHT");
|
||||
break;
|
||||
case WaitingUp:
|
||||
if (m_lastButton)
|
||||
m_labelInstruction.redraw("Press UP again");
|
||||
else
|
||||
m_labelInstruction.redraw("Press UP");
|
||||
break;
|
||||
case WaitingDown:
|
||||
if (m_lastButton)
|
||||
m_labelInstruction.redraw("Press DOWN again");
|
||||
else
|
||||
m_labelInstruction.redraw("Press DOWN");
|
||||
break;
|
||||
case Finished:
|
||||
m_labelInstruction.redraw("Finished");
|
||||
break;
|
||||
}
|
||||
|
||||
m_labelLeft.redraw(m_status > WaitingLeft ? fmt::format("Left: {}", m_leftButton) : std::string{});
|
||||
m_labelRight.redraw(m_status > WaitingRight ? fmt::format("Right: {}", m_rightButton) : std::string{});
|
||||
m_labelUp.redraw(m_status > WaitingUp ? fmt::format("Up: {}", m_upButton) : std::string{});
|
||||
m_labelDown.redraw(m_status > WaitingDown ? fmt::format("Down: {}", m_downButton) : std::string{});
|
||||
|
||||
m_labelEnd.redraw(m_status == Finished ? "Press RIGHT to save" : "");
|
||||
}
|
||||
|
||||
void ButtonCalibrateDisplay::stop()
|
||||
{
|
||||
Base::stop();
|
||||
|
||||
if (currentMode == &m_mode)
|
||||
{
|
||||
// to avoid crash after deconstruction
|
||||
m_mode.stop();
|
||||
lastMode = nullptr;
|
||||
|
||||
currentMode = m_oldMode;
|
||||
}
|
||||
}
|
||||
|
||||
void ButtonCalibrateDisplay::rawButtonPressed(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonPressed(button);
|
||||
|
||||
if (m_status == Finished)
|
||||
{
|
||||
if (button == m_rightButton)
|
||||
{
|
||||
ESP_LOGI(TAG, "correct button");
|
||||
m_finished = true;
|
||||
}
|
||||
else
|
||||
ESP_LOGI(TAG, "wrong button");
|
||||
}
|
||||
else if (!m_lastButton || *m_lastButton != button)
|
||||
m_lastButton = button;
|
||||
else
|
||||
{
|
||||
switch (m_status)
|
||||
{
|
||||
case WaitingLeft:
|
||||
m_leftButton = button;
|
||||
m_lastButton = std::nullopt;
|
||||
m_status = WaitingRight;
|
||||
break;
|
||||
case WaitingRight:
|
||||
m_rightButton = button;
|
||||
m_lastButton = std::nullopt;
|
||||
m_status = WaitingUp;
|
||||
break;
|
||||
case WaitingUp:
|
||||
m_upButton = button;
|
||||
m_lastButton = std::nullopt;
|
||||
m_status = WaitingDown;
|
||||
break;
|
||||
case WaitingDown:
|
||||
m_downButton = button;
|
||||
m_lastButton = std::nullopt;
|
||||
m_status = Finished;
|
||||
break;
|
||||
case Finished:;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ButtonCalibrateDisplay::rawButtonReleased(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonReleased(button);
|
||||
}
|
||||
|
||||
void ButtonCalibrateDisplay::buttonPressed(espgui::Button button)
|
||||
{
|
||||
//Base::buttonPressed(button);
|
||||
}
|
||||
|
||||
void ButtonCalibrateDisplay::buttonReleased(espgui::Button button)
|
||||
{
|
||||
//Base::buttonReleased(button);
|
||||
}
|
53
main/displays/buttoncalibratedisplay.h
Normal file
53
main/displays/buttoncalibratedisplay.h
Normal file
@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <displaywithtitle.h>
|
||||
#include <widgets/label.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "modeinterface.h"
|
||||
#include "modes/ignoreinputmode.h"
|
||||
|
||||
class ButtonCalibrateDisplay : public espgui::DisplayWithTitle
|
||||
{
|
||||
using Base = espgui::DisplayWithTitle;
|
||||
|
||||
public:
|
||||
ButtonCalibrateDisplay() = default;
|
||||
explicit ButtonCalibrateDisplay(bool bootup) : m_bootup{bootup} {}
|
||||
|
||||
std::string text() const override;
|
||||
void start() override;
|
||||
void initScreen() override;
|
||||
void update() override;
|
||||
void redraw() override;
|
||||
void stop() override;
|
||||
|
||||
void rawButtonPressed(uint8_t button) override;
|
||||
void rawButtonReleased(uint8_t button) override;
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
void buttonReleased(espgui::Button button) override;
|
||||
|
||||
private:
|
||||
const bool m_bootup{false};
|
||||
ModeInterface *m_oldMode;
|
||||
IgnoreInputMode m_mode{0, bobbycar::protocol::ControlType::FieldOrientedControl, bobbycar::protocol::ControlMode::Torque};
|
||||
|
||||
std::optional<uint8_t> m_lastButton;
|
||||
|
||||
enum { WaitingLeft, WaitingRight, WaitingUp, WaitingDown, Finished } m_status;
|
||||
|
||||
espgui::Label m_labelInstruction{25, 72};
|
||||
|
||||
espgui::Label m_labelLeft{25, 100};
|
||||
espgui::Label m_labelRight{25, 125};
|
||||
espgui::Label m_labelUp{25, 150};
|
||||
espgui::Label m_labelDown{25, 175};
|
||||
|
||||
espgui::Label m_labelEnd{25, 225};
|
||||
|
||||
uint8_t m_leftButton, m_rightButton, m_upButton, m_downButton;
|
||||
|
||||
bool m_finished;
|
||||
};
|
@ -134,7 +134,7 @@ CalibrateVoltageDisplay::CalibrateVoltageDisplay()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_VOLTAGECALIBRATION_RESET>, ResetCalibrationAction>>();
|
||||
}
|
||||
|
||||
std::string CalibrateVoltageDisplay::title() const
|
||||
std::string CalibrateVoltageDisplay::text() const
|
||||
{
|
||||
return TEXT_BATTERY_CALIBRATE;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ class CalibrateVoltageDisplay : public BobbyMenuDisplay
|
||||
public:
|
||||
CalibrateVoltageDisplay();
|
||||
|
||||
std::string title() const override;
|
||||
std::string text() const override;
|
||||
|
||||
void back() override;
|
||||
};
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "confiscationdisplay.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
#include <esprandom.h>
|
||||
#include <randomutils.h>
|
||||
#include <fontrenderer.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
@ -29,39 +29,39 @@ void ConfiscationDisplay::start()
|
||||
m_nextRestart = espchrono::millis_clock::now() + std::chrono::seconds{cpputils::randomNumber(3, 7, espcpputils::esp_random_device{})};
|
||||
}
|
||||
|
||||
void ConfiscationDisplay::initScreen(espgui::TftInterface &tft)
|
||||
void ConfiscationDisplay::initScreen()
|
||||
{
|
||||
Base::initScreen(tft);
|
||||
Base::initScreen();
|
||||
|
||||
espgui::FontRenderer fontRenderer{tft};
|
||||
espgui::tft.setSwapBytes(true);
|
||||
espgui::tft.pushImage(10, 70, bobbyicons::shortcircuit.WIDTH, bobbyicons::shortcircuit.HEIGHT, bobbyicons::shortcircuit.buffer);
|
||||
espgui::tft.setSwapBytes(false);
|
||||
|
||||
tft.pushImage(10, 70, bobbyicons::shortcircuit.WIDTH, bobbyicons::shortcircuit.HEIGHT, bobbyicons::shortcircuit.buffer);
|
||||
m_progressBar.start();
|
||||
|
||||
m_progressBar.start(tft);
|
||||
m_label.start();
|
||||
|
||||
m_label.start(tft);
|
||||
|
||||
fontRenderer.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
fontRenderer.setTextFont(2);
|
||||
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
espgui::tft.setTextFont(2);
|
||||
|
||||
auto y = 235;
|
||||
constexpr auto lineheight = 15;
|
||||
tft.drawString(tft, fontRenderer, "Bei erneuter, widerrechtlicher", 10, y+=lineheight);
|
||||
tft.drawString(tft, fontRenderer, "Beschlagnahmung wird die Selbst-", 10, y+=lineheight);
|
||||
tft.drawString(tft, fontRenderer, "Vernichtung durch Kurzschluss", 10, y+=lineheight);
|
||||
tft.drawString(tft, fontRenderer, fmt::format("der Batterie eingeleitet (ca {:.2f}MJ)", calculateMegaJoules()), 10, y+=lineheight);
|
||||
espgui::tft.drawString("Bei erneuter, widerrechtlicher", 10, y+=lineheight);
|
||||
espgui::tft.drawString("Beschlagnahmung wird die Selbst-", 10, y+=lineheight);
|
||||
espgui::tft.drawString("Vernichtung durch Kurzschluss", 10, y+=lineheight);
|
||||
espgui::tft.drawString(fmt::format("der Batterie eingeleitet (ca {:.2f}MJ)", calculateMegaJoules()), 10, y+=lineheight);
|
||||
}
|
||||
|
||||
void ConfiscationDisplay::redraw(espgui::TftInterface &tft)
|
||||
void ConfiscationDisplay::redraw()
|
||||
{
|
||||
Base::redraw(tft);
|
||||
Base::redraw();
|
||||
|
||||
m_progressBar.redraw(tft, m_progress);
|
||||
m_progressBar.redraw(m_progress);
|
||||
|
||||
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
|
||||
espgui::tft.setTextColor(TFT_YELLOW, TFT_BLACK);
|
||||
|
||||
tft.setTextFont(2);
|
||||
m_label.redraw(tft, fontRenderer, [](){
|
||||
espgui::tft.setTextFont(2);
|
||||
m_label.redraw([](){
|
||||
if (const auto period = espchrono::millis_clock::now().time_since_epoch() % 6000ms; period < 2000ms)
|
||||
return "Halten Sie 10m Abstand.";
|
||||
else if (period < 4000ms)
|
||||
@ -110,7 +110,7 @@ void ConfiscationDisplay::buttonPressed(espgui::Button button)
|
||||
}
|
||||
}
|
||||
|
||||
std::string ConfiscationDisplay::title() const
|
||||
std::string ConfiscationDisplay::text() const
|
||||
{
|
||||
return "Explosions-Modus";
|
||||
}
|
||||
|
@ -16,14 +16,14 @@ class ConfiscationDisplay : public BobbyDisplayWithTitle
|
||||
public:
|
||||
void start() override;
|
||||
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void update() override;
|
||||
void stop() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
std::string title() const override;
|
||||
std::string text() const override;
|
||||
|
||||
private:
|
||||
espgui::ProgressBar m_progressBar{10, 210, 200, 10, 0, 500};
|
||||
|
@ -3,12 +3,8 @@
|
||||
// 3rdparty lib includes
|
||||
#include <randomutils.h>
|
||||
#include <esprandom.h>
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
#include <tftinterface.h>
|
||||
#include <tftcolors.h>
|
||||
|
||||
// local includes
|
||||
#include "screens.h"
|
||||
|
||||
void GameOfLifeDisplay::start()
|
||||
{
|
||||
@ -18,28 +14,26 @@ void GameOfLifeDisplay::start()
|
||||
m_newgrid = std::make_unique<std::bitset<GRIDX*GRIDY>>();
|
||||
}
|
||||
|
||||
void GameOfLifeDisplay::initScreen(espgui::TftInterface &tft)
|
||||
void GameOfLifeDisplay::initScreen()
|
||||
{
|
||||
Base::initScreen(tft);
|
||||
Base::initScreen();
|
||||
|
||||
disableScreenFlip(true);
|
||||
|
||||
tft.setRotation(3);
|
||||
tft.fillScreen(espgui::TFT_BLACK);
|
||||
espgui::tft.setRotation(3);
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
}
|
||||
|
||||
void GameOfLifeDisplay::redraw(espgui::TftInterface &tft)
|
||||
void GameOfLifeDisplay::redraw()
|
||||
{
|
||||
Base::redraw(tft);
|
||||
Base::redraw();
|
||||
|
||||
if (gen == 0)
|
||||
{
|
||||
tft.fillScreen(espgui::TFT_BLACK);
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
initGrid();
|
||||
}
|
||||
|
||||
computeCA();
|
||||
drawGrid(tft);
|
||||
drawGrid();
|
||||
|
||||
*m_grid = *m_newgrid;
|
||||
|
||||
@ -51,8 +45,7 @@ void GameOfLifeDisplay::stop()
|
||||
{
|
||||
Base::stop();
|
||||
|
||||
disableScreenFlip(false);
|
||||
|
||||
espgui::tft.setRotation(0);
|
||||
m_grid = nullptr;
|
||||
m_newgrid = nullptr;
|
||||
}
|
||||
@ -71,9 +64,9 @@ void GameOfLifeDisplay::buttonPressed(espgui::Button button)
|
||||
}
|
||||
}
|
||||
|
||||
void GameOfLifeDisplay::drawGrid(espgui::TftInterface &tft)
|
||||
void GameOfLifeDisplay::drawGrid()
|
||||
{
|
||||
uint16_t color = espgui::TFT_WHITE;
|
||||
uint16_t color = TFT_WHITE;
|
||||
for (int16_t x = 1; x < GRIDX - 1; x++) {
|
||||
for (int16_t y = 1; y < GRIDY - 1; y++) {
|
||||
if (((*m_grid)[index(x,y)]) != ((*m_newgrid)[index(x,y)])) {
|
||||
@ -81,7 +74,7 @@ void GameOfLifeDisplay::drawGrid(espgui::TftInterface &tft)
|
||||
color = 0xFFFF; //random(0xFFFF);
|
||||
else
|
||||
color = 0;
|
||||
tft.fillRect(CELLXY * x, CELLXY * y, CELLXY, CELLXY, color);
|
||||
espgui::tft.fillRect(CELLXY * x, CELLXY * y, CELLXY, CELLXY, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ class GameOfLifeDisplay : public BobbyDisplay
|
||||
|
||||
public:
|
||||
void start() override;
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
void stop() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
@ -22,7 +22,7 @@ public:
|
||||
private:
|
||||
|
||||
//Draws the grid on the display
|
||||
void drawGrid(espgui::TftInterface &tft);
|
||||
void drawGrid();
|
||||
|
||||
//Initialise Grid
|
||||
void initGrid();
|
||||
|
@ -21,8 +21,8 @@ class GametrakCalibrateDisplay : public BobbyDisplay, public ConfirmActionInterf
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen(espgui::TftInterface &tft) override;
|
||||
void redraw(espgui::TftInterface &tft) override;
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
|
||||
private:
|
||||
std::array<Label, 6> m_labels {{
|
||||
@ -41,9 +41,9 @@ private:
|
||||
}};
|
||||
};
|
||||
|
||||
void GametrakCalibrateDisplay::initScreen(espgui::TftInterface &tft)
|
||||
void GametrakCalibrateDisplay::initScreen()
|
||||
{
|
||||
Base::initScreen(tft);
|
||||
Base::initScreen();
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextFont(4);
|
||||
@ -62,9 +62,9 @@ void GametrakCalibrateDisplay::initScreen(espgui::TftInterface &tft)
|
||||
progressBar.start();
|
||||
}
|
||||
|
||||
void GametrakCalibrateDisplay::redraw(espgui::TftInterface &tft)
|
||||
void GametrakCalibrateDisplay::redraw()
|
||||
{
|
||||
Base::redraw(tft);
|
||||
Base::redraw();
|
||||
|
||||
m_labels[0].redraw(fmt::format("{:.02f}", gametrakX));
|
||||
m_labels[1].redraw(std::to_string(raw_gametrakX));
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user