64 Commits

Author SHA1 Message Date
c307b64b0a Schon wieder irgendwas 2023-08-14 15:34:31 +02:00
101a2b03a8 More fixes again 2023-08-13 22:33:45 +02:00
7b4fd61a39 Again so many tft fixes 2023-08-13 20:37:50 +02:00
f32013f782 Even more more fixes 2023-08-13 20:26:51 +02:00
cca17b7ded More fixes 2023-08-13 20:15:53 +02:00
a9794b13bd Updated to newest idf 2023-08-13 20:13:05 +02:00
1a7e83de83 Merge pull request #400 from bobbycar-graz/update-mick-config
Update mick configs
2023-04-04 09:18:51 +02:00
69b030268f Update mick configs 2023-04-04 08:35:14 +02:00
b3b45653b5 Merge pull request #399 from bobbycar-graz/fix-open-quickaction
Skip empty configs on door open quickaction
2023-04-04 08:32:50 +02:00
199a8f1e4e Skip empty configs on door open quickaction 2023-04-04 07:52:09 +02:00
d6c76f3c3f Merge pull request #398 from bobbycar-graz/fix-build
Also build components with C++23
2023-04-04 07:51:00 +02:00
0909c055de Also build components with C++23 2023-04-04 06:27:23 +02:00
52b55b38cd Merge pull request #391 from bobbycar-graz/add-idf-ver
Added idf version to git menu
2022-12-24 16:08:40 +01:00
65d7a7e9ec Added idf version to git menu 2022-12-24 16:05:13 +01:00
13a6ce3cc2 Merge pull request #390 from bobbycar-graz/update-for-nimble-tests
Fixed ble
2022-12-24 16:02:52 +01:00
6bc85875ee Fixed ble 2022-12-24 15:55:35 +01:00
4688326323 Revert init change 2022-12-24 15:30:05 +01:00
1b7a523acd Made some modifications 2022-12-24 15:29:45 +01:00
c85e84e9a1 Updated submodules 2022-12-23 00:02:52 +01:00
9e6ee2c957 Merge pull request #389 from bobbycar-graz/accel-brake-lights 2022-12-18 20:32:29 +01:00
d29a74dbd4 Decreased limit 2022-12-18 19:33:37 +01:00
b984360956 Added acceleration and power cause for brake lights 2022-12-18 19:32:41 +01:00
fa819822f0 Removed unused file 2022-12-18 19:31:45 +01:00
52ff7acd02 Added brake light optimizations 2022-12-18 02:31:41 +01:00
b61dfcf53d Added acceleration detection for brake lights 2022-12-18 00:18:50 +01:00
f6b4966071 Merge pull request #388 from bobbycar-graz/optimizations 2022-12-17 23:25:26 +01:00
a6fb1b7396 Added more stats 2022-10-30 02:47:13 +01:00
fd40d8dbd8 Increase timings 2022-10-30 02:19:41 +02:00
8cf766356c Do not display so many can messages 2022-10-30 02:19:27 +02:00
da8b91403d Merge pull request #372 from bobbycar-graz/setup-screen-361 2022-10-26 19:19:17 +02:00
4b4044626b Poti screen 2022-10-26 19:03:55 +02:00
71906ba511 Changed potis 2022-10-26 18:11:12 +02:00
ef7e605eb7 Enable feedcode cloud 2022-10-26 18:11:05 +02:00
32389f2bf9 Fixed font 2022-10-26 17:49:51 +02:00
e647c4b372 Merge pull request #384 from bobbycar-graz/fix-tft-espi 2022-10-26 17:31:00 +02:00
3c0b0cdbb1 Fixed everything 2022-10-26 17:30:02 +02:00
43c2338dbd Added raw poti graphs 2022-10-21 21:18:31 +02:00
846a5d753a Updated librarys 2022-10-21 16:15:38 +02:00
f4110bb854 Minor modifications 2022-10-21 15:42:26 +02:00
226636a82a Remove old files 2022-10-13 22:01:25 +02:00
a93f34e0ba Refactor into multiple files 2022-10-13 22:00:16 +02:00
f2350c8746 Made some opimizations 2022-10-13 16:48:32 +02:00
1840030461 Fixed layout 2022-10-13 16:23:09 +02:00
62a4b88acb Added more setup scripts 2022-10-13 15:43:09 +02:00
bc9a0c396c Unfinished button calibration 2022-10-13 15:43:09 +02:00
2bc1625fab Old formatting 2022-10-13 15:43:08 +02:00
9db3da4b27 Dev commit 2022-10-13 15:43:08 +02:00
4e0fdd65c3 Remove commented out code 2022-10-13 15:43:08 +02:00
129cc64d24 Partitially done 2022-10-13 15:43:08 +02:00
f8b1454f9a Added git status 2022-10-13 15:43:08 +02:00
4f703c4d10 Fixed compiling commits that contains "quotes" 2022-10-13 15:43:08 +02:00
95e04ef543 Changed nvs reset and some other things 2022-10-13 15:43:08 +02:00
87751682b2 Made some modifications to qr functions 2022-10-13 15:43:08 +02:00
7a3a081af4 Modified reset, added option to debug menu 2022-10-13 15:43:08 +02:00
327932ac14 Merge pull request #381 from bobbycar-graz/clang-format 2022-10-08 16:32:46 +02:00
17eff6127f Added basic clang format file 2022-10-08 16:10:11 +02:00
2ec6ddc150 Merge pull request #380 from bobbycar-graz/fix-boardcomputerhardwaresettingsmenu 2022-10-06 15:56:15 +02:00
ba5d907e38 Switched to popScreen 2022-10-06 15:42:45 +02:00
3de6827bc5 Merge pull request #379 from bobbycar-graz/fix-display-rotation 2022-10-06 13:51:03 +02:00
846d90836d Fixed screen rotation 2022-10-06 13:41:12 +02:00
6e3324fe65 Merge pull request #378 from bobbycar-graz/enhancements 2022-10-06 11:37:02 +02:00
79e51f7511 Added more debug text 2022-10-06 11:23:55 +02:00
33f35f14b7 Merge pull request #359 from bobbycar-graz/new-ota-url 2022-10-06 11:23:33 +02:00
b43e4e76ac Changed to new ota url 2022-10-06 10:50:49 +02:00
274 changed files with 8829 additions and 3257 deletions

66
.clang-format Normal file
View File

@ -0,0 +1,66 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: None
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterUnion: true
BeforeCatch: false
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 8
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Right
ReflowComments: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 0
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never

16
.gitmodules vendored
View File

@ -3,7 +3,7 @@
url = ../../0xFEEDC0DE64/espcpputils.git url = ../../0xFEEDC0DE64/espcpputils.git
[submodule "esp-idf"] [submodule "esp-idf"]
path = esp-idf path = esp-idf
url = ../../0xFEEDC0DE64/esp-idf.git url = ../../bobbycar-graz/esp-idf.git
[submodule "components/cpputils"] [submodule "components/cpputils"]
path = components/cpputils path = components/cpputils
url = ../../0xFEEDC0DE64/cpputils.git url = ../../0xFEEDC0DE64/cpputils.git
@ -22,9 +22,6 @@
[submodule "components/arduino-esp32"] [submodule "components/arduino-esp32"]
path = components/arduino-esp32 path = components/arduino-esp32
url = ../../0xFEEDC0DE64/arduino-esp32.git url = ../../0xFEEDC0DE64/arduino-esp32.git
[submodule "components/expected"]
path = components/expected
url = ../../0xFEEDC0DE64/expected.git
[submodule "components/bobbycar-protocol"] [submodule "components/bobbycar-protocol"]
path = components/bobbycar-protocol path = components/bobbycar-protocol
url = ../../bobbycar-graz/bobbycar-protocol.git url = ../../bobbycar-graz/bobbycar-protocol.git
@ -36,7 +33,7 @@
url = ../../0xFEEDC0DE64/espwifistack.git url = ../../0xFEEDC0DE64/espwifistack.git
[submodule "components/esp-nimble-cpp"] [submodule "components/esp-nimble-cpp"]
path = components/esp-nimble-cpp path = components/esp-nimble-cpp
url = ../../0xFEEDC0DE64/esp-nimble-cpp.git url = ../../bobbycar-graz/esp-nimble-cpp.git
[submodule "components/espasyncota"] [submodule "components/espasyncota"]
path = components/espasyncota path = components/espasyncota
url = ../../0xFEEDC0DE64/espasyncota.git url = ../../0xFEEDC0DE64/espasyncota.git
@ -70,6 +67,9 @@
[submodule "esp_boost"] [submodule "esp_boost"]
path = esp_boost path = esp_boost
url = ../../0xFEEDC0DE64/esp_boost.git url = ../../0xFEEDC0DE64/esp_boost.git
[submodule "components/asio_web"] [submodule "components/esptftlib"]
path = components/asio_web path = components/esptftlib
url = ../../0xFEEDC0DE64/asio_web.git url = ../../0xFEEDC0DE64/esptftlib.git
[submodule "components/espfontlib"]
path = components/espfontlib
url = ../../0xFEEDC0DE64/espfontlib.git

View File

