80 Commits

Author SHA1 Message Date
d6b2b4b41c Merge pull request #358 from bobbycar-graz/move-configs 2022-09-18 12:04:49 +02:00
bff99bd6c5 Autogenerate available configs 2022-09-18 11:57:04 +02:00
98a1160c6f Moved all config files 2022-09-18 11:45:06 +02:00
7db25a5642 Merge pull request #356 from bobbycar-graz/ci 2022-09-18 11:25:52 +02:00
405ab92cf2 Removed unused configs 2022-09-18 11:13:26 +02:00
6f7b598bd7 Merge pull request #355 from bobbycar-graz/update-bobbycar-protocols 2022-09-18 11:11:48 +02:00
c129106ff4 Added iq and id 2022-09-18 11:03:28 +02:00
4885913c75 Updated bobbycar-protocol 2022-09-18 11:03:27 +02:00
f5d6535db9 Merge pull request #348 from bobbycar-graz/peter_screen_improvements
Speed screen improvements
2022-09-17 17:55:45 +02:00
f18a057411 Merge branch 'master' into peter_screen_improvements 2022-09-17 17:22:14 +02:00
72c1e959a1 Fixed ledstrip direction 2022-08-28 23:33:10 +02:00
3fe227a82b Merge pull request #255 from bobbycar-graz/websocket 2022-08-07 00:22:14 +02:00
e518c80e03 Removed display-related websocket stuff for merge 2022-08-07 00:09:40 +02:00
f8baa1c6ea Updated 2022-08-06 23:35:35 +02:00
67580cb7ec Fixed code 2022-08-06 23:35:35 +02:00
1abb83e6b1 More remote display 2022-08-06 23:35:35 +02:00
ad9b3c4e53 WIP binary protocol 2022-08-06 23:35:35 +02:00
e23418dbb0 Dev commit, probably not working 2022-08-06 23:35:35 +02:00
c39033399b Updated sdkconfig 2022-08-06 23:35:35 +02:00
0565c3042d Changed to fork 2022-08-06 23:35:35 +02:00
cb7d4180c4 Default value 2022-08-06 23:35:34 +02:00
bc6dd5a50c Fixed crash when pressing buttons 2022-08-06 23:35:34 +02:00
7a887a3323 Fixed compiling 2022-08-06 23:35:34 +02:00
73fd65b04f Fix for no buttons 2022-08-06 23:35:34 +02:00
0fab6e72e1 Added button control 2022-08-06 23:35:34 +02:00
0cf28d961a Kinda unified dpads 2022-08-06 23:35:34 +02:00
6c94b608fa Implemented enums for cloud 2022-08-06 23:35:34 +02:00
1366f3fedb Iterate Enum fixes 2022-08-06 23:35:34 +02:00
ca1b7173e7 Updated sdkconfig 2022-08-06 23:35:34 +02:00
1317cec337 Added temperature and current 2022-08-06 23:35:34 +02:00
e49603751f Implemented ota 2022-08-06 23:35:34 +02:00
c16a126a2f Fixed format string 2022-08-06 23:35:33 +02:00
91f2f621fe Added voltage field 2022-08-06 23:35:33 +02:00
7bece3c32f Added cloud destroy and battery percentage 2022-08-06 23:35:33 +02:00
2773f0614d Updated protocol 2022-08-06 23:35:33 +02:00
474b48ff3e Added testdevice 2022-08-06 23:35:33 +02:00
11b9564b07 Fixed can still having errors when both boards are deactivated 2022-08-06 23:35:33 +02:00
0c81c96e46 Changed to debug 2022-08-06 23:35:33 +02:00
01cf28e8f0 Implemented cloud nvs 2022-08-06 23:35:33 +02:00
3722d87aee Added type to string 2022-08-06 23:35:33 +02:00
12261a815f Implemented websocket cloud system 2022-08-06 23:35:33 +02:00
c0069006cd Fixed compiling by removing dot 2022-08-06 23:35:33 +02:00
8a8f800447 Formatting, also added new defaults 2022-08-06 23:35:32 +02:00
9068be4a2d Fixed compiling 2022-08-06 23:35:32 +02:00
cab4dd2ca1 New config lib fixes 2022-08-06 23:35:32 +02:00
83ea64a086 Added popup handler 2022-08-06 23:35:32 +02:00
5d4655b549 Made some changes so it will work without TFT_eSPI hack 2022-08-06 23:35:32 +02:00
6f6966d13e Some enhancements 2022-08-06 23:35:32 +02:00
72ce9fb3a5 Rendering 2022-08-06 23:35:32 +02:00
d805bcfb2c change Wh/km to W in speed info display 2022-07-17 16:31:29 +02:00
a462e97d5f Merge pull request #347 from bobbycar-graz/fixed-rc 2022-07-06 22:19:11 +02:00
cff49fa3a8 Fixed config 2022-07-06 21:57:13 +02:00
ee6fb1f99c Merge pull request #344 from bobbycar-graz/c++23
Upgrade to C++23
2022-06-25 22:35:06 +02:00
3c13473d0c Upgrade to C++23 2022-06-25 22:16:21 +02:00
38fb68ce2e Merge pull request #331 from bobbycar-graz/more-displays 2022-06-23 20:30:25 +02:00
55386b5fb3 Fixed formatting 2022-06-23 20:15:51 +02:00
0393ac750b fix speed info display 2022-06-23 20:15:51 +02:00
647365c5fc improve steedinfodisplay 2022-06-23 20:15:51 +02:00
756c8bde94 Hopefully fixed compile-errors 2022-06-23 20:15:51 +02:00
56d0cb2ab0 Fixed metersdisplay, implemented speed display 2022-06-23 20:15:51 +02:00
d829c0d5cb Fixed spelling 2022-06-23 20:15:51 +02:00
ff104923d7 Updated gui lib 2022-06-23 20:15:51 +02:00
a5ee6bb557 Added battery status display 2022-06-23 20:15:50 +02:00
b9961e2e2f Added debug menu for display coordinates 2022-06-23 20:15:50 +02:00
65bc7d2b38 Merge pull request #342 from bobbycar-graz/add-ble-fence 2022-06-23 20:12:49 +02:00
08e2f6e4d3 Fixed crash 2022-06-23 19:58:35 +02:00
0843e4881b Fixes 2022-06-23 19:02:31 +02:00
cf278e4d18 Add BLE fence 2022-06-23 19:02:31 +02:00
3e70a1fc74 Pull fixCommonParams and sendCommand out of driving modes 2022-06-23 19:02:31 +02:00
5971061bc7 Merge pull request #343 from bobbycar-graz/aveexy 2022-06-23 18:41:42 +02:00
eef937edea Fixed button calibrate display 2022-06-23 18:25:46 +02:00
401c870287 Added better default values 2022-06-23 18:25:46 +02:00
66a469f4e3 Added OTA Name define 2022-06-23 18:25:46 +02:00
ba45f28f17 Added aveexy config 2022-06-23 18:25:46 +02:00
735ad66dba Merge pull request #341 from bobbycar-graz/fixes 2022-06-20 09:50:36 +02:00
325d719aee Fixed bug that crashed the firmware 2022-06-20 09:31:12 +02:00
6144a05e25 Merge pull request #340 from bobbycar-graz/export-fixes 2022-06-13 22:45:26 +02:00
5db917786a Remove shell prefix 2022-06-13 22:34:21 +02:00
cf2f9a5939 Merge pull request #339 from bobbycar-graz/fix-compiling 2022-06-13 22:30:39 +02:00
54cdeee1c9 Fixed message 2022-06-13 22:11:11 +02:00
120 changed files with 5724 additions and 418 deletions

