Merge pull request #203 from bobbycar-graz/input-refactorings
Input reafactorings
This commit is contained in:
Submodule components/esp-gui-lib updated: 3d01a04aa4...ec002d6058
@ -80,10 +80,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DDPAD_6WIRESW_DEBUG
|
||||
-DFEATURE_GSCHISSENE_DIODE
|
||||
|
||||
-DDEFAULT_GASMIN=842
|
||||
-DDEFAULT_GASMAX=2480
|
||||
-DDEFAULT_BREMSMIN=826
|
||||
-DDEFAULT_BREMSMAX=2502
|
||||
-DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
|
@ -80,10 +80,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DDPAD_6WIRESW_DEBUG
|
||||
-DFEATURE_GSCHISSENE_DIODE
|
||||
|
||||
-DDEFAULT_GASMIN=842
|
||||
-DDEFAULT_GASMAX=2480
|
||||
-DDEFAULT_BREMSMIN=826
|
||||
-DDEFAULT_BREMSMAX=2502
|
||||
-DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
|
@ -61,10 +61,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
-DDPAD_5WIRESW_QUICKACTION_DOWN=3
|
||||
-DDPAD_5WIRESW_QUICKACTION_UP=6
|
||||
# -DDPAD_5WIRESW_DEBUG
|
||||
-DDEFAULT_GASMIN=200
|
||||
-DDEFAULT_GASMAX=1070
|
||||
-DDEFAULT_BREMSMIN=270
|
||||
-DDEFAULT_BREMSMAX=1800
|
||||
-DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
|
@ -57,10 +57,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
-DDPAD_5WIRESW_PROFILE2=7
|
||||
-DDPAD_5WIRESW_PROFILE3=3
|
||||
# -DDPAD_5WIRESW_DEBUG
|
||||
-DDEFAULT_GASMIN=842
|
||||
-DDEFAULT_GASMAX=2480
|
||||
-DDEFAULT_BREMSMIN=826
|
||||
-DDEFAULT_BREMSMAX=2502
|
||||
# -DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
|
@ -57,10 +57,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DDPAD_5WIRESW_PROFILE2=7
|
||||
# -DDPAD_5WIRESW_PROFILE3=3
|
||||
# -DDPAD_5WIRESW_DEBUG
|
||||
-DDEFAULT_GASMIN=184
|
||||
-DDEFAULT_GASMAX=1329
|
||||
-DDEFAULT_BREMSMIN=28
|
||||
-DDEFAULT_BREMSMAX=500
|
||||
-DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
|
@ -80,10 +80,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DDPAD_6WIRESW_DEBUG
|
||||
# -DFEATURE_GSCHISSENE_DIODE
|
||||
|
||||
-DDEFAULT_GASMIN=842
|
||||
-DDEFAULT_GASMAX=2480
|
||||
-DDEFAULT_BREMSMIN=826
|
||||
-DDEFAULT_BREMSMAX=2502
|
||||
# -DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
|
@ -61,10 +61,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
-DDPAD_5WIRESW_QUICKACTION_DOWN=3
|
||||
-DDPAD_5WIRESW_QUICKACTION_UP=6
|
||||
# -DDPAD_5WIRESW_DEBUG
|
||||
-DDEFAULT_GASMIN=842
|
||||
-DDEFAULT_GASMAX=2480
|
||||
-DDEFAULT_BREMSMIN=826
|
||||
-DDEFAULT_BREMSMAX=2502
|
||||
-DFEATURE_BLE
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
|
@ -1,7 +1,81 @@
|
||||
set(headers
|
||||
accessorhelpers.h
|
||||
battery.h
|
||||
ble_bobby.h
|
||||
bletexthelpers.h
|
||||
bluetooth_bobby.h
|
||||
bluetoothmode.h
|
||||
bluetoothtexthelpers.h
|
||||
bmsutils.h
|
||||
bobbybuttons.h
|
||||
bobbyerrorhandler.h
|
||||
buildserver.h
|
||||
buttons.h
|
||||
can.h
|
||||
changevaluedisplay_bluetoothmode.h
|
||||
changevaluedisplay_controlmode.h
|
||||
changevaluedisplay_controltype.h
|
||||
changevaluedisplay_handbremsmode.h
|
||||
changevaluedisplay_larsmmode_mode.h
|
||||
changevaluedisplay_unifiedmodelmode.h
|
||||
cloud.h
|
||||
cloudtexthelpers.h
|
||||
controller.h
|
||||
debugcolorhelpers.h
|
||||
debuginputhandler.h
|
||||
debugtexthelpers.h
|
||||
dnsannounce.h
|
||||
dpad.h
|
||||
dpad3wire.h
|
||||
dpad5wire.h
|
||||
dpad5wire_2out.h
|
||||
dpad6wire.h
|
||||
drivingstatistics.h
|
||||
espnowfunctions.h
|
||||
esptexthelpers.h
|
||||
feedbackparser.h
|
||||
globals.h
|
||||
handbremse.h
|
||||
ledstrip.h
|
||||
ledstripdefines.h
|
||||
macros_bobbycar.h
|
||||
modeinterface.h
|
||||
modes.h
|
||||
mosfets.h
|
||||
newsettings.h
|
||||
ota.h
|
||||
potis.h
|
||||
presets.h
|
||||
qrimport.h
|
||||
rotary.h
|
||||
screens.h
|
||||
serial_bobby.h
|
||||
settings.h
|
||||
settingspersister.h
|
||||
settingsutils.h
|
||||
statistics.h
|
||||
statustexthelper.h
|
||||
taskmanager.h
|
||||
texts.h
|
||||
time_bobbycar.h
|
||||
types.h
|
||||
udpcloud.h
|
||||
unifiedmodelmode.h
|
||||
utils.h
|
||||
webserver.h
|
||||
webserver_displaycontrol.h
|
||||
webserver_dumpnvs.h
|
||||
webserver_lock.h
|
||||
webserver_newsettings.h
|
||||
webserver_ota.h
|
||||
webserver_settings.h
|
||||
wifi_bobbycar.h
|
||||
wifiguiutils.h
|
||||
accessors/globalaccessors.h
|
||||
accessors/settingsaccessors.h
|
||||
accessors/wifiaccessors.h
|
||||
accessors/wifiapconfigaccessors.h
|
||||
accessors/wifistaconfigaccessors.h
|
||||
actions/assertaction.h
|
||||
actions/bluetoothbeginaction.h
|
||||
actions/bluetoothbeginmasteraction.h
|
||||
@ -19,7 +93,6 @@ set(headers
|
||||
actions/ledstripblinkactions.h
|
||||
actions/loadsettingsaction.h
|
||||
actions/modesettingsaction.h
|
||||
actions/multiaction.h
|
||||
actions/qraction.h
|
||||
actions/rebootaction.h
|
||||
actions/savesettingsaction.h
|
||||
@ -27,41 +100,18 @@ set(headers
|
||||
actions/tempomatmodeapplycurrentpeedaction.h
|
||||
actions/updateswapfrontbackaction.h
|
||||
actions/wifiscanaction.h
|
||||
battery.h
|
||||
ble_bobby.h
|
||||
bletexthelpers.h
|
||||
bluetooth_bobby.h
|
||||
bluetoothmode.h
|
||||
bluetoothtexthelpers.h
|
||||
bmsutils.h
|
||||
buildserver.h
|
||||
buttons.h
|
||||
bobbybuttons.h
|
||||
can.h
|
||||
changevaluedisplay_bluetoothmode.h
|
||||
changevaluedisplay_controlmode.h
|
||||
changevaluedisplay_controltype.h
|
||||
changevaluedisplay_handbremsmode.h
|
||||
changevaluedisplay_larsmmode_mode.h
|
||||
changevaluedisplay_unifiedmodelmode.h
|
||||
changevaluedisplay_wifi_mode_t.h
|
||||
changevaluedisplay_wifi_power_t.h
|
||||
cloud.h
|
||||
cloudtexthelpers.h
|
||||
controller.h
|
||||
debugcolorhelpers.h
|
||||
debuginputhandler.h
|
||||
debugtexthelpers.h
|
||||
actions/wifistascanaction.h
|
||||
actions/wifistascanclearaction.h
|
||||
displays/bmsdisplay.h
|
||||
displays/bobbychangevaluedisplay.h
|
||||
displays/bobbydisplay.h
|
||||
displays/bobbydisplaywithtitle.h
|
||||
displays/bobbygraphdisplay.h
|
||||
displays/bobbymenudisplay.h
|
||||
displays/bobbypopupdisplay.h
|
||||
displays/bobbysplitgraphdisplay.h
|
||||
displays/calibratedisplay.h
|
||||
displays/calibratevoltagedisplay.h
|
||||
displays/qrdisplay.h
|
||||
displays/dpad5wire2outdebugdisplay.h
|
||||
displays/dpad5wiredebugdisplay.h
|
||||
displays/dpad6wiredebugdisplay.h
|
||||
@ -70,6 +120,7 @@ set(headers
|
||||
displays/ledstripcolorsdisplay.h
|
||||
displays/lockscreen.h
|
||||
displays/menudisplaywithtime.cpp
|
||||
displays/menudisplaywithtime.h
|
||||
displays/menus/aboutmenu.h
|
||||
displays/menus/batterydebugmenu.h
|
||||
displays/menus/batterymenu.h
|
||||
@ -90,8 +141,8 @@ set(headers
|
||||
displays/menus/espnowmenu.h
|
||||
displays/menus/espnowsettingsmenu.h
|
||||
displays/menus/feedbackdebugmenu.h
|
||||
displays/menus/garagenmenu.h
|
||||
displays/menus/gametrakmodesettingsmenu.h
|
||||
displays/menus/garagenmenu.h
|
||||
displays/menus/graphsmenu.h
|
||||
displays/menus/greenpassmenu.h
|
||||
displays/menus/handbremssettingsmenu.h
|
||||
@ -125,31 +176,24 @@ set(headers
|
||||
displays/menus/timersmenu.h
|
||||
displays/menus/timesettingsmenu.h
|
||||
displays/menus/udpcloudsettingsmenu.h
|
||||
displays/menus/wifistasettingsmenu.h
|
||||
displays/menus/wifiapclientsmenu.h
|
||||
displays/menus/wifiapsettingsmenu.h
|
||||
displays/menus/wifistaconfigentrymenu.h
|
||||
displays/menus/wifistaconfigsmenu.h
|
||||
displays/menus/wifistascanentrymenu.h
|
||||
displays/menus/wifistascanmenu.h
|
||||
displays/menus/wifistasettingsmenu.h
|
||||
displays/metersdisplay.h
|
||||
displays/pingpongdisplay.h
|
||||
displays/popups/alertdisplay.h
|
||||
displays/poweroffdisplay.h
|
||||
displays/powersupplydisplay.h
|
||||
displays/qrcodedebug.h
|
||||
displays/qrdisplay.h
|
||||
displays/qrimportdisplay.h
|
||||
displays/spirodisplay.h
|
||||
displays/starfielddisplay.h
|
||||
displays/statusdisplay.h
|
||||
displays/updatedisplay.h
|
||||
dnsannounce.h
|
||||
dpad.h
|
||||
dpad3wire.h
|
||||
dpad5wire.h
|
||||
dpad5wire_2out.h
|
||||
dpad6wire.h
|
||||
drivingstatistics.h
|
||||
esptexthelpers.h
|
||||
espnowfunctions.h
|
||||
feedbackparser.h
|
||||
globals.h
|
||||
handbremse.h
|
||||
icons/alert.h
|
||||
icons/battery.h
|
||||
icons/bluetooth.h
|
||||
@ -175,11 +219,6 @@ set(headers
|
||||
icons/time.h
|
||||
icons/update.h
|
||||
icons/wifi.h
|
||||
ledstrip.h
|
||||
ledstripdefines.h
|
||||
macros_bobbycar.h
|
||||
modeinterface.h
|
||||
modes.h
|
||||
modes/defaultmode.h
|
||||
modes/gametrakmode.h
|
||||
modes/ignoreinputmode.h
|
||||
@ -187,57 +226,87 @@ set(headers
|
||||
modes/motortestmode.h
|
||||
modes/remotecontrolmode.h
|
||||
modes/tempomatmode.h
|
||||
mosfets.h
|
||||
newsettings.h
|
||||
ota.h
|
||||
potis.h
|
||||
presets.h
|
||||
qrimport.h
|
||||
rotary.h
|
||||
screens.h
|
||||
serial_bobby.h
|
||||
settings.h
|
||||
settingspersister.h
|
||||
settingsutils.h
|
||||
statistics.h
|
||||
statustexthelper.h
|
||||
taskmanager.h
|
||||
texts.h
|
||||
time_bobbycar.h
|
||||
types.h
|
||||
udpcloud.h
|
||||
unifiedmodelmode.h
|
||||
utils.h
|
||||
webserver.h
|
||||
webserver_displaycontrol.h
|
||||
webserver_dumpnvs.h
|
||||
webserver_lock.h
|
||||
webserver_ota.h
|
||||
webserver_settings.h
|
||||
webserver_newsettings.h
|
||||
widgets/doubleprogressbar.h
|
||||
displays/menudisplaywithtime.h
|
||||
wifi_bobbycar.h
|
||||
texthelpers/networktexthelpers.h
|
||||
texthelpers/wifistatexthelpers.h
|
||||
wifiguiutils.h
|
||||
accessors/wifistaconfigaccessors.h
|
||||
displays/menus/wifistascanmenu.h
|
||||
displays/menus/wifistaconfigsmenu.h
|
||||
displays/menus/wifistascanentrymenu.h
|
||||
displays/menus/wifiapclientsmenu.h
|
||||
displays/menus/wifistaconfigentrymenu.h
|
||||
texthelpers/wifistaconfigtexthelpers.h
|
||||
accessors/wifiapconfigaccessors.h
|
||||
texthelpers/wifiaptexthelpers.h
|
||||
actions/wifistascanaction.h
|
||||
actions/wifistascanclearaction.h
|
||||
texthelpers/wifistaconfigtexthelpers.h
|
||||
texthelpers/wifistatexthelpers.h
|
||||
widgets/doubleprogressbar.h
|
||||
)
|
||||
|
||||
set(sources
|
||||
accessors/globalaccessors.cpp
|
||||
accessors/settingsaccessors.cpp
|
||||
accessors/wifiaccessors.cpp
|
||||
battery.cpp
|
||||
ble_bobby.cpp
|
||||
bletexthelpers.cpp
|
||||
bluetooth_bobby.cpp
|
||||
bluetoothmode.cpp
|
||||
bluetoothtexthelpers.cpp
|
||||
bmsutils.cpp
|
||||
bobbybuttons.cpp
|
||||
bobbyerrorhandler.cpp
|
||||
buildserver.cpp
|
||||
buttons.cpp
|
||||
can.cpp
|
||||
changevaluedisplay_bluetoothmode.cpp
|
||||
changevaluedisplay_controlmode.cpp
|
||||
changevaluedisplay_controltype.cpp
|
||||
changevaluedisplay_handbremsmode.cpp
|
||||
changevaluedisplay_larsmmode_mode.cpp
|
||||
changevaluedisplay_unifiedmodelmode.cpp
|
||||
cloud.cpp
|
||||
cloudtexthelpers.cpp
|
||||
controller.cpp
|
||||
debugcolorhelpers.cpp
|
||||
debuginputhandler.cpp
|
||||
debugtexthelpers.cpp
|
||||
dnsannounce.cpp
|
||||
dpad.cpp
|
||||
dpad3wire.cpp
|
||||
dpad5wire.cpp
|
||||
dpad5wire_2out.cpp
|
||||
dpad6wire.cpp
|
||||
drivingstatistics.cpp
|
||||
espnowfunctions.cpp
|
||||
esptexthelpers.cpp
|
||||
feedbackparser.cpp
|
||||
globals.cpp
|
||||
handbremse.cpp
|
||||
ledstrip.cpp
|
||||
ledstripdefines.cpp
|
||||
macros_bobbycar.cpp
|
||||
main.cpp
|
||||
modeinterface.cpp
|
||||
modes.cpp
|
||||
mosfets.cpp
|
||||
newsettings.cpp
|
||||
ota.cpp
|
||||
potis.cpp
|
||||
presets.cpp
|
||||
qrimport.cpp
|
||||
rotary.cpp
|
||||
screens.cpp
|
||||
serial_bobby.cpp
|
||||
settings.cpp
|
||||
settingspersister.cpp
|
||||
settingsutils.cpp
|
||||
statistics.cpp
|
||||
statustexthelper.cpp
|
||||
taskmanager.cpp
|
||||
texts.cpp
|
||||
time_bobbycar.cpp
|
||||
types.cpp
|
||||
udpcloud.cpp
|
||||
unifiedmodelmode.cpp
|
||||
utils.cpp
|
||||
webserver.cpp
|
||||
webserver_displaycontrol.cpp
|
||||
webserver_dumpnvs.cpp
|
||||
webserver_lock.cpp
|
||||
webserver_newsettings.cpp
|
||||
webserver_ota.cpp
|
||||
webserver_settings.cpp
|
||||
wifi_bobbycar.cpp
|
||||
wifiguiutils.cpp
|
||||
accessors/wifistaconfigaccessors.cpp
|
||||
actions/assertaction.cpp
|
||||
actions/bluetoothbeginaction.cpp
|
||||
actions/bluetoothbeginmasteraction.cpp
|
||||
@ -255,7 +324,6 @@ set(sources
|
||||
actions/ledstripblinkactions.cpp
|
||||
actions/loadsettingsaction.cpp
|
||||
actions/modesettingsaction.cpp
|
||||
actions/multiaction.cpp
|
||||
actions/qraction.cpp
|
||||
actions/rebootaction.cpp
|
||||
actions/savesettingsaction.cpp
|
||||
@ -263,41 +331,18 @@ set(sources
|
||||
actions/tempomatmodeapplycurrentpeedaction.cpp
|
||||
actions/updateswapfrontbackaction.cpp
|
||||
actions/wifiscanaction.cpp
|
||||
battery.cpp
|
||||
ble_bobby.cpp
|
||||
bletexthelpers.cpp
|
||||
bluetooth_bobby.cpp
|
||||
bluetoothmode.cpp
|
||||
bluetoothtexthelpers.cpp
|
||||
bmsutils.cpp
|
||||
buildserver.cpp
|
||||
buttons.cpp
|
||||
bobbybuttons.cpp
|
||||
can.cpp
|
||||
changevaluedisplay_bluetoothmode.cpp
|
||||
changevaluedisplay_controlmode.cpp
|
||||
changevaluedisplay_controltype.cpp
|
||||
changevaluedisplay_handbremsmode.cpp
|
||||
changevaluedisplay_larsmmode_mode.cpp
|
||||
changevaluedisplay_unifiedmodelmode.cpp
|
||||
changevaluedisplay_wifi_mode_t.cpp
|
||||
changevaluedisplay_wifi_power_t.cpp
|
||||
cloud.cpp
|
||||
cloudtexthelpers.cpp
|
||||
controller.cpp
|
||||
debugcolorhelpers.cpp
|
||||
debuginputhandler.cpp
|
||||
debugtexthelpers.cpp
|
||||
actions/wifistascanaction.cpp
|
||||
actions/wifistascanclearaction.cpp
|
||||
displays/bmsdisplay.cpp
|
||||
displays/bobbychangevaluedisplay.cpp
|
||||
displays/bobbydisplay.cpp
|
||||
displays/bobbydisplaywithtitle.cpp
|
||||
displays/bobbygraphdisplay.cpp
|
||||
displays/bobbymenudisplay.cpp
|
||||
displays/bobbypopupdisplay.cpp
|
||||
displays/bobbysplitgraphdisplay.cpp
|
||||
displays/calibratedisplay.cpp
|
||||
displays/calibratevoltagedisplay.cpp
|
||||
displays/qrdisplay.cpp
|
||||
displays/dpad5wire2outdebugdisplay.cpp
|
||||
displays/dpad5wiredebugdisplay.cpp
|
||||
displays/dpad6wiredebugdisplay.cpp
|
||||
@ -325,8 +370,8 @@ set(sources
|
||||
displays/menus/espnowmenu.cpp
|
||||
displays/menus/espnowsettingsmenu.cpp
|
||||
displays/menus/feedbackdebugmenu.cpp
|
||||
displays/menus/garagenmenu.cpp
|
||||
displays/menus/gametrakmodesettingsmenu.cpp
|
||||
displays/menus/garagenmenu.cpp
|
||||
displays/menus/graphsmenu.cpp
|
||||
displays/menus/greenpassmenu.cpp
|
||||
displays/menus/handbremssettingsmenu.cpp
|
||||
@ -360,31 +405,24 @@ set(sources
|
||||
displays/menus/timersmenu.cpp
|
||||
displays/menus/timesettingsmenu.cpp
|
||||
displays/menus/udpcloudsettingsmenu.cpp
|
||||
displays/menus/wifistasettingsmenu.cpp
|
||||
displays/menus/wifiapclientsmenu.cpp
|
||||
displays/menus/wifiapsettingsmenu.cpp
|
||||
displays/menus/wifistaconfigentrymenu.cpp
|
||||
displays/menus/wifistaconfigsmenu.cpp
|
||||
displays/menus/wifistascanentrymenu.cpp
|
||||
displays/menus/wifistascanmenu.cpp
|
||||
displays/menus/wifistasettingsmenu.cpp
|
||||
displays/metersdisplay.cpp
|
||||
displays/pingpongdisplay.cpp
|
||||
displays/popups/alertdisplay.cpp
|
||||
displays/poweroffdisplay.cpp
|
||||
displays/powersupplydisplay.cpp
|
||||
displays/qrcodedebug.cpp
|
||||
displays/qrdisplay.cpp
|
||||
displays/qrimportdisplay.cpp
|
||||
displays/spirodisplay.cpp
|
||||
displays/starfielddisplay.cpp
|
||||
displays/statusdisplay.cpp
|
||||
displays/updatedisplay.cpp
|
||||
dnsannounce.cpp
|
||||
dpad.cpp
|
||||
dpad3wire.cpp
|
||||
dpad5wire.cpp
|
||||
dpad5wire_2out.cpp
|
||||
dpad6wire.cpp
|
||||
drivingstatistics.cpp
|
||||
esptexthelpers.cpp
|
||||
espnowfunctions.cpp
|
||||
feedbackparser.cpp
|
||||
globals.cpp
|
||||
handbremse.cpp
|
||||
icons/alert.cpp
|
||||
icons/battery.cpp
|
||||
icons/bluetooth.cpp
|
||||
@ -410,12 +448,6 @@ set(sources
|
||||
icons/time.cpp
|
||||
icons/update.cpp
|
||||
icons/wifi.cpp
|
||||
ledstrip.cpp
|
||||
ledstripdefines.cpp
|
||||
macros_bobbycar.cpp
|
||||
main.cpp
|
||||
modeinterface.cpp
|
||||
modes.cpp
|
||||
modes/defaultmode.cpp
|
||||
modes/gametrakmode.cpp
|
||||
modes/ignoreinputmode.cpp
|
||||
@ -423,50 +455,11 @@ set(sources
|
||||
modes/motortestmode.cpp
|
||||
modes/remotecontrolmode.cpp
|
||||
modes/tempomatmode.cpp
|
||||
mosfets.cpp
|
||||
newsettings.cpp
|
||||
ota.cpp
|
||||
potis.cpp
|
||||
presets.cpp
|
||||
qrimport.cpp
|
||||
rotary.cpp
|
||||
screens.cpp
|
||||
serial_bobby.cpp
|
||||
settings.cpp
|
||||
settingspersister.cpp
|
||||
settingsutils.cpp
|
||||
statistics.cpp
|
||||
statustexthelper.cpp
|
||||
taskmanager.cpp
|
||||
texts.cpp
|
||||
time_bobbycar.cpp
|
||||
types.cpp
|
||||
udpcloud.cpp
|
||||
unifiedmodelmode.cpp
|
||||
utils.cpp
|
||||
webserver.cpp
|
||||
webserver_displaycontrol.cpp
|
||||
webserver_dumpnvs.cpp
|
||||
webserver_lock.cpp
|
||||
webserver_ota.cpp
|
||||
webserver_settings.cpp
|
||||
webserver_newsettings.cpp
|
||||
widgets/doubleprogressbar.cpp
|
||||
wifi_bobbycar.cpp
|
||||
texthelpers/networktexthelpers.cpp
|
||||
texthelpers/wifistatexthelpers.cpp
|
||||
wifiguiutils.cpp
|
||||
accessors/wifistaconfigaccessors.cpp
|
||||
displays/menus/wifistascanmenu.cpp
|
||||
displays/menus/wifistaconfigsmenu.cpp
|
||||
displays/menus/wifistascanentrymenu.cpp
|
||||
displays/menus/wifiapclientsmenu.cpp
|
||||
displays/menus/wifistaconfigentrymenu.cpp
|
||||
texthelpers/wifistaconfigtexthelpers.cpp
|
||||
accessors/wifiapconfigaccessors.cpp
|
||||
texthelpers/wifiaptexthelpers.cpp
|
||||
actions/wifistascanaction.cpp
|
||||
actions/wifistascanclearaction.cpp
|
||||
texthelpers/wifistaconfigtexthelpers.cpp
|
||||
texthelpers/wifistatexthelpers.cpp
|
||||
widgets/doubleprogressbar.cpp
|
||||
)
|
||||
|
||||
set(dependencies
|
||||
|
77
main/accessorhelpers.h
Normal file
77
main/accessorhelpers.h
Normal file
@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <cstdint>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <accessorinterface.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
//! Special type of RefAccessor that also saves settings after setValue()
|
||||
template<typename T>
|
||||
struct RefAccessorSaveSettings : public virtual espgui::RefAccessor<T>
|
||||
{
|
||||
typename espgui::AccessorInterface<T>::setter_result_t setValue(T value) override
|
||||
{
|
||||
espgui::RefAccessor<T>::setValue(value);
|
||||
|
||||
if (!saveSettings())
|
||||
return tl::make_unexpected("saveSettings() failed!");
|
||||
|
||||
return {};
|
||||
};
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct NewSettingsAccessor : public virtual espgui::AccessorInterface<T>
|
||||
{
|
||||
virtual ConfigWrapper<T>& getConfig() const = 0;
|
||||
|
||||
T getValue() const override
|
||||
{
|
||||
return getConfig().value;
|
||||
}
|
||||
|
||||
typename espgui::AccessorInterface<T>::setter_result_t setValue(T value) override
|
||||
{
|
||||
return configs.write_config(getConfig(), value);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct NewSettingsChronoAdaptorAccessor;
|
||||
|
||||
template<>
|
||||
struct NewSettingsChronoAdaptorAccessor<espchrono::minutes32> : public virtual espgui::AccessorInterface<int32_t>
|
||||
{
|
||||
virtual ConfigWrapper<espchrono::minutes32>& getConfig() const = 0;
|
||||
|
||||
int32_t getValue() const override
|
||||
{
|
||||
return getConfig().value.count();
|
||||
}
|
||||
|
||||
typename espgui::AccessorInterface<int32_t>::setter_result_t setValue(int32_t value) override
|
||||
{
|
||||
return configs.write_config(getConfig(), espchrono::minutes32{value});
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct NewSettingsChronoAdaptorAccessor<espchrono::milliseconds32> : public virtual espgui::AccessorInterface<int32_t>
|
||||
{
|
||||
virtual ConfigWrapper<espchrono::milliseconds32>& getConfig() const = 0;
|
||||
|
||||
int32_t getValue() const override
|
||||
{
|
||||
return getConfig().value.count();
|
||||
}
|
||||
|
||||
typename espgui::AccessorInterface<int32_t>::setter_result_t setValue(int32_t value) override
|
||||
{
|
||||
return configs.write_config(getConfig(), espchrono::milliseconds32{value});
|
||||
}
|
||||
};
|
@ -1 +0,0 @@
|
||||
#include "globalaccessors.h"
|
@ -1 +0,0 @@
|
||||
#include "settingsaccessors.h"
|
@ -6,46 +6,20 @@
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "utils.h"
|
||||
#include "accessorhelpers.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
//! Special type of RefAccessor that also saves settings after setValue()
|
||||
template<typename T>
|
||||
struct RefAccessorSaveSettings : public virtual espgui::RefAccessor<T>
|
||||
{
|
||||
void setValue(T value) override { espgui::RefAccessor<T>::setValue(value); saveSettings(); };
|
||||
};
|
||||
|
||||
// Bms
|
||||
#ifdef FEATURE_BMS
|
||||
struct AutoConnectBmsAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.autoConnectBms; } };
|
||||
#endif
|
||||
|
||||
// Buzzer
|
||||
struct ReverseBeepAccessor : public virtual espgui::AccessorInterface<bool>
|
||||
{
|
||||
bool getValue() const override { return configs.reverseBeep.value; }
|
||||
void setValue(bool value) override { configs.write_config(configs.reverseBeep, value); }
|
||||
};
|
||||
struct ReverseBeepFreq0Accessor : public virtual espgui::AccessorInterface<uint8_t>
|
||||
{
|
||||
uint8_t getValue() const override { return configs.reverseBeepFreq0.value; }
|
||||
void setValue(uint8_t value) override { configs.write_config(configs.reverseBeepFreq0, value); }
|
||||
};
|
||||
struct ReverseBeepFreq1Accessor : public virtual espgui::AccessorInterface<uint8_t>
|
||||
{
|
||||
uint8_t getValue() const override { return configs.reverseBeepFreq1.value; }
|
||||
void setValue(uint8_t value) override { configs.write_config(configs.reverseBeepFreq1, value); }
|
||||
};
|
||||
struct ReverseBeepDuration0Accessor : public virtual espgui::AccessorInterface<int16_t>
|
||||
{
|
||||
int16_t getValue() const override { return configs.reverseBeepDuration0.value; }
|
||||
void setValue(int16_t value) override { configs.write_config(configs.reverseBeepDuration0, value); }
|
||||
};
|
||||
struct ReverseBeepDuration1Accessor : public virtual espgui::AccessorInterface<int16_t>
|
||||
{
|
||||
int16_t getValue() const override { return configs.reverseBeepDuration1.value; }
|
||||
void setValue(int16_t value) override { configs.write_config(configs.reverseBeepDuration1, value); }
|
||||
};
|
||||
struct ReverseBeepAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.reverseBeep; } };
|
||||
struct ReverseBeepFreq0Accessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.reverseBeepFreq0; } };
|
||||
struct ReverseBeepFreq1Accessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.reverseBeepFreq1; } };
|
||||
struct ReverseBeepDuration0Accessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.reverseBeepDuration0; } };
|
||||
struct ReverseBeepDuration1Accessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.reverseBeepDuration1; } };
|
||||
|
||||
// Limits
|
||||
struct IMotMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.iMotMax; } };
|
||||
@ -53,24 +27,18 @@ struct IDcMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRe
|
||||
struct NMotMaxKmhAccessor : public virtual espgui::AccessorInterface<int16_t>
|
||||
{
|
||||
int16_t getValue() const override { return convertToKmh(settings.limits.nMotMax); }
|
||||
void setValue(int16_t value) override { settings.limits.nMotMax = convertFromKmh(value); saveSettings(); }
|
||||
espgui::AccessorInterface<int16_t>::setter_result_t setValue(int16_t value) override
|
||||
{
|
||||
settings.limits.nMotMax = convertFromKmh(value);
|
||||
if (!saveSettings())
|
||||
return tl::make_unexpected("saveSettings() failed!");
|
||||
return {};
|
||||
}
|
||||
};
|
||||
struct NMotMaxRpmAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.nMotMax; } };
|
||||
struct FieldWeakMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.fieldWeakMax; } };
|
||||
struct PhaseAdvMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.phaseAdvMax; } };
|
||||
|
||||
// WiFi
|
||||
struct WifiStaEnabledAccessor : public virtual espgui::AccessorInterface<bool>
|
||||
{
|
||||
bool getValue() const override { return configs.wifiStaEnabled.value; }
|
||||
void setValue(bool value) override { configs.write_config(configs.wifiStaEnabled, value); }
|
||||
};
|
||||
struct WifiApEnabledAccessor : public virtual espgui::AccessorInterface<bool>
|
||||
{
|
||||
bool getValue() const override { return configs.wifiApEnabled.value; }
|
||||
void setValue(bool value) override { configs.write_config(configs.wifiApEnabled, value); }
|
||||
};
|
||||
|
||||
// Bluetooth
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
struct AutoBluetoothModeAccessor : public RefAccessorSaveSettings<BluetoothMode> { BluetoothMode &getRef() const override { return settings.bluetoothSettings.autoBluetoothMode; } };
|
||||
@ -88,32 +56,14 @@ struct CloudTransmitTimeoutAccessor : public RefAccessorSaveSettings<int16_t> {
|
||||
#endif
|
||||
|
||||
// Time
|
||||
struct TimezoneOffsetAccessor : public virtual espgui::AccessorInterface<int32_t>
|
||||
{
|
||||
int32_t getValue() const override { return configs.timezoneOffset.value.count(); }
|
||||
void setValue(int32_t value) override { configs.write_config(configs.timezoneOffset, espchrono::minutes32{value}); }
|
||||
};
|
||||
struct DaylightSavingModeAccessor : public virtual espgui::AccessorInterface<espchrono::DayLightSavingMode>
|
||||
{
|
||||
espchrono::DayLightSavingMode getValue() const override { return configs.timeDst.value; }
|
||||
void setValue(espchrono::DayLightSavingMode value) override { configs.write_config(configs.timeDst, value); }
|
||||
};
|
||||
//struct TimezoneOffsetAccessor : public NewSettingsAccessor<int32_t> { ConfigWrapper<int32_t> &getConfig() const override { return configs.timezoneOffset; } };
|
||||
struct TimezoneOffsetAccessor : public NewSettingsChronoAdaptorAccessor<espchrono::minutes32> { ConfigWrapper<espchrono::minutes32> &getConfig() const override { return configs.timezoneOffset; } };
|
||||
struct DaylightSavingModeAccessor : public NewSettingsAccessor<espchrono::DayLightSavingMode> { ConfigWrapper<espchrono::DayLightSavingMode> &getConfig() const override { return configs.timeDst; } };
|
||||
#ifdef FEATURE_NTP
|
||||
struct TimeServerEnabledAccessor : public virtual espgui::AccessorInterface<bool>
|
||||
{
|
||||
bool getValue() const override { return configs.timeServerEnabled.value; }
|
||||
void setValue(bool value) override { configs.write_config(configs.timeServerEnabled, value); }
|
||||
};
|
||||
struct TimeSyncModeAccessor : public virtual espgui::AccessorInterface<sntp_sync_mode_t>
|
||||
{
|
||||
sntp_sync_mode_t getValue() const override { return configs.timeSyncMode.value; }
|
||||
void setValue(sntp_sync_mode_t value) override { configs.write_config(configs.timeSyncMode, value); }
|
||||
};
|
||||
struct TimeSyncIntervalAccessor : public virtual espgui::AccessorInterface<int32_t>
|
||||
{
|
||||
int32_t getValue() const override { return configs.timeSyncInterval.value.count(); }
|
||||
void setValue(int32_t value) override { configs.write_config(configs.timeSyncInterval, espchrono::milliseconds32{value}); }
|
||||
};
|
||||
struct TimeServerEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.timeServerEnabled; } };
|
||||
struct TimeSyncModeAccessor : public NewSettingsAccessor<sntp_sync_mode_t> { ConfigWrapper<sntp_sync_mode_t> &getConfig() const override { return configs.timeSyncMode; } };
|
||||
//struct TimeSyncIntervalAccessor : public NewSettingsAccessor<int32_t> { ConfigWrapper<int32_t> &getConfig() const override { return configs.timeSyncInterval; } };
|
||||
struct TimeSyncIntervalAccessor : public NewSettingsChronoAdaptorAccessor<espchrono::milliseconds32> { ConfigWrapper<espchrono::milliseconds32> &getConfig() const override { return configs.timeSyncInterval; } };
|
||||
#endif
|
||||
|
||||
// Controller Hardware
|
||||
@ -131,7 +81,13 @@ struct WheelDiameterMmAccessor : public RefAccessorSaveSettings<int16_t> { int16
|
||||
struct WheelDiameterInchAccessor : public virtual espgui::AccessorInterface<float>
|
||||
{
|
||||
float getValue() const override { return convertToInch(settings.controllerHardware.wheelDiameter); }
|
||||
void setValue(float value) override { settings.controllerHardware.wheelDiameter = convertFromInch(value); saveSettings(); }
|
||||
espgui::AccessorInterface<int16_t>::setter_result_t setValue(float value) override
|
||||
{
|
||||
settings.controllerHardware.wheelDiameter = convertFromInch(value);
|
||||
if (!saveSettings())
|
||||
return tl::make_unexpected("saveSettings() failed!");
|
||||
return {};
|
||||
}
|
||||
};
|
||||
struct NumMagnetPolesAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.controllerHardware.numMagnetPoles; } };
|
||||
struct SwapFrontBackAccessor : public RefAccessorSaveSettings<bool> {
|
||||
@ -150,13 +106,13 @@ struct CanReceiveTimeoutAccessor : public RefAccessorSaveSettings<int16_t> { int
|
||||
#endif
|
||||
|
||||
// Input devices
|
||||
struct SampleCountAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.sampleCount; } };
|
||||
struct GasMinAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.gasMin; } };
|
||||
struct GasMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.gasMax; } };
|
||||
struct BremsMinAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.bremsMin; } };
|
||||
struct BremsMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.bremsMax; } };
|
||||
struct SampleCountAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.sampleCount; } };
|
||||
struct GasMinAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.gasMin; } };
|
||||
struct GasMaxAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.gasMax; } };
|
||||
struct BremsMinAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.bremsMin; } };
|
||||
struct BremsMaxAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.bremsMax; } };
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW) || defined(FEATURE_DPAD_5WIRESW_2OUT) || defined (FEATURE_DPAD_6WIRESW)
|
||||
struct DPadDebounceAccessor : public RefAccessorSaveSettings<uint8_t> { uint8_t &getRef() const override { return settings.boardcomputerHardware.dpadDebounce; } };
|
||||
struct DPadDebounceAccessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.dpadDebounce; } };
|
||||
#endif
|
||||
#ifdef FEATURE_GAMETRAK
|
||||
struct GametrakXMinAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.gametrakXMin; } };
|
||||
|
@ -1,12 +0,0 @@
|
||||
#include "wifiapconfigaccessors.h"
|
||||
|
||||
// local includes
|
||||
#include "newsettings.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
bool WifiApEnabledAccessor::getValue() const { return configs.wifiApEnabled.value; }
|
||||
void WifiApEnabledAccessor::setValue(bool value) { configs.write_config(configs.wifiApEnabled, value); }
|
||||
|
||||
//bool WifiApDisableWhenOnlineAccessor::getValue() const { return configs.wifiDisableApWhenOnline.value; }
|
||||
//void WifiApDisableWhenOnlineAccessor::setValue(bool value) { configs.write_config(configs.wifiDisableApWhenOnline, value); }
|
@ -1,22 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <string>
|
||||
// local includes
|
||||
#include "accessorhelpers.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <accessorinterface.h>
|
||||
#include <espwifiutils.h>
|
||||
|
||||
class WifiApEnabledAccessor : public virtual espgui::AccessorInterface<bool>
|
||||
{
|
||||
public:
|
||||
bool getValue() const override;
|
||||
void setValue(bool value) override;
|
||||
};
|
||||
|
||||
//class WifiApDisableWhenOnlineAccessor : public virtual espgui::AccessorInterface<bool>
|
||||
//{
|
||||
//public:
|
||||
// bool getValue() const override;
|
||||
// void setValue(bool value) override;
|
||||
//};
|
||||
struct WifiApEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.wifiApEnabled; } };
|
||||
//struct WifiApDisableWhenOnlineAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.wifiDisableApWhenOnline; } };
|
||||
struct WifiApNameAccessor : public NewSettingsAccessor<std::string> { ConfigWrapper<std::string> &getConfig() const override { return configs.wifiApName; } };
|
||||
struct WifiApKeyAccessor : public NewSettingsAccessor<std::string> { ConfigWrapper<std::string> &getConfig() const override { return configs.wifiApKey; } };
|
||||
struct WifiApIpAccessor : public NewSettingsAccessor<wifi_stack::ip_address_t> { ConfigWrapper<wifi_stack::ip_address_t> &getConfig() const override { return configs.wifiApIp; } };
|
||||
struct WifiApMaskAccessor : public NewSettingsAccessor<wifi_stack::ip_address_t> { ConfigWrapper<wifi_stack::ip_address_t> &getConfig() const override { return configs.wifiApMask; } };
|
||||
struct WifiApChannelAccessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.wifiApChannel; } };
|
||||
struct WifiApAuthmodeAccessor : public NewSettingsAccessor<wifi_auth_mode_t> { ConfigWrapper<wifi_auth_mode_t> &getConfig() const override { return configs.wifiApAuthmode; } };
|
||||
|
@ -1,39 +1,3 @@
|
||||
#include "wifistaconfigaccessors.h"
|
||||
|
||||
// local includes
|
||||
#include "newsettings.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
bool WifiStaEnabledAccessor::getValue() const { return configs.wifiStaEnabled.value; }
|
||||
void WifiStaEnabledAccessor::setValue(bool value) { configs.write_config(configs.wifiStaEnabled, value); }
|
||||
|
||||
std::string WifiStaConfigSsidAccessor::getValue() const { return configs.wifi_configs[m_index].ssid.value; }
|
||||
void WifiStaConfigSsidAccessor::setValue(std::string value) { configs.write_config(configs.wifi_configs[m_index].ssid, value); }
|
||||
|
||||
std::string WifiStaConfigKeyAccessor::getValue() const { return configs.wifi_configs[m_index].key.value; }
|
||||
void WifiStaConfigKeyAccessor::setValue(std::string value) { configs.write_config(configs.wifi_configs[m_index].key, value); }
|
||||
|
||||
bool WifiStaConfigUseStaticIpAccessor::getValue() const { return configs.wifi_configs[m_index].useStaticIp.value; }
|
||||
void WifiStaConfigUseStaticIpAccessor::setValue(bool value) { configs.write_config(configs.wifi_configs[m_index].useStaticIp, value); }
|
||||
|
||||
wifi_stack::ip_address_t WifiStaConfigStaticIpAccessor::getValue() const { return configs.wifi_configs[m_index].staticIp.value; }
|
||||
void WifiStaConfigStaticIpAccessor::setValue(wifi_stack::ip_address_t value) { configs.write_config(configs.wifi_configs[m_index].staticIp, value); }
|
||||
|
||||
wifi_stack::ip_address_t WifiStaConfigStaticSubnetAccessor::getValue() const { return configs.wifi_configs[m_index].staticSubnet.value; }
|
||||
void WifiStaConfigStaticSubnetAccessor::setValue(wifi_stack::ip_address_t value) { configs.write_config(configs.wifi_configs[m_index].staticSubnet, value); }
|
||||
|
||||
wifi_stack::ip_address_t WifiStaConfigStaticGatewayAccessor::getValue() const { return configs.wifi_configs[m_index].staticGateway.value; }
|
||||
void WifiStaConfigStaticGatewayAccessor::setValue(wifi_stack::ip_address_t value) { configs.write_config(configs.wifi_configs[m_index].staticGateway, value); }
|
||||
|
||||
bool WifiStaConfigUseStaticDnsAccessor::getValue() const { return configs.wifi_configs[m_index].useStaticDns.value; }
|
||||
void WifiStaConfigUseStaticDnsAccessor::setValue(bool value) { configs.write_config(configs.wifi_configs[m_index].useStaticDns, value); }
|
||||
|
||||
wifi_stack::ip_address_t WifiStaConfigStaticDns0Accessor::getValue() const { return configs.wifi_configs[m_index].staticDns0.value; }
|
||||
void WifiStaConfigStaticDns0Accessor::setValue(wifi_stack::ip_address_t value) { configs.write_config(configs.wifi_configs[m_index].staticDns0, value); }
|
||||
|
||||
wifi_stack::ip_address_t WifiStaConfigStaticDns1Accessor::getValue() const { return configs.wifi_configs[m_index].staticDns1.value; }
|
||||
void WifiStaConfigStaticDns1Accessor::setValue(wifi_stack::ip_address_t value) { configs.write_config(configs.wifi_configs[m_index].staticDns1, value); }
|
||||
|
||||
wifi_stack::ip_address_t WifiStaConfigStaticDns2Accessor::getValue() const { return configs.wifi_configs[m_index].staticDns2.value; }
|
||||
void WifiStaConfigStaticDns2Accessor::setValue(wifi_stack::ip_address_t value) { configs.write_config(configs.wifi_configs[m_index].staticDns2, value); }
|
||||
|
@ -9,129 +9,98 @@
|
||||
#include <accessorinterface.h>
|
||||
#include <espwifiutils.h>
|
||||
|
||||
class WifiStaEnabledAccessor : public virtual espgui::AccessorInterface<bool>
|
||||
{
|
||||
public:
|
||||
bool getValue() const override;
|
||||
void setValue(bool value) override;
|
||||
};
|
||||
// local includes
|
||||
#include "newsettings.h"
|
||||
#include "accessorhelpers.h"
|
||||
|
||||
class WifiStaConfigSsidAccessor : public virtual espgui::AccessorInterface<std::string>
|
||||
struct WifiStaEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.wifiStaEnabled; } };
|
||||
|
||||
class WifiStaConfigSsidAccessor : public virtual NewSettingsAccessor<std::string>
|
||||
{
|
||||
public:
|
||||
WifiStaConfigSsidAccessor(int index) : m_index{index} {}
|
||||
|
||||
std::string getValue() const override;
|
||||
void setValue(std::string value) override;
|
||||
|
||||
ConfigWrapper<std::string>& getConfig() const override { return configs.wifi_configs[m_index].ssid; }
|
||||
private:
|
||||
const int m_index;
|
||||
};
|
||||
|
||||
class WifiStaConfigKeyAccessor : public virtual espgui::AccessorInterface<std::string>
|
||||
class WifiStaConfigKeyAccessor : public virtual NewSettingsAccessor<std::string>
|
||||
{
|
||||
public:
|
||||
WifiStaConfigKeyAccessor(int index) : m_index{index} {}
|
||||
|
||||
std::string getValue() const override;
|
||||
void setValue(std::string value) override;
|
||||
|
||||
ConfigWrapper<std::string>& getConfig() const override { return configs.wifi_configs[m_index].key; }
|
||||
private:
|
||||
const int m_index;
|
||||
};
|
||||
|
||||
class WifiStaConfigUseStaticIpAccessor : public virtual espgui::AccessorInterface<bool>
|
||||
class WifiStaConfigUseStaticIpAccessor : public virtual NewSettingsAccessor<bool>
|
||||
{
|
||||
public:
|
||||
WifiStaConfigUseStaticIpAccessor(int index) : m_index{index} {}
|
||||
|
||||
bool getValue() const override;
|
||||
void setValue(bool value) override;
|
||||
|
||||
ConfigWrapper<bool>& getConfig() const override { return configs.wifi_configs[m_index].useStaticIp; }
|
||||
private:
|
||||
const int m_index;
|
||||
};
|
||||
|
||||
class WifiStaConfigStaticIpAccessor : public virtual espgui::AccessorInterface<wifi_stack::ip_address_t>
|
||||
class WifiStaConfigStaticIpAccessor : public virtual NewSettingsAccessor<wifi_stack::ip_address_t>
|
||||
{
|
||||
public:
|
||||
WifiStaConfigStaticIpAccessor(int index) : m_index{index} {}
|
||||
|
||||
wifi_stack::ip_address_t getValue() const override;
|
||||
void setValue(wifi_stack::ip_address_t value) override;
|
||||
|
||||
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticIp; }
|
||||
private:
|
||||
const int m_index;
|
||||
};
|
||||
|
||||
class WifiStaConfigStaticSubnetAccessor : public virtual espgui::AccessorInterface<wifi_stack::ip_address_t>
|
||||
class WifiStaConfigStaticSubnetAccessor : public virtual NewSettingsAccessor<wifi_stack::ip_address_t>
|
||||
{
|
||||
public:
|
||||
WifiStaConfigStaticSubnetAccessor(int index) : m_index{index} {}
|
||||
|
||||
wifi_stack::ip_address_t getValue() const override;
|
||||
void setValue(wifi_stack::ip_address_t value) override;
|
||||
|
||||
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticSubnet; }
|
||||
private:
|
||||
const int m_index;
|
||||
};
|
||||
|
||||
class WifiStaConfigStaticGatewayAccessor : public virtual espgui::AccessorInterface<wifi_stack::ip_address_t>
|
||||
class WifiStaConfigStaticGatewayAccessor : public virtual NewSettingsAccessor<wifi_stack::ip_address_t>
|
||||
{
|
||||
public:
|
||||
WifiStaConfigStaticGatewayAccessor(int index) : m_index{index} {}
|
||||
|
||||
wifi_stack::ip_address_t getValue() const override;
|
||||
void setValue(wifi_stack::ip_address_t value) override;
|
||||
|
||||
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticGateway; }
|
||||
private:
|
||||
const int m_index;
|
||||
};
|
||||
|
||||
class WifiStaConfigUseStaticDnsAccessor : public virtual espgui::AccessorInterface<bool>
|
||||
class WifiStaConfigUseStaticDnsAccessor : public virtual NewSettingsAccessor<bool>
|
||||
{
|
||||
public:
|
||||
WifiStaConfigUseStaticDnsAccessor(int index) : m_index{index} {}
|
||||
|
||||
bool getValue() const override;
|
||||
void setValue(bool value) override;
|
||||
|
||||
ConfigWrapper<bool>& getConfig() const override { return configs.wifi_configs[m_index].useStaticDns; }
|
||||
private:
|
||||
const int m_index;
|
||||
};
|
||||
|
||||
class WifiStaConfigStaticDns0Accessor : public virtual espgui::AccessorInterface<wifi_stack::ip_address_t>
|
||||
class WifiStaConfigStaticDns0Accessor : public virtual NewSettingsAccessor<wifi_stack::ip_address_t>
|
||||
{
|
||||
public:
|
||||
WifiStaConfigStaticDns0Accessor(int index) : m_index{index} {}
|
||||
|
||||
wifi_stack::ip_address_t getValue() const override;
|
||||
void setValue(wifi_stack::ip_address_t value) override;
|
||||
|
||||
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticDns0; }
|
||||
private:
|
||||
const int m_index;
|
||||
};
|
||||
|
||||
class WifiStaConfigStaticDns1Accessor : public virtual espgui::AccessorInterface<wifi_stack::ip_address_t>
|
||||
class WifiStaConfigStaticDns1Accessor : public virtual NewSettingsAccessor<wifi_stack::ip_address_t>
|
||||
{
|
||||
public:
|
||||
WifiStaConfigStaticDns1Accessor(int index) : m_index{index} {}
|
||||
|
||||
wifi_stack::ip_address_t getValue() const override;
|
||||
void setValue(wifi_stack::ip_address_t value) override;
|
||||
|
||||
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticDns1; }
|
||||
private:
|
||||
const int m_index;
|
||||
};
|
||||
|
||||
class WifiStaConfigStaticDns2Accessor : public virtual espgui::AccessorInterface<wifi_stack::ip_address_t>
|
||||
class WifiStaConfigStaticDns2Accessor : public virtual NewSettingsAccessor<wifi_stack::ip_address_t>
|
||||
{
|
||||
public:
|
||||
WifiStaConfigStaticDns2Accessor(int index) : m_index{index} {}
|
||||
|
||||
wifi_stack::ip_address_t getValue() const override;
|
||||
void setValue(wifi_stack::ip_address_t value) override;
|
||||
|
||||
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticDns2; }
|
||||
private:
|
||||
const int m_index;
|
||||
};
|
||||
|
@ -1,31 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "actioninterface.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
namespace {
|
||||
template<typename ...T>
|
||||
class MultiAction;
|
||||
|
||||
template<typename T>
|
||||
class MultiAction<T> : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
T{}.triggered();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, typename ...Tmore>
|
||||
class MultiAction<T, Tmore...> : public virtual MultiAction<Tmore...>
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
T{}.triggered();
|
||||
MultiAction<Tmore...>::triggered();
|
||||
}
|
||||
};
|
||||
}
|
@ -1,50 +1,29 @@
|
||||
#include "bobbybuttons.h"
|
||||
|
||||
void BobbyButtons::rawButtonPressed(uint8_t button)
|
||||
[[nodiscard]] std::optional<espgui::Button> translateRawButton(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonPressed(button);
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case 0: buttonPressed(Button::Left); break;
|
||||
case 1: buttonPressed(Button::Right); break;
|
||||
case 2: buttonPressed(Button::Up); break;
|
||||
case 3: buttonPressed(Button::Down); break;
|
||||
case 4: buttonPressed(Button(BobbyButton::Profile0)); break;
|
||||
case 5: buttonPressed(Button(BobbyButton::Profile1)); break;
|
||||
case 6: buttonPressed(Button(BobbyButton::Profile2)); break;
|
||||
case 7: buttonPressed(Button(BobbyButton::Profile3)); break;
|
||||
case 8: buttonPressed(Button(BobbyButton::Left2)); break;
|
||||
case 9: buttonPressed(Button(BobbyButton::Right2)); break;
|
||||
case 10: buttonPressed(Button(BobbyButton::Up2)); break;
|
||||
case 11: buttonPressed(Button(BobbyButton::Down2)); break;
|
||||
case 0: return Button::Left;
|
||||
case 1: return Button::Right;
|
||||
case 2: return Button::Up;
|
||||
case 3: return Button::Down;
|
||||
case 4: return Button(BobbyButton::Profile0);
|
||||
case 5: return Button(BobbyButton::Profile1);
|
||||
case 6: return Button(BobbyButton::Profile2);
|
||||
case 7: return Button(BobbyButton::Profile3);
|
||||
case 8: return Button(BobbyButton::Left2);
|
||||
case 9: return Button(BobbyButton::Right2);
|
||||
case 10: return Button(BobbyButton::Up2);
|
||||
case 11: return Button(BobbyButton::Down2);
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void BobbyButtons::rawButtonReleased(uint8_t button)
|
||||
void buttonPressedCommon(espgui::Button button)
|
||||
{
|
||||
//Base::rawButtonReleased(button);
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case 0: buttonReleased(Button::Left); break;
|
||||
case 1: buttonReleased(Button::Right); break;
|
||||
case 2: buttonReleased(Button::Up); break;
|
||||
case 3: buttonReleased(Button::Down); break;
|
||||
case 4: buttonReleased(Button(BobbyButton::Profile0)); break;
|
||||
case 5: buttonReleased(Button(BobbyButton::Profile1)); break;
|
||||
case 6: buttonReleased(Button(BobbyButton::Profile2)); break;
|
||||
case 7: buttonReleased(Button(BobbyButton::Profile3)); break;
|
||||
case 8: buttonReleased(Button(BobbyButton::Left2)); break;
|
||||
case 9: buttonReleased(Button(BobbyButton::Right2)); break;
|
||||
case 10: buttonReleased(Button(BobbyButton::Up2)); break;
|
||||
case 11: buttonReleased(Button(BobbyButton::Down2)); break;
|
||||
}
|
||||
}
|
||||
|
||||
void BobbyButtons::buttonPressed(espgui::Button button)
|
||||
{
|
||||
//Base::buttonPressed(button);
|
||||
switch (BobbyButton(button))
|
||||
{
|
||||
case BobbyButton::Profile0: /* TODO */ break;
|
||||
@ -59,6 +38,26 @@ void BobbyButtons::buttonPressed(espgui::Button button)
|
||||
}
|
||||
}
|
||||
|
||||
void BobbyButtons::rawButtonPressed(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonPressed(button);
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonPressed(*translated);
|
||||
}
|
||||
|
||||
void BobbyButtons::rawButtonReleased(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonReleased(button);
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonReleased(*translated);
|
||||
}
|
||||
|
||||
void BobbyButtons::buttonPressed(espgui::Button button)
|
||||
{
|
||||
//Base::buttonPressed(button);
|
||||
buttonPressedCommon(button);
|
||||
}
|
||||
|
||||
void BobbyButtons::buttonReleased(espgui::Button button)
|
||||
{
|
||||
//Base::buttonReleased(button);
|
||||
|
@ -1,5 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <optional>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "buttonsinterface.h"
|
||||
|
||||
@ -17,6 +20,9 @@ enum BobbyButton
|
||||
Back = espgui::Button::Left
|
||||
};
|
||||
|
||||
[[nodiscard]] std::optional<espgui::Button> translateRawButton(uint8_t button);
|
||||
void buttonPressedCommon(espgui::Button button);
|
||||
|
||||
class BobbyButtons : public virtual espgui::ButtonsInterface
|
||||
{
|
||||
public:
|
||||
|
14
main/bobbyerrorhandler.cpp
Normal file
14
main/bobbyerrorhandler.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "bobbyerrorhandler.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbypopupdisplay.h"
|
||||
|
||||
void BobbyErrorHandler::errorOccured(std::string &&error)
|
||||
{
|
||||
auto newDisplay = std::make_unique<BobbyPopupDisplay>(std::move(error), std::move(espgui::currentDisplay));
|
||||
newDisplay->initOverlay();
|
||||
espgui::currentDisplay = std::move(newDisplay);
|
||||
}
|
9
main/bobbyerrorhandler.h
Normal file
9
main/bobbyerrorhandler.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <errorhandlerinterface.h>
|
||||
|
||||
struct BobbyErrorHandler : public virtual espgui::ErrorHandlerInterface
|
||||
{
|
||||
void errorOccured(std::string &&error) override;
|
||||
};
|
@ -0,0 +1,53 @@
|
||||
#include "changevaluedisplay_controlmode.h"
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
||||
namespace espgui {
|
||||
namespace {
|
||||
constexpr const char * const TAG = "ESPGUI";
|
||||
|
||||
constexpr char TEXT_OPENMODE[] = "Open mode";
|
||||
constexpr char TEXT_VOLTAGE[] = "Voltage";
|
||||
constexpr char TEXT_SPEED[] = "Speed";
|
||||
constexpr char TEXT_TORQUE[] = "Torque";
|
||||
constexpr char TEXT_BACK[] = "Back";
|
||||
} // namespace
|
||||
|
||||
ChangeValueDisplay<bobbycar::protocol::ControlMode>::ChangeValueDisplay()
|
||||
{
|
||||
using bobbycar::protocol::ControlMode;
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<ControlMode>, StaticText<TEXT_OPENMODE>>>(ControlMode::OpenMode, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<ControlMode>, StaticText<TEXT_VOLTAGE>>>(ControlMode::Voltage, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<ControlMode>, StaticText<TEXT_SPEED>>>(ControlMode::Speed, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<ControlMode>, StaticText<TEXT_TORQUE>>>(ControlMode::Torque, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, BackProxyAction, StaticText<TEXT_BACK>, StaticMenuItemIcon<&espgui::icons::back>>>(*this);
|
||||
}
|
||||
|
||||
void ChangeValueDisplay<bobbycar::protocol::ControlMode>::start()
|
||||
{
|
||||
Base::start();
|
||||
|
||||
switch (const auto value = getValue())
|
||||
{
|
||||
using bobbycar::protocol::ControlMode;
|
||||
case ControlMode::OpenMode: setSelectedIndex(0); break;
|
||||
case ControlMode::Voltage: setSelectedIndex(1); break;
|
||||
case ControlMode::Speed: setSelectedIndex(2); break;
|
||||
case ControlMode::Torque: setSelectedIndex(3); break;
|
||||
default:
|
||||
ESP_LOGW(TAG, "Unknown ControlMode: %i", std::to_underlying(value));
|
||||
setSelectedIndex(4);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace espgui
|
||||
|
@ -1,23 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
// 3rdparty lib includes
|
||||
#include <changevaluedisplay.h>
|
||||
#include <menudisplay.h>
|
||||
#include <confirminterface.h>
|
||||
#include <errorhandlerinterface.h>
|
||||
|
||||
// local includes
|
||||
#include "changevaluedisplay.h"
|
||||
#include "menudisplay.h"
|
||||
#include "utils.h"
|
||||
#include "actions/setvalueaction.h"
|
||||
#include "actions/backproxyaction.h"
|
||||
#include "icons/back.h"
|
||||
#include "texts.h"
|
||||
#include "bobbycar-common.h"
|
||||
|
||||
namespace espgui {
|
||||
|
||||
template<>
|
||||
class ChangeValueDisplay<bobbycar::protocol::ControlMode> :
|
||||
public MenuDisplay,
|
||||
public virtual AccessorInterface<bobbycar::protocol::ControlMode>,
|
||||
public virtual ActionInterface
|
||||
public virtual ConfirmInterface,
|
||||
public virtual ErrorHandlerInterface
|
||||
{
|
||||
using Base = MenuDisplay;
|
||||
|
||||
@ -27,30 +26,4 @@ public:
|
||||
void start() override;
|
||||
};
|
||||
|
||||
ChangeValueDisplay<bobbycar::protocol::ControlMode>::ChangeValueDisplay()
|
||||
{
|
||||
using bobbycar::protocol::ControlMode;
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<ControlMode>, StaticText<TEXT_OPENMODE>>>(ControlMode::OpenMode, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<ControlMode>, StaticText<TEXT_VOLTAGE>>>(ControlMode::Voltage, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<ControlMode>, StaticText<TEXT_SPEED>>>(ControlMode::Speed, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<ControlMode>, StaticText<TEXT_TORQUE>>>(ControlMode::Torque, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, BackProxyAction, StaticText<TEXT_BACK>, StaticMenuItemIcon<&espgui::icons::back>>>(*this);
|
||||
}
|
||||
|
||||
void ChangeValueDisplay<bobbycar::protocol::ControlMode>::start()
|
||||
{
|
||||
Base::start();
|
||||
|
||||
switch (const auto value = getValue())
|
||||
{
|
||||
using bobbycar::protocol::ControlMode;
|
||||
case ControlMode::OpenMode: setSelectedIndex(0); break;
|
||||
case ControlMode::Voltage: setSelectedIndex(1); break;
|
||||
case ControlMode::Speed: setSelectedIndex(2); break;
|
||||
case ControlMode::Torque: setSelectedIndex(3); break;
|
||||
default:
|
||||
ESP_LOGW("BOBBY", "Unknown ControlMode: %i", int(value));
|
||||
setSelectedIndex(4);
|
||||
}
|
||||
}
|
||||
} // namespace espgui
|
||||
|
@ -0,0 +1,50 @@
|
||||
#include "changevaluedisplay_controltype.h"
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
||||
namespace espgui {
|
||||
namespace {
|
||||
constexpr const char * const TAG = "ESPGUI";
|
||||
|
||||
constexpr char TEXT_COMMUTATION[] = "Commutation";
|
||||
constexpr char TEXT_SINUSOIDAL[] = "Sinusoidal";
|
||||
constexpr char TEXT_FIELDORIENTEDCONTROL[] = "Field oriented control";
|
||||
constexpr char TEXT_BACK[] = "Back";
|
||||
} // namespace
|
||||
|
||||
ChangeValueDisplay<bobbycar::protocol::ControlType>::ChangeValueDisplay()
|
||||
{
|
||||
using bobbycar::protocol::ControlType;
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<ControlType>, StaticText<TEXT_COMMUTATION>>>(ControlType::Commutation, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<ControlType>, StaticText<TEXT_SINUSOIDAL>>>(ControlType::Sinusoidal, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<ControlType>, StaticText<TEXT_FIELDORIENTEDCONTROL>>>(ControlType::FieldOrientedControl, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, BackProxyAction, StaticText<TEXT_BACK>, StaticMenuItemIcon<&espgui::icons::back>>>(*this);
|
||||
}
|
||||
|
||||
void ChangeValueDisplay<bobbycar::protocol::ControlType>::start()
|
||||
{
|
||||
Base::start();
|
||||
|
||||
switch (const auto value = getValue())
|
||||
{
|
||||
using bobbycar::protocol::ControlType;
|
||||
case ControlType::Commutation: setSelectedIndex(0); break;
|
||||
case ControlType::Sinusoidal: setSelectedIndex(1); break;
|
||||
case ControlType::FieldOrientedControl: setSelectedIndex(2); break;
|
||||
default:
|
||||
ESP_LOGW(TAG, "Unknown ControlType: %i", std::to_underlying(value));
|
||||
setSelectedIndex(3);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace espgui
|
||||
|
@ -1,23 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
// 3rdparty lib includes
|
||||
#include <changevaluedisplay.h>
|
||||
#include <menudisplay.h>
|
||||
#include <confirminterface.h>
|
||||
#include <errorhandlerinterface.h>
|
||||
|
||||
// local includes
|
||||
#include "changevaluedisplay.h"
|
||||
#include "menudisplay.h"
|
||||
#include "utils.h"
|
||||
#include "actions/setvalueaction.h"
|
||||
#include "actions/backproxyaction.h"
|
||||
#include "icons/back.h"
|
||||
#include "texts.h"
|
||||
#include "bobbycar-common.h"
|
||||
|
||||
namespace espgui {
|
||||
|
||||
template<>
|
||||
class ChangeValueDisplay<bobbycar::protocol::ControlType> :
|
||||
public MenuDisplay,
|
||||
public virtual AccessorInterface<bobbycar::protocol::ControlType>,
|
||||
public virtual ActionInterface
|
||||
public virtual ConfirmInterface,
|
||||
public virtual ErrorHandlerInterface
|
||||
{
|
||||
using Base = MenuDisplay;
|
||||
|
||||
@ -27,28 +26,4 @@ public:
|
||||
void start() override;
|
||||
};
|
||||
|
||||
ChangeValueDisplay<bobbycar::protocol::ControlType>::ChangeValueDisplay()
|
||||
{
|
||||
using bobbycar::protocol::ControlType;
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<ControlType>, StaticText<TEXT_COMMUTATION>>>(ControlType::Commutation, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<ControlType>, StaticText<TEXT_SINUSOIDAL>>>(ControlType::Sinusoidal, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<ControlType>, StaticText<TEXT_FIELDORIENTEDCONTROL>>>(ControlType::FieldOrientedControl, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, BackProxyAction, StaticText<TEXT_BACK>, StaticMenuItemIcon<&espgui::icons::back>>>(*this);
|
||||
}
|
||||
|
||||
void ChangeValueDisplay<bobbycar::protocol::ControlType>::start()
|
||||
{
|
||||
Base::start();
|
||||
|
||||
switch (const auto value = getValue())
|
||||
{
|
||||
using bobbycar::protocol::ControlType;
|
||||
case ControlType::Commutation: setSelectedIndex(0); break;
|
||||
case ControlType::Sinusoidal: setSelectedIndex(1); break;
|
||||
case ControlType::FieldOrientedControl: setSelectedIndex(2); break;
|
||||
default:
|
||||
ESP_LOGW("BOBBY", "Unknown ControlType: %i", int(value));
|
||||
setSelectedIndex(3);
|
||||
}
|
||||
}
|
||||
} // namespace espgui
|
||||
|
@ -3,16 +3,31 @@
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
#include "texts.h"
|
||||
|
||||
namespace espgui {
|
||||
namespace {
|
||||
constexpr const char * const TAG = "ESPGUI";
|
||||
|
||||
constexpr char TEXT_HANDBREMS_MOSFETS_OFF[] = "Mosfets off";
|
||||
constexpr char TEXT_HANDBREMS_OPENMODE[] = "Open Mode";
|
||||
constexpr char TEXT_HANDBREMS_SPEED0[] = "Speed 0";
|
||||
constexpr char TEXT_HANDBREMSE[] = "Handbremse";
|
||||
constexpr char TEXT_BACK[] = "Back";
|
||||
} // namespace
|
||||
|
||||
ChangeValueDisplay<HandbremseMode>::ChangeValueDisplay()
|
||||
{
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<HandbremseMode>, StaticText<TEXT_HANDBREMS_MOSFETS_OFF>>>(HandbremseMode::MOSFETS_OFF, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<HandbremseMode>, StaticText<TEXT_HANDBREMS_OPENMODE>>>(HandbremseMode::OPENMODE, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<HandbremseMode>, StaticText<TEXT_HANDBREMS_SPEED0>>>(HandbremseMode::SPEED_0, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<HandbremseMode>, StaticText<TEXT_HANDBREMS_MOSFETS_OFF>>>(HandbremseMode::MOSFETS_OFF, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<HandbremseMode>, StaticText<TEXT_HANDBREMS_OPENMODE>>>(HandbremseMode::OPENMODE, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<HandbremseMode>, StaticText<TEXT_HANDBREMS_SPEED0>>>(HandbremseMode::SPEED_0, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, BackProxyAction, StaticText<TEXT_BACK>, StaticMenuItemIcon<&espgui::icons::back>>>(*this);
|
||||
}
|
||||
|
||||
@ -26,8 +41,9 @@ void ChangeValueDisplay<HandbremseMode>::start()
|
||||
case HandbremseMode::OPENMODE: setSelectedIndex(1); break;
|
||||
case HandbremseMode::SPEED_0: setSelectedIndex(2); break;
|
||||
default:
|
||||
ESP_LOGW("BOBBY", "Unknown HandbremseMode: %i", int(value));
|
||||
ESP_LOGW(TAG, "Unknown HandbremseMode: %i", std::to_underlying(value));
|
||||
setSelectedIndex(3);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace espgui
|
||||
|
@ -1,21 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "changevaluedisplay.h"
|
||||
#include "menudisplay.h"
|
||||
#include "actions/setvalueaction.h"
|
||||
#include "actions/backproxyaction.h"
|
||||
#include "icons/back.h"
|
||||
#include <changevaluedisplay.h>
|
||||
#include <menudisplay.h>
|
||||
#include <confirminterface.h>
|
||||
#include <errorhandlerinterface.h>
|
||||
|
||||
// local includes
|
||||
#include "handbremse.h"
|
||||
|
||||
namespace espgui {
|
||||
|
||||
template<>
|
||||
class ChangeValueDisplay<HandbremseMode> :
|
||||
public MenuDisplay,
|
||||
public virtual AccessorInterface<HandbremseMode>,
|
||||
public virtual ActionInterface
|
||||
public virtual ConfirmInterface,
|
||||
public virtual ErrorHandlerInterface
|
||||
{
|
||||
using Base = MenuDisplay;
|
||||
|
||||
@ -24,4 +25,5 @@ public:
|
||||
|
||||
void start() override;
|
||||
};
|
||||
|
||||
} // namespace espgui
|
||||
|
@ -0,0 +1,51 @@
|
||||
#include "changevaluedisplay_larsmmode_mode.h"
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib inclues
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
|
||||
namespace espgui {
|
||||
namespace {
|
||||
constexpr const char * const TAG = "ESPGUI";
|
||||
|
||||
constexpr char TEXT_LARSMMODE1[] = "Mode1";
|
||||
constexpr char TEXT_LARSMMODE2[] = "Mode2";
|
||||
constexpr char TEXT_LARSMMODE3[] = "Mode3";
|
||||
constexpr char TEXT_LARSMMODE4[] = "Mode4";
|
||||
constexpr char TEXT_BACK[] = "Back";
|
||||
} // namespace
|
||||
|
||||
ChangeValueDisplay<LarsmModeMode>::ChangeValueDisplay()
|
||||
{
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<LarsmModeMode>, StaticText<TEXT_LARSMMODE1>>>(LarsmModeMode::Mode1, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<LarsmModeMode>, StaticText<TEXT_LARSMMODE2>>>(LarsmModeMode::Mode2, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<LarsmModeMode>, StaticText<TEXT_LARSMMODE3>>>(LarsmModeMode::Mode3, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<LarsmModeMode>, StaticText<TEXT_LARSMMODE4>>>(LarsmModeMode::Mode4, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, BackProxyAction, StaticText<TEXT_BACK>, StaticMenuItemIcon<&espgui::icons::back>>>(*this);
|
||||
}
|
||||
|
||||
void ChangeValueDisplay<LarsmModeMode>::start()
|
||||
{
|
||||
Base::start();
|
||||
|
||||
switch (const auto value = getValue())
|
||||
{
|
||||
case LarsmModeMode::Mode1: setSelectedIndex(0); break;
|
||||
case LarsmModeMode::Mode2: setSelectedIndex(1); break;
|
||||
case LarsmModeMode::Mode3: setSelectedIndex(2); break;
|
||||
case LarsmModeMode::Mode4: setSelectedIndex(3); break;
|
||||
default:
|
||||
ESP_LOGW(TAG, "Unknown LarsmModeMode: %i", std::to_underlying(value));
|
||||
setSelectedIndex(4);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace espgui
|
||||
|
@ -1,22 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <esp_log.h>
|
||||
// 3rdparty lib inclues
|
||||
#include <changevaluedisplay.h>
|
||||
#include <menudisplay.h>
|
||||
#include <confirminterface.h>
|
||||
#include <errorhandlerinterface.h>
|
||||
|
||||
#include "changevaluedisplay.h"
|
||||
#include "menudisplay.h"
|
||||
#include "utils.h"
|
||||
#include "actions/setvalueaction.h"
|
||||
#include "actions/backproxyaction.h"
|
||||
#include "icons/back.h"
|
||||
#include "texts.h"
|
||||
// local includes
|
||||
#include "modes/larsmmode.h"
|
||||
|
||||
namespace espgui {
|
||||
|
||||
template<>
|
||||
class ChangeValueDisplay<LarsmModeMode> :
|
||||
public MenuDisplay,
|
||||
public virtual AccessorInterface<LarsmModeMode>,
|
||||
public virtual ActionInterface
|
||||
public virtual ConfirmInterface,
|
||||
public virtual ErrorHandlerInterface
|
||||
{
|
||||
using Base = MenuDisplay;
|
||||
|
||||
@ -26,28 +26,4 @@ public:
|
||||
void start() override;
|
||||
};
|
||||
|
||||
ChangeValueDisplay<LarsmModeMode>::ChangeValueDisplay()
|
||||
{
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<LarsmModeMode>, StaticText<TEXT_LARSMMODE1>>>(LarsmModeMode::Mode1, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<LarsmModeMode>, StaticText<TEXT_LARSMMODE2>>>(LarsmModeMode::Mode2, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<LarsmModeMode>, StaticText<TEXT_LARSMMODE3>>>(LarsmModeMode::Mode3, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<LarsmModeMode>, StaticText<TEXT_LARSMMODE4>>>(LarsmModeMode::Mode4, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, BackProxyAction, StaticText<TEXT_BACK>, StaticMenuItemIcon<&espgui::icons::back>>>(*this);
|
||||
}
|
||||
|
||||
void ChangeValueDisplay<LarsmModeMode>::start()
|
||||
{
|
||||
Base::start();
|
||||
|
||||
switch (const auto value = getValue())
|
||||
{
|
||||
case LarsmModeMode::Mode1: setSelectedIndex(0); break;
|
||||
case LarsmModeMode::Mode2: setSelectedIndex(1); break;
|
||||
case LarsmModeMode::Mode3: setSelectedIndex(2); break;
|
||||
case LarsmModeMode::Mode4: setSelectedIndex(3); break;
|
||||
default:
|
||||
ESP_LOGW("BOBBY", "Unknown LarsmModeMode: %i", int(value));
|
||||
setSelectedIndex(4);
|
||||
}
|
||||
}
|
||||
} // namespace espgui
|
||||
|
@ -3,18 +3,34 @@
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <actions/setvalueaction.h>
|
||||
#include <actions/backproxyaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <futurecpp.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
#include "texts.h"
|
||||
|
||||
namespace espgui {
|
||||
namespace {
|
||||
constexpr const char * const TAG = "ESPGUI";
|
||||
|
||||
constexpr char TEXT_COMMUTATION[] = "Commutation";
|
||||
constexpr char TEXT_SINUSOIDAL[] = "Sinusoidal";
|
||||
constexpr char TEXT_FOCVOLTAGE[] = "FOC/Voltage";
|
||||
constexpr char TEXT_FOCSPEED[] = "FOC/Speed";
|
||||
constexpr char TEXT_FOCTORQUE[] = "FOC/Torque";
|
||||
constexpr char TEXT_BACK[] = "Back";
|
||||
} // namespace
|
||||
|
||||
ChangeValueDisplay<UnifiedModelMode>::ChangeValueDisplay()
|
||||
{
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<UnifiedModelMode>, StaticText<TEXT_COMMUTATION>>>(UnifiedModelMode::Commutation, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<UnifiedModelMode>, StaticText<TEXT_SINUSOIDAL>>>(UnifiedModelMode::Sinusoidal, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<UnifiedModelMode>, StaticText<TEXT_FOCVOLTAGE>>>(UnifiedModelMode::FocVoltage, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<UnifiedModelMode>, StaticText<TEXT_FOCSPEED>>>(UnifiedModelMode::FocSpeed, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<UnifiedModelMode>, StaticText<TEXT_FOCTORQUE>>>(UnifiedModelMode::FocTorque, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<UnifiedModelMode>, StaticText<TEXT_COMMUTATION>>>(UnifiedModelMode::Commutation, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<UnifiedModelMode>, StaticText<TEXT_SINUSOIDAL>>>(UnifiedModelMode::Sinusoidal, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<UnifiedModelMode>, StaticText<TEXT_FOCVOLTAGE>>>(UnifiedModelMode::FocVoltage, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<UnifiedModelMode>, StaticText<TEXT_FOCSPEED>>>(UnifiedModelMode::FocSpeed, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<UnifiedModelMode>, StaticText<TEXT_FOCTORQUE>>>(UnifiedModelMode::FocTorque, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, BackProxyAction, StaticText<TEXT_BACK>, StaticMenuItemIcon<&espgui::icons::back>>>(*this);
|
||||
}
|
||||
|
||||
@ -30,8 +46,9 @@ void ChangeValueDisplay<UnifiedModelMode>::start()
|
||||
case UnifiedModelMode::FocSpeed: setSelectedIndex(3); break;
|
||||
case UnifiedModelMode::FocTorque: setSelectedIndex(4); break;
|
||||
default:
|
||||
ESP_LOGW("BOBBY", "Unknown UnifiedModelMode: %i", int(value));
|
||||
ESP_LOGW(TAG, "Unknown UnifiedModelMode: %i", std::to_underlying(value));
|
||||
setSelectedIndex(5);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace espgui
|
||||
|
@ -1,21 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "changevaluedisplay.h"
|
||||
#include "menudisplay.h"
|
||||
#include "actions/setvalueaction.h"
|
||||
#include "actions/backproxyaction.h"
|
||||
#include "icons/back.h"
|
||||
#include <changevaluedisplay.h>
|
||||
#include <menudisplay.h>
|
||||
#include <confirminterface.h>
|
||||
#include <errorhandlerinterface.h>
|
||||
|
||||
// local includes
|
||||
#include "unifiedmodelmode.h"
|
||||
|
||||
namespace espgui {
|
||||
|
||||
template<>
|
||||
class ChangeValueDisplay<UnifiedModelMode> :
|
||||
public MenuDisplay,
|
||||
public virtual AccessorInterface<UnifiedModelMode>,
|
||||
public virtual ActionInterface
|
||||
public virtual ConfirmInterface,
|
||||
public virtual ErrorHandlerInterface
|
||||
{
|
||||
using Base = MenuDisplay;
|
||||
|
||||
@ -24,4 +25,5 @@ public:
|
||||
|
||||
void start() override;
|
||||
};
|
||||
|
||||
} // namespace espgui
|
||||
|
@ -1,53 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <esp_wifi_types.h>
|
||||
#include <esp_log.h>
|
||||
|
||||
#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 espgui {
|
||||
template<>
|
||||
class ChangeValueDisplay<wifi_mode_t> :
|
||||
public MenuDisplay,
|
||||
public virtual AccessorInterface<wifi_mode_t>,
|
||||
public virtual ActionInterface
|
||||
{
|
||||
using Base = MenuDisplay;
|
||||
|
||||
public:
|
||||
ChangeValueDisplay();
|
||||
|
||||
void start() override;
|
||||
};
|
||||
|
||||
ChangeValueDisplay<wifi_mode_t>::ChangeValueDisplay()
|
||||
{
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_mode_t>, StaticText<TEXT_WIFI_MODE_NULL>>>(WIFI_MODE_NULL, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_mode_t>, StaticText<TEXT_WIFI_MODE_STA>>>(WIFI_MODE_STA, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_mode_t>, StaticText<TEXT_WIFI_MODE_AP>>>(WIFI_MODE_AP, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_mode_t>, StaticText<TEXT_WIFI_MODE_APSTA>>>(WIFI_MODE_APSTA, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, BackProxyAction, StaticText<TEXT_BACK>, StaticMenuItemIcon<&espgui::icons::back>>>(*this);
|
||||
}
|
||||
|
||||
void ChangeValueDisplay<wifi_mode_t>::start()
|
||||
{
|
||||
Base::start();
|
||||
|
||||
switch (const auto value = getValue())
|
||||
{
|
||||
case WIFI_MODE_NULL: setSelectedIndex(0); break;
|
||||
case WIFI_MODE_STA: setSelectedIndex(1); break;
|
||||
case WIFI_MODE_AP: setSelectedIndex(2); break;
|
||||
case WIFI_MODE_APSTA: setSelectedIndex(3); break;
|
||||
default:
|
||||
ESP_LOGW("BOBBY", "Unknown wifi_mode_t: %i", int(value));
|
||||
setSelectedIndex(4);
|
||||
}
|
||||
}
|
||||
} // namespace espgui
|
@ -1,66 +0,0 @@
|
||||
#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 espgui {
|
||||
//template<>
|
||||
//class ChangeValueDisplay<wifi_power_t> :
|
||||
// public MenuDisplay,
|
||||
// public virtual AccessorInterface<wifi_power_t>,
|
||||
// public virtual ActionInterface
|
||||
//{
|
||||
// using Base = MenuDisplay;
|
||||
|
||||
//public:
|
||||
// ChangeValueDisplay();
|
||||
|
||||
// void start() override;
|
||||
//};
|
||||
|
||||
//ChangeValueDisplay<wifi_power_t>::ChangeValueDisplay()
|
||||
//{
|
||||
// constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_power_t>, StaticText<TEXT_WIFI_POWER_19_5dBm>>>(WIFI_POWER_19_5dBm, *this, *this);
|
||||
// constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_power_t>, StaticText<TEXT_WIFI_POWER_19dBm>>>(WIFI_POWER_19dBm, *this, *this);
|
||||
// constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_power_t>, StaticText<TEXT_WIFI_POWER_18_5dBm>>>(WIFI_POWER_18_5dBm, *this, *this);
|
||||
// constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_power_t>, StaticText<TEXT_WIFI_POWER_17dBm>>>(WIFI_POWER_17dBm, *this, *this);
|
||||
// constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_power_t>, StaticText<TEXT_WIFI_POWER_15dBm>>>(WIFI_POWER_15dBm, *this, *this);
|
||||
// constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_power_t>, StaticText<TEXT_WIFI_POWER_13dBm>>>(WIFI_POWER_13dBm, *this, *this);
|
||||
// constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_power_t>, StaticText<TEXT_WIFI_POWER_11dBm>>>(WIFI_POWER_11dBm, *this, *this);
|
||||
// constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_power_t>, StaticText<TEXT_WIFI_POWER_8_5dBm>>>(WIFI_POWER_8_5dBm, *this, *this);
|
||||
// constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_power_t>, StaticText<TEXT_WIFI_POWER_7dBm>>>(WIFI_POWER_7dBm, *this, *this);
|
||||
// constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_power_t>, StaticText<TEXT_WIFI_POWER_5dBm>>>(WIFI_POWER_5dBm, *this, *this);
|
||||
// constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_power_t>, StaticText<TEXT_WIFI_POWER_2dBm>>>(WIFI_POWER_2dBm, *this, *this);
|
||||
// constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<wifi_power_t>, StaticText<TEXT_WIFI_POWER_MINUS_1dBm>>>(WIFI_POWER_MINUS_1dBm, *this, *this);
|
||||
// constructMenuItem<makeComponentArgs<MenuItem, BackProxyAction, StaticText<TEXT_BACK>, StaticMenuItemIcon<&espgui::icons::back>>>(*this);
|
||||
//}
|
||||
|
||||
//void ChangeValueDisplay<wifi_power_t>::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);
|
||||
// }
|
||||
//}
|
||||
} // namespace espgui
|
@ -5,9 +5,12 @@
|
||||
|
||||
// local includes
|
||||
#include "bobbybuttons.h"
|
||||
#include "bobbyerrorhandler.h"
|
||||
|
||||
template<typename Tvalue>
|
||||
class BobbyChangeValueDisplay : public espgui::ChangeValueDisplay<Tvalue>
|
||||
class BobbyChangeValueDisplay :
|
||||
public espgui::ChangeValueDisplay<Tvalue>,
|
||||
public virtual BobbyErrorHandler
|
||||
{
|
||||
using Base = espgui::ChangeValueDisplay<Tvalue>;
|
||||
|
||||
@ -23,63 +26,23 @@ template<typename Tvalue>
|
||||
void BobbyChangeValueDisplay<Tvalue>::rawButtonPressed(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonPressed(button);
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case 0: buttonPressed(Button::Left); break;
|
||||
case 1: buttonPressed(Button::Right); break;
|
||||
case 2: buttonPressed(Button::Up); break;
|
||||
case 3: buttonPressed(Button::Down); break;
|
||||
case 4: buttonPressed(Button(BobbyButton::Profile0)); break;
|
||||
case 5: buttonPressed(Button(BobbyButton::Profile1)); break;
|
||||
case 6: buttonPressed(Button(BobbyButton::Profile2)); break;
|
||||
case 7: buttonPressed(Button(BobbyButton::Profile3)); break;
|
||||
case 8: buttonPressed(Button(BobbyButton::Left2)); break;
|
||||
case 9: buttonPressed(Button(BobbyButton::Right2)); break;
|
||||
case 10: buttonPressed(Button(BobbyButton::Up2)); break;
|
||||
case 11: buttonPressed(Button(BobbyButton::Down2)); break;
|
||||
}
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonPressed(*translated);
|
||||
}
|
||||
|
||||
template<typename Tvalue>
|
||||
void BobbyChangeValueDisplay<Tvalue>::rawButtonReleased(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonReleased(button);
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case 0: buttonReleased(Button::Left); break;
|
||||
case 1: buttonReleased(Button::Right); break;
|
||||
case 2: buttonReleased(Button::Up); break;
|
||||
case 3: buttonReleased(Button::Down); break;
|
||||
case 4: buttonReleased(Button(BobbyButton::Profile0)); break;
|
||||
case 5: buttonReleased(Button(BobbyButton::Profile1)); break;
|
||||
case 6: buttonReleased(Button(BobbyButton::Profile2)); break;
|
||||
case 7: buttonReleased(Button(BobbyButton::Profile3)); break;
|
||||
case 8: buttonReleased(Button(BobbyButton::Left2)); break;
|
||||
case 9: buttonReleased(Button(BobbyButton::Right2)); break;
|
||||
case 10: buttonReleased(Button(BobbyButton::Up2)); break;
|
||||
case 11: buttonReleased(Button(BobbyButton::Down2)); break;
|
||||
}
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonReleased(*translated);
|
||||
}
|
||||
|
||||
template<typename Tvalue>
|
||||
void BobbyChangeValueDisplay<Tvalue>::buttonPressed(espgui::Button button)
|
||||
{
|
||||
Base::buttonPressed(button);
|
||||
|
||||
switch (BobbyButton(button))
|
||||
{
|
||||
case BobbyButton::Profile0: /* TODO */ break;
|
||||
case BobbyButton::Profile1: /* TODO */ break;
|
||||
case BobbyButton::Profile2: /* TODO */ break;
|
||||
case BobbyButton::Profile3: /* TODO */ break;
|
||||
case BobbyButton::Left2: /* TODO */ break;
|
||||
case BobbyButton::Right2: /* TODO */ break;
|
||||
case BobbyButton::Up2: /* TODO */ break;
|
||||
case BobbyButton::Down2: /* TODO */ break;
|
||||
default:;
|
||||
}
|
||||
buttonPressedCommon(button);
|
||||
}
|
||||
|
||||
template<typename Tvalue>
|
||||
|
@ -1,63 +1,26 @@
|
||||
#include "bobbydisplay.h"
|
||||
|
||||
// local includes
|
||||
#include "bobbybuttons.h"
|
||||
|
||||
void BobbyDisplay::rawButtonPressed(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonPressed(button);
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case 0: buttonPressed(Button::Left); break;
|
||||
case 1: buttonPressed(Button::Right); break;
|
||||
case 2: buttonPressed(Button::Up); break;
|
||||
case 3: buttonPressed(Button::Down); break;
|
||||
case 4: buttonPressed(Button(BobbyButton::Profile0)); break;
|
||||
case 5: buttonPressed(Button(BobbyButton::Profile1)); break;
|
||||
case 6: buttonPressed(Button(BobbyButton::Profile2)); break;
|
||||
case 7: buttonPressed(Button(BobbyButton::Profile3)); break;
|
||||
case 8: buttonPressed(Button(BobbyButton::Left2)); break;
|
||||
case 9: buttonPressed(Button(BobbyButton::Right2)); break;
|
||||
case 10: buttonPressed(Button(BobbyButton::Up2)); break;
|
||||
case 11: buttonPressed(Button(BobbyButton::Down2)); break;
|
||||
}
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonPressed(*translated);
|
||||
}
|
||||
|
||||
void BobbyDisplay::rawButtonReleased(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonReleased(button);
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case 0: buttonReleased(Button::Left); break;
|
||||
case 1: buttonReleased(Button::Right); break;
|
||||
case 2: buttonReleased(Button::Up); break;
|
||||
case 3: buttonReleased(Button::Down); break;
|
||||
case 4: buttonReleased(Button(BobbyButton::Profile0)); break;
|
||||
case 5: buttonReleased(Button(BobbyButton::Profile1)); break;
|
||||
case 6: buttonReleased(Button(BobbyButton::Profile2)); break;
|
||||
case 7: buttonReleased(Button(BobbyButton::Profile3)); break;
|
||||
case 8: buttonReleased(Button(BobbyButton::Left2)); break;
|
||||
case 9: buttonReleased(Button(BobbyButton::Right2)); break;
|
||||
case 10: buttonReleased(Button(BobbyButton::Up2)); break;
|
||||
case 11: buttonReleased(Button(BobbyButton::Down2)); break;
|
||||
}
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonReleased(*translated);
|
||||
}
|
||||
|
||||
void BobbyDisplay::buttonPressed(espgui::Button button)
|
||||
{
|
||||
//Base::buttonPressed(button);
|
||||
|
||||
switch (BobbyButton(button))
|
||||
{
|
||||
case BobbyButton::Profile0: /* TODO */ break;
|
||||
case BobbyButton::Profile1: /* TODO */ break;
|
||||
case BobbyButton::Profile2: /* TODO */ break;
|
||||
case BobbyButton::Profile3: /* TODO */ break;
|
||||
case BobbyButton::Left2: /* TODO */ break;
|
||||
case BobbyButton::Right2: /* TODO */ break;
|
||||
case BobbyButton::Up2: /* TODO */ break;
|
||||
case BobbyButton::Down2: /* TODO */ break;
|
||||
default:;
|
||||
}
|
||||
buttonPressedCommon(button);
|
||||
}
|
||||
|
||||
void BobbyDisplay::buttonReleased(espgui::Button button)
|
||||
|
@ -3,9 +3,6 @@
|
||||
// 3rdparty lib includes
|
||||
#include <display.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbybuttons.h"
|
||||
|
||||
class BobbyDisplay : public espgui::Display
|
||||
{
|
||||
using Base = espgui::Display;
|
||||
|
@ -1,63 +1,26 @@
|
||||
#include "bobbydisplaywithtitle.h"
|
||||
|
||||
// local includes
|
||||
#include "bobbybuttons.h"
|
||||
|
||||
void BobbyDisplayWithTitle::rawButtonPressed(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonPressed(button);
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case 0: buttonPressed(Button::Left); break;
|
||||
case 1: buttonPressed(Button::Right); break;
|
||||
case 2: buttonPressed(Button::Up); break;
|
||||
case 3: buttonPressed(Button::Down); break;
|
||||
case 4: buttonPressed(Button(BobbyButton::Profile0)); break;
|
||||
case 5: buttonPressed(Button(BobbyButton::Profile1)); break;
|
||||
case 6: buttonPressed(Button(BobbyButton::Profile2)); break;
|
||||
case 7: buttonPressed(Button(BobbyButton::Profile3)); break;
|
||||
case 8: buttonPressed(Button(BobbyButton::Left2)); break;
|
||||
case 9: buttonPressed(Button(BobbyButton::Right2)); break;
|
||||
case 10: buttonPressed(Button(BobbyButton::Up2)); break;
|
||||
case 11: buttonPressed(Button(BobbyButton::Down2)); break;
|
||||
}
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonPressed(*translated);
|
||||
}
|
||||
|
||||
void BobbyDisplayWithTitle::rawButtonReleased(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonReleased(button);
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case 0: buttonReleased(Button::Left); break;
|
||||
case 1: buttonReleased(Button::Right); break;
|
||||
case 2: buttonReleased(Button::Up); break;
|
||||
case 3: buttonReleased(Button::Down); break;
|
||||
case 4: buttonReleased(Button(BobbyButton::Profile0)); break;
|
||||
case 5: buttonReleased(Button(BobbyButton::Profile1)); break;
|
||||
case 6: buttonReleased(Button(BobbyButton::Profile2)); break;
|
||||
case 7: buttonReleased(Button(BobbyButton::Profile3)); break;
|
||||
case 8: buttonReleased(Button(BobbyButton::Left2)); break;
|
||||
case 9: buttonReleased(Button(BobbyButton::Right2)); break;
|
||||
case 10: buttonReleased(Button(BobbyButton::Up2)); break;
|
||||
case 11: buttonReleased(Button(BobbyButton::Down2)); break;
|
||||
}
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonReleased(*translated);
|
||||
}
|
||||
|
||||
void BobbyDisplayWithTitle::buttonPressed(espgui::Button button)
|
||||
{
|
||||
//Base::buttonPressed(button);
|
||||
|
||||
switch (BobbyButton(button))
|
||||
{
|
||||
case BobbyButton::Profile0: /* TODO */ break;
|
||||
case BobbyButton::Profile1: /* TODO */ break;
|
||||
case BobbyButton::Profile2: /* TODO */ break;
|
||||
case BobbyButton::Profile3: /* TODO */ break;
|
||||
case BobbyButton::Left2: /* TODO */ break;
|
||||
case BobbyButton::Right2: /* TODO */ break;
|
||||
case BobbyButton::Up2: /* TODO */ break;
|
||||
case BobbyButton::Down2: /* TODO */ break;
|
||||
default:;
|
||||
}
|
||||
buttonPressedCommon(button);
|
||||
}
|
||||
|
||||
void BobbyDisplayWithTitle::buttonReleased(espgui::Button button)
|
||||
|
@ -3,9 +3,6 @@
|
||||
// 3rdparty lib includes
|
||||
#include <displaywithtitle.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbybuttons.h"
|
||||
|
||||
class BobbyDisplayWithTitle : public espgui::DisplayWithTitle
|
||||
{
|
||||
using Base = espgui::DisplayWithTitle;
|
||||
|
@ -23,63 +23,23 @@ template<size_t COUNT>
|
||||
void BobbyGraphDisplay<COUNT>::rawButtonPressed(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonPressed(button);
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case 0: buttonPressed(Button::Left); break;
|
||||
case 1: buttonPressed(Button::Right); break;
|
||||
case 2: buttonPressed(Button::Up); break;
|
||||
case 3: buttonPressed(Button::Down); break;
|
||||
case 4: buttonPressed(Button(BobbyButton::Profile0)); break;
|
||||
case 5: buttonPressed(Button(BobbyButton::Profile1)); break;
|
||||
case 6: buttonPressed(Button(BobbyButton::Profile2)); break;
|
||||
case 7: buttonPressed(Button(BobbyButton::Profile3)); break;
|
||||
case 8: buttonPressed(Button(BobbyButton::Left2)); break;
|
||||
case 9: buttonPressed(Button(BobbyButton::Right2)); break;
|
||||
case 10: buttonPressed(Button(BobbyButton::Up2)); break;
|
||||
case 11: buttonPressed(Button(BobbyButton::Down2)); break;
|
||||
}
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonPressed(*translated);
|
||||
}
|
||||
|
||||
template<size_t COUNT>
|
||||
void BobbyGraphDisplay<COUNT>::rawButtonReleased(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonReleased(button);
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case 0: buttonReleased(Button::Left); break;
|
||||
case 1: buttonReleased(Button::Right); break;
|
||||
case 2: buttonReleased(Button::Up); break;
|
||||
case 3: buttonReleased(Button::Down); break;
|
||||
case 4: buttonReleased(Button(BobbyButton::Profile0)); break;
|
||||
case 5: buttonReleased(Button(BobbyButton::Profile1)); break;
|
||||
case 6: buttonReleased(Button(BobbyButton::Profile2)); break;
|
||||
case 7: buttonReleased(Button(BobbyButton::Profile3)); break;
|
||||
case 8: buttonReleased(Button(BobbyButton::Left2)); break;
|
||||
case 9: buttonReleased(Button(BobbyButton::Right2)); break;
|
||||
case 10: buttonReleased(Button(BobbyButton::Up2)); break;
|
||||
case 11: buttonReleased(Button(BobbyButton::Down2)); break;
|
||||
}
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonReleased(*translated);
|
||||
}
|
||||
|
||||
template<size_t COUNT>
|
||||
void BobbyGraphDisplay<COUNT>::buttonPressed(espgui::Button button)
|
||||
{
|
||||
Base::buttonPressed(button);
|
||||
|
||||
switch (BobbyButton(button))
|
||||
{
|
||||
case BobbyButton::Profile0: /* TODO */ break;
|
||||
case BobbyButton::Profile1: /* TODO */ break;
|
||||
case BobbyButton::Profile2: /* TODO */ break;
|
||||
case BobbyButton::Profile3: /* TODO */ break;
|
||||
case BobbyButton::Left2: /* TODO */ break;
|
||||
case BobbyButton::Right2: /* TODO */ break;
|
||||
case BobbyButton::Up2: /* TODO */ break;
|
||||
case BobbyButton::Down2: /* TODO */ break;
|
||||
default:;
|
||||
}
|
||||
buttonPressedCommon(button);
|
||||
}
|
||||
|
||||
template<size_t COUNT>
|
||||
|
@ -1,63 +1,26 @@
|
||||
#include "bobbymenudisplay.h"
|
||||
|
||||
// local includes
|
||||
#include "bobbybuttons.h"
|
||||
|
||||
void BobbyMenuDisplay::rawButtonPressed(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonPressed(button);
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case 0: buttonPressed(Button::Left); break;
|
||||
case 1: buttonPressed(Button::Right); break;
|
||||
case 2: buttonPressed(Button::Up); break;
|
||||
case 3: buttonPressed(Button::Down); break;
|
||||
case 4: buttonPressed(Button(BobbyButton::Profile0)); break;
|
||||
case 5: buttonPressed(Button(BobbyButton::Profile1)); break;
|
||||
case 6: buttonPressed(Button(BobbyButton::Profile2)); break;
|
||||
case 7: buttonPressed(Button(BobbyButton::Profile3)); break;
|
||||
case 8: buttonPressed(Button(BobbyButton::Left2)); break;
|
||||
case 9: buttonPressed(Button(BobbyButton::Right2)); break;
|
||||
case 10: buttonPressed(Button(BobbyButton::Up2)); break;
|
||||
case 11: buttonPressed(Button(BobbyButton::Down2)); break;
|
||||
}
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonPressed(*translated);
|
||||
}
|
||||
|
||||
void BobbyMenuDisplay::rawButtonReleased(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonReleased(button);
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case 0: buttonReleased(Button::Left); break;
|
||||
case 1: buttonReleased(Button::Right); break;
|
||||
case 2: buttonReleased(Button::Up); break;
|
||||
case 3: buttonReleased(Button::Down); break;
|
||||
case 4: buttonReleased(Button(BobbyButton::Profile0)); break;
|
||||
case 5: buttonReleased(Button(BobbyButton::Profile1)); break;
|
||||
case 6: buttonReleased(Button(BobbyButton::Profile2)); break;
|
||||
case 7: buttonReleased(Button(BobbyButton::Profile3)); break;
|
||||
case 8: buttonReleased(Button(BobbyButton::Left2)); break;
|
||||
case 9: buttonReleased(Button(BobbyButton::Right2)); break;
|
||||
case 10: buttonReleased(Button(BobbyButton::Up2)); break;
|
||||
case 11: buttonReleased(Button(BobbyButton::Down2)); break;
|
||||
}
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonReleased(*translated);
|
||||
}
|
||||
|
||||
void BobbyMenuDisplay::buttonPressed(espgui::Button button)
|
||||
{
|
||||
Base::buttonPressed(button);
|
||||
|
||||
switch (BobbyButton(button))
|
||||
{
|
||||
case BobbyButton::Profile0: /* TODO */ break;
|
||||
case BobbyButton::Profile1: /* TODO */ break;
|
||||
case BobbyButton::Profile2: /* TODO */ break;
|
||||
case BobbyButton::Profile3: /* TODO */ break;
|
||||
case BobbyButton::Left2: /* TODO */ break;
|
||||
case BobbyButton::Right2: /* TODO */ break;
|
||||
case BobbyButton::Up2: /* TODO */ break;
|
||||
case BobbyButton::Down2: /* TODO */ break;
|
||||
default:;
|
||||
}
|
||||
buttonPressedCommon(button);
|
||||
}
|
||||
|
||||
void BobbyMenuDisplay::buttonReleased(espgui::Button button)
|
||||
|
@ -3,9 +3,6 @@
|
||||
// 3rdparty lib includes
|
||||
#include <menudisplay.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbybuttons.h"
|
||||
|
||||
class BobbyMenuDisplay : public espgui::MenuDisplay
|
||||
{
|
||||
using Base = espgui::MenuDisplay;
|
||||
|
29
main/displays/bobbypopupdisplay.cpp
Normal file
29
main/displays/bobbypopupdisplay.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include "bobbypopupdisplay.h"
|
||||
|
||||
// local includes
|
||||
#include "bobbybuttons.h"
|
||||
|
||||
void BobbyPopupDisplay::rawButtonPressed(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonPressed(button);
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonPressed(*translated);
|
||||
}
|
||||
|
||||
void BobbyPopupDisplay::rawButtonReleased(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonReleased(button);
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonReleased(*translated);
|
||||
}
|
||||
|
||||
void BobbyPopupDisplay::buttonPressed(espgui::Button button)
|
||||
{
|
||||
Base::buttonPressed(button);
|
||||
buttonPressedCommon(button);
|
||||
}
|
||||
|
||||
void BobbyPopupDisplay::buttonReleased(espgui::Button button)
|
||||
{
|
||||
//Base::buttonReleased(button);
|
||||
}
|
18
main/displays/bobbypopupdisplay.h
Normal file
18
main/displays/bobbypopupdisplay.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <popupdisplay.h>
|
||||
|
||||
class BobbyPopupDisplay : public espgui::PopupDisplay
|
||||
{
|
||||
using Base = espgui::PopupDisplay;
|
||||
|
||||
public:
|
||||
using Base::Base;
|
||||
|
||||
void rawButtonPressed(uint8_t button) override;
|
||||
void rawButtonReleased(uint8_t button) override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
void buttonReleased(espgui::Button button) override;
|
||||
};
|
@ -23,63 +23,23 @@ template<std::size_t COUNT0, std::size_t COUNT1>
|
||||
void BobbySplitGraphDisplay<COUNT0, COUNT1>::rawButtonPressed(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonPressed(button);
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case 0: buttonPressed(Button::Left); break;
|
||||
case 1: buttonPressed(Button::Right); break;
|
||||
case 2: buttonPressed(Button::Up); break;
|
||||
case 3: buttonPressed(Button::Down); break;
|
||||
case 4: buttonPressed(Button(BobbyButton::Profile0)); break;
|
||||
case 5: buttonPressed(Button(BobbyButton::Profile1)); break;
|
||||
case 6: buttonPressed(Button(BobbyButton::Profile2)); break;
|
||||
case 7: buttonPressed(Button(BobbyButton::Profile3)); break;
|
||||
case 8: buttonPressed(Button(BobbyButton::Left2)); break;
|
||||
case 9: buttonPressed(Button(BobbyButton::Right2)); break;
|
||||
case 10: buttonPressed(Button(BobbyButton::Up2)); break;
|
||||
case 11: buttonPressed(Button(BobbyButton::Down2)); break;
|
||||
}
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonPressed(*translated);
|
||||
}
|
||||
|
||||
template<std::size_t COUNT0, std::size_t COUNT1>
|
||||
void BobbySplitGraphDisplay<COUNT0, COUNT1>::rawButtonReleased(uint8_t button)
|
||||
{
|
||||
//Base::rawButtonReleased(button);
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case 0: buttonReleased(Button::Left); break;
|
||||
case 1: buttonReleased(Button::Right); break;
|
||||
case 2: buttonReleased(Button::Up); break;
|
||||
case 3: buttonReleased(Button::Down); break;
|
||||
case 4: buttonReleased(Button(BobbyButton::Profile0)); break;
|
||||
case 5: buttonReleased(Button(BobbyButton::Profile1)); break;
|
||||
case 6: buttonReleased(Button(BobbyButton::Profile2)); break;
|
||||
case 7: buttonReleased(Button(BobbyButton::Profile3)); break;
|
||||
case 8: buttonReleased(Button(BobbyButton::Left2)); break;
|
||||
case 9: buttonReleased(Button(BobbyButton::Right2)); break;
|
||||
case 10: buttonReleased(Button(BobbyButton::Up2)); break;
|
||||
case 11: buttonReleased(Button(BobbyButton::Down2)); break;
|
||||
}
|
||||
if (const auto translated = translateRawButton(button))
|
||||
buttonReleased(*translated);
|
||||
}
|
||||
|
||||
template<std::size_t COUNT0, std::size_t COUNT1>
|
||||
void BobbySplitGraphDisplay<COUNT0, COUNT1>::buttonPressed(espgui::Button button)
|
||||
{
|
||||
Base::buttonPressed(button);
|
||||
|
||||
switch (BobbyButton(button))
|
||||
{
|
||||
case BobbyButton::Profile0: /* TODO */ break;
|
||||
case BobbyButton::Profile1: /* TODO */ break;
|
||||
case BobbyButton::Profile2: /* TODO */ break;
|
||||
case BobbyButton::Profile3: /* TODO */ break;
|
||||
case BobbyButton::Left2: /* TODO */ break;
|
||||
case BobbyButton::Right2: /* TODO */ break;
|
||||
case BobbyButton::Up2: /* TODO */ break;
|
||||
case BobbyButton::Down2: /* TODO */ break;
|
||||
default:;
|
||||
}
|
||||
buttonPressedCommon(button);
|
||||
}
|
||||
|
||||
template<std::size_t COUNT0, std::size_t COUNT1>
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "displays/menus/mainmenu.h"
|
||||
#include "displays/statusdisplay.h"
|
||||
#include "displays/menus/boardcomputerhardwaresettingsmenu.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
CalibrateDisplay::CalibrateDisplay(bool bootup) :
|
||||
m_bootup{bootup}
|
||||
@ -274,16 +275,16 @@ void CalibrateDisplay::buttonPressed(espgui::Button button)
|
||||
|
||||
void CalibrateDisplay::copyFromSettings()
|
||||
{
|
||||
m_gasMin = settings.boardcomputerHardware.gasMin;
|
||||
m_gasMax = settings.boardcomputerHardware.gasMax;
|
||||
m_bremsMin = settings.boardcomputerHardware.bremsMin;
|
||||
m_bremsMax = settings.boardcomputerHardware.bremsMax;
|
||||
m_gasMin = configs.gasMin.value;
|
||||
m_gasMax = configs.gasMax.value;
|
||||
m_bremsMin = configs.bremsMin.value;
|
||||
m_bremsMax = configs.bremsMax.value;
|
||||
}
|
||||
|
||||
void CalibrateDisplay::copyToSettings()
|
||||
{
|
||||
settings.boardcomputerHardware.gasMin = m_gasMin;
|
||||
settings.boardcomputerHardware.gasMax = m_gasMax;
|
||||
settings.boardcomputerHardware.bremsMin = m_bremsMin;
|
||||
settings.boardcomputerHardware.bremsMax = m_bremsMax;
|
||||
configs.write_config(configs.gasMin, m_gasMin);
|
||||
configs.write_config(configs.gasMax, m_gasMax);
|
||||
configs.write_config(configs.bremsMin, m_bremsMin);
|
||||
configs.write_config(configs.bremsMax, m_bremsMax);
|
||||
}
|
||||
|
@ -2,13 +2,14 @@
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <changevaluedisplay.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
#include <fmt/core.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
#include "mainmenu.h"
|
||||
#include "displays/calibratevoltagedisplay.h"
|
||||
#include "accessors/settingsaccessors.h"
|
||||
#include "fmt/core.h"
|
||||
#include "battery.h"
|
||||
|
||||
class CurrentBatteryStatusText : public virtual espgui::TextInterface { public: std::string text() const override { return getBatteryPercentageString(); } };
|
||||
@ -17,24 +18,24 @@ using BatteryCellSeriesChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_CELL_SERIES>,
|
||||
BatterySeriesCellsAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
|
||||
espgui::SwitchScreenAction<BatteryMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>
|
||||
>;
|
||||
|
||||
using BatteryCellParallelChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_CELL_PARALLEL>,
|
||||
BatteryParallelCellsAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
|
||||
espgui::SwitchScreenAction<BatteryMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>
|
||||
>;
|
||||
|
||||
using BatteryWHperKMChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint16_t>,
|
||||
espgui::StaticText<TEXT_BATTERY_WHKM>,
|
||||
BatteryWHperKMAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
|
||||
espgui::SwitchScreenAction<BatteryMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>
|
||||
>;
|
||||
|
||||
using namespace espgui;
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <actions/toggleboolaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <checkboxicon.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
@ -47,36 +48,36 @@ using SampleCountChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SAMPLECOUNT>,
|
||||
SampleCountAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||
>;
|
||||
using GasMinChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_GASMIN>,
|
||||
GasMinAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||
>;
|
||||
using GasMaxChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_GASMAX>,
|
||||
GasMaxAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||
>;
|
||||
using BremsMinChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_BREMSMIN>,
|
||||
BremsMinAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||
>;
|
||||
using BremsMaxChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_BREMSMAX>,
|
||||
BremsMaxAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||
>;
|
||||
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW) || defined(FEATURE_DPAD_5WIRESW_2OUT) || defined (FEATURE_DPAD_6WIRESW)
|
||||
@ -84,8 +85,8 @@ using DPadDebounceChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_DPADDEBOUNCE>,
|
||||
DPadDebounceAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||
>;
|
||||
#endif
|
||||
|
||||
@ -107,43 +108,43 @@ using GametrakXMinChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SETGAMETRAKXMIN>,
|
||||
GametrakXMinAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||
>;
|
||||
using GametrakXMaxChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SETGAMETRAKXMAX>,
|
||||
GametrakXMaxAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||
>;
|
||||
using GametrakYMinChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SETGAMETRAKYMIN>,
|
||||
GametrakYMinAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||
>;
|
||||
using GametrakYMaxChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SETGAMETRAKYMAX>,
|
||||
GametrakYMaxAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||
>;
|
||||
using GametrakDistMinChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SETGAMETRAKDISTMIN>,
|
||||
GametrakDistMinAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||
>;
|
||||
using GametrakDistMaxChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SETGAMETRAKDISTMAX>,
|
||||
GametrakDistMaxAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||
>;
|
||||
#endif
|
||||
} // namespace
|
||||
|
@ -21,8 +21,8 @@ using FrontFreqChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_FRONTFREQ>,
|
||||
FrontFreqAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::SwitchScreenAction<BuzzerMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
|
||||
>;
|
||||
|
||||
struct FrontPatternAccessor : public espgui::RefAccessor<uint8_t> { uint8_t &getRef() const override { return controllers.front.command.buzzer.pattern; } };
|
||||
@ -30,8 +30,8 @@ using FrontPatternChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_FRONTPATTERN>,
|
||||
FrontPatternAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::SwitchScreenAction<BuzzerMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
|
||||
>;
|
||||
|
||||
struct BackFreqAccessor : public espgui::RefAccessor<uint8_t> { uint8_t &getRef() const override { return controllers.back.command.buzzer.freq; } };
|
||||
@ -39,8 +39,8 @@ using BackFreqChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_BACKFREQ>,
|
||||
BackFreqAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::SwitchScreenAction<BuzzerMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
|
||||
>;
|
||||
|
||||
struct BackPatternAccessor : public espgui::RefAccessor<uint8_t> { uint8_t &getRef() const override { return controllers.back.command.buzzer.pattern; } };
|
||||
@ -48,37 +48,37 @@ using BackPatternChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_BACKPATTERN>,
|
||||
BackPatternAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::SwitchScreenAction<BuzzerMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
|
||||
>;
|
||||
|
||||
using ReverseBeepFreq0ChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_REVERSEBEEPFREQ0>,
|
||||
ReverseBeepFreq0Accessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::SwitchScreenAction<BuzzerMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
|
||||
>;
|
||||
using ReverseBeepFreq1ChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_REVERSEBEEPFREQ1>,
|
||||
ReverseBeepFreq1Accessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::SwitchScreenAction<BuzzerMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
|
||||
>;
|
||||
using ReverseBeepDuration0ChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_REVERSEBEEPDURATION0>,
|
||||
ReverseBeepDuration0Accessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::SwitchScreenAction<BuzzerMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
|
||||
>;
|
||||
using ReverseBeepDuration1ChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_REVERSEBEEPDURATION1>,
|
||||
ReverseBeepDuration1Accessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::SwitchScreenAction<BuzzerMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
|
@ -24,8 +24,8 @@ using CloudTransmitTimeoutChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_CLOUDTRANSMITTIMEOUT>,
|
||||
CloudTransmitTimeoutAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<CloudSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>
|
||||
>;
|
||||
|
||||
struct CloudBufferLengthText : public virtual espgui::TextInterface
|
||||
@ -41,16 +41,16 @@ using CloudCollectRateChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_CLOUDCOLLECTRATE>,
|
||||
CloudCollectRateAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<CloudSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>
|
||||
>;
|
||||
|
||||
using CloudSendRateChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_CLOUDSENDRATE>,
|
||||
CloudSendRateAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<CloudSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
#include "debugmenu.h"
|
||||
#include "utils.h"
|
||||
#include "menuitem.h"
|
||||
#include "actions/dummyaction.h"
|
||||
@ -30,7 +31,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class FrontCommandDebugMenu : public CommandDebugMenu<TEXT_FRONTCOMMAND, FrontTexts> {};
|
||||
class BackCommandDebugMenu : public CommandDebugMenu<TEXT_BACKCOMMAND, BackTexts> {};
|
||||
using FrontCommandDebugMenu = CommandDebugMenu<TEXT_FRONTCOMMAND, FrontTexts>;
|
||||
using BackCommandDebugMenu = CommandDebugMenu<TEXT_BACKCOMMAND, BackTexts>;
|
||||
|
||||
} // namespace
|
||||
|
@ -24,38 +24,38 @@ using WheelDiameterMmChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_WHEELDIAMETERMM>,
|
||||
WheelDiameterMmAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
|
||||
>;
|
||||
using WheelDiameterInchChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<float>,
|
||||
espgui::StaticText<TEXT_WHEELDIAMETERINCH>,
|
||||
WheelDiameterInchAccessor,
|
||||
espgui::RatioNumberStep<float, std::ratio<1,10>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
|
||||
>;
|
||||
using NumMagnetPolesChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_NUMMAGNETPOLES>,
|
||||
NumMagnetPolesAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
|
||||
>;
|
||||
#ifdef FEATURE_CAN
|
||||
using CanTransmitTimeoutChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_CANTRANSMITTIMEOUT>,
|
||||
CanTransmitTimeoutAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
|
||||
>;
|
||||
using CanReceiveTimeoutChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_CANRECEIVETIMEOUT>,
|
||||
CanReceiveTimeoutAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
|
||||
>;
|
||||
#endif
|
||||
} // namespace
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "displays/menus/dynamicdebugmenu.h"
|
||||
#include "displays/menus/mainmenu.h"
|
||||
#include "displays/menus/batterydebugmenu.h"
|
||||
#include "displays/popups/alertdisplay.cpp"
|
||||
#include "bobbyerrorhandler.h"
|
||||
|
||||
namespace {
|
||||
class AlertAction : public espgui::MenuItem
|
||||
@ -37,9 +37,7 @@ public:
|
||||
std::string text() const override { return "Open popup"; }
|
||||
void triggered() override
|
||||
{
|
||||
auto newDisplay = std::make_unique<AlertDisplay>("Das\nist\nein sehr langer text, der nicht in eine zeile passt", std::move(currentDisplay));
|
||||
newDisplay->initOverlay();
|
||||
currentDisplay = std::move(newDisplay);
|
||||
BobbyErrorHandler{}.errorOccured("Das\nist\nein sehr langer text, der nicht in eine zeile passt");
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
|
@ -1,13 +1,14 @@
|
||||
#include "defaultmodesettingsmenu.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "changevaluedisplay.h"
|
||||
#include "menuitem.h"
|
||||
#include "actions/toggleboolaction.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "actions/dummyaction.h"
|
||||
#include "checkboxicon.h"
|
||||
#include "icons/back.h"
|
||||
#include <changevaluedisplay.h>
|
||||
#include <menuitem.h>
|
||||
#include <actions/toggleboolaction.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <actions/dummyaction.h>
|
||||
#include <checkboxicon.h>
|
||||
#include <icons/back.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
@ -22,92 +23,92 @@ using DefaultModeModelModeChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<UnifiedModelMode>,
|
||||
espgui::StaticText<TEXT_MODELMODE>,
|
||||
DefaultModeModelModeAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
>;
|
||||
using DefaultModeHybridModelModeChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<UnifiedModelMode>,
|
||||
espgui::StaticText<TEXT_HYBRIDMODE>,
|
||||
DefaultModeHybridModelModeAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
>;
|
||||
using DefaultModeSmoothingChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SMOOTHINGVAL>,
|
||||
DefaultModeSmoothingAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
>;
|
||||
using DefaultModeFwSmoothingLowerLimitChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_FWSMOOTHING_LIMIT>,
|
||||
DefaultModeEnableFieldWeakSmoothingLowerLimitAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
>;
|
||||
using DefaultModeFrontPercentageChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_FRONTPERCENTAGE>,
|
||||
DefaultModeFrontPercentageAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
>;
|
||||
using DefaultModeBackPercentageChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_BACKPERCENTAGE>,
|
||||
DefaultModeBackPercentageAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
>;
|
||||
using DefaultModeAddSchwelleChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_ADDSCHWELLE>,
|
||||
DefaultModeAddSchwelleAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
>;
|
||||
using DefaultModeGas1WertChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_ADDGASVAL>,
|
||||
DefaultModeGas1WertAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
>;
|
||||
using DefaultModeGas2WertChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SUBGASVAL>,
|
||||
DefaultModeGas2WertAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
>;
|
||||
using DefaultModeBrems1WertChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_ADDBRAKEVAL>,
|
||||
DefaultModeBrems1WertAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
>;
|
||||
using DefaultModeBrems2WertChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SUBBRAKEVAL>,
|
||||
DefaultModeBrems2WertAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
>;
|
||||
using DefaultModeHybridActivationLimitChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_HYBRIDACTIVATIONLIMIT>,
|
||||
DefaultModeHybridActivationLimitAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
>;
|
||||
using DefaultModeHybridDeactivationLimitChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_HYBRIDDEACTIVATIONLIMIT>,
|
||||
DefaultModeHybridDeactivationLimitAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
@ -125,8 +126,8 @@ DefaultModeSettingsMenu::DefaultModeSettingsMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ENABLESMOOTHINGDOWN>, ToggleBoolAction, CheckboxIcon, DefaultModeEnableSmoothingDownAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ENABLEFWSMOOTHINGUP>, ToggleBoolAction, CheckboxIcon, DefaultModeEnableFieldWeakSmoothingUpAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ENABLEFWSMOOTHINGDOWN>, ToggleBoolAction, CheckboxIcon, DefaultModeEnableFieldWeakSmoothingDownAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_HYBRIDENABLE>, ToggleBoolAction, CheckboxIcon, DefaultModeEnableHybridAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_HANDBREMSE>, SwitchScreenAction<HandbremsSettingsMenu>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_HYBRIDENABLE>, ToggleBoolAction, CheckboxIcon, DefaultModeEnableHybridAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_HANDBREMSE>, SwitchScreenAction<HandbremsSettingsMenu>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_FWSMOOTHING_LIMIT, DefaultModeEnableFieldWeakSmoothingLowerLimitAccessor>, SwitchScreenAction<DefaultModeFwSmoothingLowerLimitChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_SMOOTHINGVAL, DefaultModeSmoothingAccessor>, SwitchScreenAction<DefaultModeSmoothingChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_FRONTPERCENTAGE, DefaultModeFrontPercentageAccessor>, SwitchScreenAction<DefaultModeFrontPercentageChangeDisplay>>>();
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
#include "debugmenu.h"
|
||||
#include "utils.h"
|
||||
#include "menuitem.h"
|
||||
#include "actions/dummyaction.h"
|
||||
@ -33,7 +34,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class FrontFeedbackDebugMenu : public FeedbackDebugMenu<TEXT_FRONTFEEDBACK, FrontTexts, FrontFeedbackColor> {};
|
||||
class BackFeedbackDebugMenu : public FeedbackDebugMenu<TEXT_BACKFEEDBACK, BackTexts, FrontFeedbackColor> {};
|
||||
using FrontFeedbackDebugMenu = FeedbackDebugMenu<TEXT_FRONTFEEDBACK, FrontTexts, FrontFeedbackColor>;
|
||||
using BackFeedbackDebugMenu = FeedbackDebugMenu<TEXT_BACKFEEDBACK, BackTexts, FrontFeedbackColor>;
|
||||
|
||||
} // namespace
|
||||
|
@ -4,6 +4,9 @@
|
||||
#include <esp_err.h>
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <fmt/core.h>
|
||||
|
||||
// local includes
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "actions/qraction.h"
|
||||
|
@ -2,11 +2,12 @@
|
||||
|
||||
// 3rd party libs
|
||||
#include <fmt/core.h>
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "actions/toggleboolaction.h"
|
||||
#include "changevaluedisplay.h"
|
||||
#include "checkboxicon.h"
|
||||
#include "icons/back.h"
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <actions/toggleboolaction.h>
|
||||
#include <changevaluedisplay.h>
|
||||
#include <checkboxicon.h>
|
||||
#include <icons/back.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
@ -20,15 +21,15 @@ using HandBremsTriggerTimeoutChangeValueDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint16_t>,
|
||||
espgui::StaticText<TEXT_HANDBREMSE_TRIGGERTIMEOUT>,
|
||||
HandbremsTimeoutAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<HandbremsSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>
|
||||
>;
|
||||
using HandBremsModeChangeValueDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<HandbremseMode>,
|
||||
espgui::StaticText<TEXT_HANDBREMSE_MODE>,
|
||||
HandbremsModeAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<HandbremsSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>
|
||||
>;
|
||||
class HandBremsModeText : public virtual espgui::TextInterface
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
class HandbremsSettingsMenu :
|
||||
public BobbyMenuDisplay,
|
||||
public espgui::StaticText<TEXT_DEBUG>
|
||||
public espgui::StaticText<TEXT_HANDBREMSE>
|
||||
{
|
||||
public:
|
||||
HandbremsSettingsMenu();
|
||||
|
@ -19,22 +19,22 @@ using LarsmModeModelModeChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<UnifiedModelMode>,
|
||||
espgui::StaticText<TEXT_MODELMODE>,
|
||||
LarsmModeModelModeAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<LarsmModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>
|
||||
>;
|
||||
using LarsmModeModeChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<LarsmModeMode>,
|
||||
espgui::StaticText<TEXT_SETMODE>,
|
||||
LarsmModeModeAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<LarsmModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>
|
||||
>;
|
||||
using LarsmModeIterationsChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_SETITERATIONS>,
|
||||
LarsmModeIterationsAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<LarsmModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <checkboxicon.h>
|
||||
#include <icons/back.h>
|
||||
#include <menuitem.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
@ -29,72 +30,72 @@ using LedsCountChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_LEDSCOUNT>,
|
||||
LedsCountAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::SwitchScreenAction<LedstripMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
>;
|
||||
|
||||
using CenterOffsetChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_CENTEROFFSET>,
|
||||
CenterOffsetAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::SwitchScreenAction<LedstripMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
>;
|
||||
|
||||
using SmallOffsetChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_SMALLOFFSET>,
|
||||
SmallOffsetAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::SwitchScreenAction<LedstripMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
>;
|
||||
|
||||
using BigOffsetChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_BIGOFFSET>,
|
||||
BigOffsetAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::SwitchScreenAction<LedstripMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
>;
|
||||
|
||||
using DeziampereChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_LEDSTRIP_MILLIAMP>,
|
||||
DeziampereAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::SwitchScreenAction<LedstripMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
>;
|
||||
|
||||
using StVOOffsetChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_STVO_FRONTOFFSET>,
|
||||
LedsStVOFrontOffsetAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::SwitchScreenAction<LedstripMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
>;
|
||||
|
||||
using StVOLengthChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_STVO_FRONTLENGTH>,
|
||||
LedsStVOFrontLengthAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::SwitchScreenAction<LedstripMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
>;
|
||||
|
||||
using animationMultiplierChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_ANIMATION_MULTIPLIER>,
|
||||
AnimationMultiplierAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::SwitchScreenAction<LedstripMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
>;
|
||||
|
||||
using ledstripBrightnessChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_LEDSTRIP_BRIGHTNESS>,
|
||||
LedstripBrightnessAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::SwitchScreenAction<LedstripMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||
>;
|
||||
|
||||
class AllCustomLedsOffAction : public virtual espgui::ActionInterface
|
||||
|
@ -1,10 +1,11 @@
|
||||
#include "limitssettingsmenu.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "changevaluedisplay.h"
|
||||
#include "menuitem.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
#include <changevaluedisplay.h>
|
||||
#include <menuitem.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
@ -17,43 +18,43 @@ using IMotMaxChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_IMOTMAX>,
|
||||
IMotMaxAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<LimitsSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
|
||||
>;
|
||||
using IDcMaxChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_IDCMAX>,
|
||||
IDcMaxAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<LimitsSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
|
||||
>;
|
||||
using NMotMaxKmhChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_NMOTMAXKMH>,
|
||||
NMotMaxKmhAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<LimitsSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
|
||||
>;
|
||||
using NMotMaxRpmChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_NMOTMAX>,
|
||||
NMotMaxRpmAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<LimitsSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
|
||||
>;
|
||||
using FieldWeakMaxChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_FIELDWEAKMAX>,
|
||||
FieldWeakMaxAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<LimitsSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
|
||||
>;
|
||||
using PhaseAdvMaxChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_PHASEADVMAX>,
|
||||
PhaseAdvMaxAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<LimitsSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
#include "lockscreensettingsmenu.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "menuitem.h"
|
||||
#include "actions/toggleboolaction.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
#include "checkboxicon.h"
|
||||
#include "changevaluedisplay.h"
|
||||
#include <menuitem.h>
|
||||
#include <actions/toggleboolaction.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <checkboxicon.h>
|
||||
#include <changevaluedisplay.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
@ -19,32 +20,32 @@ using LockscreenPinDigit0ChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int8_t>,
|
||||
espgui::StaticText<TEXT_PINDIGIT0>,
|
||||
LockscreenPinDigitAccessor<0>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<LockscreenSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>
|
||||
>;
|
||||
|
||||
using LockscreenPinDigit1ChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int8_t>,
|
||||
espgui::StaticText<TEXT_PINDIGIT1>,
|
||||
LockscreenPinDigitAccessor<1>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<LockscreenSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>
|
||||
>;
|
||||
|
||||
using LockscreenPinDigit2ChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int8_t>,
|
||||
espgui::StaticText<TEXT_PINDIGIT2>,
|
||||
LockscreenPinDigitAccessor<2>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<LockscreenSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>
|
||||
>;
|
||||
|
||||
using LockscreenPinDigit3ChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int8_t>,
|
||||
espgui::StaticText<TEXT_PINDIGIT3>,
|
||||
LockscreenPinDigitAccessor<3>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<LockscreenSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
|
@ -14,7 +14,7 @@ class GPIOAccessor : public virtual espgui::AccessorInterface<bool>
|
||||
{
|
||||
public:
|
||||
bool getValue() const override { return digitalRead(PIN); }
|
||||
void setValue(bool value) override { digitalWrite(PIN, value ? HIGH : LOW); }
|
||||
espgui::AccessorInterface<bool>::setter_result_t setValue(bool value) override { digitalWrite(PIN, value ? HIGH : LOW); return {}; }
|
||||
};
|
||||
|
||||
using Mosfet0Accessor = GPIOAccessor<PINS_MOSFET0>;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
#include "debugmenu.h"
|
||||
#include "utils.h"
|
||||
#include "menuitem.h"
|
||||
#include "actions/dummyaction.h"
|
||||
@ -40,7 +41,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class FrontLeftMotorFeedbackDebugMenu : public MotorFeedbackDebugMenu<TEXT_FRONTLEFTFEEDBACK, FrontTexts::LeftFeedback, FrontFeedbackColor> {};
|
||||
class FrontRightMotorFeedbackDebugMenu : public MotorFeedbackDebugMenu<TEXT_FRONTRIGHTFEEDBACK, FrontTexts::RightFeedback, FrontFeedbackColor> {};
|
||||
class BackLeftMotorFeedbackDebugMenu : public MotorFeedbackDebugMenu<TEXT_BACKLEFTFEEDBACK, BackTexts::LeftFeedback, BackFeedbackColor> {};
|
||||
class BackRightMotorFeedbackDebugMenu : public MotorFeedbackDebugMenu<TEXT_BACKRIGHTFEEDBACK, BackTexts::RightFeedback, BackFeedbackColor> {};
|
||||
using FrontLeftMotorFeedbackDebugMenu = MotorFeedbackDebugMenu<TEXT_FRONTLEFTFEEDBACK, FrontTexts::LeftFeedback, FrontFeedbackColor>;
|
||||
using FrontRightMotorFeedbackDebugMenu = MotorFeedbackDebugMenu<TEXT_FRONTRIGHTFEEDBACK, FrontTexts::RightFeedback, FrontFeedbackColor>;
|
||||
using BackLeftMotorFeedbackDebugMenu = MotorFeedbackDebugMenu<TEXT_BACKLEFTFEEDBACK, BackTexts::LeftFeedback, BackFeedbackColor>;
|
||||
using BackRightMotorFeedbackDebugMenu = MotorFeedbackDebugMenu<TEXT_BACKRIGHTFEEDBACK, BackTexts::RightFeedback, BackFeedbackColor>;
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
#include "debugmenu.h"
|
||||
#include "utils.h"
|
||||
#include "texts.h"
|
||||
#include "debugtexthelpers.h"
|
||||
@ -37,7 +38,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class FrontLeftMotorStateDebugMenu : public MotorStateDebugMenu<TEXT_FRONTLEFTCOMMAND, FrontTexts::LeftCommand> {};
|
||||
class FrontRightMotorStateDebugMenu : public MotorStateDebugMenu<TEXT_FRONTRIGHTCOMMAND, FrontTexts::RightCommand> {};
|
||||
class BackLeftMotorStateDebugMenu : public MotorStateDebugMenu<TEXT_BACKLEFTCOMMAND, BackTexts::LeftCommand> {};
|
||||
class BackRightMotorStateDebugMenu : public MotorStateDebugMenu<TEXT_BACKRIGHTCOMMAND, BackTexts::RightCommand> {};
|
||||
using FrontLeftMotorStateDebugMenu = MotorStateDebugMenu<TEXT_FRONTLEFTCOMMAND, FrontTexts::LeftCommand>;
|
||||
using FrontRightMotorStateDebugMenu = MotorStateDebugMenu<TEXT_FRONTRIGHTCOMMAND, FrontTexts::RightCommand>;
|
||||
using BackLeftMotorStateDebugMenu = MotorStateDebugMenu<TEXT_BACKLEFTCOMMAND, BackTexts::LeftCommand>;
|
||||
using BackRightMotorStateDebugMenu = MotorStateDebugMenu<TEXT_BACKRIGHTCOMMAND, BackTexts::RightCommand>;
|
||||
|
@ -17,16 +17,16 @@ using MotortestMultiplikatorChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_MOTORTESTMULTIPLIKATOR>,
|
||||
MotortestModeMultiplikatorAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<MotortestModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>
|
||||
>;
|
||||
|
||||
using MotortestMaxPwmChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint16_t>,
|
||||
espgui::StaticText<TEXT_MOTORTESTMAXPWM>,
|
||||
MotortestMaxPwmAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<MotortestModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
|
@ -1,10 +1,13 @@
|
||||
#include "selectmodemenu.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <actions/multiaction.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "utils.h"
|
||||
#include "actions/multiaction.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
#include "globals.h"
|
||||
#include "modes/defaultmode.h"
|
||||
#include "modes/tempomatmode.h"
|
||||
|
@ -49,7 +49,7 @@ namespace {
|
||||
struct BacklightAccessor : public virtual espgui::AccessorInterface<bool>
|
||||
{
|
||||
bool getValue() const override { return digitalRead(PINS_LEDBACKLIGHT) != ledBacklightInverted; }
|
||||
void setValue(bool value) override { digitalWrite(PINS_LEDBACKLIGHT, value != ledBacklightInverted); }
|
||||
espgui::AccessorInterface<bool>::setter_result_t setValue(bool value) override { digitalWrite(PINS_LEDBACKLIGHT, value != ledBacklightInverted); return {}; }
|
||||
};
|
||||
#endif
|
||||
struct FrontLedAccessor : public espgui::RefAccessor<bool> { bool &getRef() const override { return controllers.front.command.led; } };
|
||||
|
@ -1,10 +1,11 @@
|
||||
#include "tempomatmodesettingsmenu.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "changevaluedisplay.h"
|
||||
#include "menuitem.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "icons/back.h"
|
||||
#include <changevaluedisplay.h>
|
||||
#include <menuitem.h>
|
||||
#include <actions/switchscreenaction.h>
|
||||
#include <icons/back.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
@ -20,16 +21,16 @@ using TempomatModeCruiseMotTgtChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_NCRUISEMOTTGT>,
|
||||
TempomatModeCruiseMotTgtAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<TempomatModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>
|
||||
>;
|
||||
|
||||
using TempomatModeModelModeChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<UnifiedModelMode>,
|
||||
espgui::StaticText<TEXT_MODELMODE>,
|
||||
TempomatModeModelModeAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<TempomatModeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
|
@ -16,8 +16,8 @@ using StatsUpdateRateChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_STATSUPDATERATE>,
|
||||
StatsUpdateRateAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimersMenu>>,
|
||||
espgui::SwitchScreenAction<TimersMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TimersMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimersMenu>>
|
||||
>;
|
||||
}
|
||||
|
||||
|
@ -48,16 +48,16 @@ using TimezoneOffsetChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int32_t>,
|
||||
espgui::StaticText<TEXT_OFFSET>,
|
||||
TimezoneOffsetAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<TimeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>
|
||||
>;
|
||||
|
||||
using DaylightSavingModeChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<espchrono::DayLightSavingMode>,
|
||||
espgui::StaticText<TEXT_DAYLIGHTSAVINGMODE>,
|
||||
DaylightSavingModeAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<TimeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>
|
||||
>;
|
||||
|
||||
#ifdef FEATURE_NTP
|
||||
@ -65,16 +65,16 @@ using TimeSyncModeChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<sntp_sync_mode_t>,
|
||||
espgui::StaticText<TEXT_NTPMODE>,
|
||||
TimeSyncModeAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<TimeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>
|
||||
>;
|
||||
|
||||
using TimeSyncIntervalChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int32_t>,
|
||||
espgui::StaticText<TEXT_NTPINTERVAL>,
|
||||
TimeSyncIntervalAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<TimeSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>
|
||||
>;
|
||||
|
||||
class NtpSyncStatusText : public virtual espgui::TextInterface
|
||||
|
@ -21,8 +21,8 @@ using UdpCloudSendRateChangeDisplay = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<int16_t>,
|
||||
espgui::StaticText<TEXT_UDPSENDRATE>,
|
||||
UdpCloudSendIntervalAccessor,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<UdpCloudSettingsMenu>>,
|
||||
espgui::SwitchScreenAction<UdpCloudSettingsMenu>
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<UdpCloudSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<UdpCloudSettingsMenu>>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
|
@ -12,8 +12,12 @@
|
||||
#include <icons/back.h>
|
||||
#include <screenmanager.h>
|
||||
#include <espwifistack.h>
|
||||
#include <textwithvaluehelper.h>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbychangevaluedisplay.h"
|
||||
#include "changevaluedisplay.h"
|
||||
#include "changevaluedisplay_wifi_auth_mode_t.h"
|
||||
#include "wifiapclientsmenu.h"
|
||||
#include "networksettingsmenu.h"
|
||||
#include "accessors/wifiapconfigaccessors.h"
|
||||
@ -28,23 +32,54 @@ constexpr char TEXT_ENABLED[] = "Enabled";
|
||||
constexpr char TEXT_DISABLEWHENONLINE[] = "Disable when online";
|
||||
constexpr char TEXT_BACK[] = "Back";
|
||||
|
||||
constexpr char TEXT_SSID[] = "AP SSID";
|
||||
constexpr char TEXT_SSID_FORMATTED[] = "&sssid: &2";
|
||||
constexpr char TEXT_KEY[] = "AP Key";
|
||||
constexpr char TEXT_KEY_FORMATTED[] = "&skey: &2";
|
||||
constexpr char TEXT_IP[] = "AP IP";
|
||||
constexpr char TEXT_IP_FORMATTED[] = "&sIP: &f&2";
|
||||
constexpr char TEXT_MASK[] = "AP Mask";
|
||||
constexpr char TEXT_MASK_FORMATTED[] = "&sMask: &f&2";
|
||||
constexpr char TEXT_CHANNEL[] = "AP Channel";
|
||||
constexpr char TEXT_CHANNEL_FORMATTED[] = "&sChannel: &f&2";
|
||||
constexpr char TEXT_AUTHMODE[] = "AP Authmode";
|
||||
constexpr char TEXT_AUTHMODE_FORMATTED[] = "&sAuthmode: &2";
|
||||
|
||||
class WifiApClientsAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override;
|
||||
};
|
||||
|
||||
using ApChannelChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<uint8_t>,
|
||||
espgui::StaticText<TEXT_CHANNEL>,
|
||||
WifiApChannelAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<WifiApSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<WifiApSettingsMenu>>
|
||||
>;
|
||||
|
||||
using ApAuthmodeChangeScreen = espgui::makeComponent<
|
||||
BobbyChangeValueDisplay<wifi_auth_mode_t>,
|
||||
espgui::StaticText<TEXT_AUTHMODE>,
|
||||
WifiApAuthmodeAccessor,
|
||||
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<WifiApSettingsMenu>>,
|
||||
espgui::BackActionInterface<espgui::SwitchScreenAction<WifiApSettingsMenu>>
|
||||
>;
|
||||
} // namespace
|
||||
|
||||
WifiApSettingsMenu::WifiApSettingsMenu()
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApNameText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApKeyText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApMacText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApIpText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApMaskText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApHostnameText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ENABLED>, ToggleBoolAction, CheckboxIcon, WifiApEnabledAccessor>>();
|
||||
//constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DISABLEWHENONLINE>, ToggleBoolAction, CheckboxIcon, WifiApDisableWhenOnlineAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_SSID_FORMATTED, WifiApNameAccessor>, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_KEY_FORMATTED, WifiApKeyAccessor>, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApMacText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_IP_FORMATTED, WifiApIpAccessor>, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_MASK_FORMATTED, WifiApMaskAccessor>, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_CHANNEL_FORMATTED, WifiApChannelAccessor>, SwitchScreenAction<ApChannelChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_AUTHMODE_FORMATTED, WifiApAuthmodeAccessor>, SwitchScreenAction<ApAuthmodeChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApHostnameText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, WifiApClientsText, WifiApClientsAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<NetworkSettingsMenu>, StaticMenuItemIcon<&icons::back>>>();
|
||||
}
|
||||
|
@ -1,105 +0,0 @@
|
||||
#include "alertdisplay.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
#include <cppmacros.h>
|
||||
|
||||
AlertDisplay::AlertDisplay(std::string &&message, std::unique_ptr<Display> &&lastDisplay) :
|
||||
m_message{std::move(message)}, m_lastDisplay{std::move(lastDisplay)}
|
||||
{
|
||||
}
|
||||
|
||||
void AlertDisplay::initScreen()
|
||||
{
|
||||
m_lastDisplay->initScreen();
|
||||
|
||||
initOverlay();
|
||||
}
|
||||
|
||||
void AlertDisplay::buttonPressed(espgui::Button button)
|
||||
{
|
||||
Base::buttonPressed(button);
|
||||
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case Button::Left:
|
||||
case Button::Right:
|
||||
closeOverlay();
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
||||
void AlertDisplay::initOverlay()
|
||||
{
|
||||
constexpr auto leftMargin = 20;
|
||||
constexpr auto rightMargin = leftMargin;
|
||||
constexpr auto topMargin = 50;
|
||||
constexpr auto bottomMargin = topMargin;
|
||||
|
||||
const auto width = espgui::tft.width() - leftMargin - rightMargin;
|
||||
const auto height = espgui::tft.height() - topMargin - bottomMargin;
|
||||
const auto right = espgui::tft.width() - rightMargin;
|
||||
const auto bottom = espgui::tft.height() - bottomMargin;
|
||||
|
||||
CPP_UNUSED(right)
|
||||
|
||||
//espgui::tft.drawRect(leftMargin, topMargin, espgui::tft.width() - leftMargin - rightMargin, espgui::tft.height() - topMargin - bottomMargin, TFT_WHITE);
|
||||
//espgui::tft.fillRect(leftMargin + 1, topMargin + 1, espgui::tft.width() - leftMargin - rightMargin - 2, espgui::tft.height() - topMargin - bottomMargin - 2, TFT_BLACK);
|
||||
|
||||
espgui::tft.drawSunkenRect(leftMargin, topMargin, width, height,
|
||||
color565(240, 240, 240),
|
||||
color565(100, 100, 100),
|
||||
color565(30, 30, 30));
|
||||
|
||||
espgui::tft.setTextColor(TFT_WHITE, color565(30, 30, 30));
|
||||
|
||||
int x = leftMargin + 5;
|
||||
int y = topMargin + 5;
|
||||
for (char c : m_message)
|
||||
{
|
||||
if (c == '\n' || x > espgui::tft.width() - rightMargin - 10)
|
||||
{
|
||||
x = leftMargin + 5;
|
||||
y += espgui::tft.fontHeight(4);
|
||||
}
|
||||
|
||||
if (c != '\n')
|
||||
{
|
||||
const auto addedWidth = espgui::tft.drawChar(espgui::tft.decodeUTF8(c), x, y, 4);
|
||||
x += addedWidth;
|
||||
}
|
||||
|
||||
if (y >= espgui::tft.height() - bottomMargin)
|
||||
break;
|
||||
}
|
||||
|
||||
espgui::tft.setTextColor(TFT_BLACK, color565(170, 170, 170));
|
||||
|
||||
espgui::tft.drawSunkenRect(leftMargin + 15, bottom - 40,
|
||||
(width - 15 - 10 - 15) / 2,
|
||||
30,
|
||||
color565(240, 240, 240),
|
||||
color565(100, 100, 100),
|
||||
color565(170, 170, 170));
|
||||
|
||||
espgui::tft.drawString("Yes", leftMargin + 18, bottom - 37);
|
||||
|
||||
espgui::tft.drawSunkenRect(leftMargin + 15 + ((width - 15 - 30 - 15) / 2) + 15, bottom - 40,
|
||||
(width - 15 - 10 - 15) / 2,
|
||||
30,
|
||||
color565(240, 240, 240),
|
||||
color565(100, 100, 100),
|
||||
color565(170, 170, 170));
|
||||
|
||||
espgui::tft.drawString("No", leftMargin + 18 + ((width - 15 - 30 - 15) / 2) + 15 + 1, bottom - 37);
|
||||
}
|
||||
|
||||
void AlertDisplay::closeOverlay()
|
||||
{
|
||||
auto guard = std::move(espgui::currentDisplay);
|
||||
espgui::currentDisplay = std::move(m_lastDisplay);
|
||||
espgui::currentDisplay->initScreen();
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <memory>
|
||||
|
||||
// local includes
|
||||
#include "displays/bobbydisplay.h"
|
||||
|
||||
class AlertDisplay : public BobbyDisplay
|
||||
{
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
AlertDisplay(std::string &&message, std::unique_ptr<Display> &&lastDisplay);
|
||||
|
||||
//void start() override;
|
||||
void initScreen() override;
|
||||
//void update() override;
|
||||
//void redraw() override;
|
||||
//void stop() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
void initOverlay();
|
||||
void closeOverlay();
|
||||
|
||||
private:
|
||||
std::string m_message;
|
||||
std::unique_ptr<Display> m_lastDisplay;
|
||||
};
|
@ -14,6 +14,7 @@
|
||||
#include "buttons.h"
|
||||
#include "types.h"
|
||||
#include "globals.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
namespace {
|
||||
namespace dpad5wire_2out {
|
||||
@ -167,7 +168,7 @@ void update()
|
||||
|
||||
const auto now = espchrono::millis_clock::now();
|
||||
|
||||
const std::chrono::milliseconds dpadDebounce{settings.boardcomputerHardware.dpadDebounce};
|
||||
const std::chrono::milliseconds dpadDebounce{configs.dpadDebounce.value};
|
||||
|
||||
if (lastState.up != newState.up && now - debounceUp > dpadDebounce)
|
||||
{
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "buttons.h"
|
||||
#include "types.h"
|
||||
#include "globals.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
namespace {
|
||||
namespace dpad6wire {
|
||||
@ -135,7 +136,7 @@ void update()
|
||||
|
||||
const auto now = espchrono::millis_clock::now();
|
||||
|
||||
const std::chrono::milliseconds dpadDebounce{settings.boardcomputerHardware.dpadDebounce};
|
||||
const std::chrono::milliseconds dpadDebounce{configs.dpadDebounce.value};
|
||||
|
||||
if (lastState.up != newState.up && now - debounceUp > dpadDebounce)
|
||||
{
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include "bobbycar-common.h"
|
||||
#include "modeinterface.h"
|
||||
|
||||
enum class LarsmModeMode : uint8_t { Mode1, Mode2, Mode3, Mode4 };
|
||||
|
||||
class LarsmMode : public ModeInterface
|
||||
{
|
||||
using Base = ModeInterface;
|
||||
|
@ -83,10 +83,10 @@ class ConfigContainer
|
||||
using mac_t = wifi_stack::mac_t;
|
||||
|
||||
public:
|
||||
// default allowReset constraints nvsName
|
||||
ConfigWrapper<std::optional<mac_t>> baseMacAddressOverride{std::nullopt, NoReset, {}, "baseMacAddrOver" };
|
||||
ConfigWrapper<std::string> hostname {defaultHostname, DoReset, StringMinMaxSize<4, 32>, "hostname" };
|
||||
ConfigWrapper<bool> wifiStaEnabled {true, DoReset, {}, "wifiStaEnabled" };
|
||||
// default allowReset constraints nvsName
|
||||
ConfigWrapper<std::optional<mac_t>> baseMacAddressOverride{std::nullopt, DoReset, {}, "baseMacAddrOver" };
|
||||
ConfigWrapper<std::string> hostname {defaultHostname, DoReset, StringMinMaxSize<4, 32>, "hostname" };
|
||||
ConfigWrapper<bool> wifiStaEnabled {true, DoReset, {}, "wifiStaEnabled" };
|
||||
std::array<WiFiConfig, 10> wifi_configs {
|
||||
WiFiConfig {"wifi_ssid0", "wifi_key0", "wifi_usestatic0", "wifi_static_ip0", "wifi_stati_sub0", "wifi_stat_gate0", "wifi_usestadns0", "wifi_stat_dnsA0", "wifi_stat_dnsB0", "wifi_stat_dnsC0"},
|
||||
WiFiConfig {"wifi_ssid1", "wifi_key1", "wifi_usestatic1", "wifi_static_ip1", "wifi_stati_sub1", "wifi_stat_gate1", "wifi_usestadns1", "wifi_stat_dnsA1", "wifi_stat_dnsB1", "wifi_stat_dnsC1"},
|
||||
@ -99,22 +99,32 @@ public:
|
||||
WiFiConfig {"wifi_ssid8", "wifi_key8", "wifi_usestatic8", "wifi_static_ip8", "wifi_stati_sub8", "wifi_stat_gate8", "wifi_usestadns8", "wifi_stat_dnsA8", "wifi_stat_dnsB8", "wifi_stat_dnsC8"},
|
||||
WiFiConfig {"wifi_ssid9", "wifi_key9", "wifi_usestatic9", "wifi_static_ip9", "wifi_stati_sub9", "wifi_stat_gate9", "wifi_usestadns9", "wifi_stat_dnsA9", "wifi_stat_dnsB9", "wifi_stat_dnsC9"}
|
||||
};
|
||||
ConfigWrapper<int8_t> wifiStaMinRssi {-90, DoReset, {}, "wifiStaMinRssi" };
|
||||
ConfigWrapper<int8_t> wifiStaMinRssi {-90, DoReset, {}, "wifiStaMinRssi" };
|
||||
|
||||
ConfigWrapper<bool> wifiApEnabled {true, DoReset, {}, "wifiApEnabled" };
|
||||
ConfigWrapper<std::string> wifiApName {defaultHostname, DoReset, StringMinMaxSize<4, 32>, "wifiApName" };
|
||||
ConfigWrapper<bool> wifiApEnabled {true, DoReset, {}, "wifiApEnabled" };
|
||||
ConfigWrapper<std::string> wifiApName {defaultHostname, DoReset, StringMinMaxSize<4, 32>, "wifiApName" };
|
||||
ConfigWrapper<std::string> wifiApKey {"Passwort_123", DoReset, StringOr<StringEmpty, StringMinMaxSize<8, 64>>, "wifiApKey" };
|
||||
ConfigWrapper<uint8_t> wifiApChannel {1, DoReset, {}, "wifiApChannel" };
|
||||
ConfigWrapper<wifi_auth_mode_t> wifiApAuthmode{WIFI_AUTH_WPA2_PSK, DoReset, {}, "wifiApAuthmode" };
|
||||
ConfigWrapper<wifi_stack::ip_address_t> wifiApIp{wifi_stack::ip_address_t{10, 0, 0, 1},DoReset, {}, "wifiApIp" };
|
||||
ConfigWrapper<wifi_stack::ip_address_t> wifiApMask{wifi_stack::ip_address_t{255, 255, 255, 0},DoReset, {}, "wifiApMask" };
|
||||
ConfigWrapper<uint8_t> wifiApChannel {1, DoReset, MinMaxValue<uint8_t, 1, 14>, "wifiApChannel" };
|
||||
ConfigWrapper<wifi_auth_mode_t> wifiApAuthmode{WIFI_AUTH_WPA2_PSK, DoReset, {}, "wifiApAuthmode" };
|
||||
|
||||
ConfigWrapper<bool> timeServerEnabled {false, DoReset, {}, "timeServerEnabl" };
|
||||
ConfigWrapper<std::string> timeServer {"europe.pool.ntp.org", NoReset, StringMaxSize<64>, "timeServer" };
|
||||
ConfigWrapper<sntp_sync_mode_t> timeSyncMode {SNTP_SYNC_MODE_IMMED, NoReset, {}, "timeSyncMode" };
|
||||
ConfigWrapper<espchrono::milliseconds32> timeSyncInterval{espchrono::milliseconds32{CONFIG_LWIP_SNTP_UPDATE_DELAY}, NoReset, MinTimeSyncInterval, "timeSyncInterva" };
|
||||
ConfigWrapper<espchrono::minutes32> timezoneOffset{espchrono::minutes32{60}, DoReset, {}, "timezoneOffset" }; // MinMaxValue<minutes32, -1440m, 1440m>
|
||||
ConfigWrapper<espchrono::DayLightSavingMode>timeDst{espchrono::DayLightSavingMode::EuropeanSummerTime, DoReset, {}, "time_dst" };
|
||||
ConfigWrapper<bool> timeServerEnabled {true, DoReset, {}, "timeServerEnabl" };
|
||||
ConfigWrapper<std::string> timeServer {"europe.pool.ntp.org", DoReset, StringMaxSize<64>, "timeServer" };
|
||||
ConfigWrapper<sntp_sync_mode_t> timeSyncMode {SNTP_SYNC_MODE_IMMED, DoReset, {}, "timeSyncMode" };
|
||||
ConfigWrapper<espchrono::milliseconds32> timeSyncInterval{espchrono::milliseconds32{CONFIG_LWIP_SNTP_UPDATE_DELAY}, DoReset, MinTimeSyncInterval, "timeSyncInterva" };
|
||||
ConfigWrapper<espchrono::minutes32> timezoneOffset{espchrono::minutes32{60}, DoReset, {}, "timezoneOffset" }; // MinMaxValue<minutes32, -1440m, 1440m>
|
||||
ConfigWrapper<espchrono::DayLightSavingMode>timeDst{espchrono::DayLightSavingMode::EuropeanSummerTime, DoReset, {}, "time_dst" };
|
||||
|
||||
ConfigWrapper<bool> canBusResetOnError {false, DoReset, {}, "canBusRstErr" };
|
||||
ConfigWrapper<bool> canBusResetOnError {false, DoReset, {}, "canBusRstErr" };
|
||||
|
||||
ConfigWrapper<int16_t> sampleCount {50, DoReset, {}, "sampleCount" };
|
||||
ConfigWrapper<int16_t> gasMin {0, DoReset, MinMaxValue<int16_t, 0, 4095>, "gasMin" };
|
||||
ConfigWrapper<int16_t> gasMax {4095, DoReset, MinMaxValue<int16_t, 0, 4095>, "gasMax" };
|
||||
ConfigWrapper<int16_t> bremsMin {0, DoReset, MinMaxValue<int16_t, 0, 4095>, "bremsMin" };
|
||||
ConfigWrapper<int16_t> bremsMax {4096, DoReset, MinMaxValue<int16_t, 0, 4095>, "bremsMax" };
|
||||
|
||||
ConfigWrapper<uint8_t> dpadDebounce {25, DoReset, {}, "dpadDebounce" };
|
||||
|
||||
std::array<WirelessDoorsConfig, 5> wireless_door_configs {
|
||||
WirelessDoorsConfig { "door_id0", "door_token0" },
|
||||
@ -262,6 +272,8 @@ public:
|
||||
x(wifiApEnabled) \
|
||||
x(wifiApName) \
|
||||
x(wifiApKey) \
|
||||
x(wifiApIp) \
|
||||
x(wifiApMask) \
|
||||
x(wifiApChannel) \
|
||||
x(wifiApAuthmode) \
|
||||
\
|
||||
@ -274,6 +286,14 @@ public:
|
||||
\
|
||||
x(canBusResetOnError) \
|
||||
\
|
||||
x(sampleCount) \
|
||||
x(gasMin) \
|
||||
x(gasMax) \
|
||||
x(bremsMin) \
|
||||
x(bremsMax) \
|
||||
\
|
||||
x(dpadDebounce) \
|
||||
\
|
||||
x(wireless_door_configs[0].doorId) \
|
||||
x(wireless_door_configs[0].doorToken) \
|
||||
x(wireless_door_configs[1].doorId) \
|
||||
|
@ -9,6 +9,7 @@
|
||||
#ifdef FEATURE_CAN
|
||||
#include "can.h"
|
||||
#endif
|
||||
#include "newsettings.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
@ -26,13 +27,13 @@ void readPotis()
|
||||
{
|
||||
[[maybe_unused]]
|
||||
constexpr auto sampleMultipleTimes = [](uint8_t pin){
|
||||
analogRead(pin);
|
||||
double sum{};
|
||||
const auto sampleCount = settings.boardcomputerHardware.sampleCount;
|
||||
for (int i = 0; i < sampleCount; i++)
|
||||
sum += analogRead(pin);
|
||||
return sum / sampleCount;
|
||||
};
|
||||
analogRead(pin);
|
||||
double sum{};
|
||||
const auto sampleCount = configs.sampleCount.value;
|
||||
for (int i = 0; i < sampleCount; i++)
|
||||
sum += analogRead(pin);
|
||||
return sum / sampleCount;
|
||||
};
|
||||
|
||||
raw_gas = std::nullopt;
|
||||
raw_brems = std::nullopt;
|
||||
@ -65,11 +66,11 @@ void readPotis()
|
||||
#endif
|
||||
|
||||
if (raw_gas)
|
||||
gas = cpputils::mapValueClamped<float>(*raw_gas, settings.boardcomputerHardware.gasMin, settings.boardcomputerHardware.gasMax, 0., 1000.);
|
||||
gas = cpputils::mapValueClamped<float>(*raw_gas, configs.gasMin.value, configs.gasMax.value, 0., 1000.);
|
||||
else
|
||||
gas = std::nullopt;
|
||||
if (raw_brems)
|
||||
brems = cpputils::mapValueClamped<float>(*raw_brems, settings.boardcomputerHardware.bremsMin, settings.boardcomputerHardware.bremsMax, 0., 1000.);
|
||||
brems = cpputils::mapValueClamped<float>(*raw_brems, configs.bremsMin.value, configs.bremsMax.value, 0., 1000.);
|
||||
else
|
||||
brems = std::nullopt;
|
||||
|
||||
|
@ -123,14 +123,6 @@ constexpr Settings::BoardcomputerHardware::TimersSettings defaultTimersSettings
|
||||
};
|
||||
|
||||
constexpr Settings::BoardcomputerHardware defaultBoardcomputerHardware {
|
||||
.sampleCount = 50,
|
||||
.gasMin = DEFAULT_GASMIN,
|
||||
.gasMax = DEFAULT_GASMAX,
|
||||
.bremsMin = DEFAULT_BREMSMIN,
|
||||
.bremsMax = DEFAULT_BREMSMAX,
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW) || defined(FEATURE_DPAD_5WIRESW_2OUT) || defined (FEATURE_DPAD_6WIRESW)
|
||||
.dpadDebounce = 25,
|
||||
#endif
|
||||
#ifdef FEATURE_GAMETRAK
|
||||
.gametrakXMin = DEFAULT_GAMETRAKXMIN,
|
||||
.gametrakXMax = DEFAULT_GAMETRAKXMAX,
|
||||
|
@ -23,8 +23,7 @@
|
||||
#include "unifiedmodelmode.h"
|
||||
#include "handbremse.h"
|
||||
#include "ledstrip.h"
|
||||
|
||||
enum class LarsmModeMode : uint8_t { Mode1, Mode2, Mode3, Mode4 };
|
||||
#include "modes/larsmmode.h"
|
||||
|
||||
struct Settings
|
||||
{
|
||||
@ -70,11 +69,6 @@ struct Settings
|
||||
} controllerHardware;
|
||||
|
||||
struct BoardcomputerHardware {
|
||||
int16_t sampleCount;
|
||||
int16_t gasMin, gasMax, bremsMin, bremsMax;
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW) || defined(FEATURE_DPAD_5WIRESW_2OUT) || defined (FEATURE_DPAD_6WIRESW)
|
||||
uint8_t dpadDebounce;
|
||||
#endif
|
||||
#ifdef FEATURE_GAMETRAK
|
||||
int16_t gametrakXMin, gametrakXMax, gametrakYMin, gametrakYMax, gametrakDistMin, gametrakDistMax;
|
||||
#endif
|
||||
@ -243,14 +237,6 @@ void Settings::executeForEveryCommonSetting(T &&callable)
|
||||
callable("canReceiveTimeo", controllerHardware.canReceiveTimeout);
|
||||
#endif
|
||||
|
||||
callable("sampleCount", boardcomputerHardware.sampleCount);
|
||||
callable("gasMin", boardcomputerHardware.gasMin);
|
||||
callable("gasMax", boardcomputerHardware.gasMax);
|
||||
callable("bremsMin", boardcomputerHardware.bremsMin);
|
||||
callable("bremsMax", boardcomputerHardware.bremsMax);
|
||||
#if defined(FEATURE_DPAD) || defined(FEATURE_DPAD_3WIRESW) || defined(FEATURE_DPAD_5WIRESW) || defined(FEATURE_DPAD_5WIRESW_2OUT)
|
||||
callable("dpadDebounce", boardcomputerHardware.dpadDebounce);
|
||||
#endif
|
||||
#ifdef FEATURE_GAMETRAK
|
||||
callable("gametrakXMin", boardcomputerHardware.gametrakXMin);
|
||||
callable("gametrakXMax", boardcomputerHardware.gametrakXMax);
|
||||
|
@ -8,22 +8,8 @@
|
||||
#include <espwifistack.h>
|
||||
#include <richtextrenderer.h>
|
||||
|
||||
// local includes
|
||||
#include "newsettings.h"
|
||||
#include "wifi_bobbycar.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
std::string WifiApNameText::text() const
|
||||
{
|
||||
return fmt::format("&sssid: &f{}", richTextEscape(configs.wifiApName.value));
|
||||
}
|
||||
|
||||
std::string WifiApKeyText::text() const
|
||||
{
|
||||
return fmt::format("&skey: &f{}", richTextEscape(configs.wifiApKey.value));
|
||||
}
|
||||
|
||||
std::string WifiApMacText::text() const
|
||||
{
|
||||
std::string text = "&smac: &f";
|
||||
@ -35,16 +21,6 @@ std::string WifiApMacText::text() const
|
||||
return text;
|
||||
}
|
||||
|
||||
std::string WifiApIpText::text() const
|
||||
{
|
||||
return fmt::format("&sip: &f{}", wifi_stack::toString(apIP));
|
||||
}
|
||||
|
||||
std::string WifiApMaskText::text() const
|
||||
{
|
||||
return fmt::format("&smask: &f{}", wifi_stack::toString(netMsk));
|
||||
}
|
||||
|
||||
std::string WifiApHostnameText::text() const
|
||||
{
|
||||
if (auto hostname = wifi_stack::get_hostname_for_interface(ESP_IF_WIFI_AP))
|
||||
|
@ -3,36 +3,12 @@
|
||||
// 3rdparty lib includes
|
||||
#include <textinterface.h>
|
||||
|
||||
class WifiApNameText : public virtual espgui::TextInterface
|
||||
{
|
||||
public:
|
||||
std::string text() const override;
|
||||
};
|
||||
|
||||
class WifiApKeyText : public virtual espgui::TextInterface
|
||||
{
|
||||
public:
|
||||
std::string text() const override;
|
||||
};
|
||||
|
||||
class WifiApMacText : public virtual espgui::TextInterface
|
||||
{
|
||||
public:
|
||||
std::string text() const override;
|
||||
};
|
||||
|
||||
class WifiApIpText : public virtual espgui::TextInterface
|
||||
{
|
||||
public:
|
||||
std::string text() const override;
|
||||
};
|
||||
|
||||
class WifiApMaskText : public virtual espgui::TextInterface
|
||||
{
|
||||
public:
|
||||
std::string text() const override;
|
||||
};
|
||||
|
||||
class WifiApHostnameText : public virtual espgui::TextInterface
|
||||
{
|
||||
public:
|
||||
|
@ -234,6 +234,7 @@ char TEXT_HANDBREMSE_AUTOMATIC[] = "Automatic Handbremse";
|
||||
char TEXT_HANDBREMSE_VISUALIZE[] = "Visualize Handbremse";
|
||||
char TEXT_HANDBREMSE_MODE[] = "Handbrems Mode";
|
||||
char TEXT_HANDBREMSE_TRIGGERTIMEOUT[] = "Handbrems Timeout";
|
||||
char TEXT_HANDBREMSE[] = "Handbremse";
|
||||
//char TEXT_BACK[] = "Back";
|
||||
|
||||
//DynamicDebugMenu
|
||||
@ -448,62 +449,6 @@ char TEXT_OFF[] = "Off";
|
||||
char TEXT_MASTER[] = "Master";
|
||||
char TEXT_SLAVE[] = "Slave";
|
||||
|
||||
//ChangeValueDisplay<ControlMode>
|
||||
char TEXT_OPENMODE[] = "Open mode";
|
||||
char TEXT_VOLTAGE[] = "Voltage";
|
||||
char TEXT_SPEED[] = "Speed";
|
||||
char TEXT_TORQUE[] = "Torque";
|
||||
//char TEXT_BACK[] = "Back";
|
||||
|
||||
//ChangeValueDisplay<ControlType>
|
||||
char TEXT_COMMUTATION[] = "Commutation";
|
||||
char TEXT_SINUSOIDAL[] = "Sinusoidal";
|
||||
char TEXT_FIELDORIENTEDCONTROL[] = "Field oriented control";
|
||||
//char TEXT_BACK[] = "Back";
|
||||
|
||||
//ChangeValueDisplay<HandbremseMode>
|
||||
char TEXT_HANDBREMS_MOSFETS_OFF[] = "Mosfets off";
|
||||
char TEXT_HANDBREMS_OPENMODE[] = "Open Mode";
|
||||
char TEXT_HANDBREMS_SPEED0[] = "Speed 0";
|
||||
char TEXT_HANDBREMSE[] = "Handbremse";
|
||||
|
||||
//ChangeValueDisplay<LarsmMode::Mode>
|
||||
char TEXT_LARSMMODE1[] = "Mode1";
|
||||
char TEXT_LARSMMODE2[] = "Mode2";
|
||||
char TEXT_LARSMMODE3[] = "Mode3";
|
||||
char TEXT_LARSMMODE4[] = "Mode4";
|
||||
//char TEXT_BACK[] = "Back";
|
||||
|
||||
//ChangeValueDisplay<UnifiedModelMode>
|
||||
//char TEXT_COMMUTATION[] = "Commutation";
|
||||
//char TEXT_SINUSOIDAL[] = "Sinusoidal";
|
||||
char TEXT_FOCVOLTAGE[] = "FOC/Voltage";
|
||||
char TEXT_FOCSPEED[] = "FOC/Speed";
|
||||
char TEXT_FOCTORQUE[] = "FOC/Torque";
|
||||
//char TEXT_BACK[] = "Back";
|
||||
|
||||
//ChangeValueDisplay<wifi_mode_t>
|
||||
char TEXT_WIFI_MODE_NULL[] = "WIFI_MODE_NULL";
|
||||
char TEXT_WIFI_MODE_STA[] = "WIFI_MODE_STA";
|
||||
char TEXT_WIFI_MODE_AP[] = "WIFI_MODE_AP";
|
||||
char TEXT_WIFI_MODE_APSTA[] = "WIFI_MODE_APSTA";
|
||||
//char TEXT_BACK[] = "Back";
|
||||
|
||||
//ChangeValueDisplay<wifi_power_t>
|
||||
char TEXT_WIFI_POWER_19_5dBm[] = "19.5dBm";
|
||||
char TEXT_WIFI_POWER_19dBm[] = "19dBm";
|
||||
char TEXT_WIFI_POWER_18_5dBm[] = "18.5dBm";
|
||||
char TEXT_WIFI_POWER_17dBm[] = "17dBm";
|
||||
char TEXT_WIFI_POWER_15dBm[] = "15dBm";
|
||||
char TEXT_WIFI_POWER_13dBm[] = "13dBm";
|
||||
char TEXT_WIFI_POWER_11dBm[] = "11dBm";
|
||||
char TEXT_WIFI_POWER_8_5dBm[] = "8.5dBm";
|
||||
char TEXT_WIFI_POWER_7dBm[] = "7dBm";
|
||||
char TEXT_WIFI_POWER_5dBm[] = "5dBm";
|
||||
char TEXT_WIFI_POWER_2dBm[] = "2dBm";
|
||||
char TEXT_WIFI_POWER_MINUS_1dBm[] = "-1dBm";
|
||||
//char TEXT_BACK[] = "Back";
|
||||
|
||||
//Crashmenu
|
||||
char TEXT_CRASHMENU[] = "Crash Menu";
|
||||
char TEXT_CRASH_ASSERT[] = "assert(0)";
|
||||
|
55
main/texts.h
55
main/texts.h
@ -448,61 +448,6 @@ extern char TEXT_OFF[];
|
||||
extern char TEXT_MASTER[];
|
||||
extern char TEXT_SLAVE[];
|
||||
|
||||
//ChangeValueDisplay<ControlMode>
|
||||
extern char TEXT_OPENMODE[];
|
||||
extern char TEXT_VOLTAGE[];
|
||||
extern char TEXT_SPEED[];
|
||||
extern char TEXT_TORQUE[];
|
||||
//extern char TEXT_BACK[];
|
||||
|
||||
//ChangeValueDisplay<ControlType>
|
||||
extern char TEXT_COMMUTATION[];
|
||||
extern char TEXT_SINUSOIDAL[];
|
||||
extern char TEXT_FIELDORIENTEDCONTROL[];
|
||||
//extern char TEXT_BACK[];
|
||||
|
||||
//ChangeValueDisplay<HandbremseMode>
|
||||
extern char TEXT_HANDBREMS_MOSFETS_OFF[];
|
||||
extern char TEXT_HANDBREMS_OPENMODE[];
|
||||
extern char TEXT_HANDBREMS_SPEED0[];
|
||||
|
||||
//ChangeValueDisplay<LarsmMode::Mode>
|
||||
extern char TEXT_LARSMMODE1[];
|
||||
extern char TEXT_LARSMMODE2[];
|
||||
extern char TEXT_LARSMMODE3[];
|
||||
extern char TEXT_LARSMMODE4[];
|
||||
//extern char TEXT_BACK[];
|
||||
|
||||
//ChangeValueDisplay<UnifiedModelMode>
|
||||
//extern char TEXT_COMMUTATION[];
|
||||
//extern char TEXT_SINUSOIDAL[];
|
||||
extern char TEXT_FOCVOLTAGE[];
|
||||
extern char TEXT_FOCSPEED[];
|
||||
extern char TEXT_FOCTORQUE[];
|
||||
//extern char TEXT_BACK[];
|
||||
|
||||
//ChangeValueDisplay<wifi_mode_t>
|
||||
extern char TEXT_WIFI_MODE_NULL[];
|
||||
extern char TEXT_WIFI_MODE_STA[];
|
||||
extern char TEXT_WIFI_MODE_AP[];
|
||||
extern char TEXT_WIFI_MODE_APSTA[];
|
||||
//extern char TEXT_BACK[];
|
||||
|
||||
//ChangeValueDisplay<wifi_power_t>
|
||||
extern char TEXT_WIFI_POWER_19_5dBm[];
|
||||
extern char TEXT_WIFI_POWER_19dBm[];
|
||||
extern char TEXT_WIFI_POWER_18_5dBm[];
|
||||
extern char TEXT_WIFI_POWER_17dBm[];
|
||||
extern char TEXT_WIFI_POWER_15dBm[];
|
||||
extern char TEXT_WIFI_POWER_13dBm[];
|
||||
extern char TEXT_WIFI_POWER_11dBm[];
|
||||
extern char TEXT_WIFI_POWER_8_5dBm[];
|
||||
extern char TEXT_WIFI_POWER_7dBm[];
|
||||
extern char TEXT_WIFI_POWER_5dBm[];
|
||||
extern char TEXT_WIFI_POWER_2dBm[];
|
||||
extern char TEXT_WIFI_POWER_MINUS_1dBm[];
|
||||
//extern char TEXT_BACK[];
|
||||
|
||||
//Crashmenu
|
||||
extern char TEXT_CRASHMENU[];
|
||||
extern char TEXT_CRASH_ASSERT[];
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include <numberparsing.h>
|
||||
#include <lockhelper.h>
|
||||
#include <tickchrono.h>
|
||||
#include <futurecpp.h>
|
||||
#include <cpputils.h>
|
||||
|
||||
// local includes
|
||||
#include "newsettings.h"
|
||||
@ -29,25 +31,38 @@ using esphttpdutils::HtmlTag;
|
||||
namespace {
|
||||
constexpr const char * const TAG = "BOBBYWEB";
|
||||
|
||||
template<class T>
|
||||
struct is_duration : std::false_type {};
|
||||
|
||||
template<class Rep, class Period>
|
||||
struct is_duration<std::chrono::duration<Rep, Period>> : std::true_type {};
|
||||
|
||||
template <typename _Tp>
|
||||
inline constexpr bool is_duration_v = is_duration<_Tp>::value;
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
!std::is_same<T, bool>::value &&
|
||||
!std::is_integral<T>::value &&
|
||||
!std::is_same<T, std::string>::value &&
|
||||
!std::is_same<T, wifi_stack::ip_address_t>::value &&
|
||||
!std::is_same<T, wifi_stack::mac_t>::value
|
||||
, bool>::type
|
||||
!std::is_same_v<T, bool> &&
|
||||
!std::is_integral_v<T> &&
|
||||
!is_duration_v<T> &&
|
||||
!std::is_same_v<T, std::string> &&
|
||||
!std::is_same_v<T, wifi_stack::ip_address_t> &&
|
||||
!std::is_same_v<T, wifi_stack::mac_t> &&
|
||||
!std::is_same_v<T, std::optional<wifi_stack::mac_t>> &&
|
||||
!std::is_same_v<T, wifi_auth_mode_t> &&
|
||||
!std::is_same_v<T, sntp_sync_mode_t> &&
|
||||
!std::is_same_v<T, espchrono::DayLightSavingMode>
|
||||
, void>::type
|
||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
{
|
||||
HtmlTag spanTag{"span", "style=\"color: red;\"", body};
|
||||
body += "Unsupported config type";
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same<T, bool>::value
|
||||
, bool>::type
|
||||
std::is_same_v<T, bool>
|
||||
, void>::type
|
||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
{
|
||||
body += fmt::format("<input type=\"checkbox\" name=\"{}\" value=\"true\" {}/>"
|
||||
@ -55,14 +70,13 @@ showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
esphttpdutils::htmlentities(key),
|
||||
value ? "checked " : "",
|
||||
esphttpdutils::htmlentities(key));
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
!std::is_same<T, bool>::value &&
|
||||
std::is_integral<T>::value
|
||||
, bool>::type
|
||||
!std::is_same_v<T, bool> &&
|
||||
std::is_integral_v<T>
|
||||
, void>::type
|
||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
{
|
||||
body += fmt::format("<input type=\"number\" name=\"{}\" value=\"{}\" min=\"{}\" max=\"{}\" step=\"1\" />",
|
||||
@ -70,49 +84,126 @@ showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
value,
|
||||
std::numeric_limits<T>::min(),
|
||||
std::numeric_limits<T>::max());
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same<T, std::string>::value
|
||||
, bool>::type
|
||||
is_duration_v<T>
|
||||
, void>::type
|
||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
{
|
||||
body += fmt::format("<input type=\"number\" name=\"{}\" value=\"{}\" step=\"1\" />",
|
||||
esphttpdutils::htmlentities(key),
|
||||
value.count());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same_v<T, std::string>
|
||||
, void>::type
|
||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
{
|
||||
body += fmt::format("<input type=\"text\" name=\"{}\" value=\"{}\" />",
|
||||
esphttpdutils::htmlentities(key),
|
||||
esphttpdutils::htmlentities(value));
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same<T, wifi_stack::ip_address_t>::value
|
||||
, bool>::type
|
||||
std::is_same_v<T, wifi_stack::ip_address_t>
|
||||
, void>::type
|
||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
{
|
||||
body += fmt::format("<input type=\"text\" name=\"{}\" value=\"{}\" pattern=\"[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\" />",
|
||||
esphttpdutils::htmlentities(key),
|
||||
esphttpdutils::htmlentities(wifi_stack::toString(value)));
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same<T, wifi_stack::mac_t>::value
|
||||
, bool>::type
|
||||
std::is_same_v<T, wifi_stack::mac_t>
|
||||
, void>::type
|
||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
{
|
||||
body += fmt::format("<input type=\"text\" name=\"{}\" value=\"{}\" pattern=\"[0-9a-fA-F]{2}(?:\\:[0-9a-fA-F]{2}){5}\" />",
|
||||
body += fmt::format("<input type=\"text\" name=\"{}\" value=\"{}\" pattern=\"[0-9a-fA-F]{{2}}(?:\\:[0-9a-fA-F]{{2}}){{5}}\" />",
|
||||
esphttpdutils::htmlentities(key),
|
||||
esphttpdutils::htmlentities(wifi_stack::toString(value)));
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same_v<T, std::optional<wifi_stack::mac_t>>
|
||||
, void>::type
|
||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
{
|
||||
body += fmt::format("<input type=\"text\" name=\"{}\" value=\"{}\" pattern=\"(?:[0-9a-fA-F]{{2}}(?:\\:[0-9a-fA-F]{{2}}){{5}})?\" /> ?",
|
||||
esphttpdutils::htmlentities(key),
|
||||
value ? esphttpdutils::htmlentities(wifi_stack::toString(*value)) : std::string{});
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same_v<T, wifi_auth_mode_t>
|
||||
, void>::type
|
||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
{
|
||||
HtmlTag select{"select", fmt::format("name=\"{}\"", esphttpdutils::htmlentities(key)), body};
|
||||
|
||||
#define HANDLE_ENUM_KEY(x) \
|
||||
{ \
|
||||
HtmlTag option{"option", fmt::format("value=\"{}\"{}", std::to_underlying(x), value == x ? " selected" : ""), body}; \
|
||||
body += esphttpdutils::htmlentities(#x); \
|
||||
}
|
||||
HANDLE_ENUM_KEY(WIFI_AUTH_OPEN)
|
||||
HANDLE_ENUM_KEY(WIFI_AUTH_WEP)
|
||||
HANDLE_ENUM_KEY(WIFI_AUTH_WPA_PSK)
|
||||
HANDLE_ENUM_KEY(WIFI_AUTH_WPA2_PSK)
|
||||
HANDLE_ENUM_KEY(WIFI_AUTH_WPA_WPA2_PSK)
|
||||
HANDLE_ENUM_KEY(WIFI_AUTH_WPA2_ENTERPRISE)
|
||||
HANDLE_ENUM_KEY(WIFI_AUTH_WPA3_PSK)
|
||||
HANDLE_ENUM_KEY(WIFI_AUTH_WPA2_WPA3_PSK)
|
||||
HANDLE_ENUM_KEY(WIFI_AUTH_WAPI_PSK)
|
||||
HANDLE_ENUM_KEY(WIFI_AUTH_MAX)
|
||||
#undef HANDLE_ENUM_KEY
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same_v<T, sntp_sync_mode_t>
|
||||
, void>::type
|
||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
{
|
||||
HtmlTag select{"select", fmt::format("name=\"{}\"", esphttpdutils::htmlentities(key)), body};
|
||||
|
||||
#define HANDLE_ENUM_KEY(x) \
|
||||
{ \
|
||||
HtmlTag option{"option", fmt::format("value=\"{}\"{}", std::to_underlying(x), value == x ? " selected" : ""), body}; \
|
||||
body += esphttpdutils::htmlentities(#x); \
|
||||
}
|
||||
HANDLE_ENUM_KEY(SNTP_SYNC_MODE_IMMED)
|
||||
HANDLE_ENUM_KEY(SNTP_SYNC_MODE_SMOOTH)
|
||||
#undef HANDLE_ENUM_KEY
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same_v<T, espchrono::DayLightSavingMode>
|
||||
, void>::type
|
||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||
{
|
||||
HtmlTag select{"select", fmt::format("name=\"{}\"", esphttpdutils::htmlentities(key)), body};
|
||||
|
||||
espchrono::iterateDayLightSavingMode([&](T enumVal, std::string_view enumKey){
|
||||
HtmlTag option{"option", fmt::format("value=\"{}\"{}", std::to_underlying(enumVal), value == enumVal ? " selected" : ""), body};
|
||||
body += esphttpdutils::htmlentities(enumKey);
|
||||
});
|
||||
}
|
||||
} // namespace
|
||||
|
||||
esp_err_t webserver_newSettings_handler(httpd_req_t *req)
|
||||
{
|
||||
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||
ESP_LOGI(TAG, "trying to lock...");
|
||||
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||
if (!helper.locked())
|
||||
{
|
||||
@ -219,10 +310,16 @@ esp_err_t webserver_newSettings_handler(httpd_req_t *req)
|
||||
|
||||
body += ' ';
|
||||
|
||||
if (config.allowReset())
|
||||
{
|
||||
HtmlTag buttonTag{"a", fmt::format("href=\"/resetNewSettings?{}=1\"", esphttpdutils::htmlentities(nvsName)), body};
|
||||
body += "Reset";
|
||||
}
|
||||
else
|
||||
{
|
||||
HtmlTag buttonTag{"span", "style=\"color: yellow;\"", body};
|
||||
body += "No Reset";
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -238,152 +335,105 @@ esp_err_t webserver_newSettings_handler(httpd_req_t *req)
|
||||
namespace {
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
!std::is_same<T, bool>::value &&
|
||||
!std::is_integral<T>::value &&
|
||||
!std::is_same<T, std::string>::value &&
|
||||
!std::is_same<T, wifi_stack::ip_address_t>::value &&
|
||||
!std::is_same<T, wifi_stack::mac_t>::value
|
||||
, bool>::type
|
||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue, std::string &body)
|
||||
!std::is_same_v<T, bool> &&
|
||||
!std::is_integral_v<T> &&
|
||||
!std::is_same_v<T, std::string> &&
|
||||
!std::is_same_v<T, wifi_stack::ip_address_t> &&
|
||||
!std::is_same_v<T, wifi_stack::mac_t> &&
|
||||
!std::is_same_v<T, std::optional<wifi_stack::mac_t>> &&
|
||||
!std::is_same_v<T, wifi_auth_mode_t> &&
|
||||
!std::is_same_v<T, sntp_sync_mode_t> &&
|
||||
!std::is_same_v<T, espchrono::DayLightSavingMode>
|
||||
, tl::expected<void, std::string>>::type
|
||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
|
||||
{
|
||||
body += "Unsupported config type";
|
||||
return false;
|
||||
return tl::make_unexpected("Unsupported config type");
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same<T, bool>::value
|
||||
, bool>::type
|
||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue, std::string &body)
|
||||
std::is_same_v<T, bool>
|
||||
, tl::expected<void, std::string>>::type
|
||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
|
||||
{
|
||||
if (newValue == "true")
|
||||
{
|
||||
if (const auto result = configs.write_config(config, true); result)
|
||||
{
|
||||
body += "applied";
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
body += result.error();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (newValue == "false")
|
||||
{
|
||||
if (const auto result = configs.write_config(config, false); result)
|
||||
{
|
||||
body += "applied";
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
body += result.error();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (cpputils::is_in(newValue, "true", "false"))
|
||||
return configs.write_config(config, newValue == "true");
|
||||
else
|
||||
{
|
||||
body += fmt::format("only true and false allowed, not {}", newValue);
|
||||
return false;
|
||||
}
|
||||
return tl::make_unexpected(fmt::format("only true and false allowed, not {}", newValue));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
!std::is_same<T, bool>::value &&
|
||||
std::is_integral<T>::value
|
||||
, bool>::type
|
||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue, std::string &body)
|
||||
!std::is_same_v<T, bool> &&
|
||||
std::is_integral_v<T>
|
||||
, tl::expected<void, std::string>>::type
|
||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
|
||||
{
|
||||
if (auto parsed = cpputils::fromString<T>(newValue))
|
||||
{
|
||||
if (const auto result = configs.write_config(config, *parsed); result)
|
||||
{
|
||||
body += "applied";
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
body += result.error();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return configs.write_config(config, *parsed);
|
||||
else
|
||||
{
|
||||
body += fmt::format("could not parse {}", newValue);
|
||||
return false;
|
||||
}
|
||||
return tl::make_unexpected(fmt::format("could not parse {}", newValue));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same<T, std::string>::value
|
||||
, bool>::type
|
||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue, std::string &body)
|
||||
std::is_same_v<T, std::string>
|
||||
, tl::expected<void, std::string>>::type
|
||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
|
||||
{
|
||||
if (const auto result = configs.write_config(config, std::string{newValue}); result)
|
||||
{
|
||||
body += "applied";
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
body += result.error();
|
||||
return false;
|
||||
}
|
||||
return configs.write_config(config, std::string{newValue});
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same<T, wifi_stack::ip_address_t>::value
|
||||
, bool>::type
|
||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue, std::string &body)
|
||||
std::is_same_v<T, wifi_stack::ip_address_t>
|
||||
, tl::expected<void, std::string>>::type
|
||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
|
||||
{
|
||||
if (const auto parsed = wifi_stack::fromString<wifi_stack::ip_address_t>(newValue); parsed)
|
||||
{
|
||||
if (const auto result = configs.write_config(config, *parsed); result)
|
||||
{
|
||||
body += "applied";
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
body += result.error();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return configs.write_config(config, *parsed);
|
||||
else
|
||||
{
|
||||
body += parsed.error();
|
||||
return false;
|
||||
}
|
||||
return tl::make_unexpected(parsed.error());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same<T, wifi_stack::mac_t>::value
|
||||
, bool>::type
|
||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue, std::string &body)
|
||||
std::is_same_v<T, wifi_stack::mac_t>
|
||||
, tl::expected<void, std::string>>::type
|
||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
|
||||
{
|
||||
if (const auto parsed = wifi_stack::fromString<wifi_stack::mac_t>(newValue); parsed)
|
||||
{
|
||||
if (const auto result = configs.write_config(config, *parsed); result)
|
||||
{
|
||||
body += "applied";
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
body += result.error();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return configs.write_config(config, *parsed);
|
||||
else
|
||||
{
|
||||
body += parsed.error();
|
||||
return false;
|
||||
}
|
||||
return tl::make_unexpected(parsed.error());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same_v<T, std::optional<wifi_stack::mac_t>>
|
||||
, tl::expected<void, std::string>>::type
|
||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
|
||||
{
|
||||
if (newValue.empty())
|
||||
return configs.write_config(config, std::nullopt);
|
||||
else if (const auto parsed = wifi_stack::fromString<wifi_stack::mac_t>(newValue); parsed)
|
||||
return configs.write_config(config, *parsed);
|
||||
else
|
||||
return tl::make_unexpected(parsed.error());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same_v<T, wifi_auth_mode_t> ||
|
||||
std::is_same_v<T, sntp_sync_mode_t> ||
|
||||
std::is_same_v<T, espchrono::DayLightSavingMode>
|
||||
, tl::expected<void, std::string>>::type
|
||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
|
||||
{
|
||||
if (auto parsed = cpputils::fromString<std::underlying_type_t<T>>(newValue))
|
||||
return configs.write_config(config, T(*parsed));
|
||||
else
|
||||
return tl::make_unexpected(fmt::format("could not parse {}", newValue));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -431,10 +481,13 @@ esp_err_t webserver_saveNewSettings_handler(httpd_req_t *req)
|
||||
char valueBuf[257];
|
||||
esphttpdutils::urldecode(valueBuf, valueBufEncoded);
|
||||
|
||||
body += nvsName;
|
||||
if (!saveSetting(config, valueBuf, body))
|
||||
if (const auto result = saveSetting(config, valueBuf); result)
|
||||
body += fmt::format("{} succeeded!\n", esphttpdutils::htmlentities(nvsName));
|
||||
else
|
||||
{
|
||||
body += fmt::format("{} failed: {}\n", esphttpdutils::htmlentities(nvsName), esphttpdutils::htmlentities(result.error()));
|
||||
success = false;
|
||||
body += '\n';
|
||||
}
|
||||
});
|
||||
|
||||
if (body.empty())
|
||||
|
@ -131,9 +131,9 @@ std::optional<wifi_stack::ap_config> createApConfig()
|
||||
.ssid = configs.wifiApName.value,
|
||||
.key = configs.wifiApKey.value,
|
||||
.static_ip = {
|
||||
.ip = apIP,
|
||||
.subnet = netMsk,
|
||||
.gateway = apIP
|
||||
.ip = configs.wifiApIp.value,
|
||||
.subnet = configs.wifiApMask.value,
|
||||
.gateway = configs.wifiApIp.value,
|
||||
},
|
||||
.channel = configs.wifiApChannel.value,
|
||||
.authmode = configs.wifiApAuthmode.value,
|
||||
|
@ -6,9 +6,6 @@
|
||||
// 3rdparty lib includes
|
||||
#include <espwifiutils.h>
|
||||
|
||||
constexpr const wifi_stack::ip_address_t apIP{10, 0, 0, 1};
|
||||
constexpr const wifi_stack::ip_address_t netMsk{255, 255, 255, 0};
|
||||
|
||||
void wifi_begin();
|
||||
|
||||
void wifi_update();
|
||||
|
Reference in New Issue
Block a user