@ -25,6 +25,8 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
idf_build_set_property(CXX_COMPILE_OPTIONS -std=gnu++23 APPEND)
set(EXTRA_COMPONENT_DIRS set(EXTRA_COMPONENT_DIRS
esp_boost esp_boost
esp-protocols/components esp-protocols/components

1
components/espfontlib Submodule

Submodule components/espfontlib added at 89048ff162

1
components/esptftlib Submodule

Submodule components/esptftlib added at b779a4c09d

View File

@ -1,20 +1,20 @@
set(BOBBY_APP_NAME bobbyquad_comred_new) set(BOBBY_APP_NAME bobbyquad_comred_new)
set(BOBBY_DEFAULT_USERNAME comred_new) set(BOBBY_DEFAULT_USERNAME comred_new)
add_definitions( # add_definitions(
-DUSER_SETUP_LOADED=1 # -DUSER_SETUP_LOADED=1
-DLOAD_GLCD=1 # -DLOAD_GLCD=1
-DLOAD_FONT2=1 # -DLOAD_FONT2=1
-DLOAD_FONT4=1 # -DLOAD_FONT4=1
-DLOAD_FONT7=1 # -DLOAD_FONT7=1
-DILI9341_DRIVER=1 # -DILI9341_DRIVER=1
-DTFT_MOSI=13 # -DTFT_MOSI=13
-DTFT_SCLK=15 # -DTFT_SCLK=15
-DTFT_CS=14 # -DTFT_CS=14
-DTFT_DC=12 # -DTFT_DC=12
-DTFT_RST=2 # -DTFT_RST=2
-DSPI_FREQUENCY=40000000 # -DSPI_FREQUENCY=40000000
) # )
set(BOBBYCAR_BUILDFLAGS set(BOBBYCAR_BUILDFLAGS
# Pins # Pins

View File

@ -1,21 +1,6 @@
set(BOBBY_APP_NAME bobbyquad_mick) set(BOBBY_APP_NAME bobbyquad_mick)
set(BOBBY_DEFAULT_USERNAME mick) set(BOBBY_DEFAULT_USERNAME mick)
add_definitions(
-DUSER_SETUP_LOADED=1
-DLOAD_GLCD=1
-DLOAD_FONT2=1
-DLOAD_FONT4=1
-DLOAD_FONT7=1
-DILI9341_DRIVER=1
-DTFT_MOSI=13
-DTFT_SCLK=15
-DTFT_CS=14
-DTFT_DC=12
-DTFT_RST=2
-DSPI_FREQUENCY=27000000
)
set(BOBBYCAR_BUILDFLAGS set(BOBBYCAR_BUILDFLAGS
# Pins # Pins
-DPINS_GAS=34 -DPINS_GAS=34

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,15 @@
dependencies: dependencies:
espressif/esp-idf-cxx:
component_hash: df7921090d6601b268b99b5d54d2f53bb5ea25dbd58cc53961ef7784326621de
source:
service_url: https://api.components.espressif.com/
type: service
version: 1.0.1-beta
idf: idf:
component_hash: null component_hash: null
source: source:
type: idf type: idf
version: 5.1.0 version: 5.2.0
manifest_hash: 61ebe3a040bdb7a8bb7b582261db12d83b6028789124b5f6ddacb4104628daa6 manifest_hash: 04b1e89bb78c4187b4d7bc0cf9461b7a3475762e58fec6f3bb49a885c56532c2
target: esp32 target: esp32
version: 1.0.0 version: 1.0.0

Submodule esp-idf updated: 756de87ccf...14b365579b

View File

@ -1,4 +1,4 @@
set(headers set(BOBBY_HEADERS
accessorhelpers.h accessorhelpers.h
accessors/globalaccessors.h accessors/globalaccessors.h
accessors/settingsaccessors.h accessors/settingsaccessors.h
@ -23,9 +23,9 @@ set(headers
actions/loadsettingsaction.h actions/loadsettingsaction.h
actions/modesettingsaction.h actions/modesettingsaction.h
actions/qraction.h actions/qraction.h
actions/rebootaction.h
actions/resetnvsaction.h actions/resetnvsaction.h
actions/savesettingsaction.h actions/savesettingsaction.h
actions/setupactions.h
actions/switchprofileaction.h actions/switchprofileaction.h
actions/tempomatmodeapplycurrentpeedaction.h actions/tempomatmodeapplycurrentpeedaction.h
actions/updateswapfrontbackaction.h actions/updateswapfrontbackaction.h
@ -72,7 +72,6 @@ set(headers
displays/bobbymenudisplay.h displays/bobbymenudisplay.h
displays/bobbypopupdisplay.h displays/bobbypopupdisplay.h
displays/bobbysplitgraphdisplay.h displays/bobbysplitgraphdisplay.h
displays/buttoncalibratedisplay.h
displays/calibratevoltagedisplay.h displays/calibratevoltagedisplay.h
displays/confiscationdisplay.h displays/confiscationdisplay.h
displays/gameoflifedisplay.h displays/gameoflifedisplay.h
@ -159,6 +158,14 @@ set(headers
displays/qrcodedebug.h displays/qrcodedebug.h
displays/qrdisplay.h displays/qrdisplay.h
displays/qrimportdisplay.h displays/qrimportdisplay.h
displays/rebootscreen.h
displays/setup/ask_calibrate_other_buttons.h
displays/setup/ask_setup_clouds.h
displays/setup/basic_buttons.h
displays/setup/calibrate_potis.h
displays/setup/final_information.h
displays/setup/information.h
displays/setup/setup_cloud.h
displays/speedinfodisplay.h displays/speedinfodisplay.h
displays/spirodisplay.h displays/spirodisplay.h
displays/starfielddisplay.h displays/starfielddisplay.h
@ -233,6 +240,7 @@ set(headers
serial_bobby.h serial_bobby.h
settingspersister.h settingspersister.h
settingsutils.h settingsutils.h
setup.h
softpwmlimiter.h softpwmlimiter.h
statistics.h statistics.h
statustexthelper.h statustexthelper.h
@ -259,7 +267,7 @@ set(headers
wifiguiutils.h wifiguiutils.h
) )
set(sources set(BOBBY_SOURCES
accessors/wifistaconfigaccessors.cpp accessors/wifistaconfigaccessors.cpp
actions/assertaction.cpp actions/assertaction.cpp
actions/bluetoothbeginaction.cpp actions/bluetoothbeginaction.cpp
@ -279,9 +287,9 @@ set(sources
actions/loadsettingsaction.cpp actions/loadsettingsaction.cpp
actions/modesettingsaction.cpp actions/modesettingsaction.cpp
actions/qraction.cpp actions/qraction.cpp
actions/rebootaction.cpp
actions/resetnvsaction.cpp actions/resetnvsaction.cpp
actions/savesettingsaction.cpp actions/savesettingsaction.cpp
actions/setupactions.cpp
actions/switchprofileaction.cpp actions/switchprofileaction.cpp
actions/tempomatmodeapplycurrentpeedaction.cpp actions/tempomatmodeapplycurrentpeedaction.cpp
actions/updateswapfrontbackaction.cpp actions/updateswapfrontbackaction.cpp
@ -325,7 +333,6 @@ set(sources
displays/bobbymenudisplay.cpp displays/bobbymenudisplay.cpp
displays/bobbypopupdisplay.cpp displays/bobbypopupdisplay.cpp
displays/bobbysplitgraphdisplay.cpp displays/bobbysplitgraphdisplay.cpp
displays/buttoncalibratedisplay.cpp
displays/calibratevoltagedisplay.cpp displays/calibratevoltagedisplay.cpp
displays/confiscationdisplay.cpp displays/confiscationdisplay.cpp
displays/gameoflifedisplay.cpp displays/gameoflifedisplay.cpp
@ -410,6 +417,14 @@ set(sources
displays/qrcodedebug.cpp displays/qrcodedebug.cpp
displays/qrdisplay.cpp displays/qrdisplay.cpp
displays/qrimportdisplay.cpp displays/qrimportdisplay.cpp
displays/rebootscreen.cpp
displays/setup/ask_calibrate_other_buttons.cpp
displays/setup/ask_setup_clouds.cpp
displays/setup/basic_buttons.cpp
displays/setup/calibrate_potis.cpp
displays/setup/final_information.cpp
displays/setup/information.cpp
displays/setup/setup_cloud.cpp
displays/speedinfodisplay.cpp displays/speedinfodisplay.cpp
displays/spirodisplay.cpp displays/spirodisplay.cpp
displays/starfielddisplay.cpp displays/starfielddisplay.cpp
@ -485,6 +500,7 @@ set(sources
serial_bobby.cpp serial_bobby.cpp
settingspersister.cpp settingspersister.cpp
settingsutils.cpp settingsutils.cpp
setup.cpp
softpwmlimiter.cpp softpwmlimiter.cpp
statistics.cpp statistics.cpp
statustexthelper.cpp statustexthelper.cpp
@ -514,13 +530,13 @@ set(dependencies
freertos nvs_flash esp_http_server esp_https_ota mdns app_update esp_system esp_websocket_client driver esp_adc freertos nvs_flash esp_http_server esp_https_ota mdns app_update esp_system esp_websocket_client driver esp_adc
arduino-esp32 ArduinoJson esp-nimble-cpp FastLED-idf TFT_eSPI QRCode-esp32 arduino-esp32 ArduinoJson esp-nimble-cpp FastLED-idf TFT_eSPI QRCode-esp32
bobbycar-protocol cpputils cxx-ring-buffer date sunset bobbycar-protocol cpputils cxx-ring-buffer date sunset
espasynchttpreq espasyncota espchrono espcpputils espconfiglib esp-gui-lib esphttpdutils espwifistack expected fmt espasynchttpreq espasyncota espchrono espcpputils espconfiglib esp-gui-lib esphttpdutils espwifistack fmt
) )
idf_component_register( idf_component_register(
SRCS SRCS
${headers} ${BOBBY_HEADERS}
${sources} ${BOBBY_SOURCES}
INCLUDE_DIRS INCLUDE_DIRS
. .
REQUIRES REQUIRES
@ -538,14 +554,31 @@ execute_process(
COMMAND git rev-parse --abbrev-ref HEAD COMMAND git rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE GIT_BRANCH OUTPUT_VARIABLE GIT_BRANCH
) )
execute_process(
COMMAND git status --short
OUTPUT_VARIABLE GIT_STATUS
)
if (NOT GIT_STATUS STREQUAL "")
set(GIT_STATUS "dirty")
else()
set(GIT_STATUS "clean")
endif()
string(STRIP "${GIT_REV}" GIT_REV) string(STRIP "${GIT_REV}" GIT_REV)
string(SUBSTRING "${GIT_REV}" 1 7 GIT_SHORT_REV) string(SUBSTRING "${GIT_REV}" 1 7 GIT_SHORT_REV)
string(STRIP "${GIT_MESSAGE}" GIT_MESSAGE) string(STRIP "${GIT_MESSAGE}" GIT_MESSAGE)
string(REPLACE "\n" " " GIT_MESSAGE "${GIT_MESSAGE}") string(REPLACE "\n" " " GIT_MESSAGE "${GIT_MESSAGE}")
string(REPLACE "\"" "\\\"" GIT_MESSAGE "${GIT_MESSAGE}")
string(SUBSTRING "${GIT_MESSAGE}" 0 100 GIT_MESSAGE) string(SUBSTRING "${GIT_MESSAGE}" 0 100 GIT_MESSAGE)
string(STRIP "${GIT_BRANCH}" GIT_BRANCH) string(STRIP "${GIT_BRANCH}" GIT_BRANCH)
message(WARNING "Git revision: ${GIT_REV}")
message(WARNING "Git short revision: ${GIT_SHORT_REV}")
message(WARNING "Git message: ${GIT_MESSAGE}")
message(WARNING "Git branch: ${GIT_BRANCH}")
message(WARNING "Git status: ${GIT_STATUS}")
if(NOT DEFINED BOBBY_DEFAULT_USERNAME) if(NOT DEFINED BOBBY_DEFAULT_USERNAME)
message(FATAL_ERROR "Please define BOBBY_DEFAULT_USERNAME") message(FATAL_ERROR "Please define BOBBY_DEFAULT_USERNAME")
endif() endif()

View File

@ -2,6 +2,7 @@
// system includes // system includes
#include <cstdint> #include <cstdint>
#include <expected>
// 3rdparty lib includes // 3rdparty lib includes
#include <accessorinterface.h> #include <accessorinterface.h>
@ -19,7 +20,7 @@ struct RefAccessorSaveSettings : public virtual espgui::RefAccessor<T>
espgui::RefAccessor<T>::setValue(value); espgui::RefAccessor<T>::setValue(value);
if (!saveProfileSettings()) if (!saveProfileSettings())
return tl::make_unexpected("saveProfileSettings() failed!"); return std::unexpected("saveProfileSettings() failed!");
return {}; return {};
}; };

View File

@ -1,5 +1,8 @@
#pragma once #pragma once
// system includes
#include <expected>
// 3rdparty lib includes // 3rdparty lib includes
#include <accessorinterface.h> #include <accessorinterface.h>
@ -29,7 +32,7 @@ struct NMotMaxKmhAccessor : public virtual espgui::AccessorInterface<int16_t>
{ {
profileSettings.limits.nMotMax = convertFromKmh(value); profileSettings.limits.nMotMax = convertFromKmh(value);
if (!saveProfileSettings()) if (!saveProfileSettings())
return tl::make_unexpected("saveProfileSettings() failed!"); return std::unexpected("saveProfileSettings() failed!");
return {}; return {};
} }
}; };
@ -77,7 +80,7 @@ struct WheelDiameterInchAccessor : public virtual espgui::AccessorInterface<floa
{ {
// profileSettings.controllerHardware.wheelDiameter = convertFromInch(value); // profileSettings.controllerHardware.wheelDiameter = convertFromInch(value);
// if (!saveProfileSettings()) // if (!saveProfileSettings())
// return tl::make_unexpected("saveProfileSettings() failed!"); // return std::unexpected("saveProfileSettings() failed!");
// return {}; // return {};
return configs.write_config(configs.controllerHardware.wheelDiameter, convertFromInch(value)); return configs.write_config(configs.controllerHardware.wheelDiameter, convertFromInch(value));
} }
@ -205,6 +208,9 @@ struct LedstripEnableBlinkAnimationAccessor : public NewSettingsAccessor<bool> {
struct LedstripOtaAnimationAccessor : public NewSettingsAccessor<OtaAnimationModes> { ConfigWrapper<OtaAnimationModes> &getConfig() const override { return configs.ledstrip.otaMode; } }; struct LedstripOtaAnimationAccessor : public NewSettingsAccessor<OtaAnimationModes> { ConfigWrapper<OtaAnimationModes> &getConfig() const override { return configs.ledstrip.otaMode; } };
struct LedstripEnableVisualizeBlinkAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableVisualizeBlink; } }; struct LedstripEnableVisualizeBlinkAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableVisualizeBlink; } };
struct LedstripAutomaticLightAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.automaticLight; } }; struct LedstripAutomaticLightAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.automaticLight; } };
struct LedstripBrakeLightUseAccelAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.brakeLights_useAccel; } };
struct LedstripBrakeLightUsePowerAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.brakeLights_usePower; } };
// Battery // Battery
struct BatterySeriesCellsAccessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.battery.cellsSeries; } }; struct BatterySeriesCellsAccessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.battery.cellsSeries; } };

View File

@ -32,7 +32,6 @@ private:
std::string m_msg; std::string m_msg;
}; };
template<typename TMenu>
class PushQrImportDisplayAction : public virtual espgui::ActionInterface class PushQrImportDisplayAction : public virtual espgui::ActionInterface
{ {
public: public:
@ -41,7 +40,7 @@ public:
void triggered() override void triggered() override
{ {
espgui::pushScreen<QrImportDisplay<TMenu>>(std::move(m_nvskey)); espgui::pushScreen<QrImportDisplay>(std::move(m_nvskey));
} }
private: private:
std::string m_nvskey; std::string m_nvskey;

View File

@ -1,22 +0,0 @@
#include "rebootaction.h"
// esp-idf includes
#include <esp_system.h>
// 3rdparty lib includes
#include <tftinstance.h>
void RebootAction::triggered()
{
espgui::tft.fillScreen(TFT_BLACK);
espgui::tft.setTextColor(TFT_YELLOW);
espgui::tft.drawString("Reboot", 5, 5, 4);
espgui::tft.fillRect(0, 34, espgui::tft.width(), 3, TFT_WHITE);
espgui::tft.setTextColor(TFT_WHITE);
espgui::tft.drawString("Rebooting now...", 0, 50, 4);
esp_restart();
}

View File

@ -1,10 +0,0 @@
#pragma once
// 3rdparty lib includes
#include <actioninterface.h>
class RebootAction : public virtual espgui::ActionInterface
{
public:
void triggered() override;
};

View File

@ -1,11 +0,0 @@
#include "resetnvsaction.h"
// system includes
#include <esp_system.h>
#include <nvs_flash.h>
void ResetNVSAction::triggered()
{
nvs_flash_erase();
esp_restart();
}

View File

@ -1,10 +1,40 @@
#pragma once #pragma once
// system includes
#include <esp_system.h>
// 3rdparty lib includes // 3rdparty lib includes
#include <actioninterface.h> #include <actioninterface.h>
#include <tftcolors.h>
// local includes
#include "newsettings.h"
template<bool reboot>
class ResetNVSAction : public virtual espgui::ActionInterface class ResetNVSAction : public virtual espgui::ActionInterface
{ {
public: public:
void triggered() override; void triggered() override
{
if (reboot)
{
tft.fillScreen(espgui::TFT_BLACK);
tft.setTextColor(espgui::TFT_YELLOW);
tft.drawString("Reboot", 5, 5, 4);
tft.fillRect(0, 34, tft.width(), 3, espgui::TFT_WHITE);
tft.setTextColor(espgui::TFT_WHITE);
tft.drawString("Rebooting now...", 0, 50, 4);
configs.reset();
esp_restart();
}
else
{
configs.reset();
}
}
}; };

View File

@ -0,0 +1,26 @@
#include "setupactions.h"
// 3rdparty lib includes
#include <screenmanager.h>
// local includes
#include "displays/setup/basic_buttons.h"
#include "displays/setup/calibrate_potis.h"
PushButtonCalibrateDisplayAction::PushButtonCalibrateDisplayAction(const bool early_return) :
m_early_return{early_return}
{}
void PushButtonCalibrateDisplayAction::triggered()
{
espgui::pushScreen<SetupBasicButtonsDisplay>(m_early_return);
}
PushPotiCalibrateDisplayAction::PushPotiCalibrateDisplayAction(const bool early_return) :
m_early_return{early_return}
{}
void PushPotiCalibrateDisplayAction::triggered()
{
// espgui::pushScreen<SetupCalibratePotisDisplay>(m_early_return); // commented out until implemented
}

View File

@ -0,0 +1,24 @@
#pragma once
// 3rdparty lib includes
#include <actioninterface.h>
class PushButtonCalibrateDisplayAction : public virtual espgui::ActionInterface
{
public:
explicit PushButtonCalibrateDisplayAction(bool early_return);
void triggered() override;
private:
const bool m_early_return;
};
class PushPotiCalibrateDisplayAction : public virtual espgui::ActionInterface
{
public:
explicit PushPotiCalibrateDisplayAction(bool early_return);
void triggered() override;
private:
const bool m_early_return;
};

View File

@ -21,19 +21,19 @@ constexpr const char * const TAG = "BOBBYBLE";
class RemoteControlCallbacks : public NimBLECharacteristicCallbacks class RemoteControlCallbacks : public NimBLECharacteristicCallbacks
{ {
public: public:
void onWrite(NimBLECharacteristic* pCharacteristic) override; void onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) override;
}; };
class WirelessSettingsCallbacks : public NimBLECharacteristicCallbacks class WirelessSettingsCallbacks : public NimBLECharacteristicCallbacks
{ {
public: public:
void onWrite(NimBLECharacteristic* pCharacteristic) override; void onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) override;
}; };
class WiFiListCallbacks : public NimBLECharacteristicCallbacks class WiFiListCallbacks : public NimBLECharacteristicCallbacks
{ {
public: public:
void onRead(NimBLECharacteristic* pCharacteristic) override; void onRead(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) override;
}; };
} // namespace } // namespace
@ -55,14 +55,20 @@ void createBle()
{ {
ESP_LOGI("BOBBY", "called"); ESP_LOGI("BOBBY", "called");
BLEDevice::init(configs.bluetoothName.value()); NimBLEDevice::init(configs.bluetoothName.value());
const auto serviceUuid{"0335e46c-f355-4ce6-8076-017de08cee98"}; const auto serviceUuid{"0335e46c-f355-4ce6-8076-017de08cee98"};
pServer = BLEDevice::createServer(); ESP_LOGI(TAG, "Creating BLE server");
pServer = NimBLEDevice::createServer();
ESP_LOGI(TAG, "Creating BLE service");
pService = pServer->createService(serviceUuid); pService = pServer->createService(serviceUuid);
ESP_LOGI(TAG, "Creating BLE characteristics");
livestatsCharacteristic = pService->createCharacteristic("a48321ea-329f-4eab-a401-30e247211524", NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::NOTIFY); livestatsCharacteristic = pService->createCharacteristic("a48321ea-329f-4eab-a401-30e247211524", NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::NOTIFY);
remotecontrolCharacteristic = pService->createCharacteristic("4201def0-a264-43e6-946b-6b2d9612dfed", NIMBLE_PROPERTY::WRITE); remotecontrolCharacteristic = pService->createCharacteristic("4201def0-a264-43e6-946b-6b2d9612dfed", NIMBLE_PROPERTY::WRITE);
remotecontrolCharacteristic->setCallbacks(&bleRemoteCallbacks); remotecontrolCharacteristic->setCallbacks(&bleRemoteCallbacks);
@ -72,19 +78,23 @@ void createBle()
getwifilist = pService->createCharacteristic("4201def2-a264-43e6-946b-6b2d9612dfed", NIMBLE_PROPERTY::READ); getwifilist = pService->createCharacteristic("4201def2-a264-43e6-946b-6b2d9612dfed", NIMBLE_PROPERTY::READ);
getwifilist->setCallbacks(&bleWiFiListCallbacks); getwifilist->setCallbacks(&bleWiFiListCallbacks);
ESP_LOGI(TAG, "Starting BLE service");
pService->start(); pService->start();
BLEAdvertising *pAdvertising = BLEDevice::getAdvertising(); ESP_LOGI(TAG, "Starting BLE advertising");
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
pAdvertising->addServiceUUID(serviceUuid); pAdvertising->addServiceUUID(serviceUuid);
pAdvertising->setScanResponse(true); pAdvertising->setScanResponse(true);
BLEDevice::startAdvertising(); NimBLEDevice::startAdvertising();
} }
void destroyBle() void destroyBle()
{ {
ESP_LOGI("BOBBY", "called"); ESP_LOGI("BOBBY", "called");
BLEDevice::deinit(true); NimBLEDevice::deinit(true);
pServer = {}; pServer = {};
pService = {}; pService = {};
@ -226,9 +236,9 @@ void handleBle()
namespace { namespace {
void RemoteControlCallbacks::onWrite(NimBLECharacteristic* pCharacteristic) void RemoteControlCallbacks::onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo)
{ {
const auto &val = pCharacteristic->getValue(); const std::string& val = pCharacteristic->getValue();
StaticJsonDocument<256> doc; StaticJsonDocument<256> doc;
if (const auto error = deserializeJson(doc, val)) if (const auto error = deserializeJson(doc, val))
@ -258,9 +268,9 @@ void RemoteControlCallbacks::onWrite(NimBLECharacteristic* pCharacteristic)
} }
} }
void WirelessSettingsCallbacks::onWrite(NimBLECharacteristic* pCharacteristic) void WirelessSettingsCallbacks::onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo)
{ {
const auto &val = pCharacteristic->getValue(); const std::string& val = pCharacteristic->getValue();
StaticJsonDocument<256> doc; StaticJsonDocument<256> doc;
if (const auto error = deserializeJson(doc, val)) if (const auto error = deserializeJson(doc, val))
@ -282,7 +292,7 @@ void WirelessSettingsCallbacks::onWrite(NimBLECharacteristic* pCharacteristic)
} }
} }
void WiFiListCallbacks::onRead(NimBLECharacteristic *pCharacteristic) void WiFiListCallbacks::onRead(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo)
{ {
StaticJsonDocument<768> responseDoc; StaticJsonDocument<768> responseDoc;
auto wifiArray = responseDoc.createNestedArray("wifis"); auto wifiArray = responseDoc.createNestedArray("wifis");

View File

@ -60,23 +60,18 @@ namespace bobbyblinker {
} }
if (configs.ledstrip.enableBrakeLights.value() && espchrono::ago(*brake_last_time_sent) > 500ms) if (configs.ledstrip.enableBrakeLights.value() && espchrono::ago(*brake_last_time_sent) > 500ms)
{ {
float avgPwm{}; if (brakeLightsStatus == brakeLightsOffSent)
for (const Controller &controller: controllers) {
avgPwm +=
controller.command.left.pwm * (controller.invertLeft ? -1 : 1) +
controller.command.right.pwm * (controller.invertRight ? -1 : 1);
}
avgPwm /= 4;
if (avgPwm < -1.f)
{ {
sendState("BRAKELIGHTSON"); if (brakeLightsStatus)
brakeLightsOffSent = false; {
} sendState("BRAKELIGHTSON");
else if (!brakeLightsOffSent && avgPwm > -1.f) brakeLightsOffSent = false;
{ }
sendState("BRAKELIGHTSOFF"); else if (!brakeLightsOffSent)
brakeLightsOffSent = true; {
sendState("BRAKELIGHTSOFF");
brakeLightsOffSent = true;
}
} }
} }
} }