View File

@ -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
View File

@ -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

View File

@ -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
)

View 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
)

View File

@ -1,4 +1,5 @@
set(BOBBY_APP_NAME bobbyquad_comred)
set(BOBBY_DEFAULT_OTA_NAME comred)
add_definitions(
-DUSER_SETUP_LOADED=1

View File

@ -1,4 +1,5 @@
set(BOBBY_APP_NAME bobbyquad_comred_new)
set(BOBBY_DEFAULT_OTA_NAME comred_new)
add_definitions(
-DUSER_SETUP_LOADED=1

View File

@ -1,4 +1,5 @@
set(BOBBY_APP_NAME bobbyquad_feedc0de)
set(BOBBY_DEFAULT_OTA_NAME feedc0de)
add_definitions(
-DUSER_SETUP_LOADED=1

View File

@ -1,4 +1,5 @@
set(BOBBY_APP_NAME bobbyquad_gernot)
set(BOBBY_DEFAULT_OTA_NAME gernot)
add_definitions(
-DUSER_SETUP_LOADED=1

View File

@ -1,4 +1,5 @@
set(BOBBY_APP_NAME bobbyquad_greyhash)
set(BOBBY_DEFAULT_OTA_NAME greyhash)
add_definitions(
-DUSER_SETUP_LOADED=1

View File

@ -1,4 +1,5 @@
set(BOBBY_APP_NAME bobbyquad_mick)
set(BOBBY_DEFAULT_OTA_NAME mick)
add_definitions(
-DUSER_SETUP_LOADED=1

View File

@ -1,4 +1,5 @@
set(BOBBY_APP_NAME bobbyquad_nofeatures)
set(BOBBY_DEFAULT_OTA_NAME nofeatures)
add_definitions(
-DUSER_SETUP_LOADED=1

View File

@ -1,4 +1,5 @@
set(BOBBY_APP_NAME bobbyquad_peter)
set(BOBBY_DEFAULT_OTA_NAME peter)
add_definitions(
-DUSER_SETUP_LOADED=1

View File

@ -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

View 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

File diff suppressed because it is too large Load Diff

1850
configs/sdkconfig_testdevice Normal file

File diff suppressed because it is too large Load Diff

Submodule esp-idf updated: d0026946cd...468b1f17c9

View File

@ -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"

View File

@ -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}
)

View File

@ -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; } };

View File

@ -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());
}
};

View File

@ -6,7 +6,6 @@
// 3rdparty lib includes
#include <ArduinoJson.h>
#include <wifi_bobbycar.h>
#include <futurecpp.h>
// local includes
#include "ledstrip.h"

View File

@ -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"

View File

@ -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);

