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
|
# -DDPAD_6WIRESW_DEBUG
|
||||||
-DFEATURE_GSCHISSENE_DIODE
|
-DFEATURE_GSCHISSENE_DIODE
|
||||||
|
|
||||||
-DDEFAULT_GASMIN=842
|
|
||||||
-DDEFAULT_GASMAX=2480
|
|
||||||
-DDEFAULT_BREMSMIN=826
|
|
||||||
-DDEFAULT_BREMSMAX=2502
|
|
||||||
-DFEATURE_BLE
|
-DFEATURE_BLE
|
||||||
# -DFEATURE_BLUETOOTH
|
# -DFEATURE_BLUETOOTH
|
||||||
# -DFEATURE_BMS
|
# -DFEATURE_BMS
|
||||||
|
@ -80,10 +80,6 @@ set(BOBBYCAR_BUILDFLAGS
|
|||||||
# -DDPAD_6WIRESW_DEBUG
|
# -DDPAD_6WIRESW_DEBUG
|
||||||
-DFEATURE_GSCHISSENE_DIODE
|
-DFEATURE_GSCHISSENE_DIODE
|
||||||
|
|
||||||
-DDEFAULT_GASMIN=842
|
|
||||||
-DDEFAULT_GASMAX=2480
|
|
||||||
-DDEFAULT_BREMSMIN=826
|
|
||||||
-DDEFAULT_BREMSMAX=2502
|
|
||||||
-DFEATURE_BLE
|
-DFEATURE_BLE
|
||||||
# -DFEATURE_BLUETOOTH
|
# -DFEATURE_BLUETOOTH
|
||||||
# -DFEATURE_BMS
|
# -DFEATURE_BMS
|
||||||
|
@ -61,10 +61,6 @@ set(BOBBYCAR_BUILDFLAGS
|
|||||||
-DDPAD_5WIRESW_QUICKACTION_DOWN=3
|
-DDPAD_5WIRESW_QUICKACTION_DOWN=3
|
||||||
-DDPAD_5WIRESW_QUICKACTION_UP=6
|
-DDPAD_5WIRESW_QUICKACTION_UP=6
|
||||||
# -DDPAD_5WIRESW_DEBUG
|
# -DDPAD_5WIRESW_DEBUG
|
||||||
-DDEFAULT_GASMIN=200
|
|
||||||
-DDEFAULT_GASMAX=1070
|
|
||||||
-DDEFAULT_BREMSMIN=270
|
|
||||||
-DDEFAULT_BREMSMAX=1800
|
|
||||||
-DFEATURE_BLE
|
-DFEATURE_BLE
|
||||||
# -DFEATURE_BLUETOOTH
|
# -DFEATURE_BLUETOOTH
|
||||||
# -DFEATURE_BMS
|
# -DFEATURE_BMS
|
||||||
|
@ -57,10 +57,6 @@ set(BOBBYCAR_BUILDFLAGS
|
|||||||
-DDPAD_5WIRESW_PROFILE2=7
|
-DDPAD_5WIRESW_PROFILE2=7
|
||||||
-DDPAD_5WIRESW_PROFILE3=3
|
-DDPAD_5WIRESW_PROFILE3=3
|
||||||
# -DDPAD_5WIRESW_DEBUG
|
# -DDPAD_5WIRESW_DEBUG
|
||||||
-DDEFAULT_GASMIN=842
|
|
||||||
-DDEFAULT_GASMAX=2480
|
|
||||||
-DDEFAULT_BREMSMIN=826
|
|
||||||
-DDEFAULT_BREMSMAX=2502
|
|
||||||
# -DFEATURE_BLE
|
# -DFEATURE_BLE
|
||||||
# -DFEATURE_BLUETOOTH
|
# -DFEATURE_BLUETOOTH
|
||||||
# -DFEATURE_BMS
|
# -DFEATURE_BMS
|
||||||
|
@ -57,10 +57,6 @@ set(BOBBYCAR_BUILDFLAGS
|
|||||||
# -DDPAD_5WIRESW_PROFILE2=7
|
# -DDPAD_5WIRESW_PROFILE2=7
|
||||||
# -DDPAD_5WIRESW_PROFILE3=3
|
# -DDPAD_5WIRESW_PROFILE3=3
|
||||||
# -DDPAD_5WIRESW_DEBUG
|
# -DDPAD_5WIRESW_DEBUG
|
||||||
-DDEFAULT_GASMIN=184
|
|
||||||
-DDEFAULT_GASMAX=1329
|
|
||||||
-DDEFAULT_BREMSMIN=28
|
|
||||||
-DDEFAULT_BREMSMAX=500
|
|
||||||
-DFEATURE_BLE
|
-DFEATURE_BLE
|
||||||
# -DFEATURE_BLUETOOTH
|
# -DFEATURE_BLUETOOTH
|
||||||
# -DFEATURE_BMS
|
# -DFEATURE_BMS
|
||||||
|
@ -80,10 +80,6 @@ set(BOBBYCAR_BUILDFLAGS
|
|||||||
# -DDPAD_6WIRESW_DEBUG
|
# -DDPAD_6WIRESW_DEBUG
|
||||||
# -DFEATURE_GSCHISSENE_DIODE
|
# -DFEATURE_GSCHISSENE_DIODE
|
||||||
|
|
||||||
-DDEFAULT_GASMIN=842
|
|
||||||
-DDEFAULT_GASMAX=2480
|
|
||||||
-DDEFAULT_BREMSMIN=826
|
|
||||||
-DDEFAULT_BREMSMAX=2502
|
|
||||||
# -DFEATURE_BLE
|
# -DFEATURE_BLE
|
||||||
# -DFEATURE_BLUETOOTH
|
# -DFEATURE_BLUETOOTH
|
||||||
# -DFEATURE_BMS
|
# -DFEATURE_BMS
|
||||||
|
@ -61,10 +61,6 @@ set(BOBBYCAR_BUILDFLAGS
|
|||||||
-DDPAD_5WIRESW_QUICKACTION_DOWN=3
|
-DDPAD_5WIRESW_QUICKACTION_DOWN=3
|
||||||
-DDPAD_5WIRESW_QUICKACTION_UP=6
|
-DDPAD_5WIRESW_QUICKACTION_UP=6
|
||||||
# -DDPAD_5WIRESW_DEBUG
|
# -DDPAD_5WIRESW_DEBUG
|
||||||
-DDEFAULT_GASMIN=842
|
|
||||||
-DDEFAULT_GASMAX=2480
|
|
||||||
-DDEFAULT_BREMSMIN=826
|
|
||||||
-DDEFAULT_BREMSMAX=2502
|
|
||||||
-DFEATURE_BLE
|
-DFEATURE_BLE
|
||||||
# -DFEATURE_BLUETOOTH
|
# -DFEATURE_BLUETOOTH
|
||||||
# -DFEATURE_BMS
|
# -DFEATURE_BMS
|
||||||
|
@ -1,7 +1,81 @@
|
|||||||
set(headers
|
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/globalaccessors.h
|
||||||
accessors/settingsaccessors.h
|
accessors/settingsaccessors.h
|
||||||
accessors/wifiaccessors.h
|
accessors/wifiaccessors.h
|
||||||
|
accessors/wifiapconfigaccessors.h
|
||||||
|
accessors/wifistaconfigaccessors.h
|
||||||
actions/assertaction.h
|
actions/assertaction.h
|
||||||
actions/bluetoothbeginaction.h
|
actions/bluetoothbeginaction.h
|
||||||
actions/bluetoothbeginmasteraction.h
|
actions/bluetoothbeginmasteraction.h
|
||||||
@ -19,7 +93,6 @@ set(headers
|
|||||||
actions/ledstripblinkactions.h
|
actions/ledstripblinkactions.h
|
||||||
actions/loadsettingsaction.h
|
actions/loadsettingsaction.h
|
||||||
actions/modesettingsaction.h
|
actions/modesettingsaction.h
|
||||||
actions/multiaction.h
|
|
||||||
actions/qraction.h
|
actions/qraction.h
|
||||||
actions/rebootaction.h
|
actions/rebootaction.h
|
||||||
actions/savesettingsaction.h
|
actions/savesettingsaction.h
|
||||||
@ -27,41 +100,18 @@ set(headers
|
|||||||
actions/tempomatmodeapplycurrentpeedaction.h
|
actions/tempomatmodeapplycurrentpeedaction.h
|
||||||
actions/updateswapfrontbackaction.h
|
actions/updateswapfrontbackaction.h
|
||||||
actions/wifiscanaction.h
|
actions/wifiscanaction.h
|
||||||
battery.h
|
actions/wifistascanaction.h
|
||||||
ble_bobby.h
|
actions/wifistascanclearaction.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
|
|
||||||
displays/bmsdisplay.h
|
displays/bmsdisplay.h
|
||||||
displays/bobbychangevaluedisplay.h
|
displays/bobbychangevaluedisplay.h
|
||||||
displays/bobbydisplay.h
|
displays/bobbydisplay.h
|
||||||
displays/bobbydisplaywithtitle.h
|
displays/bobbydisplaywithtitle.h
|
||||||
displays/bobbygraphdisplay.h
|
displays/bobbygraphdisplay.h
|
||||||
displays/bobbymenudisplay.h
|
displays/bobbymenudisplay.h
|
||||||
|
displays/bobbypopupdisplay.h
|
||||||
displays/bobbysplitgraphdisplay.h
|
displays/bobbysplitgraphdisplay.h
|
||||||
displays/calibratedisplay.h
|
displays/calibratedisplay.h
|
||||||
displays/calibratevoltagedisplay.h
|
displays/calibratevoltagedisplay.h
|
||||||
displays/qrdisplay.h
|
|
||||||
displays/dpad5wire2outdebugdisplay.h
|
displays/dpad5wire2outdebugdisplay.h
|
||||||
displays/dpad5wiredebugdisplay.h
|
displays/dpad5wiredebugdisplay.h
|
||||||
displays/dpad6wiredebugdisplay.h
|
displays/dpad6wiredebugdisplay.h
|
||||||
@ -70,6 +120,7 @@ set(headers
|
|||||||
displays/ledstripcolorsdisplay.h
|
displays/ledstripcolorsdisplay.h
|
||||||
displays/lockscreen.h
|
displays/lockscreen.h
|
||||||
displays/menudisplaywithtime.cpp
|
displays/menudisplaywithtime.cpp
|
||||||
|
displays/menudisplaywithtime.h
|
||||||
displays/menus/aboutmenu.h
|
displays/menus/aboutmenu.h
|
||||||
displays/menus/batterydebugmenu.h
|
displays/menus/batterydebugmenu.h
|
||||||
displays/menus/batterymenu.h
|
displays/menus/batterymenu.h
|
||||||
@ -90,8 +141,8 @@ set(headers
|
|||||||
displays/menus/espnowmenu.h
|
displays/menus/espnowmenu.h
|
||||||
displays/menus/espnowsettingsmenu.h
|
displays/menus/espnowsettingsmenu.h
|
||||||
displays/menus/feedbackdebugmenu.h
|
displays/menus/feedbackdebugmenu.h
|
||||||
displays/menus/garagenmenu.h
|
|
||||||
displays/menus/gametrakmodesettingsmenu.h
|
displays/menus/gametrakmodesettingsmenu.h
|
||||||
|
displays/menus/garagenmenu.h
|
||||||
displays/menus/graphsmenu.h
|
displays/menus/graphsmenu.h
|
||||||
displays/menus/greenpassmenu.h
|
displays/menus/greenpassmenu.h
|
||||||
displays/menus/handbremssettingsmenu.h
|
displays/menus/handbremssettingsmenu.h
|
||||||
@ -125,31 +176,24 @@ set(headers
|
|||||||
displays/menus/timersmenu.h
|
displays/menus/timersmenu.h
|
||||||
displays/menus/timesettingsmenu.h
|
displays/menus/timesettingsmenu.h
|
||||||
displays/menus/udpcloudsettingsmenu.h
|
displays/menus/udpcloudsettingsmenu.h
|
||||||
displays/menus/wifistasettingsmenu.h
|
displays/menus/wifiapclientsmenu.h
|
||||||
displays/menus/wifiapsettingsmenu.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/metersdisplay.h
|
||||||
displays/pingpongdisplay.h
|
displays/pingpongdisplay.h
|
||||||
displays/popups/alertdisplay.h
|
|
||||||
displays/poweroffdisplay.h
|
displays/poweroffdisplay.h
|
||||||
displays/powersupplydisplay.h
|
displays/powersupplydisplay.h
|
||||||
displays/qrcodedebug.h
|
displays/qrcodedebug.h
|
||||||
|
displays/qrdisplay.h
|
||||||
displays/qrimportdisplay.h
|
displays/qrimportdisplay.h
|
||||||
displays/spirodisplay.h
|
displays/spirodisplay.h
|
||||||
displays/starfielddisplay.h
|
displays/starfielddisplay.h
|
||||||
displays/statusdisplay.h
|
displays/statusdisplay.h
|
||||||
displays/updatedisplay.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/alert.h
|
||||||
icons/battery.h
|
icons/battery.h
|
||||||
icons/bluetooth.h
|
icons/bluetooth.h
|
||||||
@ -175,11 +219,6 @@ set(headers
|
|||||||
icons/time.h
|
icons/time.h
|
||||||
icons/update.h
|
icons/update.h
|
||||||
icons/wifi.h
|
icons/wifi.h
|
||||||
ledstrip.h
|
|
||||||
ledstripdefines.h
|
|
||||||
macros_bobbycar.h
|
|
||||||
modeinterface.h
|
|
||||||
modes.h
|
|
||||||
modes/defaultmode.h
|
modes/defaultmode.h
|
||||||
modes/gametrakmode.h
|
modes/gametrakmode.h
|
||||||
modes/ignoreinputmode.h
|
modes/ignoreinputmode.h
|
||||||
@ -187,57 +226,87 @@ set(headers
|
|||||||
modes/motortestmode.h
|
modes/motortestmode.h
|
||||||
modes/remotecontrolmode.h
|
modes/remotecontrolmode.h
|
||||||
modes/tempomatmode.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/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
|
texthelpers/wifiaptexthelpers.h
|
||||||
actions/wifistascanaction.h
|
texthelpers/wifistaconfigtexthelpers.h
|
||||||
actions/wifistascanclearaction.h
|
texthelpers/wifistatexthelpers.h
|
||||||
|
widgets/doubleprogressbar.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(sources
|
set(sources
|
||||||
accessors/globalaccessors.cpp
|
battery.cpp
|
||||||
accessors/settingsaccessors.cpp
|
ble_bobby.cpp
|
||||||
accessors/wifiaccessors.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/assertaction.cpp
|
||||||
actions/bluetoothbeginaction.cpp
|
actions/bluetoothbeginaction.cpp
|
||||||
actions/bluetoothbeginmasteraction.cpp
|
actions/bluetoothbeginmasteraction.cpp
|
||||||
@ -255,7 +324,6 @@ set(sources
|
|||||||
actions/ledstripblinkactions.cpp
|
actions/ledstripblinkactions.cpp
|
||||||
actions/loadsettingsaction.cpp
|
actions/loadsettingsaction.cpp
|
||||||
actions/modesettingsaction.cpp
|
actions/modesettingsaction.cpp
|
||||||
actions/multiaction.cpp
|
|
||||||
actions/qraction.cpp
|
actions/qraction.cpp
|
||||||
actions/rebootaction.cpp
|
actions/rebootaction.cpp
|
||||||
actions/savesettingsaction.cpp
|
actions/savesettingsaction.cpp
|
||||||
@ -263,41 +331,18 @@ set(sources
|
|||||||
actions/tempomatmodeapplycurrentpeedaction.cpp
|
actions/tempomatmodeapplycurrentpeedaction.cpp
|
||||||
actions/updateswapfrontbackaction.cpp
|
actions/updateswapfrontbackaction.cpp
|
||||||
actions/wifiscanaction.cpp
|
actions/wifiscanaction.cpp
|
||||||
battery.cpp
|
actions/wifistascanaction.cpp
|
||||||
ble_bobby.cpp
|
actions/wifistascanclearaction.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
|
|
||||||
displays/bmsdisplay.cpp
|
displays/bmsdisplay.cpp
|
||||||
displays/bobbychangevaluedisplay.cpp
|
displays/bobbychangevaluedisplay.cpp
|
||||||
displays/bobbydisplay.cpp
|
displays/bobbydisplay.cpp
|
||||||
displays/bobbydisplaywithtitle.cpp
|
displays/bobbydisplaywithtitle.cpp
|
||||||
displays/bobbygraphdisplay.cpp
|
displays/bobbygraphdisplay.cpp
|
||||||
displays/bobbymenudisplay.cpp
|
displays/bobbymenudisplay.cpp
|
||||||
|
displays/bobbypopupdisplay.cpp
|
||||||
displays/bobbysplitgraphdisplay.cpp
|
displays/bobbysplitgraphdisplay.cpp
|
||||||
displays/calibratedisplay.cpp
|
displays/calibratedisplay.cpp
|
||||||
displays/calibratevoltagedisplay.cpp
|
displays/calibratevoltagedisplay.cpp
|
||||||
displays/qrdisplay.cpp
|
|
||||||
displays/dpad5wire2outdebugdisplay.cpp
|
displays/dpad5wire2outdebugdisplay.cpp
|
||||||
displays/dpad5wiredebugdisplay.cpp
|
displays/dpad5wiredebugdisplay.cpp
|
||||||
displays/dpad6wiredebugdisplay.cpp
|
displays/dpad6wiredebugdisplay.cpp
|
||||||
@ -325,8 +370,8 @@ set(sources
|
|||||||
displays/menus/espnowmenu.cpp
|
displays/menus/espnowmenu.cpp
|
||||||
displays/menus/espnowsettingsmenu.cpp
|
displays/menus/espnowsettingsmenu.cpp
|
||||||
displays/menus/feedbackdebugmenu.cpp
|
displays/menus/feedbackdebugmenu.cpp
|
||||||
displays/menus/garagenmenu.cpp
|
|
||||||
displays/menus/gametrakmodesettingsmenu.cpp
|
displays/menus/gametrakmodesettingsmenu.cpp
|
||||||
|
displays/menus/garagenmenu.cpp
|
||||||
displays/menus/graphsmenu.cpp
|
displays/menus/graphsmenu.cpp
|
||||||
displays/menus/greenpassmenu.cpp
|
displays/menus/greenpassmenu.cpp
|
||||||
displays/menus/handbremssettingsmenu.cpp
|
displays/menus/handbremssettingsmenu.cpp
|
||||||
@ -360,31 +405,24 @@ set(sources
|
|||||||
displays/menus/timersmenu.cpp
|
displays/menus/timersmenu.cpp
|
||||||
displays/menus/timesettingsmenu.cpp
|
displays/menus/timesettingsmenu.cpp
|
||||||
displays/menus/udpcloudsettingsmenu.cpp
|
displays/menus/udpcloudsettingsmenu.cpp
|
||||||
displays/menus/wifistasettingsmenu.cpp
|
displays/menus/wifiapclientsmenu.cpp
|
||||||
displays/menus/wifiapsettingsmenu.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/metersdisplay.cpp
|
||||||
displays/pingpongdisplay.cpp
|
displays/pingpongdisplay.cpp
|
||||||
displays/popups/alertdisplay.cpp
|
|
||||||
displays/poweroffdisplay.cpp
|
displays/poweroffdisplay.cpp
|
||||||
displays/powersupplydisplay.cpp
|
displays/powersupplydisplay.cpp
|
||||||
displays/qrcodedebug.cpp
|
displays/qrcodedebug.cpp
|
||||||
|
displays/qrdisplay.cpp
|
||||||
displays/qrimportdisplay.cpp
|
displays/qrimportdisplay.cpp
|
||||||
displays/spirodisplay.cpp
|
displays/spirodisplay.cpp
|
||||||
displays/starfielddisplay.cpp
|
displays/starfielddisplay.cpp
|
||||||
displays/statusdisplay.cpp
|
displays/statusdisplay.cpp
|
||||||
displays/updatedisplay.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/alert.cpp
|
||||||
icons/battery.cpp
|
icons/battery.cpp
|
||||||
icons/bluetooth.cpp
|
icons/bluetooth.cpp
|
||||||
@ -410,12 +448,6 @@ set(sources
|
|||||||
icons/time.cpp
|
icons/time.cpp
|
||||||
icons/update.cpp
|
icons/update.cpp
|
||||||
icons/wifi.cpp
|
icons/wifi.cpp
|
||||||
ledstrip.cpp
|
|
||||||
ledstripdefines.cpp
|
|
||||||
macros_bobbycar.cpp
|
|
||||||
main.cpp
|
|
||||||
modeinterface.cpp
|
|
||||||
modes.cpp
|
|
||||||
modes/defaultmode.cpp
|
modes/defaultmode.cpp
|
||||||
modes/gametrakmode.cpp
|
modes/gametrakmode.cpp
|
||||||
modes/ignoreinputmode.cpp
|
modes/ignoreinputmode.cpp
|
||||||
@ -423,50 +455,11 @@ set(sources
|
|||||||
modes/motortestmode.cpp
|
modes/motortestmode.cpp
|
||||||
modes/remotecontrolmode.cpp
|
modes/remotecontrolmode.cpp
|
||||||
modes/tempomatmode.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/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
|
texthelpers/wifiaptexthelpers.cpp
|
||||||
actions/wifistascanaction.cpp
|
texthelpers/wifistaconfigtexthelpers.cpp
|
||||||
actions/wifistascanclearaction.cpp
|
texthelpers/wifistatexthelpers.cpp
|
||||||
|
widgets/doubleprogressbar.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(dependencies
|
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
|
// local includes
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "accessorhelpers.h"
|
||||||
#include "newsettings.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
|
// Bms
|
||||||
#ifdef FEATURE_BMS
|
#ifdef FEATURE_BMS
|
||||||
struct AutoConnectBmsAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.autoConnectBms; } };
|
struct AutoConnectBmsAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.autoConnectBms; } };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Buzzer
|
// Buzzer
|
||||||
struct ReverseBeepAccessor : public virtual espgui::AccessorInterface<bool>
|
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; } };
|
||||||
bool getValue() const override { return configs.reverseBeep.value; }
|
struct ReverseBeepFreq1Accessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.reverseBeepFreq1; } };
|
||||||
void setValue(bool value) override { configs.write_config(configs.reverseBeep, value); }
|
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; } };
|
||||||
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); }
|
|
||||||
};
|
|
||||||
|
|
||||||
// Limits
|
// Limits
|
||||||
struct IMotMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.limits.iMotMax; } };
|
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>
|
struct NMotMaxKmhAccessor : public virtual espgui::AccessorInterface<int16_t>
|
||||||
{
|
{
|
||||||
int16_t getValue() const override { return convertToKmh(settings.limits.nMotMax); }
|
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 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 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; } };
|
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
|
// Bluetooth
|
||||||
#ifdef FEATURE_BLUETOOTH
|
#ifdef FEATURE_BLUETOOTH
|
||||||
struct AutoBluetoothModeAccessor : public RefAccessorSaveSettings<BluetoothMode> { BluetoothMode &getRef() const override { return settings.bluetoothSettings.autoBluetoothMode; } };
|
struct AutoBluetoothModeAccessor : public RefAccessorSaveSettings<BluetoothMode> { BluetoothMode &getRef() const override { return settings.bluetoothSettings.autoBluetoothMode; } };
|
||||||
@ -88,32 +56,14 @@ struct CloudTransmitTimeoutAccessor : public RefAccessorSaveSettings<int16_t> {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Time
|
// Time
|
||||||
struct TimezoneOffsetAccessor : public virtual espgui::AccessorInterface<int32_t>
|
//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; } };
|
||||||
int32_t getValue() const override { return configs.timezoneOffset.value.count(); }
|
struct DaylightSavingModeAccessor : public NewSettingsAccessor<espchrono::DayLightSavingMode> { ConfigWrapper<espchrono::DayLightSavingMode> &getConfig() const override { return configs.timeDst; } };
|
||||||
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); }
|
|
||||||
};
|
|
||||||
#ifdef FEATURE_NTP
|
#ifdef FEATURE_NTP
|
||||||
struct TimeServerEnabledAccessor : public virtual espgui::AccessorInterface<bool>
|
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; } };
|
||||||
bool getValue() const override { return configs.timeServerEnabled.value; }
|
//struct TimeSyncIntervalAccessor : public NewSettingsAccessor<int32_t> { ConfigWrapper<int32_t> &getConfig() const override { return configs.timeSyncInterval; } };
|
||||||
void setValue(bool value) override { configs.write_config(configs.timeServerEnabled, value); }
|
struct TimeSyncIntervalAccessor : public NewSettingsChronoAdaptorAccessor<espchrono::milliseconds32> { ConfigWrapper<espchrono::milliseconds32> &getConfig() const override { return configs.timeSyncInterval; } };
|
||||||
};
|
|
||||||
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}); }
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Controller Hardware
|
// Controller Hardware
|
||||||
@ -131,7 +81,13 @@ struct WheelDiameterMmAccessor : public RefAccessorSaveSettings<int16_t> { int16
|
|||||||
struct WheelDiameterInchAccessor : public virtual espgui::AccessorInterface<float>
|
struct WheelDiameterInchAccessor : public virtual espgui::AccessorInterface<float>
|
||||||
{
|
{
|
||||||
float getValue() const override { return convertToInch(settings.controllerHardware.wheelDiameter); }
|
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 NumMagnetPolesAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.controllerHardware.numMagnetPoles; } };
|
||||||
struct SwapFrontBackAccessor : public RefAccessorSaveSettings<bool> {
|
struct SwapFrontBackAccessor : public RefAccessorSaveSettings<bool> {
|
||||||
@ -150,13 +106,13 @@ struct CanReceiveTimeoutAccessor : public RefAccessorSaveSettings<int16_t> { int
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Input devices
|
// Input devices
|
||||||
struct SampleCountAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.sampleCount; } };
|
struct SampleCountAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.sampleCount; } };
|
||||||
struct GasMinAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.gasMin; } };
|
struct GasMinAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.gasMin; } };
|
||||||
struct GasMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.gasMax; } };
|
struct GasMaxAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.gasMax; } };
|
||||||
struct BremsMinAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.bremsMin; } };
|
struct BremsMinAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.bremsMin; } };
|
||||||
struct BremsMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.bremsMax; } };
|
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)
|
#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
|
#endif
|
||||||
#ifdef FEATURE_GAMETRAK
|
#ifdef FEATURE_GAMETRAK
|
||||||
struct GametrakXMinAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.boardcomputerHardware.gametrakXMin; } };
|
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
|
#pragma once
|
||||||
|
|
||||||
// system includes
|
// local includes
|
||||||
#include <string>
|
#include "accessorhelpers.h"
|
||||||
|
#include "newsettings.h"
|
||||||
|
|
||||||
// 3rdparty lib includes
|
struct WifiApEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.wifiApEnabled; } };
|
||||||
#include <accessorinterface.h>
|
//struct WifiApDisableWhenOnlineAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.wifiDisableApWhenOnline; } };
|
||||||
#include <espwifiutils.h>
|
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; } };
|
||||||
class WifiApEnabledAccessor : public virtual espgui::AccessorInterface<bool>
|
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; } };
|
||||||
public:
|
struct WifiApChannelAccessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.wifiApChannel; } };
|
||||||
bool getValue() const override;
|
struct WifiApAuthmodeAccessor : public NewSettingsAccessor<wifi_auth_mode_t> { ConfigWrapper<wifi_auth_mode_t> &getConfig() const override { return configs.wifiApAuthmode; } };
|
||||||
void setValue(bool value) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
//class WifiApDisableWhenOnlineAccessor : public virtual espgui::AccessorInterface<bool>
|
|
||||||
//{
|
|
||||||
//public:
|
|
||||||
// bool getValue() const override;
|
|
||||||
// void setValue(bool value) override;
|
|
||||||
//};
|
|
||||||
|
@ -1,39 +1,3 @@
|
|||||||
#include "wifistaconfigaccessors.h"
|
#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 <accessorinterface.h>
|
||||||
#include <espwifiutils.h>
|
#include <espwifiutils.h>
|
||||||
|
|
||||||
class WifiStaEnabledAccessor : public virtual espgui::AccessorInterface<bool>
|
// local includes
|
||||||
{
|
#include "newsettings.h"
|
||||||
public:
|
#include "accessorhelpers.h"
|
||||||
bool getValue() const override;
|
|
||||||
void setValue(bool value) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
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:
|
public:
|
||||||
WifiStaConfigSsidAccessor(int index) : m_index{index} {}
|
WifiStaConfigSsidAccessor(int index) : m_index{index} {}
|
||||||
|
ConfigWrapper<std::string>& getConfig() const override { return configs.wifi_configs[m_index].ssid; }
|
||||||
std::string getValue() const override;
|
|
||||||
void setValue(std::string value) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int m_index;
|
const int m_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WifiStaConfigKeyAccessor : public virtual espgui::AccessorInterface<std::string>
|
class WifiStaConfigKeyAccessor : public virtual NewSettingsAccessor<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WifiStaConfigKeyAccessor(int index) : m_index{index} {}
|
WifiStaConfigKeyAccessor(int index) : m_index{index} {}
|
||||||
|
ConfigWrapper<std::string>& getConfig() const override { return configs.wifi_configs[m_index].key; }
|
||||||
std::string getValue() const override;
|
|
||||||
void setValue(std::string value) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int m_index;
|
const int m_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WifiStaConfigUseStaticIpAccessor : public virtual espgui::AccessorInterface<bool>
|
class WifiStaConfigUseStaticIpAccessor : public virtual NewSettingsAccessor<bool>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WifiStaConfigUseStaticIpAccessor(int index) : m_index{index} {}
|
WifiStaConfigUseStaticIpAccessor(int index) : m_index{index} {}
|
||||||
|
ConfigWrapper<bool>& getConfig() const override { return configs.wifi_configs[m_index].useStaticIp; }
|
||||||
bool getValue() const override;
|
|
||||||
void setValue(bool value) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int m_index;
|
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:
|
public:
|
||||||
WifiStaConfigStaticIpAccessor(int index) : m_index{index} {}
|
WifiStaConfigStaticIpAccessor(int index) : m_index{index} {}
|
||||||
|
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticIp; }
|
||||||
wifi_stack::ip_address_t getValue() const override;
|
|
||||||
void setValue(wifi_stack::ip_address_t value) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int m_index;
|
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:
|
public:
|
||||||
WifiStaConfigStaticSubnetAccessor(int index) : m_index{index} {}
|
WifiStaConfigStaticSubnetAccessor(int index) : m_index{index} {}
|
||||||
|
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticSubnet; }
|
||||||
wifi_stack::ip_address_t getValue() const override;
|
|
||||||
void setValue(wifi_stack::ip_address_t value) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int m_index;
|
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:
|
public:
|
||||||
WifiStaConfigStaticGatewayAccessor(int index) : m_index{index} {}
|
WifiStaConfigStaticGatewayAccessor(int index) : m_index{index} {}
|
||||||
|
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticGateway; }
|
||||||
wifi_stack::ip_address_t getValue() const override;
|
|
||||||
void setValue(wifi_stack::ip_address_t value) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int m_index;
|
const int m_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WifiStaConfigUseStaticDnsAccessor : public virtual espgui::AccessorInterface<bool>
|
class WifiStaConfigUseStaticDnsAccessor : public virtual NewSettingsAccessor<bool>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WifiStaConfigUseStaticDnsAccessor(int index) : m_index{index} {}
|
WifiStaConfigUseStaticDnsAccessor(int index) : m_index{index} {}
|
||||||
|
ConfigWrapper<bool>& getConfig() const override { return configs.wifi_configs[m_index].useStaticDns; }
|
||||||
bool getValue() const override;
|
|
||||||
void setValue(bool value) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int m_index;
|
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:
|
public:
|
||||||
WifiStaConfigStaticDns0Accessor(int index) : m_index{index} {}
|
WifiStaConfigStaticDns0Accessor(int index) : m_index{index} {}
|
||||||
|
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticDns0; }
|
||||||
wifi_stack::ip_address_t getValue() const override;
|
|
||||||
void setValue(wifi_stack::ip_address_t value) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int m_index;
|
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:
|
public:
|
||||||
WifiStaConfigStaticDns1Accessor(int index) : m_index{index} {}
|
WifiStaConfigStaticDns1Accessor(int index) : m_index{index} {}
|
||||||
|
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticDns1; }
|
||||||
wifi_stack::ip_address_t getValue() const override;
|
|
||||||
void setValue(wifi_stack::ip_address_t value) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int m_index;
|
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:
|
public:
|
||||||
WifiStaConfigStaticDns2Accessor(int index) : m_index{index} {}
|
WifiStaConfigStaticDns2Accessor(int index) : m_index{index} {}
|
||||||
|
ConfigWrapper<wifi_stack::ip_address_t>& getConfig() const override { return configs.wifi_configs[m_index].staticDns2; }
|
||||||
wifi_stack::ip_address_t getValue() const override;
|
|
||||||
void setValue(wifi_stack::ip_address_t value) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int m_index;
|
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"
|
#include "bobbybuttons.h"
|
||||||
|
|
||||||
void BobbyButtons::rawButtonPressed(uint8_t button)
|
[[nodiscard]] std::optional<espgui::Button> translateRawButton(uint8_t button)
|
||||||
{
|
{
|
||||||
//Base::rawButtonPressed(button);
|
|
||||||
switch (button)
|
switch (button)
|
||||||
{
|
{
|
||||||
using espgui::Button;
|
using espgui::Button;
|
||||||
case 0: buttonPressed(Button::Left); break;
|
case 0: return Button::Left;
|
||||||
case 1: buttonPressed(Button::Right); break;
|
case 1: return Button::Right;
|
||||||
case 2: buttonPressed(Button::Up); break;
|
case 2: return Button::Up;
|
||||||
case 3: buttonPressed(Button::Down); break;
|
case 3: return Button::Down;
|
||||||
case 4: buttonPressed(Button(BobbyButton::Profile0)); break;
|
case 4: return Button(BobbyButton::Profile0);
|
||||||
case 5: buttonPressed(Button(BobbyButton::Profile1)); break;
|
case 5: return Button(BobbyButton::Profile1);
|
||||||
case 6: buttonPressed(Button(BobbyButton::Profile2)); break;
|
case 6: return Button(BobbyButton::Profile2);
|
||||||
case 7: buttonPressed(Button(BobbyButton::Profile3)); break;
|
case 7: return Button(BobbyButton::Profile3);
|
||||||
case 8: buttonPressed(Button(BobbyButton::Left2)); break;
|
case 8: return Button(BobbyButton::Left2);
|
||||||
case 9: buttonPressed(Button(BobbyButton::Right2)); break;
|
case 9: return Button(BobbyButton::Right2);
|
||||||
case 10: buttonPressed(Button(BobbyButton::Up2)); break;
|
case 10: return Button(BobbyButton::Up2);
|
||||||
case 11: buttonPressed(Button(BobbyButton::Down2)); break;
|
case 11: return Button(BobbyButton::Down2);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BobbyButtons::rawButtonReleased(uint8_t button)
|
return std::nullopt;
|
||||||
{
|
|
||||||
//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)
|
void buttonPressedCommon(espgui::Button button)
|
||||||
{
|
{
|
||||||
//Base::buttonPressed(button);
|
|
||||||
switch (BobbyButton(button))
|
switch (BobbyButton(button))
|
||||||
{
|
{
|
||||||
case BobbyButton::Profile0: /* TODO */ break;
|
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)
|
void BobbyButtons::buttonReleased(espgui::Button button)
|
||||||
{
|
{
|
||||||
//Base::buttonReleased(button);
|
//Base::buttonReleased(button);
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// system includes
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include "buttonsinterface.h"
|
#include "buttonsinterface.h"
|
||||||
|
|
||||||
@ -17,6 +20,9 @@ enum BobbyButton
|
|||||||
Back = espgui::Button::Left
|
Back = espgui::Button::Left
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[[nodiscard]] std::optional<espgui::Button> translateRawButton(uint8_t button);
|
||||||
|
void buttonPressedCommon(espgui::Button button);
|
||||||
|
|
||||||
class BobbyButtons : public virtual espgui::ButtonsInterface
|
class BobbyButtons : public virtual espgui::ButtonsInterface
|
||||||
{
|
{
|
||||||
public:
|
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
|
#pragma once
|
||||||
|
|
||||||
// esp-idf includes
|
// 3rdparty lib includes
|
||||||
#include <esp_log.h>
|
#include <changevaluedisplay.h>
|
||||||
|
#include <menudisplay.h>
|
||||||
|
#include <confirminterface.h>
|
||||||
|
#include <errorhandlerinterface.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "changevaluedisplay.h"
|
#include "bobbycar-common.h"
|
||||||
#include "menudisplay.h"
|
|
||||||
#include "utils.h"
|
|
||||||
#include "actions/setvalueaction.h"
|
|
||||||
#include "actions/backproxyaction.h"
|
|
||||||
#include "icons/back.h"
|
|
||||||
#include "texts.h"
|
|
||||||
|
|
||||||
namespace espgui {
|
namespace espgui {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class ChangeValueDisplay<bobbycar::protocol::ControlMode> :
|
class ChangeValueDisplay<bobbycar::protocol::ControlMode> :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public virtual AccessorInterface<bobbycar::protocol::ControlMode>,
|
public virtual AccessorInterface<bobbycar::protocol::ControlMode>,
|
||||||
public virtual ActionInterface
|
public virtual ConfirmInterface,
|
||||||
|
public virtual ErrorHandlerInterface
|
||||||
{
|
{
|
||||||
using Base = MenuDisplay;
|
using Base = MenuDisplay;
|
||||||
|
|
||||||
@ -27,30 +26,4 @@ public:
|
|||||||
void start() override;
|
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
|
} // 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
|
#pragma once
|
||||||
|
|
||||||
// esp-idf includes
|
// 3rdparty lib includes
|
||||||
#include <esp_log.h>
|
#include <changevaluedisplay.h>
|
||||||
|
#include <menudisplay.h>
|
||||||
|
#include <confirminterface.h>
|
||||||
|
#include <errorhandlerinterface.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "changevaluedisplay.h"
|
#include "bobbycar-common.h"
|
||||||
#include "menudisplay.h"
|
|
||||||
#include "utils.h"
|
|
||||||
#include "actions/setvalueaction.h"
|
|
||||||
#include "actions/backproxyaction.h"
|
|
||||||
#include "icons/back.h"
|
|
||||||
#include "texts.h"
|
|
||||||
|
|
||||||
namespace espgui {
|
namespace espgui {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class ChangeValueDisplay<bobbycar::protocol::ControlType> :
|
class ChangeValueDisplay<bobbycar::protocol::ControlType> :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public virtual AccessorInterface<bobbycar::protocol::ControlType>,
|
public virtual AccessorInterface<bobbycar::protocol::ControlType>,
|
||||||
public virtual ActionInterface
|
public virtual ConfirmInterface,
|
||||||
|
public virtual ErrorHandlerInterface
|
||||||
{
|
{
|
||||||
using Base = MenuDisplay;
|
using Base = MenuDisplay;
|
||||||
|
|
||||||
@ -27,28 +26,4 @@ public:
|
|||||||
void start() override;
|
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
|
} // namespace espgui
|
||||||
|
@ -3,16 +3,31 @@
|
|||||||
// esp-idf includes
|
// esp-idf includes
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
|
|
||||||
|
// 3rdparty lib includes
|
||||||
|
#include <actions/setvalueaction.h>
|
||||||
|
#include <actions/backproxyaction.h>
|
||||||
|
#include <icons/back.h>
|
||||||
|
#include <futurecpp.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "texts.h"
|
|
||||||
|
|
||||||
namespace espgui {
|
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()
|
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_MOSFETS_OFF>>>(HandbremseMode::MOSFETS_OFF, *this, *this, *this);
|
||||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<HandbremseMode>, StaticText<TEXT_HANDBREMS_OPENMODE>>>(HandbremseMode::OPENMODE, *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);
|
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);
|
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::OPENMODE: setSelectedIndex(1); break;
|
||||||
case HandbremseMode::SPEED_0: setSelectedIndex(2); break;
|
case HandbremseMode::SPEED_0: setSelectedIndex(2); break;
|
||||||
default:
|
default:
|
||||||
ESP_LOGW("BOBBY", "Unknown HandbremseMode: %i", int(value));
|
ESP_LOGW(TAG, "Unknown HandbremseMode: %i", std::to_underlying(value));
|
||||||
setSelectedIndex(3);
|
setSelectedIndex(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace espgui
|
} // namespace espgui
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include "changevaluedisplay.h"
|
#include <changevaluedisplay.h>
|
||||||
#include "menudisplay.h"
|
#include <menudisplay.h>
|
||||||
#include "actions/setvalueaction.h"
|
#include <confirminterface.h>
|
||||||
#include "actions/backproxyaction.h"
|
#include <errorhandlerinterface.h>
|
||||||
#include "icons/back.h"
|
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "handbremse.h"
|
#include "handbremse.h"
|
||||||
|
|
||||||
namespace espgui {
|
namespace espgui {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class ChangeValueDisplay<HandbremseMode> :
|
class ChangeValueDisplay<HandbremseMode> :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public virtual AccessorInterface<HandbremseMode>,
|
public virtual AccessorInterface<HandbremseMode>,
|
||||||
public virtual ActionInterface
|
public virtual ConfirmInterface,
|
||||||
|
public virtual ErrorHandlerInterface
|
||||||
{
|
{
|
||||||
using Base = MenuDisplay;
|
using Base = MenuDisplay;
|
||||||
|
|
||||||
@ -24,4 +25,5 @@ public:
|
|||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace espgui
|
} // 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
|
#pragma once
|
||||||
|
|
||||||
#include <esp_log.h>
|
// 3rdparty lib inclues
|
||||||
|
#include <changevaluedisplay.h>
|
||||||
|
#include <menudisplay.h>
|
||||||
|
#include <confirminterface.h>
|
||||||
|
#include <errorhandlerinterface.h>
|
||||||
|
|
||||||
#include "changevaluedisplay.h"
|
// local includes
|
||||||
#include "menudisplay.h"
|
|
||||||
#include "utils.h"
|
|
||||||
#include "actions/setvalueaction.h"
|
|
||||||
#include "actions/backproxyaction.h"
|
|
||||||
#include "icons/back.h"
|
|
||||||
#include "texts.h"
|
|
||||||
#include "modes/larsmmode.h"
|
#include "modes/larsmmode.h"
|
||||||
|
|
||||||
namespace espgui {
|
namespace espgui {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class ChangeValueDisplay<LarsmModeMode> :
|
class ChangeValueDisplay<LarsmModeMode> :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public virtual AccessorInterface<LarsmModeMode>,
|
public virtual AccessorInterface<LarsmModeMode>,
|
||||||
public virtual ActionInterface
|
public virtual ConfirmInterface,
|
||||||
|
public virtual ErrorHandlerInterface
|
||||||
{
|
{
|
||||||
using Base = MenuDisplay;
|
using Base = MenuDisplay;
|
||||||
|
|
||||||
@ -26,28 +26,4 @@ public:
|
|||||||
void start() override;
|
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
|
} // namespace espgui
|
||||||
|
@ -3,18 +3,34 @@
|
|||||||
// esp-idf includes
|
// esp-idf includes
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
|
|
||||||
|
// 3rdparty lib includes
|
||||||
|
#include <actions/setvalueaction.h>
|
||||||
|
#include <actions/backproxyaction.h>
|
||||||
|
#include <icons/back.h>
|
||||||
|
#include <futurecpp.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "texts.h"
|
|
||||||
|
|
||||||
namespace espgui {
|
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()
|
ChangeValueDisplay<UnifiedModelMode>::ChangeValueDisplay()
|
||||||
{
|
{
|
||||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<UnifiedModelMode>, StaticText<TEXT_COMMUTATION>>>(UnifiedModelMode::Commutation, *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);
|
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);
|
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);
|
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);
|
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);
|
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::FocSpeed: setSelectedIndex(3); break;
|
||||||
case UnifiedModelMode::FocTorque: setSelectedIndex(4); break;
|
case UnifiedModelMode::FocTorque: setSelectedIndex(4); break;
|
||||||
default:
|
default:
|
||||||
ESP_LOGW("BOBBY", "Unknown UnifiedModelMode: %i", int(value));
|
ESP_LOGW(TAG, "Unknown UnifiedModelMode: %i", std::to_underlying(value));
|
||||||
setSelectedIndex(5);
|
setSelectedIndex(5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace espgui
|
} // namespace espgui
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include "changevaluedisplay.h"
|
#include <changevaluedisplay.h>
|
||||||
#include "menudisplay.h"
|
#include <menudisplay.h>
|
||||||
#include "actions/setvalueaction.h"
|
#include <confirminterface.h>
|
||||||
#include "actions/backproxyaction.h"
|
#include <errorhandlerinterface.h>
|
||||||
#include "icons/back.h"
|
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "unifiedmodelmode.h"
|
#include "unifiedmodelmode.h"
|
||||||
|
|
||||||
namespace espgui {
|
namespace espgui {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class ChangeValueDisplay<UnifiedModelMode> :
|
class ChangeValueDisplay<UnifiedModelMode> :
|
||||||
public MenuDisplay,
|
public MenuDisplay,
|
||||||
public virtual AccessorInterface<UnifiedModelMode>,
|
public virtual AccessorInterface<UnifiedModelMode>,
|
||||||
public virtual ActionInterface
|
public virtual ConfirmInterface,
|
||||||
|
public virtual ErrorHandlerInterface
|
||||||
{
|
{
|
||||||
using Base = MenuDisplay;
|
using Base = MenuDisplay;
|
||||||
|
|
||||||
@ -24,4 +25,5 @@ public:
|
|||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace espgui
|
} // 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
|
// local includes
|
||||||
#include "bobbybuttons.h"
|
#include "bobbybuttons.h"
|
||||||
|
#include "bobbyerrorhandler.h"
|
||||||
|
|
||||||
template<typename Tvalue>
|
template<typename Tvalue>
|
||||||
class BobbyChangeValueDisplay : public espgui::ChangeValueDisplay<Tvalue>
|
class BobbyChangeValueDisplay :
|
||||||
|
public espgui::ChangeValueDisplay<Tvalue>,
|
||||||
|
public virtual BobbyErrorHandler
|
||||||
{
|
{
|
||||||
using Base = espgui::ChangeValueDisplay<Tvalue>;
|
using Base = espgui::ChangeValueDisplay<Tvalue>;
|
||||||
|
|
||||||
@ -23,63 +26,23 @@ template<typename Tvalue>
|
|||||||
void BobbyChangeValueDisplay<Tvalue>::rawButtonPressed(uint8_t button)
|
void BobbyChangeValueDisplay<Tvalue>::rawButtonPressed(uint8_t button)
|
||||||
{
|
{
|
||||||
//Base::rawButtonPressed(button);
|
//Base::rawButtonPressed(button);
|
||||||
switch (button)
|
if (const auto translated = translateRawButton(button))
|
||||||
{
|
buttonPressed(*translated);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Tvalue>
|
template<typename Tvalue>
|
||||||
void BobbyChangeValueDisplay<Tvalue>::rawButtonReleased(uint8_t button)
|
void BobbyChangeValueDisplay<Tvalue>::rawButtonReleased(uint8_t button)
|
||||||
{
|
{
|
||||||
//Base::rawButtonReleased(button);
|
//Base::rawButtonReleased(button);
|
||||||
switch (button)
|
if (const auto translated = translateRawButton(button))
|
||||||
{
|
buttonReleased(*translated);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Tvalue>
|
template<typename Tvalue>
|
||||||
void BobbyChangeValueDisplay<Tvalue>::buttonPressed(espgui::Button button)
|
void BobbyChangeValueDisplay<Tvalue>::buttonPressed(espgui::Button button)
|
||||||
{
|
{
|
||||||
Base::buttonPressed(button);
|
Base::buttonPressed(button);
|
||||||
|
buttonPressedCommon(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:;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Tvalue>
|
template<typename Tvalue>
|
||||||
|
@ -1,63 +1,26 @@
|
|||||||
#include "bobbydisplay.h"
|
#include "bobbydisplay.h"
|
||||||
|
|
||||||
|
// local includes
|
||||||
|
#include "bobbybuttons.h"
|
||||||
|
|
||||||
void BobbyDisplay::rawButtonPressed(uint8_t button)
|
void BobbyDisplay::rawButtonPressed(uint8_t button)
|
||||||
{
|
{
|
||||||
//Base::rawButtonPressed(button);
|
//Base::rawButtonPressed(button);
|
||||||
switch (button)
|
if (const auto translated = translateRawButton(button))
|
||||||
{
|
buttonPressed(*translated);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BobbyDisplay::rawButtonReleased(uint8_t button)
|
void BobbyDisplay::rawButtonReleased(uint8_t button)
|
||||||
{
|
{
|
||||||
//Base::rawButtonReleased(button);
|
//Base::rawButtonReleased(button);
|
||||||
switch (button)
|
if (const auto translated = translateRawButton(button))
|
||||||
{
|
buttonReleased(*translated);
|
||||||
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 BobbyDisplay::buttonPressed(espgui::Button button)
|
void BobbyDisplay::buttonPressed(espgui::Button button)
|
||||||
{
|
{
|
||||||
//Base::buttonPressed(button);
|
//Base::buttonPressed(button);
|
||||||
|
buttonPressedCommon(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:;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BobbyDisplay::buttonReleased(espgui::Button button)
|
void BobbyDisplay::buttonReleased(espgui::Button button)
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include <display.h>
|
#include <display.h>
|
||||||
|
|
||||||
// local includes
|
|
||||||
#include "bobbybuttons.h"
|
|
||||||
|
|
||||||
class BobbyDisplay : public espgui::Display
|
class BobbyDisplay : public espgui::Display
|
||||||
{
|
{
|
||||||
using Base = espgui::Display;
|
using Base = espgui::Display;
|
||||||
|
@ -1,63 +1,26 @@
|
|||||||
#include "bobbydisplaywithtitle.h"
|
#include "bobbydisplaywithtitle.h"
|
||||||
|
|
||||||
|
// local includes
|
||||||
|
#include "bobbybuttons.h"
|
||||||
|
|
||||||
void BobbyDisplayWithTitle::rawButtonPressed(uint8_t button)
|
void BobbyDisplayWithTitle::rawButtonPressed(uint8_t button)
|
||||||
{
|
{
|
||||||
//Base::rawButtonPressed(button);
|
//Base::rawButtonPressed(button);
|
||||||
switch (button)
|
if (const auto translated = translateRawButton(button))
|
||||||
{
|
buttonPressed(*translated);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BobbyDisplayWithTitle::rawButtonReleased(uint8_t button)
|
void BobbyDisplayWithTitle::rawButtonReleased(uint8_t button)
|
||||||
{
|
{
|
||||||
//Base::rawButtonReleased(button);
|
//Base::rawButtonReleased(button);
|
||||||
switch (button)
|
if (const auto translated = translateRawButton(button))
|
||||||
{
|
buttonReleased(*translated);
|
||||||
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 BobbyDisplayWithTitle::buttonPressed(espgui::Button button)
|
void BobbyDisplayWithTitle::buttonPressed(espgui::Button button)
|
||||||
{
|
{
|
||||||
//Base::buttonPressed(button);
|
//Base::buttonPressed(button);
|
||||||
|
buttonPressedCommon(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:;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BobbyDisplayWithTitle::buttonReleased(espgui::Button button)
|
void BobbyDisplayWithTitle::buttonReleased(espgui::Button button)
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include <displaywithtitle.h>
|
#include <displaywithtitle.h>
|
||||||
|
|
||||||
// local includes
|
|
||||||
#include "bobbybuttons.h"
|
|
||||||
|
|
||||||
class BobbyDisplayWithTitle : public espgui::DisplayWithTitle
|
class BobbyDisplayWithTitle : public espgui::DisplayWithTitle
|
||||||
{
|
{
|
||||||
using Base = espgui::DisplayWithTitle;
|
using Base = espgui::DisplayWithTitle;
|
||||||
|
@ -23,63 +23,23 @@ template<size_t COUNT>
|
|||||||
void BobbyGraphDisplay<COUNT>::rawButtonPressed(uint8_t button)
|
void BobbyGraphDisplay<COUNT>::rawButtonPressed(uint8_t button)
|
||||||
{
|
{
|
||||||
//Base::rawButtonPressed(button);
|
//Base::rawButtonPressed(button);
|
||||||
switch (button)
|
if (const auto translated = translateRawButton(button))
|
||||||
{
|
buttonPressed(*translated);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<size_t COUNT>
|
template<size_t COUNT>
|
||||||
void BobbyGraphDisplay<COUNT>::rawButtonReleased(uint8_t button)
|
void BobbyGraphDisplay<COUNT>::rawButtonReleased(uint8_t button)
|
||||||
{
|
{
|
||||||
//Base::rawButtonReleased(button);
|
//Base::rawButtonReleased(button);
|
||||||
switch (button)
|
if (const auto translated = translateRawButton(button))
|
||||||
{
|
buttonReleased(*translated);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<size_t COUNT>
|
template<size_t COUNT>
|
||||||
void BobbyGraphDisplay<COUNT>::buttonPressed(espgui::Button button)
|
void BobbyGraphDisplay<COUNT>::buttonPressed(espgui::Button button)
|
||||||
{
|
{
|
||||||
Base::buttonPressed(button);
|
Base::buttonPressed(button);
|
||||||
|
buttonPressedCommon(button);
|
||||||
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:;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<size_t COUNT>
|
template<size_t COUNT>
|
||||||
|
@ -1,63 +1,26 @@
|
|||||||
#include "bobbymenudisplay.h"
|
#include "bobbymenudisplay.h"
|
||||||
|
|
||||||
|
// local includes
|
||||||
|
#include "bobbybuttons.h"
|
||||||
|
|
||||||
void BobbyMenuDisplay::rawButtonPressed(uint8_t button)
|
void BobbyMenuDisplay::rawButtonPressed(uint8_t button)
|
||||||
{
|
{
|
||||||
//Base::rawButtonPressed(button);
|
//Base::rawButtonPressed(button);
|
||||||
switch (button)
|
if (const auto translated = translateRawButton(button))
|
||||||
{
|
buttonPressed(*translated);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BobbyMenuDisplay::rawButtonReleased(uint8_t button)
|
void BobbyMenuDisplay::rawButtonReleased(uint8_t button)
|
||||||
{
|
{
|
||||||
//Base::rawButtonReleased(button);
|
//Base::rawButtonReleased(button);
|
||||||
switch (button)
|
if (const auto translated = translateRawButton(button))
|
||||||
{
|
buttonReleased(*translated);
|
||||||
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 BobbyMenuDisplay::buttonPressed(espgui::Button button)
|
void BobbyMenuDisplay::buttonPressed(espgui::Button button)
|
||||||
{
|
{
|
||||||
Base::buttonPressed(button);
|
Base::buttonPressed(button);
|
||||||
|
buttonPressedCommon(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:;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BobbyMenuDisplay::buttonReleased(espgui::Button button)
|
void BobbyMenuDisplay::buttonReleased(espgui::Button button)
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include <menudisplay.h>
|
#include <menudisplay.h>
|
||||||
|
|
||||||
// local includes
|
|
||||||
#include "bobbybuttons.h"
|
|
||||||
|
|
||||||
class BobbyMenuDisplay : public espgui::MenuDisplay
|
class BobbyMenuDisplay : public espgui::MenuDisplay
|
||||||
{
|
{
|
||||||
using Base = 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)
|
void BobbySplitGraphDisplay<COUNT0, COUNT1>::rawButtonPressed(uint8_t button)
|
||||||
{
|
{
|
||||||
//Base::rawButtonPressed(button);
|
//Base::rawButtonPressed(button);
|
||||||
switch (button)
|
if (const auto translated = translateRawButton(button))
|
||||||
{
|
buttonPressed(*translated);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t COUNT0, std::size_t COUNT1>
|
template<std::size_t COUNT0, std::size_t COUNT1>
|
||||||
void BobbySplitGraphDisplay<COUNT0, COUNT1>::rawButtonReleased(uint8_t button)
|
void BobbySplitGraphDisplay<COUNT0, COUNT1>::rawButtonReleased(uint8_t button)
|
||||||
{
|
{
|
||||||
//Base::rawButtonReleased(button);
|
//Base::rawButtonReleased(button);
|
||||||
switch (button)
|
if (const auto translated = translateRawButton(button))
|
||||||
{
|
buttonReleased(*translated);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t COUNT0, std::size_t COUNT1>
|
template<std::size_t COUNT0, std::size_t COUNT1>
|
||||||
void BobbySplitGraphDisplay<COUNT0, COUNT1>::buttonPressed(espgui::Button button)
|
void BobbySplitGraphDisplay<COUNT0, COUNT1>::buttonPressed(espgui::Button button)
|
||||||
{
|
{
|
||||||
Base::buttonPressed(button);
|
Base::buttonPressed(button);
|
||||||
|
buttonPressedCommon(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:;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t COUNT0, std::size_t COUNT1>
|
template<std::size_t COUNT0, std::size_t COUNT1>
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "displays/menus/mainmenu.h"
|
#include "displays/menus/mainmenu.h"
|
||||||
#include "displays/statusdisplay.h"
|
#include "displays/statusdisplay.h"
|
||||||
#include "displays/menus/boardcomputerhardwaresettingsmenu.h"
|
#include "displays/menus/boardcomputerhardwaresettingsmenu.h"
|
||||||
|
#include "newsettings.h"
|
||||||
|
|
||||||
CalibrateDisplay::CalibrateDisplay(bool bootup) :
|
CalibrateDisplay::CalibrateDisplay(bool bootup) :
|
||||||
m_bootup{bootup}
|
m_bootup{bootup}
|
||||||
@ -274,16 +275,16 @@ void CalibrateDisplay::buttonPressed(espgui::Button button)
|
|||||||
|
|
||||||
void CalibrateDisplay::copyFromSettings()
|
void CalibrateDisplay::copyFromSettings()
|
||||||
{
|
{
|
||||||
m_gasMin = settings.boardcomputerHardware.gasMin;
|
m_gasMin = configs.gasMin.value;
|
||||||
m_gasMax = settings.boardcomputerHardware.gasMax;
|
m_gasMax = configs.gasMax.value;
|
||||||
m_bremsMin = settings.boardcomputerHardware.bremsMin;
|
m_bremsMin = configs.bremsMin.value;
|
||||||
m_bremsMax = settings.boardcomputerHardware.bremsMax;
|
m_bremsMax = configs.bremsMax.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrateDisplay::copyToSettings()
|
void CalibrateDisplay::copyToSettings()
|
||||||
{
|
{
|
||||||
settings.boardcomputerHardware.gasMin = m_gasMin;
|
configs.write_config(configs.gasMin, m_gasMin);
|
||||||
settings.boardcomputerHardware.gasMax = m_gasMax;
|
configs.write_config(configs.gasMax, m_gasMax);
|
||||||
settings.boardcomputerHardware.bremsMin = m_bremsMin;
|
configs.write_config(configs.bremsMin, m_bremsMin);
|
||||||
settings.boardcomputerHardware.bremsMax = m_bremsMax;
|
configs.write_config(configs.bremsMax, m_bremsMax);
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include <changevaluedisplay.h>
|
#include <changevaluedisplay.h>
|
||||||
|
#include <textwithvaluehelper.h>
|
||||||
|
#include <fmt/core.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "displays/bobbychangevaluedisplay.h"
|
#include "displays/bobbychangevaluedisplay.h"
|
||||||
#include "mainmenu.h"
|
#include "mainmenu.h"
|
||||||
#include "displays/calibratevoltagedisplay.h"
|
#include "displays/calibratevoltagedisplay.h"
|
||||||
#include "accessors/settingsaccessors.h"
|
#include "accessors/settingsaccessors.h"
|
||||||
#include "fmt/core.h"
|
|
||||||
#include "battery.h"
|
#include "battery.h"
|
||||||
|
|
||||||
class CurrentBatteryStatusText : public virtual espgui::TextInterface { public: std::string text() const override { return getBatteryPercentageString(); } };
|
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>,
|
BobbyChangeValueDisplay<uint8_t>,
|
||||||
espgui::StaticText<TEXT_CELL_SERIES>,
|
espgui::StaticText<TEXT_CELL_SERIES>,
|
||||||
BatterySeriesCellsAccessor,
|
BatterySeriesCellsAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
|
||||||
espgui::SwitchScreenAction<BatteryMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using BatteryCellParallelChangeScreen = espgui::makeComponent<
|
using BatteryCellParallelChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<uint8_t>,
|
BobbyChangeValueDisplay<uint8_t>,
|
||||||
espgui::StaticText<TEXT_CELL_PARALLEL>,
|
espgui::StaticText<TEXT_CELL_PARALLEL>,
|
||||||
BatteryParallelCellsAccessor,
|
BatteryParallelCellsAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
|
||||||
espgui::SwitchScreenAction<BatteryMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using BatteryWHperKMChangeScreen = espgui::makeComponent<
|
using BatteryWHperKMChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<uint16_t>,
|
BobbyChangeValueDisplay<uint16_t>,
|
||||||
espgui::StaticText<TEXT_BATTERY_WHKM>,
|
espgui::StaticText<TEXT_BATTERY_WHKM>,
|
||||||
BatteryWHperKMAccessor,
|
BatteryWHperKMAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BatteryMenu>>,
|
||||||
espgui::SwitchScreenAction<BatteryMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BatteryMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using namespace espgui;
|
using namespace espgui;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <actions/toggleboolaction.h>
|
#include <actions/toggleboolaction.h>
|
||||||
#include <icons/back.h>
|
#include <icons/back.h>
|
||||||
#include <checkboxicon.h>
|
#include <checkboxicon.h>
|
||||||
|
#include <textwithvaluehelper.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "displays/bobbychangevaluedisplay.h"
|
#include "displays/bobbychangevaluedisplay.h"
|
||||||
@ -47,36 +48,36 @@ using SampleCountChangeScreen = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_SAMPLECOUNT>,
|
espgui::StaticText<TEXT_SAMPLECOUNT>,
|
||||||
SampleCountAccessor,
|
SampleCountAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using GasMinChangeScreen = espgui::makeComponent<
|
using GasMinChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_GASMIN>,
|
espgui::StaticText<TEXT_GASMIN>,
|
||||||
GasMinAccessor,
|
GasMinAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using GasMaxChangeScreen = espgui::makeComponent<
|
using GasMaxChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_GASMAX>,
|
espgui::StaticText<TEXT_GASMAX>,
|
||||||
GasMaxAccessor,
|
GasMaxAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using BremsMinChangeScreen = espgui::makeComponent<
|
using BremsMinChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_BREMSMIN>,
|
espgui::StaticText<TEXT_BREMSMIN>,
|
||||||
BremsMinAccessor,
|
BremsMinAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using BremsMaxChangeScreen = espgui::makeComponent<
|
using BremsMaxChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_BREMSMAX>,
|
espgui::StaticText<TEXT_BREMSMAX>,
|
||||||
BremsMaxAccessor,
|
BremsMaxAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
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)
|
#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>,
|
BobbyChangeValueDisplay<uint8_t>,
|
||||||
espgui::StaticText<TEXT_DPADDEBOUNCE>,
|
espgui::StaticText<TEXT_DPADDEBOUNCE>,
|
||||||
DPadDebounceAccessor,
|
DPadDebounceAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -107,43 +108,43 @@ using GametrakXMinChangeScreen = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_SETGAMETRAKXMIN>,
|
espgui::StaticText<TEXT_SETGAMETRAKXMIN>,
|
||||||
GametrakXMinAccessor,
|
GametrakXMinAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using GametrakXMaxChangeScreen = espgui::makeComponent<
|
using GametrakXMaxChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_SETGAMETRAKXMAX>,
|
espgui::StaticText<TEXT_SETGAMETRAKXMAX>,
|
||||||
GametrakXMaxAccessor,
|
GametrakXMaxAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using GametrakYMinChangeScreen = espgui::makeComponent<
|
using GametrakYMinChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_SETGAMETRAKYMIN>,
|
espgui::StaticText<TEXT_SETGAMETRAKYMIN>,
|
||||||
GametrakYMinAccessor,
|
GametrakYMinAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using GametrakYMaxChangeScreen = espgui::makeComponent<
|
using GametrakYMaxChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_SETGAMETRAKYMAX>,
|
espgui::StaticText<TEXT_SETGAMETRAKYMAX>,
|
||||||
GametrakYMaxAccessor,
|
GametrakYMaxAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using GametrakDistMinChangeScreen = espgui::makeComponent<
|
using GametrakDistMinChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_SETGAMETRAKDISTMIN>,
|
espgui::StaticText<TEXT_SETGAMETRAKDISTMIN>,
|
||||||
GametrakDistMinAccessor,
|
GametrakDistMinAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using GametrakDistMaxChangeScreen = espgui::makeComponent<
|
using GametrakDistMaxChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_SETGAMETRAKDISTMAX>,
|
espgui::StaticText<TEXT_SETGAMETRAKDISTMAX>,
|
||||||
GametrakDistMaxAccessor,
|
GametrakDistMaxAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BoardcomputerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
#endif
|
#endif
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -21,8 +21,8 @@ using FrontFreqChangeScreen = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<uint8_t>,
|
BobbyChangeValueDisplay<uint8_t>,
|
||||||
espgui::StaticText<TEXT_FRONTFREQ>,
|
espgui::StaticText<TEXT_FRONTFREQ>,
|
||||||
FrontFreqAccessor,
|
FrontFreqAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||||
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; } };
|
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>,
|
BobbyChangeValueDisplay<uint8_t>,
|
||||||
espgui::StaticText<TEXT_FRONTPATTERN>,
|
espgui::StaticText<TEXT_FRONTPATTERN>,
|
||||||
FrontPatternAccessor,
|
FrontPatternAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||||
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; } };
|
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>,
|
BobbyChangeValueDisplay<uint8_t>,
|
||||||
espgui::StaticText<TEXT_BACKFREQ>,
|
espgui::StaticText<TEXT_BACKFREQ>,
|
||||||
BackFreqAccessor,
|
BackFreqAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||||
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; } };
|
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>,
|
BobbyChangeValueDisplay<uint8_t>,
|
||||||
espgui::StaticText<TEXT_BACKPATTERN>,
|
espgui::StaticText<TEXT_BACKPATTERN>,
|
||||||
BackPatternAccessor,
|
BackPatternAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||||
espgui::SwitchScreenAction<BuzzerMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using ReverseBeepFreq0ChangeScreen = espgui::makeComponent<
|
using ReverseBeepFreq0ChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<uint8_t>,
|
BobbyChangeValueDisplay<uint8_t>,
|
||||||
espgui::StaticText<TEXT_REVERSEBEEPFREQ0>,
|
espgui::StaticText<TEXT_REVERSEBEEPFREQ0>,
|
||||||
ReverseBeepFreq0Accessor,
|
ReverseBeepFreq0Accessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||||
espgui::SwitchScreenAction<BuzzerMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
|
||||||
>;
|
>;
|
||||||
using ReverseBeepFreq1ChangeScreen = espgui::makeComponent<
|
using ReverseBeepFreq1ChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<uint8_t>,
|
BobbyChangeValueDisplay<uint8_t>,
|
||||||
espgui::StaticText<TEXT_REVERSEBEEPFREQ1>,
|
espgui::StaticText<TEXT_REVERSEBEEPFREQ1>,
|
||||||
ReverseBeepFreq1Accessor,
|
ReverseBeepFreq1Accessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||||
espgui::SwitchScreenAction<BuzzerMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
|
||||||
>;
|
>;
|
||||||
using ReverseBeepDuration0ChangeScreen = espgui::makeComponent<
|
using ReverseBeepDuration0ChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_REVERSEBEEPDURATION0>,
|
espgui::StaticText<TEXT_REVERSEBEEPDURATION0>,
|
||||||
ReverseBeepDuration0Accessor,
|
ReverseBeepDuration0Accessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||||
espgui::SwitchScreenAction<BuzzerMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
|
||||||
>;
|
>;
|
||||||
using ReverseBeepDuration1ChangeScreen = espgui::makeComponent<
|
using ReverseBeepDuration1ChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_REVERSEBEEPDURATION1>,
|
espgui::StaticText<TEXT_REVERSEBEEPDURATION1>,
|
||||||
ReverseBeepDuration1Accessor,
|
ReverseBeepDuration1Accessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>,
|
||||||
espgui::SwitchScreenAction<BuzzerMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<BuzzerMenu>>
|
||||||
>;
|
>;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ using CloudTransmitTimeoutChangeScreen = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_CLOUDTRANSMITTIMEOUT>,
|
espgui::StaticText<TEXT_CLOUDTRANSMITTIMEOUT>,
|
||||||
CloudTransmitTimeoutAccessor,
|
CloudTransmitTimeoutAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<CloudSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
struct CloudBufferLengthText : public virtual espgui::TextInterface
|
struct CloudBufferLengthText : public virtual espgui::TextInterface
|
||||||
@ -41,16 +41,16 @@ using CloudCollectRateChangeDisplay = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_CLOUDCOLLECTRATE>,
|
espgui::StaticText<TEXT_CLOUDCOLLECTRATE>,
|
||||||
CloudCollectRateAccessor,
|
CloudCollectRateAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<CloudSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using CloudSendRateChangeDisplay = espgui::makeComponent<
|
using CloudSendRateChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_CLOUDSENDRATE>,
|
espgui::StaticText<TEXT_CLOUDSENDRATE>,
|
||||||
CloudSendRateAccessor,
|
CloudSendRateAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<CloudSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<CloudSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "displays/bobbymenudisplay.h"
|
#include "displays/bobbymenudisplay.h"
|
||||||
|
#include "debugmenu.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "menuitem.h"
|
#include "menuitem.h"
|
||||||
#include "actions/dummyaction.h"
|
#include "actions/dummyaction.h"
|
||||||
@ -30,7 +31,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class FrontCommandDebugMenu : public CommandDebugMenu<TEXT_FRONTCOMMAND, FrontTexts> {};
|
using FrontCommandDebugMenu = CommandDebugMenu<TEXT_FRONTCOMMAND, FrontTexts>;
|
||||||
class BackCommandDebugMenu : public CommandDebugMenu<TEXT_BACKCOMMAND, BackTexts> {};
|
using BackCommandDebugMenu = CommandDebugMenu<TEXT_BACKCOMMAND, BackTexts>;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -24,38 +24,38 @@ using WheelDiameterMmChangeScreen = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_WHEELDIAMETERMM>,
|
espgui::StaticText<TEXT_WHEELDIAMETERMM>,
|
||||||
WheelDiameterMmAccessor,
|
WheelDiameterMmAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using WheelDiameterInchChangeScreen = espgui::makeComponent<
|
using WheelDiameterInchChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<float>,
|
BobbyChangeValueDisplay<float>,
|
||||||
espgui::StaticText<TEXT_WHEELDIAMETERINCH>,
|
espgui::StaticText<TEXT_WHEELDIAMETERINCH>,
|
||||||
WheelDiameterInchAccessor,
|
WheelDiameterInchAccessor,
|
||||||
espgui::RatioNumberStep<float, std::ratio<1,10>>,
|
espgui::RatioNumberStep<float, std::ratio<1,10>>,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using NumMagnetPolesChangeScreen = espgui::makeComponent<
|
using NumMagnetPolesChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_NUMMAGNETPOLES>,
|
espgui::StaticText<TEXT_NUMMAGNETPOLES>,
|
||||||
NumMagnetPolesAccessor,
|
NumMagnetPolesAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
#ifdef FEATURE_CAN
|
#ifdef FEATURE_CAN
|
||||||
using CanTransmitTimeoutChangeScreen = espgui::makeComponent<
|
using CanTransmitTimeoutChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_CANTRANSMITTIMEOUT>,
|
espgui::StaticText<TEXT_CANTRANSMITTIMEOUT>,
|
||||||
CanTransmitTimeoutAccessor,
|
CanTransmitTimeoutAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using CanReceiveTimeoutChangeScreen = espgui::makeComponent<
|
using CanReceiveTimeoutChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_CANRECEIVETIMEOUT>,
|
espgui::StaticText<TEXT_CANRECEIVETIMEOUT>,
|
||||||
CanReceiveTimeoutAccessor,
|
CanReceiveTimeoutAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<ControllerHardwareSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
#endif
|
#endif
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "displays/menus/dynamicdebugmenu.h"
|
#include "displays/menus/dynamicdebugmenu.h"
|
||||||
#include "displays/menus/mainmenu.h"
|
#include "displays/menus/mainmenu.h"
|
||||||
#include "displays/menus/batterydebugmenu.h"
|
#include "displays/menus/batterydebugmenu.h"
|
||||||
#include "displays/popups/alertdisplay.cpp"
|
#include "bobbyerrorhandler.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class AlertAction : public espgui::MenuItem
|
class AlertAction : public espgui::MenuItem
|
||||||
@ -37,9 +37,7 @@ public:
|
|||||||
std::string text() const override { return "Open popup"; }
|
std::string text() const override { return "Open popup"; }
|
||||||
void triggered() override
|
void triggered() override
|
||||||
{
|
{
|
||||||
auto newDisplay = std::make_unique<AlertDisplay>("Das\nist\nein sehr langer text, der nicht in eine zeile passt", std::move(currentDisplay));
|
BobbyErrorHandler{}.errorOccured("Das\nist\nein sehr langer text, der nicht in eine zeile passt");
|
||||||
newDisplay->initOverlay();
|
|
||||||
currentDisplay = std::move(newDisplay);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
#include "defaultmodesettingsmenu.h"
|
#include "defaultmodesettingsmenu.h"
|
||||||
|
|
||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include "changevaluedisplay.h"
|
#include <changevaluedisplay.h>
|
||||||
#include "menuitem.h"
|
#include <menuitem.h>
|
||||||
#include "actions/toggleboolaction.h"
|
#include <actions/toggleboolaction.h>
|
||||||
#include "actions/switchscreenaction.h"
|
#include <actions/switchscreenaction.h>
|
||||||
#include "actions/dummyaction.h"
|
#include <actions/dummyaction.h>
|
||||||
#include "checkboxicon.h"
|
#include <checkboxicon.h>
|
||||||
#include "icons/back.h"
|
#include <icons/back.h>
|
||||||
|
#include <textwithvaluehelper.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "displays/bobbychangevaluedisplay.h"
|
#include "displays/bobbychangevaluedisplay.h"
|
||||||
@ -22,92 +23,92 @@ using DefaultModeModelModeChangeDisplay = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<UnifiedModelMode>,
|
BobbyChangeValueDisplay<UnifiedModelMode>,
|
||||||
espgui::StaticText<TEXT_MODELMODE>,
|
espgui::StaticText<TEXT_MODELMODE>,
|
||||||
DefaultModeModelModeAccessor,
|
DefaultModeModelModeAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using DefaultModeHybridModelModeChangeDisplay = espgui::makeComponent<
|
using DefaultModeHybridModelModeChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<UnifiedModelMode>,
|
BobbyChangeValueDisplay<UnifiedModelMode>,
|
||||||
espgui::StaticText<TEXT_HYBRIDMODE>,
|
espgui::StaticText<TEXT_HYBRIDMODE>,
|
||||||
DefaultModeHybridModelModeAccessor,
|
DefaultModeHybridModelModeAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using DefaultModeSmoothingChangeDisplay = espgui::makeComponent<
|
using DefaultModeSmoothingChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_SMOOTHINGVAL>,
|
espgui::StaticText<TEXT_SMOOTHINGVAL>,
|
||||||
DefaultModeSmoothingAccessor,
|
DefaultModeSmoothingAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using DefaultModeFwSmoothingLowerLimitChangeDisplay = espgui::makeComponent<
|
using DefaultModeFwSmoothingLowerLimitChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_FWSMOOTHING_LIMIT>,
|
espgui::StaticText<TEXT_FWSMOOTHING_LIMIT>,
|
||||||
DefaultModeEnableFieldWeakSmoothingLowerLimitAccessor,
|
DefaultModeEnableFieldWeakSmoothingLowerLimitAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using DefaultModeFrontPercentageChangeDisplay = espgui::makeComponent<
|
using DefaultModeFrontPercentageChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_FRONTPERCENTAGE>,
|
espgui::StaticText<TEXT_FRONTPERCENTAGE>,
|
||||||
DefaultModeFrontPercentageAccessor,
|
DefaultModeFrontPercentageAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using DefaultModeBackPercentageChangeDisplay = espgui::makeComponent<
|
using DefaultModeBackPercentageChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_BACKPERCENTAGE>,
|
espgui::StaticText<TEXT_BACKPERCENTAGE>,
|
||||||
DefaultModeBackPercentageAccessor,
|
DefaultModeBackPercentageAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using DefaultModeAddSchwelleChangeDisplay = espgui::makeComponent<
|
using DefaultModeAddSchwelleChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_ADDSCHWELLE>,
|
espgui::StaticText<TEXT_ADDSCHWELLE>,
|
||||||
DefaultModeAddSchwelleAccessor,
|
DefaultModeAddSchwelleAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using DefaultModeGas1WertChangeDisplay = espgui::makeComponent<
|
using DefaultModeGas1WertChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_ADDGASVAL>,
|
espgui::StaticText<TEXT_ADDGASVAL>,
|
||||||
DefaultModeGas1WertAccessor,
|
DefaultModeGas1WertAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using DefaultModeGas2WertChangeDisplay = espgui::makeComponent<
|
using DefaultModeGas2WertChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_SUBGASVAL>,
|
espgui::StaticText<TEXT_SUBGASVAL>,
|
||||||
DefaultModeGas2WertAccessor,
|
DefaultModeGas2WertAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using DefaultModeBrems1WertChangeDisplay = espgui::makeComponent<
|
using DefaultModeBrems1WertChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_ADDBRAKEVAL>,
|
espgui::StaticText<TEXT_ADDBRAKEVAL>,
|
||||||
DefaultModeBrems1WertAccessor,
|
DefaultModeBrems1WertAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using DefaultModeBrems2WertChangeDisplay = espgui::makeComponent<
|
using DefaultModeBrems2WertChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_SUBBRAKEVAL>,
|
espgui::StaticText<TEXT_SUBBRAKEVAL>,
|
||||||
DefaultModeBrems2WertAccessor,
|
DefaultModeBrems2WertAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using DefaultModeHybridActivationLimitChangeDisplay = espgui::makeComponent<
|
using DefaultModeHybridActivationLimitChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_HYBRIDACTIVATIONLIMIT>,
|
espgui::StaticText<TEXT_HYBRIDACTIVATIONLIMIT>,
|
||||||
DefaultModeHybridActivationLimitAccessor,
|
DefaultModeHybridActivationLimitAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using DefaultModeHybridDeactivationLimitChangeDisplay = espgui::makeComponent<
|
using DefaultModeHybridDeactivationLimitChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_HYBRIDDEACTIVATIONLIMIT>,
|
espgui::StaticText<TEXT_HYBRIDDEACTIVATIONLIMIT>,
|
||||||
DefaultModeHybridDeactivationLimitAccessor,
|
DefaultModeHybridDeactivationLimitAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<DefaultModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<DefaultModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "displays/bobbymenudisplay.h"
|
#include "displays/bobbymenudisplay.h"
|
||||||
|
#include "debugmenu.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "menuitem.h"
|
#include "menuitem.h"
|
||||||
#include "actions/dummyaction.h"
|
#include "actions/dummyaction.h"
|
||||||
@ -33,7 +34,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class FrontFeedbackDebugMenu : public FeedbackDebugMenu<TEXT_FRONTFEEDBACK, FrontTexts, FrontFeedbackColor> {};
|
using FrontFeedbackDebugMenu = FeedbackDebugMenu<TEXT_FRONTFEEDBACK, FrontTexts, FrontFeedbackColor>;
|
||||||
class BackFeedbackDebugMenu : public FeedbackDebugMenu<TEXT_BACKFEEDBACK, BackTexts, FrontFeedbackColor> {};
|
using BackFeedbackDebugMenu = FeedbackDebugMenu<TEXT_BACKFEEDBACK, BackTexts, FrontFeedbackColor>;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
#include <esp_err.h>
|
#include <esp_err.h>
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
|
|
||||||
|
// 3rdparty lib includes
|
||||||
|
#include <fmt/core.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "actions/switchscreenaction.h"
|
#include "actions/switchscreenaction.h"
|
||||||
#include "actions/qraction.h"
|
#include "actions/qraction.h"
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
// 3rd party libs
|
// 3rd party libs
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
#include "actions/switchscreenaction.h"
|
#include <actions/switchscreenaction.h>
|
||||||
#include "actions/toggleboolaction.h"
|
#include <actions/toggleboolaction.h>
|
||||||
#include "changevaluedisplay.h"
|
#include <changevaluedisplay.h>
|
||||||
#include "checkboxicon.h"
|
#include <checkboxicon.h>
|
||||||
#include "icons/back.h"
|
#include <icons/back.h>
|
||||||
|
#include <textwithvaluehelper.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "displays/bobbychangevaluedisplay.h"
|
#include "displays/bobbychangevaluedisplay.h"
|
||||||
@ -20,15 +21,15 @@ using HandBremsTriggerTimeoutChangeValueDisplay = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<uint16_t>,
|
BobbyChangeValueDisplay<uint16_t>,
|
||||||
espgui::StaticText<TEXT_HANDBREMSE_TRIGGERTIMEOUT>,
|
espgui::StaticText<TEXT_HANDBREMSE_TRIGGERTIMEOUT>,
|
||||||
HandbremsTimeoutAccessor,
|
HandbremsTimeoutAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<HandbremsSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using HandBremsModeChangeValueDisplay = espgui::makeComponent<
|
using HandBremsModeChangeValueDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<HandbremseMode>,
|
BobbyChangeValueDisplay<HandbremseMode>,
|
||||||
espgui::StaticText<TEXT_HANDBREMSE_MODE>,
|
espgui::StaticText<TEXT_HANDBREMSE_MODE>,
|
||||||
HandbremsModeAccessor,
|
HandbremsModeAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<HandbremsSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<HandbremsSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
class HandBremsModeText : public virtual espgui::TextInterface
|
class HandBremsModeText : public virtual espgui::TextInterface
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
class HandbremsSettingsMenu :
|
class HandbremsSettingsMenu :
|
||||||
public BobbyMenuDisplay,
|
public BobbyMenuDisplay,
|
||||||
public espgui::StaticText<TEXT_DEBUG>
|
public espgui::StaticText<TEXT_HANDBREMSE>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HandbremsSettingsMenu();
|
HandbremsSettingsMenu();
|
||||||
|
@ -19,22 +19,22 @@ using LarsmModeModelModeChangeDisplay = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<UnifiedModelMode>,
|
BobbyChangeValueDisplay<UnifiedModelMode>,
|
||||||
espgui::StaticText<TEXT_MODELMODE>,
|
espgui::StaticText<TEXT_MODELMODE>,
|
||||||
LarsmModeModelModeAccessor,
|
LarsmModeModelModeAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<LarsmModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using LarsmModeModeChangeDisplay = espgui::makeComponent<
|
using LarsmModeModeChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<LarsmModeMode>,
|
BobbyChangeValueDisplay<LarsmModeMode>,
|
||||||
espgui::StaticText<TEXT_SETMODE>,
|
espgui::StaticText<TEXT_SETMODE>,
|
||||||
LarsmModeModeAccessor,
|
LarsmModeModeAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<LarsmModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using LarsmModeIterationsChangeDisplay = espgui::makeComponent<
|
using LarsmModeIterationsChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<uint8_t>,
|
BobbyChangeValueDisplay<uint8_t>,
|
||||||
espgui::StaticText<TEXT_SETITERATIONS>,
|
espgui::StaticText<TEXT_SETITERATIONS>,
|
||||||
LarsmModeIterationsAccessor,
|
LarsmModeIterationsAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<LarsmModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LarsmModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <checkboxicon.h>
|
#include <checkboxicon.h>
|
||||||
#include <icons/back.h>
|
#include <icons/back.h>
|
||||||
#include <menuitem.h>
|
#include <menuitem.h>
|
||||||
|
#include <textwithvaluehelper.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "displays/bobbychangevaluedisplay.h"
|
#include "displays/bobbychangevaluedisplay.h"
|
||||||
@ -29,72 +30,72 @@ using LedsCountChangeScreen = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_LEDSCOUNT>,
|
espgui::StaticText<TEXT_LEDSCOUNT>,
|
||||||
LedsCountAccessor,
|
LedsCountAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||||
espgui::SwitchScreenAction<LedstripMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using CenterOffsetChangeScreen = espgui::makeComponent<
|
using CenterOffsetChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_CENTEROFFSET>,
|
espgui::StaticText<TEXT_CENTEROFFSET>,
|
||||||
CenterOffsetAccessor,
|
CenterOffsetAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||||
espgui::SwitchScreenAction<LedstripMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using SmallOffsetChangeScreen = espgui::makeComponent<
|
using SmallOffsetChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_SMALLOFFSET>,
|
espgui::StaticText<TEXT_SMALLOFFSET>,
|
||||||
SmallOffsetAccessor,
|
SmallOffsetAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||||
espgui::SwitchScreenAction<LedstripMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using BigOffsetChangeScreen = espgui::makeComponent<
|
using BigOffsetChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_BIGOFFSET>,
|
espgui::StaticText<TEXT_BIGOFFSET>,
|
||||||
BigOffsetAccessor,
|
BigOffsetAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||||
espgui::SwitchScreenAction<LedstripMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using DeziampereChangeScreen = espgui::makeComponent<
|
using DeziampereChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_LEDSTRIP_MILLIAMP>,
|
espgui::StaticText<TEXT_LEDSTRIP_MILLIAMP>,
|
||||||
DeziampereAccessor,
|
DeziampereAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||||
espgui::SwitchScreenAction<LedstripMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using StVOOffsetChangeScreen = espgui::makeComponent<
|
using StVOOffsetChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_STVO_FRONTOFFSET>,
|
espgui::StaticText<TEXT_STVO_FRONTOFFSET>,
|
||||||
LedsStVOFrontOffsetAccessor,
|
LedsStVOFrontOffsetAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||||
espgui::SwitchScreenAction<LedstripMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using StVOLengthChangeScreen = espgui::makeComponent<
|
using StVOLengthChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_STVO_FRONTLENGTH>,
|
espgui::StaticText<TEXT_STVO_FRONTLENGTH>,
|
||||||
LedsStVOFrontLengthAccessor,
|
LedsStVOFrontLengthAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||||
espgui::SwitchScreenAction<LedstripMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using animationMultiplierChangeScreen = espgui::makeComponent<
|
using animationMultiplierChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_ANIMATION_MULTIPLIER>,
|
espgui::StaticText<TEXT_ANIMATION_MULTIPLIER>,
|
||||||
AnimationMultiplierAccessor,
|
AnimationMultiplierAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||||
espgui::SwitchScreenAction<LedstripMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using ledstripBrightnessChangeScreen = espgui::makeComponent<
|
using ledstripBrightnessChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<uint8_t>,
|
BobbyChangeValueDisplay<uint8_t>,
|
||||||
espgui::StaticText<TEXT_LEDSTRIP_BRIGHTNESS>,
|
espgui::StaticText<TEXT_LEDSTRIP_BRIGHTNESS>,
|
||||||
LedstripBrightnessAccessor,
|
LedstripBrightnessAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LedstripMenu>>,
|
||||||
espgui::SwitchScreenAction<LedstripMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LedstripMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
class AllCustomLedsOffAction : public virtual espgui::ActionInterface
|
class AllCustomLedsOffAction : public virtual espgui::ActionInterface
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
#include "limitssettingsmenu.h"
|
#include "limitssettingsmenu.h"
|
||||||
|
|
||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include "changevaluedisplay.h"
|
#include <changevaluedisplay.h>
|
||||||
#include "menuitem.h"
|
#include <menuitem.h>
|
||||||
#include "actions/switchscreenaction.h"
|
#include <actions/switchscreenaction.h>
|
||||||
#include "icons/back.h"
|
#include <icons/back.h>
|
||||||
|
#include <textwithvaluehelper.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "displays/bobbychangevaluedisplay.h"
|
#include "displays/bobbychangevaluedisplay.h"
|
||||||
@ -17,43 +18,43 @@ using IMotMaxChangeScreen = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_IMOTMAX>,
|
espgui::StaticText<TEXT_IMOTMAX>,
|
||||||
IMotMaxAccessor,
|
IMotMaxAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<LimitsSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using IDcMaxChangeScreen = espgui::makeComponent<
|
using IDcMaxChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_IDCMAX>,
|
espgui::StaticText<TEXT_IDCMAX>,
|
||||||
IDcMaxAccessor,
|
IDcMaxAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<LimitsSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using NMotMaxKmhChangeScreen = espgui::makeComponent<
|
using NMotMaxKmhChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_NMOTMAXKMH>,
|
espgui::StaticText<TEXT_NMOTMAXKMH>,
|
||||||
NMotMaxKmhAccessor,
|
NMotMaxKmhAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<LimitsSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using NMotMaxRpmChangeScreen = espgui::makeComponent<
|
using NMotMaxRpmChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_NMOTMAX>,
|
espgui::StaticText<TEXT_NMOTMAX>,
|
||||||
NMotMaxRpmAccessor,
|
NMotMaxRpmAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<LimitsSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using FieldWeakMaxChangeScreen = espgui::makeComponent<
|
using FieldWeakMaxChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_FIELDWEAKMAX>,
|
espgui::StaticText<TEXT_FIELDWEAKMAX>,
|
||||||
FieldWeakMaxAccessor,
|
FieldWeakMaxAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<LimitsSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
using PhaseAdvMaxChangeScreen = espgui::makeComponent<
|
using PhaseAdvMaxChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_PHASEADVMAX>,
|
espgui::StaticText<TEXT_PHASEADVMAX>,
|
||||||
PhaseAdvMaxAccessor,
|
PhaseAdvMaxAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<LimitsSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LimitsSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
#include "lockscreensettingsmenu.h"
|
#include "lockscreensettingsmenu.h"
|
||||||
|
|
||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include "menuitem.h"
|
#include <menuitem.h>
|
||||||
#include "actions/toggleboolaction.h"
|
#include <actions/toggleboolaction.h>
|
||||||
#include "actions/switchscreenaction.h"
|
#include <actions/switchscreenaction.h>
|
||||||
#include "icons/back.h"
|
#include <icons/back.h>
|
||||||
#include "checkboxicon.h"
|
#include <checkboxicon.h>
|
||||||
#include "changevaluedisplay.h"
|
#include <changevaluedisplay.h>
|
||||||
|
#include <textwithvaluehelper.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "displays/bobbychangevaluedisplay.h"
|
#include "displays/bobbychangevaluedisplay.h"
|
||||||
@ -19,32 +20,32 @@ using LockscreenPinDigit0ChangeScreen = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<int8_t>,
|
BobbyChangeValueDisplay<int8_t>,
|
||||||
espgui::StaticText<TEXT_PINDIGIT0>,
|
espgui::StaticText<TEXT_PINDIGIT0>,
|
||||||
LockscreenPinDigitAccessor<0>,
|
LockscreenPinDigitAccessor<0>,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<LockscreenSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using LockscreenPinDigit1ChangeScreen = espgui::makeComponent<
|
using LockscreenPinDigit1ChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int8_t>,
|
BobbyChangeValueDisplay<int8_t>,
|
||||||
espgui::StaticText<TEXT_PINDIGIT1>,
|
espgui::StaticText<TEXT_PINDIGIT1>,
|
||||||
LockscreenPinDigitAccessor<1>,
|
LockscreenPinDigitAccessor<1>,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<LockscreenSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using LockscreenPinDigit2ChangeScreen = espgui::makeComponent<
|
using LockscreenPinDigit2ChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int8_t>,
|
BobbyChangeValueDisplay<int8_t>,
|
||||||
espgui::StaticText<TEXT_PINDIGIT2>,
|
espgui::StaticText<TEXT_PINDIGIT2>,
|
||||||
LockscreenPinDigitAccessor<2>,
|
LockscreenPinDigitAccessor<2>,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<LockscreenSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using LockscreenPinDigit3ChangeScreen = espgui::makeComponent<
|
using LockscreenPinDigit3ChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int8_t>,
|
BobbyChangeValueDisplay<int8_t>,
|
||||||
espgui::StaticText<TEXT_PINDIGIT3>,
|
espgui::StaticText<TEXT_PINDIGIT3>,
|
||||||
LockscreenPinDigitAccessor<3>,
|
LockscreenPinDigitAccessor<3>,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<LockscreenSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<LockscreenSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ class GPIOAccessor : public virtual espgui::AccessorInterface<bool>
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool getValue() const override { return digitalRead(PIN); }
|
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>;
|
using Mosfet0Accessor = GPIOAccessor<PINS_MOSFET0>;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "displays/bobbymenudisplay.h"
|
#include "displays/bobbymenudisplay.h"
|
||||||
|
#include "debugmenu.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "menuitem.h"
|
#include "menuitem.h"
|
||||||
#include "actions/dummyaction.h"
|
#include "actions/dummyaction.h"
|
||||||
@ -40,7 +41,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class FrontLeftMotorFeedbackDebugMenu : public MotorFeedbackDebugMenu<TEXT_FRONTLEFTFEEDBACK, FrontTexts::LeftFeedback, FrontFeedbackColor> {};
|
using FrontLeftMotorFeedbackDebugMenu = MotorFeedbackDebugMenu<TEXT_FRONTLEFTFEEDBACK, FrontTexts::LeftFeedback, FrontFeedbackColor>;
|
||||||
class FrontRightMotorFeedbackDebugMenu : public MotorFeedbackDebugMenu<TEXT_FRONTRIGHTFEEDBACK, FrontTexts::RightFeedback, FrontFeedbackColor> {};
|
using FrontRightMotorFeedbackDebugMenu = MotorFeedbackDebugMenu<TEXT_FRONTRIGHTFEEDBACK, FrontTexts::RightFeedback, FrontFeedbackColor>;
|
||||||
class BackLeftMotorFeedbackDebugMenu : public MotorFeedbackDebugMenu<TEXT_BACKLEFTFEEDBACK, BackTexts::LeftFeedback, BackFeedbackColor> {};
|
using BackLeftMotorFeedbackDebugMenu = MotorFeedbackDebugMenu<TEXT_BACKLEFTFEEDBACK, BackTexts::LeftFeedback, BackFeedbackColor>;
|
||||||
class BackRightMotorFeedbackDebugMenu : public MotorFeedbackDebugMenu<TEXT_BACKRIGHTFEEDBACK, BackTexts::RightFeedback, BackFeedbackColor> {};
|
using BackRightMotorFeedbackDebugMenu = MotorFeedbackDebugMenu<TEXT_BACKRIGHTFEEDBACK, BackTexts::RightFeedback, BackFeedbackColor>;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "displays/bobbymenudisplay.h"
|
#include "displays/bobbymenudisplay.h"
|
||||||
|
#include "debugmenu.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
#include "debugtexthelpers.h"
|
#include "debugtexthelpers.h"
|
||||||
@ -37,7 +38,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class FrontLeftMotorStateDebugMenu : public MotorStateDebugMenu<TEXT_FRONTLEFTCOMMAND, FrontTexts::LeftCommand> {};
|
using FrontLeftMotorStateDebugMenu = MotorStateDebugMenu<TEXT_FRONTLEFTCOMMAND, FrontTexts::LeftCommand>;
|
||||||
class FrontRightMotorStateDebugMenu : public MotorStateDebugMenu<TEXT_FRONTRIGHTCOMMAND, FrontTexts::RightCommand> {};
|
using FrontRightMotorStateDebugMenu = MotorStateDebugMenu<TEXT_FRONTRIGHTCOMMAND, FrontTexts::RightCommand>;
|
||||||
class BackLeftMotorStateDebugMenu : public MotorStateDebugMenu<TEXT_BACKLEFTCOMMAND, BackTexts::LeftCommand> {};
|
using BackLeftMotorStateDebugMenu = MotorStateDebugMenu<TEXT_BACKLEFTCOMMAND, BackTexts::LeftCommand>;
|
||||||
class BackRightMotorStateDebugMenu : public MotorStateDebugMenu<TEXT_BACKRIGHTCOMMAND, BackTexts::RightCommand> {};
|
using BackRightMotorStateDebugMenu = MotorStateDebugMenu<TEXT_BACKRIGHTCOMMAND, BackTexts::RightCommand>;
|
||||||
|
@ -17,16 +17,16 @@ using MotortestMultiplikatorChangeDisplay = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<uint8_t>,
|
BobbyChangeValueDisplay<uint8_t>,
|
||||||
espgui::StaticText<TEXT_MOTORTESTMULTIPLIKATOR>,
|
espgui::StaticText<TEXT_MOTORTESTMULTIPLIKATOR>,
|
||||||
MotortestModeMultiplikatorAccessor,
|
MotortestModeMultiplikatorAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<MotortestModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using MotortestMaxPwmChangeDisplay = espgui::makeComponent<
|
using MotortestMaxPwmChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<uint16_t>,
|
BobbyChangeValueDisplay<uint16_t>,
|
||||||
espgui::StaticText<TEXT_MOTORTESTMAXPWM>,
|
espgui::StaticText<TEXT_MOTORTESTMAXPWM>,
|
||||||
MotortestMaxPwmAccessor,
|
MotortestMaxPwmAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<MotortestModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<MotortestModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
#include "selectmodemenu.h"
|
#include "selectmodemenu.h"
|
||||||
|
|
||||||
|
// 3rdparty lib includes
|
||||||
|
#include <actions/multiaction.h>
|
||||||
|
#include <actions/switchscreenaction.h>
|
||||||
|
#include <icons/back.h>
|
||||||
|
#include <textwithvaluehelper.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "actions/multiaction.h"
|
|
||||||
#include "actions/switchscreenaction.h"
|
|
||||||
#include "icons/back.h"
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "modes/defaultmode.h"
|
#include "modes/defaultmode.h"
|
||||||
#include "modes/tempomatmode.h"
|
#include "modes/tempomatmode.h"
|
||||||
|
@ -49,7 +49,7 @@ namespace {
|
|||||||
struct BacklightAccessor : public virtual espgui::AccessorInterface<bool>
|
struct BacklightAccessor : public virtual espgui::AccessorInterface<bool>
|
||||||
{
|
{
|
||||||
bool getValue() const override { return digitalRead(PINS_LEDBACKLIGHT) != ledBacklightInverted; }
|
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
|
#endif
|
||||||
struct FrontLedAccessor : public espgui::RefAccessor<bool> { bool &getRef() const override { return controllers.front.command.led; } };
|
struct FrontLedAccessor : public espgui::RefAccessor<bool> { bool &getRef() const override { return controllers.front.command.led; } };
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
#include "tempomatmodesettingsmenu.h"
|
#include "tempomatmodesettingsmenu.h"
|
||||||
|
|
||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include "changevaluedisplay.h"
|
#include <changevaluedisplay.h>
|
||||||
#include "menuitem.h"
|
#include <menuitem.h>
|
||||||
#include "actions/switchscreenaction.h"
|
#include <actions/switchscreenaction.h>
|
||||||
#include "icons/back.h"
|
#include <icons/back.h>
|
||||||
|
#include <textwithvaluehelper.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "displays/bobbychangevaluedisplay.h"
|
#include "displays/bobbychangevaluedisplay.h"
|
||||||
@ -20,16 +21,16 @@ using TempomatModeCruiseMotTgtChangeDisplay = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_NCRUISEMOTTGT>,
|
espgui::StaticText<TEXT_NCRUISEMOTTGT>,
|
||||||
TempomatModeCruiseMotTgtAccessor,
|
TempomatModeCruiseMotTgtAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<TempomatModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using TempomatModeModelModeChangeScreen = espgui::makeComponent<
|
using TempomatModeModelModeChangeScreen = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<UnifiedModelMode>,
|
BobbyChangeValueDisplay<UnifiedModelMode>,
|
||||||
espgui::StaticText<TEXT_MODELMODE>,
|
espgui::StaticText<TEXT_MODELMODE>,
|
||||||
TempomatModeModelModeAccessor,
|
TempomatModeModelModeAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<TempomatModeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<TempomatModeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ using StatsUpdateRateChangeDisplay = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_STATSUPDATERATE>,
|
espgui::StaticText<TEXT_STATSUPDATERATE>,
|
||||||
StatsUpdateRateAccessor,
|
StatsUpdateRateAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimersMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TimersMenu>>,
|
||||||
espgui::SwitchScreenAction<TimersMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<TimersMenu>>
|
||||||
>;
|
>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,16 +48,16 @@ using TimezoneOffsetChangeDisplay = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<int32_t>,
|
BobbyChangeValueDisplay<int32_t>,
|
||||||
espgui::StaticText<TEXT_OFFSET>,
|
espgui::StaticText<TEXT_OFFSET>,
|
||||||
TimezoneOffsetAccessor,
|
TimezoneOffsetAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<TimeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using DaylightSavingModeChangeDisplay = espgui::makeComponent<
|
using DaylightSavingModeChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<espchrono::DayLightSavingMode>,
|
BobbyChangeValueDisplay<espchrono::DayLightSavingMode>,
|
||||||
espgui::StaticText<TEXT_DAYLIGHTSAVINGMODE>,
|
espgui::StaticText<TEXT_DAYLIGHTSAVINGMODE>,
|
||||||
DaylightSavingModeAccessor,
|
DaylightSavingModeAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<TimeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
#ifdef FEATURE_NTP
|
#ifdef FEATURE_NTP
|
||||||
@ -65,16 +65,16 @@ using TimeSyncModeChangeDisplay = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<sntp_sync_mode_t>,
|
BobbyChangeValueDisplay<sntp_sync_mode_t>,
|
||||||
espgui::StaticText<TEXT_NTPMODE>,
|
espgui::StaticText<TEXT_NTPMODE>,
|
||||||
TimeSyncModeAccessor,
|
TimeSyncModeAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<TimeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
using TimeSyncIntervalChangeDisplay = espgui::makeComponent<
|
using TimeSyncIntervalChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int32_t>,
|
BobbyChangeValueDisplay<int32_t>,
|
||||||
espgui::StaticText<TEXT_NTPINTERVAL>,
|
espgui::StaticText<TEXT_NTPINTERVAL>,
|
||||||
TimeSyncIntervalAccessor,
|
TimeSyncIntervalAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<TimeSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
class NtpSyncStatusText : public virtual espgui::TextInterface
|
class NtpSyncStatusText : public virtual espgui::TextInterface
|
||||||
|
@ -21,8 +21,8 @@ using UdpCloudSendRateChangeDisplay = espgui::makeComponent<
|
|||||||
BobbyChangeValueDisplay<int16_t>,
|
BobbyChangeValueDisplay<int16_t>,
|
||||||
espgui::StaticText<TEXT_UDPSENDRATE>,
|
espgui::StaticText<TEXT_UDPSENDRATE>,
|
||||||
UdpCloudSendIntervalAccessor,
|
UdpCloudSendIntervalAccessor,
|
||||||
espgui::BackActionInterface<espgui::SwitchScreenAction<UdpCloudSettingsMenu>>,
|
espgui::ConfirmActionInterface<espgui::SwitchScreenAction<UdpCloudSettingsMenu>>,
|
||||||
espgui::SwitchScreenAction<UdpCloudSettingsMenu>
|
espgui::BackActionInterface<espgui::SwitchScreenAction<UdpCloudSettingsMenu>>
|
||||||
>;
|
>;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -12,8 +12,12 @@
|
|||||||
#include <icons/back.h>
|
#include <icons/back.h>
|
||||||
#include <screenmanager.h>
|
#include <screenmanager.h>
|
||||||
#include <espwifistack.h>
|
#include <espwifistack.h>
|
||||||
|
#include <textwithvaluehelper.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
|
#include "displays/bobbychangevaluedisplay.h"
|
||||||
|
#include "changevaluedisplay.h"
|
||||||
|
#include "changevaluedisplay_wifi_auth_mode_t.h"
|
||||||
#include "wifiapclientsmenu.h"
|
#include "wifiapclientsmenu.h"
|
||||||
#include "networksettingsmenu.h"
|
#include "networksettingsmenu.h"
|
||||||
#include "accessors/wifiapconfigaccessors.h"
|
#include "accessors/wifiapconfigaccessors.h"
|
||||||
@ -28,23 +32,54 @@ constexpr char TEXT_ENABLED[] = "Enabled";
|
|||||||
constexpr char TEXT_DISABLEWHENONLINE[] = "Disable when online";
|
constexpr char TEXT_DISABLEWHENONLINE[] = "Disable when online";
|
||||||
constexpr char TEXT_BACK[] = "Back";
|
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
|
class WifiApClientsAction : public virtual ActionInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void triggered() override;
|
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
|
} // namespace
|
||||||
|
|
||||||
WifiApSettingsMenu::WifiApSettingsMenu()
|
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_ENABLED>, ToggleBoolAction, CheckboxIcon, WifiApEnabledAccessor>>();
|
||||||
//constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DISABLEWHENONLINE>, ToggleBoolAction, CheckboxIcon, WifiApDisableWhenOnlineAccessor>>();
|
//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, WifiApClientsText, WifiApClientsAction>>();
|
||||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<NetworkSettingsMenu>, StaticMenuItemIcon<&icons::back>>>();
|
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 "buttons.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include "newsettings.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
namespace dpad5wire_2out {
|
namespace dpad5wire_2out {
|
||||||
@ -167,7 +168,7 @@ void update()
|
|||||||
|
|
||||||
const auto now = espchrono::millis_clock::now();
|
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)
|
if (lastState.up != newState.up && now - debounceUp > dpadDebounce)
|
||||||
{
|
{
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "buttons.h"
|
#include "buttons.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include "newsettings.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
namespace dpad6wire {
|
namespace dpad6wire {
|
||||||
@ -135,7 +136,7 @@ void update()
|
|||||||
|
|
||||||
const auto now = espchrono::millis_clock::now();
|
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)
|
if (lastState.up != newState.up && now - debounceUp > dpadDebounce)
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include "bobbycar-common.h"
|
#include "bobbycar-common.h"
|
||||||
#include "modeinterface.h"
|
#include "modeinterface.h"
|
||||||
|
|
||||||
|
enum class LarsmModeMode : uint8_t { Mode1, Mode2, Mode3, Mode4 };
|
||||||
|
|
||||||
class LarsmMode : public ModeInterface
|
class LarsmMode : public ModeInterface
|
||||||
{
|
{
|
||||||
using Base = ModeInterface;
|
using Base = ModeInterface;
|
||||||
|
@ -84,7 +84,7 @@ class ConfigContainer
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// default allowReset constraints nvsName
|
// default allowReset constraints nvsName
|
||||||
ConfigWrapper<std::optional<mac_t>> baseMacAddressOverride{std::nullopt, NoReset, {}, "baseMacAddrOver" };
|
ConfigWrapper<std::optional<mac_t>> baseMacAddressOverride{std::nullopt, DoReset, {}, "baseMacAddrOver" };
|
||||||
ConfigWrapper<std::string> hostname {defaultHostname, DoReset, StringMinMaxSize<4, 32>, "hostname" };
|
ConfigWrapper<std::string> hostname {defaultHostname, DoReset, StringMinMaxSize<4, 32>, "hostname" };
|
||||||
ConfigWrapper<bool> wifiStaEnabled {true, DoReset, {}, "wifiStaEnabled" };
|
ConfigWrapper<bool> wifiStaEnabled {true, DoReset, {}, "wifiStaEnabled" };
|
||||||
std::array<WiFiConfig, 10> wifi_configs {
|
std::array<WiFiConfig, 10> wifi_configs {
|
||||||
@ -104,18 +104,28 @@ public:
|
|||||||
ConfigWrapper<bool> wifiApEnabled {true, DoReset, {}, "wifiApEnabled" };
|
ConfigWrapper<bool> wifiApEnabled {true, DoReset, {}, "wifiApEnabled" };
|
||||||
ConfigWrapper<std::string> wifiApName {defaultHostname, DoReset, StringMinMaxSize<4, 32>, "wifiApName" };
|
ConfigWrapper<std::string> wifiApName {defaultHostname, DoReset, StringMinMaxSize<4, 32>, "wifiApName" };
|
||||||
ConfigWrapper<std::string> wifiApKey {"Passwort_123", DoReset, StringOr<StringEmpty, StringMinMaxSize<8, 64>>, "wifiApKey" };
|
ConfigWrapper<std::string> wifiApKey {"Passwort_123", DoReset, StringOr<StringEmpty, StringMinMaxSize<8, 64>>, "wifiApKey" };
|
||||||
ConfigWrapper<uint8_t> wifiApChannel {1, DoReset, {}, "wifiApChannel" };
|
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<wifi_auth_mode_t> wifiApAuthmode{WIFI_AUTH_WPA2_PSK, DoReset, {}, "wifiApAuthmode" };
|
||||||
|
|
||||||
ConfigWrapper<bool> timeServerEnabled {false, DoReset, {}, "timeServerEnabl" };
|
ConfigWrapper<bool> timeServerEnabled {true, DoReset, {}, "timeServerEnabl" };
|
||||||
ConfigWrapper<std::string> timeServer {"europe.pool.ntp.org", NoReset, StringMaxSize<64>, "timeServer" };
|
ConfigWrapper<std::string> timeServer {"europe.pool.ntp.org", DoReset, StringMaxSize<64>, "timeServer" };
|
||||||
ConfigWrapper<sntp_sync_mode_t> timeSyncMode {SNTP_SYNC_MODE_IMMED, NoReset, {}, "timeSyncMode" };
|
ConfigWrapper<sntp_sync_mode_t> timeSyncMode {SNTP_SYNC_MODE_IMMED, DoReset, {}, "timeSyncMode" };
|
||||||
ConfigWrapper<espchrono::milliseconds32> timeSyncInterval{espchrono::milliseconds32{CONFIG_LWIP_SNTP_UPDATE_DELAY}, NoReset, MinTimeSyncInterval, "timeSyncInterva" };
|
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::minutes32> timezoneOffset{espchrono::minutes32{60}, DoReset, {}, "timezoneOffset" }; // MinMaxValue<minutes32, -1440m, 1440m>
|
||||||
ConfigWrapper<espchrono::DayLightSavingMode>timeDst{espchrono::DayLightSavingMode::EuropeanSummerTime, DoReset, {}, "time_dst" };
|
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 {
|
std::array<WirelessDoorsConfig, 5> wireless_door_configs {
|
||||||
WirelessDoorsConfig { "door_id0", "door_token0" },
|
WirelessDoorsConfig { "door_id0", "door_token0" },
|
||||||
WirelessDoorsConfig { "door_id1", "door_token1" },
|
WirelessDoorsConfig { "door_id1", "door_token1" },
|
||||||
@ -262,6 +272,8 @@ public:
|
|||||||
x(wifiApEnabled) \
|
x(wifiApEnabled) \
|
||||||
x(wifiApName) \
|
x(wifiApName) \
|
||||||
x(wifiApKey) \
|
x(wifiApKey) \
|
||||||
|
x(wifiApIp) \
|
||||||
|
x(wifiApMask) \
|
||||||
x(wifiApChannel) \
|
x(wifiApChannel) \
|
||||||
x(wifiApAuthmode) \
|
x(wifiApAuthmode) \
|
||||||
\
|
\
|
||||||
@ -274,6 +286,14 @@ public:
|
|||||||
\
|
\
|
||||||
x(canBusResetOnError) \
|
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].doorId) \
|
||||||
x(wireless_door_configs[0].doorToken) \
|
x(wireless_door_configs[0].doorToken) \
|
||||||
x(wireless_door_configs[1].doorId) \
|
x(wireless_door_configs[1].doorId) \
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#ifdef FEATURE_CAN
|
#ifdef FEATURE_CAN
|
||||||
#include "can.h"
|
#include "can.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "newsettings.h"
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ void readPotis()
|
|||||||
constexpr auto sampleMultipleTimes = [](uint8_t pin){
|
constexpr auto sampleMultipleTimes = [](uint8_t pin){
|
||||||
analogRead(pin);
|
analogRead(pin);
|
||||||
double sum{};
|
double sum{};
|
||||||
const auto sampleCount = settings.boardcomputerHardware.sampleCount;
|
const auto sampleCount = configs.sampleCount.value;
|
||||||
for (int i = 0; i < sampleCount; i++)
|
for (int i = 0; i < sampleCount; i++)
|
||||||
sum += analogRead(pin);
|
sum += analogRead(pin);
|
||||||
return sum / sampleCount;
|
return sum / sampleCount;
|
||||||
@ -65,11 +66,11 @@ void readPotis()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (raw_gas)
|
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
|
else
|
||||||
gas = std::nullopt;
|
gas = std::nullopt;
|
||||||
if (raw_brems)
|
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
|
else
|
||||||
brems = std::nullopt;
|
brems = std::nullopt;
|
||||||
|
|
||||||
|
@ -123,14 +123,6 @@ constexpr Settings::BoardcomputerHardware::TimersSettings defaultTimersSettings
|
|||||||
};
|
};
|
||||||
|
|
||||||
constexpr Settings::BoardcomputerHardware defaultBoardcomputerHardware {
|
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
|
#ifdef FEATURE_GAMETRAK
|
||||||
.gametrakXMin = DEFAULT_GAMETRAKXMIN,
|
.gametrakXMin = DEFAULT_GAMETRAKXMIN,
|
||||||
.gametrakXMax = DEFAULT_GAMETRAKXMAX,
|
.gametrakXMax = DEFAULT_GAMETRAKXMAX,
|
||||||
|
@ -23,8 +23,7 @@
|
|||||||
#include "unifiedmodelmode.h"
|
#include "unifiedmodelmode.h"
|
||||||
#include "handbremse.h"
|
#include "handbremse.h"
|
||||||
#include "ledstrip.h"
|
#include "ledstrip.h"
|
||||||
|
#include "modes/larsmmode.h"
|
||||||
enum class LarsmModeMode : uint8_t { Mode1, Mode2, Mode3, Mode4 };
|
|
||||||
|
|
||||||
struct Settings
|
struct Settings
|
||||||
{
|
{
|
||||||
@ -70,11 +69,6 @@ struct Settings
|
|||||||
} controllerHardware;
|
} controllerHardware;
|
||||||
|
|
||||||
struct BoardcomputerHardware {
|
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
|
#ifdef FEATURE_GAMETRAK
|
||||||
int16_t gametrakXMin, gametrakXMax, gametrakYMin, gametrakYMax, gametrakDistMin, gametrakDistMax;
|
int16_t gametrakXMin, gametrakXMax, gametrakYMin, gametrakYMax, gametrakDistMin, gametrakDistMax;
|
||||||
#endif
|
#endif
|
||||||
@ -243,14 +237,6 @@ void Settings::executeForEveryCommonSetting(T &&callable)
|
|||||||
callable("canReceiveTimeo", controllerHardware.canReceiveTimeout);
|
callable("canReceiveTimeo", controllerHardware.canReceiveTimeout);
|
||||||
#endif
|
#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
|
#ifdef FEATURE_GAMETRAK
|
||||||
callable("gametrakXMin", boardcomputerHardware.gametrakXMin);
|
callable("gametrakXMin", boardcomputerHardware.gametrakXMin);
|
||||||
callable("gametrakXMax", boardcomputerHardware.gametrakXMax);
|
callable("gametrakXMax", boardcomputerHardware.gametrakXMax);
|
||||||
|
@ -8,22 +8,8 @@
|
|||||||
#include <espwifistack.h>
|
#include <espwifistack.h>
|
||||||
#include <richtextrenderer.h>
|
#include <richtextrenderer.h>
|
||||||
|
|
||||||
// local includes
|
|
||||||
#include "newsettings.h"
|
|
||||||
#include "wifi_bobbycar.h"
|
|
||||||
|
|
||||||
using namespace espgui;
|
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 WifiApMacText::text() const
|
||||||
{
|
{
|
||||||
std::string text = "&smac: &f";
|
std::string text = "&smac: &f";
|
||||||
@ -35,16 +21,6 @@ std::string WifiApMacText::text() const
|
|||||||
return text;
|
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
|
std::string WifiApHostnameText::text() const
|
||||||
{
|
{
|
||||||
if (auto hostname = wifi_stack::get_hostname_for_interface(ESP_IF_WIFI_AP))
|
if (auto hostname = wifi_stack::get_hostname_for_interface(ESP_IF_WIFI_AP))
|
||||||
|
@ -3,36 +3,12 @@
|
|||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include <textinterface.h>
|
#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
|
class WifiApMacText : public virtual espgui::TextInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::string text() const override;
|
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
|
class WifiApHostnameText : public virtual espgui::TextInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -234,6 +234,7 @@ char TEXT_HANDBREMSE_AUTOMATIC[] = "Automatic Handbremse";
|
|||||||
char TEXT_HANDBREMSE_VISUALIZE[] = "Visualize Handbremse";
|
char TEXT_HANDBREMSE_VISUALIZE[] = "Visualize Handbremse";
|
||||||
char TEXT_HANDBREMSE_MODE[] = "Handbrems Mode";
|
char TEXT_HANDBREMSE_MODE[] = "Handbrems Mode";
|
||||||
char TEXT_HANDBREMSE_TRIGGERTIMEOUT[] = "Handbrems Timeout";
|
char TEXT_HANDBREMSE_TRIGGERTIMEOUT[] = "Handbrems Timeout";
|
||||||
|
char TEXT_HANDBREMSE[] = "Handbremse";
|
||||||
//char TEXT_BACK[] = "Back";
|
//char TEXT_BACK[] = "Back";
|
||||||
|
|
||||||
//DynamicDebugMenu
|
//DynamicDebugMenu
|
||||||
@ -448,62 +449,6 @@ char TEXT_OFF[] = "Off";
|
|||||||
char TEXT_MASTER[] = "Master";
|
char TEXT_MASTER[] = "Master";
|
||||||
char TEXT_SLAVE[] = "Slave";
|
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
|
//Crashmenu
|
||||||
char TEXT_CRASHMENU[] = "Crash Menu";
|
char TEXT_CRASHMENU[] = "Crash Menu";
|
||||||
char TEXT_CRASH_ASSERT[] = "assert(0)";
|
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_MASTER[];
|
||||||
extern char TEXT_SLAVE[];
|
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
|
//Crashmenu
|
||||||
extern char TEXT_CRASHMENU[];
|
extern char TEXT_CRASHMENU[];
|
||||||
extern char TEXT_CRASH_ASSERT[];
|
extern char TEXT_CRASH_ASSERT[];
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
#include <numberparsing.h>
|
#include <numberparsing.h>
|
||||||
#include <lockhelper.h>
|
#include <lockhelper.h>
|
||||||
#include <tickchrono.h>
|
#include <tickchrono.h>
|
||||||
|
#include <futurecpp.h>
|
||||||
|
#include <cpputils.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "newsettings.h"
|
#include "newsettings.h"
|
||||||
@ -29,25 +31,38 @@ using esphttpdutils::HtmlTag;
|
|||||||
namespace {
|
namespace {
|
||||||
constexpr const char * const TAG = "BOBBYWEB";
|
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>
|
template<typename T>
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
!std::is_same<T, bool>::value &&
|
!std::is_same_v<T, bool> &&
|
||||||
!std::is_integral<T>::value &&
|
!std::is_integral_v<T> &&
|
||||||
!std::is_same<T, std::string>::value &&
|
!is_duration_v<T> &&
|
||||||
!std::is_same<T, wifi_stack::ip_address_t>::value &&
|
!std::is_same_v<T, std::string> &&
|
||||||
!std::is_same<T, wifi_stack::mac_t>::value
|
!std::is_same_v<T, wifi_stack::ip_address_t> &&
|
||||||
, bool>::type
|
!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)
|
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||||
{
|
{
|
||||||
HtmlTag spanTag{"span", "style=\"color: red;\"", body};
|
HtmlTag spanTag{"span", "style=\"color: red;\"", body};
|
||||||
body += "Unsupported config type";
|
body += "Unsupported config type";
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
std::is_same<T, bool>::value
|
std::is_same_v<T, bool>
|
||||||
, bool>::type
|
, void>::type
|
||||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||||
{
|
{
|
||||||
body += fmt::format("<input type=\"checkbox\" name=\"{}\" value=\"true\" {}/>"
|
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),
|
esphttpdutils::htmlentities(key),
|
||||||
value ? "checked " : "",
|
value ? "checked " : "",
|
||||||
esphttpdutils::htmlentities(key));
|
esphttpdutils::htmlentities(key));
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
!std::is_same<T, bool>::value &&
|
!std::is_same_v<T, bool> &&
|
||||||
std::is_integral<T>::value
|
std::is_integral_v<T>
|
||||||
, bool>::type
|
, void>::type
|
||||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||||
{
|
{
|
||||||
body += fmt::format("<input type=\"number\" name=\"{}\" value=\"{}\" min=\"{}\" max=\"{}\" step=\"1\" />",
|
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,
|
value,
|
||||||
std::numeric_limits<T>::min(),
|
std::numeric_limits<T>::min(),
|
||||||
std::numeric_limits<T>::max());
|
std::numeric_limits<T>::max());
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
std::is_same<T, std::string>::value
|
is_duration_v<T>
|
||||||
, bool>::type
|
, 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)
|
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||||
{
|
{
|
||||||
body += fmt::format("<input type=\"text\" name=\"{}\" value=\"{}\" />",
|
body += fmt::format("<input type=\"text\" name=\"{}\" value=\"{}\" />",
|
||||||
esphttpdutils::htmlentities(key),
|
esphttpdutils::htmlentities(key),
|
||||||
esphttpdutils::htmlentities(value));
|
esphttpdutils::htmlentities(value));
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
std::is_same<T, wifi_stack::ip_address_t>::value
|
std::is_same_v<T, wifi_stack::ip_address_t>
|
||||||
, bool>::type
|
, void>::type
|
||||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
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]+\" />",
|
body += fmt::format("<input type=\"text\" name=\"{}\" value=\"{}\" pattern=\"[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\" />",
|
||||||
esphttpdutils::htmlentities(key),
|
esphttpdutils::htmlentities(key),
|
||||||
esphttpdutils::htmlentities(wifi_stack::toString(value)));
|
esphttpdutils::htmlentities(wifi_stack::toString(value)));
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
std::is_same<T, wifi_stack::mac_t>::value
|
std::is_same_v<T, wifi_stack::mac_t>
|
||||||
, bool>::type
|
, void>::type
|
||||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
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(key),
|
||||||
esphttpdutils::htmlentities(wifi_stack::toString(value)));
|
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
|
} // namespace
|
||||||
|
|
||||||
esp_err_t webserver_newSettings_handler(httpd_req_t *req)
|
esp_err_t webserver_newSettings_handler(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
#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()};
|
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
|
||||||
if (!helper.locked())
|
if (!helper.locked())
|
||||||
{
|
{
|
||||||
@ -219,10 +310,16 @@ esp_err_t webserver_newSettings_handler(httpd_req_t *req)
|
|||||||
|
|
||||||
body += ' ';
|
body += ' ';
|
||||||
|
|
||||||
|
if (config.allowReset())
|
||||||
{
|
{
|
||||||
HtmlTag buttonTag{"a", fmt::format("href=\"/resetNewSettings?{}=1\"", esphttpdutils::htmlentities(nvsName)), body};
|
HtmlTag buttonTag{"a", fmt::format("href=\"/resetNewSettings?{}=1\"", esphttpdutils::htmlentities(nvsName)), body};
|
||||||
body += "Reset";
|
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 {
|
namespace {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
!std::is_same<T, bool>::value &&
|
!std::is_same_v<T, bool> &&
|
||||||
!std::is_integral<T>::value &&
|
!std::is_integral_v<T> &&
|
||||||
!std::is_same<T, std::string>::value &&
|
!std::is_same_v<T, std::string> &&
|
||||||
!std::is_same<T, wifi_stack::ip_address_t>::value &&
|
!std::is_same_v<T, wifi_stack::ip_address_t> &&
|
||||||
!std::is_same<T, wifi_stack::mac_t>::value
|
!std::is_same_v<T, wifi_stack::mac_t> &&
|
||||||
, bool>::type
|
!std::is_same_v<T, std::optional<wifi_stack::mac_t>> &&
|
||||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue, std::string &body)
|
!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 tl::make_unexpected("Unsupported config type");
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
std::is_same<T, bool>::value
|
std::is_same_v<T, bool>
|
||||||
, bool>::type
|
, tl::expected<void, std::string>>::type
|
||||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue, std::string &body)
|
saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
|
||||||
{
|
{
|
||||||
if (newValue == "true")
|
if (cpputils::is_in(newValue, "true", "false"))
|
||||||
{
|
return configs.write_config(config, newValue == "true");
|
||||||
if (const auto result = configs.write_config(config, true); result)
|
|
||||||
{
|
|
||||||
body += "applied";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
return tl::make_unexpected(fmt::format("only true and false allowed, not {}", newValue));
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
body += fmt::format("only true and false allowed, not {}", newValue);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
!std::is_same<T, bool>::value &&
|
!std::is_same_v<T, bool> &&
|
||||||
std::is_integral<T>::value
|
std::is_integral_v<T>
|
||||||
, bool>::type
|
, tl::expected<void, std::string>>::type
|
||||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue, std::string &body)
|
saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
|
||||||
{
|
{
|
||||||
if (auto parsed = cpputils::fromString<T>(newValue))
|
if (auto parsed = cpputils::fromString<T>(newValue))
|
||||||
{
|
return configs.write_config(config, *parsed);
|
||||||
if (const auto result = configs.write_config(config, *parsed); result)
|
|
||||||
{
|
|
||||||
body += "applied";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
return tl::make_unexpected(fmt::format("could not parse {}", newValue));
|
||||||
body += result.error();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
body += fmt::format("could not parse {}", newValue);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
std::is_same<T, std::string>::value
|
std::is_same_v<T, std::string>
|
||||||
, bool>::type
|
, tl::expected<void, std::string>>::type
|
||||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue, std::string &body)
|
saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
|
||||||
{
|
{
|
||||||
if (const auto result = configs.write_config(config, std::string{newValue}); result)
|
return configs.write_config(config, std::string{newValue});
|
||||||
{
|
|
||||||
body += "applied";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
body += result.error();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
std::is_same<T, wifi_stack::ip_address_t>::value
|
std::is_same_v<T, wifi_stack::ip_address_t>
|
||||||
, bool>::type
|
, tl::expected<void, std::string>>::type
|
||||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue, std::string &body)
|
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 parsed = wifi_stack::fromString<wifi_stack::ip_address_t>(newValue); parsed)
|
||||||
{
|
return configs.write_config(config, *parsed);
|
||||||
if (const auto result = configs.write_config(config, *parsed); result)
|
|
||||||
{
|
|
||||||
body += "applied";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
return tl::make_unexpected(parsed.error());
|
||||||
body += result.error();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
body += parsed.error();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
std::is_same<T, wifi_stack::mac_t>::value
|
std::is_same_v<T, wifi_stack::mac_t>
|
||||||
, bool>::type
|
, tl::expected<void, std::string>>::type
|
||||||
saveSetting(ConfigWrapper<T> &config, std::string_view newValue, std::string &body)
|
saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
|
||||||
{
|
{
|
||||||
if (const auto parsed = wifi_stack::fromString<wifi_stack::mac_t>(newValue); parsed)
|
if (const auto parsed = wifi_stack::fromString<wifi_stack::mac_t>(newValue); parsed)
|
||||||
{
|
return configs.write_config(config, *parsed);
|
||||||
if (const auto result = configs.write_config(config, *parsed); result)
|
|
||||||
{
|
|
||||||
body += "applied";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
body += result.error();
|
if (newValue.empty())
|
||||||
return false;
|
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
|
else
|
||||||
{
|
return tl::make_unexpected(parsed.error());
|
||||||
body += parsed.error();
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
} // namespace
|
||||||
|
|
||||||
@ -431,10 +481,13 @@ esp_err_t webserver_saveNewSettings_handler(httpd_req_t *req)
|
|||||||
char valueBuf[257];
|
char valueBuf[257];
|
||||||
esphttpdutils::urldecode(valueBuf, valueBufEncoded);
|
esphttpdutils::urldecode(valueBuf, valueBufEncoded);
|
||||||
|
|
||||||
body += nvsName;
|
if (const auto result = saveSetting(config, valueBuf); result)
|
||||||
if (!saveSetting(config, valueBuf, body))
|
body += fmt::format("{} succeeded!\n", esphttpdutils::htmlentities(nvsName));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
body += fmt::format("{} failed: {}\n", esphttpdutils::htmlentities(nvsName), esphttpdutils::htmlentities(result.error()));
|
||||||
success = false;
|
success = false;
|
||||||
body += '\n';
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (body.empty())
|
if (body.empty())
|
||||||
|
@ -131,9 +131,9 @@ std::optional<wifi_stack::ap_config> createApConfig()
|
|||||||
.ssid = configs.wifiApName.value,
|
.ssid = configs.wifiApName.value,
|
||||||
.key = configs.wifiApKey.value,
|
.key = configs.wifiApKey.value,
|
||||||
.static_ip = {
|
.static_ip = {
|
||||||
.ip = apIP,
|
.ip = configs.wifiApIp.value,
|
||||||
.subnet = netMsk,
|
.subnet = configs.wifiApMask.value,
|
||||||
.gateway = apIP
|
.gateway = configs.wifiApIp.value,
|
||||||
},
|
},
|
||||||
.channel = configs.wifiApChannel.value,
|
.channel = configs.wifiApChannel.value,
|
||||||
.authmode = configs.wifiApAuthmode.value,
|
.authmode = configs.wifiApAuthmode.value,
|
||||||
|
@ -6,9 +6,6 @@
|
|||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include <espwifiutils.h>
|
#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_begin();
|
||||||
|
|
||||||
void wifi_update();
|
void wifi_update();
|
||||||
|
Reference in New Issue
Block a user