View File

@ -8,7 +8,9 @@
void BobbyErrorHandler::errorOccurred(std::string &&error) void BobbyErrorHandler::errorOccurred(std::string &&error)
{ {
auto newDisplay = std::make_unique<BobbyPopupDisplay>(std::move(error), std::move(espgui::currentDisplay)); espgui::changeScreenCallback = [error_ = std::move(error)](espgui::TftInterface &tft) mutable {
newDisplay->initOverlay(); auto newDisplay = std::make_unique<BobbyPopupDisplay>(std::move(error_), std::move(espgui::currentDisplay));
espgui::currentDisplay = std::move(newDisplay); newDisplay->initOverlay(tft);
espgui::currentDisplay = std::move(newDisplay);
};
} }

View File

@ -95,6 +95,9 @@ void open_garage()
return; return;
for (const auto &config : configs.wireless_door_configs) for (const auto &config : configs.wireless_door_configs)
{ {
if (config.doorId.value().empty() || config.doorToken.value().empty())
continue;
if (const auto error = espnow::send_espnow_message(fmt::format("BOBBYOPEN:{}:{}", config.doorId.value(), config.doorToken.value())); error != ESP_OK) if (const auto error = espnow::send_espnow_message(fmt::format("BOBBYOPEN:{}:{}", config.doorId.value(), config.doorToken.value())); error != ESP_OK)
{ {
ESP_LOGE("BOBBY", "send_espnow_message() failed with: %s", esp_err_to_name(error)); ESP_LOGE("BOBBY", "send_espnow_message() failed with: %s", esp_err_to_name(error));

View File

@ -155,7 +155,7 @@ namespace buildserver {
std::string get_hash_url(std::string hash) std::string get_hash_url(std::string hash)
{ {
return fmt::format(fmt::runtime(url_for_hashes), hash); return fmt::format("{}{}.bin", url_for_hashes, hash);
} }
std::string get_latest_url() std::string get_latest_url()
@ -197,7 +197,7 @@ namespace buildserver {
index = 0; index = 0;
url_for_latest = fmt::format("{}{}", configs.otaServerUrl.value(), doc["latest"].as<std::string>()); url_for_latest = fmt::format("{}{}", configs.otaServerUrl.value(), doc["latest"].as<std::string>());
url_for_hashes = fmt::format("{}{}", configs.otaServerUrl.value(), doc["url"].as<std::string>()); url_for_hashes = fmt::format("{}{}", configs.otaServerUrl.value(), doc["new_url"].as<std::string>());
parsing_finished = true; parsing_finished = true;
} }

View File

@ -308,7 +308,7 @@ void sendCanCommands()
++can_total_error_cnt; ++can_total_error_cnt;
can_sequential_bus_errors = status_info.bus_error_count; can_sequential_bus_errors = status_info.bus_error_count;
if (can_total_error_cnt < 500) if (can_total_error_cnt < 500 && (configs.canUninstallOnReset.value() && can_total_error_cnt < 100))
ESP_LOGW(TAG, "twai_transmit() failed after %lldms with %s, seq err: %lu, total err: %lu", ESP_LOGW(TAG, "twai_transmit() failed after %lldms with %s, seq err: %lu, total err: %lu",
std::chrono::floor<std::chrono::milliseconds>(timestamp_after - timestamp_before).count(), std::chrono::floor<std::chrono::milliseconds>(timestamp_after - timestamp_before).count(),
esp_err_to_name(result), esp_err_to_name(result),

View File

@ -2,6 +2,7 @@
// system includes // system includes
#include <optional> #include <optional>
#include <expected>
// esp-idf includes // esp-idf includes
#include <esp_log.h> #include <esp_log.h>
@ -13,7 +14,6 @@
#include <menudisplay.h> #include <menudisplay.h>
#include <numberparsing.h> #include <numberparsing.h>
#include <screenmanager.h> #include <screenmanager.h>
#include <tftinstance.h>
#include <tickchrono.h> #include <tickchrono.h>
#include <wrappers/websocket_client.h> #include <wrappers/websocket_client.h>
@ -196,41 +196,41 @@ typename std::enable_if<
!std::is_same_v<T, HandbremseMode> && !std::is_same_v<T, HandbremseMode> &&
!std::is_same_v<T, BobbyQuickActions> && !std::is_same_v<T, BobbyQuickActions> &&
!std::is_same_v<T, BatteryCellType> !std::is_same_v<T, BatteryCellType>
, tl::expected<void, std::string>>::type , std::expected<void, std::string>>::type
set_config(ConfigWrapper<T> &config, std::string_view newValue) set_config(ConfigWrapper<T> &config, std::string_view newValue)
{ {
return tl::make_unexpected("Unsupported config type"); return std::unexpected("Unsupported config type");
} }
template<typename T> template<typename T>
typename std::enable_if< typename std::enable_if<
std::is_same_v<T, bool> std::is_same_v<T, bool>
, tl::expected<void, std::string>>::type , std::expected<void, std::string>>::type
set_config(ConfigWrapper<T> &config, std::string_view newValue) set_config(ConfigWrapper<T> &config, std::string_view newValue)
{ {
if (cpputils::is_in(newValue, "true", "false")) if (cpputils::is_in(newValue, "true", "false"))
return configs.write_config(config, newValue == "true"); return configs.write_config(config, newValue == "true");
else else
return tl::make_unexpected(fmt::format("only true and false allowed, not {}", newValue)); return std::unexpected(fmt::format("only true and false allowed, not {}", newValue));
} }
template<typename T> template<typename T>
typename std::enable_if< typename std::enable_if<
!std::is_same_v<T, bool> && !std::is_same_v<T, bool> &&
std::is_integral_v<T> std::is_integral_v<T>
, tl::expected<void, std::string>>::type , std::expected<void, std::string>>::type
set_config(ConfigWrapper<T> &config, std::string_view newValue) set_config(ConfigWrapper<T> &config, std::string_view newValue)
{ {
if (auto parsed = cpputils::fromString<T>(newValue)) if (auto parsed = cpputils::fromString<T>(newValue))
return configs.write_config(config, *parsed); return configs.write_config(config, *parsed);
else else
return tl::make_unexpected(fmt::format("could not parse {}", newValue)); return std::unexpected(fmt::format("could not parse {}", newValue));
} }
template<typename T> template<typename T>
typename std::enable_if< typename std::enable_if<
std::is_same_v<T, std::string> std::is_same_v<T, std::string>
, tl::expected<void, std::string>>::type , std::expected<void, std::string>>::type
set_config(ConfigWrapper<T> &config, std::string_view newValue) set_config(ConfigWrapper<T> &config, std::string_view newValue)
{ {
return configs.write_config(config, std::string{newValue}); return configs.write_config(config, std::string{newValue});
@ -239,31 +239,31 @@ set_config(ConfigWrapper<T> &config, std::string_view newValue)
template<typename T> template<typename T>
typename std::enable_if< typename std::enable_if<
std::is_same_v<T, wifi_stack::ip_address_t> std::is_same_v<T, wifi_stack::ip_address_t>
, tl::expected<void, std::string>>::type , std::expected<void, std::string>>::type
set_config(ConfigWrapper<T> &config, std::string_view newValue) set_config(ConfigWrapper<T> &config, std::string_view newValue)
{ {
if (const auto parsed = wifi_stack::fromString<wifi_stack::ip_address_t>(newValue); parsed) if (const auto parsed = wifi_stack::fromString<wifi_stack::ip_address_t>(newValue); parsed)
return configs.write_config(config, *parsed); return configs.write_config(config, *parsed);
else else
return tl::make_unexpected(parsed.error()); return std::unexpected(parsed.error());
} }
template<typename T> template<typename T>
typename std::enable_if< typename std::enable_if<
std::is_same_v<T, wifi_stack::mac_t> std::is_same_v<T, wifi_stack::mac_t>
, tl::expected<void, std::string>>::type , std::expected<void, std::string>>::type
set_config(ConfigWrapper<T> &config, std::string_view newValue) set_config(ConfigWrapper<T> &config, std::string_view newValue)
{ {
if (const auto parsed = wifi_stack::fromString<wifi_stack::mac_t>(newValue); parsed) if (const auto parsed = wifi_stack::fromString<wifi_stack::mac_t>(newValue); parsed)
return configs.write_config(config, *parsed); return configs.write_config(config, *parsed);
else else
return tl::make_unexpected(parsed.error()); return std::unexpected(parsed.error());
} }
template<typename T> template<typename T>
typename std::enable_if< typename std::enable_if<
std::is_same_v<T, std::optional<wifi_stack::mac_t>> std::is_same_v<T, std::optional<wifi_stack::mac_t>>
, tl::expected<void, std::string>>::type , std::expected<void, std::string>>::type
set_config(ConfigWrapper<T> &config, std::string_view newValue) set_config(ConfigWrapper<T> &config, std::string_view newValue)
{ {
if (newValue.empty()) if (newValue.empty())
@ -271,7 +271,7 @@ set_config(ConfigWrapper<T> &config, std::string_view newValue)
else if (const auto parsed = wifi_stack::fromString<wifi_stack::mac_t>(newValue); parsed) else if (const auto parsed = wifi_stack::fromString<wifi_stack::mac_t>(newValue); parsed)
return configs.write_config(config, *parsed); return configs.write_config(config, *parsed);
else else
return tl::make_unexpected(parsed.error()); return std::unexpected(parsed.error());
} }
template<typename T> template<typename T>
@ -284,13 +284,13 @@ typename std::enable_if<
std::is_same_v<T, HandbremseMode> || std::is_same_v<T, HandbremseMode> ||
std::is_same_v<T, BobbyQuickActions> || std::is_same_v<T, BobbyQuickActions> ||
std::is_same_v<T, BatteryCellType> std::is_same_v<T, BatteryCellType>
, tl::expected<void, std::string>>::type , std::expected<void, std::string>>::type
set_config(ConfigWrapper<T> &config, std::string_view newValue) set_config(ConfigWrapper<T> &config, std::string_view newValue)
{ {
if (auto parsed = cpputils::fromString<std::underlying_type_t<T>>(newValue)) if (auto parsed = cpputils::fromString<std::underlying_type_t<T>>(newValue))
return configs.write_config(config, T(*parsed)); return configs.write_config(config, T(*parsed));
else else
return tl::make_unexpected(fmt::format("could not parse {}", newValue)); return std::unexpected(fmt::format("could not parse {}", newValue));
} }
void send_config(uint32_t skipCount) void send_config(uint32_t skipCount)
@ -448,7 +448,7 @@ void send_information()
if (const auto *display = currentDisplay->asMenuDisplay()) if (const auto *display = currentDisplay->asMenuDisplay())
{ {
displayObject["name"] = display->text(); displayObject["name"] = display->title();
} }
} }
else else
@ -590,7 +590,7 @@ void updateCloud()
lastCloudSend = now; lastCloudSend = now;
} }
if (!lastHeartbeat || now - *lastHeartbeat >= 1500ms) if (!lastHeartbeat || now - *lastHeartbeat >= 1500ms && !configs.cloudSettings.cloudKey.value().empty())
{ {
cloudHeartbeat(); cloudHeartbeat();
lastHeartbeat = now; lastHeartbeat = now;
@ -743,7 +743,7 @@ void cloudSend()
const auto timeout = std::chrono::ceil<espcpputils::ticks>(espchrono::milliseconds32{configs.cloudSettings.cloudTransmitTimeout.value()}).count(); const auto timeout = std::chrono::ceil<espcpputils::ticks>(espchrono::milliseconds32{configs.cloudSettings.cloudTransmitTimeout.value()}).count();
if (!hasAnnouncedItself && configs.cloudSettings.cloudEnabled.value()) if (!hasAnnouncedItself && configs.cloudSettings.cloudEnabled.value() && !configs.cloudSettings.cloudKey.value().empty())
{ {
std::string helloWorld = getLoginMessage(); std::string helloWorld = getLoginMessage();
ESP_LOGW(TAG, "=====> %s", helloWorld.c_str()); ESP_LOGW(TAG, "=====> %s", helloWorld.c_str());

View File

@ -8,7 +8,6 @@
#include <esp_log.h> #include <esp_log.h>
// 3rdparty lib includes // 3rdparty lib includes
#include <tftinstance.h>
#include <esp32-hal-gpio.h> #include <esp32-hal-gpio.h>
#include <screenmanager.h> #include <screenmanager.h>
#include <changevaluedisplay.h> #include <changevaluedisplay.h>
@ -117,7 +116,7 @@ void handleNormalChar(char c)
{ {
case 'i': case 'i':
case 'I': case 'I':
espgui::tft.init(); tft.init();
break; break;
case 'p': case 'p':
case 'P': case 'P':

View File

@ -3,7 +3,7 @@ constexpr const char * const TAG = "BatteryGraphDisplay";
// 3rdparty lib includes // 3rdparty lib includes
#include <screenmanager.h> #include <screenmanager.h>
#include <tftinstance.h> #include <tftcolors.h>
// local includes // local includes
#include "battery.h" #include "battery.h"
@ -18,13 +18,13 @@ namespace {
constexpr const uint8_t TOP_OFFSET = 40; constexpr const uint8_t TOP_OFFSET = 40;
} // namespace } // namespace
void BatteryGraphDisplay::initScreen() void BatteryGraphDisplay::initScreen(espgui::TftInterface &tft)
{ {
Base::initScreen(); Base::initScreen(tft);
drawBatteryCurve(); drawBatteryCurve(tft);
} }
std::string BatteryGraphDisplay::text() const std::string BatteryGraphDisplay::title() const
{ {
if (const auto avgVoltage = controllers.getAvgVoltage(); avgVoltage) if (const auto avgVoltage = controllers.getAvgVoltage(); avgVoltage)
{ {
@ -33,10 +33,10 @@ std::string BatteryGraphDisplay::text() const
return TEXT_BATTERY_GRAPH; return TEXT_BATTERY_GRAPH;
} }
void BatteryGraphDisplay::redraw() void BatteryGraphDisplay::redraw(espgui::TftInterface &tft)
{ {
using namespace espgui; using namespace espgui;
Base::redraw(); Base::redraw(tft);
if (const auto avgVoltage = controllers.getAvgVoltage(); avgVoltage) if (const auto avgVoltage = controllers.getAvgVoltage(); avgVoltage)
{ {
@ -50,10 +50,10 @@ void BatteryGraphDisplay::redraw()
const uint16_t lastXOffset = onePercent * (100 - getBatteryPercentage(m_lastBatVoltage, cellType)); const uint16_t lastXOffset = onePercent * (100 - getBatteryPercentage(m_lastBatVoltage, cellType));
// clear the old one and draw the new one // clear the old one and draw the new one
tft.fillRect(lastXOffset + 2, TOP_OFFSET, onePercent, tft.height() - TOP_OFFSET, TFT_BLACK); tft.fillRect(lastXOffset + 2, TOP_OFFSET, onePercent, tft.height() - TOP_OFFSET, espgui::TFT_BLACK);
tft.fillRect(xOffset + 2, TOP_OFFSET, onePercent, tft.height() - TOP_OFFSET, TFT_WHITE); tft.fillRect(xOffset + 2, TOP_OFFSET, onePercent, tft.height() - TOP_OFFSET, espgui::TFT_WHITE);
m_lastBatVoltage = *avgVoltage; m_lastBatVoltage = *avgVoltage;
drawBatteryCurve(); drawBatteryCurve(tft);
} }
// tft.drawLine() code // tft.drawLine() code
} }
@ -73,11 +73,11 @@ void BatteryGraphDisplay::buttonPressed(espgui::Button button)
} }
} }
void BatteryGraphDisplay::drawBatteryCurve() void BatteryGraphDisplay::drawBatteryCurve(espgui::TftInterface &tft)
{ {
const auto points = count_curve_points(configs.battery.cellType.value()); const auto points = count_curve_points(configs.battery.cellType.value());
const auto max_height = espgui::tft.height() - 1; const auto max_height = tft.height() - 1;
const auto max_width = espgui::tft.width() - 4; const auto max_width = tft.width() - 4;
const uint16_t part = max_width / points; const uint16_t part = max_width / points;
const auto min_voltage = getMinBatCellVoltage(configs.battery.cellType.value()); const auto min_voltage = getMinBatCellVoltage(configs.battery.cellType.value());
const auto max_voltage = getMaxBatCellVoltage(configs.battery.cellType.value()); const auto max_voltage = getMaxBatCellVoltage(configs.battery.cellType.value());
@ -89,7 +89,7 @@ void BatteryGraphDisplay::drawBatteryCurve()
const int y1 = float_map(point->minVoltage / 100.f, min_voltage, max_voltage, max_height, TOP_OFFSET); const int y1 = float_map(point->minVoltage / 100.f, min_voltage, max_voltage, max_height, TOP_OFFSET);
const int x2 = 2 + part * (points - i); const int x2 = 2 + part * (points - i);
const int y2 = float_map(point->maxVoltage / 100.f, min_voltage, max_voltage, max_height, TOP_OFFSET); const int y2 = float_map(point->maxVoltage / 100.f, min_voltage, max_voltage, max_height, TOP_OFFSET);
espgui::tft.drawLine(x1, y1, x2, y2, TFT_WHITE); tft.drawLine(x1, y1, x2, y2, espgui::TFT_WHITE);
} }
} }
} }

View File

@ -7,13 +7,13 @@ class BatteryGraphDisplay : public BobbyDisplayWithTitle {
using Base = BobbyDisplayWithTitle; using Base = BobbyDisplayWithTitle;
public: public:
std::string text() const override; std::string title() const override;
void initScreen() override; void initScreen(espgui::TftInterface &tft) override;
void redraw() override; void redraw(espgui::TftInterface &tft) override;
void buttonPressed(espgui::Button button) override; void buttonPressed(espgui::Button button) override;
static void drawBatteryCurve(); static void drawBatteryCurve(espgui::TftInterface &tft);
private: private:
float m_lastBatVoltage{0}; float m_lastBatVoltage{0};

View File

@ -2,7 +2,7 @@
// 3rdparty lib includes // 3rdparty lib includes
#include <screenmanager.h> #include <screenmanager.h>
#include <tftinstance.h> #include <tftcolors.h>
// local includes // local includes
#include "battery.h" #include "battery.h"
@ -14,20 +14,20 @@
// display with big battery and ten bars (0-100%) // display with big battery and ten bars (0-100%)
void BatteryInfoDisplay::initScreen() void BatteryInfoDisplay::initScreen(espgui::TftInterface &tft)
{ {
using namespace espgui; using namespace espgui;
Base::initScreen(); Base::initScreen(tft);
tft.drawRoundRect(m_offset, m_offset, tft.width() - (m_offset * 2), tft.height() - (m_offset * 2), 10, TFT_WHITE); tft.drawRoundRect(m_offset, m_offset, tft.width() - (m_offset * 2), tft.height() - (m_offset * 2), 10, espgui::TFT_WHITE);
tft.drawRoundRect((tft.width() / 2) - (m_offset / 2), m_offset / 2, m_offset, m_offset / 2, 3, TFT_WHITE); tft.drawRoundRect((tft.width() / 2) - (m_offset / 2), m_offset / 2, m_offset, m_offset / 2, 3, espgui::TFT_WHITE);
m_lastBarCount = 0; m_lastBarCount = 0;
} }
void BatteryInfoDisplay::redraw() void BatteryInfoDisplay::redraw(espgui::TftInterface &tft)
{ {
using namespace espgui; using namespace espgui;
Base::redraw(); Base::redraw(tft);
// calculate height of space available for all bars // calculate height of space available for all bars
const auto min_x = m_offset + 3; // leave 2 pixels + 1 pixel for border const auto min_x = m_offset + 3; // leave 2 pixels + 1 pixel for border
@ -51,7 +51,7 @@ void BatteryInfoDisplay::redraw()
for (auto i = 0; i < 10; ++i) for (auto i = 0; i < 10; ++i)
{ {
const auto y = bottomY - (i * segment_height) - segment_height; 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.fillRoundRect(min_x, y, width, segment_height - 2, 10, segment_count > i ? espgui::TFT_GREEN : espgui::TFT_DARKGREY);
} }
} }
} }

View File

@ -8,8 +8,8 @@ class BatteryInfoDisplay : public BobbyDisplay
using Base = BobbyDisplay; using Base = BobbyDisplay;
public: public:
void initScreen() override; void initScreen(espgui::TftInterface &tft) override;
void redraw() override; void redraw(espgui::TftInterface &tft) override;
void buttonPressed(espgui::Button button) override; void buttonPressed(espgui::Button button) override;
private: private:

View File

@ -5,13 +5,12 @@
#include "displays/speedinfodisplay.h" #include "displays/speedinfodisplay.h"
#include "displays/statusdisplay.h" #include "displays/statusdisplay.h"
#include "screenmanager.h" #include "screenmanager.h"
#include "tftinstance.h"
using namespace espgui; using namespace espgui;
void BmsDisplay::initScreen() void BmsDisplay::initScreen(espgui::TftInterface &tft)
{ {
Base::initScreen(); Base::initScreen(tft);
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK); tft.setTextColor(TFT_WHITE, TFT_BLACK);
@ -43,9 +42,9 @@ void BmsDisplay::initScreen()
m_cycleLabel.start(); m_cycleLabel.start();
} }
void BmsDisplay::redraw() void BmsDisplay::redraw(espgui::TftInterface &tft)
{ {
Base::redraw(); Base::redraw(tft);
if (bluetoothSerial.hasClient()) if (bluetoothSerial.hasClient())
tft.setTextColor(TFT_GREEN, TFT_BLACK); tft.setTextColor(TFT_GREEN, TFT_BLACK);

View File

@ -18,8 +18,8 @@ class BmsDisplay :
using Base = BobbyDisplay; using Base = BobbyDisplay;
public: public:
void initScreen() override; void initScreen(espgui::TftInterface &tft) override;
void redraw() override; void redraw(espgui::TftInterface &tft) override;
void buttonPressed(espgui::Button button) override; void buttonPressed(espgui::Button button) override;

View File

@ -38,7 +38,7 @@ void BobbyGraphDisplay<COUNT>::rawButtonReleased(uint8_t button)
template<size_t COUNT> template<size_t COUNT>
void BobbyGraphDisplay<COUNT>::buttonPressed(espgui::Button button) void BobbyGraphDisplay<COUNT>::buttonPressed(espgui::Button button)
{ {
//Base::buttonPressed(button); Base::buttonPressed(button);
buttonPressedCommon(button); buttonPressedCommon(button);
} }

View File

@ -1,221 +0,0 @@
#include "buttoncalibratedisplay.h"
// esp-idf includes
#include <esp_log.h>
// 3rdparty lib includes
#include <tftinstance.h>
#include <fmt/core.h>
#include <screenmanager.h>
// local includes
#include "bobbyerrorhandler.h"
#include "displays/statusdisplay.h"
#include "newsettings.h"
namespace {
constexpr const char TAG[] = "BUTTON";
} // namespace
std::string ButtonCalibrateDisplay::text() const
{
return "Button calibrate";
}
void ButtonCalibrateDisplay::start()
{
Base::start();
m_oldMode = currentMode;
currentMode = &m_mode;
m_lastButton = std::nullopt;
m_status = WaitingLeft;
m_finished = false;
}
void ButtonCalibrateDisplay::initScreen()
{
Base::initScreen();
m_labelInstruction.start();
m_labelLeft.start();
m_labelRight.start();
m_labelUp.start();
m_labelDown.start();
m_labelEnd.start();
}
void ButtonCalibrateDisplay::update()
{
Base::update();
if (m_finished)
{
m_finished = false;
if (auto result = configs.write_config(configs.dpadMappingLeft, m_leftButton); !result)
{
BobbyErrorHandler{}.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{}.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{}.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{}.errorOccurred(std::move(result).error());
return;
}
else
{
ESP_LOGI(TAG, "Down button set to %d", m_downButton);
}
if (espgui::displayStack.empty())
{
espgui::switchScreen<StatusDisplay>();
}
else
espgui::popScreen();
}
}
void ButtonCalibrateDisplay::redraw()
{
Base::redraw();
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK);
switch (m_status)
{
case WaitingLeft:
if (m_lastButton)
m_labelInstruction.redraw("Press LEFT again");
else
m_labelInstruction.redraw("Press LEFT");
break;
case WaitingRight:
if (m_lastButton)
m_labelInstruction.redraw("Press RIGHT again");
else
m_labelInstruction.redraw("Press RIGHT");
break;
case WaitingUp:
if (m_lastButton)
m_labelInstruction.redraw("Press UP again");
else
m_labelInstruction.redraw("Press UP");
break;
case WaitingDown:
if (m_lastButton)
m_labelInstruction.redraw("Press DOWN again");
else
m_labelInstruction.redraw("Press DOWN");
break;
case Finished:
m_labelInstruction.redraw("Finished");
break;
}
m_labelLeft.redraw(m_status > WaitingLeft ? fmt::format("Left: {}", m_leftButton) : std::string{});
m_labelRight.redraw(m_status > WaitingRight ? fmt::format("Right: {}", m_rightButton) : std::string{});
m_labelUp.redraw(m_status > WaitingUp ? fmt::format("Up: {}", m_upButton) : std::string{});
m_labelDown.redraw(m_status > WaitingDown ? fmt::format("Down: {}", m_downButton) : std::string{});
m_labelEnd.redraw(m_status == Finished ? "Press RIGHT to save" : "");
}
void ButtonCalibrateDisplay::stop()
{
Base::stop();
if (currentMode == &m_mode)
{
// to avoid crash after deconstruction
m_mode.stop();
lastMode = nullptr;
currentMode = m_oldMode;
}
}
void ButtonCalibrateDisplay::rawButtonPressed(uint8_t button)
{
//Base::rawButtonPressed(button);
if (m_status == Finished)
{
if (button == m_rightButton)
{
ESP_LOGI(TAG, "correct button");
m_finished = true;
}
else
ESP_LOGI(TAG, "wrong button");
}
else if (!m_lastButton || *m_lastButton != button)
m_lastButton = button;
else
{
switch (m_status)
{
case WaitingLeft:
m_leftButton = button;
m_lastButton = std::nullopt;
m_status = WaitingRight;
break;
case WaitingRight:
m_rightButton = button;
m_lastButton = std::nullopt;
m_status = WaitingUp;
break;
case WaitingUp:
m_upButton = button;
m_lastButton = std::nullopt;
m_status = WaitingDown;
break;
case WaitingDown:
m_downButton = button;
m_lastButton = std::nullopt;
m_status = Finished;
break;
case Finished:;
}
}
}
void ButtonCalibrateDisplay::rawButtonReleased(uint8_t button)
{
//Base::rawButtonReleased(button);
}
void ButtonCalibrateDisplay::buttonPressed(espgui::Button button)
{
//Base::buttonPressed(button);
}
void ButtonCalibrateDisplay::buttonReleased(espgui::Button button)
{
//Base::buttonReleased(button);
}

View File

@ -1,53 +0,0 @@
#pragma once
// 3rdparty lib includes
#include <displaywithtitle.h>
#include <widgets/label.h>
// local includes
#include "globals.h"
#include "modeinterface.h"
#include "modes/ignoreinputmode.h"
class ButtonCalibrateDisplay : public espgui::DisplayWithTitle
{
using Base = espgui::DisplayWithTitle;
public:
ButtonCalibrateDisplay() = default;
explicit ButtonCalibrateDisplay(bool bootup) : m_bootup{bootup} {}
std::string text() const override;
void start() override;
void initScreen() override;
void update() override;
void redraw() override;
void stop() override;
void rawButtonPressed(uint8_t button) override;
void rawButtonReleased(uint8_t button) override;
void buttonPressed(espgui::Button button) override;
void buttonReleased(espgui::Button button) override;
private:
const bool m_bootup{false};
ModeInterface *m_oldMode;
IgnoreInputMode m_mode{0, bobbycar::protocol::ControlType::FieldOrientedControl, bobbycar::protocol::ControlMode::Torque};
std::optional<uint8_t> m_lastButton;
enum { WaitingLeft, WaitingRight, WaitingUp, WaitingDown, Finished } m_status;
espgui::Label m_labelInstruction{25, 72};
espgui::Label m_labelLeft{25, 100};
espgui::Label m_labelRight{25, 125};
espgui::Label m_labelUp{25, 150};
espgui::Label m_labelDown{25, 175};
espgui::Label m_labelEnd{25, 225};
uint8_t m_leftButton, m_rightButton, m_upButton, m_downButton;
bool m_finished;
};

View File

@ -134,7 +134,7 @@ CalibrateVoltageDisplay::CalibrateVoltageDisplay()
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_VOLTAGECALIBRATION_RESET>, ResetCalibrationAction>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_VOLTAGECALIBRATION_RESET>, ResetCalibrationAction>>();
} }
std::string CalibrateVoltageDisplay::text() const std::string CalibrateVoltageDisplay::title() const
{ {
return TEXT_BATTERY_CALIBRATE; return TEXT_BATTERY_CALIBRATE;
} }

View File

@ -8,7 +8,7 @@ class CalibrateVoltageDisplay : public BobbyMenuDisplay
public: public:
CalibrateVoltageDisplay(); CalibrateVoltageDisplay();
std::string text() const override; std::string title() const override;
void back() override; void back() override;
}; };