View File

@ -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();

View File

@ -5,5 +5,5 @@
struct BobbyErrorHandler : public virtual espgui::ErrorHandlerInterface
{
void errorOccured(std::string &&error) override;
void errorOccurred(std::string &&error) override;
};

View File

@ -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 {

View File

@ -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()

View File

@ -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;

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

File diff suppressed because it is too large Load Diff

View File

@ -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();

View File

@ -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)

View File

@ -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)

View File

@ -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:

View 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:;
}
}

View 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};
};

View File

@ -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:;
}

View File

@ -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();
}
}

View File

@ -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>>>();

View File

@ -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

View File

@ -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

View File

@ -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())
{

View File

@ -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

View File

@ -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;

View File

@ -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;
}

View File

@ -29,7 +29,7 @@ namespace {
public:
void triggered() override
{
BobbyErrorHandler{}.errorOccured(TEXT_GIT_MESSAGE);
BobbyErrorHandler{}.errorOccurred(TEXT_GIT_MESSAGE);
}
};

View File

@ -22,7 +22,7 @@ namespace {
class MainMenu : public bobbygui::MenuDisplayWithTime
{
using Base = espgui::MenuDisplay;
using Base = bobbygui::MenuDisplayWithTime;
public:
MainMenu();

View File

@ -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.");
}
}

View File

@ -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>>>();
}

View File

@ -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 = {};
}
}

View File

@ -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>>>();
}

View File

@ -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;

View File

@ -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:;
}

View File

@ -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

View 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:;
}
}

View 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};
};

View File

@ -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:;
}
}

View File

@ -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
{

View 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:;
}
}

View 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;
};

View File

@ -96,6 +96,8 @@ void update()
debounceBack = now;
}
}
constexpr const uint8_t BUTTON_COUNT = 4;
#endif
}
}
} // namespace dpad
} // namespace

View File

@ -111,6 +111,7 @@ void update()
debounceBack = now;
}
}
constexpr const uint8_t BUTTON_COUNT = 4;
#endif
}
}
} // namespace dpad3wire
} // namespace

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -217,7 +217,6 @@ void updateLedStrip()
void showAnimation()
{
if (configs.ledstrip.enableLedAnimation.value()
&& !simplified
&& !(asyncOtaTaskStarted && configs.ledstrip.otaMode.value() != OtaAnimationModes::None)
)
{

View File

@ -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();
}

View File

@ -258,8 +258,6 @@ void DefaultMode::update()
motor.cruiseCtrlEna = false;
motor.nCruiseMotTgt = 0;
}
fixCommonParams();
}
}
sendCommands();
}

View File

@ -76,9 +76,5 @@ void GametrakMode::update()
motor.nCruiseMotTgt = 0;
}
}
fixCommonParams();
sendCommands();
}
#endif

View File

@ -14,8 +14,4 @@ void IgnoreInputMode::update()
motor.cruiseCtrlEna = false;
motor.nCruiseMotTgt = 0;
}
fixCommonParams();
sendCommands();
}

View File

@ -105,8 +105,4 @@ void LarsmMode::update()
motor.nCruiseMotTgt = 0;
}
}
fixCommonParams();
sendCommands();
}

View File

@ -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