diff --git a/.gitignore b/.gitignore index 07c18dc..bf82364 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ -.pio -platformio.pro* +desktop.ini +/build +/CMakeLists.txt.user* +/cmake-build-debug +/sdkconfig.old* +/.idea +/.ccache diff --git a/.gitmodules b/.gitmodules index 27c8abf..44beed1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,39 @@ -[submodule "src/bobbycar-protocol"] - path = src/bobbycar-protocol - url = git@github.com:bobbycar-graz/bobbycar-protocol.git [submodule "src/espcpputils"] - path = src/espcpputils + path = components/espcpputils url = git@github.com:0xFEEDC0DE64/espcpputils.git [submodule "esp-idf"] path = esp-idf - url = https://github.com/0xFEEDC0DE64/esp-idf.git + url = git@github.com:0xFEEDC0DE64/esp-idf.git +[submodule "components/cpputils"] + path = components/cpputils + url = git@github.com:0xFEEDC0DE64/cpputils.git +[submodule "components/espcpputils"] + path = components/espcpputils + url = git@github.com:0xFEEDC0DE64/espcpputils.git +[submodule "components/cxx-ring-buffer"] + path = components/cxx-ring-buffer + url = git@github.com:0xFEEDC0DE64/cxx-ring-buffer.git +[submodule "components/date"] + path = components/date + url = git@github.com:0xFEEDC0DE64/date.git +[submodule "components/espchrono"] + path = components/espchrono + url = git@github.com:0xFEEDC0DE64/espchrono.git +[submodule "components/ArduinoJson"] + path = components/ArduinoJson + url = git@github.com:0xFEEDC0DE64/ArduinoJson.git +[submodule "components/TFT_eSPI"] + path = components/TFT_eSPI + url = git@github.com:0xFEEDC0DE64/TFT_eSPI.git +[submodule "components/arduino-esp32"] + path = components/arduino-esp32 + url = git@github.com:0xFEEDC0DE64/arduino-esp32.git +[submodule "components/expected"] + path = components/expected + url = git@github.com:0xFEEDC0DE64/expected.git +[submodule "components/bobbycar-protocol"] + path = components/bobbycar-protocol + url = git@github.com:bobbycar-graz/bobbycar-protocol.git +[submodule "components/fmt"] + path = components/fmt + url = git@github.com:0xFEEDC0DE64/fmt.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..24a8c9e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,85 @@ +cmake_minimum_required(VERSION 3.16.3) + +add_definitions( + -DUSER_SETUP_LOADED=1 + -DLOAD_GLCD=1 + -DLOAD_FONT2=1 + -DLOAD_FONT4=1 + -DLOAD_FONT7=1 + -DFEATURE_ADC_IN + -DPINS_GAS=34 + -DPINS_BREMS=35 +# -DPINS_LED=23 + -DILI9341_DRIVER=1 + -DTFT_MOSI=13 + -DTFT_SCLK=15 + -DTFT_CS=14 + -DTFT_DC=12 + -DTFT_RST=2 + -DSPI_FREQUENCY=27000000 + -DDEFAULT_SWAPSCREENBYTES=false + -DFEATURE_CAN +# -DFEATURE_SERIAL +# -DPINS_RX1=4 +# -DPINS_TX1=5 +# -DPINS_RX2=22 +# -DPINS_TX2=23 + -DDEFAULT_INVERTFRONTLEFT=false + -DDEFAULT_INVERTFRONTRIGHT=true + -DDEFAULT_INVERTBACKLEFT=false + -DDEFAULT_INVERTBACKRIGHT=true + -DDEFAULT_WHEELDIAMETER=255 +# -DFEATURE_MOSFETS +# -DPINS_MOSFET0=18 +# -DPINS_MOSFET1=19 +# -DPINS_MOSFET2=21 + -DDEFAULT_IMOTMAX=35 + -DDEFAULT_IDCMAX=37 + -DDEFAULT_NMOTMAX=2000 + -DDEFAULT_FIELDWEAKMAX=7 + -DDEFAULT_FIELDADVMAX=40 + -DDEVICE_PREFIX=bobbyquad + -DAP_PASSWORD=Passwort_123 +# -DFEATURE_WEBSERVER +# -DFEATURE_ARDUINOOTA +# -DFEATURE_WEBOTA + -DFEATURE_DPAD_5WIRESW + -DPINS_DPAD_5WIRESW_OUT=18 + -DPINS_DPAD_5WIRESW_IN1=19 + -DPINS_DPAD_5WIRESW_IN2=27 + -DPINS_DPAD_5WIRESW_IN3=32 + -DPINS_DPAD_5WIRESW_IN4=33 + -DDPAD_5WIRESW_UP=6 + -DDPAD_5WIRESW_DOWN=3 + -DDPAD_5WIRESW_CONFIRM=7 + -DDPAD_5WIRESW_BACK=2 + -DDPAD_5WIRESW_PROFILE0=1 + -DDPAD_5WIRESW_PROFILE1=5 + -DDPAD_5WIRESW_PROFILE2=0 + -DDPAD_5WIRESW_PROFILE3=4 +# -DDPAD_5WIRESW_DEBUG + -DDEFAULT_GASMIN=150 + -DDEFAULT_GASMAX=1300 + -DDEFAULT_BREMSMIN=200 + -DDEFAULT_BREMSMAX=1500 +# -DFEATURE_BLUETOOTH +# -DFEATURE_BMS +# -DFEATURE_GAMETRAK +# -DPINS_GAMETRAKX=34 +# -DPINS_GAMETRAKY=39 +# -DPINS_GAMETRAKDIST=36 +# -DDEFAULT_GAMETRAKXMIN=0 +# -DDEFAULT_GAMETRAKXMAX=4095 +# -DDEFAULT_GAMETRAKYMIN=0 +# -DDEFAULT_GAMETRAKYMAX=4095 +# -DDEFAULT_GAMETRAKDISTMIN=0 +# -DDEFAULT_GAMETRAKDISTMAX=4095 +# -DFEATURE_CLOUD +) + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +project(boardcomputer) diff --git a/README.md b/README.md index 7501df5..d9bd56b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,9 @@ ``` git clone --recursive git@github.com:bobbycar-graz/bobbycar-boardcomputer-firmware.git cd bobbycar-boardcomputer-firmware/ -platformio run --environment bobbycar_usb --target upload +./esp-idf/install.sh +. esp-idf/export.sh +idf.py -p /dev/ttyUSB0 -b 921600 flash monitor ``` ## How to wire all connections? diff --git a/backtrace.sh b/backtrace.sh deleted file mode 100755 index 3ae5e84..0000000 --- a/backtrace.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -GDB_BINARY=~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb -ELF_FILE=.pio/build/feedc0de_usb/firmware.elf - -if [[ ! -x "$GDB_BINARY" ]] -then - echo Could not find gdb binary: "$GDB_BINARY" - exit 1 -fi - -if [[ ! -f "$ELF_FILE" ]] -then - echo Could not find elf file: "$ELF_FILE" - exit 1 -fi - -ls -lah "$ELF_FILE" - -PARAMS=() -for i in $@ -do - ADDR="$(echo "$i" | cut -d ":" -f 1)" - OUTPUT="$($GDB_BINARY --batch $ELF_FILE -ex "set listsize 1" -ex "l *$ADDR" -ex "q")" - - if [[ -z "$OUTPUT" ]] - then - echo "${ADDR} gdb empty output" - else - echo "${OUTPUT}" - fi -done diff --git a/components/ArduinoJson b/components/ArduinoJson new file mode 160000 index 0000000..d66159f --- /dev/null +++ b/components/ArduinoJson @@ -0,0 +1 @@ +Subproject commit d66159f51a7b958789ab83aabd72f270a04af066 diff --git a/components/TFT_eSPI b/components/TFT_eSPI new file mode 160000 index 0000000..95458b3 --- /dev/null +++ b/components/TFT_eSPI @@ -0,0 +1 @@ +Subproject commit 95458b3875afa69889878fc6a494466d6814eb90 diff --git a/components/arduino-esp32 b/components/arduino-esp32 new file mode 160000 index 0000000..ff9ec96 --- /dev/null +++ b/components/arduino-esp32 @@ -0,0 +1 @@ +Subproject commit ff9ec961c1566d98ce39c3b97269c77d85fc69c0 diff --git a/components/bobbycar-protocol b/components/bobbycar-protocol new file mode 160000 index 0000000..1acdbfe --- /dev/null +++ b/components/bobbycar-protocol @@ -0,0 +1 @@ +Subproject commit 1acdbfe14e59808f5fe0b29a0267e9d068b7f6f8 diff --git a/components/cpputils b/components/cpputils new file mode 160000 index 0000000..79a7f4e --- /dev/null +++ b/components/cpputils @@ -0,0 +1 @@ +Subproject commit 79a7f4ef855454e73dc9f657db6a4011b3fa7f7e diff --git a/components/cxx-ring-buffer b/components/cxx-ring-buffer new file mode 160000 index 0000000..c204c20 --- /dev/null +++ b/components/cxx-ring-buffer @@ -0,0 +1 @@ +Subproject commit c204c208884c08a583f7ded7eb3fa19936761460 diff --git a/components/date b/components/date new file mode 160000 index 0000000..b1a7584 --- /dev/null +++ b/components/date @@ -0,0 +1 @@ +Subproject commit b1a75847d5625d6a7e315f19abf8548ec8fd0d6b diff --git a/components/espchrono b/components/espchrono new file mode 160000 index 0000000..7f8a185 --- /dev/null +++ b/components/espchrono @@ -0,0 +1 @@ +Subproject commit 7f8a185678cccf0307910bffc6422a5564dccb0c diff --git a/components/espcpputils b/components/espcpputils new file mode 160000 index 0000000..a504262 --- /dev/null +++ b/components/espcpputils @@ -0,0 +1 @@ +Subproject commit a504262f3949b267c6f79e97f448ecf1f8fb1a45 diff --git a/components/expected b/components/expected new file mode 160000 index 0000000..aa9b2b2 --- /dev/null +++ b/components/expected @@ -0,0 +1 @@ +Subproject commit aa9b2b2d1f3e23b2a3771afc6eda7f2244125da6 diff --git a/components/fmt b/components/fmt new file mode 160000 index 0000000..4b11c94 --- /dev/null +++ b/components/fmt @@ -0,0 +1 @@ +Subproject commit 4b11c94036d4c5012dc4cb3854f47052f6f49812 diff --git a/include/README b/include/README deleted file mode 100644 index 194dcd4..0000000 --- a/include/README +++ /dev/null @@ -1,39 +0,0 @@ - -This directory is intended for project header files. - -A header file is a file containing C declarations and macro definitions -to be shared between several project source files. You request the use of a -header file in your project source file (C, C++, etc) located in `src` folder -by including it, with the C preprocessing directive `#include'. - -```src/main.c - -#include "header.h" - -int main (void) -{ - ... -} -``` - -Including a header file produces the same results as copying the header file -into each source file that needs it. Such copying would be time-consuming -and error-prone. With a header file, the related declarations appear -in only one place. If they need to be changed, they can be changed in one -place, and programs that include the header file will automatically use the -new version when next recompiled. The header file eliminates the labor of -finding and changing all the copies as well as the risk that a failure to -find one copy will result in inconsistencies within a program. - -In C, the usual convention is to give header files names that end with `.h'. -It is most portable to use only letters, digits, dashes, and underscores in -header file names, and at most one dot. - -Read more about using header files in official GCC documentation: - -* Include Syntax -* Include Operation -* Once-Only Headers -* Computed Includes - -https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/init_ide.sh b/init_ide.sh deleted file mode 100755 index 3f4efb8..0000000 --- a/init_ide.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -platformio init --ide qtcreator - -echo "CONFIG+=c++17" >> platformio.pro - -echo "OTHER_FILES += \\" >> platformio.pro - -#for i in $(find data -type f) -#do -# echo " $i \\" >> platformio.pro -#done - -echo " partitions_16M_ota.csv \\" >> platformio.pro -echo " partitions_4M_noota.csv \\" >> platformio.pro -echo " partitions_4M_ota.csv \\" >> platformio.pro -echo " LICENSE" >> platformio.pro -echo " README.md" >> platformio.pro diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt new file mode 100644 index 0000000..830e653 --- /dev/null +++ b/main/CMakeLists.txt @@ -0,0 +1,203 @@ +set(headers + accessorinterface.h + actioninterface.h + actions/backproxyaction.h + actions/bluetoothbeginaction.h + actions/bluetoothbeginmasteraction.h + actions/bluetoothconnectbmsaction.h + actions/bluetoothdisconnectaction.h + actions/bluetoothendaction.h + actions/bluetoothflushaction.h + actions/bmsturnoffchargeaction.h + actions/bmsturnoffdischargeaction.h + actions/bmsturnonchargeaction.h + actions/bmsturnondischargeaction.h + actions/dummyaction.h + actions/erasenvsaction.h + actions/loadsettingsaction.h + actions/modesettingsaction.h + actions/multiaction.h + actions/rebootaction.h + actions/savesettingsaction.h + actions/setvalueaction.h + actions/switchscreenaction.h + actions/toggleboolaction.h + actions/wifidisconnectaction.h + actions/wifienableipv6action.h + actions/wifireconnectaction.h + actions/wifisoftapaction.h + actions/wifisoftapdisconnectaction.h + actions/wifisoftapdisconnectwifioffaction.h + actions/wifisoftapenableipv6action.h + actions/switchprofileaction.h + actions/updateswapfrontbackaction.h + bluetoothmode.h + bmsutils.h + changevaluedisplay_bluetoothmode.h + changevaluedisplay_bool.h + changevaluedisplay_larsmmode_mode.h + changevaluedisplay_unifiedmodelmode.h + changevaluedisplay_wifi_mode_t.h + changevaluedisplay_wifi_power_t.h + checkboxicon.h + cloud.h + colorinterface.h + debugcolorhelpers.h + displays/gameoflifedisplay.h + displays/graphdisplay.h + displays/menus/aboutmenu.h + displays/menus/accesspointwifisettingsmenu.h + displays/menus/bluetoothsettingsmenu.h + displays/menus/bmsmenu.h + displays/menus/buzzermenu.h + displays/menus/commanddebugmenu.h + displays/menus/debugmenu.h + displays/menus/defaultmodesettingsmenu.h + displays/menus/demosmenu.h + displays/menus/enablemenu.h + displays/menus/feedbackdebugmenu.h + displays/menus/gametrakmodesettingsmenu.h + displays/menus/genericwifisettingsmenu.h + displays/menus/graphsmenu.h + displays/menus/invertmenu.h + displays/menus/larsmmodesettingsmenu.h + displays/menus/modessettingsmenu.h + displays/menus/mosfetsmenu.h + displays/menus/motorstatedebugmenu.h + displays/menus/presetsmenu.h + displays/menus/profilesmenu.h + displays/menus/selectmodemenu.h + displays/menus/settingsmenu.h + displays/menus/stationwifisettingsmenu.h + displays/menus/tempomatmodesettingsmenu.h + displays/menus/timersmenu.h + displays/menus/wifisettingsmenu.h + displays/menus/controllerhardwaresettingsmenu.h + displays/menus/boardcomputerhardwaresettingsmenu.h + displays/menus/dynamicdebugmenu.h + displays/menus/limitssettingsmenu.h + displays/menus/mainmenu.h + displays/menus/motorfeedbackdebugmenu.h + displays/menus/wifiscanmenu.h + displays/pingpongdisplay.h + displays/poweroffdisplay.h + displays/spirodisplay.h + displays/splitgraphdisplay.h + displays/starfielddisplay.h + displays/bmsdisplay.h + displays/calibratedisplay.h + displays/dpad5wiredebugdisplay.h + displays/gametrakcalibratedisplay.h + displays/lockscreen.h + displays/metersdisplay.h + displays/powersupplydisplay.h + displays/statusdisplay.h + displays/updatedisplay.h + esp_websocket_client.h + fontinterface.h + htmltag.h + icon.h + iconinterface.h + icons/alert.h + icons/back.h + icons/bluetooth.h + icons/bms.h + icons/buzzer.h + icons/checked.h + icons/close.h + icons/demos.h + icons/graph.h + icons/hardware.h + icons/info.h + icons/lock.h + icons/logo.h + icons/modes.h + icons/poweroff.h + icons/presets.h + icons/reboot.h + icons/scan.h + icons/settings.h + icons/unchecked.h + icons/wifi.h + menudisplay.h + menuitem.h + modes/defaultmode.h + modes/gametrakmode.h + modes/ignoreinputmode.h + modes/larsmmode.h + modes/tempomatmode.h + rotary.h + screens.h + types.h + widgets/progressbar.h + widgets/reverseprogressbar.h + widgets/verticalmeter.h + widgets/vumeter.h + widgets/graph.h + widgets/label.h + wifiaccessors.h + esptexthelpers.h + presets.h + bluetoothtexthelpers.h + bobby_webserver.h + buttons.h + can.h + changevaluedisplay.h + changevaluedisplay_controlmode.h + changevaluedisplay_controltype.h + controller.h + debugtexthelpers.h + display.h + dpad.h + dpad3wire.h + dpad5wire.h + feedbackparser.h + globals.h + htmlutils.h + modeinterface.h + ota.h + serialhandler.h + settings.h + settingsaccessors.h + settingspersister.h + settingsutils.h + statistics.h + textinterface.h + texts.h + unifiedmodelmode.h + utils.h + wifitexthelpers.h +) + +set(sources + main.cpp +) + +set(dependencies + libsodium freertos nvs_flash esp_http_server esp_https_ota mdns app_update esp_system esp_websocket_client driver + arduino-esp32 ArduinoJson +# AsyncTCP + bobbycar-protocol cpputils cxx-ring-buffer date +# ESPAsyncWebServer + espchrono espcpputils expected fmt TFT_eSPI +) + +idf_component_register( + SRCS + ${headers} + ${sources} + INCLUDE_DIRS + . + REQUIRES + ${dependencies} +) + +target_compile_options(${COMPONENT_TARGET} + PRIVATE + -fstack-reuse=all + -fstack-protector-all + -Wno-unused-function + -Wno-deprecated-declarations + -Wno-missing-field-initializers + -Wno-parentheses +) diff --git a/src/accessorinterface.h b/main/accessorinterface.h similarity index 100% rename from src/accessorinterface.h rename to main/accessorinterface.h diff --git a/src/actioninterface.h b/main/actioninterface.h similarity index 82% rename from src/actioninterface.h rename to main/actioninterface.h index 8340088..d2cf9d0 100644 --- a/src/actioninterface.h +++ b/main/actioninterface.h @@ -1,7 +1,5 @@ #pragma once -#include "utils.h" - namespace { class ActionInterface { diff --git a/src/actions/backproxyaction.h b/main/actions/backproxyaction.h similarity index 100% rename from src/actions/backproxyaction.h rename to main/actions/backproxyaction.h diff --git a/src/actions/bluetoothbeginaction.h b/main/actions/bluetoothbeginaction.h similarity index 79% rename from src/actions/bluetoothbeginaction.h rename to main/actions/bluetoothbeginaction.h index a2ea505..1fe82c8 100644 --- a/src/actions/bluetoothbeginaction.h +++ b/main/actions/bluetoothbeginaction.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "actioninterface.h" #include "globals.h" @@ -14,7 +12,7 @@ public: { if (!bluetoothSerial.begin(deviceName)) { - Serial.println("Could not begin bluetooth"); + //Serial.println("Could not begin bluetooth"); // TODO: better error handling } } diff --git a/src/actions/bluetoothbeginmasteraction.h b/main/actions/bluetoothbeginmasteraction.h similarity index 78% rename from src/actions/bluetoothbeginmasteraction.h rename to main/actions/bluetoothbeginmasteraction.h index ee0c22e..89131b2 100644 --- a/src/actions/bluetoothbeginmasteraction.h +++ b/main/actions/bluetoothbeginmasteraction.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "actioninterface.h" #include "globals.h" @@ -14,7 +12,7 @@ public: { if (!bluetoothSerial.begin(deviceName, true)) { - Serial.println("Could not begin bluetooth master"); + //Serial.println("Could not begin bluetooth master"); // TODO: better error handling } } diff --git a/src/actions/bluetoothconnectbmsaction.h b/main/actions/bluetoothconnectbmsaction.h similarity index 83% rename from src/actions/bluetoothconnectbmsaction.h rename to main/actions/bluetoothconnectbmsaction.h index 5a780e4..49570d4 100644 --- a/src/actions/bluetoothconnectbmsaction.h +++ b/main/actions/bluetoothconnectbmsaction.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "actioninterface.h" #include "globals.h" @@ -15,7 +13,7 @@ public: uint8_t remoteAddress[ESP_BD_ADDR_LEN] = {0xAA, 0xBB, 0xCC, 0xA1, 0x23, 0x45}; if (!bluetoothSerial.connect(remoteAddress)) { - Serial.println("Could not connect bluetooth to bms"); + //Serial.println("Could not connect bluetooth to bms"); // TODO: better error handling } } diff --git a/src/actions/bluetoothdisconnectaction.h b/main/actions/bluetoothdisconnectaction.h similarity index 78% rename from src/actions/bluetoothdisconnectaction.h rename to main/actions/bluetoothdisconnectaction.h index 0c6181b..1e1eb52 100644 --- a/src/actions/bluetoothdisconnectaction.h +++ b/main/actions/bluetoothdisconnectaction.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "actioninterface.h" #include "globals.h" @@ -14,7 +12,7 @@ public: { if (!bluetoothSerial.disconnect()) { - Serial.println("Could not disconnect bluetooth"); + //Serial.println("Could not disconnect bluetooth"); // TODO: better error handling } } diff --git a/src/actions/bluetoothendaction.h b/main/actions/bluetoothendaction.h similarity index 100% rename from src/actions/bluetoothendaction.h rename to main/actions/bluetoothendaction.h diff --git a/src/actions/bluetoothflushaction.h b/main/actions/bluetoothflushaction.h similarity index 100% rename from src/actions/bluetoothflushaction.h rename to main/actions/bluetoothflushaction.h diff --git a/src/actions/bmsturnoffchargeaction.h b/main/actions/bmsturnoffchargeaction.h similarity index 83% rename from src/actions/bmsturnoffchargeaction.h rename to main/actions/bmsturnoffchargeaction.h index 06da7d2..52ae81e 100644 --- a/src/actions/bmsturnoffchargeaction.h +++ b/main/actions/bmsturnoffchargeaction.h @@ -12,7 +12,7 @@ public: { if (!bms::send6Bit(42405, 250, 0)) { - Serial.println("Could not turn off charge mosfet"); + //Serial.println("Could not turn off charge mosfet"); // TODO: better error handling } } diff --git a/src/actions/bmsturnoffdischargeaction.h b/main/actions/bmsturnoffdischargeaction.h similarity index 82% rename from src/actions/bmsturnoffdischargeaction.h rename to main/actions/bmsturnoffdischargeaction.h index d19c228..706cec3 100644 --- a/src/actions/bmsturnoffdischargeaction.h +++ b/main/actions/bmsturnoffdischargeaction.h @@ -12,7 +12,7 @@ public: { if (!bms::send6Bit(42405, 249, 0)) { - Serial.println("Could not turn off discharge mosfet"); + //Serial.println("Could not turn off discharge mosfet"); // TODO: better error handling } } diff --git a/src/actions/bmsturnonchargeaction.h b/main/actions/bmsturnonchargeaction.h similarity index 83% rename from src/actions/bmsturnonchargeaction.h rename to main/actions/bmsturnonchargeaction.h index 79d9867..bdcfe7a 100644 --- a/src/actions/bmsturnonchargeaction.h +++ b/main/actions/bmsturnonchargeaction.h @@ -12,7 +12,7 @@ public: { if (!bms::send6Bit(42405, 250, 1)) { - Serial.println("Could not turn on charge mosfet"); + //Serial.println("Could not turn on charge mosfet"); // TODO: better error handling } } diff --git a/src/actions/bmsturnondischargeaction.h b/main/actions/bmsturnondischargeaction.h similarity index 82% rename from src/actions/bmsturnondischargeaction.h rename to main/actions/bmsturnondischargeaction.h index 6c87d50..c2d02fb 100644 --- a/src/actions/bmsturnondischargeaction.h +++ b/main/actions/bmsturnondischargeaction.h @@ -12,7 +12,7 @@ public: { if (!bms::send6Bit(42405, 249, 1)) { - Serial.println("Could not turn on discharge mosfet"); + //Serial.println("Could not turn on discharge mosfet"); // TODO: better error handling } } diff --git a/src/actions/dummyaction.h b/main/actions/dummyaction.h similarity index 100% rename from src/actions/dummyaction.h rename to main/actions/dummyaction.h diff --git a/src/actions/erasenvsaction.h b/main/actions/erasenvsaction.h similarity index 71% rename from src/actions/erasenvsaction.h rename to main/actions/erasenvsaction.h index aef8a88..bcb1ddd 100644 --- a/src/actions/erasenvsaction.h +++ b/main/actions/erasenvsaction.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "actioninterface.h" #include "globals.h" #include "presets.h" @@ -16,7 +14,7 @@ public: if (!settingsPersister.erase()) { - Serial.println("EraseNvsAction::triggered() erase failed"); + //Serial.println("EraseNvsAction::triggered() erase failed"); return; } @@ -27,13 +25,13 @@ public: if (!settingsPersister.openProfile(*profile)) { - Serial.println("EraseNvsAction::triggered() openProfile failed"); + //Serial.println("EraseNvsAction::triggered() openProfile failed"); return; } if (!settingsPersister.load(settings)) { - Serial.println("EraseNvsAction::triggered() load failed"); + //Serial.println("EraseNvsAction::triggered() load failed"); return; } } diff --git a/src/actions/loadsettingsaction.h b/main/actions/loadsettingsaction.h similarity index 100% rename from src/actions/loadsettingsaction.h rename to main/actions/loadsettingsaction.h diff --git a/src/actions/modesettingsaction.h b/main/actions/modesettingsaction.h similarity index 90% rename from src/actions/modesettingsaction.h rename to main/actions/modesettingsaction.h index ef83b04..f33f465 100644 --- a/src/actions/modesettingsaction.h +++ b/main/actions/modesettingsaction.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "actioninterface.h" #include "globals.h" #include "modes/defaultmode.h" @@ -33,6 +31,8 @@ void ModeSettingsAction::triggered() switchScreen(); #endif else - Serial.println("Unknown mode, cannot open settings for it"); + { + //Serial.println("Unknown mode, cannot open settings for it"); + } } } diff --git a/src/actions/multiaction.h b/main/actions/multiaction.h similarity index 100% rename from src/actions/multiaction.h rename to main/actions/multiaction.h diff --git a/src/actions/rebootaction.h b/main/actions/rebootaction.h similarity index 91% rename from src/actions/rebootaction.h rename to main/actions/rebootaction.h index 4fb6773..fc77138 100644 --- a/src/actions/rebootaction.h +++ b/main/actions/rebootaction.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include "actioninterface.h" #include "globals.h" @@ -22,7 +22,7 @@ public: tft.setTextColor(TFT_WHITE); tft.drawString("Rebooting now...", 0, 50, 4); - ESP.restart(); + esp_restart(); } }; } diff --git a/src/actions/savesettingsaction.h b/main/actions/savesettingsaction.h similarity index 100% rename from src/actions/savesettingsaction.h rename to main/actions/savesettingsaction.h diff --git a/src/actions/setvalueaction.h b/main/actions/setvalueaction.h similarity index 100% rename from src/actions/setvalueaction.h rename to main/actions/setvalueaction.h diff --git a/src/actions/switchprofileaction.h b/main/actions/switchprofileaction.h similarity index 89% rename from src/actions/switchprofileaction.h rename to main/actions/switchprofileaction.h index 26e6eb9..2010d29 100644 --- a/src/actions/switchprofileaction.h +++ b/main/actions/switchprofileaction.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "actioninterface.h" #include "settingsutils.h" diff --git a/src/actions/switchscreenaction.h b/main/actions/switchscreenaction.h similarity index 100% rename from src/actions/switchscreenaction.h rename to main/actions/switchscreenaction.h diff --git a/src/actions/toggleboolaction.h b/main/actions/toggleboolaction.h similarity index 100% rename from src/actions/toggleboolaction.h rename to main/actions/toggleboolaction.h diff --git a/src/actions/updateswapfrontbackaction.h b/main/actions/updateswapfrontbackaction.h similarity index 100% rename from src/actions/updateswapfrontbackaction.h rename to main/actions/updateswapfrontbackaction.h diff --git a/src/actions/wifidisconnectaction.h b/main/actions/wifidisconnectaction.h similarity index 58% rename from src/actions/wifidisconnectaction.h rename to main/actions/wifidisconnectaction.h index 9a3fad3..b418c97 100644 --- a/src/actions/wifidisconnectaction.h +++ b/main/actions/wifidisconnectaction.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "actioninterface.h" namespace { @@ -11,11 +8,11 @@ class WifiDisconnectAction : public virtual ActionInterface public: void triggered() override { - if (!WiFi.disconnect()) - { - Serial.println("Could not disconnect WiFi"); + //if (!WiFi.disconnect()) + //{ + //Serial.println("Could not disconnect WiFi"); // TODO: better error handling - } + //} } }; } diff --git a/src/actions/wifienableipv6action.h b/main/actions/wifienableipv6action.h similarity index 58% rename from src/actions/wifienableipv6action.h rename to main/actions/wifienableipv6action.h index 4e54061..fd055e3 100644 --- a/src/actions/wifienableipv6action.h +++ b/main/actions/wifienableipv6action.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "actioninterface.h" namespace { @@ -11,11 +8,11 @@ class WifiEnableIpV6Action : public virtual ActionInterface public: void triggered() override { - if (!WiFi.enableIpV6()) - { - Serial.println("Could not enableIpV6 WiFi"); + //if (!WiFi.enableIpV6()) + //{ + //Serial.println("Could not enableIpV6 WiFi"); // TODO: better error handling - } + //} } }; } diff --git a/src/actions/wifireconnectaction.h b/main/actions/wifireconnectaction.h similarity index 58% rename from src/actions/wifireconnectaction.h rename to main/actions/wifireconnectaction.h index d4bc7c7..029c0bd 100644 --- a/src/actions/wifireconnectaction.h +++ b/main/actions/wifireconnectaction.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "actioninterface.h" namespace { @@ -11,11 +8,11 @@ class WifiReconnectAction : public virtual ActionInterface public: void triggered() override { - if (!WiFi.reconnect()) - { - Serial.println("Could not reconnect WiFi"); + //if (!WiFi.reconnect()) + //{ + //Serial.println("Could not reconnect WiFi"); // TODO: better error handling - } + //} } }; } diff --git a/src/actions/wifisoftapaction.h b/main/actions/wifisoftapaction.h similarity index 58% rename from src/actions/wifisoftapaction.h rename to main/actions/wifisoftapaction.h index 0ab471d..63a809d 100644 --- a/src/actions/wifisoftapaction.h +++ b/main/actions/wifisoftapaction.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "actioninterface.h" #include "globals.h" #include "utils.h" @@ -13,11 +10,11 @@ class WifiSoftApAction : public virtual ActionInterface public: void triggered() override { - if (!WiFi.softAP(deviceName, STRING(AP_PASSWORD))) - { - Serial.println("Could not softAP WiFi"); + //if (!WiFi.softAP(deviceName, STRING(AP_PASSWORD))) + //{ + //Serial.println("Could not softAP WiFi"); // TODO: better error handling - } + //} } }; } diff --git a/src/actions/wifisoftapdisconnectaction.h b/main/actions/wifisoftapdisconnectaction.h similarity index 57% rename from src/actions/wifisoftapdisconnectaction.h rename to main/actions/wifisoftapdisconnectaction.h index 8fa3811..be3ad03 100644 --- a/src/actions/wifisoftapdisconnectaction.h +++ b/main/actions/wifisoftapdisconnectaction.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "actioninterface.h" namespace { @@ -11,11 +8,11 @@ class WifiSoftApDisconnectAction : public virtual ActionInterface public: void triggered() override { - if (!WiFi.softAPdisconnect()) - { - Serial.println("Could not softAPdisconnect WiFi"); + //if (!WiFi.softAPdisconnect()) + //{ + //Serial.println("Could not softAPdisconnect WiFi"); // TODO: better error handling - } + //} } }; } diff --git a/src/actions/wifisoftapdisconnectwifioffaction.h b/main/actions/wifisoftapdisconnectwifioffaction.h similarity index 55% rename from src/actions/wifisoftapdisconnectwifioffaction.h rename to main/actions/wifisoftapdisconnectwifioffaction.h index 6e3889e..1acebd4 100644 --- a/src/actions/wifisoftapdisconnectwifioffaction.h +++ b/main/actions/wifisoftapdisconnectwifioffaction.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "actioninterface.h" namespace { @@ -11,11 +8,11 @@ class WifiSoftApDisconnectWifioffAction : public virtual ActionInterface public: void triggered() override { - if (!WiFi.softAPdisconnect(true)) - { - Serial.println("Could not softAPdisconnect wifioff WiFi"); + //if (!WiFi.softAPdisconnect(true)) + //{ + //Serial.println("Could not softAPdisconnect wifioff WiFi"); // TODO: better error handling - } + //} } }; } diff --git a/src/actions/wifisoftapenableipv6action.h b/main/actions/wifisoftapenableipv6action.h similarity index 57% rename from src/actions/wifisoftapenableipv6action.h rename to main/actions/wifisoftapenableipv6action.h index 1d35b86..98bc4dc 100644 --- a/src/actions/wifisoftapenableipv6action.h +++ b/main/actions/wifisoftapenableipv6action.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include "actioninterface.h" namespace { @@ -11,11 +8,11 @@ class WifiSoftApEnableIpV6Action : public virtual ActionInterface public: void triggered() override { - if (!WiFi.softAPenableIpV6()) - { - Serial.println("Could not softAPenableIpV6 WiFi"); + //if (!WiFi.softAPenableIpV6()) + //{ + //Serial.println("Could not softAPenableIpV6 WiFi"); // TODO: better error handling - } + //} } }; } diff --git a/src/bluetoothmode.h b/main/bluetoothmode.h similarity index 100% rename from src/bluetoothmode.h rename to main/bluetoothmode.h diff --git a/src/bluetoothtexthelpers.h b/main/bluetoothtexthelpers.h similarity index 100% rename from src/bluetoothtexthelpers.h rename to main/bluetoothtexthelpers.h diff --git a/src/bmsutils.h b/main/bmsutils.h similarity index 71% rename from src/bmsutils.h rename to main/bmsutils.h index 1cc3ef7..1ff9a28 100644 --- a/src/bmsutils.h +++ b/main/bmsutils.h @@ -1,7 +1,8 @@ #pragma once +#include + #include "globals.h" -#include "types.h" namespace { #if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS) @@ -9,8 +10,8 @@ namespace bms { constexpr auto autoReconnect = false; // causes hangs when not available bool lastConnected; -millis_t lastSend; -millis_t lastReceive; +espchrono::millis_clock::time_point lastSend; +espchrono::millis_clock::time_point lastReceive; float voltage; float current; @@ -32,13 +33,15 @@ bool send6Bit(int zhen_tou, int address, int data) const auto sent = bluetoothSerial.write(buffer, 6); if (sent != 6) - Serial.printf("send: %u\r\n", sent); + { + //Serial.printf("send: %u\r\n", sent); + } return sent == 6; } void update() { - const auto now = millis(); + const auto now = espchrono::millis_clock::now(); if (bluetoothSerial.hasClient() != lastConnected) { @@ -54,11 +57,13 @@ void update() const auto read = bluetoothSerial.readBytes(buffer, 140); if (read != 140) { - Serial.printf("bms read buffer too short %u\r\n", read); + //Serial.printf("bms read buffer too short %u\r\n", read); for (int i = 0; i < read; i++) - Serial.printf("%i ", buffer[i]); - Serial.println(); + { + //Serial.printf("%i ", buffer[i]); + } + //Serial.println(); goto after_read; } @@ -68,11 +73,13 @@ void update() buffer[2] != 170 || buffer[3] != 255) { - Serial.println("bms read buffer wrong sequence"); + //Serial.println("bms read buffer wrong sequence"); for (const auto &x : buffer) - Serial.printf("%i ", x); - Serial.println(); + { + //Serial.printf("%i ", x); + } + //Serial.println(); goto after_read; } @@ -91,19 +98,23 @@ void update() } // else if (bluetoothSerial.available()) // { -// Serial.printf("available() = %i\r\n", bluetoothSerial.available()); +// //Serial.printf("available() = %i\r\n", bluetoothSerial.available()); // while (bluetoothSerial.available()) -// Serial.printf("%i ", bluetoothSerial.read()); -// Serial.println(); +// { +// //Serial.printf("%i ", bluetoothSerial.read()); +// } +// //Serial.println(); // } after_read: if (!lastSend || now-lastSend >= 1000) { - Serial.println("requresting bms live values"); + //Serial.println("requresting bms live values"); if (!send6Bit(56283, 0, 0)) - Serial.println("could not request bms live values"); + { + //Serial.println("could not request bms live values"); + } lastSend = now; } } @@ -112,9 +123,9 @@ void update() if (!lastSend || now-lastSend >= 500) { uint8_t remoteAddress[ESP_BD_ADDR_LEN] = {0xAA, 0xBB, 0xCC, 0xA1, 0x23, 0x45}; - Serial.println("connect()"); + //Serial.println("connect()"); const auto result = bluetoothSerial.connect(remoteAddress); - Serial.printf("connect() returned %s\r\n", result?"true":"false"); + //Serial.printf("connect() returned %s\r\n", result?"true":"false"); lastSend = now; } diff --git a/src/bobby_webserver.h b/main/bobby_webserver.h similarity index 97% rename from src/bobby_webserver.h rename to main/bobby_webserver.h index b3aba7c..d169fcf 100644 --- a/src/bobby_webserver.h +++ b/main/bobby_webserver.h @@ -1,7 +1,9 @@ #pragma once // 3rdparty lib includes +#ifdef FEATURE_WEBSERVER #include +#endif // local includes #include "screens.h" @@ -268,11 +270,11 @@ void initWebserver() return [size, command](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final){ //ESP_UNUSED(request) - Serial.printf("callback %u %u\r\n", index, len); + //Serial.printf("callback %u %u\r\n", index, len); if (!index) { - Serial.printf("Update Start: %s\r\n", filename.c_str()); + //Serial.printf("Update Start: %s\r\n", filename.c_str()); //Update.runAsync(true); if (!Update.begin(size, command)) Update.printError(Serial); @@ -316,7 +318,7 @@ void initWebserver() { if (Update.end(true)) { - Serial.printf("Update Success: %uB\r\n", index + len); + //Serial.printf("Update Success: %uB\r\n", index + len); ((UpdateDisplay*)currentDisplay.get())->m_finished = true; ((UpdateDisplay*)currentDisplay.get())->redraw(); diff --git a/src/buttons.h b/main/buttons.h similarity index 73% rename from src/buttons.h rename to main/buttons.h index 4e340e3..fd2b3ca 100644 --- a/src/buttons.h +++ b/main/buttons.h @@ -3,8 +3,9 @@ // Arduino includes #include +#include + // local includes -#include "types.h" #include "settingsutils.h" namespace { @@ -27,9 +28,9 @@ public: static void confirmButton(bool pressed) { - static millis_t pressBegin = 0; + static espchrono::millis_clock::time_point pressBegin{}; - const auto now = millis(); + const auto now = espchrono::millis_clock::now(); if (pressed) pressBegin = now; @@ -37,22 +38,22 @@ public: { const auto duration = now - pressBegin; - if (duration < 500) + if (duration < 500ms) confirmButtonPressed = true; - else if (duration < 2000) + else if (duration < 2000ms) confirmButtonLongPressed = true; else requestFullRedraw = true; - pressBegin = 0; + pressBegin = {}; } } static void backButton(bool pressed) { - static millis_t pressBegin = 0; + static espchrono::millis_clock::time_point pressBegin{}; - const auto now = millis(); + const auto now = espchrono::millis_clock::now(); if (pressed) pressBegin = now; @@ -60,12 +61,12 @@ public: { const auto duration = now - pressBegin; - if (duration < 500) + if (duration < 500ms) backButtonPressed = true; else backButtonLongPressed = true; - pressBegin = 0; + pressBegin = {}; } } diff --git a/src/can.h b/main/can.h similarity index 85% rename from src/can.h rename to main/can.h index dd1513f..c3fd59c 100644 --- a/src/can.h +++ b/main/can.h @@ -4,20 +4,21 @@ #include #include -#include +#include #include -#include "bobbycar-protocol/bobbycar-can.h" +#include + +#include "bobbycar-can.h" -#include "types.h" #include "globals.h" #include "buttons.h" namespace can { namespace { std::optional can_gas, can_brems; -millis_t last_can_gas{}, last_can_brems{}; +espchrono::millis_clock::time_point last_can_gas{}, last_can_brems{}; struct CanButtonsState { @@ -34,11 +35,11 @@ CanButtonsState lastButtonsState; void initCan() { - Serial.println("initCan()"); + //Serial.println("initCan()"); - can_general_config_t g_config = CAN_GENERAL_CONFIG_DEFAULT(GPIO_NUM_21, GPIO_NUM_22, CAN_MODE_NORMAL); - can_timing_config_t t_config CAN_TIMING_CONFIG_250KBITS(); - can_filter_config_t f_config CAN_FILTER_CONFIG_ACCEPT_ALL(); + twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(GPIO_NUM_21, GPIO_NUM_22, TWAI_MODE_NORMAL); + twai_timing_config_t t_config TWAI_TIMING_CONFIG_250KBITS(); + twai_filter_config_t f_config TWAI_FILTER_CONFIG_ACCEPT_ALL(); // { // // // .acceptance_code = 0b00000000000, @@ -46,31 +47,31 @@ void initCan() // .single_filter = true // }; - if (const auto result = can_driver_install(&g_config, &t_config, &f_config); result == ESP_OK) + if (const auto result = twai_driver_install(&g_config, &t_config, &f_config); result == ESP_OK) { - Serial.printf("CAN info can_driver_install() succeeded\r\n"); + //Serial.printf("CAN info twai_driver_install() succeeded\r\n"); } else { - Serial.printf("CAN err can_driver_install() failed with %s\r\n", esp_err_to_name(result)); + //Serial.printf("CAN err twai_driver_install() failed with %s\r\n", esp_err_to_name(result)); return; } - if (const auto result = can_start(); result == ESP_OK) + if (const auto result = twai_start(); result == ESP_OK) { - Serial.printf("CAN info can_start() succeeded\r\n"); + //Serial.printf("CAN info twai_start() succeeded\r\n"); } else { - Serial.printf("CAN err can_start() failed with %s\r\n", esp_err_to_name(result)); + //Serial.printf("CAN err twai_start() failed with %s\r\n", esp_err_to_name(result)); - if (const auto result = can_driver_uninstall(); result == ESP_OK) + if (const auto result = twai_driver_uninstall(); result == ESP_OK) { - Serial.printf("CAN info can_driver_uninstall() succeeded\r\n"); + //Serial.printf("CAN info twai_driver_uninstall() succeeded\r\n"); } else { - Serial.printf("CAN err can_driver_uninstall() failed with %s\r\n", esp_err_to_name(result)); + //Serial.printf("CAN err twai_driver_uninstall() failed with %s\r\n", esp_err_to_name(result)); } return; @@ -78,7 +79,7 @@ void initCan() } template -bool parseMotorControllerCanMessage(const can_message_t &message, Controller &controller) +bool parseMotorControllerCanMessage(const twai_message_t &message, Controller &controller) { switch (message.identifier) { @@ -154,7 +155,7 @@ bool parseMotorControllerCanMessage(const can_message_t &message, Controller &co return false; } -bool parseBoardcomputerCanMessage(const can_message_t &message) +bool parseBoardcomputerCanMessage(const twai_message_t &message) { switch (message.identifier) { @@ -204,11 +205,11 @@ bool parseBoardcomputerCanMessage(const can_message_t &message) } case Boardcomputer::Command::RawGas: can_gas = *((int16_t*)message.data); - last_can_gas = millis(); + last_can_gas = espchrono::millis_clock::now(); break; case Boardcomputer::Command::RawBrems: can_brems = *((int16_t*)message.data); - last_can_brems = millis(); + last_can_brems = espchrono::millis_clock::now(); break; } @@ -217,18 +218,20 @@ bool parseBoardcomputerCanMessage(const can_message_t &message) bool tryParseCanInput() { - can_message_t message; - if (const auto result = can_receive(&message, pdMS_TO_TICKS(50)); result != ESP_OK) + twai_message_t message; + if (const auto result = twai_receive(&message, pdMS_TO_TICKS(50)); result != ESP_OK) { - if (millis() - controllers.front.lastCanFeedback > 100) + if (result != ESP_ERR_TIMEOUT) + { + //Serial.printf("CAN err twai_receive() failed with %s\r\n", esp_err_to_name(result)); + } + + if (espchrono::millis_clock::now() - controllers.front.lastCanFeedback > 100ms) controllers.front.feedbackValid = false; - if (millis() - controllers.back.lastCanFeedback > 100) + if (espchrono::millis_clock::now() - controllers.back.lastCanFeedback > 100ms) controllers.back.feedbackValid = false; - if (result != ESP_ERR_TIMEOUT) - Serial.printf("CAN err can_receive() failed with %s\r\n", esp_err_to_name(result)); - return false; } @@ -237,28 +240,28 @@ bool tryParseCanInput() if (parseMotorControllerCanMessage(message, front)) { - if (millis() - back.lastCanFeedback > 100) + if (espchrono::millis_clock::now() - back.lastCanFeedback > 100ms) back.feedbackValid = false; - front.lastCanFeedback = millis(); + front.lastCanFeedback = espchrono::millis_clock::now(); front.feedbackValid = true; return true; } else { - if (millis() - front.lastCanFeedback > 100) + if (espchrono::millis_clock::now() - front.lastCanFeedback > 100ms) front.feedbackValid = false; } if (parseMotorControllerCanMessage(message, back)) { - back.lastCanFeedback = millis(); + back.lastCanFeedback = espchrono::millis_clock::now(); back.feedbackValid = true; return true; } else { - if (millis() - back.lastCanFeedback > 100) + if (espchrono::millis_clock::now() - back.lastCanFeedback > 100ms) back.feedbackValid = false; } @@ -280,16 +283,18 @@ void parseCanInput() void sendCanCommands() { constexpr auto send = [](uint32_t addr, auto value){ - can_message_t message; + twai_message_t message; message.identifier = addr; - message.flags = CAN_MSG_FLAG_SS; + message.flags = TWAI_MSG_FLAG_SS; message.data_length_code = sizeof(value); std::fill(std::begin(message.data), std::end(message.data), 0); std::memcpy(message.data, &value, sizeof(value)); - const auto result = can_transmit(&message, pdMS_TO_TICKS(200)); + const auto result = twai_transmit(&message, pdMS_TO_TICKS(200)); if (result != ESP_OK && result != ESP_ERR_TIMEOUT) - Serial.printf("ERROR: can_transmit() failed with %s\r\n", esp_err_to_name(result)); + { + //Serial.printf("ERROR: twai_transmit() failed with %s\r\n", esp_err_to_name(result)); + } return result; }; @@ -412,6 +417,7 @@ void sendCanCommands() case 10: if (send(Boardcomputer::Feedback::ButtonLeds, buttonLeds) == ESP_OK) lastValues.buttonLeds = buttonLeds; + [[fallthrough]] default: i=0; break; diff --git a/src/changevaluedisplay.h b/main/changevaluedisplay.h similarity index 100% rename from src/changevaluedisplay.h rename to main/changevaluedisplay.h diff --git a/src/changevaluedisplay_bluetoothmode.h b/main/changevaluedisplay_bluetoothmode.h similarity index 95% rename from src/changevaluedisplay_bluetoothmode.h rename to main/changevaluedisplay_bluetoothmode.h index ac27a31..250bdcb 100644 --- a/src/changevaluedisplay_bluetoothmode.h +++ b/main/changevaluedisplay_bluetoothmode.h @@ -45,7 +45,7 @@ void ChangeValueDisplay::start() case BluetoothMode::Master: setSelectedIndex(1); break; case BluetoothMode::Slave: setSelectedIndex(2); break; default: - Serial.printf("Unknown BluetoothMode: %i\r\n", int(value)); + //Serial.printf("Unknown BluetoothMode: %i\r\n", int(value)); setSelectedIndex(4); } } diff --git a/src/changevaluedisplay_bool.h b/main/changevaluedisplay_bool.h similarity index 100% rename from src/changevaluedisplay_bool.h rename to main/changevaluedisplay_bool.h diff --git a/src/changevaluedisplay_controlmode.h b/main/changevaluedisplay_controlmode.h similarity index 96% rename from src/changevaluedisplay_controlmode.h rename to main/changevaluedisplay_controlmode.h index 3c36d3a..a053643 100644 --- a/src/changevaluedisplay_controlmode.h +++ b/main/changevaluedisplay_controlmode.h @@ -45,7 +45,7 @@ void ChangeValueDisplay::start() case ControlMode::Speed: setSelectedIndex(2); break; case ControlMode::Torque: setSelectedIndex(3); break; default: - Serial.printf("Unknown ControlMode: %i\r\n", int(value)); + //Serial.printf("Unknown ControlMode: %i\r\n", int(value)); setSelectedIndex(4); } } diff --git a/src/changevaluedisplay_controltype.h b/main/changevaluedisplay_controltype.h similarity index 96% rename from src/changevaluedisplay_controltype.h rename to main/changevaluedisplay_controltype.h index f90cb46..837b429 100644 --- a/src/changevaluedisplay_controltype.h +++ b/main/changevaluedisplay_controltype.h @@ -43,7 +43,7 @@ void ChangeValueDisplay::start() case ControlType::Sinusoidal: setSelectedIndex(1); break; case ControlType::FieldOrientedControl: setSelectedIndex(2); break; default: - Serial.printf("Unknown ControlType: %i\r\n", int(value)); + //Serial.printf("Unknown ControlType: %i\r\n", int(value)); setSelectedIndex(3); } } diff --git a/src/changevaluedisplay_larsmmode_mode.h b/main/changevaluedisplay_larsmmode_mode.h similarity index 96% rename from src/changevaluedisplay_larsmmode_mode.h rename to main/changevaluedisplay_larsmmode_mode.h index 8a0dfd8..1b9ddc0 100644 --- a/src/changevaluedisplay_larsmmode_mode.h +++ b/main/changevaluedisplay_larsmmode_mode.h @@ -44,7 +44,7 @@ void ChangeValueDisplay::start() case LarsmModeMode::Mode3: setSelectedIndex(2); break; case LarsmModeMode::Mode4: setSelectedIndex(3); break; default: - Serial.printf("Unknown LarsmModeMode: %i\r\n", int(value)); + //Serial.printf("Unknown LarsmModeMode: %i\r\n", int(value)); setSelectedIndex(4); } } diff --git a/src/changevaluedisplay_unifiedmodelmode.h b/main/changevaluedisplay_unifiedmodelmode.h similarity index 96% rename from src/changevaluedisplay_unifiedmodelmode.h rename to main/changevaluedisplay_unifiedmodelmode.h index af82f50..cf08511 100644 --- a/src/changevaluedisplay_unifiedmodelmode.h +++ b/main/changevaluedisplay_unifiedmodelmode.h @@ -46,7 +46,7 @@ void ChangeValueDisplay::start() case UnifiedModelMode::FocSpeed: setSelectedIndex(3); break; case UnifiedModelMode::FocTorque: setSelectedIndex(4); break; default: - Serial.printf("Unknown UnifiedModelMode: %i\r\n", int(value)); + //Serial.printf("Unknown UnifiedModelMode: %i\r\n", int(value)); setSelectedIndex(5); } } diff --git a/src/changevaluedisplay_wifi_mode_t.h b/main/changevaluedisplay_wifi_mode_t.h similarity index 96% rename from src/changevaluedisplay_wifi_mode_t.h rename to main/changevaluedisplay_wifi_mode_t.h index 4d396d6..76731d6 100644 --- a/src/changevaluedisplay_wifi_mode_t.h +++ b/main/changevaluedisplay_wifi_mode_t.h @@ -45,7 +45,7 @@ void ChangeValueDisplay::start() case WIFI_MODE_AP: setSelectedIndex(2); break; case WIFI_MODE_APSTA: setSelectedIndex(3); break; default: - Serial.printf("Unknown wifi_mode_t: %i\r\n", int(value)); + //Serial.printf("Unknown wifi_mode_t: %i\r\n", int(value)); setSelectedIndex(4); } } diff --git a/main/changevaluedisplay_wifi_power_t.h b/main/changevaluedisplay_wifi_power_t.h new file mode 100644 index 0000000..8dca1c1 --- /dev/null +++ b/main/changevaluedisplay_wifi_power_t.h @@ -0,0 +1,66 @@ +#pragma once + +#include "changevaluedisplay.h" +#include "menudisplay.h" +#include "utils.h" +#include "actions/setvalueaction.h" +#include "actions/backproxyaction.h" +#include "icons/back.h" +#include "texts.h" + +namespace { +//template<> +//class ChangeValueDisplay : +// public MenuDisplay, +// public virtual AccessorInterface, +// public virtual ActionInterface +//{ +// using Base = MenuDisplay; + +//public: +// ChangeValueDisplay(); + +// void start() override; +//}; + +//ChangeValueDisplay::ChangeValueDisplay() +//{ +// constructMenuItem, StaticText>>(WIFI_POWER_19_5dBm, *this, *this); +// constructMenuItem, StaticText>>(WIFI_POWER_19dBm, *this, *this); +// constructMenuItem, StaticText>>(WIFI_POWER_18_5dBm, *this, *this); +// constructMenuItem, StaticText>>(WIFI_POWER_17dBm, *this, *this); +// constructMenuItem, StaticText>>(WIFI_POWER_15dBm, *this, *this); +// constructMenuItem, StaticText>>(WIFI_POWER_13dBm, *this, *this); +// constructMenuItem, StaticText>>(WIFI_POWER_11dBm, *this, *this); +// constructMenuItem, StaticText>>(WIFI_POWER_8_5dBm, *this, *this); +// constructMenuItem, StaticText>>(WIFI_POWER_7dBm, *this, *this); +// constructMenuItem, StaticText>>(WIFI_POWER_5dBm, *this, *this); +// constructMenuItem, StaticText>>(WIFI_POWER_2dBm, *this, *this); +// constructMenuItem, StaticText>>(WIFI_POWER_MINUS_1dBm, *this, *this); +// constructMenuItem, StaticMenuItemIcon<&icons::back>>>(*this); +//} + +//void ChangeValueDisplay::start() +//{ +// Base::start(); + +// switch (const auto value = getValue()) +// { +// case WIFI_POWER_19_5dBm: setSelectedIndex(0); break; +// case WIFI_POWER_19dBm: setSelectedIndex(1); break; +// case WIFI_POWER_18_5dBm: setSelectedIndex(2); break; +// case WIFI_POWER_17dBm: setSelectedIndex(3); break; +// case WIFI_POWER_15dBm: setSelectedIndex(4); break; +// case WIFI_POWER_13dBm: setSelectedIndex(5); break; +// case WIFI_POWER_11dBm: setSelectedIndex(6); break; +// case WIFI_POWER_8_5dBm: setSelectedIndex(7); break; +// case WIFI_POWER_7dBm: setSelectedIndex(8); break; +// case WIFI_POWER_5dBm: setSelectedIndex(9); break; +// case WIFI_POWER_2dBm: setSelectedIndex(10); break; +// case WIFI_POWER_MINUS_1dBm: setSelectedIndex(11); break; +// default: +// //Serial.printf("Unknown wifi_power_t: %i\r\n", int(value)); +// setSelectedIndex(12); +// } +//} +} diff --git a/src/checkboxicon.h b/main/checkboxicon.h similarity index 100% rename from src/checkboxicon.h rename to main/checkboxicon.h diff --git a/main/cloud.h b/main/cloud.h new file mode 100644 index 0000000..aea3a39 --- /dev/null +++ b/main/cloud.h @@ -0,0 +1,106 @@ +#pragma once + +// esp-idf includes +#ifdef FEATURE_CLOUD +#include +#include +#include +#endif + +namespace { +#ifdef FEATURE_CLOUD +void cloudTask(void*) +{ + const esp_websocket_client_config_t config = { + .uri = "ws://iot.wattpilot.io:8080/charger/bobbycar1", + }; + esp_websocket_client_handle_t handle = esp_websocket_client_init(&config); + + if (handle) + { + //Serial.println("esp websocket init succeeded"); + + if (const auto result = esp_websocket_client_start(handle); result == ESP_OK) + { + //Serial.println("esp websocket start succeeded"); + + while (true) + { + if (esp_websocket_client_is_connected(handle)) + { + std::string msg = "{" + "\"type\": \"fullStatus\"," + "\"partial\": false, " + "\"status\": {" + "\"millis\":" + std::to_string(std::chrono::milliseconds{espchrono::millis_clock::now().time_since_epoch()}.count()) + "," + "\"front.valid\":" + std::to_string(controllers.front.feedbackValid) + "," + "\"back.valid\":" + std::to_string(controllers.back.feedbackValid) + "," + "\"front.left.pwm\":" + std::to_string(controllers.front.command.left.pwm) + "," + "\"front.right.pwm\":" + std::to_string(controllers.front.command.right.pwm) + "," + "\"back.left.pwm\":" + std::to_string(controllers.back.command.left.pwm) + "," + "\"back.right.pwm\":" + std::to_string(controllers.back.command.right.pwm) + "," + "\"front.volt\":" + std::to_string(controllers.front.feedback.batVoltage) + "," + "\"back.volt\":" + std::to_string(controllers.back.feedback.batVoltage) + "," + "\"front.temp\":" + std::to_string(controllers.front.feedback.boardTemp) + "," + "\"back.temp\":" + std::to_string(controllers.back.feedback.boardTemp) + "," + "\"front.bad\":" + std::to_string(controllers.front.feedback.timeoutCntSerial) + "," + "\"back.bad\":" + std::to_string(controllers.back.feedback.timeoutCntSerial) + "," + "\"front.left.speed\":" + std::to_string(controllers.front.feedback.left.speed) + "," + "\"front.right.speed\":" + std::to_string(controllers.front.feedback.right.speed) + "," + "\"back.left.speed\":" + std::to_string(controllers.back.feedback.left.speed) + "," + "\"back.right.speed\":" + std::to_string(controllers.back.feedback.right.speed) + "," + "\"front.left.current\":" + std::to_string(controllers.front.feedback.left.dcLink) + "," + "\"front.right.current\":" + std::to_string(controllers.front.feedback.right.dcLink) + "," + "\"back.left.current\":" + std::to_string(controllers.back.feedback.left.dcLink) + "," + "\"back.right.current\":" + std::to_string(controllers.back.feedback.right.dcLink) + "," + "\"front.left.error\":" + std::to_string(controllers.front.feedback.left.error) + "," + "\"front.right.error\":" + std::to_string(controllers.front.feedback.right.error) + "," + "\"back.left.error\":" + std::to_string(controllers.back.feedback.left.error) + "," + "\"back.right.error\":" + std::to_string(controllers.back.feedback.right.error) + + "}" + "}"; + + const auto sent = esp_websocket_client_send_text(handle, msg.c_str(), msg.length(), 1000 / portTICK_PERIOD_MS); + if (sent == msg.length()) + { + //Serial.println("Sent cloud message"); + } + else + { + //Serial.printf("sent=%i, msgsize=%i\r\n", sent, msg.length()); + } + } + else + { + //Serial.println("Not sending cloud because not connected"); + } + + delay(100); + } + } + else + { + //Serial.printf("esp websocket start failed with %s\r\n", esp_err_to_name(result)); + } + } + else + { + //Serial.println("esp websocket init failed"); + } + + vTaskDelete(NULL); +} + +void startCloud() +{ + if (const auto result = xTaskCreatePinnedToCore(cloudTask, "cloudTask", 4096, nullptr, 10, nullptr, 1); result == pdTRUE) + { + //Serial.println("cloud task create succeeded"); + } + else + { + //Serial.printf("cloud task create failed\r\n"); + } +} +#endif +} // namespace diff --git a/src/colorinterface.h b/main/colorinterface.h similarity index 100% rename from src/colorinterface.h rename to main/colorinterface.h diff --git a/src/controller.h b/main/controller.h similarity index 77% rename from src/controller.h rename to main/controller.h index a177977..ca2772a 100644 --- a/src/controller.h +++ b/main/controller.h @@ -1,16 +1,24 @@ #pragma once +// system includes #include -#include "bobbycar-protocol/bobbycar-common.h" -#include "bobbycar-protocol/bobbycar-serial.h" +// Arduino includes +#ifdef FEATURE_SERIAL +#include +#endif -#include "types.h" +// 3rdparty lib includes +#include +// local includes +#include "bobbycar-common.h" +#include "bobbycar-serial.h" #ifdef FEATURE_SERIAL #include "feedbackparser.h" #endif +// forward declares #ifdef FEATURE_SERIAL class HardwareSerial; #endif @@ -39,7 +47,7 @@ struct Controller { bobbycar::protocol::serial::Command command{}; #ifdef FEATURE_CAN - millis_t lastCanFeedback{}; + espchrono::millis_clock::time_point lastCanFeedback{}; #endif bool feedbackValid{}; bobbycar::protocol::serial::Feedback feedback{}; diff --git a/src/debugcolorhelpers.h b/main/debugcolorhelpers.h similarity index 100% rename from src/debugcolorhelpers.h rename to main/debugcolorhelpers.h diff --git a/src/debugtexthelpers.h b/main/debugtexthelpers.h similarity index 87% rename from src/debugtexthelpers.h rename to main/debugtexthelpers.h index dfe144e..7a78041 100644 --- a/src/debugtexthelpers.h +++ b/main/debugtexthelpers.h @@ -1,5 +1,9 @@ #pragma once +// 3rdparty lib includes +#include + +// local includes #include "textinterface.h" #include "globals.h" #include "utils.h" @@ -42,9 +46,9 @@ public: using RightCommand = CommandTexts; struct BatVoltageText : public virtual TextInterface { public: std::string text() const override { std::string line{"batVoltage: "}; if (controller::get().feedbackValid) line += std::to_string(controller::get().feedback.batVoltage); return line; } }; - struct BatVoltageFixedText : public virtual TextInterface { public: std::string text() const override { std::string line{"batVoltage: "}; if (controller::get().feedbackValid) line += std::to_string(fixBatVoltage(controller::get().feedback.batVoltage)) + 'V'; return line; } }; + struct BatVoltageFixedText : public virtual TextInterface { public: std::string text() const override { std::string line{"batVoltage: "}; if (controller::get().feedbackValid) line += fmt::format("{:.2f}V", fixBatVoltage(controller::get().feedback.batVoltage)); return line; } }; struct BoardTempText : public virtual TextInterface { public: std::string text() const override { std::string line{"boardTemp: "}; if (controller::get().feedbackValid) line += std::to_string(controller::get().feedback.boardTemp); return line; } }; - struct BoardTempFixedText : public virtual TextInterface { public: std::string text() const override { std::string line{"boardTemp: "}; if (controller::get().feedbackValid) line += std::to_string(fixBoardTemp(controller::get().feedback.boardTemp)) + 'C'; return line; } }; + struct BoardTempFixedText : public virtual TextInterface { public: std::string text() const override { std::string line{"boardTemp: "}; if (controller::get().feedbackValid) line += fmt::format("{:.2f}C", fixBoardTemp(controller::get().feedback.boardTemp)); return line; } }; struct TimeoutCntSerialText : public virtual TextInterface { public: std::string text() const override { std::string line{"timeoutCntSerial: "}; if (controller::get().feedbackValid) line += std::to_string(controller::get().feedback.timeoutCntSerial); return line; } }; private: @@ -59,16 +63,16 @@ private: struct AngleText : public virtual TextInterface { public: std::string text() const override { std::string line{"angle: "}; if (controller::get().feedbackValid) line += std::to_string(MotorFeedbackGetter::get().angle); return line; } }; struct SpeedText : public virtual TextInterface { public: std::string text() const override { std::string line{"speed: "}; if (controller::get().feedbackValid) line += std::to_string(MotorFeedbackGetter::get().speed); return line; } }; - struct SpeedKmhText : public virtual TextInterface { public: std::string text() const override { std::string line{"speed kmh: "}; if (controller::get().feedbackValid) line += std::to_string(convertToKmh(MotorFeedbackGetter::get().speed)); return line; } }; + struct SpeedKmhText : public virtual TextInterface { public: std::string text() const override { std::string line{"speed kmh: "}; if (controller::get().feedbackValid) line += fmt::format("{:.2f}", convertToKmh(MotorFeedbackGetter::get().speed)); return line; } }; struct ErrorText : public virtual TextInterface { public: std::string text() const override { std::string line{"error: "}; if (controller::get().feedbackValid) line += std::to_string(MotorFeedbackGetter::get().error); return line; } }; struct DcLinkText : public virtual TextInterface { public: std::string text() const override { std::string line{"dcLink: "}; if (controller::get().feedbackValid) line += std::to_string(MotorFeedbackGetter::get().dcLink); return line; } }; - struct DcLinkFixedText : public virtual TextInterface { public: std::string text() const override { std::string line{"dcLink: "}; if (controller::get().feedbackValid) line += std::to_string(fixCurrent(MotorFeedbackGetter::get().dcLink)) + 'A'; return line; } }; + struct DcLinkFixedText : public virtual TextInterface { public: std::string text() const override { std::string line{"dcLink: "}; if (controller::get().feedbackValid) line += fmt::format("{:.2f}A", fixCurrent(MotorFeedbackGetter::get().dcLink)); return line; } }; struct DcPhaAText : public virtual TextInterface { public: std::string text() const override { std::string line{"dcPhaA: "}; if (controller::get().feedbackValid) line += std::to_string(MotorFeedbackGetter::get().dcPhaA); return line; } }; - struct DcPhaAFixedText : public virtual TextInterface { public: std::string text() const override { std::string line{"dcPhaA: "}; if (controller::get().feedbackValid) line += std::to_string(fixCurrent(MotorFeedbackGetter::get().dcPhaA)) + 'A'; return line; } }; + struct DcPhaAFixedText : public virtual TextInterface { public: std::string text() const override { std::string line{"dcPhaA: "}; if (controller::get().feedbackValid) line += fmt::format("{:.2f}A", fixCurrent(MotorFeedbackGetter::get().dcPhaA)); return line; } }; struct DcPhaBText : public virtual TextInterface { public: std::string text() const override { std::string line{"dcPhaB: "}; if (controller::get().feedbackValid) line += std::to_string(MotorFeedbackGetter::get().dcPhaB); return line; } }; - struct DcPhaBFixedText : public virtual TextInterface { public: std::string text() const override { std::string line{"dcPhaB: "}; if (controller::get().feedbackValid) line += std::to_string(fixCurrent(MotorFeedbackGetter::get().dcPhaB)) + 'A'; return line; } }; + struct DcPhaBFixedText : public virtual TextInterface { public: std::string text() const override { std::string line{"dcPhaB: "}; if (controller::get().feedbackValid) line += fmt::format("{:.2f}A", fixCurrent(MotorFeedbackGetter::get().dcPhaB)); return line; } }; struct DcPhaCText : public virtual TextInterface { public: std::string text() const override { std::string line{"dcPhaC: "}; if (controller::get().feedbackValid) line += std::to_string(MotorFeedbackGetter::get().dcPhaC); return line; } }; - struct DcPhaCFixedText : public virtual TextInterface { public: std::string text() const override { std::string line{"dcPhaC: "}; if (controller::get().feedbackValid) line += std::to_string(fixCurrent(MotorFeedbackGetter::get().dcPhaC)) + 'A'; return line; } }; + struct DcPhaCFixedText : public virtual TextInterface { public: std::string text() const override { std::string line{"dcPhaC: "}; if (controller::get().feedbackValid) line += fmt::format("{:.2f}A", fixCurrent(MotorFeedbackGetter::get().dcPhaC)); return line; } }; struct ChopsText : public virtual TextInterface { public: std::string text() const override { std::string line{"chops: "}; if (controller::get().feedbackValid) line += std::to_string(MotorFeedbackGetter::get().chops); return line; } }; struct HallText : public virtual TextInterface { public: std::string text() const override { std::string line{"hall: "}; if (controller::get().feedbackValid) line += hallString(MotorFeedbackGetter::get()); return line; } }; }; diff --git a/src/display.h b/main/display.h similarity index 100% rename from src/display.h rename to main/display.h diff --git a/src/displays/bmsdisplay.h b/main/displays/bmsdisplay.h similarity index 100% rename from src/displays/bmsdisplay.h rename to main/displays/bmsdisplay.h diff --git a/src/displays/calibratedisplay.h b/main/displays/calibratedisplay.h similarity index 100% rename from src/displays/calibratedisplay.h rename to main/displays/calibratedisplay.h diff --git a/src/displays/dpad5wiredebugdisplay.h b/main/displays/dpad5wiredebugdisplay.h similarity index 100% rename from src/displays/dpad5wiredebugdisplay.h rename to main/displays/dpad5wiredebugdisplay.h diff --git a/src/displays/gameoflifedisplay.h b/main/displays/gameoflifedisplay.h similarity index 95% rename from src/displays/gameoflifedisplay.h rename to main/displays/gameoflifedisplay.h index ea37694..8b2bf94 100644 --- a/src/displays/gameoflifedisplay.h +++ b/main/displays/gameoflifedisplay.h @@ -3,9 +3,6 @@ #include #include -#include -#include - #include "display.h" #include "actions/switchscreenaction.h" @@ -50,18 +47,18 @@ private: { if (x >= GRIDX) { - Serial.printf("x: %i\r\n", x); + //Serial.printf("x: %i\r\n", x); return 0; } if (y >= GRIDY) { - Serial.printf("y: %i\r\n", x); + //Serial.printf("y: %i\r\n", x); return 0; } const auto result = (x * GRIDY) + y; if (result >= GRIDX*GRIDY) { - Serial.printf("x:%i y:%i x*y:%i\r\n", x, y, result); + //Serial.printf("x:%i y:%i x*y:%i\r\n", x, y, result); return 0; } return result; diff --git a/src/displays/gametrakcalibratedisplay.h b/main/displays/gametrakcalibratedisplay.h similarity index 100% rename from src/displays/gametrakcalibratedisplay.h rename to main/displays/gametrakcalibratedisplay.h diff --git a/src/displays/graphdisplay.h b/main/displays/graphdisplay.h similarity index 100% rename from src/displays/graphdisplay.h rename to main/displays/graphdisplay.h diff --git a/src/displays/lockscreen.h b/main/displays/lockscreen.h similarity index 100% rename from src/displays/lockscreen.h rename to main/displays/lockscreen.h diff --git a/src/displays/menus/aboutmenu.h b/main/displays/menus/aboutmenu.h similarity index 96% rename from src/displays/menus/aboutmenu.h rename to main/displays/menus/aboutmenu.h index b49f4b9..0b6f358 100644 --- a/src/displays/menus/aboutmenu.h +++ b/main/displays/menus/aboutmenu.h @@ -27,7 +27,7 @@ public: AboutMenu() { constructMenuItem, DummyAction>>(); - constructMenuItem, DummyAction>>(); + constructMenuItem>(); constructMenuItem, DummyAction>>(); constructMenuItem, DisabledColor, DummyAction>>(); constructMenuItem, DisabledColor, DummyAction>>(); diff --git a/src/displays/menus/accesspointwifisettingsmenu.h b/main/displays/menus/accesspointwifisettingsmenu.h similarity index 100% rename from src/displays/menus/accesspointwifisettingsmenu.h rename to main/displays/menus/accesspointwifisettingsmenu.h diff --git a/src/displays/menus/bluetoothsettingsmenu.h b/main/displays/menus/bluetoothsettingsmenu.h similarity index 100% rename from src/displays/menus/bluetoothsettingsmenu.h rename to main/displays/menus/bluetoothsettingsmenu.h diff --git a/src/displays/menus/bmsmenu.h b/main/displays/menus/bmsmenu.h similarity index 100% rename from src/displays/menus/bmsmenu.h rename to main/displays/menus/bmsmenu.h diff --git a/src/displays/menus/boardcomputerhardwaresettingsmenu.h b/main/displays/menus/boardcomputerhardwaresettingsmenu.h similarity index 97% rename from src/displays/menus/boardcomputerhardwaresettingsmenu.h rename to main/displays/menus/boardcomputerhardwaresettingsmenu.h index af0db44..140f1c9 100644 --- a/src/displays/menus/boardcomputerhardwaresettingsmenu.h +++ b/main/displays/menus/boardcomputerhardwaresettingsmenu.h @@ -167,7 +167,7 @@ public: constructMenuItem, SwitchScreenAction>>(); #endif #ifdef FEATURE_GAMETRAK - constructMenuItem, DummyAction>, + constructMenuItem, constructMenuItem, DummyAction>>(); constructMenuItem, DummyAction>>(); constructMenuItem, DummyAction>>(); @@ -179,7 +179,7 @@ public: constructMenuItem, SwitchScreenAction>>(); constructMenuItem, SwitchScreenAction>>(); #endif - constructMenuItem, DummyAction>>(); + constructMenuItem>(); constructMenuItem, ToggleBoolAction, CheckboxIcon, SwapScreenBytesAccessor>>(); constructMenuItem, SwitchScreenAction>>(); constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::back>>>(); diff --git a/src/displays/menus/buzzermenu.h b/main/displays/menus/buzzermenu.h similarity index 100% rename from src/displays/menus/buzzermenu.h rename to main/displays/menus/buzzermenu.h diff --git a/src/displays/menus/commanddebugmenu.h b/main/displays/menus/commanddebugmenu.h similarity index 100% rename from src/displays/menus/commanddebugmenu.h rename to main/displays/menus/commanddebugmenu.h diff --git a/src/displays/menus/controllerhardwaresettingsmenu.h b/main/displays/menus/controllerhardwaresettingsmenu.h similarity index 100% rename from src/displays/menus/controllerhardwaresettingsmenu.h rename to main/displays/menus/controllerhardwaresettingsmenu.h diff --git a/src/displays/menus/debugmenu.h b/main/displays/menus/debugmenu.h similarity index 87% rename from src/displays/menus/debugmenu.h rename to main/displays/menus/debugmenu.h index 30f9f20..91cfc4c 100644 --- a/src/displays/menus/debugmenu.h +++ b/main/displays/menus/debugmenu.h @@ -46,23 +46,23 @@ public: constructMenuItem, LoadSettingsAction>>(); constructMenuItem, SaveSettingsAction>>(); constructMenuItem, EraseNvsAction>>(); - constructMenuItem, DummyAction>>(); + constructMenuItem>(); constructMenuItem, SwitchScreenAction>>(); constructMenuItem, SwitchScreenAction>>(); - constructMenuItem, DummyAction>>(); + constructMenuItem>(); constructMenuItem, SwitchScreenAction>>(); constructMenuItem, SwitchScreenAction>>(); constructMenuItem, SwitchScreenAction>>(); constructMenuItem, SwitchScreenAction>>(); - constructMenuItem, DummyAction>>(); + constructMenuItem>(); constructMenuItem, SwitchScreenAction, FrontFeedbackColor>>(); constructMenuItem, SwitchScreenAction, BackFeedbackColor>>(); - constructMenuItem, DummyAction>>(); + constructMenuItem>(); constructMenuItem, SwitchScreenAction, FrontFeedbackColor>>(); constructMenuItem, SwitchScreenAction, FrontFeedbackColor>>(); constructMenuItem, SwitchScreenAction, BackFeedbackColor>>(); constructMenuItem, SwitchScreenAction, BackFeedbackColor>>(); - constructMenuItem, DummyAction>>(); + constructMenuItem>(); constructMenuItem, SwitchScreenAction>>(); constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::back>>>(); } diff --git a/src/displays/menus/defaultmodesettingsmenu.h b/main/displays/menus/defaultmodesettingsmenu.h similarity index 100% rename from src/displays/menus/defaultmodesettingsmenu.h rename to main/displays/menus/defaultmodesettingsmenu.h diff --git a/src/displays/menus/demosmenu.h b/main/displays/menus/demosmenu.h similarity index 100% rename from src/displays/menus/demosmenu.h rename to main/displays/menus/demosmenu.h diff --git a/src/displays/menus/dynamicdebugmenu.h b/main/displays/menus/dynamicdebugmenu.h similarity index 77% rename from src/displays/menus/dynamicdebugmenu.h rename to main/displays/menus/dynamicdebugmenu.h index dc911bf..f685324 100644 --- a/src/displays/menus/dynamicdebugmenu.h +++ b/main/displays/menus/dynamicdebugmenu.h @@ -1,8 +1,11 @@ #pragma once -// Arduino includes -#include +// system includes #include +#include + +// 3rdparty lib includes +#include // local includes #include "menudisplay.h" @@ -15,7 +18,6 @@ #include "checkboxicon.h" #include "icons/back.h" #include "texts.h" -#include "types.h" // forward declares namespace { @@ -28,18 +30,18 @@ class RandomText : public virtual TextInterface public: std::string text() const override { - const auto now = millis(); - if (!m_nextUpdate || now >= m_nextUpdate) + const auto now = espchrono::millis_clock::now(); + if (!m_nextUpdate || now >= *m_nextUpdate) { - m_title = std::string{"Dynamic text: "} + std::to_string(random(0, 100)); - m_nextUpdate = now + random(0, 1000); + m_title = "Dynamic text: " + std::to_string(random(0, 100)); + m_nextUpdate = now + std::chrono::milliseconds{random(0, 1000)}; } return m_title; } private: - mutable millis_t m_nextUpdate{}; + mutable std::optional m_nextUpdate; mutable std::string m_title; }; @@ -48,19 +50,19 @@ class RandomColor : public virtual ColorInterface public: int color() const override { - const auto now = millis(); - if (!m_nextUpdate || now >= m_nextUpdate) + const auto now = espchrono::millis_clock::now(); + if (!m_nextUpdate || now >= *m_nextUpdate) { - const auto count = std::distance(std::begin(default_4bit_palette), std::end(default_4bit_palette)); + const auto count = std::size(default_4bit_palette); m_color = default_4bit_palette[random(0, count)]; - m_nextUpdate = now + random(0, 1000); + m_nextUpdate = now + std::chrono::milliseconds{random(0, 1000)}; } return m_color; } private: - mutable millis_t m_nextUpdate{}; + mutable std::optional m_nextUpdate; mutable int m_color; }; @@ -69,18 +71,18 @@ class RandomFont : public virtual FontInterface public: int font() const override { - const auto now = millis(); - if (!m_nextUpdate || now >= m_nextUpdate) + const auto now = espchrono::millis_clock::now(); + if (!m_nextUpdate || now >= *m_nextUpdate) { m_font = random(1, 5); - m_nextUpdate = now + random(0, 1000); + m_nextUpdate = now + std::chrono::milliseconds{random(0, 1000)}; } return m_font; } private: - mutable millis_t m_nextUpdate{}; + mutable std::optional m_nextUpdate; mutable int m_font; }; @@ -89,21 +91,21 @@ class RandomIcon : public virtual MenuItemIconInterface public: const MenuItemIcon *icon() const override { - const auto now = millis(); - if (!m_nextUpdate || now >= m_nextUpdate) + const auto now = espchrono::millis_clock::now(); + if (!m_nextUpdate || now >= *m_nextUpdate) { if (m_icon) m_icon = nullptr; else m_icon = &icons::lock; - m_nextUpdate = now + random(0, 1000); + m_nextUpdate = now + std::chrono::milliseconds{random(0, 1000)}; } return m_icon; } private: - mutable millis_t m_nextUpdate{}; + mutable std::optional m_nextUpdate; mutable const Icon<24, 24> *m_icon; }; diff --git a/src/displays/menus/enablemenu.h b/main/displays/menus/enablemenu.h similarity index 100% rename from src/displays/menus/enablemenu.h rename to main/displays/menus/enablemenu.h diff --git a/src/displays/menus/feedbackdebugmenu.h b/main/displays/menus/feedbackdebugmenu.h similarity index 100% rename from src/displays/menus/feedbackdebugmenu.h rename to main/displays/menus/feedbackdebugmenu.h diff --git a/src/displays/menus/gametrakmodesettingsmenu.h b/main/displays/menus/gametrakmodesettingsmenu.h similarity index 100% rename from src/displays/menus/gametrakmodesettingsmenu.h rename to main/displays/menus/gametrakmodesettingsmenu.h diff --git a/src/displays/menus/genericwifisettingsmenu.h b/main/displays/menus/genericwifisettingsmenu.h similarity index 78% rename from src/displays/menus/genericwifisettingsmenu.h rename to main/displays/menus/genericwifisettingsmenu.h index 3ee2fc6..99901c7 100644 --- a/src/displays/menus/genericwifisettingsmenu.h +++ b/main/displays/menus/genericwifisettingsmenu.h @@ -1,8 +1,5 @@ #pragma once -// Arduino includes -#include - // local includes #include "menudisplay.h" #include "changevaluedisplay.h" @@ -31,13 +28,13 @@ using WifiModeChangeScreen = makeComponent< SwitchScreenAction >; -using WifiTxPowerChangeScreen = makeComponent< - ChangeValueDisplay, - StaticText, - WifiTxPowerAccessor, - BackActionInterface>, - SwitchScreenAction ->; +//using WifiTxPowerChangeScreen = makeComponent< +// ChangeValueDisplay, +// StaticText, +// WifiTxPowerAccessor, +// BackActionInterface>, +// SwitchScreenAction +//>; class GenericWifiSettingsMenu : public MenuDisplay, @@ -51,7 +48,7 @@ public: constructMenuItem>(); constructMenuItem, SwitchScreenAction>>(); constructMenuItem, ToggleBoolAction, CheckboxIcon, WifiSleepAccessor>>(); - constructMenuItem, SwitchScreenAction>>(); + //constructMenuItem, SwitchScreenAction>>(); constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::back>>>(); } }; diff --git a/src/displays/menus/graphsmenu.h b/main/displays/menus/graphsmenu.h similarity index 100% rename from src/displays/menus/graphsmenu.h rename to main/displays/menus/graphsmenu.h diff --git a/src/displays/menus/invertmenu.h b/main/displays/menus/invertmenu.h similarity index 100% rename from src/displays/menus/invertmenu.h rename to main/displays/menus/invertmenu.h diff --git a/src/displays/menus/larsmmodesettingsmenu.h b/main/displays/menus/larsmmodesettingsmenu.h similarity index 100% rename from src/displays/menus/larsmmodesettingsmenu.h rename to main/displays/menus/larsmmodesettingsmenu.h diff --git a/src/displays/menus/limitssettingsmenu.h b/main/displays/menus/limitssettingsmenu.h similarity index 100% rename from src/displays/menus/limitssettingsmenu.h rename to main/displays/menus/limitssettingsmenu.h diff --git a/src/displays/menus/mainmenu.h b/main/displays/menus/mainmenu.h similarity index 100% rename from src/displays/menus/mainmenu.h rename to main/displays/menus/mainmenu.h diff --git a/src/displays/menus/modessettingsmenu.h b/main/displays/menus/modessettingsmenu.h similarity index 100% rename from src/displays/menus/modessettingsmenu.h rename to main/displays/menus/modessettingsmenu.h diff --git a/src/displays/menus/mosfetsmenu.h b/main/displays/menus/mosfetsmenu.h similarity index 100% rename from src/displays/menus/mosfetsmenu.h rename to main/displays/menus/mosfetsmenu.h diff --git a/src/displays/menus/motorfeedbackdebugmenu.h b/main/displays/menus/motorfeedbackdebugmenu.h similarity index 100% rename from src/displays/menus/motorfeedbackdebugmenu.h rename to main/displays/menus/motorfeedbackdebugmenu.h diff --git a/src/displays/menus/motorstatedebugmenu.h b/main/displays/menus/motorstatedebugmenu.h similarity index 100% rename from src/displays/menus/motorstatedebugmenu.h rename to main/displays/menus/motorstatedebugmenu.h diff --git a/src/displays/menus/presetsmenu.h b/main/displays/menus/presetsmenu.h similarity index 100% rename from src/displays/menus/presetsmenu.h rename to main/displays/menus/presetsmenu.h diff --git a/src/displays/menus/profilesmenu.h b/main/displays/menus/profilesmenu.h similarity index 100% rename from src/displays/menus/profilesmenu.h rename to main/displays/menus/profilesmenu.h diff --git a/src/displays/menus/selectmodemenu.h b/main/displays/menus/selectmodemenu.h similarity index 96% rename from src/displays/menus/selectmodemenu.h rename to main/displays/menus/selectmodemenu.h index 9ef6771..0330580 100644 --- a/src/displays/menus/selectmodemenu.h +++ b/main/displays/menus/selectmodemenu.h @@ -67,7 +67,7 @@ void SelectModeMenu::start() setSelectedIndex(2); else { - Serial.printf("Unknown mode: %s", currentMode?currentMode->displayName():""); + //Serial.printf("Unknown mode: %s", currentMode?currentMode->displayName():""); setSelectedIndex(3); } } diff --git a/src/displays/menus/settingsmenu.h b/main/displays/menus/settingsmenu.h similarity index 98% rename from src/displays/menus/settingsmenu.h rename to main/displays/menus/settingsmenu.h index f1623a5..e96ba89 100644 --- a/src/displays/menus/settingsmenu.h +++ b/main/displays/menus/settingsmenu.h @@ -1,8 +1,5 @@ #pragma once -// Arduino includes -#include - // local includes #include "menudisplay.h" #include "utils.h" diff --git a/src/displays/menus/stationwifisettingsmenu.h b/main/displays/menus/stationwifisettingsmenu.h similarity index 98% rename from src/displays/menus/stationwifisettingsmenu.h rename to main/displays/menus/stationwifisettingsmenu.h index c060d26..327b4a4 100644 --- a/src/displays/menus/stationwifisettingsmenu.h +++ b/main/displays/menus/stationwifisettingsmenu.h @@ -1,8 +1,5 @@ #pragma once -// Arduino includes -#include - // local includes #include "menudisplay.h" #include "utils.h" diff --git a/src/displays/menus/tempomatmodesettingsmenu.h b/main/displays/menus/tempomatmodesettingsmenu.h similarity index 100% rename from src/displays/menus/tempomatmodesettingsmenu.h rename to main/displays/menus/tempomatmodesettingsmenu.h diff --git a/src/displays/menus/timersmenu.h b/main/displays/menus/timersmenu.h similarity index 100% rename from src/displays/menus/timersmenu.h rename to main/displays/menus/timersmenu.h diff --git a/main/displays/menus/wifiscanmenu.h b/main/displays/menus/wifiscanmenu.h new file mode 100644 index 0000000..989006c --- /dev/null +++ b/main/displays/menus/wifiscanmenu.h @@ -0,0 +1,121 @@ +#pragma once + +#include + +// local includes +#include "menudisplay.h" +#include "utils.h" +#include "actions/multiaction.h" +#include "actions/switchscreenaction.h" +#include "actions/dummyaction.h" +#include "icons/back.h" +#include "texts.h" + +// forward declares +namespace { +class WifiSettingsMenu; +} // namespace + +namespace { +class WifiScanMenu : public MenuDisplay, public BackActionInterface> +{ + using Base = MenuDisplay; + +public: + WifiScanMenu(); + + std::string text() const override; + + void start() override; + void update() override; + void stop() override; + +private: + espchrono::millis_clock::time_point m_lastScanComplete; + + std::vector>> m_reusableItems; +}; + +WifiScanMenu::WifiScanMenu() +{ + constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::back>>>(); +} + +std::string WifiScanMenu::text() const +{ + auto text = std::to_string(menuItemCount()-1) + " found"; + //switch (WiFi.scanComplete()) + //{ + //case WIFI_SCAN_RUNNING: text += " (scanning)"; break; + //case WIFI_SCAN_FAILED: text += " (error)"; break; + //} + text += " (not implemented)"; + return text; +} + +void WifiScanMenu::start() +{ + Base::start(); + + m_lastScanComplete = {}; + + //WiFi.scanNetworks(true); +} + +void WifiScanMenu::update() +{ + //const auto n = WiFi.scanComplete(); + //if (n >= 0) + //{ + // const auto now = espchrono::millis_clock::now(); + // if (!m_lastScanComplete) + // { + // auto backButton = takeLastMenuItem(); + // + // for (std::size_t i = 0; i < n; i++) + // { + // const auto ssid = to_string(WiFi.SSID(i)); + // if (menuItemCount() <= i) + // { + // if (m_reusableItems.empty()) + // { + // auto &item = constructMenuItem>(); + // item.setTitle(ssid); + // } + // else + // { + // std::unique_ptr> ptr = std::move(m_reusableItems.back()); + // m_reusableItems.pop_back(); + // ptr->setTitle(ssid); + // emplaceMenuItem(std::move(ptr)); + // } + // } + // else + // { + // auto &item = *(makeComponent*)(&getMenuItem(i)); + // item.setTitle(ssid); + // } + // } + // + // while (menuItemCount() > n) + // m_reusableItems.emplace_back((makeComponent*)takeLastMenuItem().release()); + // + // emplaceMenuItem(std::move(backButton)); + // + // m_lastScanComplete = now; + // } + // else if (now - m_lastScanComplete >= 2000) + // { + // m_lastScanComplete = 0; + // WiFi.scanNetworks(true); + // } + //} + + Base::update(); +} + +void WifiScanMenu::stop() +{ + //WiFi.scanDelete(); +} +} // namespace diff --git a/src/displays/menus/wifisettingsmenu.h b/main/displays/menus/wifisettingsmenu.h similarity index 100% rename from src/displays/menus/wifisettingsmenu.h rename to main/displays/menus/wifisettingsmenu.h diff --git a/src/displays/metersdisplay.h b/main/displays/metersdisplay.h similarity index 100% rename from src/displays/metersdisplay.h rename to main/displays/metersdisplay.h diff --git a/src/displays/pingpongdisplay.h b/main/displays/pingpongdisplay.h similarity index 99% rename from src/displays/pingpongdisplay.h rename to main/displays/pingpongdisplay.h index da377f2..b82306e 100644 --- a/src/displays/pingpongdisplay.h +++ b/main/displays/pingpongdisplay.h @@ -2,9 +2,6 @@ #include -#include -#include - #include "display.h" #include "actions/switchscreenaction.h" diff --git a/src/displays/poweroffdisplay.h b/main/displays/poweroffdisplay.h similarity index 82% rename from src/displays/poweroffdisplay.h rename to main/displays/poweroffdisplay.h index 759f1ad..97acc22 100644 --- a/src/displays/poweroffdisplay.h +++ b/main/displays/poweroffdisplay.h @@ -1,7 +1,9 @@ #pragma once -#include +// 3rdparty lib includes +#include +// local includes #include "display.h" #include "utils.h" #include "globals.h" @@ -22,12 +24,12 @@ public: void stop() override; private: - unsigned int m_startTime{}; + espchrono::millis_clock::time_point m_startTime; }; void PoweroffDisplay::start() { - m_startTime = millis(); + m_startTime = espchrono::millis_clock::now(); for (Controller &controller : controllers) controller.command.poweroff = true; @@ -50,7 +52,7 @@ void PoweroffDisplay::initScreen() void PoweroffDisplay::update() { - if (millis() - m_startTime >= 1000) + if (espchrono::millis_clock::now() - m_startTime >= 1000ms) switchScreen(); } diff --git a/src/displays/powersupplydisplay.h b/main/displays/powersupplydisplay.h similarity index 100% rename from src/displays/powersupplydisplay.h rename to main/displays/powersupplydisplay.h diff --git a/src/displays/spirodisplay.h b/main/displays/spirodisplay.h similarity index 98% rename from src/displays/spirodisplay.h rename to main/displays/spirodisplay.h index 96a9a31..6105622 100644 --- a/src/displays/spirodisplay.h +++ b/main/displays/spirodisplay.h @@ -2,9 +2,6 @@ #include -#include -#include - #include "display.h" #include "actions/switchscreenaction.h" diff --git a/src/displays/splitgraphdisplay.h b/main/displays/splitgraphdisplay.h similarity index 100% rename from src/displays/splitgraphdisplay.h rename to main/displays/splitgraphdisplay.h diff --git a/src/displays/starfielddisplay.h b/main/displays/starfielddisplay.h similarity index 100% rename from src/displays/starfielddisplay.h rename to main/displays/starfielddisplay.h diff --git a/src/displays/statusdisplay.h b/main/displays/statusdisplay.h similarity index 91% rename from src/displays/statusdisplay.h rename to main/displays/statusdisplay.h index a2dd0d6..887ae5d 100644 --- a/src/displays/statusdisplay.h +++ b/main/displays/statusdisplay.h @@ -1,11 +1,11 @@ #pragma once -#include -#include +// 3rdparty lib includes +#include +// local includes #include "display.h" #include "actions/switchscreenaction.h" - #include "modeinterface.h" #include "globals.h" #include "utils.h" @@ -13,6 +13,7 @@ #include "widgets/progressbar.h" #include "icons/alert.h" +// forward declares namespace { class MainMenu; class BmsDisplay; @@ -146,19 +147,19 @@ void StatusDisplay::redraw() { tft.setTextFont(2); m_labelRawGas.redraw(raw_gas ? std::to_string(*raw_gas) : "?"); - m_labelGas.redraw(gas ? std::to_string(*gas) : "?"); + m_labelGas.redraw(gas ? fmt::format("{:.2f}", *gas) : "?"); m_progressBarGas.redraw(gas ? *gas : 0); m_labelRawBrems.redraw(raw_brems ? std::to_string(*raw_brems) : "?"); - m_labelBrems.redraw(brems ? std::to_string(*brems) : "?"); + m_labelBrems.redraw(brems ? fmt::format("{:.2f}", *brems) : "?"); m_progressBarBrems.redraw(brems ? *brems : 0); m_frontStatus.redraw(controllers.front); m_backStatus.redraw(controllers.back); tft.setTextFont(2); - m_labelWifiStatus.redraw(to_string(WiFi.status())); + //m_labelWifiStatus.redraw(to_string(WiFi.status())); m_labelLimit0.redraw(std::to_string(controllers.front.command.left.iMotMax) + "A"); - m_labelIpAddress.redraw(to_string(WiFi.localIP())); + //m_labelIpAddress.redraw(to_string(WiFi.localIP())); m_labelLimit1.redraw(std::to_string(controllers.front.command.left.iDcMax) + "A"); m_labelPerformance.redraw(std::to_string(performance.last)); m_labelMode.redraw(currentMode->displayName()); @@ -231,8 +232,8 @@ void StatusDisplay::BoardStatus::redraw(const Controller &controller) if (controller.feedbackValid) { - m_labelVoltage.redraw(std::to_string(fixBatVoltage(controller.feedback.batVoltage)) + 'V'); - m_labelTemperature.redraw(std::to_string(fixBoardTemp(controller.feedback.boardTemp)) + 'C'); + m_labelVoltage.redraw(fmt::format("{:.2f}V", fixBatVoltage(controller.feedback.batVoltage))); + m_labelTemperature.redraw(fmt::format("{:.2f}C", fixBoardTemp(controller.feedback.boardTemp))); m_leftMotor.redraw(controller.feedback.left); m_rightMotor.redraw(controller.feedback.right); } @@ -253,8 +254,8 @@ void StatusDisplay::BoardStatus::MotorStatus::redraw(const bobbycar::protocol::s m_labelError.redraw(std::to_string(motor.error)); tft.setTextColor(TFT_WHITE, TFT_BLACK); - m_labelCurrent.redraw(std::to_string(fixCurrent(motor.dcLink)) + 'A'); - m_labelSpeed.redraw(std::to_string(convertToKmh(motor.speed))); + m_labelCurrent.redraw(fmt::format("{:.2f}A", fixCurrent(motor.dcLink))); + m_labelSpeed.redraw(fmt::format("{:.2f}", convertToKmh(motor.speed))); tft.setTextFont(2); m_labelHallSensors.redraw(hallString(motor)); diff --git a/src/displays/updatedisplay.h b/main/displays/updatedisplay.h similarity index 96% rename from src/displays/updatedisplay.h rename to main/displays/updatedisplay.h index f205043..6231633 100644 --- a/src/displays/updatedisplay.h +++ b/main/displays/updatedisplay.h @@ -3,7 +3,9 @@ #include #include +#if defined(FEATURE_ARDUINOOTA) || defined(FEATURE_WEBOTA) #include +#endif #include "display.h" #include "actions/switchscreenaction.h" diff --git a/src/dpad.h b/main/dpad.h similarity index 93% rename from src/dpad.h rename to main/dpad.h index 1430f57..e5d170e 100644 --- a/src/dpad.h +++ b/main/dpad.h @@ -4,8 +4,10 @@ #include -#include "types.h" +#include + #include "buttons.h" +#include "types.h" namespace { namespace dpad @@ -44,7 +46,7 @@ State Helper::read() #ifdef FEATURE_DPAD Helper helper; State lastState; -millis_t debounceUp, debounceDown, debounceConfirm, debounceBack; +espchrono::millis_clock::time_point debounceUp, debounceDown, debounceConfirm, debounceBack; void init() { @@ -54,7 +56,7 @@ void init() void update() { const auto state = helper.read(); - const auto now = millis(); + const auto now = espchrono::millis_clock::now(); enum { ButtonUp = 0, diff --git a/src/dpad3wire.h b/main/dpad3wire.h similarity index 93% rename from src/dpad3wire.h rename to main/dpad3wire.h index 1ee36a7..b659437 100644 --- a/src/dpad3wire.h +++ b/main/dpad3wire.h @@ -2,9 +2,11 @@ #include +#include + #include "dpad.h" -#include "types.h" #include "buttons.h" +#include "types.h" namespace { namespace dpad3wire @@ -57,18 +59,18 @@ dpad::State Helper::read() #ifdef FEATURE_DPAD_3WIRESW Helper helper; dpad::State lastState; -millis_t debounceUp, debounceDown, debounceConfirm, debounceBack; +espchrono::millis_clock::time_point debounceUp, debounceDown, debounceConfirm, debounceBack; void init() { helper.begin(); - debounceUp = debounceDown = debounceConfirm = debounceBack = millis(); + debounceUp = debounceDown = debounceConfirm = debounceBack = espchrono::millis_clock::now(); } void update() { const auto state = helper.read(); - const auto now = millis(); + const auto now = espchrono::millis_clock::now(); enum { ButtonUp = 3, diff --git a/src/dpad5wire.h b/main/dpad5wire.h similarity index 67% rename from src/dpad5wire.h rename to main/dpad5wire.h index 908e006..9d328b5 100644 --- a/src/dpad5wire.h +++ b/main/dpad5wire.h @@ -4,8 +4,10 @@ #include -#include "types.h" +#include + #include "buttons.h" +#include "types.h" namespace { namespace dpad5wire { @@ -97,12 +99,12 @@ State Helper::read() Helper helper; State lastState; -millis_t debounceUp, debounceDown, debounceConfirm, debounceBack, debounceProfile0, debounceProfile1, debounceProfile2, debounceProfile3; +espchrono::millis_clock::time_point debounceUp, debounceDown, debounceConfirm, debounceBack, debounceProfile0, debounceProfile1, debounceProfile2, debounceProfile3; void init() { helper.begin(); - debounceUp = debounceDown = debounceConfirm = debounceBack = debounceProfile0 = debounceProfile1 = debounceProfile2 = debounceProfile3 = millis(); + debounceUp = debounceDown = debounceConfirm = debounceBack = debounceProfile0 = debounceProfile1 = debounceProfile2 = debounceProfile3 = espchrono::millis_clock::now(); } void update() @@ -114,55 +116,57 @@ void update() return; #endif - const auto now = millis(); + const auto now = espchrono::millis_clock::now(); - if (lastState.up != newState.up && now-debounceUp > settings.boardcomputerHardware.dpadDebounce) + const std::chrono::milliseconds dpadDebounce{settings.boardcomputerHardware.dpadDebounce}; + + if (lastState.up != newState.up && now - debounceUp > dpadDebounce) { if (newState.up) InputDispatcher::rotate(-1); debounceUp = now; } - if (lastState.down != newState.down && now-debounceDown > settings.boardcomputerHardware.dpadDebounce) + if (lastState.down != newState.down && now - debounceDown > dpadDebounce) { if (newState.down) InputDispatcher::rotate(1); debounceDown = now; } - if (lastState.confirm != newState.confirm && now-debounceConfirm > settings.boardcomputerHardware.dpadDebounce) + if (lastState.confirm != newState.confirm && now - debounceConfirm > dpadDebounce) { - InputDispatcher::confirmButton(std::get(newState)); + InputDispatcher::confirmButton(newState.confirm); debounceConfirm = now; } - if (lastState.back != newState.back && now-debounceBack > settings.boardcomputerHardware.dpadDebounce) + if (lastState.back != newState.back && now - debounceBack > dpadDebounce) { - InputDispatcher::backButton(std::get(newState)); + InputDispatcher::backButton(newState.back); debounceBack = now; } - if (lastState.profile0 != newState.profile0 && now-debounceProfile0 > settings.boardcomputerHardware.dpadDebounce) + if (lastState.profile0 != newState.profile0 && now - debounceProfile0 > dpadDebounce) { - InputDispatcher::profileButton(0, std::get(newState)); + InputDispatcher::profileButton(0, newState.profile0); debounceProfile0 = now; } - if (lastState.profile1 != newState.profile1 && now-debounceProfile1 > settings.boardcomputerHardware.dpadDebounce) + if (lastState.profile1 != newState.profile1 && now - debounceProfile1 > dpadDebounce) { - InputDispatcher::profileButton(1, std::get(newState)); + InputDispatcher::profileButton(1, newState.profile1); debounceProfile1 = now; } - if (lastState.profile2 != newState.profile2 && now-debounceProfile2 > settings.boardcomputerHardware.dpadDebounce) + if (lastState.profile2 != newState.profile2 && now - debounceProfile2 > dpadDebounce) { - InputDispatcher::profileButton(2, std::get(newState)); + InputDispatcher::profileButton(2, newState.profile2); debounceProfile2 = now; } - if (lastState.profile3 != newState.profile3 && now-debounceProfile3 > settings.boardcomputerHardware.dpadDebounce) + if (lastState.profile3 != newState.profile3 && now - debounceProfile3 > dpadDebounce) { - InputDispatcher::profileButton(3, std::get(newState)); + InputDispatcher::profileButton(3, newState.profile3); debounceProfile3 = now; } diff --git a/src/esp_websocket_client.h b/main/esp_websocket_client.h similarity index 100% rename from src/esp_websocket_client.h rename to main/esp_websocket_client.h diff --git a/main/esptexthelpers.h b/main/esptexthelpers.h new file mode 100644 index 0000000..f30bb13 --- /dev/null +++ b/main/esptexthelpers.h @@ -0,0 +1,62 @@ +#pragma once + +#include "textinterface.h" + +namespace { +//template +//using EspStatusTextHelper = StatusTextHelper; + +constexpr char TEXT_ESPHEAPSIZE[] = "Heap size: "; +using EspHeapSizeText = StaticText; //EspStatusTextHelper; + +constexpr char TEXT_ESPFREEHEAP[] = "Free heap: "; +using EspFreeHeapText = StaticText; //EspStatusTextHelper; + +constexpr char TEXT_ESPMINFREEHEAP[] = "Min free heap: "; +using EspMinFreeHeapText = StaticText; //EspStatusTextHelper; + +constexpr char TEXT_ESPMAXALLOCHEAP[] = "Max alloc heap: "; +using EspMaxAllocHeapText = StaticText; //EspStatusTextHelper; + +constexpr char TEXT_ESPPSRAMSIZE[] = "psram size: "; +using EspPsramSizeText = StaticText; //EspStatusTextHelper; + +constexpr char TEXT_ESPFREEPSRAM[] = "Free psram: "; +using EspFreePsramText = StaticText; //EspStatusTextHelper; + +constexpr char TEXT_ESPMINFREEPSRAM[] = "Min free psram: "; +using EspMinFreePsramText = StaticText; //EspStatusTextHelper; + +constexpr char TEXT_ESPMAXALLOCPSRAM[] = "Max alloc psram: "; +using EspMaxAllocPsramText = StaticText; //EspStatusTextHelper; + +constexpr char TEXT_ESPCHIPREVISION[] = "Chip revision: "; +using EspChipRevisionText = StaticText; //EspStatusTextHelper; + +constexpr char TEXT_ESPCPUFREQMHZ[] = "Cpu freq MHz: "; +using EspCpuFreqMHzText = StaticText; //EspStatusTextHelper; + +constexpr char TEXT_ESPCYCLECOUNT[] = "Cycle count: "; +using EspCycleCountText = StaticText; //EspStatusTextHelper; + +constexpr char TEXT_ESPSDKVERSION[] = "Sdk version: "; +using EspSdkVersionText = StaticText; //EspStatusTextHelper; + +constexpr char TEXT_ESPFLASHCHIPSIZE[] = "Flash chip size: "; +using EspFlashChipSizeText = StaticText; //EspStatusTextHelper; + +constexpr char TEXT_ESPFLASHCHIPSPEED[] = "Flash chip speed: "; +using EspFlashChipSpeedText = StaticText; //EspStatusTextHelper; + +constexpr char TEXT_ESPFLASHCHIPMODE[] = "Flash chip mode: "; +using EspFlashChipModeText = StaticText; //EspStatusTextHelper; // TODO: improve stringifying + +constexpr char TEXT_ESPSKETCHSIZE[] = "Sketch size: "; +using EspSketchSizeText = StaticText; //StaticallyCachedText>; // caching because of slow + +constexpr char TEXT_ESPSKETCHMD5[] = "Sketch MD5: "; +using EspSketchMd5Text = StaticText; //StaticallyCachedText>; // caching because of slow + +constexpr char TEXT_ESPFREESKETCHSPACE[] = "Free sketch space: "; +using EspFreeSketchSpaceText = StaticText; //EspStatusTextHelper; +} diff --git a/src/feedbackparser.h b/main/feedbackparser.h similarity index 83% rename from src/feedbackparser.h rename to main/feedbackparser.h index 9b31130..18b4ad3 100644 --- a/src/feedbackparser.h +++ b/main/feedbackparser.h @@ -3,11 +3,9 @@ #include #include -#include +#include -#include "bobbycar-protocol/bobbycar-serial.h" - -#include "types.h" +#include "bobbycar-serial.h" namespace { class FeedbackParser @@ -50,19 +48,19 @@ public: { m_feedbackValid = true; m_feedback = m_newFeedback; - m_lastFeedback = millis(); + m_lastFeedback = espchrono::millis_clock::now(); } // else // { // if (m_newFeedback.start == Feedback::VALID_HEADER) -// Serial.println("header matched"); +// //Serial.println("header matched"); // else -// Serial.println("header did not match"); +// //Serial.println("header did not match"); // if (checksum == m_newFeedback.checksum) -// Serial.println("checksum matched"); +// //Serial.println("checksum matched"); // else -// Serial.println("checksum did not match"); +// //Serial.println("checksum did not match"); // } m_idx = 0; // Reset the index (it prevents to enter in this if condition in the next cycle) } @@ -71,7 +69,7 @@ public: m_incomingBytePrev = m_incomingByte; } - if (millis() - m_lastFeedback > 500) + if (espchrono::millis_clock::now() - m_lastFeedback > 500) m_feedbackValid = false; } @@ -82,7 +80,7 @@ private: uint8_t m_incomingByte{}; uint8_t m_incomingBytePrev{}; - millis_t m_lastFeedback{millis()}; + espchrono::millis_clock::time_point m_lastFeedback{espchrono::millis_clock::now()}; const std::reference_wrapper &m_serial; bool &m_feedbackValid; bobbycar::protocol::serial::Feedback &m_feedback, m_newFeedback; diff --git a/src/fontinterface.h b/main/fontinterface.h similarity index 100% rename from src/fontinterface.h rename to main/fontinterface.h diff --git a/src/globals.h b/main/globals.h similarity index 92% rename from src/globals.h rename to main/globals.h index f9a5f6c..c09d708 100644 --- a/src/globals.h +++ b/main/globals.h @@ -9,17 +9,20 @@ #ifdef FEATURE_BLUETOOTH #include #endif -#include -#include +#ifdef FEATURE_SERIAL +#include +#endif #include +#include +#include + // local includes #include "controller.h" #include "display.h" #include "modeinterface.h" #include "settings.h" #include "settingspersister.h" -#include "types.h" namespace { std::optional raw_gas, raw_brems; @@ -70,9 +73,9 @@ struct FrontControllerGetter { static Controller &get() { return controllers.fro struct BackControllerGetter { static Controller &get() { return controllers.back; }}; struct { - millis_t lastTime = millis(); - int current{0}; - int last{0}; + espchrono::millis_clock::time_point lastTime; + int current{}; + int last{}; } performance; #ifdef FEATURE_BLUETOOTH diff --git a/src/htmltag.h b/main/htmltag.h similarity index 100% rename from src/htmltag.h rename to main/htmltag.h diff --git a/src/htmlutils.h b/main/htmlutils.h similarity index 100% rename from src/htmlutils.h rename to main/htmlutils.h diff --git a/src/icon.h b/main/icon.h similarity index 100% rename from src/icon.h rename to main/icon.h diff --git a/src/iconinterface.h b/main/iconinterface.h similarity index 100% rename from src/iconinterface.h rename to main/iconinterface.h diff --git a/src/icons/alert.h b/main/icons/alert.h similarity index 100% rename from src/icons/alert.h rename to main/icons/alert.h diff --git a/src/icons/back.h b/main/icons/back.h similarity index 100% rename from src/icons/back.h rename to main/icons/back.h diff --git a/src/icons/bluetooth.h b/main/icons/bluetooth.h similarity index 100% rename from src/icons/bluetooth.h rename to main/icons/bluetooth.h diff --git a/src/icons/bms.h b/main/icons/bms.h similarity index 100% rename from src/icons/bms.h rename to main/icons/bms.h diff --git a/src/icons/buzzer.h b/main/icons/buzzer.h similarity index 100% rename from src/icons/buzzer.h rename to main/icons/buzzer.h diff --git a/src/icons/checked.h b/main/icons/checked.h similarity index 100% rename from src/icons/checked.h rename to main/icons/checked.h diff --git a/src/icons/close.h b/main/icons/close.h similarity index 100% rename from src/icons/close.h rename to main/icons/close.h diff --git a/src/icons/demos.h b/main/icons/demos.h similarity index 100% rename from src/icons/demos.h rename to main/icons/demos.h diff --git a/src/icons/graph.h b/main/icons/graph.h similarity index 100% rename from src/icons/graph.h rename to main/icons/graph.h diff --git a/src/icons/hardware.h b/main/icons/hardware.h similarity index 100% rename from src/icons/hardware.h rename to main/icons/hardware.h diff --git a/src/icons/info.h b/main/icons/info.h similarity index 100% rename from src/icons/info.h rename to main/icons/info.h diff --git a/src/icons/lock.h b/main/icons/lock.h similarity index 100% rename from src/icons/lock.h rename to main/icons/lock.h diff --git a/src/icons/logo.h b/main/icons/logo.h similarity index 100% rename from src/icons/logo.h rename to main/icons/logo.h diff --git a/src/icons/modes.h b/main/icons/modes.h similarity index 100% rename from src/icons/modes.h rename to main/icons/modes.h diff --git a/src/icons/poweroff.h b/main/icons/poweroff.h similarity index 100% rename from src/icons/poweroff.h rename to main/icons/poweroff.h diff --git a/src/icons/presets.h b/main/icons/presets.h similarity index 100% rename from src/icons/presets.h rename to main/icons/presets.h diff --git a/src/icons/reboot.h b/main/icons/reboot.h similarity index 100% rename from src/icons/reboot.h rename to main/icons/reboot.h diff --git a/src/icons/scan.h b/main/icons/scan.h similarity index 100% rename from src/icons/scan.h rename to main/icons/scan.h diff --git a/src/icons/settings.h b/main/icons/settings.h similarity index 100% rename from src/icons/settings.h rename to main/icons/settings.h diff --git a/src/icons/unchecked.h b/main/icons/unchecked.h similarity index 100% rename from src/icons/unchecked.h rename to main/icons/unchecked.h diff --git a/src/icons/wifi.h b/main/icons/wifi.h similarity index 100% rename from src/icons/wifi.h rename to main/icons/wifi.h diff --git a/main/main.cpp b/main/main.cpp new file mode 100644 index 0000000..69bbc7e --- /dev/null +++ b/main/main.cpp @@ -0,0 +1,395 @@ +// system includes +#include + +// esp-idf includes +#include + +// Arduino includes +#include + +// 3rdparty lib includes +#include +using namespace std::chrono_literals; + +// local includes +#include "bobbycar-common.h" +#include "bobbycar-serial.h" +#include "globals.h" +#include "modes/defaultmode.h" +#include "modes/tempomatmode.h" +#include "displays/menus/aboutmenu.h" +#include "displays/menus/accesspointwifisettingsmenu.h" +#ifdef FEATURE_BLUETOOTH +#include "displays/menus/bluetoothsettingsmenu.h" +#endif +#include "displays/menus/bmsmenu.h" +#include "displays/menus/buzzermenu.h" +#include "displays/menus/commanddebugmenu.h" +#include "displays/menus/debugmenu.h" +#include "displays/menus/defaultmodesettingsmenu.h" +#include "displays/menus/demosmenu.h" +#include "displays/menus/dynamicdebugmenu.h" +#include "displays/menus/enablemenu.h" +#include "displays/menus/feedbackdebugmenu.h" +#include "displays/menus/gametrakmodesettingsmenu.h" +#include "displays/menus/genericwifisettingsmenu.h" +#include "displays/menus/graphsmenu.h" +#include "displays/menus/controllerhardwaresettingsmenu.h" +#include "displays/menus/invertmenu.h" +#include "displays/menus/larsmmodesettingsmenu.h" +#include "displays/menus/limitssettingsmenu.h" +#include "displays/menus/mainmenu.h" +#include "displays/menus/tempomatmodesettingsmenu.h" +#include "displays/menus/modessettingsmenu.h" +#include "displays/menus/mosfetsmenu.h" +#include "displays/menus/motorfeedbackdebugmenu.h" +#include "displays/menus/motorstatedebugmenu.h" +#include "displays/menus/profilesmenu.h" +#include "displays/menus/presetsmenu.h" +#include "displays/menus/boardcomputerhardwaresettingsmenu.h" +#include "displays/menus/selectmodemenu.h" +#include "displays/menus/settingsmenu.h" +#include "displays/menus/stationwifisettingsmenu.h" +#include "displays/menus/timersmenu.h" +#include "displays/menus/wifiscanmenu.h" +#include "displays/menus/wifisettingsmenu.h" +#include "displays/bmsdisplay.h" +#include "displays/calibratedisplay.h" +#include "displays/dpad5wiredebugdisplay.h" +#include "displays/gameoflifedisplay.h" +#include "displays/gametrakcalibratedisplay.h" +#include "displays/lockscreen.h" +#include "displays/metersdisplay.h" +#include "displays/pingpongdisplay.h" +#include "displays/poweroffdisplay.h" +#include "displays/powersupplydisplay.h" +#include "displays/spirodisplay.h" +#include "displays/starfielddisplay.h" +#include "displays/statusdisplay.h" +#include "displays/updatedisplay.h" +#include "screens.h" +#include "dpad.h" +#include "dpad3wire.h" +#include "dpad5wire.h" +#include "rotary.h" +#include "serialhandler.h" +#include "ota.h" +#include "presets.h" +#include "statistics.h" +#include "actions/wifisoftapaction.h" +#ifdef FEATURE_BLUETOOTH +#include "actions/bluetoothbeginaction.h" +#include "actions/bluetoothbeginmasteraction.h" +#include "actions/bluetoothconnectbmsaction.h" +#endif +#include "bobby_webserver.h" +#ifdef FEATURE_CAN +#include "can.h" +#endif +#ifdef FEATURE_CLOUD +#include "cloud.h" +#endif + +namespace { +ModeInterface *lastMode{}; +std::optional lastPotiRead; +std::optional lastModeUpdate; +std::optional lastStatsUpdate; +std::optional lastDisplayUpdate; +std::optional lastDisplayRedraw; +} + +void printMemoryStats(const char *s) +{ + //Serial.printf("MEMORY %s 8bit: %u 32bit: %u\r\n", + // s, + // heap_caps_get_free_size(MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT), + // heap_caps_get_free_size(MALLOC_CAP_INTERNAL|MALLOC_CAP_32BIT)); +} + +extern "C" void app_main() +{ + Serial.begin(115200); + //Serial.setDebugOutput(true); + //Serial.println("setup()"); + +#ifdef PINS_LED + pinMode(PINS_LED, OUTPUT); + digitalWrite(PINS_LED, LOW); +#endif + + printMemoryStats("setup()"); + + pinMode(3, INPUT_PULLUP); + + currentlyReverseBeeping = false; + + initScreen(); + printMemoryStats("initScreen()"); + +#ifdef FEATURE_DPAD + bootLabel.redraw("dpad"); + dpad::init(); +#endif + +#ifdef FEATURE_DPAD_3WIRESW + bootLabel.redraw("dpad3wire"); + dpad3wire::init(); +#endif + +#ifdef FEATURE_DPAD_5WIRESW + bootLabel.redraw("dpad5wire"); + dpad5wire::init(); +#endif + +#ifdef FEATURE_ROTARY + bootLabel.redraw("rotary"); + initRotary(); +#endif + +#ifdef FEATURE_MOSFETS + bootLabel.redraw("mosfets"); + pinMode(PINS_MOSFET0, OUTPUT); + pinMode(PINS_MOSFET1, OUTPUT); + pinMode(PINS_MOSFET2, OUTPUT); + + digitalWrite(PINS_MOSFET0, LOW); + digitalWrite(PINS_MOSFET1, LOW); + digitalWrite(PINS_MOSFET2, LOW); +#endif + + bootLabel.redraw("settings"); + settings = presets::defaultSettings; + + if (settingsPersister.init()) + { + if (settingsPersister.openProfile(0)) + { + loadSettings(); + } + } + printMemoryStats("loadSettings()"); + +#ifdef FEATURE_SERIAL + bootLabel.redraw("swap front back"); + updateSwapFrontBack(); + printMemoryStats("swapFronBack()"); +#endif + + //bootLabel.redraw("deviceName"); + //{ + // uint8_t macAddress[6]; + // WiFi.macAddress(&macAddress[0]); + // std::sprintf(deviceName, STRING(DEVICE_PREFIX) "_%02hhx%02hhx%02hhx", macAddress[3], macAddress[4], macAddress[5]); + //} + //printMemoryStats("deviceName"); + + //bootLabel.redraw("setHostname"); + //if (!WiFi.setHostname(deviceName)) + //{ + //Serial.println("Could not setHostname"); + //} + //printMemoryStats("setHostname()"); + + //bootLabel.redraw("softAPsetHostname"); + //if (!WiFi.softAPsetHostname(deviceName)) + //{ + //Serial.println("Could not softAPsetHostname"); + //} + //printMemoryStats("softAPsetHostname()"); + + //bootLabel.redraw("WiFi mode"); + //if (!WiFi.mode(settings.wifiSettings.autoWifiMode)) + //{ + //Serial.println("Could not set mode to WIFI_AP_STA"); + //} + //printMemoryStats("WiFi.mode()"); + + //if (settings.wifiSettings.autoEnableAp) + //{ + //bootLabel.redraw("WiFi softAp"); + //WifiSoftApAction{}.triggered(); + //printMemoryStats("WifiSoftApAction()"); + //} + + //bootLabel.redraw("WiFi begin"); + //if (!WiFi.begin("realraum", "r3alraum")) + //{ + //Serial.println("Could not begin WiFi"); + //} + //printMemoryStats("WiFi.begin()"); + +#ifdef FEATURE_BLUETOOTH + if (settings.bluetoothSettings.autoBluetoothMode == BluetoothMode::Master) + { + bootLabel.redraw("bluetooth begin master"); + BluetoothBeginMasterAction{}.triggered(); + printMemoryStats("BluetoothBeginMasterAction()"); +#ifdef FEATURE_BMS + if (settings.autoConnectBms) + { + bootLabel.redraw("connect BMS"); + BluetoothConnectBmsAction{}.triggered(); + printMemoryStats("BluetoothConnectBmsAction()"); + } +#endif + } + else if (settings.bluetoothSettings.autoBluetoothMode == BluetoothMode::Slave) + { + bootLabel.redraw("bluetooth begin"); + BluetoothBeginAction{}.triggered(); + printMemoryStats("BluetoothBeginAction()"); + } +#endif + +#ifdef FEATURE_CAN + can::initCan(); +#endif + +#ifdef FEATURE_SERIAL + bootLabel.redraw("front Serial begin"); + controllers.front.serial.get().begin(38400, SERIAL_8N1, PINS_RX1, PINS_TX1); + + bootLabel.redraw("back Serial begin"); + controllers.back.serial.get().begin(38400, SERIAL_8N1, PINS_RX2, PINS_TX2); +#endif + + raw_gas = std::nullopt; + raw_brems = std::nullopt; + gas = std::nullopt; + brems = std::nullopt; + + for (Controller &controller : controllers) + controller.command.buzzer = {}; + + currentMode = &modes::defaultMode; + +#ifdef FEATURE_ARDUINOOTA + bootLabel.redraw("ota"); + initOta(); + printMemoryStats("initOta()"); +#endif + +#ifdef FEATURE_WEBSERVER + bootLabel.redraw("webserver"); + initWebserver(); + printMemoryStats("initWebserver()"); +#endif + + bootLabel.redraw("potis"); + readPotis(); + printMemoryStats("readPotis()"); + +#ifdef FEATURE_CLOUD + startCloud(); +#endif + +#if defined(FEATURE_DPAD_5WIRESW) && defined(DPAD_5WIRESW_DEBUG) + switchScreen(); + return; +#endif + + if (!gas || !brems || *gas > 200.f || *brems > 200.f) + switchScreen(true); + else + switchScreen(); + + printMemoryStats("switchScreen()"); + + while (true) + { + //Serial.println("loop()"); + //printMemoryStats("loop()"); + + const auto now = espchrono::millis_clock::now(); + +#ifdef FEATURE_DPAD + dpad::update(); +#endif + +#ifdef FEATURE_DPAD_3WIRESW + dpad3wire::update(); +#endif + +#ifdef FEATURE_DPAD_5WIRESW + dpad5wire::update(); +#endif + + if (!lastPotiRead || now - *lastPotiRead >= 1000ms/settings.boardcomputerHardware.timersSettings.potiReadRate) + { + readPotis(); + + lastPotiRead = now; + } + + if (!lastModeUpdate || now - *lastModeUpdate >= 1000ms/settings.boardcomputerHardware.timersSettings.modeUpdateRate) + { + if (lastMode != currentMode) + { + if (lastMode) + lastMode->stop(); + lastMode = currentMode; + if (currentMode) + currentMode->start(); + } + + if (currentMode) + currentMode->update(); + + lastModeUpdate = now; + + performance.current++; + } + + if (!lastStatsUpdate || now - *lastStatsUpdate >= 1000ms/settings.boardcomputerHardware.timersSettings.statsUpdateRate) + { + updateAccumulators(); + pushStats(); + lastStatsUpdate = now; + } + + if (!lastDisplayUpdate || now - *lastDisplayUpdate >= 1000ms/settings.boardcomputerHardware.timersSettings.displayUpdateRate) + { + updateDisplay(); + + lastDisplayUpdate = now; + } + + if (!lastDisplayRedraw || now - *lastDisplayRedraw >= 1000ms/settings.boardcomputerHardware.timersSettings.displayRedrawRate) + { + redrawDisplay(); + + lastDisplayRedraw = now; + } + + if (now - performance.lastTime >= 1000ms) + { + performance.last = performance.current; + performance.current = 0; + performance.lastTime = now; + } + +#ifdef FEATURE_CAN + can::parseCanInput(); +#endif + +#ifdef FEATURE_SERIAL + for (Controller &controller : controllers) + controller.parser.update(); +#endif + + handleSerial(); + +#ifdef FEATURE_ARDUINOOTA + handleOta(); +#endif + +#ifdef FEATURE_WEBSERVER + handleWebserver(); +#endif + +#ifdef FEATURE_BMS + bms::update(); +#endif + } +} diff --git a/src/menudisplay.h b/main/menudisplay.h similarity index 96% rename from src/menudisplay.h rename to main/menudisplay.h index 67c4979..9bd9f8c 100644 --- a/src/menudisplay.h +++ b/main/menudisplay.h @@ -3,6 +3,7 @@ #include #include #include +#include #include "display.h" #include "textinterface.h" @@ -36,18 +37,14 @@ public: MenuItem& getMenuItem(std::size_t index) { - if (index < m_menuItems.size()) - return *m_menuItems[index].get(); - - throw "aua"; + assert(index < m_menuItems.size()); + return *m_menuItems[index].get(); } const MenuItem& getMenuItem(std::size_t index) const { - if (index < m_menuItems.size()) - return *m_menuItems[index].get(); - - throw "aua"; + assert(index < m_menuItems.size()); + return *m_menuItems[index].get(); } void runForEveryMenuItem(std::function &&callback) @@ -83,9 +80,7 @@ public: std::unique_ptr takeLastMenuItem() { - if (m_menuItems.empty()) - throw "aua"; - + assert(!m_menuItems.empty()); std::unique_ptr ptr = std::move(m_menuItems.back()); m_menuItems.pop_back(); return ptr; diff --git a/src/menuitem.h b/main/menuitem.h similarity index 100% rename from src/menuitem.h rename to main/menuitem.h diff --git a/src/modeinterface.h b/main/modeinterface.h similarity index 100% rename from src/modeinterface.h rename to main/modeinterface.h diff --git a/src/modes/defaultmode.h b/main/modes/defaultmode.h similarity index 86% rename from src/modes/defaultmode.h rename to main/modes/defaultmode.h index ff10507..1d7d2a7 100644 --- a/src/modes/defaultmode.h +++ b/main/modes/defaultmode.h @@ -4,10 +4,11 @@ #include +#include + #include "modeinterface.h" #include "globals.h" #include "utils.h" -#include "types.h" namespace { class DefaultMode : public ModeInterface @@ -21,7 +22,7 @@ public: bool waitForBremsLoslass{false}; private: - millis_t lastTime{millis()}; + espchrono::millis_clock::time_point lastTime{espchrono::millis_clock::now()}; float lastPwm{0}; }; @@ -66,7 +67,7 @@ void DefaultMode::update() const auto gas_processed = settings.defaultMode.squareGas ? (local_gas * local_gas) / 1000.f : local_gas; const auto brems_processed = settings.defaultMode.squareBrems ? (local_brems * local_brems) / 1000 : local_brems; - const auto now = millis(); + const auto now = espchrono::millis_clock::now(); float pwm; if (gas_processed >= settings.defaultMode.add_schwelle) @@ -77,13 +78,13 @@ void DefaultMode::update() { if (lastPwm < pwm) { - pwm = std::min(pwm, lastPwm+(settings.defaultMode.smoothing*(now-lastTime)/100.f)); + pwm = std::min(pwm, lastPwm + (settings.defaultMode.smoothing * std::chrono::milliseconds{now - lastTime}.count() / 100.f)); if (pwm < 1000.) pwm = 1000.; } else if (lastPwm > pwm) { - pwm = std::max(pwm, lastPwm-(settings.defaultMode.smoothing*(now-lastTime)/100.f)); + pwm = std::max(pwm, lastPwm - (settings.defaultMode.smoothing * std::chrono::milliseconds{now - lastTime}.count() / 100.f)); } } } diff --git a/src/modes/gametrakmode.h b/main/modes/gametrakmode.h similarity index 97% rename from src/modes/gametrakmode.h rename to main/modes/gametrakmode.h index 2287280..28fa512 100644 --- a/src/modes/gametrakmode.h +++ b/main/modes/gametrakmode.h @@ -14,7 +14,7 @@ constexpr const T& clamp( const T& v, const T& lo, const T& hi ) #include "utils.h" #include "defaultmode.h" -#include "bobbycar-protocol/bobbycar-common.h" +#include "bobbycar-common.h" namespace { #ifdef FEATURE_GAMETRAK diff --git a/src/modes/ignoreinputmode.h b/main/modes/ignoreinputmode.h similarity index 94% rename from src/modes/ignoreinputmode.h rename to main/modes/ignoreinputmode.h index f22b4c0..638ad94 100644 --- a/src/modes/ignoreinputmode.h +++ b/main/modes/ignoreinputmode.h @@ -4,7 +4,7 @@ #include "globals.h" #include "utils.h" -#include "bobbycar-protocol/bobbycar-common.h" +#include "bobbycar-common.h" namespace { class IgnoreInputMode : public ModeInterface diff --git a/src/modes/larsmmode.h b/main/modes/larsmmode.h similarity index 99% rename from src/modes/larsmmode.h rename to main/modes/larsmmode.h index 9ede112..57e2e08 100644 --- a/src/modes/larsmmode.h +++ b/main/modes/larsmmode.h @@ -4,7 +4,7 @@ #include "globals.h" #include "utils.h" -#include "bobbycar-protocol/bobbycar-common.h" +#include "bobbycar-common.h" namespace { class LarsmMode : public ModeInterface diff --git a/src/modes/tempomatmode.h b/main/modes/tempomatmode.h similarity index 96% rename from src/modes/tempomatmode.h rename to main/modes/tempomatmode.h index 81dcff2..11df47e 100644 --- a/src/modes/tempomatmode.h +++ b/main/modes/tempomatmode.h @@ -2,7 +2,7 @@ #include -#include "bobbycar-protocol/bobbycar-common.h" +#include "bobbycar-common.h" #include "modeinterface.h" #include "globals.h" diff --git a/src/ota.h b/main/ota.h similarity index 100% rename from src/ota.h rename to main/ota.h diff --git a/src/presets.h b/main/presets.h similarity index 100% rename from src/presets.h rename to main/presets.h diff --git a/src/rotary.h b/main/rotary.h similarity index 83% rename from src/rotary.h rename to main/rotary.h index 0e3f6fd..526d7a1 100644 --- a/src/rotary.h +++ b/main/rotary.h @@ -1,7 +1,9 @@ #pragma once -#include +// 3rdparty lib includes +#include +// local includes #include "globals.h" #include "types.h" @@ -20,7 +22,7 @@ public: void updateSwitch(); private: - int m_lastMillis{}; + espchrono::millis_clock::time_point m_lastMillis; bool m_lastClk; bool m_lastSw{}; @@ -29,7 +31,7 @@ private: template void Rotary::begin() { - m_lastMillis = millis(); + m_lastMillis = espchrono::millis_clock::now(); pinMode(ClkPin, INPUT_PULLUP); pinMode(DtPin, INPUT_PULLUP); @@ -41,8 +43,8 @@ void Rotary::begin() template void Rotary::updateRotate() { - const auto now = millis(); - if (now - m_lastMillis < 1) + const auto now = espchrono::millis_clock::now(); + if (now - m_lastMillis < 1ms) return; m_lastMillis = now; @@ -57,8 +59,8 @@ void Rotary::updateRotate() template void Rotary::updateSwitch() { - const auto now = millis(); - if (now - m_lastMillis < 1) + const auto now = espchrono::millis_clock::now(); + if (now - m_lastMillis < 1ms) return; m_lastMillis = now; diff --git a/src/screens.h b/main/screens.h similarity index 94% rename from src/screens.h rename to main/screens.h index ce33cd3..374cd46 100644 --- a/src/screens.h +++ b/main/screens.h @@ -88,7 +88,7 @@ void updateDisplay() if (confirmButtonLongPressed) { confirmButtonLongPressed = false; - Serial.println("todo: implement long press for confirm"); + //Serial.println("todo: implement long press for confirm"); } if (backButtonPressed) @@ -102,7 +102,7 @@ void updateDisplay() if (backButtonLongPressed) { backButtonLongPressed = false; - Serial.println("todo: implement long press for back"); + //Serial.println("todo: implement long press for back"); } if (currentDisplay) diff --git a/src/serialhandler.h b/main/serialhandler.h similarity index 79% rename from src/serialhandler.h rename to main/serialhandler.h index 072f2d4..4bcde72 100644 --- a/src/serialhandler.h +++ b/main/serialhandler.h @@ -1,33 +1,32 @@ #pragma once #include -#include #include "globals.h" #include "utils.h" #include "screens.h" namespace { -wl_status_t last_status; -IPAddress last_ip; +//wl_status_t last_status; +//IPAddress last_ip; void handleSerial() { - const auto status = WiFi.status(); - if (last_status != status) - { - Serial.print("Status changed to: "); - Serial.println(to_string(status).c_str()); - last_status = status; - } + //const auto status = WiFi.status(); + //if (last_status != status) + //{ + //Serial.print("Status changed to: "); + //Serial.println(to_string(status).c_str()); + //last_status = status; + //} - const auto ip = WiFi.localIP(); - if (last_ip != ip) - { - Serial.print("IP changed to: "); - Serial.println(to_string(ip).c_str()); - last_ip = ip; - } + //const auto ip = WiFi.localIP(); + //if (last_ip != ip) + //{ + //Serial.print("IP changed to: "); + //Serial.println(to_string(ip).c_str()); + //last_ip = ip; + //} while(Serial.available()) { diff --git a/src/settings.h b/main/settings.h similarity index 99% rename from src/settings.h rename to main/settings.h index 2c2ea53..2462419 100644 --- a/src/settings.h +++ b/main/settings.h @@ -4,7 +4,7 @@ #include -#include "bobbycar-protocol/bobbycar-common.h" +#include "bobbycar-common.h" #ifdef FEATURE_BLUETOOTH #include "bluetoothmode.h" diff --git a/src/settingsaccessors.h b/main/settingsaccessors.h similarity index 100% rename from src/settingsaccessors.h rename to main/settingsaccessors.h diff --git a/src/settingspersister.h b/main/settingspersister.h similarity index 89% rename from src/settingspersister.h rename to main/settingspersister.h index e6720b6..bc2fe0b 100644 --- a/src/settingspersister.h +++ b/main/settingspersister.h @@ -3,7 +3,6 @@ #include #include -#include #include #include @@ -39,14 +38,14 @@ bool SettingsPersister::init() esp_err_t err = nvs_flash_init(); if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) { - Serial.printf("nvs_flash_init() returned: %s, trying to erase\r\n", esp_err_to_name(err)); + //Serial.printf("nvs_flash_init() returned: %s, trying to erase\r\n", esp_err_to_name(err)); return erase(); } if (err != ESP_OK) { - Serial.printf("nvs_flash_init() returned: %s\r\n", esp_err_to_name(err)); + //Serial.printf("nvs_flash_init() returned: %s\r\n", esp_err_to_name(err)); return false; } @@ -58,14 +57,14 @@ bool SettingsPersister::erase() esp_err_t err = nvs_flash_erase(); if (err != ESP_OK) { - Serial.printf("nvs_flash_erase() returned: %s, aborting\r\n", esp_err_to_name(err)); + //Serial.printf("nvs_flash_erase() returned: %s, aborting\r\n", esp_err_to_name(err)); return false; } err = nvs_flash_init(); if (err != ESP_OK) { - Serial.printf("nvs_flash_init() returned: %s\r\n", esp_err_to_name(err)); + //Serial.printf("nvs_flash_init() returned: %s\r\n", esp_err_to_name(err)); return false; } @@ -80,7 +79,7 @@ bool SettingsPersister::openProfile(uint8_t index) esp_err_t err = nvs_open(("bobbycar"+std::to_string(index)).c_str(), NVS_READWRITE, &handle); if (err != ESP_OK) { - Serial.printf("nvs_open() returned: %s\r\n", esp_err_to_name(err)); + //Serial.printf("nvs_open() returned: %s\r\n", esp_err_to_name(err)); return false; } @@ -169,7 +168,7 @@ bool SettingsPersister::load(Settings &settings) { if (!m_profile) { - Serial.println("SettingsPersister::load() no profile open currently!"); + //Serial.println("SettingsPersister::load() no profile open currently!"); return false; } @@ -180,7 +179,7 @@ bool SettingsPersister::load(Settings &settings) esp_err_t err = nvsGetterHelper>::nvs_get(m_profile->handle, key, &value); if (err != ESP_OK) { - Serial.printf("nvs_get_i32() for %s returned: %s\r\n", key, esp_err_to_name(err)); + //Serial.printf("nvs_get_i32() for %s returned: %s\r\n", key, esp_err_to_name(err)); result = false; } }); @@ -227,7 +226,7 @@ bool SettingsPersister::save(Settings &settings) { if (!m_profile) { - Serial.println("SettingsPersister::save() no profile open currently!"); + //Serial.println("SettingsPersister::save() no profile open currently!"); return false; } @@ -238,10 +237,9 @@ bool SettingsPersister::save(Settings &settings) esp_err_t err = nvsSetterHelper::nvs_set(m_profile->handle, key, value); if (err != ESP_OK) { - Serial.printf("nvs_get_i32() for %s returned: %s\r\n", key, esp_err_to_name(err)); + //Serial.printf("nvs_get_i32() for %s returned: %s\r\n", key, esp_err_to_name(err)); result = false; } - return err == ESP_OK; }); return result; diff --git a/src/settingsutils.h b/main/settingsutils.h similarity index 62% rename from src/settingsutils.h rename to main/settingsutils.h index d4e285b..3cec2e1 100644 --- a/src/settingsutils.h +++ b/main/settingsutils.h @@ -1,8 +1,5 @@ #pragma once -// Arduino includes -#include - // local includes #include "globals.h" #include "presets.h" @@ -15,9 +12,13 @@ void switchProfile(uint8_t index) if (settingsPersister.openProfile(index)) { if (!settingsPersister.load(settings)) - Serial.println("switchProfile() load failed"); + { + //Serial.println("switchProfile() load failed"); + } } else - Serial.println("switchProfile() openProfile failed"); + { + //Serial.println("switchProfile() openProfile failed"); + } } } diff --git a/src/statistics.h b/main/statistics.h similarity index 100% rename from src/statistics.h rename to main/statistics.h diff --git a/src/textinterface.h b/main/textinterface.h similarity index 79% rename from src/textinterface.h rename to main/textinterface.h index a8d9321..fce1b01 100644 --- a/src/textinterface.h +++ b/main/textinterface.h @@ -10,6 +10,12 @@ public: virtual std::string text() const = 0; }; +class EmptyText : public virtual TextInterface +{ +public: + std::string text() const override { return {}; } +}; + template class StaticText : public virtual TextInterface { @@ -37,6 +43,13 @@ public: std::string text() const override { using std::to_string; using ::to_string; return Ttext + to_string((Tptr->*Tmethod)()); } }; +template +class StaticStatusTextHelper : public virtual TextInterface +{ +public: + std::string text() const override { using std::to_string; using ::to_string; return Ttext + to_string(Tmethod()); } +}; + template class CachedText : public virtual T { diff --git a/src/texts.h b/main/texts.h similarity index 100% rename from src/texts.h rename to main/texts.h diff --git a/src/types.h b/main/types.h similarity index 59% rename from src/types.h rename to main/types.h index 4b4c23d..acaebae 100644 --- a/src/types.h +++ b/main/types.h @@ -2,5 +2,4 @@ namespace { using pin_t = int; -using millis_t = unsigned long; } diff --git a/src/unifiedmodelmode.h b/main/unifiedmodelmode.h similarity index 88% rename from src/unifiedmodelmode.h rename to main/unifiedmodelmode.h index e402ce2..105a2c4 100644 --- a/src/unifiedmodelmode.h +++ b/main/unifiedmodelmode.h @@ -2,9 +2,7 @@ #include -#include - -#include "bobbycar-protocol/bobbycar-common.h" +#include "bobbycar-common.h" namespace { enum class UnifiedModelMode : uint8_t @@ -30,7 +28,7 @@ std::pair spli case UnifiedModelMode::FocTorque: return std::make_pair(ControlType::FieldOrientedControl, ControlMode::Torque); } - Serial.printf("Unknown UnifiedModelMode: %i\r\n", int(mode)); + //Serial.printf("Unknown UnifiedModelMode: %i\r\n", int(mode)); return std::make_pair(ControlType::FieldOrientedControl, ControlMode::OpenMode); } diff --git a/src/utils.h b/main/utils.h similarity index 88% rename from src/utils.h rename to main/utils.h index fe8184f..ba627b4 100644 --- a/src/utils.h +++ b/main/utils.h @@ -4,17 +4,22 @@ #include #include -#include +#include +#ifdef FEATURE_ARDUINOOTA #include -#include -#include - -#ifdef FEATURE_CAN -#include "bobbycar-protocol/bobbycar-can.h" #endif #ifdef FEATURE_SERIAL -#include "bobbycar-protocol/bobbycar-serial.h" +#include +#endif + +#include + +#ifdef FEATURE_CAN +#include "bobbycar-can.h" +#endif +#ifdef FEATURE_SERIAL +#include "bobbycar-serial.h" #endif #include "display.h" @@ -30,7 +35,7 @@ namespace { bool currentlyReverseBeeping; bool reverseBeepToggle; -unsigned int lastReverseBeepToggle; +espchrono::millis_clock::time_point lastReverseBeepToggle; template class makeComponent : public T... @@ -97,11 +102,6 @@ std::string hallString(const bobbycar::protocol::serial::MotorFeedback &motor) return std::string{} + (motor.hallA ? '1' : '0') + (motor.hallB ? '1' : '0') + (motor.hallC ? '1' : '0'); } -std::string to_string(const String &value) -{ - return std::string{value.c_str(), value.length()}; -} - std::string to_string(bobbycar::protocol::ControlType value) { switch (value) @@ -127,23 +127,7 @@ std::string to_string(bobbycar::protocol::ControlMode value) return "Unknown ControlMode(" + std::to_string(int(value)) + ')'; } -std::string to_string(wl_status_t value) -{ - switch (value) - { - case WL_NO_SHIELD: return "WL_NO_SHIELD"; - case WL_IDLE_STATUS: return "WL_IDLE_STATUS"; - case WL_NO_SSID_AVAIL: return "WL_NO_SSID_AVAIL"; - case WL_SCAN_COMPLETED: return "WL_SCAN_COMPLETED"; - case WL_CONNECTED: return "WL_CONNECTED"; - case WL_CONNECT_FAILED: return "WL_CONNECT_FAILED"; - case WL_CONNECTION_LOST: return "WL_CONNECTION_LOST"; - case WL_DISCONNECTED: return "WL_DISCONNECTED"; - } - - return "Unknown wl_status_t(" + std::to_string(int(value)) + ')'; -} - +#ifdef FEATURE_ARDUINOOTA std::string to_string(ota_error_t value) { switch (value) @@ -157,16 +141,7 @@ std::string to_string(ota_error_t value) return "Unknown ota_error_t(" + std::to_string(int(value)) + ')'; } - -std::string to_string(IPAddress value) -{ - return to_string(value.toString()); -} - -std::string to_string(IPv6Address value) -{ - return to_string(value.toString()); -} +#endif std::array, 2> motorsInController(Controller &controller) { @@ -217,7 +192,7 @@ void fixCommonParams() if (shouldBeep) { reverseBeepToggle = true; - lastReverseBeepToggle = millis(); + lastReverseBeepToggle = espchrono::millis_clock::now(); for (auto &controller : controllers) controller.command.buzzer = {.freq=settings.reverseBeepFreq0, .pattern=0}; } @@ -227,14 +202,14 @@ void fixCommonParams() currentlyReverseBeeping = shouldBeep; } - else if (shouldBeep && millis() - lastReverseBeepToggle >= (reverseBeepToggle?settings.reverseBeepDuration0:settings.reverseBeepDuration1)) + else if (shouldBeep && espchrono::millis_clock::now() - lastReverseBeepToggle >= std::chrono::milliseconds{reverseBeepToggle?settings.reverseBeepDuration0:settings.reverseBeepDuration1}) { reverseBeepToggle = !reverseBeepToggle; for (auto &controller : controllers) controller.command.buzzer = {.freq=uint8_t(reverseBeepToggle?settings.reverseBeepFreq0:settings.reverseBeepFreq1), .pattern=0}; - lastReverseBeepToggle = millis(); + lastReverseBeepToggle = espchrono::millis_clock::now(); } } else if (currentlyReverseBeeping) @@ -342,11 +317,11 @@ void readPotis() raw_brems = std::nullopt; #ifdef FEATURE_CAN - const auto now = millis(); + const auto now = espchrono::millis_clock::now(); if (can::can_gas) { - if (now - can::last_can_gas < 100) + if (now - can::last_can_gas < 100ms) raw_gas = *can::can_gas; else can::can_gas = std::nullopt; @@ -354,7 +329,7 @@ void readPotis() if (can::can_brems) { - if (now - can::last_can_brems < 100) + if (now - can::last_can_brems < 100ms) raw_brems = *can::can_brems; else can::can_brems = std::nullopt; diff --git a/src/widgets/graph.h b/main/widgets/graph.h similarity index 100% rename from src/widgets/graph.h rename to main/widgets/graph.h diff --git a/src/widgets/label.h b/main/widgets/label.h similarity index 100% rename from src/widgets/label.h rename to main/widgets/label.h diff --git a/src/widgets/progressbar.h b/main/widgets/progressbar.h similarity index 100% rename from src/widgets/progressbar.h rename to main/widgets/progressbar.h diff --git a/src/widgets/reverseprogressbar.h b/main/widgets/reverseprogressbar.h similarity index 100% rename from src/widgets/reverseprogressbar.h rename to main/widgets/reverseprogressbar.h diff --git a/src/widgets/verticalmeter.h b/main/widgets/verticalmeter.h similarity index 100% rename from src/widgets/verticalmeter.h rename to main/widgets/verticalmeter.h diff --git a/src/widgets/vumeter.h b/main/widgets/vumeter.h similarity index 100% rename from src/widgets/vumeter.h rename to main/widgets/vumeter.h diff --git a/main/wifiaccessors.h b/main/wifiaccessors.h new file mode 100644 index 0000000..10ee782 --- /dev/null +++ b/main/wifiaccessors.h @@ -0,0 +1,90 @@ +#pragma once + +#include + +#include "accessorinterface.h" + +namespace { +struct WifiModeAccessor : public virtual AccessorInterface +{ + wifi_mode_t getValue() const override + { + //return WiFi.getMode(); + return WIFI_MODE_NULL; + } + void setValue(wifi_mode_t value) override + { + //if (!WiFi.mode(value)) + //{ + //Serial.println("Could not change WiFi mode!"); + //} + // TODO: better error handling + } +}; + +struct WifiSleepAccessor : public virtual AccessorInterface +{ + bool getValue() const override + { + //return WiFi.getSleep(); + return false; + } + void setValue(bool value) override + { + //if (!WiFi.setSleep(value)) + //{ + //Serial.println("Could not set WiFi sleep!"); + //} + // TODO: better error handling + } +}; + +//struct WifiTxPowerAccessor : public virtual AccessorInterface +//{ +// wifi_power_t getValue() const override { return WiFi.getTxPower(); } +// void setValue(wifi_power_t value) override +// { +// if (!WiFi.setTxPower(value)) +// { +// //Serial.println("Could not set WiFi tx power!"); +// } +// // TODO: better error handling +// } +//}; + + + +struct WifiAutoConnectAccessor : public virtual AccessorInterface +{ + bool getValue() const override + { + //return WiFi.getAutoConnect(); + return true; + } + void setValue(bool value) override + { + //if (!WiFi.setAutoConnect(value)) + //{ + //Serial.println("Could not set WiFi autoConnect!"); + //} + // TODO: better error handling + } +}; + +struct WifiAutoReconnectAccessor : public virtual AccessorInterface +{ + bool getValue() const override + { + //return WiFi.getAutoReconnect(); + return true; + } + void setValue(bool value) override + { + //if (!WiFi.setAutoReconnect(value)) + //{ + //Serial.println("Could not set WiFi autoReconnect!"); + //} + // TODO: better error handling + } +}; +} diff --git a/main/wifitexthelpers.h b/main/wifitexthelpers.h new file mode 100644 index 0000000..9dbdd31 --- /dev/null +++ b/main/wifitexthelpers.h @@ -0,0 +1,60 @@ +#pragma once + +#include "textinterface.h" + +namespace { +constexpr char TEXT_STATUSBITS[] = "statusBits: "; +using WifiStatusBitsText = StaticText; //StatusTextHelper; +constexpr char TEXT_CHANNEL[] = "channel: "; +using WifiChannelText = StaticText; //StatusTextHelper; + +constexpr char TEXT_ISCONNECTED[] = "isConnected: "; +using WifiIsConnectedText = StaticText; //StatusTextHelper +constexpr char TEXT_LOCALIP[] = "localIP: "; +using WifiLocalIpText = StaticText; //StatusTextHelper +constexpr char TEXT_MACADDRESS[] = "macAddress: "; +using WifiMacAddressText = StaticText; //StatusTextHelper +constexpr char TEXT_SUBNETMASK[] = "subnetMask: "; +using WifiSubnetMaskText = StaticText; //StatusTextHelper +constexpr char TEXT_GATEWAYIP[] = "gatewayIP: "; +using WifiGatewayIpText = StaticText; //StatusTextHelper +constexpr char TEXT_DNSIP[] = "dnsIP: "; +using WifiDnsIpText = StaticText; //StatusTextHelper +constexpr char TEXT_BROADCASTIP[] = "broadcastIP: "; +using WifiBroadcastIpText = StaticText; //StatusTextHelper +constexpr char TEXT_NETWORKID[] = "networkID: "; +using WifiNetworkIdText = StaticText; //StatusTextHelper +constexpr char TEXT_SUBNETCIDR[] = "subnetCIDR: "; +using WifiSubnetCIDRText = StaticText; //StatusTextHelper +constexpr char TEXT_LOCALIPV6[] = "localIPv6: "; +using WifiLocalIpV6Text = StaticText; //StatusTextHelper +constexpr char TEXT_HOSTNAME[] = "hostname: "; +using WifiHostnameText = StaticText; //StatusTextHelper +constexpr char TEXT_STATUS2[] = "status: "; +using WifiStatusText = StaticText; //StatusTextHelper +constexpr char TEXT_SSID[] = "SSID: "; +using WifiSsidText = StaticText; //StatusTextHelper +constexpr char TEXT_PSK[] = "psk: "; +using WifiPskText = StaticText; //StatusTextHelper +constexpr char TEXT_BSSID[] = "BSSID: "; +using WifiBssidText = StaticText; //StatusTextHelper +constexpr char TEXT_RSSI[] = "RSSI: "; +using WifiRssiText = StaticText; //StatusTextHelper + +constexpr char TEXT_SOFTAPGETSTATIONNUM[] = "softAPgetStationNum: "; +using WifiSoftApGetStationNumText = StaticText; //StatusTextHelper +constexpr char TEXT_SOFTAPIP[] = "softAPIP: "; +using WifiSoftApIpText = StaticText; //StatusTextHelper +constexpr char TEXT_SOFTAPBROADCASTIP[] = "softAPBroadcastIP: "; +using WifiSoftApBroadcastIpText = StaticText; //StatusTextHelper +constexpr char TEXT_SOFTAPNETWORKID[] = "softAPNetworkID: "; +using WifiSoftApNetworkIdText = StaticText; //StatusTextHelper +constexpr char TEXT_SOFTAPSUBNETCIDR[] = "softAPSubnetCIDR: "; +using WifiSoftApSubnetCidrText = StaticText; //StatusTextHelper +constexpr char TEXT_SOFTAPIPV6[] = "softAPIPv6: "; +using WifiSoftApIpV6Text = StaticText; //StatusTextHelper +constexpr char TEXT_SOFTAPGETHOSTNAME[] = "softAPgetHostname: "; +using WifiSoftApHostnameText = StaticText; //StatusTextHelper +constexpr char TEXT_SOFTAPMACADDRESS[] = "softAPmacAddress: "; +using WifiSoftApMacAddressText = StaticText; //StatusTextHelper +} diff --git a/partitions_16M_ota.csv b/partitions_16M_ota.csv index 9fd97b3..637c57b 100644 --- a/partitions_16M_ota.csv +++ b/partitions_16M_ota.csv @@ -1,6 +1,13 @@ -# Name, Type, SubType, Offset, Size, Flags -nvs, data, nvs, 0x9000, 0x5000, -otadata, data, ota, 0xe000, 0x2000, -app0, app, ota_0, 0x10000, 0x2F0000, -app1, app, ota_1, 0x300000, 0x2F0000, -spiffs, data, spiffs, 0x5F0000, 0x100000, +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x10000, 0x40000, +nvsFac, data, nvs, 0x50000, 0x40000, +phy_init, data, phy, 0x90000, 0x1000, +otadata, data, ota, 0x91000, 0x2000, +# PADDING FOR APP ALIGN 0x93000, 0xD000, +factory, app, factory, 0xA0000, 0x100000, +app_0, app, ota_0, 0x1A0000, 0x400000, +app_1, app, ota_1, 0x5A0000, 0x400000, +nvs_key, data, nvs_keys, 0x9A0000, 0x1000, encrypted +coredump, data, coredump, 0x9A1000, 0x10000, encrypted +keys, 0x40, 0x01, 0x9B1000, 0x10000, encrypted +spiffs, data, spiffs, 0x9C1000, 0x400000, diff --git a/platformio.ini b/platformio.ini deleted file mode 100644 index 555e5b5..0000000 --- a/platformio.ini +++ /dev/null @@ -1,485 +0,0 @@ -;PlatformIO Project Configuration File -; -; Build options: build flags, source filter -; Upload options: custom upload port, speed and extra flags -; Library options: dependencies, extra library storages -; Advanced options: extra scripting -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[common_env_data] -platform = espressif32 -board = esp32dev -framework = arduino - -platform_packages = - toolchain-xtensa32 @ https://github.com/0xFEEDC0DE64/esp32-platformio-gcc#v8.4.0 - framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#idf-release/v4.0 - -lib_deps = - TFT_eSPI - https://github.com/Ferdi265/cxx-ring-buffer - -lib_compat_mode = strict -build_unflags = - -std=gnu++11 - -Os - -build_flags = - -std=gnu++2a - -O3 -; -Werror - -Wall - -Wno-unused-function - -DUSER_SETUP_LOADED=1 - -DLOAD_GLCD=1 - -DLOAD_FONT2=1 - -DLOAD_FONT4=1 - -DLOAD_FONT7=1 - -[default_limits] -build_flags = - -DDEFAULT_IMOTMAX=35 - -DDEFAULT_IDCMAX=37 - -DDEFAULT_NMOTMAX=2000 - -DDEFAULT_FIELDWEAKMAX=7 - -DDEFAULT_FIELDADVMAX=40 - -[default_wheels_inverted] -build_flags = - -DDEFAULT_INVERTFRONTLEFT=false - -DDEFAULT_INVERTFRONTRIGHT=true - -DDEFAULT_INVERTBACKLEFT=false - -DDEFAULT_INVERTBACKRIGHT=true - -[peters_platine_common] -build_flags = - -DILI9341_DRIVER=1 - -DTFT_MOSI=13 - -DTFT_SCLK=15 - -DTFT_CS=14 - -DTFT_DC=12 - -DTFT_RST=2 - -DSPI_FREQUENCY=27000000 - -DDEFAULT_SWAPSCREENBYTES=false - -DFEATURE_SERIAL - -DPINS_RX1=4 - -DPINS_TX1=5 - -DPINS_RX2=25 - -DPINS_TX2=26 - -DFEATURE_ADC_IN - -DFEATURE_MOSFETS - -DPINS_MOSFET0=18 - -DPINS_MOSFET1=19 - -DPINS_MOSFET2=21 - -[webserver_common] -lib_deps = - https://github.com/0xFEEDC0DE64/ESPAsyncWebServer - -build_flags = - -DFEATURE_WEBSERVER - -[peters_platine] -build_flags = - ${peters_platine_common.build_flags} - -DPINS_GAS=35 - -DPINS_BREMS=33 - -[peters_platine_reversed] -build_flags = - ${peters_platine_common.build_flags} - -DPINS_GAS=33 - -DPINS_BREMS=35 - -[feedc0de] -platform = ${common_env_data.platform} -board = ${common_env_data.board} -framework = ${common_env_data.framework} -platform_packages = ${common_env_data.platform_packages} -board_build.partitions = partitions_16M_ota.csv -lib_deps = - ${common_env_data.lib_deps} -; ${webserver_common.lib_deps} -lib_compat_mode = ${common_env_data.lib_compat_mode} -build_unflags = ${common_env_data.build_unflags} -build_flags = - ${common_env_data.build_flags} - -DFEATURE_ADC_IN - -DPINS_GAS=34 - -DPINS_BREMS=35 -; -DPINS_LED=23 - -DILI9341_DRIVER=1 - -DTFT_MOSI=13 - -DTFT_SCLK=15 - -DTFT_CS=14 - -DTFT_DC=12 - -DTFT_RST=2 - -DSPI_FREQUENCY=27000000 - -DDEFAULT_SWAPSCREENBYTES=false - -DFEATURE_CAN -; -DFEATURE_SERIAL -; -DPINS_RX1=4 -; -DPINS_TX1=5 -; -DPINS_RX2=22 -; -DPINS_TX2=23 - ${default_wheels_inverted.build_flags} - -DDEFAULT_WHEELDIAMETER=255 -; -DFEATURE_MOSFETS -; -DPINS_MOSFET0=18 -; -DPINS_MOSFET1=19 -; -DPINS_MOSFET2=21 - ${default_limits.build_flags} - -DDEVICE_PREFIX=bobbyquad - -DAP_PASSWORD=Passwort_123 -; ${webserver_common.build_flags} -; -DFEATURE_ARDUINOOTA -; -DFEATURE_WEBOTA - -DFEATURE_DPAD_5WIRESW - -DPINS_DPAD_5WIRESW_OUT=18 - -DPINS_DPAD_5WIRESW_IN1=19 - -DPINS_DPAD_5WIRESW_IN2=27 - -DPINS_DPAD_5WIRESW_IN3=32 - -DPINS_DPAD_5WIRESW_IN4=33 - -DDPAD_5WIRESW_UP=6 - -DDPAD_5WIRESW_DOWN=3 - -DDPAD_5WIRESW_CONFIRM=7 - -DDPAD_5WIRESW_BACK=2 - -DDPAD_5WIRESW_PROFILE0=1 - -DDPAD_5WIRESW_PROFILE1=5 - -DDPAD_5WIRESW_PROFILE2=0 - -DDPAD_5WIRESW_PROFILE3=4 -; -DDPAD_5WIRESW_DEBUG - -DDEFAULT_GASMIN=150 - -DDEFAULT_GASMAX=1300 - -DDEFAULT_BREMSMIN=200 - -DDEFAULT_BREMSMAX=1500 - -DFEATURE_BLUETOOTH - -DFEATURE_BMS -; -DFEATURE_GAMETRAK -; -DPINS_GAMETRAKX=34 -; -DPINS_GAMETRAKY=39 -; -DPINS_GAMETRAKDIST=36 -; -DDEFAULT_GAMETRAKXMIN=0 -; -DDEFAULT_GAMETRAKXMAX=4095 -; -DDEFAULT_GAMETRAKYMIN=0 -; -DDEFAULT_GAMETRAKYMAX=4095 -; -DDEFAULT_GAMETRAKDISTMIN=0 -; -DDEFAULT_GAMETRAKDISTMAX=4095 -; -DFEATURE_CLOUD - -[env:feedc0de_usb] -platform = ${feedc0de.platform} -board = ${feedc0de.board} -framework = ${feedc0de.framework} -platform_packages = ${feedc0de.platform_packages} -board_build.partitions = ${feedc0de.board_build.partitions} -lib_deps = ${feedc0de.lib_deps} -lib_compat_mode = ${feedc0de.lib_compat_mode} -build_unflags = ${feedc0de.build_unflags} -build_flags = ${feedc0de.build_flags} - -upload_speed = 921600 -upload_port = /dev/ttyUSB* - -[env:feedc0de_ota] -platform = ${feedc0de.platform} -board = ${feedc0de.board} -framework = ${feedc0de.framework} -platform_packages = ${feedc0de.platform_packages} -board_build.partitions = ${feedc0de.board_build.partitions} -lib_deps = ${feedc0de.lib_deps} -lib_compat_mode = ${feedc0de.lib_compat_mode} -build_unflags = ${feedc0de.build_unflags} -build_flags = ${feedc0de.build_flags} - -upload_protocol = espota -upload_port = 192.168.127.124 - - - -[greyhash] -platform = ${common_env_data.platform} -board = ${common_env_data.board} -framework = ${common_env_data.framework} -platform_packages = ${common_env_data.platform_packages} -board_build.partitions = partitions_16M_ota.csv -lib_deps = - ${common_env_data.lib_deps} - ${webserver_common.lib_deps} -lib_compat_mode = ${common_env_data.lib_compat_mode} -build_unflags = ${common_env_data.build_unflags} -build_flags = - ${common_env_data.build_flags} - ${peters_platine.build_flags} - ${default_limits.build_flags} - ${default_wheels_inverted.build_flags} - -DDEFAULT_WHEELDIAMETER=165 - -DDEVICE_PREFIX=bobbycar - -DAP_PASSWORD=Passwort_123 - ${webserver_common.build_flags} - -DFEATURE_ARDUINOOTA - -DDEFAULT_GASMIN=400 - -DDEFAULT_GASMAX=2000 - -DDEFAULT_BREMSMIN=600 - -DDEFAULT_BREMSMAX=2300 - -DPINS_DPAD_UP=23 ;runter - -DPINS_DPAD_DOWN=32 - -DPINS_DPAD_CONFIRM=22 ;rauf - -DPINS_DPAD_BACK=27 - -DFEATURE_DPAD - -[env:greyhash_usb] -platform = ${greyhash.platform} -board = ${greyhash.board} -framework = ${greyhash.framework} -platform_packages = ${greyhash.platform_packages} -board_build.partitions = ${greyhash.board_build.partitions} -lib_deps = ${greyhash.lib_deps} -lib_compat_mode = ${greyhash.lib_compat_mode} -build_unflags = ${greyhash.build_unflags} -build_flags = ${greyhash.build_flags} - -upload_speed = 921600 -upload_port = /dev/ttyUSB* - -[env:greyhash_ota] -platform = ${greyhash.platform} -board = ${greyhash.board} -framework = ${greyhash.framework} -platform_packages = ${greyhash.platform_packages} -board_build.partitions = ${greyhash.board_build.partitions} -lib_deps = ${greyhash.lib_deps} -lib_compat_mode = ${greyhash.lib_compat_mode} -build_unflags = ${greyhash.build_unflags} -build_flags = ${greyhash.build_flags} - -upload_protocol = espota -upload_port = 192.168.127.198 - - - -[env:aveexy_usb] -platform = ${common_env_data.platform} -board = ${common_env_data.board} -framework = ${common_env_data.framework} -platform_packages = ${common_env_data.platform_packages} -board_build.partitions = partitions_16M_ota.csv -lib_deps = - ${common_env_data.lib_deps} - ${webserver_common.lib_deps} -lib_compat_mode = ${common_env_data.lib_compat_mode} -build_unflags = ${common_env_data.build_unflags} - -upload_speed = 921600 -upload_port = /dev/ttyUSB* - -build_flags = - ${common_env_data.build_flags} - ${peters_platine.build_flags} - ${default_limits.build_flags} - ${default_wheels_inverted.build_flags} - -DDEFAULT_WHEELDIAMETER=165 - -DDEVICE_PREFIX=bobbyquad - -DAP_PASSWORD=Passwort_123 - ${webserver_common.build_flags} - -DFEATURE_ARDUINOOTA - -DFEATURE_DPAD - -DPINS_DPAD_UP=32 - -DPINS_DPAD_DOWN=22 - -DPINS_DPAD_CONFIRM=23 - -DPINS_DPAD_BACK=27 - -DDEFAULT_GASMIN=800 - -DDEFAULT_GASMAX=3700 - -DDEFAULT_BREMSMIN=1300 - -DDEFAULT_BREMSMAX=4000 - - - -[env:mickdermack_usb] -platform = ${common_env_data.platform} -board = ${common_env_data.board} -framework = ${common_env_data.framework} -platform_packages = ${common_env_data.platform_packages} -board_build.partitions = partitions_4M_ota.csv -lib_deps = - ${common_env_data.lib_deps} - ${webserver_common.lib_deps} -lib_compat_mode = ${common_env_data.lib_compat_mode} -build_unflags = ${common_env_data.build_unflags} - -upload_port = /dev/ttyUSB* -upload_speed = 921600 - -build_flags = - ${common_env_data.build_flags} - ${default_limits.build_flags} - -DDEVICE_PREFIX=bobbyquad - -DAP_PASSWORD=Passwort_123 - ${webserver_common.build_flags} - -DFEATURE_ARDUINOOTA - -DRPI_DISPLAY_TYPE - -DR61581_DRIVER -; TODO: TFT_MISO (touch MISO?) - -DTFT_MISO=17 - -DTFT_MOSI=4 - -DTFT_SCLK=21 - -DTFT_CS=32 - -DTFT_DC=19 - -DTFT_RST=27 -; TODO: TOUCH_CS - -DTOUCH_CS=22 - -DSPI_FREQUENCY=20000000 - -DSPI_TOUCH_FREQUENCY=2500000 - -DDEFAULT_SWAPSCREENBYTES=false - ${default_wheels_inverted.build_flags} - -DDEFAULT_WHEELDIAMETER=165 -; TODO: actually assign pins - -DFEATURE_SERIAL - -DPINS_RX1=22 - -DPINS_TX1=25 - -DPINS_RX2=23 - -DPINS_TX2=34 - -DFEATURE_ADC_IN - -DPINS_GAS=35 - -DPINS_BREMS=33 - -DDEFAULT_GASMIN=0 - -DDEFAULT_GASMAX=4095 - -DDEFAULT_BREMSMIN=0 - -DDEFAULT_BREMSMAX=4095 - - - -[peter] -platform = ${common_env_data.platform} -board = ${common_env_data.board} -framework = ${common_env_data.framework} -platform_packages = ${common_env_data.platform_packages} -board_build.partitions = partitions_16M_ota.csv -lib_deps = - ${common_env_data.lib_deps} - ${webserver_common.lib_deps} -lib_compat_mode = ${common_env_data.lib_compat_mode} -build_unflags = ${common_env_data.build_unflags} -build_flags = - ${common_env_data.build_flags} - ${peters_platine_reversed.build_flags} - ${default_limits.build_flags} - ${default_wheels_inverted.build_flags} - -DDEFAULT_WHEELDIAMETER=165 - -DDEVICE_PREFIX=bobbycar - -DAP_PASSWORD=Passwort_123 - ${webserver_common.build_flags} - -DFEATURE_ARDUINOOTA - -DDEFAULT_GASMIN=1000 - -DDEFAULT_GASMAX=4000 - -DDEFAULT_BREMSMIN=200 - -DDEFAULT_BREMSMAX=2700 - -[env:peter_usb] -platform = ${peter.platform} -board = ${peter.board} -framework = ${peter.framework} -platform_packages = ${peter.platform_packages} -board_build.partitions = ${peter.board_build.partitions} -lib_deps = ${peter.lib_deps} -lib_compat_mode = ${peter.lib_compat_mode} -build_unflags = ${peter.build_unflags} -build_flags = ${peter.build_flags} - -upload_speed = 921600 - -[env:peter_ota] -platform = ${peter.platform} -board = ${peter.board} -framework = ${peter.framework} -platform_packages = ${peter.platform_packages} -board_build.partitions = ${peter.board_build.partitions} -lib_deps = ${peter.lib_deps} -lib_compat_mode = ${peter.lib_compat_mode} -build_unflags = ${peter.build_unflags} -build_flags = ${peter.build_flags} - -upload_protocol = espota -upload_port = 192.168.127.83 - -[gernot] -platform = ${common_env_data.platform} -board = ${common_env_data.board} -framework = ${common_env_data.framework} -platform_packages = ${common_env_data.platform_packages} -board_build.partitions = partitions_4M_ota.csv -lib_deps = - ${common_env_data.lib_deps} - ${webserver_common.lib_deps} -lib_compat_mode = ${common_env_data.lib_compat_mode} -build_unflags = ${common_env_data.build_unflags} -build_flags = - ${common_env_data.build_flags} - -DFEATURE_ADC_IN - -DPINS_GAS=33 - -DPINS_BREMS=35 - -DILI9341_DRIVER=1 - -DTFT_MOSI=13 - -DTFT_SCLK=15 - -DTFT_CS=14 - -DTFT_DC=12 - -DTFT_RST=2 - -DSPI_FREQUENCY=27000000 - -DDEFAULT_SWAPSCREENBYTES=false - -DFEATURE_SERIAL - -DPINS_RX1=4 - -DPINS_TX1=5 - -DPINS_RX2=25 - -DPINS_TX2=26 - ${default_wheels_inverted.build_flags} - -DDEFAULT_WHEELDIAMETER=165 -; -DFEATURE_MOSFETS -; -DPINS_MOSFET0=18 -; -DPINS_MOSFET1=19 -; -DPINS_MOSFET2=21 - ${default_limits.build_flags} - -DDEVICE_PREFIX=bobbyquad - -DAP_PASSWORD=Passwort_123 - ${webserver_common.build_flags} - -DFEATURE_ARDUINOOTA - -DPINS_DPAD_UP=23 ;runter - -DPINS_DPAD_DOWN=32 - -DPINS_DPAD_CONFIRM=34 ;rauf - -DPINS_DPAD_BACK=27 - -DFEATURE_DPAD -; -DDPAD_5WIRESW_DEBUG - -DDEFAULT_GASMIN=770 - -DDEFAULT_GASMAX=2770 - -DDEFAULT_BREMSMIN=770 - -DDEFAULT_BREMSMAX=2970 -; -DFEATURE_BMS - -[env:gernot_usb] -platform = ${gernot.platform} -board = ${gernot.board} -framework = ${gernot.framework} -platform_packages = ${gernot.platform_packages} -board_build.partitions = ${gernot.board_build.partitions} -lib_deps = ${gernot.lib_deps} -lib_compat_mode = ${gernot.lib_compat_mode} -build_unflags = ${gernot.build_unflags} -build_flags = ${gernot.build_flags} - -upload_speed = 921600 -upload_port = COM14 - -[env:gernot_ota] -platform = ${gernot.platform} -board = ${gernot.board} -framework = ${gernot.framework} -platform_packages = ${gernot.platform_packages} -board_build.partitions = ${gernot.board_build.partitions} -lib_deps = ${gernot.lib_deps} -lib_compat_mode = ${gernot.lib_compat_mode} -build_unflags = ${gernot.build_unflags} -build_flags = ${gernot.build_flags} - -upload_protocol = espota -upload_port = 192.168.0.50 diff --git a/sdkconfig b/sdkconfig new file mode 100644 index 0000000..598aacf --- /dev/null +++ b/sdkconfig @@ -0,0 +1,1300 @@ +# +# Automatically generated file. DO NOT EDIT. +# Espressif IoT Development Framework (ESP-IDF) Project Configuration +# +CONFIG_IDF_CMAKE=y +CONFIG_IDF_TARGET_ARCH_XTENSA=y +CONFIG_IDF_TARGET="esp32" +CONFIG_IDF_TARGET_ESP32=y +CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 + +# +# SDK tool configuration +# +CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-" +# CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set +# end of SDK tool configuration + +# +# Build type +# +CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y +# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set +CONFIG_APP_BUILD_GENERATE_BINARIES=y +CONFIG_APP_BUILD_BOOTLOADER=y +CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y +CONFIG_APP_FLASH_PARTITION_SELECTION_BOOT_DEFAULT=y +# CONFIG_APP_FLASH_PARTITION_SELECTION_OTA_0 is not set +# CONFIG_APP_FLASH_PARTITION_SELECTION_OTA_1 is not set +# CONFIG_APP_FLASH_PARTITION_SELECTION_FACTORY is not set +# end of Build type + +# +# Application manager +# +CONFIG_APP_COMPILE_TIME_DATE=y +# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set +# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set +# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set +CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 +# end of Application manager + +# +# Bootloader config +# +CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000 +CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y +# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set +# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set +# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set +CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y +# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set +CONFIG_BOOTLOADER_LOG_LEVEL=3 +# CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set +CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y +# CONFIG_BOOTLOADER_FACTORY_RESET is not set +# CONFIG_BOOTLOADER_APP_TEST is not set +CONFIG_BOOTLOADER_WDT_ENABLE=y +# CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set +CONFIG_BOOTLOADER_WDT_TIME_MS=9000 +# CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE is not set +# CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP is not set +CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0 +# CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set +# end of Bootloader config + +# +# Security features +# +# CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set +# CONFIG_SECURE_BOOT is not set +# CONFIG_SECURE_FLASH_ENC_ENABLED is not set +# end of Security features + +# +# Serial flasher config +# +CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 +# CONFIG_ESPTOOLPY_NO_STUB is not set +# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set +# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set +CONFIG_ESPTOOLPY_FLASHMODE_DIO=y +# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +CONFIG_ESPTOOLPY_FLASHMODE="dio" +# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set +CONFIG_ESPTOOLPY_FLASHFREQ_40M=y +# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set +CONFIG_ESPTOOLPY_FLASHFREQ="40m" +# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +CONFIG_ESPTOOLPY_FLASHSIZE="16MB" +CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +CONFIG_ESPTOOLPY_BEFORE_RESET=y +# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set +CONFIG_ESPTOOLPY_BEFORE="default_reset" +CONFIG_ESPTOOLPY_AFTER_RESET=y +# CONFIG_ESPTOOLPY_AFTER_NORESET is not set +CONFIG_ESPTOOLPY_AFTER="hard_reset" +# CONFIG_ESPTOOLPY_MONITOR_BAUD_CONSOLE is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set +CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y +# CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set +CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200 +CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 +# end of Serial flasher config + +# +# Partition Table +# +# CONFIG_PARTITION_TABLE_SINGLE_APP is not set +# CONFIG_PARTITION_TABLE_TWO_OTA is not set +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_16M_ota.csv" +CONFIG_PARTITION_TABLE_FILENAME="partitions_16M_ota.csv" +CONFIG_PARTITION_TABLE_OFFSET=0xf000 +CONFIG_PARTITION_TABLE_MD5=y +# end of Partition Table + +# +# Arduino Configuration +# +CONFIG_ENABLE_ARDUINO_DEPENDS=y +# CONFIG_ARDUINO_ISR_IRAM is not set +# CONFIG_DISABLE_HAL_LOCKS is not set + +# +# Debug Log Configuration +# +# CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_NONE is not set +CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_ERROR=y +# CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_WARN is not set +# CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_INFO is not set +# CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_DEBUG is not set +# CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_VERBOSE is not set +CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL=1 +# CONFIG_ARDUHAL_LOG_COLORS is not set +# CONFIG_ARDUHAL_ESP_LOG is not set +# end of Debug Log Configuration + +CONFIG_ARDUINO_SELECTIVE_COMPILATION=y +# CONFIG_ARDUINO_SELECTIVE_FS is not set +CONFIG_ARDUINO_SELECTIVE_SPI=y +# CONFIG_ARDUINO_SELECTIVE_SPIFFS is not set +CONFIG_ARDUINO_SELECTIVE_Wire=y +# end of Arduino Configuration + +# +# Simple WiFi Stack settings +# +# CONFIG_LOG_LOCAL_LEVEL_WIFI_STACK_NONE is not set +# CONFIG_LOG_LOCAL_LEVEL_WIFI_STACK_ERROR is not set +# CONFIG_LOG_LOCAL_LEVEL_WIFI_STACK_WARN is not set +CONFIG_LOG_LOCAL_LEVEL_WIFI_STACK_INFO=y +# CONFIG_LOG_LOCAL_LEVEL_WIFI_STACK_DEBUG is not set +# CONFIG_LOG_LOCAL_LEVEL_WIFI_STACK_VERBOSE is not set +CONFIG_LOG_LOCAL_LEVEL_WIFI_STACK=3 +# end of Simple WiFi Stack settings + +# +# Compiler options +# +CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y +# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set +# CONFIG_COMPILER_OPTIMIZATION_PERF is not set +# CONFIG_COMPILER_OPTIMIZATION_NONE is not set +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y +# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set +# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set +# CONFIG_COMPILER_CXX_EXCEPTIONS is not set +# CONFIG_COMPILER_CXX_RTTI is not set +CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y +# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set +# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set +# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set +# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set +# CONFIG_COMPILER_DISABLE_GCC8_WARNINGS is not set +# CONFIG_COMPILER_DUMP_RTL_FILES is not set +# end of Compiler options + +# +# Component config +# + +# +# Application Level Tracing +# +# CONFIG_APPTRACE_DEST_TRAX is not set +CONFIG_APPTRACE_DEST_NONE=y +CONFIG_APPTRACE_LOCK_ENABLE=y +# end of Application Level Tracing + +# +# ESP-ASIO +# +# CONFIG_ASIO_SSL_SUPPORT is not set +# end of ESP-ASIO + +# +# Bluetooth +# +# CONFIG_BT_ENABLED is not set +CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0 +CONFIG_BTDM_CTRL_PCM_ROLE_EFF=0 +CONFIG_BTDM_CTRL_PCM_POLAR_EFF=0 +CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=0 +CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=0 +CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0 +CONFIG_BTDM_CTRL_PINNED_TO_CORE=0 +CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1 +CONFIG_BT_CTRL_MODE_EFF=1 +CONFIG_BT_CTRL_BLE_MAX_ACT=10 +CONFIG_BT_CTRL_BLE_MAX_ACT_EFF=10 +CONFIG_BT_CTRL_BLE_STATIC_ACL_TX_BUF_NB=0 +CONFIG_BT_CTRL_PINNED_TO_CORE=0 +CONFIG_BT_CTRL_HCI_TL=1 +CONFIG_BT_CTRL_ADV_DUP_FILT_MAX=30 +CONFIG_BT_CTRL_HW_CCA_EFF=0 +CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_EFF=0 +CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y +CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 +CONFIG_BT_CTRL_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 +CONFIG_BT_CTRL_BLE_SCAN_DUPL=y +CONFIG_BT_CTRL_SCAN_DUPL_TYPE=0 +CONFIG_BT_CTRL_SCAN_DUPL_CACHE_SIZE=100 +CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EFF=0 +CONFIG_BT_CTRL_SLEEP_MODE_EFF=0 +CONFIG_BT_CTRL_SLEEP_CLOCK_EFF=0 +CONFIG_BT_CTRL_HCI_TL_EFF=1 +CONFIG_BT_RESERVE_DRAM=0 +# end of Bluetooth + +# +# CoAP Configuration +# +CONFIG_COAP_MBEDTLS_PSK=y +# CONFIG_COAP_MBEDTLS_PKI is not set +# CONFIG_COAP_MBEDTLS_DEBUG is not set +CONFIG_COAP_LOG_DEFAULT_LEVEL=0 +# end of CoAP Configuration + +# +# Driver configurations +# + +# +# ADC configuration +# +# CONFIG_ADC_FORCE_XPD_FSM is not set +CONFIG_ADC_DISABLE_DAC=y +# end of ADC configuration + +# +# SPI configuration +# +# CONFIG_SPI_MASTER_IN_IRAM is not set +CONFIG_SPI_MASTER_ISR_IN_IRAM=y +# CONFIG_SPI_SLAVE_IN_IRAM is not set +CONFIG_SPI_SLAVE_ISR_IN_IRAM=y +# end of SPI configuration + +# +# TWAI configuration +# +# CONFIG_TWAI_ISR_IN_IRAM is not set +# end of TWAI configuration + +# +# UART configuration +# +# CONFIG_UART_ISR_IN_IRAM is not set +# end of UART configuration + +# +# RTCIO configuration +# +# CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC is not set +# end of RTCIO configuration + +# +# GPIO Configuration +# +# CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL is not set +# end of GPIO Configuration +# end of Driver configurations + +# +# eFuse Bit Manager +# +# CONFIG_EFUSE_CUSTOM_TABLE is not set +# CONFIG_EFUSE_VIRTUAL is not set +# CONFIG_EFUSE_CODE_SCHEME_COMPAT_NONE is not set +CONFIG_EFUSE_CODE_SCHEME_COMPAT_3_4=y +# CONFIG_EFUSE_CODE_SCHEME_COMPAT_REPEAT is not set +CONFIG_EFUSE_MAX_BLK_LEN=192 +# end of eFuse Bit Manager + +# +# ESP-TLS +# +CONFIG_ESP_TLS_USING_MBEDTLS=y +# CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set +# CONFIG_ESP_TLS_SERVER is not set +# CONFIG_ESP_TLS_PSK_VERIFICATION is not set +# CONFIG_ESP_TLS_INSECURE is not set +# end of ESP-TLS + +# +# ESP32-specific +# +CONFIG_ESP32_REV_MIN_0=y +# CONFIG_ESP32_REV_MIN_1 is not set +# CONFIG_ESP32_REV_MIN_2 is not set +# CONFIG_ESP32_REV_MIN_3 is not set +CONFIG_ESP32_REV_MIN=0 +CONFIG_ESP32_DPORT_WORKAROUND=y +# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set +CONFIG_ESP32_DEFAULT_CPU_FREQ_160=y +# CONFIG_ESP32_DEFAULT_CPU_FREQ_240 is not set +CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=160 +# CONFIG_ESP32_SPIRAM_SUPPORT is not set +# CONFIG_ESP32_TRAX is not set +CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 +# CONFIG_ESP32_ULP_COPROC_ENABLED is not set +CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=0 +CONFIG_ESP32_DEBUG_OCDAWARE=y +CONFIG_ESP32_BROWNOUT_DET=y +CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_ESP32_BROWNOUT_DET_LVL=0 +CONFIG_ESP32_REDUCE_PHY_TX_POWER=y +CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y +# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set +CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y +# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set +# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set +# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set +CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 +CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 +CONFIG_ESP32_XTAL_FREQ_40=y +# CONFIG_ESP32_XTAL_FREQ_26 is not set +# CONFIG_ESP32_XTAL_FREQ_AUTO is not set +CONFIG_ESP32_XTAL_FREQ=40 +# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set +# CONFIG_ESP32_NO_BLOBS is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +# CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set +CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5 +# end of ESP32-specific + +# +# ADC-Calibration +# +CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y +CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y +CONFIG_ADC_CAL_LUT_ENABLE=y +# end of ADC-Calibration + +# +# Common ESP-related +# +CONFIG_ESP_ERR_TO_NAME_LOOKUP=y +CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=3584 +CONFIG_ESP_MAIN_TASK_CORE_AFFINITY=0 +CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 +CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y +CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 +CONFIG_ESP_CONSOLE_UART_DEFAULT=y +# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART=y +CONFIG_ESP_CONSOLE_MULTIPLE_UART=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +CONFIG_ESP_INT_WDT=y +CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 +CONFIG_ESP_INT_WDT_CHECK_CPU1=y +CONFIG_ESP_TASK_WDT=y +# CONFIG_ESP_TASK_WDT_PANIC is not set +CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y +# CONFIG_ESP_PANIC_HANDLER_IRAM is not set +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_BT_OFFSET=2 +CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y +# end of Common ESP-related + +# +# Ethernet +# +# CONFIG_ETH_USE_ESP32_EMAC is not set +# CONFIG_ETH_USE_SPI_ETHERNET is not set +# CONFIG_ETH_USE_OPENETH is not set +# end of Ethernet + +# +# Event Loop Library +# +# CONFIG_ESP_EVENT_LOOP_PROFILING is not set +CONFIG_ESP_EVENT_POST_FROM_ISR=y +CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y +# end of Event Loop Library + +# +# GDB Stub +# +# end of GDB Stub + +# +# ESP HTTP client +# +CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y +# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set +# end of ESP HTTP client + +# +# HTTP Server +# +CONFIG_HTTPD_MAX_REQ_HDR_LEN=512 +CONFIG_HTTPD_MAX_URI_LEN=512 +CONFIG_HTTPD_ERR_RESP_NO_DELAY=y +CONFIG_HTTPD_PURGE_BUF_LEN=32 +# CONFIG_HTTPD_LOG_PURGE_DATA is not set +CONFIG_HTTPD_WS_SUPPORT=y +# end of HTTP Server + +# +# ESP HTTPS OTA +# +CONFIG_OTA_ALLOW_HTTP=y +# end of ESP HTTPS OTA + +# +# ESP HTTPS server +# +# CONFIG_ESP_HTTPS_SERVER_ENABLE is not set +# end of ESP HTTPS server + +# +# ESP NETIF Adapter +# +CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 +CONFIG_ESP_NETIF_TCPIP_LWIP=y +# CONFIG_ESP_NETIF_LOOPBACK is not set +CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=y +# end of ESP NETIF Adapter + +# +# Power Management +# +# CONFIG_PM_ENABLE is not set +# end of Power Management + +# +# ESP System Settings +# +# CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set +CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y +# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set +# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set +CONFIG_ESP_SYSTEM_PD_FLASH=y + +# +# Memory protection +# +# end of Memory protection +# end of ESP System Settings + +# +# High resolution timer (esp_timer) +# +# CONFIG_ESP_TIMER_PROFILING is not set +CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y +CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y +CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584 +# CONFIG_ESP_TIMER_IMPL_FRC2 is not set +CONFIG_ESP_TIMER_IMPL_TG0_LAC=y +# end of High resolution timer (esp_timer) + +# +# Wi-Fi +# +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 +# CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y +CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32 +# CONFIG_ESP32_WIFI_CSI_ENABLED is not set +CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP32_WIFI_TX_BA_WIN=6 +CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP32_WIFI_RX_BA_WIN=6 +# CONFIG_ESP32_WIFI_NVS_ENABLED is not set +CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y +# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set +CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 +CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 +# CONFIG_ESP32_WIFI_DEBUG_LOG_ENABLE is not set +CONFIG_ESP32_WIFI_IRAM_OPT=y +CONFIG_ESP32_WIFI_RX_IRAM_OPT=y +CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y +# CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set +# end of Wi-Fi + +# +# PHY +# +CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y +CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION=y +# CONFIG_ESP32_PHY_DEFAULT_INIT_IF_INVALID is not set +# CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN is not set +CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 +CONFIG_ESP32_PHY_MAX_TX_POWER=20 +# end of PHY + +# +# Core dump +# +# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set +# CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set +CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y +# end of Core dump + +# +# FAT Filesystem support +# +# CONFIG_FATFS_CODEPAGE_DYNAMIC is not set +CONFIG_FATFS_CODEPAGE_437=y +# CONFIG_FATFS_CODEPAGE_720 is not set +# CONFIG_FATFS_CODEPAGE_737 is not set +# CONFIG_FATFS_CODEPAGE_771 is not set +# CONFIG_FATFS_CODEPAGE_775 is not set +# CONFIG_FATFS_CODEPAGE_850 is not set +# CONFIG_FATFS_CODEPAGE_852 is not set +# CONFIG_FATFS_CODEPAGE_855 is not set +# CONFIG_FATFS_CODEPAGE_857 is not set +# CONFIG_FATFS_CODEPAGE_860 is not set +# CONFIG_FATFS_CODEPAGE_861 is not set +# CONFIG_FATFS_CODEPAGE_862 is not set +# CONFIG_FATFS_CODEPAGE_863 is not set +# CONFIG_FATFS_CODEPAGE_864 is not set +# CONFIG_FATFS_CODEPAGE_865 is not set +# CONFIG_FATFS_CODEPAGE_866 is not set +# CONFIG_FATFS_CODEPAGE_869 is not set +# CONFIG_FATFS_CODEPAGE_932 is not set +# CONFIG_FATFS_CODEPAGE_936 is not set +# CONFIG_FATFS_CODEPAGE_949 is not set +# CONFIG_FATFS_CODEPAGE_950 is not set +CONFIG_FATFS_CODEPAGE=437 +CONFIG_FATFS_LFN_NONE=y +# CONFIG_FATFS_LFN_HEAP is not set +# CONFIG_FATFS_LFN_STACK is not set +CONFIG_FATFS_FS_LOCK=0 +CONFIG_FATFS_TIMEOUT_MS=10000 +CONFIG_FATFS_PER_FILE_CACHE=y +# CONFIG_FATFS_USE_FASTSEEK is not set +# end of FAT Filesystem support + +# +# Modbus configuration +# +CONFIG_FMB_COMM_MODE_TCP_EN=y +CONFIG_FMB_TCP_PORT_DEFAULT=502 +CONFIG_FMB_TCP_PORT_MAX_CONN=5 +CONFIG_FMB_TCP_CONNECTION_TOUT_SEC=20 +CONFIG_FMB_COMM_MODE_RTU_EN=y +CONFIG_FMB_COMM_MODE_ASCII_EN=y +CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND=150 +CONFIG_FMB_MASTER_DELAY_MS_CONVERT=200 +CONFIG_FMB_QUEUE_LENGTH=20 +CONFIG_FMB_PORT_TASK_STACK_SIZE=4096 +CONFIG_FMB_SERIAL_BUF_SIZE=256 +CONFIG_FMB_SERIAL_ASCII_BITS_PER_SYMB=8 +CONFIG_FMB_SERIAL_ASCII_TIMEOUT_RESPOND_MS=1000 +CONFIG_FMB_PORT_TASK_PRIO=10 +CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT=y +CONFIG_FMB_CONTROLLER_SLAVE_ID=0x00112233 +CONFIG_FMB_CONTROLLER_NOTIFY_TIMEOUT=20 +CONFIG_FMB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 +CONFIG_FMB_CONTROLLER_STACK_SIZE=4096 +CONFIG_FMB_EVENT_QUEUE_TIMEOUT=20 +CONFIG_FMB_TIMER_PORT_ENABLED=y +CONFIG_FMB_TIMER_GROUP=0 +CONFIG_FMB_TIMER_INDEX=0 +# CONFIG_FMB_TIMER_ISR_IN_IRAM is not set +# end of Modbus configuration + +# +# FreeRTOS +# +# CONFIG_FREERTOS_UNICORE is not set +CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF +CONFIG_FREERTOS_CORETIMER_0=y +# CONFIG_FREERTOS_CORETIMER_1 is not set +CONFIG_FREERTOS_HZ=100 +CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y +# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set +# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set +CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y +# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set +CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y +# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set +# CONFIG_FREERTOS_ASSERT_DISABLE is not set +CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 +CONFIG_FREERTOS_ISR_STACKSIZE=1536 +# CONFIG_FREERTOS_LEGACY_HOOKS is not set +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16 +CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y +# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set +# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set +CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y +CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y +# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set +# CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set +CONFIG_FREERTOS_DEBUG_OCDAWARE=y +# CONFIG_FREERTOS_FPU_IN_ISR is not set +# end of FreeRTOS + +# +# Heap memory debugging +# +CONFIG_HEAP_POISONING_DISABLED=y +# CONFIG_HEAP_POISONING_LIGHT is not set +# CONFIG_HEAP_POISONING_COMPREHENSIVE is not set +CONFIG_HEAP_TRACING_OFF=y +# CONFIG_HEAP_TRACING_STANDALONE is not set +# CONFIG_HEAP_TRACING_TOHOST is not set +# CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set +# end of Heap memory debugging + +# +# jsmn +# +# CONFIG_JSMN_PARENT_LINKS is not set +# CONFIG_JSMN_STRICT is not set +# end of jsmn + +# +# libsodium +# +# end of libsodium + +# +# Log output +# +# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set +# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set +# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set +CONFIG_LOG_DEFAULT_LEVEL_INFO=y +# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set +# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set +CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_LOG_COLORS=y +CONFIG_LOG_LOCATION=y +CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y +# CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set +# end of Log output + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif" +CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y +# CONFIG_LWIP_L2_TO_L3_COPY is not set +# CONFIG_LWIP_IRAM_OPTIMIZATION is not set +CONFIG_LWIP_TIMERS_ONDEMAND=y +CONFIG_LWIP_MAX_SOCKETS=10 +# CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set +# CONFIG_LWIP_SO_LINGER is not set +CONFIG_LWIP_SO_REUSE=y +CONFIG_LWIP_SO_REUSE_RXTOALL=y +CONFIG_LWIP_SO_RCVBUF=y +# CONFIG_LWIP_NETBUF_RECVINFO is not set +CONFIG_LWIP_IP4_FRAG=y +CONFIG_LWIP_IP6_FRAG=y +# CONFIG_LWIP_IP4_REASSEMBLY is not set +# CONFIG_LWIP_IP6_REASSEMBLY is not set +# CONFIG_LWIP_IP_FORWARD is not set +# CONFIG_LWIP_STATS is not set +# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set +CONFIG_LWIP_ESP_GRATUITOUS_ARP=y +CONFIG_LWIP_GARP_TMR_INTERVAL=60 +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 +CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y +# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set + +# +# DHCP server +# +CONFIG_LWIP_DHCPS_LEASE_UNIT=60 +CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 +# end of DHCP server + +# CONFIG_LWIP_AUTOIP is not set +# CONFIG_LWIP_IPV6_AUTOCONFIG is not set +CONFIG_LWIP_NETIF_LOOPBACK=y +CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 + +# +# TCP +# +CONFIG_LWIP_MAX_ACTIVE_TCP=16 +CONFIG_LWIP_MAX_LISTENING_TCP=16 +CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y +CONFIG_LWIP_TCP_MAXRTX=12 +CONFIG_LWIP_TCP_SYNMAXRTX=12 +CONFIG_LWIP_TCP_MSS=1440 +CONFIG_LWIP_TCP_TMR_INTERVAL=250 +CONFIG_LWIP_TCP_MSL=60000 +CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5744 +# CONFIG_LWIP_TCP_SND_QUEUELEN_DEFINED is not set +# CONFIG_LWIP_TCP_SNDQUEUELOWAT_DEFINED is not set +CONFIG_LWIP_TCP_WND_DEFAULT=5744 +CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 +CONFIG_LWIP_TCP_QUEUE_OOSEQ=y +# CONFIG_LWIP_TCP_SACK_OUT is not set +# CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set +CONFIG_LWIP_TCP_OVERSIZE_MSS=y +# CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set +# CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set +CONFIG_LWIP_TCP_RTO_TIME=1500 +# end of TCP + +# +# UDP +# +CONFIG_LWIP_MAX_UDP_PCBS=16 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 +# end of UDP + +# +# Checksums +# +# CONFIG_LWIP_CHECKSUM_CHECK_IP is not set +# CONFIG_LWIP_CHECKSUM_CHECK_UDP is not set +CONFIG_LWIP_CHECKSUM_CHECK_ICMP=y +# end of Checksums + +CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072 +CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y +# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set +# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU1 is not set +CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF +# CONFIG_LWIP_PPP_SUPPORT is not set +CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3 +CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5 +# CONFIG_LWIP_SLIP_SUPPORT is not set + +# +# ICMP +# +# CONFIG_LWIP_MULTICAST_PING is not set +# CONFIG_LWIP_BROADCAST_PING is not set +# end of ICMP + +# +# LWIP RAW API +# +CONFIG_LWIP_MAX_RAW_PCBS=16 +# end of LWIP RAW API + +# +# SNTP +# +CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1 +CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 +# end of SNTP + +CONFIG_LWIP_ESP_LWIP_ASSERT=y + +# +# Hooks +# +# CONFIG_LWIP_HOOK_TCP_ISN_NONE is not set +CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y +# CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y +# CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set +CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y +# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set +# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set +# end of Hooks + +# +# Debug +# +# CONFIG_LWIP_NETIF_DEBUG is not set +# CONFIG_LWIP_PBUF_DEBUG is not set +# CONFIG_LWIP_ETHARP_DEBUG is not set +# CONFIG_LWIP_API_LIB_DEBUG is not set +# CONFIG_LWIP_SOCKETS_DEBUG is not set +# CONFIG_LWIP_IP_DEBUG is not set +# CONFIG_LWIP_ICMP_DEBUG is not set +# CONFIG_LWIP_DHCP_STATE_DEBUG is not set +# CONFIG_LWIP_DHCP_DEBUG is not set +# CONFIG_LWIP_IP6_DEBUG is not set +# CONFIG_LWIP_ICMP6_DEBUG is not set +# CONFIG_LWIP_TCP_DEBUG is not set +# end of Debug +# end of LWIP + +# +# mbedTLS +# +CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y +# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set +# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set +CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y +CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 +CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 +# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set +# CONFIG_MBEDTLS_DEBUG is not set + +# +# Certificate Bundle +# +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y +# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set +# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE is not set +# CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE is not set +# end of Certificate Bundle + +# CONFIG_MBEDTLS_ECP_RESTARTABLE is not set +# CONFIG_MBEDTLS_CMAC_C is not set +CONFIG_MBEDTLS_HARDWARE_AES=y +CONFIG_MBEDTLS_HARDWARE_MPI=y +CONFIG_MBEDTLS_HARDWARE_SHA=y +# CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set +# CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set +CONFIG_MBEDTLS_HAVE_TIME=y +# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set +CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y +CONFIG_MBEDTLS_SHA512_C=y +CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y +# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set +# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set +# CONFIG_MBEDTLS_TLS_DISABLED is not set +CONFIG_MBEDTLS_TLS_SERVER=y +CONFIG_MBEDTLS_TLS_CLIENT=y +CONFIG_MBEDTLS_TLS_ENABLED=y + +# +# TLS Key Exchange Methods +# +# CONFIG_MBEDTLS_PSK_MODES is not set +CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y +# end of TLS Key Exchange Methods + +CONFIG_MBEDTLS_SSL_RENEGOTIATION=y +# CONFIG_MBEDTLS_SSL_PROTO_SSL3 is not set +CONFIG_MBEDTLS_SSL_PROTO_TLS1=y +CONFIG_MBEDTLS_SSL_PROTO_TLS1_1=y +CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y +# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set +CONFIG_MBEDTLS_SSL_ALPN=y +CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y +CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y + +# +# Symmetric Ciphers +# +CONFIG_MBEDTLS_AES_C=y +# CONFIG_MBEDTLS_CAMELLIA_C is not set +# CONFIG_MBEDTLS_DES_C is not set +CONFIG_MBEDTLS_RC4_DISABLED=y +# CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT is not set +# CONFIG_MBEDTLS_RC4_ENABLED is not set +# CONFIG_MBEDTLS_BLOWFISH_C is not set +# CONFIG_MBEDTLS_XTEA_C is not set +CONFIG_MBEDTLS_CCM_C=y +CONFIG_MBEDTLS_GCM_C=y +# end of Symmetric Ciphers + +# CONFIG_MBEDTLS_RIPEMD160_C is not set + +# +# Certificates +# +CONFIG_MBEDTLS_PEM_PARSE_C=y +CONFIG_MBEDTLS_PEM_WRITE_C=y +CONFIG_MBEDTLS_X509_CRL_PARSE_C=y +CONFIG_MBEDTLS_X509_CSR_PARSE_C=y +# end of Certificates + +CONFIG_MBEDTLS_ECP_C=y +CONFIG_MBEDTLS_ECDH_C=y +CONFIG_MBEDTLS_ECDSA_C=y +# CONFIG_MBEDTLS_ECJPAKE_C is not set +CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y +CONFIG_MBEDTLS_ECP_NIST_OPTIM=y +# CONFIG_MBEDTLS_POLY1305_C is not set +# CONFIG_MBEDTLS_CHACHA20_C is not set +# CONFIG_MBEDTLS_HKDF_C is not set +# CONFIG_MBEDTLS_THREADING_C is not set +# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set +# CONFIG_MBEDTLS_SECURITY_RISKS is not set +# end of mbedTLS + +# +# mDNS +# +CONFIG_MDNS_MAX_SERVICES=10 +CONFIG_MDNS_TASK_PRIORITY=1 +CONFIG_MDNS_TASK_STACK_SIZE=4096 +# CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY is not set +CONFIG_MDNS_TASK_AFFINITY_CPU0=y +# CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set +CONFIG_MDNS_TASK_AFFINITY=0x0 +CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 +CONFIG_MDNS_TIMER_PERIOD_MS=100 +# end of mDNS + +# +# ESP-MQTT Configurations +# +CONFIG_MQTT_PROTOCOL_311=y +CONFIG_MQTT_TRANSPORT_SSL=y +CONFIG_MQTT_TRANSPORT_WEBSOCKET=y +CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y +# CONFIG_MQTT_MSG_ID_INCREMENTAL is not set +# CONFIG_MQTT_SKIP_PUBLISH_IF_DISCONNECTED is not set +# CONFIG_MQTT_REPORT_DELETED_MESSAGES is not set +# CONFIG_MQTT_USE_CUSTOM_CONFIG is not set +# CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED is not set +# CONFIG_MQTT_CUSTOM_OUTBOX is not set +# end of ESP-MQTT Configurations + +# +# Newlib +# +CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y +# CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF is not set +# CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR is not set +# CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF is not set +# CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set +CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y +# CONFIG_NEWLIB_NANO_FORMAT is not set +# end of Newlib + +# +# NVS +# +# end of NVS + +# +# OpenSSL +# +# CONFIG_OPENSSL_DEBUG is not set +CONFIG_OPENSSL_ERROR_STACK=y +# CONFIG_OPENSSL_ASSERT_DO_NOTHING is not set +CONFIG_OPENSSL_ASSERT_EXIT=y +# end of OpenSSL + +# +# PThreads +# +CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5 +CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 +CONFIG_PTHREAD_STACK_MIN=768 +CONFIG_PTHREAD_DEFAULT_CORE_NO_AFFINITY=y +# CONFIG_PTHREAD_DEFAULT_CORE_0 is not set +# CONFIG_PTHREAD_DEFAULT_CORE_1 is not set +CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 +CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" +# end of PThreads + +# +# SPI Flash driver +# +# CONFIG_SPI_FLASH_VERIFY_WRITE is not set +# CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set +CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y +CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y +# CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set +# CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set +# CONFIG_SPI_FLASH_USE_LEGACY_IMPL is not set +# CONFIG_SPI_FLASH_SHARE_SPI1_BUS is not set +# CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set +CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y +CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20 +CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 +CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 +# CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set +# CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set + +# +# Auto-detect flash chips +# +CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP=y +# end of Auto-detect flash chips + +CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y +# end of SPI Flash driver + +# +# SPIFFS Configuration +# +CONFIG_SPIFFS_MAX_PARTITIONS=3 + +# +# SPIFFS Cache Configuration +# +CONFIG_SPIFFS_CACHE=y +CONFIG_SPIFFS_CACHE_WR=y +# CONFIG_SPIFFS_CACHE_STATS is not set +# end of SPIFFS Cache Configuration + +CONFIG_SPIFFS_PAGE_CHECK=y +CONFIG_SPIFFS_GC_MAX_RUNS=10 +# CONFIG_SPIFFS_GC_STATS is not set +CONFIG_SPIFFS_PAGE_SIZE=256 +CONFIG_SPIFFS_OBJ_NAME_LEN=32 +# CONFIG_SPIFFS_FOLLOW_SYMLINKS is not set +CONFIG_SPIFFS_USE_MAGIC=y +CONFIG_SPIFFS_USE_MAGIC_LENGTH=y +CONFIG_SPIFFS_META_LENGTH=4 +CONFIG_SPIFFS_USE_MTIME=y + +# +# Debug Configuration +# +# CONFIG_SPIFFS_DBG is not set +# CONFIG_SPIFFS_API_DBG is not set +# CONFIG_SPIFFS_GC_DBG is not set +# CONFIG_SPIFFS_CACHE_DBG is not set +# CONFIG_SPIFFS_CHECK_DBG is not set +# CONFIG_SPIFFS_TEST_VISUALISATION is not set +# end of Debug Configuration +# end of SPIFFS Configuration + +# +# TCP Transport +# +CONFIG_WS_BUFFER_SIZE=1024 +# end of TCP Transport + +# +# TinyUSB +# +# end of TinyUSB + +# +# Unity unit testing library +# +CONFIG_UNITY_ENABLE_FLOAT=y +CONFIG_UNITY_ENABLE_DOUBLE=y +# CONFIG_UNITY_ENABLE_COLOR is not set +CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y +# CONFIG_UNITY_ENABLE_FIXTURE is not set +# CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL is not set +# end of Unity unit testing library + +# +# Virtual file system +# +# CONFIG_VFS_SUPPORT_IO is not set +# end of Virtual file system + +# +# Wear Levelling +# +# CONFIG_WL_SECTOR_SIZE_512 is not set +CONFIG_WL_SECTOR_SIZE_4096=y +CONFIG_WL_SECTOR_SIZE=4096 +# end of Wear Levelling + +# +# Wi-Fi Provisioning Manager +# +CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 +CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 +# end of Wi-Fi Provisioning Manager + +# +# Supplicant +# +CONFIG_WPA_MBEDTLS_CRYPTO=y +# CONFIG_WPA_WAPI_PSK is not set +# CONFIG_WPA_DEBUG_PRINT is not set +# CONFIG_WPA_TESTING_OPTIONS is not set +# CONFIG_WPA_WPS_WARS is not set +# CONFIG_WPA_11KV_SUPPORT is not set +# end of Supplicant +# end of Component config + +# +# Compatibility options +# +# CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set +# end of Compatibility options + +# Deprecated options for backward compatibility +CONFIG_TOOLPREFIX="xtensa-esp32-elf-" +# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set +CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y +# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set +CONFIG_LOG_BOOTLOADER_LEVEL=3 +# CONFIG_APP_ROLLBACK_ENABLE is not set +# CONFIG_FLASH_ENCRYPTION_ENABLED is not set +# CONFIG_FLASHMODE_QIO is not set +# CONFIG_FLASHMODE_QOUT is not set +CONFIG_FLASHMODE_DIO=y +# CONFIG_FLASHMODE_DOUT is not set +# CONFIG_MONITOR_BAUD_9600B is not set +# CONFIG_MONITOR_BAUD_57600B is not set +CONFIG_MONITOR_BAUD_115200B=y +# CONFIG_MONITOR_BAUD_230400B is not set +# CONFIG_MONITOR_BAUD_921600B is not set +# CONFIG_MONITOR_BAUD_2MB is not set +# CONFIG_MONITOR_BAUD_OTHER is not set +CONFIG_MONITOR_BAUD_OTHER_VAL=115200 +CONFIG_MONITOR_BAUD=115200 +CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y +# CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set +CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y +# CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set +# CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set +# CONFIG_CXX_EXCEPTIONS is not set +CONFIG_STACK_CHECK_NONE=y +# CONFIG_STACK_CHECK_NORM is not set +# CONFIG_STACK_CHECK_STRONG is not set +# CONFIG_STACK_CHECK_ALL is not set +# CONFIG_WARN_WRITE_STRINGS is not set +# CONFIG_DISABLE_GCC8_WARNINGS is not set +# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set +CONFIG_ESP32_APPTRACE_DEST_NONE=y +CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y +CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=0 +CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=0 +CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0 +CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0 +CONFIG_ADC2_DISABLE_DAC=y +# CONFIG_SPIRAM_SUPPORT is not set +CONFIG_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set +CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y +CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 +# CONFIG_ULP_COPROC_ENABLED is not set +CONFIG_ULP_COPROC_RESERVE_MEM=0 +CONFIG_BROWNOUT_DET=y +CONFIG_BROWNOUT_DET_LVL_SEL_0=y +# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_4 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_BROWNOUT_DET_LVL=0 +CONFIG_REDUCE_PHY_TX_POWER=y +CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y +# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL is not set +# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set +# CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set +# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set +# CONFIG_NO_BLOBS is not set +# CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 +CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +CONFIG_MAIN_TASK_STACK_SIZE=3584 +CONFIG_IPC_TASK_STACK_SIZE=1024 +CONFIG_CONSOLE_UART_DEFAULT=y +# CONFIG_CONSOLE_UART_CUSTOM is not set +# CONFIG_ESP_CONSOLE_UART_NONE is not set +CONFIG_CONSOLE_UART=y +CONFIG_CONSOLE_UART_NUM=0 +CONFIG_CONSOLE_UART_BAUDRATE=115200 +CONFIG_INT_WDT=y +CONFIG_INT_WDT_TIMEOUT_MS=300 +CONFIG_INT_WDT_CHECK_CPU1=y +CONFIG_TASK_WDT=y +# CONFIG_TASK_WDT_PANIC is not set +CONFIG_TASK_WDT_TIMEOUT_S=5 +CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y +CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y +# CONFIG_EVENT_LOOP_PROFILING is not set +CONFIG_POST_EVENTS_FROM_ISR=y +CONFIG_POST_EVENTS_FROM_IRAM_ISR=y +# CONFIG_ESP32S2_PANIC_PRINT_HALT is not set +CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y +# CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set +# CONFIG_ESP32S2_PANIC_GDBSTUB is not set +CONFIG_TIMER_TASK_STACK_SIZE=3584 +# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set +# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set +CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y +CONFIG_MB_MASTER_TIMEOUT_MS_RESPOND=150 +CONFIG_MB_MASTER_DELAY_MS_CONVERT=200 +CONFIG_MB_QUEUE_LENGTH=20 +CONFIG_MB_SERIAL_TASK_STACK_SIZE=4096 +CONFIG_MB_SERIAL_BUF_SIZE=256 +CONFIG_MB_SERIAL_TASK_PRIO=10 +CONFIG_MB_CONTROLLER_SLAVE_ID_SUPPORT=y +CONFIG_MB_CONTROLLER_SLAVE_ID=0x00112233 +CONFIG_MB_CONTROLLER_NOTIFY_TIMEOUT=20 +CONFIG_MB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 +CONFIG_MB_CONTROLLER_STACK_SIZE=4096 +CONFIG_MB_EVENT_QUEUE_TIMEOUT=20 +CONFIG_MB_TIMER_PORT_ENABLED=y +CONFIG_MB_TIMER_GROUP=0 +CONFIG_MB_TIMER_INDEX=0 +# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set +CONFIG_TIMER_TASK_PRIORITY=1 +CONFIG_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_TIMER_QUEUE_LENGTH=10 +# CONFIG_L2_TO_L3_COPY is not set +# CONFIG_USE_ONLY_LWIP_SELECT is not set +CONFIG_ESP_GRATUITOUS_ARP=y +CONFIG_GARP_TMR_INTERVAL=60 +CONFIG_TCPIP_RECVMBOX_SIZE=32 +CONFIG_TCP_MAXRTX=12 +CONFIG_TCP_SYNMAXRTX=12 +CONFIG_TCP_MSS=1440 +CONFIG_TCP_MSL=60000 +CONFIG_TCP_SND_BUF_DEFAULT=5744 +CONFIG_TCP_WND_DEFAULT=5744 +CONFIG_TCP_RECVMBOX_SIZE=6 +CONFIG_TCP_QUEUE_OOSEQ=y +# CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set +CONFIG_TCP_OVERSIZE_MSS=y +# CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set +# CONFIG_TCP_OVERSIZE_DISABLE is not set +CONFIG_UDP_RECVMBOX_SIZE=6 +CONFIG_TCPIP_TASK_STACK_SIZE=3072 +CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY=y +# CONFIG_TCPIP_TASK_AFFINITY_CPU0 is not set +# CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set +CONFIG_TCPIP_TASK_AFFINITY=0x7FFFFFFF +# CONFIG_PPP_SUPPORT is not set +CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 +CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 +CONFIG_ESP32_PTHREAD_STACK_MIN=768 +CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY=y +# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_0 is not set +# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_1 is not set +CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1 +CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" +CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y +# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set +# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set +# End of deprecated options diff --git a/src/bobbycar-protocol b/src/bobbycar-protocol deleted file mode 160000 index 2c6fb11..0000000 --- a/src/bobbycar-protocol +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2c6fb114f2ea6e3aed243acea1afd28ca34938c9 diff --git a/src/changevaluedisplay_wifi_power_t.h b/src/changevaluedisplay_wifi_power_t.h deleted file mode 100644 index fa11ff9..0000000 --- a/src/changevaluedisplay_wifi_power_t.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -#include - -#include "changevaluedisplay.h" -#include "menudisplay.h" -#include "utils.h" -#include "actions/setvalueaction.h" -#include "actions/backproxyaction.h" -#include "icons/back.h" -#include "texts.h" - -namespace { -template<> -class ChangeValueDisplay : - public MenuDisplay, - public virtual AccessorInterface, - public virtual ActionInterface -{ - using Base = MenuDisplay; - -public: - ChangeValueDisplay(); - - void start() override; -}; - -ChangeValueDisplay::ChangeValueDisplay() -{ - constructMenuItem, StaticText>>(WIFI_POWER_19_5dBm, *this, *this); - constructMenuItem, StaticText>>(WIFI_POWER_19dBm, *this, *this); - constructMenuItem, StaticText>>(WIFI_POWER_18_5dBm, *this, *this); - constructMenuItem, StaticText>>(WIFI_POWER_17dBm, *this, *this); - constructMenuItem, StaticText>>(WIFI_POWER_15dBm, *this, *this); - constructMenuItem, StaticText>>(WIFI_POWER_13dBm, *this, *this); - constructMenuItem, StaticText>>(WIFI_POWER_11dBm, *this, *this); - constructMenuItem, StaticText>>(WIFI_POWER_8_5dBm, *this, *this); - constructMenuItem, StaticText>>(WIFI_POWER_7dBm, *this, *this); - constructMenuItem, StaticText>>(WIFI_POWER_5dBm, *this, *this); - constructMenuItem, StaticText>>(WIFI_POWER_2dBm, *this, *this); - constructMenuItem, StaticText>>(WIFI_POWER_MINUS_1dBm, *this, *this); - constructMenuItem, StaticMenuItemIcon<&icons::back>>>(*this); -} - -void ChangeValueDisplay::start() -{ - Base::start(); - - switch (const auto value = getValue()) - { - case WIFI_POWER_19_5dBm: setSelectedIndex(0); break; - case WIFI_POWER_19dBm: setSelectedIndex(1); break; - case WIFI_POWER_18_5dBm: setSelectedIndex(2); break; - case WIFI_POWER_17dBm: setSelectedIndex(3); break; - case WIFI_POWER_15dBm: setSelectedIndex(4); break; - case WIFI_POWER_13dBm: setSelectedIndex(5); break; - case WIFI_POWER_11dBm: setSelectedIndex(6); break; - case WIFI_POWER_8_5dBm: setSelectedIndex(7); break; - case WIFI_POWER_7dBm: setSelectedIndex(8); break; - case WIFI_POWER_5dBm: setSelectedIndex(9); break; - case WIFI_POWER_2dBm: setSelectedIndex(10); break; - case WIFI_POWER_MINUS_1dBm: setSelectedIndex(11); break; - default: - Serial.printf("Unknown wifi_power_t: %i\r\n", int(value)); - setSelectedIndex(12); - } -} -} diff --git a/src/displays/menus/wifiscanmenu.h b/src/displays/menus/wifiscanmenu.h deleted file mode 100644 index cf24644..0000000 --- a/src/displays/menus/wifiscanmenu.h +++ /dev/null @@ -1,123 +0,0 @@ -#pragma once - -// Arduino includes -#include -#include - -// local includes -#include "menudisplay.h" -#include "utils.h" -#include "actions/multiaction.h" -#include "actions/switchscreenaction.h" -#include "actions/dummyaction.h" -#include "icons/back.h" -#include "texts.h" -#include "types.h" - -// forward declares -namespace { -class WifiSettingsMenu; -} // namespace - -namespace { -class WifiScanMenu : public MenuDisplay, public BackActionInterface> -{ - using Base = MenuDisplay; - -public: - WifiScanMenu(); - - std::string text() const override; - - void start() override; - void update() override; - void stop() override; - -private: - millis_t m_lastScanComplete; - - std::vector>> m_reusableItems; -}; - -WifiScanMenu::WifiScanMenu() -{ - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::back>>>(); -} - -std::string WifiScanMenu::text() const -{ - auto text = std::to_string(menuItemCount()-1) + " found"; - switch (WiFi.scanComplete()) - { - case WIFI_SCAN_RUNNING: text += " (scanning)"; break; - case WIFI_SCAN_FAILED: text += " (error)"; break; - } - return text; -} - -void WifiScanMenu::start() -{ - Base::start(); - - m_lastScanComplete = 0; - - WiFi.scanNetworks(true); -} - -void WifiScanMenu::update() -{ - const auto n = WiFi.scanComplete(); - if (n >= 0) - { - const auto now = millis(); - if (!m_lastScanComplete) - { - auto backButton = takeLastMenuItem(); - - for (std::size_t i = 0; i < n; i++) - { - const auto ssid = to_string(WiFi.SSID(i)); - if (menuItemCount() <= i) - { - if (m_reusableItems.empty()) - { - auto &item = constructMenuItem>(); - item.setTitle(ssid); - } - else - { - std::unique_ptr> ptr = std::move(m_reusableItems.back()); - m_reusableItems.pop_back(); - ptr->setTitle(ssid); - emplaceMenuItem(std::move(ptr)); - } - } - else - { - auto &item = *(makeComponent*)(&getMenuItem(i)); - item.setTitle(ssid); - } - } - - while (menuItemCount() > n) - m_reusableItems.emplace_back((makeComponent*)takeLastMenuItem().release()); - - emplaceMenuItem(std::move(backButton)); - - m_lastScanComplete = now; - } - else if (now - m_lastScanComplete >= 2000) - { - m_lastScanComplete = 0; - WiFi.scanNetworks(true); - } - } - - Base::update(); -} - -void WifiScanMenu::stop() -{ - WiFi.scanDelete(); -} -} // namespace diff --git a/src/espcpputils b/src/espcpputils deleted file mode 160000 index 7bcffb0..0000000 --- a/src/espcpputils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7bcffb0253644e45d143b65ce3f6c4360434db0c diff --git a/src/esptexthelpers.h b/src/esptexthelpers.h deleted file mode 100644 index 3ce9a69..0000000 --- a/src/esptexthelpers.h +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -#include - -#include "textinterface.h" - -namespace { -template -using EspStatusTextHelper = StatusTextHelper; - -constexpr char TEXT_ESPHEAPSIZE[] = "Heap size: "; -using EspHeapSizeText = EspStatusTextHelper; - -constexpr char TEXT_ESPFREEHEAP[] = "Free heap: "; -using EspFreeHeapText = EspStatusTextHelper; - -constexpr char TEXT_ESPMINFREEHEAP[] = "Min free heap: "; -using EspMinFreeHeapText = EspStatusTextHelper; - -constexpr char TEXT_ESPMAXALLOCHEAP[] = "Max alloc heap: "; -using EspMaxAllocHeapText = EspStatusTextHelper; - -constexpr char TEXT_ESPPSRAMSIZE[] = "psram size: "; -using EspPsramSizeText = EspStatusTextHelper; - -constexpr char TEXT_ESPFREEPSRAM[] = "Free psram: "; -using EspFreePsramText = EspStatusTextHelper; - -constexpr char TEXT_ESPMINFREEPSRAM[] = "Min free psram: "; -using EspMinFreePsramText = EspStatusTextHelper; - -constexpr char TEXT_ESPMAXALLOCPSRAM[] = "Max alloc psram: "; -using EspMaxAllocPsramText = EspStatusTextHelper; - -constexpr char TEXT_ESPCHIPREVISION[] = "Chip revision: "; -using EspChipRevisionText = EspStatusTextHelper; - -constexpr char TEXT_ESPCPUFREQMHZ[] = "Cpu freq MHz: "; -using EspCpuFreqMHzText = EspStatusTextHelper; - -constexpr char TEXT_ESPCYCLECOUNT[] = "Cycle count: "; -using EspCycleCountText = EspStatusTextHelper; - -constexpr char TEXT_ESPSDKVERSION[] = "Sdk version: "; -using EspSdkVersionText = EspStatusTextHelper; - -constexpr char TEXT_ESPFLASHCHIPSIZE[] = "Flash chip size: "; -using EspFlashChipSizeText = EspStatusTextHelper; - -constexpr char TEXT_ESPFLASHCHIPSPEED[] = "Flash chip speed: "; -using EspFlashChipSpeedText = EspStatusTextHelper; - -constexpr char TEXT_ESPFLASHCHIPMODE[] = "Flash chip mode: "; -using EspFlashChipModeText = EspStatusTextHelper; // TODO: improve stringifying - -constexpr char TEXT_ESPSKETCHSIZE[] = "Sketch size: "; -using EspSketchSizeText = StaticallyCachedText>; // caching because of slow - -constexpr char TEXT_ESPSKETCHMD5[] = "Sketch MD5: "; -using EspSketchMd5Text = StaticallyCachedText>; // caching because of slow - -constexpr char TEXT_ESPFREESKETCHSPACE[] = "Free sketch space: "; -using EspFreeSketchSpaceText = EspStatusTextHelper; -} diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index 4be24eb..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,463 +0,0 @@ -#include - -#include -#ifdef FEATURE_CLOUD -#include -#include -#include -#endif - -#include -#include -#include -#include - -#include "bobbycar-protocol/bobbycar-common.h" -#include "bobbycar-protocol/bobbycar-serial.h" - -#include "globals.h" -#include "modes/defaultmode.h" -#include "modes/tempomatmode.h" -#include "displays/menus/aboutmenu.h" -#include "displays/menus/accesspointwifisettingsmenu.h" -#ifdef FEATURE_BLUETOOTH -#include "displays/menus/bluetoothsettingsmenu.h" -#endif -#include "displays/menus/bmsmenu.h" -#include "displays/menus/buzzermenu.h" -#include "displays/menus/commanddebugmenu.h" -#include "displays/menus/debugmenu.h" -#include "displays/menus/defaultmodesettingsmenu.h" -#include "displays/menus/demosmenu.h" -#include "displays/menus/dynamicdebugmenu.h" -#include "displays/menus/enablemenu.h" -#include "displays/menus/feedbackdebugmenu.h" -#include "displays/menus/gametrakmodesettingsmenu.h" -#include "displays/menus/genericwifisettingsmenu.h" -#include "displays/menus/graphsmenu.h" -#include "displays/menus/controllerhardwaresettingsmenu.h" -#include "displays/menus/invertmenu.h" -#include "displays/menus/larsmmodesettingsmenu.h" -#include "displays/menus/limitssettingsmenu.h" -#include "displays/menus/mainmenu.h" -#include "displays/menus/tempomatmodesettingsmenu.h" -#include "displays/menus/modessettingsmenu.h" -#include "displays/menus/mosfetsmenu.h" -#include "displays/menus/motorfeedbackdebugmenu.h" -#include "displays/menus/motorstatedebugmenu.h" -#include "displays/menus/profilesmenu.h" -#include "displays/menus/presetsmenu.h" -#include "displays/menus/boardcomputerhardwaresettingsmenu.h" -#include "displays/menus/selectmodemenu.h" -#include "displays/menus/settingsmenu.h" -#include "displays/menus/stationwifisettingsmenu.h" -#include "displays/menus/timersmenu.h" -#include "displays/menus/wifiscanmenu.h" -#include "displays/menus/wifisettingsmenu.h" -#include "displays/bmsdisplay.h" -#include "displays/calibratedisplay.h" -#include "displays/dpad5wiredebugdisplay.h" -#include "displays/gameoflifedisplay.h" -#include "displays/gametrakcalibratedisplay.h" -#include "displays/lockscreen.h" -#include "displays/metersdisplay.h" -#include "displays/pingpongdisplay.h" -#include "displays/poweroffdisplay.h" -#include "displays/powersupplydisplay.h" -#include "displays/spirodisplay.h" -#include "displays/starfielddisplay.h" -#include "displays/statusdisplay.h" -#include "displays/updatedisplay.h" -#include "screens.h" -#include "dpad.h" -#include "dpad3wire.h" -#include "dpad5wire.h" -#include "rotary.h" -#include "serialhandler.h" -#include "ota.h" -#include "presets.h" -#include "statistics.h" -#include "actions/wifisoftapaction.h" -#ifdef FEATURE_BLUETOOTH -#include "actions/bluetoothbeginaction.h" -#include "actions/bluetoothbeginmasteraction.h" -#include "actions/bluetoothconnectbmsaction.h" -#endif -#include "bobby_webserver.h" -#include "types.h" -#ifdef FEATURE_CAN -#include "can.h" -#endif - -namespace { -ModeInterface *lastMode{}; -millis_t lastPotiRead{}; -millis_t lastModeUpdate{}; -millis_t lastStatsUpdate{}; -millis_t lastDisplayUpdate{}; -millis_t lastDisplayRedraw{}; -} - -void printMemoryStats(const char *s) -{ - Serial.printf("MEMORY %s 8bit: %u 32bit: %u\r\n", - s, - heap_caps_get_free_size(MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT), - heap_caps_get_free_size(MALLOC_CAP_INTERNAL|MALLOC_CAP_32BIT)); -} - -#ifdef FEATURE_CLOUD -void cloudTask(void*) -{ - const esp_websocket_client_config_t config = { - .uri = "ws://iot.wattpilot.io:8080/charger/bobbycar1", - }; - esp_websocket_client_handle_t handle = esp_websocket_client_init(&config); - - if (handle) - { - Serial.println("esp websocket init succeeded"); - - if (const auto result = esp_websocket_client_start(handle); result == ESP_OK) - { - Serial.println("esp websocket start succeeded"); - - while (true) - { - if (esp_websocket_client_is_connected(handle)) - { - std::string msg = "{" - "\"type\": \"fullStatus\"," - "\"partial\": false, " - "\"status\": {" - "\"millis\":" + std::to_string(millis()) + "," - "\"front.valid\":" + (controllers.front.feedbackValid?"true":"false") + "," - "\"back.valid\":" + (controllers.back.feedbackValid?"true":"false") + "," - "\"front.left.pwm\":" + std::to_string(controllers.front.command.left.pwm) + "," - "\"front.right.pwm\":" + std::to_string(controllers.front.command.right.pwm) + "," - "\"back.left.pwm\":" + std::to_string(controllers.back.command.left.pwm) + "," - "\"back.right.pwm\":" + std::to_string(controllers.back.command.right.pwm) + "," - "\"front.volt\":" + std::to_string(controllers.front.feedback.batVoltage) + "," - "\"back.volt\":" + std::to_string(controllers.back.feedback.batVoltage) + "," - "\"front.temp\":" + std::to_string(controllers.front.feedback.boardTemp) + "," - "\"back.temp\":" + std::to_string(controllers.back.feedback.boardTemp) + "," - "\"front.bad\":" + std::to_string(controllers.front.feedback.timeoutCntSerial) + "," - "\"back.bad\":" + std::to_string(controllers.back.feedback.timeoutCntSerial) + "," - "\"front.left.speed\":" + std::to_string(controllers.front.feedback.left.speed) + "," - "\"front.right.speed\":" + std::to_string(controllers.front.feedback.right.speed) + "," - "\"back.left.speed\":" + std::to_string(controllers.back.feedback.left.speed) + "," - "\"back.right.speed\":" + std::to_string(controllers.back.feedback.right.speed) + "," - "\"front.left.current\":" + std::to_string(controllers.front.feedback.left.current) + "," - "\"front.right.current\":" + std::to_string(controllers.front.feedback.right.current) + "," - "\"back.left.current\":" + std::to_string(controllers.back.feedback.left.current) + "," - "\"back.right.current\":" + std::to_string(controllers.back.feedback.right.current) + "," - "\"front.left.error\":" + std::to_string(controllers.front.feedback.left.error) + "," - "\"front.right.error\":" + std::to_string(controllers.front.feedback.right.error) + "," - "\"back.left.error\":" + std::to_string(controllers.back.feedback.left.error) + "," - "\"back.right.error\":" + std::to_string(controllers.back.feedback.right.error) + - "}" - "}"; - - const auto sent = esp_websocket_client_send_text(handle, msg.c_str(), msg.length(), 1000 / portTICK_PERIOD_MS); - if (sent == msg.length()) - Serial.println("Sent cloud message"); - else - Serial.printf("sent=%i, msgsize=%i\r\n", sent, msg.length()); - } - else - Serial.println("Not sending cloud because not connected"); - - delay(100); - } - } - else - Serial.printf("esp websocket start failed with %s\r\n", esp_err_to_name(result)); - } - else - Serial.println("esp websocket init failed"); - - vTaskDelete(NULL); -} -#endif - -void setup() -{ - Serial.begin(115200); - Serial.setDebugOutput(true); - //Serial.println("setup()"); - -#ifdef PINS_LED - pinMode(PINS_LED, OUTPUT); - digitalWrite(PINS_LED, LOW); -#endif - - printMemoryStats("setup()"); - - pinMode(3, INPUT_PULLUP); - - currentlyReverseBeeping = false; - - initScreen(); - printMemoryStats("initScreen()"); - -#ifdef FEATURE_DPAD - bootLabel.redraw("dpad"); - dpad::init(); -#endif - -#ifdef FEATURE_DPAD_3WIRESW - bootLabel.redraw("dpad3wire"); - dpad3wire::init(); -#endif - -#ifdef FEATURE_DPAD_5WIRESW - bootLabel.redraw("dpad5wire"); - dpad5wire::init(); -#endif - -#ifdef FEATURE_ROTARY - bootLabel.redraw("rotary"); - initRotary(); -#endif - -#ifdef FEATURE_MOSFETS - bootLabel.redraw("mosfets"); - pinMode(PINS_MOSFET0, OUTPUT); - pinMode(PINS_MOSFET1, OUTPUT); - pinMode(PINS_MOSFET2, OUTPUT); - - digitalWrite(PINS_MOSFET0, LOW); - digitalWrite(PINS_MOSFET1, LOW); - digitalWrite(PINS_MOSFET2, LOW); -#endif - - bootLabel.redraw("settings"); - settings = presets::defaultSettings; - - if (settingsPersister.init()) - { - if (settingsPersister.openProfile(0)) - { - loadSettings(); - } - } - printMemoryStats("loadSettings()"); - -#ifdef FEATURE_SERIAL - bootLabel.redraw("swap front back"); - updateSwapFrontBack(); - printMemoryStats("swapFronBack()"); -#endif - - bootLabel.redraw("deviceName"); - { - uint8_t macAddress[6]; - WiFi.macAddress(&macAddress[0]); - std::sprintf(deviceName, STRING(DEVICE_PREFIX) "_%02hhx%02hhx%02hhx", macAddress[3], macAddress[4], macAddress[5]); - } - printMemoryStats("deviceName"); - - bootLabel.redraw("setHostname"); - if (!WiFi.setHostname(deviceName)) - Serial.println("Could not setHostname"); - printMemoryStats("setHostname()"); - - bootLabel.redraw("softAPsetHostname"); - if (!WiFi.softAPsetHostname(deviceName)) - Serial.println("Could not softAPsetHostname"); - printMemoryStats("softAPsetHostname()"); - - bootLabel.redraw("WiFi mode"); - if (!WiFi.mode(settings.wifiSettings.autoWifiMode)) - Serial.println("Could not set mode to WIFI_AP_STA"); - printMemoryStats("WiFi.mode()"); - - if (settings.wifiSettings.autoEnableAp) - { - bootLabel.redraw("WiFi softAp"); - WifiSoftApAction{}.triggered(); - } - printMemoryStats("WifiSoftApAction()"); - - bootLabel.redraw("WiFi begin"); - if (!WiFi.begin("realraum", "r3alraum")) - Serial.println("Could not begin WiFi"); - printMemoryStats("WiFi.begin()"); - -#ifdef FEATURE_BLUETOOTH - if (settings.bluetoothSettings.autoBluetoothMode == BluetoothMode::Master) - { - bootLabel.redraw("bluetooth begin master"); - BluetoothBeginMasterAction{}.triggered(); - printMemoryStats("BluetoothBeginMasterAction()"); -#ifdef FEATURE_BMS - if (settings.autoConnectBms) - { - bootLabel.redraw("connect BMS"); - BluetoothConnectBmsAction{}.triggered(); - printMemoryStats("BluetoothConnectBmsAction()"); - } -#endif - } - else if (settings.bluetoothSettings.autoBluetoothMode == BluetoothMode::Slave) - { - bootLabel.redraw("bluetooth begin"); - BluetoothBeginAction{}.triggered(); - printMemoryStats("BluetoothBeginAction()"); - } -#endif - -#ifdef FEATURE_CAN - can::initCan(); -#endif - -#ifdef FEATURE_SERIAL - bootLabel.redraw("front Serial begin"); - controllers.front.serial.get().begin(38400, SERIAL_8N1, PINS_RX1, PINS_TX1); - - bootLabel.redraw("back Serial begin"); - controllers.back.serial.get().begin(38400, SERIAL_8N1, PINS_RX2, PINS_TX2); -#endif - - raw_gas = std::nullopt; - raw_brems = std::nullopt; - gas = std::nullopt; - brems = std::nullopt; - - for (Controller &controller : controllers) - controller.command.buzzer = {}; - - currentMode = &modes::defaultMode; - -#ifdef FEATURE_ARDUINOOTA - bootLabel.redraw("ota"); - initOta(); - printMemoryStats("initOta()"); -#endif - -#ifdef FEATURE_WEBSERVER - bootLabel.redraw("webserver"); - initWebserver(); - printMemoryStats("initWebserver()"); -#endif - - bootLabel.redraw("potis"); - readPotis(); - printMemoryStats("readPotis()"); - -#ifdef FEATURE_CLOUD - if (const auto result = xTaskCreatePinnedToCore(cloudTask, "cloudTask", 4096, nullptr, 10, nullptr, 1); result == pdTRUE) - Serial.println("cloud task create succeeded"); - else - Serial.printf("cloud task create failed\r\n"); -#endif - -#if defined(FEATURE_DPAD_5WIRESW) && defined(DPAD_5WIRESW_DEBUG) - switchScreen(); - return; -#endif - - if (!gas || !brems || *gas > 200.f || *brems > 200.f) - switchScreen(true); - else - switchScreen(); - - printMemoryStats("switchScreen()"); -} - -void loop() -{ - //Serial.println("loop()"); - //printMemoryStats("loop()"); - - const auto now = millis(); - -#ifdef FEATURE_DPAD - dpad::update(); -#endif - -#ifdef FEATURE_DPAD_3WIRESW - dpad3wire::update(); -#endif - -#ifdef FEATURE_DPAD_5WIRESW - dpad5wire::update(); -#endif - - if (!lastPotiRead || now - lastPotiRead >= 1000/settings.boardcomputerHardware.timersSettings.potiReadRate) - { - readPotis(); - - lastPotiRead = now; - } - - if (!lastModeUpdate || now - lastModeUpdate >= 1000/settings.boardcomputerHardware.timersSettings.modeUpdateRate) - { - if (lastMode != currentMode) - { - if (lastMode) - lastMode->stop(); - lastMode = currentMode; - if (currentMode) - currentMode->start(); - } - - if (currentMode) - currentMode->update(); - - lastModeUpdate = now; - - performance.current++; - } - - if (!lastStatsUpdate || now - lastStatsUpdate >= 1000/settings.boardcomputerHardware.timersSettings.statsUpdateRate) - { - updateAccumulators(); - pushStats(); - lastStatsUpdate = now; - } - - if (!lastDisplayUpdate || now - lastDisplayUpdate >= 1000/settings.boardcomputerHardware.timersSettings.displayUpdateRate) - { - updateDisplay(); - - lastDisplayUpdate = now; - } - - if (!lastDisplayRedraw || now - lastDisplayRedraw >= 1000/settings.boardcomputerHardware.timersSettings.displayRedrawRate) - { - redrawDisplay(); - - lastDisplayRedraw = now; - } - - if (now - performance.lastTime >= 1000) - { - performance.last = performance.current; - performance.current = 0; - performance.lastTime = now; - } - -#ifdef FEATURE_CAN - can::parseCanInput(); -#endif - -#ifdef FEATURE_SERIAL - for (Controller &controller : controllers) - controller.parser.update(); -#endif - - handleSerial(); - -#ifdef FEATURE_ARDUINOOTA - handleOta(); -#endif - -#ifdef FEATURE_WEBSERVER - handleWebserver(); -#endif - -#ifdef FEATURE_BMS - bms::update(); -#endif -} diff --git a/src/wifiaccessors.h b/src/wifiaccessors.h deleted file mode 100644 index 9bca794..0000000 --- a/src/wifiaccessors.h +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -#include - -#include "accessorinterface.h" - -namespace { -struct WifiModeAccessor : public virtual AccessorInterface -{ - wifi_mode_t getValue() const override { return WiFi.getMode(); } - void setValue(wifi_mode_t value) override - { - if (!WiFi.mode(value)) - Serial.println("Could not change WiFi mode!"); - // TODO: better error handling - } -}; - -struct WifiSleepAccessor : public virtual AccessorInterface -{ - bool getValue() const override { return WiFi.getSleep(); } - void setValue(bool value) override - { - if (!WiFi.setSleep(value)) - Serial.println("Could not set WiFi sleep!"); - // TODO: better error handling - } -}; - -struct WifiTxPowerAccessor : public virtual AccessorInterface -{ - wifi_power_t getValue() const override { return WiFi.getTxPower(); } - void setValue(wifi_power_t value) override - { - if (!WiFi.setTxPower(value)) - Serial.println("Could not set WiFi tx power!"); - // TODO: better error handling - } -}; - - - -struct WifiAutoConnectAccessor : public virtual AccessorInterface -{ - bool getValue() const override { return WiFi.getAutoConnect(); } - void setValue(bool value) override - { - if (!WiFi.setAutoConnect(value)) - Serial.println("Could not set WiFi autoConnect!"); - // TODO: better error handling - } -}; - -struct WifiAutoReconnectAccessor : public virtual AccessorInterface -{ - bool getValue() const override { return WiFi.getAutoReconnect(); } - void setValue(bool value) override - { - if (!WiFi.setAutoReconnect(value)) - Serial.println("Could not set WiFi autoReconnect!"); - // TODO: better error handling - } -}; -} diff --git a/src/wifitexthelpers.h b/src/wifitexthelpers.h deleted file mode 100644 index a1964ef..0000000 --- a/src/wifitexthelpers.h +++ /dev/null @@ -1,117 +0,0 @@ -#pragma once - -#include - -#include "textinterface.h" -#include "utils.h" - -namespace { -struct WifiStatusBitsText : public virtual TextInterface { -public: - std::string text() const override { return "statusBits: " + std::to_string(WiFi.getStatusBits()); } -}; -struct WifiChannelText : public virtual TextInterface { -public: - std::string text() const override { return "channel: " + std::to_string(WiFi.channel()); } -}; - - -struct WifiIsConnectedText : public virtual TextInterface { -public: - std::string text() const override { return "isConnected: " + std::to_string(WiFi.isConnected()); } -}; -struct WifiLocalIpText : public virtual TextInterface { -public: - std::string text() const override { return "localIP: " + to_string(WiFi.localIP()); } -}; -struct WifiMacAddressText : public virtual TextInterface { -public: - std::string text() const override { return "macAddress: " + to_string(WiFi.macAddress()); } -}; -struct WifiSubnetMaskText : public virtual TextInterface { -public: - std::string text() const override { return "subnetMask: " + to_string(WiFi.subnetMask()); } -}; -struct WifiGatewayIpText : public virtual TextInterface { -public: - std::string text() const override { return "gatewayIP: " + to_string(WiFi.gatewayIP()); } -}; -struct WifiDnsIpText : public virtual TextInterface { -public: - std::string text() const override { return "dnsIP: " + to_string(WiFi.dnsIP()); } -}; -struct WifiBroadcastIpText : public virtual TextInterface { -public: - std::string text() const override { return "broadcastIP: " + to_string(WiFi.broadcastIP()); } -}; -struct WifiNetworkIdText : public virtual TextInterface { -public: - std::string text() const override { return "networkID: " + to_string(WiFi.networkID()); } -}; -struct WifiSubnetCIDRText : public virtual TextInterface { -public: - std::string text() const override { return "subnetCIDR: " + to_string(WiFi.subnetCIDR()); } -}; -struct WifiLocalIpV6Text : public virtual TextInterface { -public: - std::string text() const override { return "localIPv6: " + to_string(WiFi.localIPv6()); } -}; -struct WifiHostnameText : public virtual TextInterface { -public: - std::string text() const override { return "hostname: " + to_string(WiFi.getHostname()); } -}; -struct WifiStatusText : public virtual TextInterface { -public: - std::string text() const override { return "status: " + to_string(WiFi.status()); } -}; -struct WifiSsidText : public virtual TextInterface { -public: - std::string text() const override { return "SSID: " + to_string(WiFi.SSID()); } -}; -struct WifiPskText : public virtual TextInterface { -public: - std::string text() const override { return "psk: " + to_string(WiFi.psk()); } -}; -struct WifiBssidText : public virtual TextInterface { -public: - std::string text() const override { return "BSSID: " + to_string(WiFi.BSSIDstr()); } -}; -struct WifiRssiText : public virtual TextInterface { -public: - std::string text() const override { return "RSSI: " + to_string(WiFi.RSSI()); } -}; - - -class WifiSoftApGetStationNumText : public virtual TextInterface { -public: - std::string text() const override { return "softAPgetStationNum: " + to_string(WiFi.softAPgetStationNum()); } -}; -class WifiSoftApIpText : public virtual TextInterface { -public: - std::string text() const override { return "softAPIP: " + to_string(WiFi.softAPIP()); } -}; -class WifiSoftApBroadcastIpText : public virtual TextInterface { -public: - std::string text() const override { return "softAPBroadcastIP: " + to_string(WiFi.softAPBroadcastIP()); } -}; -class WifiSoftApNetworkIdText : public virtual TextInterface { -public: - std::string text() const override { return "softAPNetworkID: " + to_string(WiFi.softAPNetworkID()); } -}; -class WifiSoftApSubnetCidrText : public virtual TextInterface { -public: - std::string text() const override { return "softAPSubnetCIDR: " + std::to_string(WiFi.softAPSubnetCIDR()); } -}; -class WifiSoftApIpV6Text : public virtual TextInterface { -public: - std::string text() const override { return "softAPIPv6: " + to_string(WiFi.softAPIPv6()); } -}; -class WifiSoftApHostnameText : public virtual TextInterface { -public: - std::string text() const override { return "softAPgetHostname: " + to_string(WiFi.softAPgetHostname()); } -}; -class WifiSoftApMacAddressText : public virtual TextInterface { -public: - std::string text() const override { return "softAPmacAddress: " + to_string(WiFi.softAPmacAddress()); } -}; -} diff --git a/test/README b/test/README deleted file mode 100644 index df5066e..0000000 --- a/test/README +++ /dev/null @@ -1,11 +0,0 @@ - -This directory is intended for PIO Unit Testing and project tests. - -Unit Testing is a software testing method by which individual units of -source code, sets of one or more MCU program modules together with associated -control data, usage procedures, and operating procedures, are tested to -determine whether they are fit for use. Unit testing finds problems early -in the development cycle. - -More information about PIO Unit Testing: -- https://docs.platformio.org/page/plus/unit-testing.html