View File

@ -1,10 +1,10 @@
#include "confiscationdisplay.h" #include "confiscationdisplay.h"
// 3rdparty lib includes // 3rdparty lib includes
#include <tftinstance.h>
#include <screenmanager.h> #include <screenmanager.h>
#include <esprandom.h> #include <esprandom.h>
#include <randomutils.h> #include <randomutils.h>
#include <fontrenderer.h>
// local includes // local includes
#include "globals.h" #include "globals.h"
@ -29,39 +29,39 @@ void ConfiscationDisplay::start()
m_nextRestart = espchrono::millis_clock::now() + std::chrono::seconds{cpputils::randomNumber(3, 7, espcpputils::esp_random_device{})}; m_nextRestart = espchrono::millis_clock::now() + std::chrono::seconds{cpputils::randomNumber(3, 7, espcpputils::esp_random_device{})};
} }
void ConfiscationDisplay::initScreen() void ConfiscationDisplay::initScreen(espgui::TftInterface &tft)
{ {
Base::initScreen(); Base::initScreen(tft);
espgui::tft.setSwapBytes(true); espgui::FontRenderer fontRenderer{tft};
espgui::tft.pushImage(10, 70, bobbyicons::shortcircuit.WIDTH, bobbyicons::shortcircuit.HEIGHT, bobbyicons::shortcircuit.buffer);
espgui::tft.setSwapBytes(false);
m_progressBar.start(); tft.pushImage(10, 70, bobbyicons::shortcircuit.WIDTH, bobbyicons::shortcircuit.HEIGHT, bobbyicons::shortcircuit.buffer);
m_label.start(); m_progressBar.start(tft);
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK); m_label.start(tft);
espgui::tft.setTextFont(2);
fontRenderer.setTextColor(TFT_WHITE, TFT_BLACK);
fontRenderer.setTextFont(2);
auto y = 235; auto y = 235;
constexpr auto lineheight = 15; constexpr auto lineheight = 15;
espgui::tft.drawString("Bei erneuter, widerrechtlicher", 10, y+=lineheight); tft.drawString(tft, fontRenderer, "Bei erneuter, widerrechtlicher", 10, y+=lineheight);
espgui::tft.drawString("Beschlagnahmung wird die Selbst-", 10, y+=lineheight); tft.drawString(tft, fontRenderer, "Beschlagnahmung wird die Selbst-", 10, y+=lineheight);
espgui::tft.drawString("Vernichtung durch Kurzschluss", 10, y+=lineheight); tft.drawString(tft, fontRenderer, "Vernichtung durch Kurzschluss", 10, y+=lineheight);
espgui::tft.drawString(fmt::format("der Batterie eingeleitet (ca {:.2f}MJ)", calculateMegaJoules()), 10, y+=lineheight); tft.drawString(tft, fontRenderer, fmt::format("der Batterie eingeleitet (ca {:.2f}MJ)", calculateMegaJoules()), 10, y+=lineheight);
} }
void ConfiscationDisplay::redraw() void ConfiscationDisplay::redraw(espgui::TftInterface &tft)
{ {
Base::redraw(); Base::redraw(tft);
m_progressBar.redraw(m_progress); m_progressBar.redraw(tft, m_progress);
espgui::tft.setTextColor(TFT_YELLOW, TFT_BLACK); tft.setTextColor(TFT_YELLOW, TFT_BLACK);
espgui::tft.setTextFont(2); tft.setTextFont(2);
m_label.redraw([](){ m_label.redraw(tft, fontRenderer, [](){
if (const auto period = espchrono::millis_clock::now().time_since_epoch() % 6000ms; period < 2000ms) if (const auto period = espchrono::millis_clock::now().time_since_epoch() % 6000ms; period < 2000ms)
return "Halten Sie 10m Abstand."; return "Halten Sie 10m Abstand.";
else if (period < 4000ms) else if (period < 4000ms)
@ -110,7 +110,7 @@ void ConfiscationDisplay::buttonPressed(espgui::Button button)
} }
} }
std::string ConfiscationDisplay::text() const std::string ConfiscationDisplay::title() const
{ {
return "Explosions-Modus"; return "Explosions-Modus";
} }

View File

@ -16,14 +16,14 @@ class ConfiscationDisplay : public BobbyDisplayWithTitle
public: public:
void start() override; void start() override;
void initScreen() override; void initScreen(espgui::TftInterface &tft) override;
void redraw() override; void redraw(espgui::TftInterface &tft) override;
void update() override; void update() override;
void stop() override; void stop() override;
void buttonPressed(espgui::Button button) override; void buttonPressed(espgui::Button button) override;
std::string text() const override; std::string title() const override;
private: private:
espgui::ProgressBar m_progressBar{10, 210, 200, 10, 0, 500}; espgui::ProgressBar m_progressBar{10, 210, 200, 10, 0, 500};

View File

@ -3,8 +3,12 @@
// 3rdparty lib includes // 3rdparty lib includes
#include <randomutils.h> #include <randomutils.h>
#include <esprandom.h> #include <esprandom.h>
#include <tftinstance.h>
#include <screenmanager.h> #include <screenmanager.h>
#include <tftinterface.h>
#include <tftcolors.h>
// local includes
#include "screens.h"
void GameOfLifeDisplay::start() void GameOfLifeDisplay::start()
{ {
@ -14,26 +18,28 @@ void GameOfLifeDisplay::start()
m_newgrid = std::make_unique<std::bitset<GRIDX*GRIDY>>(); m_newgrid = std::make_unique<std::bitset<GRIDX*GRIDY>>();
} }
void GameOfLifeDisplay::initScreen() void GameOfLifeDisplay::initScreen(espgui::TftInterface &tft)
{ {
Base::initScreen(); Base::initScreen(tft);
espgui::tft.setRotation(3); disableScreenFlip(true);
espgui::tft.fillScreen(TFT_BLACK);
tft.setRotation(3);
tft.fillScreen(espgui::TFT_BLACK);
} }
void GameOfLifeDisplay::redraw() void GameOfLifeDisplay::redraw(espgui::TftInterface &tft)
{ {
Base::redraw(); Base::redraw(tft);
if (gen == 0) if (gen == 0)
{ {
espgui::tft.fillScreen(TFT_BLACK); tft.fillScreen(espgui::TFT_BLACK);
initGrid(); initGrid();
} }
computeCA(); computeCA();
drawGrid(); drawGrid(tft);
*m_grid = *m_newgrid; *m_grid = *m_newgrid;
@ -45,7 +51,8 @@ void GameOfLifeDisplay::stop()
{ {
Base::stop(); Base::stop();
espgui::tft.setRotation(0); disableScreenFlip(false);
m_grid = nullptr; m_grid = nullptr;
m_newgrid = nullptr; m_newgrid = nullptr;
} }
@ -64,9 +71,9 @@ void GameOfLifeDisplay::buttonPressed(espgui::Button button)
} }
} }
void GameOfLifeDisplay::drawGrid() void GameOfLifeDisplay::drawGrid(espgui::TftInterface &tft)
{ {
uint16_t color = TFT_WHITE; uint16_t color = espgui::TFT_WHITE;
for (int16_t x = 1; x < GRIDX - 1; x++) { for (int16_t x = 1; x < GRIDX - 1; x++) {
for (int16_t y = 1; y < GRIDY - 1; y++) { for (int16_t y = 1; y < GRIDY - 1; y++) {
if (((*m_grid)[index(x,y)]) != ((*m_newgrid)[index(x,y)])) { if (((*m_grid)[index(x,y)]) != ((*m_newgrid)[index(x,y)])) {
@ -74,7 +81,7 @@ void GameOfLifeDisplay::drawGrid()
color = 0xFFFF; //random(0xFFFF); color = 0xFFFF; //random(0xFFFF);
else else
color = 0; color = 0;
espgui::tft.fillRect(CELLXY * x, CELLXY * y, CELLXY, CELLXY, color); tft.fillRect(CELLXY * x, CELLXY * y, CELLXY, CELLXY, color);
} }
} }
} }

View File

@ -13,8 +13,8 @@ class GameOfLifeDisplay : public BobbyDisplay
public: public:
void start() override; void start() override;
void initScreen() override; void initScreen(espgui::TftInterface &tft) override;
void redraw() override; void redraw(espgui::TftInterface &tft) override;
void stop() override; void stop() override;
void buttonPressed(espgui::Button button) override; void buttonPressed(espgui::Button button) override;
@ -22,7 +22,7 @@ public:
private: private:
//Draws the grid on the display //Draws the grid on the display
void drawGrid(); void drawGrid(espgui::TftInterface &tft);
//Initialise Grid //Initialise Grid
void initGrid(); void initGrid();

View File

@ -21,8 +21,8 @@ class GametrakCalibrateDisplay : public BobbyDisplay, public ConfirmActionInterf
using Base = BobbyDisplay; using Base = BobbyDisplay;
public: public:
void initScreen() override; void initScreen(espgui::TftInterface &tft) override;
void redraw() override; void redraw(espgui::TftInterface &tft) override;
private: private:
std::array<Label, 6> m_labels {{ std::array<Label, 6> m_labels {{
@ -41,9 +41,9 @@ private:
}}; }};
}; };
void GametrakCalibrateDisplay::initScreen() void GametrakCalibrateDisplay::initScreen(espgui::TftInterface &tft)
{ {
Base::initScreen(); Base::initScreen(tft);
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
tft.setTextFont(4); tft.setTextFont(4);
@ -62,9 +62,9 @@ void GametrakCalibrateDisplay::initScreen()
progressBar.start(); progressBar.start();
} }
void GametrakCalibrateDisplay::redraw() void GametrakCalibrateDisplay::redraw(espgui::TftInterface &tft)
{ {
Base::redraw(); Base::redraw(tft);
m_labels[0].redraw(fmt::format("{:.02f}", gametrakX)); m_labels[0].redraw(fmt::format("{:.02f}", gametrakX));
m_labels[1].redraw(std::to_string(raw_gametrakX)); m_labels[1].redraw(std::to_string(raw_gametrakX));

View File

@ -2,7 +2,6 @@
#include "joystickdebugdisplay.h" #include "joystickdebugdisplay.h"
// 3rdparty lib includes // 3rdparty lib includes
#include <tftinstance.h>
#include <screenmanager.h> #include <screenmanager.h>
// local includes // local includes
@ -27,7 +26,7 @@ void JoystickDebugDisplay::start()
copyFromSettings(); copyFromSettings();
} }
std::string JoystickDebugDisplay::text() const std::string JoystickDebugDisplay::title() const
{ {
return TEXT_JOYSTICK; return TEXT_JOYSTICK;
} }
@ -49,9 +48,9 @@ void JoystickDebugDisplay::update()
m_y = map_analog_stick(m_bremsMitte, m_bremsMin, m_bremsMax, configs.deadband.value(), *raw_brems); m_y = map_analog_stick(m_bremsMitte, m_bremsMin, m_bremsMax, configs.deadband.value(), *raw_brems);
} }
void JoystickDebugDisplay::redraw() void JoystickDebugDisplay::redraw(espgui::TftInterface &tft)
{ {
Base::redraw(); Base::redraw(tft);
if (m_x && m_y) if (m_x && m_y)
{ {

View File

@ -16,7 +16,7 @@ class JoystickDebugDisplay : public BobbyDisplayWithTitle
public: public:
JoystickDebugDisplay(); JoystickDebugDisplay();
std::string text() const override; std::string title() const override;
void start() override; void start() override;
void update() override; void update() override;
void redraw() override; void redraw() override;

View File

@ -8,9 +8,9 @@
#include <cpputils.h> #include <cpputils.h>
#include <menuitem.h> #include <menuitem.h>
#include <actioninterface.h> #include <actioninterface.h>
#include <tftinstance.h>
#include <screenmanager.h> #include <screenmanager.h>
#include <actions/dummyaction.h> #include <actions/dummyaction.h>
#include <fontrenderer.h>
// local includes // local includes
#include "utils.h" #include "utils.h"
@ -49,41 +49,39 @@ const std::array<uint16_t, 8> tft_colors = {
}; };
} // namespace } // namespace
std::string LedstripColorsDisplay::text() const std::string LedstripColorsDisplay::title() const
{ {
return TEXT_LEDSTRIPCOLORMENU; return TEXT_LEDSTRIPCOLORMENU;
} }
void LedstripColorsDisplay::initScreen() void LedstripColorsDisplay::initScreen(espgui::TftInterface &tft)
{ {
Base::initScreen(); Base::initScreen(tft);
espgui::tft.setSwapBytes(true); tft.pushImage(70, 60, bobbyicons::bobbycar.WIDTH, bobbyicons::bobbycar.HEIGHT, bobbyicons::bobbycar.buffer);
espgui::tft.pushImage(70, 60, bobbyicons::bobbycar.WIDTH, bobbyicons::bobbycar.HEIGHT, bobbyicons::bobbycar.buffer);
espgui::tft.setSwapBytes(false);
} }
void LedstripColorsDisplay::redraw() void LedstripColorsDisplay::redraw(espgui::TftInterface &tft)
{ {
Base::redraw(); Base::redraw(tft);
auto y_pos = ((espgui::tft.width() - 40) / 8 + 4) + 240; auto y_pos = ((tft.width() - 40) / 8 + 4) + 240;
if (last_state != state_select_color) if (last_state != state_select_color)
{ {
espgui::tft.fillRect(0,y_pos - 1, espgui::tft.width(), 20, TFT_BLACK); tft.fillRect(0,y_pos - 1, tft.width(), 20, TFT_BLACK);
last_state = state_select_color; last_state = state_select_color;
} }
espgui::tft.setTextFont(2); espgui::FontRenderer fontRenderer{tft};
espgui::tft.setTextColor(TFT_WHITE); fontRenderer.drawString(state_select_color ?
"Please select a color!" :
espgui::tft.drawString(state_select_color ? "Please select a side!", 50, y_pos,
"Please select a color!" : espgui::TFT_WHITE, espgui::TFT_BLACK,
"Please select a side!", 50, y_pos); 2);
if (!already_drew_circle) if (!already_drew_circle)
{ {
drawSide(static_cast<Bobbycar_Side>(selected_side), TFT_GOLD); drawSide(tft, static_cast<Bobbycar_Side>(selected_side), TFT_GOLD);
already_drew_circle = true; already_drew_circle = true;
} }
} }
@ -103,7 +101,7 @@ void LedstripColorsDisplay::buttonPressed(espgui::Button button)
else else
{ {
state_select_color = false; state_select_color = false;
espgui::tft.fillRect(0, 228, espgui::tft.width(), ((espgui::tft.width() - 40) / 8) + 4, TFT_BLACK); tft.fillRect(0, 228, tft.width(), ((tft.width() - 40) / 8) + 4, TFT_BLACK);
} }
break; break;
@ -111,7 +109,7 @@ void LedstripColorsDisplay::buttonPressed(espgui::Button button)
if(!state_select_color) if(!state_select_color)
{ {
state_select_color = true; state_select_color = true;
drawColors(); drawColors(tft);
} }
else else
{ {
@ -119,7 +117,7 @@ void LedstripColorsDisplay::buttonPressed(espgui::Button button)
// Uncomment to close select color menu on color select // Uncomment to close select color menu on color select
/* /*
state_select_color = false; state_select_color = false;
espgui::tft.fillRect(0, 228, espgui::tft.width(), ((espgui::tft.width() - 40) / 8) + 4, TFT_BLACK); tft.fillRect(0, 228, tft.width(), ((tft.width() - 40) / 8) + 4, TFT_BLACK);
*/ */
} }
break; break;
@ -144,13 +142,13 @@ void LedstripColorsDisplay::buttonPressed(espgui::Button button)
/* TODO commander: move into redraw method */ /* TODO commander: move into redraw method */
if (state_select_color) if (state_select_color)
{ {
drawColors(); drawColors(tft);
} }
else else
{ {
espgui::tft.fillRect(0, 228, espgui::tft.width(), ((espgui::tft.width() - 40) / 8) + 4, TFT_BLACK); tft.fillRect(0, 228, tft.width(), ((tft.width() - 40) / 8) + 4, TFT_BLACK);
clearSides(); clearSides();
drawSide(static_cast<Bobbycar_Side>(selected_side), TFT_GOLD); drawSide(tft, static_cast<Bobbycar_Side>(selected_side), TFT_GOLD);
} }
break; break;
@ -175,11 +173,11 @@ void LedstripColorsDisplay::buttonPressed(espgui::Button button)
/* TODO commander: move into redraw method */ /* TODO commander: move into redraw method */
if (state_select_color) if (state_select_color)
{ {
drawColors(); drawColors(tft);
} }
else else
{ {
espgui::tft.fillRect(0, 228, espgui::tft.width(), ((espgui::tft.width() - 40) / 8) + 4, TFT_BLACK); tft.fillRect(0, 228, tft.width(), ((tft.width() - 40) / 8) + 4, TFT_BLACK);
clearSides(); clearSides();
drawSide(static_cast<Bobbycar_Side>(selected_side), TFT_GOLD); drawSide(static_cast<Bobbycar_Side>(selected_side), TFT_GOLD);
} }
@ -188,19 +186,19 @@ void LedstripColorsDisplay::buttonPressed(espgui::Button button)
} }
} }
void LedstripColorsDisplay::drawColors() void LedstripColorsDisplay::drawColors(espgui::TftInterface &tft)
{ {
uint16_t width = (espgui::tft.width() - 40); uint16_t width = (tft.width() - 40);
auto cube_width = width / 8; auto cube_width = width / 8;
espgui::tft.fillRect(0, 228, espgui::tft.width(), cube_width + 4, TFT_BLACK); tft.fillRect(0, 228, tft.width(), cube_width + 4, TFT_BLACK);
espgui::tft.fillRect(21, 231, width - 1, cube_width - 1, TFT_WHITE); tft.fillRect(21, 231, width - 1, cube_width - 1, TFT_WHITE);
espgui::tft.fillRect(20 + (selected_color * cube_width - 1), 228, cube_width + 4, cube_width + 4, TFT_YELLOW); tft.fillRect(20 + (selected_color * cube_width - 1), 228, cube_width + 4, cube_width + 4, TFT_YELLOW);
for (int index = 0; index < 8; index++) for (int index = 0; index < 8; index++)
{ {
auto offset = index * (cube_width); auto offset = index * (cube_width);
espgui::tft.fillRect(22 + offset, 232, cube_width - 4, cube_width - 4, tft_colors[index]); tft.fillRect(22 + offset, 232, cube_width - 4, cube_width - 4, tft_colors[index]);
} }
} }
@ -212,9 +210,9 @@ void LedstripColorsDisplay::clearSides()
} }
} }
void LedstripColorsDisplay::drawSide(Bobbycar_Side side, unsigned int color) void LedstripColorsDisplay::drawSide(espgui::TftInterface &tft, Bobbycar_Side side, unsigned int color)
{ {
const auto middle = espgui::tft.width() / 2; const auto middle = tft.width() / 2;
const auto width = bobbyicons::bobbycar.WIDTH; const auto width = bobbyicons::bobbycar.WIDTH;
const auto height = bobbyicons::bobbycar.HEIGHT; const auto height = bobbyicons::bobbycar.HEIGHT;
const auto left = middle - (width / 2); const auto left = middle - (width / 2);
@ -224,33 +222,33 @@ void LedstripColorsDisplay::drawSide(Bobbycar_Side side, unsigned int color)
switch (side) { switch (side) {
case Bobbycar_Side::FRONT: case Bobbycar_Side::FRONT:
espgui::tft.fillRect(left, above, width, 5, color); tft.fillRect(left, above, width, 5, color);
break; break;
case Bobbycar_Side::FRONT_LEFT: case Bobbycar_Side::FRONT_LEFT:
espgui::tft.fillRect(left - 10, above + 10, 5, height / 2, color); tft.fillRect(left - 10, above + 10, 5, height / 2, color);
espgui::tft.fillRect(left, above, width / 2, 5, color); tft.fillRect(left, above, width / 2, 5, color);
break; break;
case Bobbycar_Side::LEFT: case Bobbycar_Side::LEFT:
espgui::tft.fillRect(left - 10, above + 10, 5, height, color); tft.fillRect(left - 10, above + 10, 5, height, color);
break; break;
case Bobbycar_Side::BACK_LEFT: case Bobbycar_Side::BACK_LEFT:
espgui::tft.fillRect(left - 10, above + 10 + (height / 2), 5, height / 2, color); tft.fillRect(left - 10, above + 10 + (height / 2), 5, height / 2, color);
espgui::tft.fillRect(left, bellow + 5, width / 2, 5, color); tft.fillRect(left, bellow + 5, width / 2, 5, color);
break; break;
case Bobbycar_Side::BACK: case Bobbycar_Side::BACK:
espgui::tft.fillRect(left, bellow + 5, width, 5, color); tft.fillRect(left, bellow + 5, width, 5, color);
break; break;
case Bobbycar_Side::BACK_RIGHT: case Bobbycar_Side::BACK_RIGHT:
espgui::tft.fillRect(right + 5, above + 10 + (height / 2), 5, height / 2, color); tft.fillRect(right + 5, above + 10 + (height / 2), 5, height / 2, color);
espgui::tft.fillRect(middle, bellow + 5, width / 2, 5, color); tft.fillRect(middle, bellow + 5, width / 2, 5, color);
break; break;
case Bobbycar_Side::RIGHT: case Bobbycar_Side::RIGHT:
espgui::tft.fillRect(right + 5, above + 10, 5, height, color); tft.fillRect(right + 5, above + 10, 5, height, color);
break; break;
case Bobbycar_Side::FRONT_RIGHT: case Bobbycar_Side::FRONT_RIGHT:
espgui::tft.fillRect(right + 5, above + 10, 5, height / 2, color); tft.fillRect(right + 5, above + 10, 5, height / 2, color);
espgui::tft.fillRect(middle, above, width / 2, 5, color); tft.fillRect(middle, above, width / 2, 5, color);
break; break;
} }
// espgui::tft.fillCircle(espgui::tft.width() / 2, 140, 100, TFT_BLACK); // tft.fillCircle(tft.width() / 2, 140, 100, TFT_BLACK);
} }

