Compare commits
80 Commits
gabor-test
...
comred-fix
Author | SHA1 | Date | |
---|---|---|---|
d6b2b4b41c | |||
bff99bd6c5 | |||
98a1160c6f | |||
7db25a5642 | |||
405ab92cf2 | |||
6f7b598bd7 | |||
c129106ff4 | |||
4885913c75 | |||
f5d6535db9 | |||
f18a057411 | |||
72c1e959a1 | |||
3fe227a82b | |||
e518c80e03 | |||
f8baa1c6ea | |||
67580cb7ec | |||
1abb83e6b1 | |||
ad9b3c4e53 | |||
e23418dbb0 | |||
c39033399b | |||
0565c3042d | |||
cb7d4180c4 | |||
bc6dd5a50c | |||
7a887a3323 | |||
73fd65b04f | |||
0fab6e72e1 | |||
0cf28d961a | |||
6c94b608fa | |||
1366f3fedb | |||
ca1b7173e7 | |||
1317cec337 | |||
e49603751f | |||
c16a126a2f | |||
91f2f621fe | |||
7bece3c32f | |||
2773f0614d | |||
474b48ff3e | |||
11b9564b07 | |||
0c81c96e46 | |||
01cf28e8f0 | |||
3722d87aee | |||
12261a815f | |||
c0069006cd | |||
8a8f800447 | |||
9068be4a2d | |||
cab4dd2ca1 | |||
83ea64a086 | |||
5d4655b549 | |||
6f6966d13e | |||
72ce9fb3a5 | |||
d805bcfb2c | |||
a462e97d5f | |||
cff49fa3a8 | |||
ee6fb1f99c | |||
3c13473d0c | |||
38fb68ce2e | |||
55386b5fb3 | |||
0393ac750b | |||
647365c5fc | |||
756c8bde94 | |||
56d0cb2ab0 | |||
d829c0d5cb | |||
ff104923d7 | |||
a5ee6bb557 | |||
b9961e2e2f | |||
65bc7d2b38 | |||
08e2f6e4d3 | |||
0843e4881b | |||
cf278e4d18 | |||
3e70a1fc74 | |||
5971061bc7 | |||
eef937edea | |||
401c870287 | |||
66a469f4e3 | |||
ba45f28f17 | |||
735ad66dba | |||
325d719aee | |||
6144a05e25 | |||
5db917786a | |||
cf2f9a5939 | |||
54cdeee1c9 |
2
.github/workflows/workflow.yml
vendored
2
.github/workflows/workflow.yml
vendored
@ -154,7 +154,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node: [feedc0de, comred, comred_new, peter, mick, nofeatures, seatbot, gernot]
|
||||
node: [feedc0de, comred_new, peter, mick, nofeatures, seatbot]
|
||||
name: ${{ matrix.node }}
|
||||
needs:
|
||||
- checkout
|
||||
|
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -19,9 +19,6 @@
|
||||
[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
|
||||
@ -67,3 +64,6 @@
|
||||
[submodule "esp-protocols"]
|
||||
path = esp-protocols
|
||||
url = ../../0xFEEDC0DE64/esp-protocols.git
|
||||
[submodule "components/TFT_eSPI"]
|
||||
path = components/TFT_eSPI
|
||||
url = ../../0xFEEDC0DE64/TFT_eSPI.git
|
||||
|
@ -22,9 +22,11 @@ include(config.cmake)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
add_definitions(-DASIO_DISABLE_CONCEPTS=1)
|
||||
|
||||
set(EXTRA_COMPONENT_DIRS
|
||||
esp-protocols/components
|
||||
)
|
||||
|
Submodule components/arduino-esp32 updated: 2b2f7cd936...a3d5e78b83
Submodule components/bobbycar-protocol updated: a74791e2aa...701243ad89
Submodule components/esp-gui-lib updated: bb02a6c267...a75c419742
Submodule components/espconfiglib updated: 3ca0eb09d6...c12f6fa3a8
Submodule components/espcpputils updated: a155041878...d811b9e470
Submodule components/esphttpdutils updated: c095443979...eb152b8406
Submodule components/espwifistack updated: 4749a9db5c...724cac190f
Submodule components/fmt updated: 7b25dd172b...32e16173ce
90
configs/config_aveexy.cmake
Normal file
90
configs/config_aveexy.cmake
Normal file
@ -0,0 +1,90 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_aveexy)
|
||||
set(BOBBY_DEFAULT_OTA_NAME 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,4 +1,5 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_comred)
|
||||
set(BOBBY_DEFAULT_OTA_NAME comred)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
@ -1,4 +1,5 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_comred_new)
|
||||
set(BOBBY_DEFAULT_OTA_NAME comred_new)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
@ -1,4 +1,5 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_feedc0de)
|
||||
set(BOBBY_DEFAULT_OTA_NAME feedc0de)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
@ -1,4 +1,5 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_gernot)
|
||||
set(BOBBY_DEFAULT_OTA_NAME gernot)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
@ -1,4 +1,5 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_greyhash)
|
||||
set(BOBBY_DEFAULT_OTA_NAME greyhash)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
@ -1,4 +1,5 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_mick)
|
||||
set(BOBBY_DEFAULT_OTA_NAME mick)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
@ -1,4 +1,5 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_nofeatures)
|
||||
set(BOBBY_DEFAULT_OTA_NAME nofeatures)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
@ -1,4 +1,5 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_peter)
|
||||
set(BOBBY_DEFAULT_OTA_NAME peter)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
@ -1,4 +1,5 @@
|
||||
set(BOBBY_APP_NAME bobbyquad_seatbot)
|
||||
set(BOBBY_DEFAULT_OTA_NAME seatbot)
|
||||
|
||||
add_definitions(
|
||||
-DUSER_SETUP_LOADED=1
|
||||
@ -45,7 +46,7 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
-DFEATURE_LEDBACKLIGHT
|
||||
|
||||
-DLEDBACKLIGHT_INVERTED
|
||||
# -DLEDSTRIP_WRONG_DIRECTION
|
||||
-DLEDSTRIP_WRONG_DIRECTION
|
||||
-DHEAP_LRGST_CRASH_TEXT_FIX
|
||||
|
||||
# Default values
|
89
configs/config_testdevice.cmake
Normal file
89
configs/config_testdevice.cmake
Normal file
@ -0,0 +1,89 @@
|
||||
set(BOBBY_APP_NAME testdevice)
|
||||
|
||||
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
|
||||
)
|
||||
|
1850
configs/sdkconfig_seatbot
Normal file
1850
configs/sdkconfig_seatbot
Normal file
File diff suppressed because it is too large
Load Diff
1850
configs/sdkconfig_testdevice
Normal file
1850
configs/sdkconfig_testdevice
Normal file
File diff suppressed because it is too large
Load Diff
2
esp-idf
2
esp-idf
Submodule esp-idf updated: d0026946cd...468b1f17c9
@ -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"
|
||||
|
||||
|
@ -62,6 +62,7 @@ set(headers
|
||||
debuginputhandler.h
|
||||
debugtexthelpers.h
|
||||
displays/batterygraphdisplay.h
|
||||
displays/batteryinfodisplay.h
|
||||
displays/bmsdisplay.h
|
||||
displays/bobbychangevaluedisplay.h
|
||||
displays/bobbydisplay.h
|
||||
@ -156,10 +157,12 @@ set(headers
|
||||
displays/qrcodedebug.h
|
||||
displays/qrdisplay.h
|
||||
displays/qrimportdisplay.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
|
||||
@ -215,6 +218,7 @@ set(headers
|
||||
modes/tempomatmode.h
|
||||
modes/wheelchairmode.h
|
||||
mosfets.h
|
||||
motorpwmlimiter.h
|
||||
newsettings.h
|
||||
ota.h
|
||||
potis.h
|
||||
@ -226,6 +230,7 @@ set(headers
|
||||
serial_bobby.h
|
||||
settingspersister.h
|
||||
settingsutils.h
|
||||
softpwmlimiter.h
|
||||
statistics.h
|
||||
statustexthelper.h
|
||||
taskmanager.h
|
||||
@ -235,6 +240,7 @@ set(headers
|
||||
texthelpers/wifistatexthelpers.h
|
||||
time_bobbycar.h
|
||||
types.h
|
||||
typeutils.h
|
||||
udpcloud.h
|
||||
unifiedmodelmode.h
|
||||
utils.h
|
||||
@ -306,6 +312,7 @@ set(sources
|
||||
debuginputhandler.cpp
|
||||
debugtexthelpers.cpp
|
||||
displays/batterygraphdisplay.cpp
|
||||
displays/batteryinfodisplay.cpp
|
||||
displays/bmsdisplay.cpp
|
||||
displays/bobbychangevaluedisplay.cpp
|
||||
displays/bobbydisplay.cpp
|
||||
@ -398,10 +405,12 @@ set(sources
|
||||
displays/qrcodedebug.cpp
|
||||
displays/qrdisplay.cpp
|
||||
displays/qrimportdisplay.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
|
||||
@ -458,6 +467,7 @@ set(sources
|
||||
modes/tempomatmode.cpp
|
||||
modes/wheelchairmode.cpp
|
||||
mosfets.cpp
|
||||
motorpwmlimiter.cpp
|
||||
newsettings.cpp
|
||||
ota.cpp
|
||||
potis.cpp
|
||||
@ -469,6 +479,7 @@ set(sources
|
||||
serial_bobby.cpp
|
||||
settingspersister.cpp
|
||||
settingsutils.cpp
|
||||
softpwmlimiter.cpp
|
||||
statistics.cpp
|
||||
statustexthelper.cpp
|
||||
taskmanager.cpp
|
||||
@ -525,6 +536,7 @@ execute_process(
|
||||
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(SUBSTRING "${GIT_MESSAGE}" 0 100 GIT_MESSAGE)
|
||||
string(STRIP "${GIT_BRANCH}" GIT_BRANCH)
|
||||
|
||||
@ -541,5 +553,6 @@ target_compile_options(${COMPONENT_TARGET}
|
||||
-DGIT_SHORT_REV="${GIT_SHORT_REV}"
|
||||
-DGIT_MESSAGE="${GIT_MESSAGE}"
|
||||
-DGIT_BRANCH="${GIT_BRANCH}"
|
||||
-DBOBBY_DEFAULT_OTA_NAME="${BOBBY_DEFAULT_OTA_NAME}"
|
||||
${BOBBYCAR_BUILDFLAGS}
|
||||
)
|
||||
|
@ -39,10 +39,12 @@ 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; } };
|
||||
|
||||
// Time
|
||||
//struct TimezoneOffsetAccessor : public NewSettingsAccessor<int32_t> { ConfigWrapper<int32_t> &getConfig() const override { return configs.timezoneOffset; } };
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
void triggered() override
|
||||
{
|
||||
if (auto result = configs.write_config(configs.ledstrip.animationType, type); !result)
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
// 3rdparty lib includes
|
||||
#include <ArduinoJson.h>
|
||||
#include <wifi_bobbycar.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "ledstrip.h"
|
||||
|
@ -6,9 +6,7 @@
|
||||
// local includes
|
||||
#include "newsettings.h"
|
||||
#include "settingsutils.h"
|
||||
#include "modes/defaultmode.h"
|
||||
#include "ledstripdefines.h"
|
||||
#include "ledstrip.h"
|
||||
|
||||
#include "bobbyquickactions.h"
|
||||
|
||||
|
@ -21,7 +21,8 @@ enum BobbyButton
|
||||
Extra3,
|
||||
Extra4,
|
||||
Confirm = espgui::Button::Right,
|
||||
Back = espgui::Button::Left
|
||||
Back = espgui::Button::Left,
|
||||
ButtonMax = Back
|
||||
};
|
||||
|
||||
[[nodiscard]] std::optional<espgui::Button> translateRawButton(uint8_t button);
|
||||
|
@ -6,7 +6,7 @@
|
||||
// local includes
|
||||
#include "displays/bobbypopupdisplay.h"
|
||||
|
||||
void BobbyErrorHandler::errorOccured(std::string &&error)
|
||||
void BobbyErrorHandler::errorOccurred(std::string &&error)
|
||||
{
|
||||
auto newDisplay = std::make_unique<BobbyPopupDisplay>(std::move(error), std::move(espgui::currentDisplay));
|
||||
newDisplay->initOverlay();
|
||||
|
@ -5,5 +5,5 @@
|
||||
|
||||
struct BobbyErrorHandler : public virtual espgui::ErrorHandlerInterface
|
||||
{
|
||||
void errorOccured(std::string &&error) override;
|
||||
void errorOccurred(std::string &&error) override;
|
||||
};
|
||||
|
@ -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_TYPESAFE_ENUM(BobbyQuickActions, : uint8_t, BobbyQuickActionsValues)
|
||||
DECLARE_BOBBYTYPESAFE_ENUM(BobbyQuickActions, : uint8_t, BobbyQuickActionsValues)
|
||||
|
||||
namespace quickactions {
|
||||
|
||||
|
@ -155,7 +155,7 @@ namespace buildserver {
|
||||
|
||||
std::string get_hash_url(std::string hash)
|
||||
{
|
||||
return fmt::format(url_for_hashes, hash);
|
||||
return fmt::format(fmt::runtime(url_for_hashes), hash);
|
||||
}
|
||||
|
||||
std::string get_latest_url()
|
||||
|
17
main/can.cpp
17
main/can.cpp
@ -4,6 +4,7 @@
|
||||
// system includes
|
||||
#include <cstring>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
// esp-idf
|
||||
#include <driver/twai.h>
|
||||
@ -14,7 +15,6 @@
|
||||
#include <espchrono.h>
|
||||
#include <tickchrono.h>
|
||||
#include <screenmanager.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbycar-can.h"
|
||||
@ -161,6 +161,18 @@ 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;
|
||||
@ -265,6 +277,9 @@ 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;
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include "changevaluedisplay_bobbyquickactions.h"
|
||||
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
@ -7,7 +10,6 @@
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include "changevaluedisplay_controlmode.h"
|
||||
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
@ -7,7 +10,6 @@
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include "changevaluedisplay_controltype.h"
|
||||
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
@ -7,7 +10,6 @@
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include "changevaluedisplay_handbremsmode.h"
|
||||
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
@ -7,7 +10,6 @@
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include "changevaluedisplay_larsmmode_mode.h"
|
||||
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
@ -7,7 +10,6 @@
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include "changevaluedisplay_unifiedmodelmode.h"
|
||||
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
@ -7,7 +10,6 @@
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
1038
main/cloud.cpp
1038
main/cloud.cpp
File diff suppressed because it is too large
Load Diff
@ -7,6 +7,9 @@
|
||||
#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;
|
||||
@ -21,3 +24,5 @@ void initCloud();
|
||||
void updateCloud();
|
||||
void cloudCollect();
|
||||
void cloudSend();
|
||||
|
||||
std::string getLoginMessage();
|
||||
|
@ -6,12 +6,13 @@
|
||||
|
||||
// local includes
|
||||
#include "battery.h"
|
||||
#include "ledstrip.h"
|
||||
#include "handbremse.h"
|
||||
#include "bobbyquickactions.h"
|
||||
#include "cloud.h"
|
||||
#include "handbremse.h"
|
||||
#include "ledstrip.h"
|
||||
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(OtaAnimationModes)
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(BatteryCellType)
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(BobbyQuickActions)
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(HandbremseMode)
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(LedstripAnimation)
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(BobbyQuickActions)
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(BatteryCellType)
|
||||
IMPLEMENT_NVS_GET_SET_ENUM(OtaAnimationModes)
|
||||
|
@ -4,8 +4,8 @@
|
||||
#define CONFIGWRAPPER_TOSTRING_USINGS using ::toString;
|
||||
#include <configwrapper_priv.h>
|
||||
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(OtaAnimationModes)
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(BatteryCellType)
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(BobbyQuickActions)
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(HandbremseMode)
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(LedstripAnimation)
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(BobbyQuickActions)
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(BatteryCellType)
|
||||
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(OtaAnimationModes)
|
||||
|
@ -77,6 +77,8 @@ 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:
|
||||
|
80
main/displays/batteryinfodisplay.cpp
Normal file
80
main/displays/batteryinfodisplay.cpp
Normal file
@ -0,0 +1,80 @@
|
||||
#include "batteryinfodisplay.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <screenmanager.h>
|
||||
#include <tftinstance.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()
|
||||
{
|
||||
using namespace espgui;
|
||||
Base::initScreen();
|
||||
|
||||
tft.drawRoundRect(m_offset, m_offset, tft.width() - (m_offset * 2), tft.height() - (m_offset * 2), 10, TFT_WHITE);
|
||||
tft.drawRoundRect((tft.width() / 2) - (m_offset / 2), m_offset / 2, m_offset, m_offset / 2, 3, TFT_WHITE);
|
||||
m_lastBarCount = 0;
|
||||
}
|
||||
|
||||
void BatteryInfoDisplay::redraw()
|
||||
{
|
||||
using namespace espgui;
|
||||
Base::redraw();
|
||||
|
||||
// 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 ? TFT_GREEN : 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:;
|
||||
}
|
||||
}
|
18
main/displays/batteryinfodisplay.h
Normal file
18
main/displays/batteryinfodisplay.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
// local includes
|
||||
#include "bobbydisplay.h"
|
||||
|
||||
class BatteryInfoDisplay : public BobbyDisplay
|
||||
{
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
private:
|
||||
static constexpr const auto m_offset = 40;
|
||||
uint16_t m_lastBarCount{0};
|
||||
};
|
@ -2,7 +2,7 @@
|
||||
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
#include "displays/menus/mainmenu.h"
|
||||
#include "displays/metersdisplay.h"
|
||||
#include "displays/speedinfodisplay.h"
|
||||
#include "displays/statusdisplay.h"
|
||||
#include "screenmanager.h"
|
||||
#include "tftinstance.h"
|
||||
@ -102,7 +102,7 @@ void BmsDisplay::buttonPressed(espgui::Button button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case Button::Right: pushScreen<MainMenu>(); break;
|
||||
case Button::Up: switchScreen<MetersDisplay>(); break;
|
||||
case Button::Up: switchScreen<SpeedInfoDisplay>(); break;
|
||||
case Button::Down: switchScreen<StatusDisplay>(); break;
|
||||
default:;
|
||||
}
|
||||
|
@ -9,9 +9,9 @@
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
#include "newsettings.h"
|
||||
#include "displays/menus/boardcomputerhardwaresettingsmenu.h"
|
||||
#include "bobbyerrorhandler.h"
|
||||
#include "displays/statusdisplay.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
namespace {
|
||||
constexpr const char TAG[] = "BUTTON";
|
||||
@ -56,26 +56,48 @@ void ButtonCalibrateDisplay::update()
|
||||
|
||||
if (auto result = configs.write_config(configs.dpadMappingLeft, m_leftButton); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
ESP_LOGI(TAG, "Left button set to %d", m_leftButton);
|
||||
}
|
||||
|
||||
if (auto result = configs.write_config(configs.dpadMappingRight, m_rightButton); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
ESP_LOGI(TAG, "Right button set to %d", m_rightButton);
|
||||
}
|
||||
if (auto result = configs.write_config(configs.dpadMappingUp, m_upButton); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
ESP_LOGI(TAG, "Up button set to %d", m_upButton);
|
||||
}
|
||||
if (auto result = configs.write_config(configs.dpadMappingDown, m_downButton); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
ESP_LOGI(TAG, "Down button set to %d", m_downButton);
|
||||
}
|
||||
|
||||
espgui::popScreen();
|
||||
if (espgui::displayStack.empty())
|
||||
{
|
||||
espgui::switchScreen<StatusDisplay>();
|
||||
}
|
||||
else
|
||||
espgui::popScreen();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
namespace {
|
||||
constexpr char TEXT_BLESETTINGS[] = "BLE settings";
|
||||
constexpr char TEXT_ENABLED[] = "Enabled";
|
||||
constexpr char TEXT_FENCE_ENABLED[] = "Fence enabled";
|
||||
constexpr char TEXT_NAME[] = "Name";
|
||||
constexpr char TEXT_NAME_FORMATTED[] = "Name: &s";
|
||||
constexpr char TEXT_BACK[] = "Back";
|
||||
@ -36,6 +37,7 @@ BleSettingsMenu::BleSettingsMenu()
|
||||
{
|
||||
using namespace espgui;
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ENABLED>, BobbyCheckbox, BleEnabledAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_FENCE_ENABLED>, BobbyCheckbox, BleFenceEnabledAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, BleServerPeerDevicesText, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, BleCharacSubscribedText, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_NAME_FORMATTED, BluetoothNameAccessor>, PushScreenAction<ApSsidChangeScreen>>>();
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
#include "candebugmenu.h"
|
||||
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
@ -14,7 +17,6 @@
|
||||
#include <actions/dummyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <screenmanager.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbyerrorhandler.h"
|
||||
@ -182,7 +184,7 @@ public:
|
||||
{
|
||||
const auto result = twai_initiate_recovery();
|
||||
ESP_LOGI(TAG, "twai_initiate_recovery() returned %s", esp_err_to_name(result));
|
||||
BobbyErrorHandler{}.errorOccured(fmt::format("twai_initiate_recovery() returned {}", esp_err_to_name(result)));
|
||||
BobbyErrorHandler{}.errorOccurred(fmt::format("twai_initiate_recovery() returned {}", esp_err_to_name(result)));
|
||||
}
|
||||
};
|
||||
|
||||
@ -193,7 +195,7 @@ public:
|
||||
{
|
||||
const auto result = twai_stop();
|
||||
ESP_LOGI(TAG, "twai_stop() returned %s", esp_err_to_name(result));
|
||||
BobbyErrorHandler{}.errorOccured(fmt::format("twai_stop() returned {}", esp_err_to_name(result)));
|
||||
BobbyErrorHandler{}.errorOccurred(fmt::format("twai_stop() returned {}", esp_err_to_name(result)));
|
||||
}
|
||||
};
|
||||
|
||||
@ -204,7 +206,7 @@ public:
|
||||
{
|
||||
const auto result = twai_start();
|
||||
ESP_LOGI(TAG, "twai_start() returned %s", esp_err_to_name(result));
|
||||
BobbyErrorHandler{}.errorOccured(fmt::format("twai_start() returned {}", esp_err_to_name(result)));
|
||||
BobbyErrorHandler{}.errorOccurred(fmt::format("twai_start() returned {}", esp_err_to_name(result)));
|
||||
}
|
||||
};
|
||||
|
||||
@ -215,7 +217,7 @@ public:
|
||||
{
|
||||
const auto result = twai_driver_uninstall();
|
||||
ESP_LOGI(TAG, "twai_driver_uninstall() returned %s", esp_err_to_name(result));
|
||||
BobbyErrorHandler{}.errorOccured(fmt::format("twai_driver_uninstall() returned {}", esp_err_to_name(result)));
|
||||
BobbyErrorHandler{}.errorOccurred(fmt::format("twai_driver_uninstall() returned {}", esp_err_to_name(result)));
|
||||
}
|
||||
};
|
||||
|
||||
@ -230,7 +232,7 @@ public:
|
||||
|
||||
const auto result = twai_driver_install(&g_config, &t_config, &f_config);
|
||||
ESP_LOGI(TAG, "twai_driver_install() returned %s", esp_err_to_name(result));
|
||||
BobbyErrorHandler{}.errorOccured(fmt::format("twai_driver_install() returned {}", esp_err_to_name(result)));
|
||||
BobbyErrorHandler{}.errorOccurred(fmt::format("twai_driver_install() returned {}", esp_err_to_name(result)));
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
|
@ -10,17 +10,19 @@
|
||||
#include "icons/back.h"
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
#include "cloudtexthelpers.h"
|
||||
#include "accessors/settingsaccessors.h"
|
||||
#include "cloud.h"
|
||||
#include "displays/menus/settingsmenu.h"
|
||||
#include "bobbycheckbox.h"
|
||||
#include "cloud.h"
|
||||
#include "cloudtexthelpers.h"
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
#include "displays/menus/settingsmenu.h"
|
||||
#include "displays/menus/typesafeenumchangemenu.h"
|
||||
|
||||
namespace {
|
||||
constexpr char TEXT_CLOUDSETTINGS[] = "Cloud settings";
|
||||
constexpr char TEXT_CLOUDENABLED[] = "Cloud enabled";
|
||||
constexpr char TEXT_CLOUDTRANSMITTIMEOUT[] = "Transmit timeout";
|
||||
constexpr char TEXT_SENDSTATISTICS[] = "Send Statistics";
|
||||
constexpr char TEXT_CLOUDCOLLECTRATE[] = "Cloud collect rate";
|
||||
constexpr char TEXT_CLOUDSENDRATE[] = "Cloud send rate";
|
||||
constexpr char TEXT_BACK[] = "Back";
|
||||
@ -65,13 +67,14 @@ CloudSettingsMenu::CloudSettingsMenu()
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CLOUDENABLED>, BobbyCheckbox, CloudEnabledAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CLOUDTRANSMITTIMEOUT>, PushScreenAction<CloudTransmitTimeoutChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SENDSTATISTICS>, BobbyCheckbox, CloudSendStatisticsAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, CloudCreatedText, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, CloudStartedText, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, CloudConnectedText, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, CloudBufferLengthText, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CLOUDCOLLECTRATE>, PushScreenAction<CloudCollectRateChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CLOUDSENDRATE>, PushScreenAction<CloudSendRateChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PushScreenAction<SettingsMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
std::string CloudSettingsMenu::text() const
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "esptexthelpers.h"
|
||||
#include "accessors/settingsaccessors.h"
|
||||
#include "displays/qrcodedebug.h"
|
||||
#include "displays/xydebugdisplay.h"
|
||||
#include "displays/menus/taskmanagermenu.h"
|
||||
#ifdef FEATURE_CAN
|
||||
#include "displays/menus/candebugmenu.h"
|
||||
@ -38,6 +39,7 @@ constexpr char TEXT_TASKMANAGER[] = "Taskmanager";
|
||||
constexpr char TEXT_CANDEBUG[] = "CAN Debug";
|
||||
#endif
|
||||
constexpr char TEXT_QRCODE_DEBUG[] = "QR Debug";
|
||||
constexpr char TEXT_XY_DEBUG[] = "XY Debug";
|
||||
constexpr char TEXT_BATTERYDEBUG[] = "Bat Debug Menu";
|
||||
constexpr char TEXT_TOGGLECLOUDDEBUG[] = "Cloud Debug";
|
||||
//constexpr char TEXT_FRONTCOMMAND[] = "Front command";
|
||||
@ -67,6 +69,7 @@ DebugMenu::DebugMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CANDEBUG>, PushScreenAction<CanDebugMenu>>>();
|
||||
#endif
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_QRCODE_DEBUG>, PushScreenAction<QrCodeDebugDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_XY_DEBUG>, PushScreenAction<XYDebugDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BATTERYDEBUG>, PushScreenAction<BatteryDebugMenu>, StaticMenuItemIcon<&bobbyicons::battery>>>();
|
||||
if (configs.feature.udpcloud.isEnabled.value())
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ class OpenPopupAction : public virtual espgui::ActionInterface
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured("Das\nist\nein sehr langer text, der nicht in eine zeile passt");
|
||||
BobbyErrorHandler{}.errorOccurred("Das\nist\nein sehr langer text, der nicht in eine zeile passt");
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
|
@ -129,84 +129,84 @@ void ExtraButtonCalibrateMenu::rawButtonPressed(uint8_t button)
|
||||
case WaitingUp2:
|
||||
if (auto result = configs.write_config(configs.dpadMappingUp2, button); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WaitingDown2:
|
||||
if (auto result = configs.write_config(configs.dpadMappingDown2, button); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WaitingLeft2:
|
||||
if (auto result = configs.write_config(configs.dpadMappingLeft2, button); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WaitingRight2:
|
||||
if (auto result = configs.write_config(configs.dpadMappingRight2, button); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WaitingProfile0:
|
||||
if (auto result = configs.write_config(configs.dpadMappingProfile0, button); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WaitingProfile1:
|
||||
if (auto result = configs.write_config(configs.dpadMappingProfile1, button); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WaitingProfile2:
|
||||
if (auto result = configs.write_config(configs.dpadMappingProfile2, button); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WaitingProfile3:
|
||||
if (auto result = configs.write_config(configs.dpadMappingProfile3, button); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WaitingExtra1:
|
||||
if (auto result = configs.write_config(configs.dpadMappingExtra1, button); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WaitingExtra2:
|
||||
if (auto result = configs.write_config(configs.dpadMappingExtra2, button); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WaitingExtra3:
|
||||
if (auto result = configs.write_config(configs.dpadMappingExtra3, button); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WaitingExtra4:
|
||||
if (auto result = configs.write_config(configs.dpadMappingExtra4, button); !result)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -29,7 +29,7 @@ void exitFeatureFlagsMenu()
|
||||
espgui::popScreen();
|
||||
if (isDirty)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(TEXT_POPUP);
|
||||
BobbyErrorHandler{}.errorOccurred(TEXT_POPUP);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ public:
|
||||
void triggered() override
|
||||
{
|
||||
if (auto result = m_flag.isEnabled.write(configs.nvs_handle_user, !m_flag.isEnabled.value()); !result)
|
||||
errorOccured(std::move(result).error());
|
||||
errorOccurred(std::move(result).error());
|
||||
else
|
||||
isDirty = true;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace {
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(TEXT_GIT_MESSAGE);
|
||||
BobbyErrorHandler{}.errorOccurred(TEXT_GIT_MESSAGE);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace {
|
||||
|
||||
class MainMenu : public bobbygui::MenuDisplayWithTime
|
||||
{
|
||||
using Base = espgui::MenuDisplay;
|
||||
using Base = bobbygui::MenuDisplayWithTime;
|
||||
|
||||
public:
|
||||
MainMenu();
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
|
||||
if (!settingsPersister.openProfile(m_profileIndex)) // just switch nvs namespace
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(fmt::format("openProfile({}) failed", m_profileIndex));
|
||||
BobbyErrorHandler{}.errorOccurred(fmt::format("openProfile({}) failed", m_profileIndex));
|
||||
return;
|
||||
}
|
||||
saveProfileSettings();
|
||||
@ -60,7 +60,9 @@ public:
|
||||
}
|
||||
else if (m_menu.m_firstIndex != -1 && m_menu.m_firstIndex != m_profileIndex)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(fmt::format("Press CONFIRM to COPY from Profile {} to Profile {}", m_menu.m_firstIndex, m_profileIndex));
|
||||
BobbyErrorHandler{}.errorOccurred(
|
||||
fmt::format("Press CONFIRM to COPY from Profile {} to Profile {}", m_menu.m_firstIndex,
|
||||
m_profileIndex));
|
||||
m_mode = CONFIRM_COPY;
|
||||
}
|
||||
}
|
||||
@ -100,7 +102,9 @@ public:
|
||||
}
|
||||
else if (m_menu.m_firstIndex != -1 && m_menu.m_firstIndex != m_profileIndex)
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(fmt::format("Press CONFIRM to SWAP Profile {} with Profile {}", m_menu.m_firstIndex, m_profileIndex));
|
||||
BobbyErrorHandler{}.errorOccurred(
|
||||
fmt::format("Press CONFIRM to SWAP Profile {} with Profile {}", m_menu.m_firstIndex,
|
||||
m_profileIndex));
|
||||
m_mode = CONFIRM_SWAP;
|
||||
}
|
||||
}
|
||||
@ -125,7 +129,7 @@ public:
|
||||
{
|
||||
m_menu.lock();
|
||||
m_mode = CONFIRM_CLEAR;
|
||||
BobbyErrorHandler{}.errorOccured("Press CONFIRM to reset Profile or BACK to cancel.");
|
||||
BobbyErrorHandler{}.errorOccurred("Press CONFIRM to reset Profile or BACK to cancel.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,8 @@ public:
|
||||
constructMenuItem<makeComponent<MenuItem, typename Ttexts::DcPhaCFixedText, ColorInterface<TFT_DARKGREY>, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, typename Ttexts::ChopsText, ColorInterface<TFT_DARKGREY>, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, typename Ttexts::HallText, ColorInterface<TFT_DARKGREY>, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, typename Ttexts::IqText, ColorInterface<TFT_DARKGREY>, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, typename Ttexts::IdText, ColorInterface<TFT_DARKGREY>, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ void SelectBuildserverBranchMenu::update()
|
||||
check_descriptor_request();
|
||||
if (!request_failed.empty())
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(fmt::format("Error: {}", request_failed));
|
||||
BobbyErrorHandler{}.errorOccurred(fmt::format("Error: {}", request_failed));
|
||||
request_failed = {};
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ void SelectBuildMenu::update()
|
||||
check_descriptor_request();
|
||||
if (!request_failed.empty())
|
||||
{
|
||||
BobbyErrorHandler{}.errorOccured(fmt::format("Error: {}", request_failed));
|
||||
BobbyErrorHandler{}.errorOccurred(fmt::format("Error: {}", request_failed));
|
||||
request_failed = {};
|
||||
}
|
||||
}
|
||||
@ -137,7 +137,7 @@ void SelectBuildMenu::buildMenuFromJson()
|
||||
{
|
||||
auto &menuitem = constructMenuItem<VersionMenuItem<TFT_WHITE>>();
|
||||
menuitem.setHash(hash);
|
||||
menuitem.setUrl(fmt::format(url_for_hashes, hash));
|
||||
menuitem.setUrl(fmt::format(fmt::runtime(url_for_hashes), hash));
|
||||
}
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
void triggered() override
|
||||
{
|
||||
if (auto result = m_config->write(configs.nvs_handle_user, m_value); !result)
|
||||
BobbyErrorHandler{}.errorOccured(std::move(result).error());
|
||||
BobbyErrorHandler{}.errorOccurred(std::move(result).error());
|
||||
}
|
||||
private:
|
||||
const TEnum m_value;
|
||||
|
@ -5,11 +5,11 @@
|
||||
#include <fmt/core.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "utils.h"
|
||||
#include "displays/batteryinfodisplay.h"
|
||||
#include "displays/menus/mainmenu.h"
|
||||
#include "displays/statusdisplay.h"
|
||||
#include "displays/bmsdisplay.h"
|
||||
#include "globals.h"
|
||||
#include "utils.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
@ -58,14 +58,14 @@ void MetersDisplay::buttonPressed(espgui::Button button)
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case Button::Right: pushScreen<MainMenu>(); break;
|
||||
case Button::Up: switchScreen<StatusDisplay>(); break;
|
||||
case Button::Down:
|
||||
#ifdef FEATURE_BMS
|
||||
switchScreen<BmsDisplay>();
|
||||
#else
|
||||
case Button::Right:
|
||||
pushScreen<MainMenu>();
|
||||
break;
|
||||
case Button::Up:
|
||||
switchScreen<StatusDisplay>();
|
||||
#endif
|
||||
break;
|
||||
case Button::Down:
|
||||
switchScreen<BatteryInfoDisplay>();
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
else if (!m_result && !m_result.error().empty())
|
||||
{
|
||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
BobbyErrorHandler{}.errorOccured(fmt::format("Error: {}", m_result.error()));
|
||||
BobbyErrorHandler{}.errorOccurred(fmt::format("Error: {}", m_result.error()));
|
||||
m_result.error().clear();
|
||||
}
|
||||
else
|
||||
|
93
main/displays/speedinfodisplay.cpp
Normal file
93
main/displays/speedinfodisplay.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
#include "speedinfodisplay.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <fmt/core.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/batteryinfodisplay.h"
|
||||
#include "displays/menus/mainmenu.h"
|
||||
#include "displays/statusdisplay.h"
|
||||
#include "drivingstatistics.h"
|
||||
|
||||
void SpeedInfoDisplay::initScreen()
|
||||
{
|
||||
Base::initScreen();
|
||||
|
||||
m_labelSpeed.start();
|
||||
|
||||
m_dischargingBar.start();
|
||||
m_chargingBar.start();
|
||||
|
||||
m_batteryPercentLabel.start();
|
||||
m_voltageLabel.start();
|
||||
m_distanceLabel.start();
|
||||
m_currentPowerLabel.start();
|
||||
}
|
||||
|
||||
void SpeedInfoDisplay::redraw()
|
||||
{
|
||||
using namespace espgui;
|
||||
|
||||
Base::redraw();
|
||||
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
tft.setTextFont(4);
|
||||
|
||||
tft.setTextSize(4);
|
||||
|
||||
m_labelSpeed.redraw(
|
||||
std::abs(avgSpeedKmh) < 10 ? fmt::format("{:.2f}", avgSpeedKmh) :
|
||||
(std::abs(avgSpeedKmh) < 100 ? fmt::format("{:.1f}", avgSpeedKmh) : fmt::format("{:.0f}", avgSpeedKmh)));
|
||||
|
||||
tft.setTextSize(1);
|
||||
m_batteryPercentLabel.redraw(getBatteryPercentageString());
|
||||
|
||||
if (const auto avgVoltage = controllers.getAvgVoltage(); avgVoltage)
|
||||
{
|
||||
auto watt = sumCurrent * *avgVoltage;
|
||||
|
||||
m_voltageLabel.redraw(fmt::format("{:.1f} V", avgVoltage.value()));
|
||||
tft.setTextSize(2);
|
||||
m_currentPowerLabel.redraw(fmt::format("{:.0f} W", watt));
|
||||
tft.setTextSize(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_voltageLabel.redraw("No voltage");
|
||||
m_currentPowerLabel.redraw("No power");
|
||||
}
|
||||
|
||||
m_distanceLabel.redraw(
|
||||
drivingStatistics.meters_driven > 1000 ? fmt::format("{:.3f} km", drivingStatistics.meters_driven / 1000) :
|
||||
(drivingStatistics.meters_driven > 100 ? fmt::format("{:.1f} m", drivingStatistics.meters_driven) : fmt::format("{:.2f} m", drivingStatistics.meters_driven)));
|
||||
|
||||
tft.setTextSize(1);
|
||||
|
||||
m_dischargingBar.redraw(sumCurrent < 0.f ? (-sumCurrent) : 0.f);
|
||||
m_chargingBar.redraw(sumCurrent > 0.f ? sumCurrent : 0.f);
|
||||
}
|
||||
|
||||
void SpeedInfoDisplay::buttonPressed(espgui::Button button)
|
||||
{
|
||||
Base::buttonPressed(button);
|
||||
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case Button::Right:
|
||||
espgui::pushScreen<MainMenu>();
|
||||
break;
|
||||
case Button::Up:
|
||||
espgui::switchScreen<BatteryInfoDisplay>();
|
||||
break;
|
||||
case Button::Down:
|
||||
#ifdef FEATURE_BMS
|
||||
espgui::switchScreen<BmsDisplay>();
|
||||
#else
|
||||
espgui::switchScreen<StatusDisplay>();
|
||||
#endif
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
}
|
32
main/displays/speedinfodisplay.h
Normal file
32
main/displays/speedinfodisplay.h
Normal file
@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <widgets/label.h>
|
||||
#include <widgets/progressbar.h>
|
||||
#include <widgets/reverseprogressbar.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbydisplay.h"
|
||||
|
||||
class SpeedInfoDisplay : public BobbyDisplay
|
||||
{
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
private:
|
||||
espgui::Label m_labelSpeed{5, 5};
|
||||
|
||||
espgui::ReverseProgressBar m_dischargingBar{10, 110, espgui::tft.width()/2 - 10, 25, 0, 40, TFT_GREEN};
|
||||
espgui::ProgressBar m_chargingBar{espgui::tft.width()/2, 110, espgui::tft.width()/2 - 10, 25, 0, 40, TFT_RED};
|
||||
|
||||
#define START_Y 150
|
||||
espgui::Label m_batteryPercentLabel{5, START_Y};
|
||||
espgui::Label m_voltageLabel{5, START_Y + 29 * 1};
|
||||
espgui::Label m_distanceLabel{5, START_Y + 29 * 2};
|
||||
espgui::Label m_currentPowerLabel{5, START_Y + 29 * 3};
|
||||
};
|
@ -4,23 +4,23 @@
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <fmt/core.h>
|
||||
#include <espwifistack.h>
|
||||
#include <fmt/core.h>
|
||||
#include <tftinstance.h>
|
||||
#include <schedulertask.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/menus/mainmenu.h"
|
||||
#include "displays/batteryinfodisplay.h"
|
||||
#include "displays/speedinfodisplay.h"
|
||||
#ifdef FEATURE_BMS
|
||||
#include "displays/bmsdisplay.h"
|
||||
#else
|
||||
#include "displays/metersdisplay.h"
|
||||
#endif
|
||||
#include "displays/menus/mainmenu.h"
|
||||
#include "displays/metersdisplay.h"
|
||||
#include "drivingstatistics.h"
|
||||
#include "udpcloud.h"
|
||||
#include "modes/defaultmode.h"
|
||||
#include "taskmanager.h"
|
||||
#include "newsettings.h"
|
||||
#include "taskmanager.h"
|
||||
#include "udpcloud.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
using namespace espgui;
|
||||
@ -230,14 +230,16 @@ void StatusDisplay::buttonPressed(espgui::Button button)
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case Button::Right: pushScreen<MainMenu>(); break;
|
||||
case Button::Right:
|
||||
pushScreen<MainMenu>();
|
||||
break;
|
||||
case Button::Up:
|
||||
if (simplified)
|
||||
return;
|
||||
#ifdef FEATURE_BMS
|
||||
switchScreen<BmsDisplay>();
|
||||
#else
|
||||
switchScreen<MetersDisplay>();
|
||||
switchScreen<SpeedInfoDisplay>();
|
||||
#endif
|
||||
break;
|
||||
case Button::Down:
|
||||
@ -245,8 +247,7 @@ void StatusDisplay::buttonPressed(espgui::Button button)
|
||||
return;
|
||||
switchScreen<MetersDisplay>();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,17 +4,17 @@
|
||||
#include <esp_heap_caps.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <espchrono.h>
|
||||
#include <widgets/label.h>
|
||||
#include <widgets/progressbar.h>
|
||||
#include <espchrono.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbydisplay.h"
|
||||
#include "modeinterface.h"
|
||||
#include "globals.h"
|
||||
#include "utils.h"
|
||||
#include "icons/alert.h"
|
||||
#include "battery.h"
|
||||
#include "bobbydisplay.h"
|
||||
#include "globals.h"
|
||||
#include "icons/alert.h"
|
||||
#include "modeinterface.h"
|
||||
#include "utils.h"
|
||||
|
||||
class StatusDisplay : public BobbyDisplay
|
||||
{
|
||||
|
77
main/displays/xydebugdisplay.cpp
Normal file
77
main/displays/xydebugdisplay.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
#include "xydebugdisplay.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <fmt/core.h>
|
||||
#include <screenmanager.h>
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbybuttons.h"
|
||||
|
||||
XYDebugDisplay::XYDebugDisplay() : m_labelCoordinates{5, 5} {}
|
||||
|
||||
void XYDebugDisplay::initScreen()
|
||||
{
|
||||
Base::initScreen();
|
||||
m_labelCoordinates.start();
|
||||
}
|
||||
|
||||
void XYDebugDisplay::redraw()
|
||||
{
|
||||
using namespace espgui;
|
||||
|
||||
Base::redraw();
|
||||
m_labelCoordinates.redraw(fmt::format("X: {}, Y: {}", m_current_cursor.x, m_current_cursor.y));
|
||||
|
||||
if (m_current_cursor.x != m_last_cursor.x || m_current_cursor.y != m_last_cursor.y)
|
||||
{
|
||||
tft.fillCircle(m_last_cursor.x, m_last_cursor.y, 2, TFT_BLACK);
|
||||
tft.fillCircle(m_current_cursor.x, m_current_cursor.y, 2, TFT_WHITE);
|
||||
|
||||
m_last_cursor = m_current_cursor;
|
||||
}
|
||||
}
|
||||
|
||||
void XYDebugDisplay::buttonPressed(espgui::Button button)
|
||||
{
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case Button::Left:
|
||||
case Button::Right:
|
||||
case Button::Up:
|
||||
case Button::Down:
|
||||
espgui::popScreen();
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
|
||||
switch (BobbyButton(button))
|
||||
{
|
||||
case BobbyButton::Left2:
|
||||
if (m_current_cursor.x > 0)
|
||||
{
|
||||
--m_current_cursor.x;
|
||||
}
|
||||
break;
|
||||
case BobbyButton::Right2:
|
||||
if (m_current_cursor.x < espgui::tft.width() - 1)
|
||||
{
|
||||
++m_current_cursor.x;
|
||||
}
|
||||
break;
|
||||
case BobbyButton::Up2:
|
||||
if (m_current_cursor.y > 0)
|
||||
{
|
||||
--m_current_cursor.y;
|
||||
}
|
||||
break;
|
||||
case BobbyButton::Down2:
|
||||
if (m_current_cursor.y < espgui::tft.height() - 1)
|
||||
{
|
||||
++m_current_cursor.y;
|
||||
}
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
}
|
29
main/displays/xydebugdisplay.h
Normal file
29
main/displays/xydebugdisplay.h
Normal file
@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <widgets/label.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbydisplay.h"
|
||||
|
||||
class XYDebugDisplay : public BobbyDisplay
|
||||
{
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
XYDebugDisplay();
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
private:
|
||||
typedef struct {
|
||||
uint8_t x;
|
||||
uint8_t y;
|
||||
} cursor_pos_t;
|
||||
|
||||
cursor_pos_t m_current_cursor{0, 0};
|
||||
cursor_pos_t m_last_cursor{0, 0};
|
||||
espgui::Label m_labelCoordinates;
|
||||
};
|
@ -96,6 +96,8 @@ void update()
|
||||
debounceBack = now;
|
||||
}
|
||||
}
|
||||
|
||||
constexpr const uint8_t BUTTON_COUNT = 4;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} // namespace dpad
|
||||
} // namespace
|
||||
|
@ -111,6 +111,7 @@ void update()
|
||||
debounceBack = now;
|
||||
}
|
||||
}
|
||||
constexpr const uint8_t BUTTON_COUNT = 4;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} // namespace dpad3wire
|
||||
} // namespace
|
||||
|
@ -1,8 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <cstdint>
|
||||
|
||||
#ifdef FEATURE_DPAD_5WIRESW
|
||||
namespace dpad5wire {
|
||||
void init();
|
||||
void update();
|
||||
constexpr const uint8_t BUTTON_COUNT = 8;
|
||||
} // namespace dpad5wire
|
||||
#endif
|
||||
|
@ -1,8 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <cstdint>
|
||||
|
||||
#ifdef FEATURE_DPAD_5WIRESW_2OUT
|
||||
namespace dpad5wire_2out {
|
||||
void init();
|
||||
void update();
|
||||
constexpr const uint8_t BUTTON_COUNT = 12;
|
||||
} // namespace dpad5wire_2out
|
||||
#endif
|
||||
|
@ -1,8 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <cstdint>
|
||||
|
||||
#ifdef FEATURE_DPAD_6WIRESW
|
||||
namespace dpad6wire {
|
||||
void init();
|
||||
void update();
|
||||
constexpr const uint8_t BUTTON_COUNT = 10;
|
||||
} // namespace dpad6wire
|
||||
#endif
|
||||
|
@ -1,8 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <cstdint>
|
||||
|
||||
#ifdef DPAD_BOARDCOMPUTER_V2
|
||||
namespace dpad_boardcomputer_v2 {
|
||||
void init();
|
||||
void update();
|
||||
constexpr const uint8_t BUTTON_COUNT = 16;
|
||||
} // namespace dpad_boardcomputer_v2
|
||||
#endif
|
||||
|
@ -39,6 +39,10 @@ bool simplified =
|
||||
ProfileSettings profileSettings;
|
||||
SettingsPersister settingsPersister;
|
||||
|
||||
std::atomic<int8_t> rawButtonRequest;
|
||||
std::atomic<int8_t> buttonRequest;
|
||||
bool initScreenRequest{false};
|
||||
|
||||
Controllers controllers;
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
// system includes
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
@ -25,11 +26,11 @@
|
||||
// local includes
|
||||
#include "controller.h"
|
||||
#include "display.h"
|
||||
#include "modeinterface.h"
|
||||
#include "profilesettings.h"
|
||||
#include "newsettings.h"
|
||||
#include "settingspersister.h"
|
||||
#include "macros_bobbycar.h"
|
||||
#include "modeinterface.h"
|
||||
#include "newsettings.h"
|
||||
#include "profilesettings.h"
|
||||
#include "settingspersister.h"
|
||||
|
||||
extern std::optional<int16_t> raw_gas, raw_brems;
|
||||
extern std::optional<float> gas, brems;
|
||||
@ -66,6 +67,10 @@ extern bool simplified;
|
||||
extern ProfileSettings profileSettings;
|
||||
extern SettingsPersister settingsPersister;
|
||||
|
||||
extern std::atomic<int8_t> rawButtonRequest;
|
||||
extern std::atomic<int8_t> buttonRequest;
|
||||
extern bool initScreenRequest;
|
||||
|
||||
class Controllers : public std::array<Controller, 2>
|
||||
{
|
||||
public:
|
||||
|
@ -217,7 +217,6 @@ void updateLedStrip()
|
||||
void showAnimation()
|
||||
{
|
||||
if (configs.ledstrip.enableLedAnimation.value()
|
||||
&& !simplified
|
||||
&& !(asyncOtaTaskStarted && configs.ledstrip.otaMode.value() != OtaAnimationModes::None)
|
||||
)
|
||||
{
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "motorpwmlimiter.h"
|
||||
#include "utils.h"
|
||||
|
||||
void initDrivingMode()
|
||||
{
|
||||
@ -21,4 +23,10 @@ void updateDrivingMode()
|
||||
|
||||
if (currentMode)
|
||||
currentMode->update();
|
||||
|
||||
fixCommonParams();
|
||||
motor_pwm_limiter::update();
|
||||
|
||||
// Last, send values to motor controllers
|
||||
sendCommands();
|
||||
}
|
||||
|
@ -258,8 +258,6 @@ void DefaultMode::update()
|
||||
motor.cruiseCtrlEna = false;
|
||||
motor.nCruiseMotTgt = 0;
|
||||
}
|
||||
fixCommonParams();
|
||||
}
|
||||
}
|
||||
sendCommands();
|
||||
}
|
||||
|
@ -76,9 +76,5 @@ void GametrakMode::update()
|
||||
motor.nCruiseMotTgt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
fixCommonParams();
|
||||
|
||||
sendCommands();
|
||||
}
|
||||
#endif
|
||||
|
@ -14,8 +14,4 @@ void IgnoreInputMode::update()
|
||||
motor.cruiseCtrlEna = false;
|
||||
motor.nCruiseMotTgt = 0;
|
||||
}
|
||||
|
||||
fixCommonParams();
|
||||
|
||||
sendCommands();
|
||||
}
|
||||
|
@ -105,8 +105,4 @@ void LarsmMode::update()
|
||||
motor.nCruiseMotTgt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
fixCommonParams();
|
||||
|
||||
sendCommands();
|
||||
}
|
||||
|
@ -78,8 +78,4 @@ void MickMode::update()
|
||||
motor.nCruiseMotTgt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
fixCommonParams();
|
||||
|
||||
sendCommands();
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user