View File

@ -15,14 +15,14 @@ class LedstripColorsDisplay : public BobbyDisplayWithTitle
using Base = BobbyDisplayWithTitle; using Base = BobbyDisplayWithTitle;
public: public:
std::string text() const override; std::string title() const override;
void initScreen() override; void initScreen(espgui::TftInterface &tft) override;
void redraw() override; void redraw(espgui::TftInterface &tft) override;
void buttonPressed(espgui::Button button) override; void buttonPressed(espgui::Button button) override;
void drawColors(); void drawColors(espgui::TftInterface &tft);
void drawSide(Bobbycar_Side side, unsigned int color); void drawSide(espgui::TftInterface &tft, Bobbycar_Side side, unsigned int color);
void clearSides(); void clearSides();
private: private:

View File

@ -4,8 +4,8 @@
#include <algorithm> #include <algorithm>
// 3rdparty lib includes // 3rdparty lib includes
#include <tftinstance.h>
#include <screenmanager.h> #include <screenmanager.h>
#include <fontrenderer.h>
// local includes // local includes
#include "globals.h" #include "globals.h"
@ -53,39 +53,34 @@ void Lockscreen::start()
} }
} }
void Lockscreen::initScreen() void Lockscreen::initScreen(espgui::TftInterface &tft)
{ {
Base::initScreen(); Base::initScreen(tft);
espgui::tft.fillScreen(TFT_BLACK); espgui::FontRenderer fontRenderer{tft};
espgui::tft.setTextFont(4);
espgui::tft.setTextColor(TFT_YELLOW);
espgui::tft.drawString("Lock vehicle", 5, 5); tft.fillScreen(TFT_BLACK);
espgui::tft.fillRect(0, 34, espgui::tft.width(), 3, TFT_WHITE); fontRenderer.drawString("Lock vehicle", 5, 5, 4, espgui::TFT_YELLOW, espgui::TFT_BLACK);
espgui::tft.setTextColor(TFT_WHITE); tft.fillRect(0, 34, tft.width(), 3, espgui::TFT_WHITE);
espgui::tft.drawString("Enter code to unlock:", 0, 50);
espgui::tft.setTextColor(TFT_WHITE, TFT_BLACK); fontRenderer.drawString("Enter code to unlock:", 0, 50, 4, espgui::TFT_WHITE, espgui::TFT_BLACK);
for(int i = 0; i <= 3; i++) for(int i = 0; i <= 3; i++)
{ {
drawRect(i, 3, TFT_WHITE); drawRect(tft, i, 3, espgui::TFT_WHITE);
drawRect(i, 4, TFT_WHITE); drawRect(tft, i, 4, espgui::TFT_WHITE);
} }
for (auto &label : m_labels) for (auto &label : m_labels)
label.start(); label.start(tft);
espgui::tft.setTextFont(7); drawRect(tft, m_currentIndex, 1, espgui::TFT_YELLOW);
drawRect(tft, m_currentIndex, 2, espgui::TFT_YELLOW);
drawRect(m_currentIndex, 1, TFT_YELLOW);
drawRect(m_currentIndex, 2, TFT_YELLOW);
for(int i = 0; i <= m_currentIndex; i++) for(int i = 0; i <= m_currentIndex; i++)
m_labels[i].redraw(std::to_string(m_numbers[i])); m_labels[i].redraw(tft, fontRenderer, std::to_string(m_numbers[i]), espgui::TFT_WHITE, espgui::TFT_BLACK, 7);
} }
void Lockscreen::update() void Lockscreen::update()
@ -93,23 +88,20 @@ void Lockscreen::update()
Base::update(); Base::update();
} }
void Lockscreen::redraw() void Lockscreen::redraw(espgui::TftInterface &tft)
{ {
Base::redraw(); Base::redraw(tft);
if (m_pressed || m_back_pressed) if (m_pressed || m_back_pressed)
{ {
drawRect(m_currentIndex, 1, TFT_BLACK); drawRect(tft, m_currentIndex, 1, TFT_BLACK);
drawRect(m_currentIndex, 2, TFT_BLACK); drawRect(tft, m_currentIndex, 2, TFT_BLACK);
if (!m_back_pressed && ++m_currentIndex>=4) if (!m_back_pressed && ++m_currentIndex>=4)
{ {
if (isValid1stPin(m_numbers)) if (isValid1stPin(m_numbers))
{ {
if (!gas || !brems || *gas > 200.f || *brems > 200.f) espgui::popScreen();
espgui::switchScreen<PotisCalibrateDisplay>(true);
else
espgui::popScreen();
#ifdef LOCKSCREEN_PLUGIN #ifdef LOCKSCREEN_PLUGIN
#include LOCKSCREEN_PLUGIN #include LOCKSCREEN_PLUGIN
LOCKSCREEN_PLUGIN_FIXES_1 LOCKSCREEN_PLUGIN_FIXES_1
@ -118,10 +110,7 @@ LOCKSCREEN_PLUGIN_FIXES_1
} }
else if(isValid2ndPin(m_numbers)) else if(isValid2ndPin(m_numbers))
{ {
if (!gas || !brems || *gas > 200.f || *brems > 200.f) espgui::popScreen();
espgui::switchScreen<PotisCalibrateDisplay>(true);
else
espgui::popScreen();
#ifdef LOCKSCREEN_PLUGIN_FIXES_2 #ifdef LOCKSCREEN_PLUGIN_FIXES_2
LOCKSCREEN_PLUGIN_FIXES_2 LOCKSCREEN_PLUGIN_FIXES_2
#endif #endif
@ -130,18 +119,19 @@ LOCKSCREEN_PLUGIN_FIXES_2
m_numbers = {0,0,0,0}; m_numbers = {0,0,0,0};
m_currentIndex = 0; m_currentIndex = 0;
std::for_each(std::begin(m_labels) + 1, std::end(m_labels), [](auto &label){ label.redraw("0"); }); std::for_each(std::begin(m_labels) + 1, std::end(m_labels),
[&tft](auto &label){ label.redraw(tft, "0"); });
} }
else if (m_back_pressed && m_currentIndex < 3) else if (m_back_pressed && m_currentIndex < 3)
{ {
drawRect(m_currentIndex+1, 1, TFT_BLACK); drawRect(tft, m_currentIndex+1, 1, TFT_BLACK);
drawRect(m_currentIndex+1, 2, TFT_BLACK); drawRect(tft, m_currentIndex+1, 2, TFT_BLACK);
} }
m_labels[m_currentIndex].redraw(std::to_string(m_numbers[m_currentIndex])); m_labels[m_currentIndex].redraw(tft, std::to_string(m_numbers[m_currentIndex]));
drawRect(m_currentIndex, 1, TFT_YELLOW); drawRect(tft, m_currentIndex, 1, TFT_YELLOW);
drawRect(m_currentIndex, 2, TFT_YELLOW); drawRect(tft, m_currentIndex, 2, TFT_YELLOW);
m_pressed = false; m_pressed = false;
m_back_pressed = false; m_back_pressed = false;
@ -211,7 +201,7 @@ void Lockscreen::buttonPressed(espgui::Button button)
} }
} }
void Lockscreen::drawRect(int index, int offset, uint32_t color) const void Lockscreen::drawRect(espgui::TftInterface &tft, int index, int offset, uint32_t color) const
{ {
espgui::tft.drawRect(m_labels[index].x()-offset, m_labels[index].y()-offset, boxWidth+(offset*2), boxHeight+(offset*2), color); tft.drawRect(m_labels[index].x()-offset, m_labels[index].y()-offset, boxWidth+(offset*2), boxHeight+(offset*2), color);
} }

View File

@ -24,15 +24,15 @@ class Lockscreen : public BobbyDisplay
public: public:
void start() override; void start() override;
void initScreen() override; void initScreen(espgui::TftInterface &tft) override;
void update() override; void update() override;
void redraw() override; void redraw(espgui::TftInterface &tft) override;
void stop() override; void stop() override;
void buttonPressed(espgui::Button button) override; void buttonPressed(espgui::Button button) override;
private: private:
void drawRect(int index, int offset, uint32_t color) const; void drawRect(espgui::TftInterface &tft, int index, int offset, uint32_t color) const;
std::array<espgui::Label, 4> m_labels {{ std::array<espgui::Label, 4> m_labels {{
espgui::Label{spacing, 100}, // boxWidth, boxHeight espgui::Label{spacing, 100}, // boxWidth, boxHeight

View File

@ -1,8 +1,8 @@
#include "menudisplaywithtime.h" #include "menudisplaywithtime.h"
// 3rdparty lib includes // 3rdparty lib includes
#include <tftinstance.h>
#include <fmt/core.h> #include <fmt/core.h>
#include <fontrenderer.h>
// local includes // local includes
#include "utils.h" #include "utils.h"
@ -10,17 +10,16 @@
using namespace espgui; using namespace espgui;
namespace bobbygui { namespace bobbygui {
void MenuDisplayWithTime::start() void MenuDisplayWithTime::initScreen(espgui::TftInterface &tft)
{ {
Base::start(); Base::initScreen(tft);
m_label_currentTime.start(); m_label_currentTime.start(tft);
} }
void MenuDisplayWithTime::redraw() void MenuDisplayWithTime::redraw(espgui::TftInterface &tft)
{ {
Base::redraw(); Base::redraw(tft);
tft.setTextFont(use_big_font() ? 4 : 2); m_label_currentTime.redraw(tft, fmt::format("&7Time: {}", local_clock_string()), espgui::TFT_WHITE, espgui::TFT_BLACK, use_big_font() ? 4 : 2);
m_label_currentTime.redraw(fmt::format("&7Time: {}", local_clock_string()));
} }
} // namespace } // namespace

View File

@ -10,8 +10,8 @@ class MenuDisplayWithTime :
using Base = BobbyMenuDisplay; using Base = BobbyMenuDisplay;
public: public:
void start() override; void initScreen(espgui::TftInterface &tft) override;
void redraw() override; void redraw(espgui::TftInterface &tft) override;
espgui::Label m_label_currentTime{145, 6}; espgui::Label m_label_currentTime{145, 6};
private: private:

View File

@ -45,6 +45,7 @@ AboutMenu::AboutMenu()
constructMenuItem<makeComponent<MenuItem, HeapLargest32Text, StaticFont<2>, DisabledColor, DummyAction>>(); constructMenuItem<makeComponent<MenuItem, HeapLargest32Text, StaticFont<2>, DisabledColor, DummyAction>>();
#endif #endif
constructMenuItem<makeComponent<MenuItem, EspChipRevisionText, StaticFont<2>, DisabledColor, DummyAction>>(); constructMenuItem<makeComponent<MenuItem, EspChipRevisionText, StaticFont<2>, DisabledColor, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, EspChipModelText, StaticFont<2>, DisabledColor, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, EspCpuMinFreqMHzText, StaticFont<2>, DisabledColor, DummyAction>>(); constructMenuItem<makeComponent<MenuItem, EspCpuMinFreqMHzText, StaticFont<2>, DisabledColor, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, EspCpuMaxFreqMHzText, StaticFont<2>, DisabledColor, DummyAction>>(); constructMenuItem<makeComponent<MenuItem, EspCpuMaxFreqMHzText, StaticFont<2>, DisabledColor, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, EspSdkVersionText, StaticFont<2>, DisabledColor, DummyAction>>(); constructMenuItem<makeComponent<MenuItem, EspSdkVersionText, StaticFont<2>, DisabledColor, DummyAction>>();
@ -57,7 +58,7 @@ AboutMenu::AboutMenu()
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
} }
std::string AboutMenu::text() const std::string AboutMenu::title() const
{ {
return TEXT_ABOUT; return TEXT_ABOUT;
} }

View File

@ -8,7 +8,7 @@ class AboutMenu : public BobbyMenuDisplay
public: public:
AboutMenu(); AboutMenu();
std::string text() const override; std::string title() const override;
void back() override; void back() override;
}; };

View File

@ -84,7 +84,7 @@ BatteryDebugMenu::BatteryDebugMenu()
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
} }
std::string BatteryDebugMenu::text() const std::string BatteryDebugMenu::title() const
{ {
return TEXT_BATTERYDEBUG; return TEXT_BATTERYDEBUG;
} }

View File

@ -8,7 +8,7 @@ class BatteryDebugMenu : public BobbyMenuDisplay
public: public:
BatteryDebugMenu(); BatteryDebugMenu();
std::string text() const override; std::string title() const override;
void back() override; void back() override;
}; };

View File

@ -9,8 +9,7 @@
#include <changevaluedisplay.h> #include <changevaluedisplay.h>
#include <textwithvaluehelper.h> #include <textwithvaluehelper.h>
#include <fmt/core.h> #include <fmt/core.h>
#include <tftcolors.h>
#include <tftinstance.h>
// Local includes // Local includes
#include "utils.h" #include "utils.h"
@ -54,7 +53,7 @@ class WhStatisticsText : public virtual espgui::TextInterface { public: std::str
using BatteryCellSeriesChangeScreen = espgui::makeComponent< using BatteryCellSeriesChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>, BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_CELL_SERIES>, espgui::StaticTitle<TEXT_CELL_SERIES>,
BatterySeriesCellsAccessor, BatterySeriesCellsAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -62,7 +61,7 @@ using BatteryCellSeriesChangeScreen = espgui::makeComponent<
using BatteryCellParallelChangeScreen = espgui::makeComponent< using BatteryCellParallelChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>, BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_CELL_PARALLEL>, espgui::StaticTitle<TEXT_CELL_PARALLEL>,
BatteryParallelCellsAccessor, BatteryParallelCellsAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -70,7 +69,7 @@ using BatteryCellParallelChangeScreen = espgui::makeComponent<
using BatteryWHperKMChangeScreen = espgui::makeComponent< using BatteryWHperKMChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint16_t>, BobbyChangeValueDisplay<uint16_t>,
espgui::StaticText<TEXT_BATTERY_WHKM>, espgui::StaticTitle<TEXT_BATTERY_WHKM>,
BatteryWHperKMAccessor, BatteryWHperKMAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -88,22 +87,21 @@ BatteryMenu::BatteryMenu()
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_BATTERY_WHKM, BatteryWHperKMAccessor>, PushScreenAction<BatteryWHperKMChangeScreen>>>(); constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_BATTERY_WHKM, BatteryWHperKMAccessor>, PushScreenAction<BatteryWHperKMChangeScreen>>>();
constructMenuItem<PushScreenTypeSafeChangeMenuItem<BatteryCellType, TEXT_SELECT_CELL_TYPE>>(&configs.battery.cellType); constructMenuItem<PushScreenTypeSafeChangeMenuItem<BatteryCellType, TEXT_SELECT_CELL_TYPE>>(&configs.battery.cellType);
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SHOW_BATTERY_GRAPH>, PushScreenAction<BatteryGraphDisplay>, StaticMenuItemIcon<&bobbyicons::graph>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SHOW_BATTERY_GRAPH>, PushScreenAction<BatteryGraphDisplay>, StaticMenuItemIcon<&bobbyicons::graph>>>();
constructMenuItem<makeComponent<MenuItem, EmptyText, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, WhStatisticsText, DummyAction>>(); constructMenuItem<makeComponent<MenuItem, WhStatisticsText, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BATTERY_CALIBRATE>, PushScreenAction<CalibrateVoltageDisplay>, StaticMenuItemIcon<&bobbyicons::settings>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BATTERY_CALIBRATE>, PushScreenAction<CalibrateVoltageDisplay>, StaticMenuItemIcon<&bobbyicons::settings>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
} }
std::string BatteryMenu::text() const std::string BatteryMenu::title() const
{ {
return TEXT_BATTERY; return TEXT_BATTERY;
} }
void BatteryMenu::initScreen() void BatteryMenu::initScreen(espgui::TftInterface &tft)
{ {
Base::initScreen(); Base::initScreen(tft);
m_batPercentBootLabel.start(); m_batPercentBootLabel.start(tft);
m_batPercentNowLabel.start(); m_batPercentNowLabel.start(tft);
} }
void BatteryMenu::start() void BatteryMenu::start()
@ -112,9 +110,9 @@ void BatteryMenu::start()
m_doubleProgressBarBatPercentage.start(); m_doubleProgressBarBatPercentage.start();
} }
void BatteryMenu::redraw() void BatteryMenu::redraw(espgui::TftInterface &tft)
{ {
Base::redraw(); Base::redraw(tft);
if (const auto avgVoltage = controllers.getAvgVoltage(); avgVoltage) if (const auto avgVoltage = controllers.getAvgVoltage(); avgVoltage)
{ {
@ -124,11 +122,11 @@ void BatteryMenu::redraw()
m_doubleProgressBarBatPercentage.redraw(batPercent, *battery::bootBatPercentage); m_doubleProgressBarBatPercentage.redraw(batPercent, *battery::bootBatPercentage);
tft.setTextFont(2); tft.setTextFont(2);
tft.setTextColor(TFT_DARKGREY, TFT_BLACK); tft.setTextColor(espgui::TFT_DARKGREY, espgui::TFT_BLACK);
m_batPercentNowLabel.redraw(fmt::format("{:.2f} %", batPercent)); m_batPercentNowLabel.redraw(fmt::format("{:.2f} %", batPercent));
m_batPercentBootLabel.redraw(fmt::format("{:.2f} %", *battery::bootBatPercentage)); m_batPercentBootLabel.redraw(fmt::format("{:.2f} %", *battery::bootBatPercentage));
tft.setTextFont(4); tft.setTextFont(4);
tft.setTextColor(TFT_WHITE, TFT_BLACK); tft.setTextColor(espgui::TFT_WHITE, espgui::TFT_BLACK);
} }
} }
} }

View File

@ -12,11 +12,11 @@ class BatteryMenu : public BobbyMenuDisplay
public: public:
BatteryMenu(); BatteryMenu();
std::string text() const override; std::string title() const override;
void initScreen() override; void initScreen(espgui::TftInterface &tft) override;
void start() override; void start() override;
void redraw() override; void redraw(espgui::TftInterface &tft) override;
void back() override; void back() override;
private: private:

View File

@ -26,7 +26,7 @@ constexpr char TEXT_BACK[] = "Back";
using ApSsidChangeScreen = espgui::makeComponent< using ApSsidChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<std::string>, BobbyChangeValueDisplay<std::string>,
espgui::StaticText<TEXT_NAME>, espgui::StaticTitle<TEXT_NAME>,
BluetoothNameAccessor, BluetoothNameAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -44,7 +44,7 @@ BleSettingsMenu::BleSettingsMenu()
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
} }
std::string BleSettingsMenu::text() const std::string BleSettingsMenu::title() const
{ {
return TEXT_BLESETTINGS; return TEXT_BLESETTINGS;
} }

View File

@ -8,7 +8,7 @@ class BleSettingsMenu : public BobbyMenuDisplay
public: public:
BleSettingsMenu(); BleSettingsMenu();
std::string text() const override; std::string title() const override;
void back() override; void back() override;
}; };

View File

@ -11,17 +11,15 @@
// local includes // local includes
#include "accessors/settingsaccessors.h" #include "accessors/settingsaccessors.h"
#include "actions/setupactions.h"
#include "bobbycheckbox.h" #include "bobbycheckbox.h"
#include "displays/bobbychangevaluedisplay.h" #include "displays/bobbychangevaluedisplay.h"
#include "displays/buttoncalibratedisplay.h"
#include "displays/menus/extrabuttoncalibratemenu.h" #include "displays/menus/extrabuttoncalibratemenu.h"
#include "displays/menus/lockscreensettingsmenu.h" #include "displays/menus/lockscreensettingsmenu.h"
#include "displays/menus/settingsmenu.h"
#include "displays/menus/setupquickactionsmenu.h" #include "displays/menus/setupquickactionsmenu.h"
#include "displays/menus/timersmenu.h" #include "displays/menus/timersmenu.h"
#include "displays/potiscalibratedisplay.h" #include "displays/potiscalibratedisplay.h"
#include "icons/lock.h" #include "icons/lock.h"
#include "utils.h"
#ifdef FEATURE_JOYSTICK #ifdef FEATURE_JOYSTICK
#include "displays/joystickdebugdisplay.h" #include "displays/joystickdebugdisplay.h"
@ -78,35 +76,35 @@ public:
using SampleCountChangeScreen = espgui::makeComponent< using SampleCountChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SAMPLECOUNT>, espgui::StaticTitle<TEXT_SAMPLECOUNT>,
SampleCountAccessor, SampleCountAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using GasMinChangeScreen = espgui::makeComponent< using GasMinChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_GASMIN>, espgui::StaticTitle<TEXT_GASMIN>,
GasMinAccessor, GasMinAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using GasMaxChangeScreen = espgui::makeComponent< using GasMaxChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_GASMAX>, espgui::StaticTitle<TEXT_GASMAX>,
GasMaxAccessor, GasMaxAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using BremsMinChangeScreen = espgui::makeComponent< using BremsMinChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_BREMSMIN>, espgui::StaticTitle<TEXT_BREMSMIN>,
BremsMinAccessor, BremsMinAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using BremsMaxChangeScreen = espgui::makeComponent< using BremsMaxChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_BREMSMAX>, espgui::StaticTitle<TEXT_BREMSMAX>,
BremsMaxAccessor, BremsMaxAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -116,14 +114,14 @@ using BremsMaxChangeScreen = espgui::makeComponent<
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW) || defined(FEATURE_DPAD_5WIRESW_2OUT) || defined (FEATURE_DPAD_6WIRESW) || defined (DPAD_BOARDCOMPUTER_V2) #if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW) || defined(FEATURE_DPAD_5WIRESW_2OUT) || defined (FEATURE_DPAD_6WIRESW) || defined (DPAD_BOARDCOMPUTER_V2)
using DPadDebounceChangeScreen = espgui::makeComponent< using DPadDebounceChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>, BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_DPADDEBOUNCE>, espgui::StaticTitle<TEXT_DPADDEBOUNCE>,
DPadDebounceAccessor, DPadDebounceAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using ButtonDelayChangeScreen = espgui::makeComponent< using ButtonDelayChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint16_t>, BobbyChangeValueDisplay<uint16_t>,
espgui::StaticText<TEXT_BUTTONDELAY>, espgui::StaticTitle<TEXT_BUTTONDELAY>,
ButtonDelayAccessor, ButtonDelayAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -146,42 +144,42 @@ public:
using GametrakXMinChangeScreen = espgui::makeComponent< using GametrakXMinChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SETGAMETRAKXMIN>, espgui::StaticTitle<TEXT_SETGAMETRAKXMIN>,
GametrakXMinAccessor, GametrakXMinAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using GametrakXMaxChangeScreen = espgui::makeComponent< using GametrakXMaxChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SETGAMETRAKXMAX>, espgui::StaticTitle<TEXT_SETGAMETRAKXMAX>,
GametrakXMaxAccessor, GametrakXMaxAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using GametrakYMinChangeScreen = espgui::makeComponent< using GametrakYMinChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SETGAMETRAKYMIN>, espgui::StaticTitle<TEXT_SETGAMETRAKYMIN>,
GametrakYMinAccessor, GametrakYMinAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using GametrakYMaxChangeScreen = espgui::makeComponent< using GametrakYMaxChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SETGAMETRAKYMAX>, espgui::StaticTitle<TEXT_SETGAMETRAKYMAX>,
GametrakYMaxAccessor, GametrakYMaxAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using GametrakDistMinChangeScreen = espgui::makeComponent< using GametrakDistMinChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SETGAMETRAKDISTMIN>, espgui::StaticTitle<TEXT_SETGAMETRAKDISTMIN>,
GametrakDistMinAccessor, GametrakDistMinAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using GametrakDistMaxChangeScreen = espgui::makeComponent< using GametrakDistMaxChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_SETGAMETRAKDISTMAX>, espgui::StaticTitle<TEXT_SETGAMETRAKDISTMAX>,
GametrakDistMaxAccessor, GametrakDistMaxAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -194,12 +192,12 @@ using namespace espgui;
BoardcomputerHardwareSettingsMenu::BoardcomputerHardwareSettingsMenu() BoardcomputerHardwareSettingsMenu::BoardcomputerHardwareSettingsMenu()
{ {
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LOCKSCREENSETTINGS>, PushScreenAction<LockscreenSettingsMenu>, StaticMenuItemIcon<&bobbyicons::lock>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LOCKSCREENSETTINGS>, PushScreenAction<LockscreenSettingsMenu>, StaticMenuItemIcon<&bobbyicons::lock>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BUTTONCALIBRATE>, PushScreenAction<ButtonCalibrateDisplay>>>(); constructMenuItem<makeComponentArgs<MenuItem, PushButtonCalibrateDisplayAction, StaticText<TEXT_BUTTONCALIBRATE>>>(true);
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_EXTRABUTTONCALIBRATE>, PushScreenAction<ExtraButtonCalibrateMenu>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_EXTRABUTTONCALIBRATE>, PushScreenAction<ExtraButtonCalibrateMenu>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_QUICKACTIONS>, PushScreenAction<SetupQuickActionsMenu>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_QUICKACTIONS>, PushScreenAction<SetupQuickActionsMenu>>>();
constructMenuItem<makeComponent<MenuItem, GasText, DisabledColor, StaticFont<2>, DummyAction>>(); constructMenuItem<makeComponent<MenuItem, GasText, DisabledColor, StaticFont<2>, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, BremsText, DisabledColor, StaticFont<2>, DummyAction>>(); constructMenuItem<makeComponent<MenuItem, BremsText, DisabledColor, StaticFont<2>, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POTISCALIBRATE>, PushScreenAction<PotisCalibrateDisplay>>>(); constructMenuItem<makeComponentArgs<MenuItem, PushPotiCalibrateDisplayAction, StaticText<TEXT_POTISCALIBRATE>>>(true);
#ifdef FEATURE_JOYSTICK #ifdef FEATURE_JOYSTICK
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_JOYSTICK>, PushScreenAction<JoystickDebugDisplay>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_JOYSTICK>, PushScreenAction<JoystickDebugDisplay>>>();
#endif #endif
@ -231,12 +229,12 @@ BoardcomputerHardwareSettingsMenu::BoardcomputerHardwareSettingsMenu()
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&icons::back>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&icons::back>>>();
} }
std::string BoardcomputerHardwareSettingsMenu::text() const std::string BoardcomputerHardwareSettingsMenu::title() const
{ {
return TEXT_BOARDCOMPUTERHARDWARESETTINGS; return TEXT_BOARDCOMPUTERHARDWARESETTINGS;
} }
void BoardcomputerHardwareSettingsMenu::back() void BoardcomputerHardwareSettingsMenu::back()
{ {
switchScreen<SettingsMenu>(); popScreen();
} }

View File

@ -8,7 +8,7 @@ class BoardcomputerHardwareSettingsMenu : public BobbyMenuDisplay
public: public:
BoardcomputerHardwareSettingsMenu(); BoardcomputerHardwareSettingsMenu();
std::string text() const override; std::string title() const override;
void back() override; void back() override;
}; };

View File

@ -31,7 +31,7 @@ constexpr char TEXT_BACK[] = "Back";
struct FrontFreqAccessor : public espgui::RefAccessor<uint8_t> { uint8_t &getRef() const override { return controllers.front.command.buzzer.freq; } }; struct FrontFreqAccessor : public espgui::RefAccessor<uint8_t> { uint8_t &getRef() const override { return controllers.front.command.buzzer.freq; } };
using FrontFreqChangeScreen = espgui::makeComponent< using FrontFreqChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>, BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_FRONTFREQ>, espgui::StaticTitle<TEXT_FRONTFREQ>,
FrontFreqAccessor, FrontFreqAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -40,7 +40,7 @@ using FrontFreqChangeScreen = espgui::makeComponent<
struct FrontPatternAccessor : public espgui::RefAccessor<uint8_t> { uint8_t &getRef() const override { return controllers.front.command.buzzer.pattern; } }; struct FrontPatternAccessor : public espgui::RefAccessor<uint8_t> { uint8_t &getRef() const override { return controllers.front.command.buzzer.pattern; } };
using FrontPatternChangeScreen = espgui::makeComponent< using FrontPatternChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>, BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_FRONTPATTERN>, espgui::StaticTitle<TEXT_FRONTPATTERN>,
FrontPatternAccessor, FrontPatternAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -49,7 +49,7 @@ using FrontPatternChangeScreen = espgui::makeComponent<
struct BackFreqAccessor : public espgui::RefAccessor<uint8_t> { uint8_t &getRef() const override { return controllers.back.command.buzzer.freq; } }; struct BackFreqAccessor : public espgui::RefAccessor<uint8_t> { uint8_t &getRef() const override { return controllers.back.command.buzzer.freq; } };
using BackFreqChangeScreen = espgui::makeComponent< using BackFreqChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>, BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_BACKFREQ>, espgui::StaticTitle<TEXT_BACKFREQ>,
BackFreqAccessor, BackFreqAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -58,7 +58,7 @@ using BackFreqChangeScreen = espgui::makeComponent<
struct BackPatternAccessor : public espgui::RefAccessor<uint8_t> { uint8_t &getRef() const override { return controllers.back.command.buzzer.pattern; } }; struct BackPatternAccessor : public espgui::RefAccessor<uint8_t> { uint8_t &getRef() const override { return controllers.back.command.buzzer.pattern; } };
using BackPatternChangeScreen = espgui::makeComponent< using BackPatternChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>, BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_BACKPATTERN>, espgui::StaticTitle<TEXT_BACKPATTERN>,
BackPatternAccessor, BackPatternAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -66,28 +66,28 @@ using BackPatternChangeScreen = espgui::makeComponent<
using ReverseBeepFreq0ChangeScreen = espgui::makeComponent< using ReverseBeepFreq0ChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>, BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_REVERSEBEEPFREQ0>, espgui::StaticTitle<TEXT_REVERSEBEEPFREQ0>,
ReverseBeepFreq0Accessor, ReverseBeepFreq0Accessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using ReverseBeepFreq1ChangeScreen = espgui::makeComponent< using ReverseBeepFreq1ChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<uint8_t>, BobbyChangeValueDisplay<uint8_t>,
espgui::StaticText<TEXT_REVERSEBEEPFREQ1>, espgui::StaticTitle<TEXT_REVERSEBEEPFREQ1>,
ReverseBeepFreq1Accessor, ReverseBeepFreq1Accessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using ReverseBeepDuration0ChangeScreen = espgui::makeComponent< using ReverseBeepDuration0ChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_REVERSEBEEPDURATION0>, espgui::StaticTitle<TEXT_REVERSEBEEPDURATION0>,
ReverseBeepDuration0Accessor, ReverseBeepDuration0Accessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using ReverseBeepDuration1ChangeScreen = espgui::makeComponent< using ReverseBeepDuration1ChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_REVERSEBEEPDURATION1>, espgui::StaticTitle<TEXT_REVERSEBEEPDURATION1>,
ReverseBeepDuration1Accessor, ReverseBeepDuration1Accessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -110,7 +110,7 @@ BuzzerMenu::BuzzerMenu()
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
} }
std::string BuzzerMenu::text() const std::string BuzzerMenu::title() const
{ {
return TEXT_BUZZER; return TEXT_BUZZER;
} }

View File

@ -8,7 +8,7 @@ class BuzzerMenu : public BobbyMenuDisplay
public: public:
BuzzerMenu(); BuzzerMenu();
std::string text() const override; std::string title() const override;
void back() override; void back() override;
}; };

View File

@ -49,7 +49,7 @@ std::string toString(twai_state_t val)
class CanStatusText : public virtual espgui::TextInterface class CanStatusText : public virtual espgui::TextInterface
{ {
public: public:
explicit CanStatusText(const tl::expected<twai_status_info_t, esp_err_t> &last_can_status_info) : explicit CanStatusText(const std::expected<twai_status_info_t, esp_err_t> &last_can_status_info) :
m_last_can_status_info{last_can_status_info} m_last_can_status_info{last_can_status_info}
{ {
} }
@ -67,7 +67,7 @@ protected:
virtual std::string canStatusText(const twai_status_info_t &can_status_info) const = 0; virtual std::string canStatusText(const twai_status_info_t &can_status_info) const = 0;
private: private:
const tl::expected<twai_status_info_t, esp_err_t> &m_last_can_status_info; const std::expected<twai_status_info_t, esp_err_t> &m_last_can_status_info;
}; };
class CanStatusStateText : public CanStatusText class CanStatusStateText : public CanStatusText
@ -260,7 +260,7 @@ CanDebugMenu::CanDebugMenu()
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
} }
std::string CanDebugMenu::text() const std::string CanDebugMenu::title() const
{ {
return TEXT_CANDEBUG; return TEXT_CANDEBUG;
} }
@ -273,7 +273,7 @@ void CanDebugMenu::update()
if (const auto result = twai_get_status_info(&status_info); result != ESP_OK) if (const auto result = twai_get_status_info(&status_info); result != ESP_OK)
{ {
ESP_LOGE(TAG, "twai_get_status_info() failed with %s", esp_err_to_name(result)); ESP_LOGE(TAG, "twai_get_status_info() failed with %s", esp_err_to_name(result));
m_last_can_status_info = tl::make_unexpected(result); m_last_can_status_info = std::unexpected(result);
} }
else else
{ {

View File

@ -1,16 +1,18 @@
#pragma once #pragma once
#include "sdkconfig.h"
// local includes // local includes
#include "displays/bobbymenudisplay.h" #include "displays/bobbymenudisplay.h"
#ifdef FEATURE_CAN #ifdef FEATURE_CAN
// system includes
#include <expected>
// esp-idf includes // esp-idf includes
#include <driver/twai.h> #include <driver/twai.h>
// 3rdparty lib includes
#include <tl/expected.hpp>
class CanDebugMenu : public BobbyMenuDisplay class CanDebugMenu : public BobbyMenuDisplay
{ {
using Base = BobbyMenuDisplay; using Base = BobbyMenuDisplay;
@ -18,14 +20,14 @@ class CanDebugMenu : public BobbyMenuDisplay
public: public:
CanDebugMenu(); CanDebugMenu();
std::string text() const override; std::string title() const override;
void update() override; void update() override;
void back() override; void back() override;
private: private:
tl::expected<twai_status_info_t, esp_err_t> m_last_can_status_info; std::expected<twai_status_info_t, esp_err_t> m_last_can_status_info;
}; };
#endif #endif

View File

@ -32,7 +32,7 @@ constexpr char TEXT_BACK[] = "Back";
using CloudURLChangeScreen = espgui::makeComponent< using CloudURLChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<std::string>, BobbyChangeValueDisplay<std::string>,
espgui::StaticText<TEXT_CLOUDURL>, espgui::StaticTitle<TEXT_CLOUDURL>,
CloudURLAccessor, CloudURLAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -40,7 +40,7 @@ using CloudURLChangeScreen = espgui::makeComponent<
using CloudKeyChangeScreen = espgui::makeComponent< using CloudKeyChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<std::string>, BobbyChangeValueDisplay<std::string>,
espgui::StaticText<TEXT_CLOUDKEY>, espgui::StaticTitle<TEXT_CLOUDKEY>,
CloudKeyAccessor, CloudKeyAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -48,7 +48,7 @@ using CloudKeyChangeScreen = espgui::makeComponent<
using CloudTransmitTimeoutChangeScreen = espgui::makeComponent< using CloudTransmitTimeoutChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_CLOUDTRANSMITTIMEOUT>, espgui::StaticTitle<TEXT_CLOUDTRANSMITTIMEOUT>,
CloudTransmitTimeoutAccessor, CloudTransmitTimeoutAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -65,7 +65,7 @@ public:
using CloudCollectRateChangeDisplay = espgui::makeComponent< using CloudCollectRateChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_CLOUDCOLLECTRATE>, espgui::StaticTitle<TEXT_CLOUDCOLLECTRATE>,
CloudCollectRateAccessor, CloudCollectRateAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -73,7 +73,7 @@ using CloudCollectRateChangeDisplay = espgui::makeComponent<
using CloudSendRateChangeDisplay = espgui::makeComponent< using CloudSendRateChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_CLOUDSENDRATE>, espgui::StaticTitle<TEXT_CLOUDSENDRATE>,
CloudSendRateAccessor, CloudSendRateAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -98,7 +98,7 @@ CloudSettingsMenu::CloudSettingsMenu()
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PushScreenAction<SettingsMenu>, StaticMenuItemIcon<&espgui::icons::back>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PushScreenAction<SettingsMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
} }
std::string CloudSettingsMenu::text() const std::string CloudSettingsMenu::title() const
{ {
return TEXT_CLOUDSETTINGS; return TEXT_CLOUDSETTINGS;
} }

View File

@ -8,7 +8,7 @@ class CloudSettingsMenu : public BobbyMenuDisplay
public: public:
CloudSettingsMenu(); CloudSettingsMenu();
std::string text() const override; std::string title() const override;
void back() override; void back() override;
}; };

View File

@ -39,14 +39,14 @@ constexpr char TEXT_BACK[] = "Back";
using WheelDiameterMmChangeScreen = espgui::makeComponent< using WheelDiameterMmChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_WHEELDIAMETERMM>, espgui::StaticTitle<TEXT_WHEELDIAMETERMM>,
WheelDiameterMmAccessor, WheelDiameterMmAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using WheelDiameterInchChangeScreen = espgui::makeComponent< using WheelDiameterInchChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<float>, BobbyChangeValueDisplay<float>,
espgui::StaticText<TEXT_WHEELDIAMETERINCH>, espgui::StaticTitle<TEXT_WHEELDIAMETERINCH>,
WheelDiameterInchAccessor, WheelDiameterInchAccessor,
espgui::RatioNumberStep<float, std::ratio<1,10>>, espgui::RatioNumberStep<float, std::ratio<1,10>>,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
@ -54,7 +54,7 @@ using WheelDiameterInchChangeScreen = espgui::makeComponent<
>; >;
using NumMagnetPolesChangeScreen = espgui::makeComponent< using NumMagnetPolesChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_NUMMAGNETPOLES>, espgui::StaticTitle<TEXT_NUMMAGNETPOLES>,
NumMagnetPolesAccessor, NumMagnetPolesAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -62,14 +62,14 @@ using NumMagnetPolesChangeScreen = espgui::makeComponent<
#ifdef FEATURE_CAN #ifdef FEATURE_CAN
using CanTransmitTimeoutChangeScreen = espgui::makeComponent< using CanTransmitTimeoutChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_CANTRANSMITTIMEOUT>, espgui::StaticTitle<TEXT_CANTRANSMITTIMEOUT>,
CanTransmitTimeoutAccessor, CanTransmitTimeoutAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
>; >;
using CanReceiveTimeoutChangeScreen = espgui::makeComponent< using CanReceiveTimeoutChangeScreen = espgui::makeComponent<
BobbyChangeValueDisplay<int16_t>, BobbyChangeValueDisplay<int16_t>,
espgui::StaticText<TEXT_CANRECEIVETIMEOUT>, espgui::StaticTitle<TEXT_CANRECEIVETIMEOUT>,
CanReceiveTimeoutAccessor, CanReceiveTimeoutAccessor,
espgui::ConfirmActionInterface<espgui::PopScreenAction>, espgui::ConfirmActionInterface<espgui::PopScreenAction>,
espgui::BackActionInterface<espgui::PopScreenAction> espgui::BackActionInterface<espgui::PopScreenAction>
@ -97,7 +97,7 @@ ControllerHardwareSettingsMenu::ControllerHardwareSettingsMenu()
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
} }
std::string ControllerHardwareSettingsMenu::text() const std::string ControllerHardwareSettingsMenu::title() const
{ {
return TEXT_CONTROLLERHARDWARESETTINGS; return TEXT_CONTROLLERHARDWARESETTINGS;
} }

View File

@ -8,7 +8,7 @@ class ControllerHardwareSettingsMenu : public BobbyMenuDisplay
public: public:
ControllerHardwareSettingsMenu(); ControllerHardwareSettingsMenu();
std::string text() const override; std::string title() const override;
void back() override; void back() override;
}; };

Some files were not shown because too many files have changed in this diff Show More