Merge pull request #245 from bobbycar-graz/nvs-feature-flags

This commit is contained in:
CommanderRedYT
2022-02-13 02:26:44 +01:00
committed by GitHub
102 changed files with 943 additions and 1153 deletions

View File

@ -16,71 +16,65 @@ add_definitions(
)
set(BOBBYCAR_BUILDFLAGS
-DFEATURE_ADC_IN
-DPINS_GAS=34
-DPINS_BREMS=35
-DDEFAULT_SWAPSCREENBYTES=false
-DFEATURE_CAN
# -DFEATURE_SERIAL
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=200
# -DFEATURE_MOSFETS
# -DPINS_MOSFET0=18
# -DPINS_MOSFET1=19
# -DPINS_MOSFET2=21
-DDEFAULT_IMOTMAX=28
-DDEFAULT_IDCMAX=30
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=7
-DDEFAULT_FIELDADVMAX=40
-DFEATURE_WEBSERVER
-DFEATURE_OTA
# -DFEATURE_DPAD_5WIRESW
# -DPINS_DPAD_5WIRESW_OUT=4
# -DPINS_DPAD_5WIRESW_IN1=5
# -DPINS_DPAD_5WIRESW_IN2=27
# -DPINS_DPAD_5WIRESW_IN3=18
# -DPINS_DPAD_5WIRESW_IN4=19
# -DPINS_DPAD_EXTRASW_IN5=25
-DFEATURE_DPAD_6WIRESW
-DPINS_DPAD_6WIRESW_OUT=4
-DPINS_DPAD_6WIRESW_IN1=5
-DPINS_DPAD_6WIRESW_IN2=27
-DPINS_DPAD_6WIRESW_IN3=18
-DPINS_DPAD_6WIRESW_IN4=19
-DPINS_DPAD_6WIRESW_IN5=26
-DFEATURE_GSCHISSENE_DIODE
-DFEATURE_BLE
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
-DFEATURE_POWERSUPPLY
-DFEATURE_CLOUD
-DFEATURE_UDPCLOUD
-DFEATURE_LEDBACKLIGHT
-DPINS_LEDBACKLIGHT=23
-DLEDBACKLIGHT_INVERTED
-DFEATURE_GARAGE
-DFEATURE_NTP
-DFEATURE_WIRELESS_CONFIG
-DFEATURE_LEDSTRIP
-DPINS_LEDSTRIP=33
-DHEAP_LRGST_CRASH_TEXT_FIX
-DLEDSTRIP_WRONG_DIRECTION
-DLEDSTRIP_ANIMATION_DEFAULT=1
-DLEDS_PER_METER=144
-DOLD_NVS
-DFEATURE_DNS_NS
-DSWITCH_BLINK
-DFEATURE_ESPNOW
# Pins
-DPINS_GAS=34
-DPINS_BREMS=35
# -DFEATURE_JOYSTICK
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
# -DPINS_MOSFET0=18
# -DPINS_MOSFET1=19
# -DPINS_MOSFET2=21
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
-DPINS_LEDBACKLIGHT=23
-DPINS_LEDSTRIP=33
# Config flags
-DFEATURE_ADC_IN
-DFEATURE_CAN
# -DFEATURE_SERIAL
# -DFEATURE_MOSFETS
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
-DFEATURE_POWERSUPPLY
-DFEATURE_LEDBACKLIGHT
-DLEDBACKLIGHT_INVERTED
-DLEDSTRIP_WRONG_DIRECTION
-DHEAP_LRGST_CRASH_TEXT_FIX
# Default values
-DDEFAULT_SWAPSCREENBYTES=false
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=200
-DDEFAULT_IMOTMAX=28
-DDEFAULT_IDCMAX=30
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=7
-DDEFAULT_FIELDADVMAX=40
# DPAD
# -DFEATURE_DPAD_5WIRESW
# -DPINS_DPAD_5WIRESW_OUT=4
# -DPINS_DPAD_5WIRESW_IN1=5
# -DPINS_DPAD_5WIRESW_IN2=27
# -DPINS_DPAD_5WIRESW_IN3=18
# -DPINS_DPAD_5WIRESW_IN4=19
# -DPINS_DPAD_EXTRASW_IN5=25
-DFEATURE_DPAD_6WIRESW
-DPINS_DPAD_6WIRESW_OUT=4
-DPINS_DPAD_6WIRESW_IN1=5
-DPINS_DPAD_6WIRESW_IN2=27
-DPINS_DPAD_6WIRESW_IN3=18
-DPINS_DPAD_6WIRESW_IN4=19
-DPINS_DPAD_6WIRESW_IN5=26
-DFEATURE_GSCHISSENE_DIODE
)

View File

@ -16,67 +16,67 @@ add_definitions(
)
set(BOBBYCAR_BUILDFLAGS
-DFEATURE_ADC_IN
-DPINS_GAS=34
-DPINS_BREMS=35
-DDEFAULT_SWAPSCREENBYTES=false
-DFEATURE_CAN
# -DFEATURE_SERIAL
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=200
# -DFEATURE_MOSFETS
# -DPINS_MOSFET0=18
# -DPINS_MOSFET1=19
# -DPINS_MOSFET2=21
-DDEFAULT_IMOTMAX=28
-DDEFAULT_IDCMAX=30
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=7
-DDEFAULT_FIELDADVMAX=40
-DFEATURE_WEBSERVER
-DFEATURE_OTA
-DFEATURE_DPAD_6WIRESW
-DPINS_DPAD_6WIRESW_OUT=4
-DPINS_DPAD_6WIRESW_IN1=5
-DPINS_DPAD_6WIRESW_IN2=27
-DPINS_DPAD_6WIRESW_IN3=18
-DPINS_DPAD_6WIRESW_IN4=19
-DPINS_DPAD_6WIRESW_IN5=26
-DFEATURE_GSCHISSENE_DIODE
-DFEATURE_BLE
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
# -DFEATURE_POWERSUPPLY
# -DFEATURE_CLOUD
-DFEATURE_UDPCLOUD
-DFEATURE_LEDBACKLIGHT
-DPINS_LEDBACKLIGHT=23
-DLEDBACKLIGHT_INVERTED
-DFEATURE_GARAGE
# -DFEATURE_NTP
-DFEATURE_WIRELESS_CONFIG
-DFEATURE_LEDSTRIP
-DPINS_LEDSTRIP=33
-DHEAP_LRGST_CRASH_TEXT_FIX
# -DLEDSTRIP_WRONG_DIRECTION
-DLEDSTRIP_ANIMATION_DEFAULT=1
-DLEDS_PER_METER=144
-DOLD_NVS
-DFEATURE_DNS_NS
-DSWITCH_BLINK
-DFEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
-DFEATURE_ESPNOW
# Pins
-DPINS_GAS=34
-DPINS_BREMS=35
# -DFEATURE_JOYSTICK
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
# -DPINS_MOSFET0=18
# -DPINS_MOSFET1=19
# -DPINS_MOSFET2=21
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
-DPINS_LEDBACKLIGHT=23
-DPINS_LEDSTRIP=33
# Config flags
-DFEATURE_ADC_IN
-DFEATURE_CAN
# -DFEATURE_SERIAL
# -DFEATURE_MOSFETS
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
# -DFEATURE_POWERSUPPLY
-DFEATURE_LEDBACKLIGHT
-DLEDBACKLIGHT_INVERTED
# -DLEDSTRIP_WRONG_DIRECTION
-DHEAP_LRGST_CRASH_TEXT_FIX
# Default values
-DDEFAULT_SWAPSCREENBYTES=false
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=200
-DDEFAULT_IMOTMAX=28
-DDEFAULT_IDCMAX=30
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=17
-DDEFAULT_FIELDADVMAX=40
# DPAD
# -DFEATURE_DPAD_5WIRESW
# -DPINS_DPAD_5WIRESW_OUT=4
# -DPINS_DPAD_5WIRESW_IN1=5
# -DPINS_DPAD_5WIRESW_IN2=27
# -DPINS_DPAD_5WIRESW_IN3=18
# -DPINS_DPAD_5WIRESW_IN4=19
# -DPINS_DPAD_EXTRASW_IN5=25
-DFEATURE_DPAD_6WIRESW
-DPINS_DPAD_6WIRESW_OUT=4
-DPINS_DPAD_6WIRESW_IN1=5
-DPINS_DPAD_6WIRESW_IN2=27
-DPINS_DPAD_6WIRESW_IN3=18
-DPINS_DPAD_6WIRESW_IN4=19
-DPINS_DPAD_6WIRESW_IN5=26
-DFEATURE_GSCHISSENE_DIODE
)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ignore/lockscreen_plugin.cmake")

View File

@ -16,63 +16,64 @@ add_definitions(
)
set(BOBBYCAR_BUILDFLAGS
-DFEATURE_ADC_IN
-DPINS_GAS=34
-DPINS_BREMS=35
-DDEFAULT_SWAPSCREENBYTES=false
-DFEATURE_CAN
# -DFEATURE_SERIAL
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=255
-DFEATURE_MOSFETS
-DPINS_MOSFET0=4
-DPINS_MOSFET1=5
-DPINS_MOSFET2=25
-DDEFAULT_IMOTMAX=40
-DDEFAULT_IDCMAX=42
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=17
-DDEFAULT_FIELDADVMAX=40
-DFEATURE_WEBSERVER
-DFEATURE_OTA
-DFEATURE_DPAD_5WIRESW_2OUT
-DPINS_DPAD_5WIRESW_OUT1=18
-DPINS_DPAD_5WIRESW_OUT2=19
-DPINS_DPAD_5WIRESW_IN1=27
-DPINS_DPAD_5WIRESW_IN2=32
-DPINS_DPAD_5WIRESW_IN3=33
-DFEATURE_BLE
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
-DFEATURE_POWERSUPPLY
-DFEATURE_CLOUD
-DFEATURE_UDPCLOUD
-DFEATURE_LEDBACKLIGHT
-DPINS_LEDBACKLIGHT=23
-DLEDBACKLIGHT_INVERTED
# -DFEATURE_GARAGE
-DFEATURE_NTP
-DFEATURE_WIRELESS_CONFIG
-DFEATURE_LEDSTRIP
-DPINS_LEDSTRIP=26
# -DHEAP_LRGST_CRASH_TEXT_FIX
# -DLEDSTRIP_WRONG_DIRECTION
-DLEDSTRIP_ANIMATION_DEFAULT=0
-DLEDS_PER_METER=144
-DOLD_NVS
-DFEATURE_DNS_NS
# -DSWITCH_BLINK
# -DFEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
# -DFEATURE_ESPNOW
# Pins
-DPINS_GAS=34
-DPINS_BREMS=35
# -DFEATURE_JOYSTICK
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
-DPINS_MOSFET0=4
-DPINS_MOSFET1=5
-DPINS_MOSFET2=25
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
-DPINS_LEDBACKLIGHT=23
-DPINS_LEDSTRIP=26
# Config flags
-DFEATURE_ADC_IN
-DFEATURE_CAN
# -DFEATURE_SERIAL
-DFEATURE_MOSFETS
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
-DFEATURE_POWERSUPPLY
-DFEATURE_LEDBACKLIGHT
-DLEDBACKLIGHT_INVERTED
# -DLEDSTRIP_WRONG_DIRECTION
# -DHEAP_LRGST_CRASH_TEXT_FIX
# Default values
-DDEFAULT_SWAPSCREENBYTES=false
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=255
-DDEFAULT_IMOTMAX=40
-DDEFAULT_IDCMAX=42
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=17
-DDEFAULT_FIELDADVMAX=40
# DPAD
-DFEATURE_DPAD_5WIRESW_2OUT
-DPINS_DPAD_5WIRESW_OUT1=18
-DPINS_DPAD_5WIRESW_OUT2=19
-DPINS_DPAD_5WIRESW_IN1=27
-DPINS_DPAD_5WIRESW_IN2=32
-DPINS_DPAD_5WIRESW_IN3=33
# -DFEATURE_DPAD_6WIRESW
# -DPINS_DPAD_6WIRESW_OUT=4
# -DPINS_DPAD_6WIRESW_IN1=5
# -DPINS_DPAD_6WIRESW_IN2=27
# -DPINS_DPAD_6WIRESW_IN3=18
# -DPINS_DPAD_6WIRESW_IN4=19
# -DPINS_DPAD_6WIRESW_IN5=26
# -DFEATURE_GSCHISSENE_DIODE
)

View File

@ -16,65 +16,58 @@ add_definitions(
)
set(BOBBYCAR_BUILDFLAGS
-DFEATURE_ADC_IN
-DPINS_GAS=34
-DPINS_BREMS=35
-DDEFAULT_SWAPSCREENBYTES=false
-DFEATURE_CAN
# -DFEATURE_SERIAL
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=200
# -DFEATURE_MOSFETS
# -DPINS_MOSFET0=18
# -DPINS_MOSFET1=19
# -DPINS_MOSFET2=21
-DDEFAULT_IMOTMAX=28
-DDEFAULT_IDCMAX=30
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=7
-DDEFAULT_FIELDADVMAX=40
-DFEATURE_WEBSERVER
-DFEATURE_OTA
-DFEATURE_DPAD_5WIRESW_2OUT
-DPINS_DPAD_5WIRESW_OUT1=5
-DPINS_DPAD_5WIRESW_OUT2=4
-DPINS_DPAD_5WIRESW_IN1=27
-DPINS_DPAD_5WIRESW_IN2=19
-DPINS_DPAD_5WIRESW_IN3=18
-DFEATURE_BLE
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
# -DFEATURE_POWERSUPPLY
# -DFEATURE_CLOUD
-DFEATURE_UDPCLOUD
-DFEATURE_LEDBACKLIGHT
-DPINS_LEDBACKLIGHT=23
-DLEDBACKLIGHT_INVERTED
-DFEATURE_GARAGE
# -DFEATURE_NTP
-DFEATURE_WIRELESS_CONFIG
-DFEATURE_LEDSTRIP
-DPINS_LEDSTRIP=33
# -DHEAP_LRGST_CRASH_TEXT_FIX
# -DLEDSTRIP_WRONG_DIRECTION
-DLEDSTRIP_ANIMATION_DEFAULT=2
-DLEDS_PER_METER=144
-DOLD_NVS
-DFEATURE_DNS_NS
# -DSWITCH_BLINK
# -DFEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
-DFEATURE_ESPNOW
# Pins
-DPINS_GAS=34
-DPINS_BREMS=35
# -DFEATURE_JOYSTICK
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
# -DPINS_MOSFET0=18
# -DPINS_MOSFET1=19
# -DPINS_MOSFET2=21
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
-DPINS_LEDBACKLIGHT=23
-DPINS_LEDSTRIP=33
# Config flags
-DFEATURE_ADC_IN
-DFEATURE_CAN
# -DFEATURE_SERIAL
# -DFEATURE_MOSFETS
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
# -DFEATURE_POWERSUPPLY
-DFEATURE_LEDBACKLIGHT
-DLEDBACKLIGHT_INVERTED
# -DLEDSTRIP_WRONG_DIRECTION
-DHEAP_LRGST_CRASH_TEXT_FIX
# Default values
-DDEFAULT_SWAPSCREENBYTES=false
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=200
-DDEFAULT_IMOTMAX=28
-DDEFAULT_IDCMAX=30
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=17
-DDEFAULT_FIELDADVMAX=40
# DPAD
-DFEATURE_DPAD_5WIRESW_2OUT
-DPINS_DPAD_5WIRESW_OUT1=5
-DPINS_DPAD_5WIRESW_OUT2=4
-DPINS_DPAD_5WIRESW_IN1=27
-DPINS_DPAD_5WIRESW_IN2=19
-DPINS_DPAD_5WIRESW_IN3=18
)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ignore/lockscreen_plugin.cmake")

View File

@ -16,61 +16,66 @@ add_definitions(
)
set(BOBBYCAR_BUILDFLAGS
-DFEATURE_ADC_IN
-DPINS_GAS=34
-DPINS_BREMS=35
-DDEFAULT_SWAPSCREENBYTES=false
-DFEATURE_CAN
# -DFEATURE_SERIAL
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=200
# -DFEATURE_MOSFETS
# -DPINS_MOSFET0=18
# -DPINS_MOSFET1=19
# -DPINS_MOSFET2=21
-DDEFAULT_IMOTMAX=28
-DDEFAULT_IDCMAX=30
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=7
-DDEFAULT_FIELDADVMAX=40
-DFEATURE_WEBSERVER
-DFEATURE_OTA
-DFEATURE_DPAD_5WIRESW_2OUT
-DPINS_DPAD_5WIRESW_OUT1=5
-DPINS_DPAD_5WIRESW_OUT2=19
-DPINS_DPAD_5WIRESW_IN1=4
-DPINS_DPAD_5WIRESW_IN2=18
-DPINS_DPAD_5WIRESW_IN3=27
-DFEATURE_BLE
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
# -DFEATURE_POWERSUPPLY
# -DFEATURE_CLOUD
-DFEATURE_UDPCLOUD
-DFEATURE_LEDBACKLIGHT
-DPINS_LEDBACKLIGHT=23
-DLEDBACKLIGHT_INVERTED
# -DFEATURE_GARAGE
# -DFEATURE_NTP
-DFEATURE_WIRELESS_CONFIG
-DFEATURE_LEDSTRIP
-DPINS_LEDSTRIP=33
# -DLEDSTRIP_WRONG_DIRECTION
-DLEDSTRIP_ANIMATION_DEFAULT=0
-DOLD_NVS
-DFEATURE_DNS_NS
-DFEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
# Pins
-DPINS_GAS=34
-DPINS_BREMS=35
# -DFEATURE_JOYSTICK
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
# -DPINS_MOSFET0=18
# -DPINS_MOSFET1=19
# -DPINS_MOSFET2=21
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
-DPINS_LEDBACKLIGHT=23
-DPINS_LEDSTRIP=33
# Config flags
-DFEATURE_ADC_IN
-DFEATURE_CAN
# -DFEATURE_SERIAL
# -DFEATURE_MOSFETS
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
-DFEATURE_POWERSUPPLY
-DFEATURE_LEDBACKLIGHT
-DLEDBACKLIGHT_INVERTED
# -DLEDSTRIP_WRONG_DIRECTION
# -DHEAP_LRGST_CRASH_TEXT_FIX
# Default values
-DDEFAULT_SWAPSCREENBYTES=false
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=200
-DDEFAULT_IMOTMAX=28
-DDEFAULT_IDCMAX=30
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=7
-DDEFAULT_FIELDADVMAX=40
# DPAD
-DFEATURE_DPAD_5WIRESW_2OUT
-DPINS_DPAD_5WIRESW_OUT1=18
-DPINS_DPAD_5WIRESW_OUT2=19
-DPINS_DPAD_5WIRESW_IN1=4
-DPINS_DPAD_5WIRESW_IN2=5
-DPINS_DPAD_5WIRESW_IN3=27
# -DFEATURE_DPAD_6WIRESW
# -DPINS_DPAD_6WIRESW_OUT=4
# -DPINS_DPAD_6WIRESW_IN1=5
# -DPINS_DPAD_6WIRESW_IN2=27
# -DPINS_DPAD_6WIRESW_IN3=18
# -DPINS_DPAD_6WIRESW_IN4=19
# -DPINS_DPAD_6WIRESW_IN5=26
# -DFEATURE_GSCHISSENE_DIODE
)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ignore/lockscreen_plugin.cmake")

View File

@ -16,72 +16,64 @@ add_definitions(
)
set(BOBBYCAR_BUILDFLAGS
-DFEATURE_ADC_IN
-DPINS_GAS=34
-DPINS_BREMS=35
-DDEFAULT_SWAPSCREENBYTES=false
-DFEATURE_CAN
# -DFEATURE_SERIAL
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=200
# -DFEATURE_MOSFETS
# -DPINS_MOSFET0=18
# -DPINS_MOSFET1=19
# -DPINS_MOSFET2=21
-DDEFAULT_IMOTMAX=28
-DDEFAULT_IDCMAX=30
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=7
-DDEFAULT_FIELDADVMAX=40
# -DFEATURE_WEBSERVER
# -DFEATURE_OTA
# -DFEATURE_DPAD_5WIRESW
# -DPINS_DPAD_5WIRESW_OUT=4
# -DPINS_DPAD_5WIRESW_IN1=5
# -DPINS_DPAD_5WIRESW_IN2=27
# -DPINS_DPAD_5WIRESW_IN3=18
# -DPINS_DPAD_5WIRESW_IN4=19
# -DPINS_DPAD_EXTRASW_IN5=25
-DFEATURE_DPAD_6WIRESW
-DPINS_DPAD_6WIRESW_OUT=4
-DPINS_DPAD_6WIRESW_IN1=5
-DPINS_DPAD_6WIRESW_IN2=27
-DPINS_DPAD_6WIRESW_IN3=18
-DPINS_DPAD_6WIRESW_IN4=19
-DPINS_DPAD_6WIRESW_IN5=26
# -DFEATURE_GSCHISSENE_DIODE
# -DFEATURE_BLE
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
# -DFEATURE_POWERSUPPLY
# -DFEATURE_CLOUD
# -DFEATURE_UDPCLOUD
# -DFEATURE_LEDBACKLIGHT
# -DPINS_LEDBACKLIGHT=23
# -DLEDBACKLIGHT_INVERTED
# -DFEATURE_GARAGE
# -DFEATURE_NTP
# -DFEATURE_WIRELESS_CONFIG
# -DFEATURE_LEDSTRIP
# -DPINS_LEDSTRIP=33
# -DHEAP_LRGST_CRASH_TEXT_FIX
# -DLEDSTRIP_WRONG_DIRECTION
# -DLEDSTRIP_ANIMATION_DEFAULT=1
# -DLEDS_PER_METER=144
-DOLD_NVS
# -DFEATURE_DNS_NS
# -DSWITCH_BLINK
-DFEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
# -DFEATURE_ESPNOW
# Pins
-DPINS_GAS=34
-DPINS_BREMS=35
# -DFEATURE_JOYSTICK
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
# -DPINS_MOSFET0=18
# -DPINS_MOSFET1=19
# -DPINS_MOSFET2=21
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
-DPINS_LEDBACKLIGHT=23
-DPINS_LEDSTRIP=33
# Config flags
# -DFEATURE_ADC_IN
# -DFEATURE_CAN
# -DFEATURE_SERIAL
# -DFEATURE_MOSFETS
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
# -DFEATURE_POWERSUPPLY
# -DFEATURE_LEDBACKLIGHT
# -DLEDBACKLIGHT_INVERTED
# -DLEDSTRIP_WRONG_DIRECTION
# -DHEAP_LRGST_CRASH_TEXT_FIX
# Default values
-DDEFAULT_SWAPSCREENBYTES=false
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=255
-DDEFAULT_IMOTMAX=28
-DDEFAULT_IDCMAX=30
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=7
-DDEFAULT_FIELDADVMAX=40
# DPAD
# -DFEATURE_DPAD_5WIRESW_2OUT
# -DPINS_DPAD_5WIRESW_OUT1=18
# -DPINS_DPAD_5WIRESW_OUT2=19
# -DPINS_DPAD_5WIRESW_IN1=4
# -DPINS_DPAD_5WIRESW_IN2=5
# -DPINS_DPAD_5WIRESW_IN3=27
# -DFEATURE_DPAD_6WIRESW
# -DPINS_DPAD_6WIRESW_OUT=4
# -DPINS_DPAD_6WIRESW_IN1=5
# -DPINS_DPAD_6WIRESW_IN2=27
# -DPINS_DPAD_6WIRESW_IN3=18
# -DPINS_DPAD_6WIRESW_IN4=19
# -DPINS_DPAD_6WIRESW_IN5=26
# -DFEATURE_GSCHISSENE_DIODE
)

View File

@ -16,65 +16,66 @@ add_definitions(
)
set(BOBBYCAR_BUILDFLAGS
-DFEATURE_ADC_IN
-DPINS_GAS=34
-DPINS_BREMS=35
-DDEFAULT_SWAPSCREENBYTES=false
-DFEATURE_CAN
# -DFEATURE_SERIAL
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=200
# -DFEATURE_MOSFETS
# -DPINS_MOSFET0=18
# -DPINS_MOSFET1=19
# -DPINS_MOSFET2=21
-DDEFAULT_IMOTMAX=28
-DDEFAULT_IDCMAX=30
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=7
-DDEFAULT_FIELDADVMAX=40
-DFEATURE_WEBSERVER
-DFEATURE_OTA
-DFEATURE_DPAD_5WIRESW_2OUT
-DPINS_DPAD_5WIRESW_OUT1=18
-DPINS_DPAD_5WIRESW_OUT2=19
-DPINS_DPAD_5WIRESW_IN1=4
-DPINS_DPAD_5WIRESW_IN2=5
-DPINS_DPAD_5WIRESW_IN3=27
-DFEATURE_BLE
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
# -DFEATURE_POWERSUPPLY
# -DFEATURE_CLOUD
-DFEATURE_UDPCLOUD
-DFEATURE_LEDBACKLIGHT
-DPINS_LEDBACKLIGHT=23
-DLEDBACKLIGHT_INVERTED
-DFEATURE_GARAGE
# -DFEATURE_NTP
-DFEATURE_WIRELESS_CONFIG
-DFEATURE_LEDSTRIP
-DPINS_LEDSTRIP=33
# -DHEAP_LRGST_CRASH_TEXT_FIX
# -DLEDSTRIP_WRONG_DIRECTION
-DLEDSTRIP_ANIMATION_DEFAULT=2
-DLEDS_PER_METER=144
-DOLD_NVS
-DFEATURE_DNS_NS
# -DSWITCH_BLINK
-DFEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
-DFEATURE_ESPNOW
# Pins
-DPINS_GAS=34
-DPINS_BREMS=35
# -DFEATURE_JOYSTICK
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
# -DPINS_MOSFET0=18
# -DPINS_MOSFET1=19
# -DPINS_MOSFET2=21
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
-DPINS_LEDBACKLIGHT=23
-DPINS_LEDSTRIP=33
# Config flags
-DFEATURE_ADC_IN
-DFEATURE_CAN
# -DFEATURE_SERIAL
# -DFEATURE_MOSFETS
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
-DFEATURE_POWERSUPPLY
-DFEATURE_LEDBACKLIGHT
-DLEDBACKLIGHT_INVERTED
# -DLEDSTRIP_WRONG_DIRECTION
# -DHEAP_LRGST_CRASH_TEXT_FIX
# Default values
-DDEFAULT_SWAPSCREENBYTES=false
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=255
-DDEFAULT_IMOTMAX=28
-DDEFAULT_IDCMAX=30
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=7
-DDEFAULT_FIELDADVMAX=40
# DPAD
-DFEATURE_DPAD_5WIRESW_2OUT
-DPINS_DPAD_5WIRESW_OUT1=18
-DPINS_DPAD_5WIRESW_OUT2=19
-DPINS_DPAD_5WIRESW_IN1=4
-DPINS_DPAD_5WIRESW_IN2=5
-DPINS_DPAD_5WIRESW_IN3=27
# -DFEATURE_DPAD_6WIRESW
# -DPINS_DPAD_6WIRESW_OUT=4
# -DPINS_DPAD_6WIRESW_IN1=5
# -DPINS_DPAD_6WIRESW_IN2=27
# -DPINS_DPAD_6WIRESW_IN3=18
# -DPINS_DPAD_6WIRESW_IN4=19
# -DPINS_DPAD_6WIRESW_IN5=26
# -DFEATURE_GSCHISSENE_DIODE
)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ignore/lockscreen_plugin.cmake")

View File

@ -1,4 +1,4 @@
set(BOBBY_APP_NAME seatbot)
set(BOBBY_APP_NAME bobbyquad_seatbot)
add_definitions(
-DUSER_SETUP_LOADED=1
@ -16,68 +16,62 @@ add_definitions(
)
set(BOBBYCAR_BUILDFLAGS
-DFEATURE_ADC_IN
-DPINS_GAS=34
-DPINS_BREMS=35
# Pins
-DPINS_GAS=34
-DPINS_BREMS=35
-DFEATURE_JOYSTICK
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
# -DPINS_MOSFET0=18
# -DPINS_MOSFET1=19
# -DPINS_MOSFET2=21
# -DPINS_GAMETRAKX=34
# -DPINS_GAMETRAKY=39
# -DPINS_GAMETRAKDIST=36
-DPINS_LEDBACKLIGHT=23
-DPINS_LEDSTRIP=33
-DFEATURE_JOYSTICK
# Config flags
-DFEATURE_ADC_IN
-DFEATURE_CAN
# -DFEATURE_SERIAL
# -DFEATURE_MOSFETS
# -DFEATURE_BLUETOOTH
# -DFEATURE_BMS
# -DFEATURE_GAMETRAK
# -DFEATURE_POWERSUPPLY
-DFEATURE_LEDBACKLIGHT
-DDEFAULT_SWAPSCREENBYTES=false
-DFEATURE_CAN
# -DFEATURE_SERIAL
# -DPINS_RX1=4
# -DPINS_TX1=5
# -DPINS_RX2=22
# -DPINS_TX2=23
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=200
# -DFEATURE_MOSFETS
# -DPINS_MOSFET0=18
# -DPINS_MOSFET1=19
# -DPINS_MOSFET2=21
-DDEFAULT_IMOTMAX=28
-DDEFAULT_IDCMAX=30
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=7
-DDEFAULT_FIELDADVMAX=40
-DFEATURE_WEBSERVER
-DFEATURE_OTA
# -DFEATURE_DPAD_6WIRESW
# -DPINS_DPAD_6WIRESW_OUT=4
# -DPINS_DPAD_6WIRESW_IN1=5
# -DPINS_DPAD_6WIRESW_IN2=27
# -DPINS_DPAD_6WIRESW_IN3=18
# -DPINS_DPAD_6WIRESW_IN4=19
# -DPINS_DPAD_6WIRESW_IN5=26
-DFEATURE_DPAD_5WIRESW_2OUT
-DPINS_DPAD_5WIRESW_OUT1=4
-DPINS_DPAD_5WIRESW_OUT2=5
-DPINS_DPAD_5WIRESW_IN1=18
-DPINS_DPAD_5WIRESW_IN2=19
-DPINS_DPAD_5WIRESW_IN3=27
-DFEATURE_BLE
-DFEATURE_UDPCLOUD
-DFEATURE_LEDBACKLIGHT
-DPINS_LEDBACKLIGHT=23
-DLEDBACKLIGHT_INVERTED
-DFEATURE_GARAGE
-DFEATURE_WIRELESS_CONFIG
-DFEATURE_LEDSTRIP
-DPINS_LEDSTRIP=33
-DHEAP_LRGST_CRASH_TEXT_FIX
-DLEDSTRIP_ANIMATION_DEFAULT=1
-DLEDS_PER_METER=144
-DOLD_NVS
# -DFEATURE_DNS_NS
-DSWITCH_BLINK
-DFEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
-DFEATURE_ESPNOW
-DLEDBACKLIGHT_INVERTED
# -DLEDSTRIP_WRONG_DIRECTION
-DHEAP_LRGST_CRASH_TEXT_FIX
# Default values
-DDEFAULT_SWAPSCREENBYTES=false
-DDEFAULT_INVERTFRONTLEFT=false
-DDEFAULT_INVERTFRONTRIGHT=true
-DDEFAULT_INVERTBACKLEFT=false
-DDEFAULT_INVERTBACKRIGHT=true
-DDEFAULT_WHEELDIAMETER=200
-DDEFAULT_IMOTMAX=28
-DDEFAULT_IDCMAX=30
-DDEFAULT_NMOTMAX=2000
-DDEFAULT_FIELDWEAKMAX=17
-DDEFAULT_FIELDADVMAX=40
# DPAD
-DFEATURE_DPAD_5WIRESW_2OUT
-DPINS_DPAD_5WIRESW_OUT1=4
-DPINS_DPAD_5WIRESW_OUT2=5
-DPINS_DPAD_5WIRESW_IN1=18
-DPINS_DPAD_5WIRESW_IN2=19
-DPINS_DPAD_5WIRESW_IN3=27
)
#if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ignore/lockscreen_plugin.cmake")
# include("${CMAKE_CURRENT_SOURCE_DIR}/ignore/lockscreen_plugin.cmake")
# message(WARNING "Including plugins")
#endif()

View File

@ -43,6 +43,7 @@ set(headers
bobbyerrorhandler.h
bobbyquickactions.h
bobbytypesafeenum.h
bobbyschedulertask.h
buildserver.h
can.h
changevaluedisplay_bluetoothmode.h
@ -96,6 +97,7 @@ set(headers
displays/menus/espnowmenu.h
displays/menus/espnowsettingsmenu.h
displays/menus/extrabuttoncalibratemenu.h
displays/menus/featureflagsmenu.h
displays/menus/feedbackdebugmenu.h
displays/menus/gametrakmodesettingsmenu.h
displays/menus/garagenmenu.h
@ -325,6 +327,7 @@ set(sources
displays/menus/espnowmenu.cpp
displays/menus/espnowsettingsmenu.cpp
displays/menus/extrabuttoncalibratemenu.cpp
displays/menus/featureflagsmenu.cpp
displays/menus/feedbackdebugmenu.cpp
displays/menus/gametrakmodesettingsmenu.cpp
displays/menus/garagenmenu.cpp

View File

@ -38,27 +38,21 @@ struct FieldWeakMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t
struct PhaseAdvMaxAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return profileSettings.limits.phaseAdvMax; } };
// Bluetooth Low Energy
#ifdef FEATURE_BLE
struct BleEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.bleSettings.bleEnabled; } };
#endif
// Cloud
#ifdef FEATURE_CLOUD
struct CloudEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.cloudSettings.cloudEnabled; } };
struct CloudTransmitTimeoutAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.cloudSettings.cloudTransmitTimeout; } };
#endif
// Time
//struct TimezoneOffsetAccessor : public NewSettingsAccessor<int32_t> { ConfigWrapper<int32_t> &getConfig() const override { return configs.timezoneOffset; } };
struct TimezoneOffsetAccessor : public NewSettingsChronoAdaptorAccessor<espchrono::minutes32> { ConfigWrapper<espchrono::minutes32> &getConfig() const override { return configs.timezoneOffset; } };
struct DaylightSavingModeAccessor : public NewSettingsAccessor<espchrono::DayLightSavingMode> { ConfigWrapper<espchrono::DayLightSavingMode> &getConfig() const override { return configs.timeDst; } };
#ifdef FEATURE_NTP
struct TimeServerEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.timeServerEnabled; } };
struct TimeServerAccessor : public NewSettingsAccessor<std::string> { ConfigWrapper<std::string> &getConfig() const override { return configs.timeServer; } };
struct TimeSyncModeAccessor : public NewSettingsAccessor<sntp_sync_mode_t> { ConfigWrapper<sntp_sync_mode_t> &getConfig() const override { return configs.timeSyncMode; } };
//struct TimeSyncIntervalAccessor : public NewSettingsAccessor<int32_t> { ConfigWrapper<int32_t> &getConfig() const override { return configs.timeSyncInterval; } };
struct TimeSyncIntervalAccessor : public NewSettingsChronoAdaptorAccessor<espchrono::milliseconds32> { ConfigWrapper<espchrono::milliseconds32> &getConfig() const override { return configs.timeSyncInterval; } };
#endif
// Controller Hardware
struct FrontLeftEnabledAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return profileSettings.controllerHardware.enableFrontLeft; } };
@ -126,17 +120,13 @@ struct GametrakDistMaxAccessor : public NewSettingsAccessor<int16_t> { ConfigWra
struct StatsUpdateRateAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.boardcomputerHardware.timersSettings.statsUpdateRate; } };
// Cloud
#ifdef FEATURE_CLOUD
struct CloudCollectRateAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.boardcomputerHardware.timersSettings.cloudCollectRate; } };
struct CloudSendRateAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.boardcomputerHardware.timersSettings.cloudSendRate; } };
#endif
#ifdef FEATURE_UDPCLOUD
struct UdpCloudSendIntervalAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.boardcomputerHardware.timersSettings.udpSendRateMs; } };
struct UdpCloudEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.udpCloudSettings.udpCloudEnabled; } };
struct CloudDebugEnableAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.udpCloudSettings.enableCloudDebug; } };
struct UdpUseStdStringAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.udpCloudSettings.udpUseStdString; } };
#endif
// DefaultMode
struct DefaultModeModelModeAccessor : public RefAccessorSaveSettings<UnifiedModelMode> { UnifiedModelMode &getRef() const override { return profileSettings.defaultMode.modelMode; } };
@ -171,7 +161,6 @@ struct MotortestModeMultiplikatorAccessor : public RefAccessorSaveSettings<uint8
struct MotortestMaxPwmAccessor : public RefAccessorSaveSettings<uint16_t> { uint16_t &getRef() const override { return profileSettings.motortestMode.maxPwm; } };
// Ledstrip
#ifdef FEATURE_LEDSTRIP
struct EnableLedAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableLedAnimation; } };
struct EnableBrakeLightsAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableBrakeLights; } };
struct LedsCountAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.ledstrip.ledsCount; } };
@ -200,11 +189,8 @@ struct EnableLedstripStVOFrontlight : public NewSettingsAccessor<bool> { ConfigW
struct AnimationMultiplierAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.ledstrip.animationMultiplier; } };
struct LedstripBrightnessAccessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.ledstrip.brightness; } };
struct LedstripEnableBlinkAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableAnimBlink; } };
#ifdef FEATURE_OTA
struct LedstripOtaAnimationAccessor : public NewSettingsAccessor<OtaAnimationModes> { ConfigWrapper<OtaAnimationModes> &getConfig() const override { return configs.ledstrip.otaMode; } };
#endif
struct LedstripEnableVisualizeBlinkAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableVisualizeBlink; } };
#endif
// Battery
struct BatterySeriesCellsAccessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.battery.cellsSeries; } };
@ -226,11 +212,9 @@ struct HandbremsAutomaticAccessor : public NewSettingsAccessor<bool> { ConfigWra
struct HandbremsVisualizeAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.handbremse.visualize; } };
// ESP Now
#ifdef FEATURE_ESPNOW
struct ESPNowSyncTimeEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.espnow.syncTime; } };
struct ESPNowSyncTimeWithOthersEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.espnow.syncTimeWithOthers; } };
struct ESPNowSyncBlinkEnabledAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.espnow.syncBlink; } };
#endif
// Button Mapping accessors
struct ButtonLeftAccessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.dpadMappingLeft; } };

View File

@ -9,7 +9,6 @@
#include "newsettings.h"
#include "bobbyerrorhandler.h"
#ifdef FEATURE_LEDSTRIP
template<LedstripAnimation type>
class LedStripSetAnimationActionStatic : public virtual espgui::ActionInterface
{
@ -29,5 +28,3 @@ public:
private:
const LedstripAnimation m_animation;
};
#endif

View File

@ -1,6 +1,5 @@
#include "ledstripblinkactions.h"
#ifdef FEATURE_LEDSTRIP
#include "ledstrip.h"
#include "ledstripdefines.h"
@ -39,4 +38,3 @@ void LedstripAnimationBlinkBothAction::triggered()
{
blinkAnimation = LEDSTRIP_OVERWRITE_BLINKBOTH;
}
#endif

View File

@ -1,6 +1,5 @@
#pragma once
#ifdef FEATURE_LEDSTRIP
#include "actioninterface.h"
class LedstripAnimationBlinkNoneAction : public virtual espgui::ActionInterface
@ -34,4 +33,3 @@ class LedstripAnimationBlinkBothAction : public virtual espgui::ActionInterface
public:
void triggered() override;
};
#endif

View File

@ -9,15 +9,12 @@
#include <futurecpp.h>
// local includes
#ifdef FEATURE_LEDSTRIP
#include "ledstrip.h"
#endif
#include "globals.h"
#include "modes/remotecontrolmode.h"
#include "utils.h"
#include "newsettings.h"
#ifdef FEATURE_BLE
namespace {
constexpr const char * const TAG = "BOBBYBLE";
@ -27,7 +24,6 @@ public:
void onWrite(NimBLECharacteristic* pCharacteristic) override;
};
#ifdef FEATURE_WIRELESS_CONFIG
class WirelessSettingsCallbacks : public NimBLECharacteristicCallbacks
{
public:
@ -39,7 +35,6 @@ class WiFiListCallbacks : public NimBLECharacteristicCallbacks
public:
void onRead(NimBLECharacteristic* pCharacteristic) override;
};
#endif // FEATURE_WIRELESS_CONFIG
} // namespace
@ -47,18 +42,14 @@ BLEServer *pServer{};
BLEService *pService{};
BLECharacteristic *livestatsCharacteristic{};
BLECharacteristic *remotecontrolCharacteristic{};
#ifdef FEATURE_WIRELESS_CONFIG
BLECharacteristic *wirelessConfig{};
BLECharacteristic *getwifilist{};
#endif // FEATURE_WIRELESS_CONFIG
namespace {
RemoteControlCallbacks bleRemoteCallbacks;
#ifdef FEATURE_WIRELESS_CONFIG
WirelessSettingsCallbacks bleWirelessSettingsCallbacks;
WiFiListCallbacks bleWiFiListCallbacks;
#endif // FEATURE_WIRELESS_CONFIG
void createBle()
{
@ -75,12 +66,11 @@ void createBle()
livestatsCharacteristic = pService->createCharacteristic("a48321ea-329f-4eab-a401-30e247211524", NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::NOTIFY);
remotecontrolCharacteristic = pService->createCharacteristic("4201def0-a264-43e6-946b-6b2d9612dfed", NIMBLE_PROPERTY::WRITE);
remotecontrolCharacteristic->setCallbacks(&bleRemoteCallbacks);
#ifdef FEATURE_WIRELESS_CONFIG
wirelessConfig = pService->createCharacteristic("4201def1-a264-43e6-946b-6b2d9612dfed", NIMBLE_PROPERTY::WRITE);
wirelessConfig->setCallbacks(&bleWirelessSettingsCallbacks);
getwifilist = pService->createCharacteristic("4201def2-a264-43e6-946b-6b2d9612dfed", NIMBLE_PROPERTY::READ);
getwifilist->setCallbacks(&bleWiFiListCallbacks);
#endif
pService->start();
@ -100,10 +90,8 @@ void destroyBle()
pService = {};
livestatsCharacteristic = {};
remotecontrolCharacteristic = {};
#ifdef FEATURE_WIRELESS_CONFIG
wirelessConfig = {};
getwifilist = {};
#endif
}
} // namespace
@ -116,6 +104,9 @@ void initBle()
void handleBle()
{
if (!configs.feature.ble.value)
return;
if (configs.bleSettings.bleEnabled.value)
{
if (!pServer)
@ -246,10 +237,11 @@ void RemoteControlCallbacks::onWrite(NimBLECharacteristic* pCharacteristic)
return;
}
#ifdef FEATURE_LEDSTRIP
auto newBlinkAnimation = doc["anim"].as<int16_t>();
if (blinkAnimation != newBlinkAnimation) blinkAnimation = newBlinkAnimation;
#endif // FEATURE_LEDSTRIP
if (configs.feature.ledstrip.value)
{
const auto newBlinkAnimation = doc["anim"].as<int16_t>();
if (blinkAnimation != newBlinkAnimation) blinkAnimation = newBlinkAnimation;
}
const bool isInverted = (profileSettings.controllerHardware.invertFrontLeft && !profileSettings.controllerHardware.invertFrontRight);
@ -264,7 +256,6 @@ void RemoteControlCallbacks::onWrite(NimBLECharacteristic* pCharacteristic)
}
}
#ifdef FEATURE_WIRELESS_CONFIG
void WirelessSettingsCallbacks::onWrite(NimBLECharacteristic* pCharacteristic)
{
const auto &val = pCharacteristic->getValue();
@ -303,8 +294,4 @@ void WiFiListCallbacks::onRead(NimBLECharacteristic *pCharacteristic)
serializeJson(responseDoc, json);
pCharacteristic->setValue(json);
}
#endif // FEATURE_WIRELESS_CONFIG
} // namespace
#endif

View File

@ -1,7 +1,5 @@
#pragma once
#ifdef FEATURE_BLE
// esp-idf includes
#include <NimBLEDevice.h>
@ -9,13 +7,9 @@ extern BLEServer *pServer;
extern BLEService *pService;
extern BLECharacteristic *livestatsCharacteristic;
extern BLECharacteristic *remotecontrolCharacteristic;
#ifdef FEATURE_WIRELESS_CONFIG
extern BLECharacteristic *wirelessConfig;
extern BLECharacteristic *getwifilist;
#endif // FEATURE_WIRELESS_CONFIG
void initBle();
void handleBle();
#endif

View File

@ -4,7 +4,6 @@
#include "textinterface.h"
#include "ble_bobby.h"
#ifdef FEATURE_BLE
struct BleServerPeerDevicesText : public virtual espgui::TextInterface {
public:
std::string text() const override
@ -26,4 +25,3 @@ public:
return text;
}
};
#endif

View File

@ -6,10 +6,9 @@
// local includes
#include "newsettings.h"
#include "settingsutils.h"
#ifdef FEATURE_LEDSTRIP
#include "modes/defaultmode.h"
#include "ledstripdefines.h"
#include "ledstrip.h"
#endif
#include "bobbyquickactions.h"

View File

@ -1,9 +1,7 @@
#include "bobbyquickactions.h"
// local includes
#ifdef FEATURE_ESPNOW
#include "espnowfunctions.h"
#endif
#include "newsettings.h"
#include "wifi_bobbycar.h"
@ -30,10 +28,7 @@ void handle_bobby_quickaction(espgui::Button button)
return;
}
if (config)
{
switch(config->value)
{
switch (config->value) {
case BobbyQuickActions::BLINK_LEFT:
blink_left();
break;
@ -51,13 +46,14 @@ void handle_bobby_quickaction(espgui::Button button)
break;
default:
return;
}
}
}
void open_garage()
{
#ifdef FEATURE_ESPNOW
if (!configs.feature.esp_now.value)
return;
if (!espnow::espnow_init_allowed())
return;
for (const auto &config : configs.wireless_door_configs)
@ -68,7 +64,6 @@ void open_garage()
continue;
}
}
#endif
}
void action_wifi_scan()
@ -82,7 +77,8 @@ void action_wifi_scan()
void blink_left()
{
#ifdef FEATURE_LEDSTRIP
if (configs.feature.ledstrip.value)
{
if (blinkAnimation == LEDSTRIP_OVERWRITE_NONE) //transition from off to left
{
blinkAnimation = LEDSTRIP_OVERWRITE_BLINKLEFT;
@ -95,12 +91,13 @@ void blink_left()
{
blinkAnimation = LEDSTRIP_OVERWRITE_NONE;
}
#endif
}
}
void blink_right()
{
#ifdef FEATURE_LEDSTRIP
if(configs.feature.ledstrip.value)
{
if (blinkAnimation == LEDSTRIP_OVERWRITE_NONE) //transition from off to right
{
blinkAnimation = LEDSTRIP_OVERWRITE_BLINKRIGHT;
@ -113,7 +110,7 @@ void blink_right()
{
blinkAnimation = LEDSTRIP_OVERWRITE_NONE;
}
#endif
}
}
void handle_handbremse()

13
main/bobbyschedulertask.h Normal file
View File

@ -0,0 +1,13 @@
#pragma once
// 3rdparty lib includes
#include <schedulertask.h>
class BobbySchedulerTask : public espcpputils::SchedulerTask {
public:
using SchedulerTask::SchedulerTask;
void setup() const { SchedulerTask::setup(); m_wasInitialized = true; }
bool isInitialized() const { return m_wasInitialized; }
private:
mutable bool m_wasInitialized{false};
};

View File

@ -16,8 +16,6 @@
#include "globals.h"
#include "newsettings.h"
#ifdef FEATURE_OTA
namespace buildserver {
uint16_t count_available_buildserver()
@ -271,4 +269,3 @@ namespace buildserver {
}
} // namespace SelectBuild
} // namespace buildserver
#endif

View File

@ -6,7 +6,6 @@
#include <asynchttprequest.h>
#include <delayedconstruction.h>
#ifdef FEATURE_OTA
namespace buildserver {
uint16_t count_available_buildserver();
@ -48,4 +47,3 @@ namespace SelectBuild {
bool get_request_running();
} // namespace SelectBuild
} // namespace buildserver
#endif

View File

@ -24,7 +24,6 @@ namespace {
constexpr const char * const TAG = "BOBBYCLOUD";
} // namespace
#ifdef FEATURE_CLOUD
espcpputils::websocket_client cloudClient;
bool cloudStarted{};
@ -53,6 +52,9 @@ void initCloud()
void updateCloud()
{
if (!configs.feature.cloud.value)
return;
const auto now = espchrono::millis_clock::now();
if (!lastCloudCollect || now - *lastCloudCollect >= std::chrono::milliseconds{configs.boardcomputerHardware.timersSettings.cloudCollectRate.value})
@ -284,5 +286,3 @@ void destroyCloud()
cloudClient = {};
cloudStarted = false;
}
#endif

View File

@ -7,7 +7,6 @@
#include <wrappers/websocket_client.h>
#include <espchrono.h>
#ifdef FEATURE_CLOUD
extern espcpputils::websocket_client cloudClient;
extern bool cloudStarted;
extern espchrono::millis_clock::time_point lastCreateTry;
@ -22,4 +21,3 @@ void initCloud();
void updateCloud();
void cloudCollect();
void cloudSend();
#endif

View File

@ -6,7 +6,6 @@
// local includes
#include "cloud.h"
#ifdef FEATURE_CLOUD
std::string CloudCreatedText::text() const
{
return fmt::format("created: {}", cloudClient ? "true" : "false");
@ -27,4 +26,3 @@ std::string CloudConnectedText::text() const
text += cloudClient.is_connected() ? "true" : "false";
return text;
}
#endif

View File

@ -3,7 +3,6 @@
// local includes
#include "textinterface.h"
#ifdef FEATURE_CLOUD
struct CloudCreatedText : public virtual espgui::TextInterface
{
public:
@ -21,4 +20,3 @@ struct CloudConnectedText : public virtual espgui::TextInterface
public:
std::string text() const override;
};
#endif

View File

@ -21,7 +21,6 @@
#include "globals.h"
#include "displays/menus/ledstripmenu.h"
#ifdef FEATURE_LEDSTRIP
namespace {
constexpr char TEXT_LEDSTRIPCOLORMENU[] = "Customize Ledstrip";
@ -30,15 +29,15 @@ int8_t selected_color;
bool state_select_color{false};
bool last_state = {false};
const std::array<CRGB, 8> Colors = {
CRGB{0,0,0},
CRGB{255,255,255},
CRGB{255,0,0},
CRGB{255,255,0},
CRGB{0,255,0},
CRGB{0,255,255},
CRGB{0,0,255},
CRGB{255,0,255}
const std::array<uint32_t, 8> Colors = {
CRGB_TO_UINT32(CRGB{0,0,0}),
CRGB_TO_UINT32(CRGB{255,255,255}),
CRGB_TO_UINT32(CRGB{255,0,0}),
CRGB_TO_UINT32(CRGB{255,255,0}),
CRGB_TO_UINT32(CRGB{0,255,0}),
CRGB_TO_UINT32(CRGB{0,255,255}),
CRGB_TO_UINT32(CRGB{0,0,255}),
CRGB_TO_UINT32(CRGB{255,0,255})
};
const std::array<uint16_t, 8> tft_colors = {
@ -119,7 +118,7 @@ void LedstripColorsDisplay::buttonPressed(espgui::Button button)
}
else
{
ledstrip_custom_colors[selected_side] = Colors[selected_color];
configs.ledstrip.custom_color[selected_side].write(configs.nvs_handle_user, Colors[selected_color]);
// Uncomment to close select color menu on color select
/*
state_select_color = false;
@ -258,4 +257,3 @@ void LedstripColorsDisplay::drawSide(Bobbycar_Side side, unsigned int color)
}
// espgui::tft.fillCircle(espgui::tft.width() / 2, 140, 100, TFT_BLACK);
}
#endif

View File

@ -10,16 +10,6 @@
#include "bobbydisplaywithtitle.h"
#include "ledstrip.h"
#ifdef FEATURE_LEDSTRIP
//extern int8_t selected_side;
//extern int8_t selected_color;
//extern bool state_select_color;
//extern bool last_state;
//extern const std::array<CRGB, 8> Colors;
//extern const std::array<uint16_t, 8> tft_colors;
class LedstripColorsDisplay : public BobbyDisplayWithTitle
{
using Base = BobbyDisplayWithTitle;
@ -38,4 +28,3 @@ public:
private:
bool already_drew_circle{false};
};
#endif

View File

@ -8,11 +8,9 @@
#include "esptexthelpers.h"
#include "displays/menus/settingsmenu.h"
#ifdef FEATURE_OTA
#include <espasyncota.h>
#include <esp_ota_ops.h>
#include "fmt/core.h"
#endif
namespace {
constexpr char TEXT_ABOUT[] = "About";
@ -23,17 +21,13 @@ class CurrentVersionText : public virtual espgui::TextInterface
public:
std::string text() const override
{
#ifdef FEATURE_OTA
if (const esp_app_desc_t *app_desc = esp_ota_get_app_description())
{
return fmt::format("Version: {}", app_desc->version);
}
#endif
return "Version: 1.0";
return "Version: Unkown";
};
};
constexpr char TEXT_VERSION[] = "Version: 1.0";
} // namespace
AboutMenu::AboutMenu()

View File

@ -15,7 +15,6 @@
#include "displays/menus/settingsmenu.h"
#include "bobbycheckbox.h"
#ifdef FEATURE_BLE
namespace {
constexpr char TEXT_BLESETTINGS[] = "BLE settings";
constexpr char TEXT_ENABLED[] = "Enabled";
@ -51,4 +50,3 @@ void BleSettingsMenu::back()
{
espgui::switchScreen<SettingsMenu>();
}
#endif

View File

@ -3,8 +3,6 @@
// local includes
#include "displays/bobbymenudisplay.h"
#ifdef FEATURE_BLE
class BleSettingsMenu : public BobbyMenuDisplay
{
public:
@ -14,4 +12,3 @@ public:
void back() override;
};
#endif

View File

@ -16,7 +16,6 @@
#include "displays/menus/settingsmenu.h"
#include "bobbycheckbox.h"
#ifdef FEATURE_CLOUD
namespace {
constexpr char TEXT_CLOUDSETTINGS[] = "Cloud settings";
constexpr char TEXT_CLOUDENABLED[] = "Cloud enabled";
@ -83,4 +82,3 @@ void CloudSettingsMenu::back()
{
switchScreen<SettingsMenu>();
}
#endif

View File

@ -3,7 +3,6 @@
// local includes
#include "displays/bobbymenudisplay.h"
#ifdef FEATURE_CLOUD
class CloudSettingsMenu : public BobbyMenuDisplay
{
public:
@ -13,4 +12,3 @@ public:
void back() override;
};
#endif

View File

@ -63,14 +63,19 @@ DebugMenu::DebugMenu()
{
using namespace espgui;
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_TASKMANAGER>, SwitchScreenAction<TaskmanagerMenu>>>();
#ifdef FEATURE_CAN
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CANDEBUG>, SwitchScreenAction<CanDebugMenu>>>();
#endif
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_QRCODE_DEBUG>, SwitchScreenAction<QrCodeDebugDisplay>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BATTERYDEBUG>, SwitchScreenAction<BatteryDebugMenu>, StaticMenuItemIcon<&bobbyicons::battery>>>();
#ifdef FEATURE_UDPCLOUD
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_TOGGLECLOUDDEBUG>, BobbyCheckbox, CloudDebugEnableAccessor>>();
#endif
if (configs.feature.udpcloud.value)
{
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_TOGGLECLOUDDEBUG>, BobbyCheckbox, CloudDebugEnableAccessor>>();
}
constructMenuItem<makeComponent<MenuItem, LastRebootReasonText, StaticFont<2>, DisabledColor, DummyAction>>();
#ifdef FEATURE_CAN
constructMenuItem<makeComponent<MenuItem, CanIcCrashText, StaticFont<2>, DisabledColor, DummyAction>>();
#endif
constructMenuItem<makeComponent<MenuItem, EmptyText, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_FRONTCOMMAND>, SwitchScreenAction<FrontCommandDebugMenu>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACKCOMMAND>, SwitchScreenAction<BackCommandDebugMenu>>>();

View File

@ -1,6 +1,5 @@
#include "espnowmenu.h"
#ifdef FEATURE_ESPNOW
// 3rdparty lib includes
#include "actions/dummyaction.h"
#include "actions/switchscreenaction.h"
@ -75,4 +74,3 @@ void EspNowMenu::back()
{
espgui::switchScreen<SettingsMenu>();
}
#endif

View File

@ -1,7 +1,5 @@
#pragma once
#ifdef FEATURE_ESPNOW
// local includes
#include "displays/bobbymenudisplay.h"
@ -14,5 +12,3 @@ public:
void back() override;
};
#endif

View File

@ -1,7 +1,5 @@
#include "espnowsettingsmenu.h"
#ifdef FEATURE_ESPNOW
// 3rdparty lib includes
#include "actions/dummyaction.h"
#include "actions/switchscreenaction.h"
@ -46,4 +44,3 @@ void EspNowSettingsMenu::back()
{
espgui::switchScreen<EspNowMenu>();
}
#endif

View File

@ -1,7 +1,5 @@
#pragma once
#ifdef FEATURE_ESPNOW
// local includes
#include "displays/bobbymenudisplay.h"
@ -14,5 +12,3 @@ public:
void back() override;
};
#endif

View File

@ -0,0 +1,79 @@
#include "featureflagsmenu.h"
// 3rdparty lib includes
#include <fmt/core.h>
#include <actions/switchscreenaction.h>
#include <icons/back.h>
#include <strutils.h>
// local includes
#include "displays/bobbypopupdisplay.h"
#include "displays/menus/settingsmenu.h"
#include "bobbycheckbox.h"
#include "newsettings.h"
using namespace espgui;
namespace {
constexpr const char * const TAG = "FEATUREFLAGSMENU";
constexpr char TEXT_FEATUREFLAGS[] = "Feature Flags";
constexpr char TEXT_BACK[] = "Back";
class FeatureFlagMenuItem : public MenuItem, public virtual BobbyErrorHandler {
public:
explicit FeatureFlagMenuItem(ConfigWrapper<bool> &config) : m_config{config} {}
std::string text() const override
{
std::string_view name = m_config.nvsName();
constexpr const std::string_view prefix = "f_";
if (cpputils::stringStartsWith(name, prefix)) {
name.remove_prefix(prefix.size());
}
return std::string{name};
}
void triggered() override
{
if (auto result = m_config.write(configs.nvs_handle_user, !m_config.value); !result)
errorOccured(std::move(result).error());
}
const MenuItemIcon *icon() const override
{
return m_config.value ? &icons::checked : &icons::unchecked;
}
private:
ConfigWrapper<bool> &m_config;
};
// TODO: Replace SwitchScreenAction / switchScreen with this action. Needs: BobbyPopupDisplayWithCustomExitAction => pass SwitchScreenAction<SettingsMenu> into it
class ExitFeatureFlagsMenuAction : public virtual ActionInterface {
public:
void triggered() override {
auto newDisplay = std::make_unique<BobbyPopupDisplay>(std::move("Please reboot if you have changed something"), std::move(espgui::currentDisplay));
newDisplay->initOverlay();
espgui::currentDisplay = std::move(newDisplay);
}
};
} // namespace
FeatureFlagsMenu::FeatureFlagsMenu()
{
configs.callForEveryFeature([&](ConfigWrapper<bool> &feature){
constructMenuItem<FeatureFlagMenuItem>(feature);
});
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<SettingsMenu>>>();
}
std::string FeatureFlagsMenu::text() const
{
return TEXT_FEATUREFLAGS;
}
void FeatureFlagsMenu::back()
{
switchScreen<SettingsMenu>();
}

View File

@ -0,0 +1,14 @@
#pragma once
// local includes
#include "displays/menudisplaywithtime.h"
class FeatureFlagsMenu : public bobbygui::MenuDisplayWithTime
{
public:
FeatureFlagsMenu();
std::string text() const override;
void back() override;
};

View File

@ -1,4 +1,3 @@
#if defined(FEATURE_GARAGE) && defined (FEATURE_ESPNOW)
#include "garagenmenu.h"
// 3rd party libs
@ -66,4 +65,3 @@ void SendEspNowMessageAction::triggered()
}
}
} // namespace
#endif

View File

@ -1,7 +1,5 @@
#pragma once
#if defined(FEATURE_GARAGE) && defined (FEATURE_ESPNOW)
// local includes
#include "displays/bobbymenudisplay.h"
@ -14,4 +12,3 @@ public:
void back() override;
};
#endif

View File

@ -1,6 +1,5 @@
#include "ledstripmenu.h"
#ifdef FEATURE_LEDSTRIP
// 3rdparty lib includes
#include <FastLED.h>
#include <actioninterface.h>
@ -127,7 +126,11 @@ class AllCustomLedsOffAction : public virtual espgui::ActionInterface
public:
void triggered() override
{
std::fill(std::begin(ledstrip_custom_colors), std::end(ledstrip_custom_colors), CRGB{0, 0, 0});
// std::fill(std::begin(ledstrip_custom_colors), std::end(ledstrip_custom_colors), CRGB{0, 0, 0});
for (uint8_t i = 0; i < configs.ledstrip.custom_color.size(); i++)
{
configs.write_config(configs.ledstrip.custom_color[i], 0);
}
}
};
@ -163,9 +166,8 @@ LedstripMenu::LedstripMenu()
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_STVO_FRONTLENGTH, LedsStVOFrontLengthAccessor>, espgui::SwitchScreenAction<StVOLengthChangeScreen>>>(); }
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_BLINKANIMATION>, espgui::SwitchScreenAction<LedstripSelectBlinkMenu>>>();
#ifdef FEATURE_OTA
if (!simplified) { constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDSTRIP_CHANGE_OTA_ANIM>, espgui::SwitchScreenAction<LedstripOtaAnimationChangeMenu>>>(); }
#endif
if (configs.feature.ota.value)
if (!simplified) { constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDSTRIP_CHANGE_OTA_ANIM>, espgui::SwitchScreenAction<LedstripOtaAnimationChangeMenu>>>(); }
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_ANIMATION_MULTIPLIER>, espgui::SwitchScreenAction<AnimationMultiplierChangeScreen>>>();
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_LEDSCOUNT, LedsCountAccessor>, espgui::SwitchScreenAction<LedsCountChangeScreen>>>(); }
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_CENTEROFFSET, CenterOffsetAccessor>, espgui::SwitchScreenAction<CenterOffsetChangeScreen>>>(); }
@ -185,4 +187,3 @@ void LedstripMenu::back()
{
espgui::switchScreen<MainMenu>();
}
#endif

View File

@ -3,7 +3,6 @@
// local includes
#include "displays/menudisplaywithtime.h"
#ifdef FEATURE_LEDSTRIP
class LedstripMenu : public bobbygui::MenuDisplayWithTime
{
public:
@ -13,4 +12,3 @@ public:
void back() override;
};
#endif

View File

@ -1,7 +1,5 @@
#include "ledstripselectblinkmenu.h"
#ifdef FEATURE_LEDSTRIP
// 3rdparty lib includes
#include "actions/dummyaction.h"
#include "actions/switchscreenaction.h"
@ -83,4 +81,3 @@ std::string CurrentSelectedBlinkAnimationText::text() const
}
} // namespace
#endif

View File

@ -3,7 +3,6 @@
// Local includes
#include "displays/bobbymenudisplay.h"
#ifdef FEATURE_LEDSTRIP
class LedstripSelectBlinkMenu : public BobbyMenuDisplay
{
public:
@ -12,4 +11,3 @@ public:
std::string text() const override;
void back() override;
};
#endif

View File

@ -10,7 +10,6 @@
#include "utils.h"
#include "ledstripmenu.h"
#if defined(FEATURE_LEDSTRIP) && defined(FEATURE_OTA)
namespace {
constexpr char TEXT_BLINKANIMATION[] = "Blink animation";
constexpr char TEXT_OTAANIM_NONE[] = "None";
@ -47,4 +46,3 @@ void LedstripOtaAnimationChangeMenu::back()
{
espgui::switchScreen<LedstripMenu>();
}
#endif

View File

@ -3,7 +3,6 @@
// local includes
#include "displays/bobbymenudisplay.h"
#if defined(FEATURE_LEDSTRIP) && defined(FEATURE_OTA)
class LedstripOtaAnimationChangeMenu : public BobbyMenuDisplay
{
public:
@ -12,4 +11,3 @@ public:
std::string text() const override;
void back() override;
};
#endif

View File

@ -21,9 +21,7 @@
#include "displays/menus/demosmenu.h"
#include "displays/menus/greenpassmenu.h"
#include "displays/lockscreen.h"
#if defined(FEATURE_GARAGE) && defined (FEATURE_ESPNOW)
#include "displays/menus/garagenmenu.h"
#endif
#include "displays/menus/otamenu.h"
#include "displays/poweroffdisplay.h"
#include "displays/menus/statisticsmenu.h"
@ -39,12 +37,8 @@
#include "icons/settings.h"
#include "icons/lock.h"
#include "icons/demos.h"
#ifdef FEATURE_OTA
#include "icons/update.h"
#endif
#ifdef FEATURE_LEDSTRIP
#include "icons/neopixel.h"
#endif
#include "icons/poweroff.h"
#include "icons/reboot.h"
#include "icons/statistics.h"
@ -89,9 +83,10 @@ MainMenu::MainMenu()
// constructMenuItem<makeComponent<MenuItem, mainmenu::CurrentTimeText, DummyAction, StaticMenuItemIcon<&bobbyicons::time>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_STATUS>, SwitchScreenAction<StatusDisplay>, StaticMenuItemIcon<&espgui::icons::back>>>();
#ifdef FEATURE_LEDSTRIP
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIP>, SwitchScreenAction<LedstripMenu>, StaticMenuItemIcon<&bobbyicons::neopixel>>>();
#endif
if (configs.feature.ledstrip.value)
{
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIP>, SwitchScreenAction<LedstripMenu>, StaticMenuItemIcon<&bobbyicons::neopixel>>>();
}
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_STATISTICSMENU>, SwitchScreenAction<StatisticsMenu>, StaticMenuItemIcon<&bobbyicons::statistics>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTMODE>, SwitchScreenAction<SelectModeMenu>, StaticMenuItemIcon<&bobbyicons::modes>>>();
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MODESETTINGS>, ModeSettingsAction>>(); }
@ -99,12 +94,12 @@ MainMenu::MainMenu()
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SETTINGS>, SwitchScreenAction<SettingsMenu>, StaticMenuItemIcon<&bobbyicons::settings>>>(); }
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GREENPASS>, SwitchScreenAction<GreenPassMenu>, StaticMenuItemIcon<&bobbyicons::greenpass>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LOCKVEHICLE>, SwitchScreenAction<Lockscreen>, StaticMenuItemIcon<&bobbyicons::lock>>>();
#if defined(FEATURE_GARAGE) && defined (FEATURE_ESPNOW)
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GARAGE>, SwitchScreenAction<GarageMenu>>>(); }
#endif
#ifdef FEATURE_OTA
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UPDATE>, SwitchScreenAction<OtaMenu>, StaticMenuItemIcon<&bobbyicons::update>>>(); }
#endif
if (configs.feature.garage.value && configs.feature.esp_now.value)
{
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GARAGE>, SwitchScreenAction<GarageMenu>>>(); }
}
if (configs.feature.ota.value)
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UPDATE>, SwitchScreenAction<OtaMenu>, StaticMenuItemIcon<&bobbyicons::update>>>(); }
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GRAPHS>, SwitchScreenAction<GraphsMenu>, StaticMenuItemIcon<&bobbyicons::graph>>>(); }
#if defined(FEATURE_CAN) && defined(FEATURE_POWERSUPPLY)
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POWERSUPPLY>, SwitchScreenAction<PowerSupplyDisplay>>>(); }

View File

@ -15,7 +15,6 @@
#include "displays/menus/mainmenu.h"
#include "displays/updatedisplay.h"
#ifdef FEATURE_OTA
namespace {
constexpr char TEXT_UPDATE[] = "Update";
constexpr char TEXT_UPDATENOW[] = "Update now";
@ -44,4 +43,3 @@ void OtaMenu::back()
{
espgui::switchScreen<MainMenu>();
}
#endif

View File

@ -1,4 +1,3 @@
#ifdef FEATURE_OTA
#include "selectbuildserverbranch.h"
// 3rd party includes
@ -164,4 +163,3 @@ void SelectBuildserverBranchMenu::buildMenuRequestError(std::string error)
item.setTitle(error);
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<OtaMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
}
#endif

View File

@ -3,8 +3,6 @@
// local includes
#include "displays/bobbymenudisplay.h"
#ifdef FEATURE_OTA
class SelectBuildserverBranchMenu : public BobbyMenuDisplay
{
using Base = espgui::MenuDisplay;
@ -17,5 +15,3 @@ public:
void update() override;
void back() override;
};
#endif

View File

@ -15,8 +15,6 @@
#include "utils.h"
#include "newsettings.h"
#ifdef FEATURE_OTA
using namespace buildserver::SelectBuild;
namespace {
@ -84,4 +82,3 @@ void SelectBuildServerMenu::back()
{
espgui::switchScreen<OtaMenu>();
}
#endif

View File

@ -5,8 +5,6 @@
// local includes
#include "displays/bobbymenudisplay.h"
#ifdef FEATURE_OTA
class SelectBuildServerMenu : public BobbyMenuDisplay
{
public:
@ -16,4 +14,3 @@ public:
void back() override;
};
#endif

View File

@ -15,7 +15,6 @@
#include "globals.h"
#include "newsettings.h"
#ifdef FEATURE_OTA
#define MESSAGE(text) constructMenuItem<makeComponent<MenuItem, StaticText<text>, DefaultFont, StaticColor<TFT_RED>, DummyAction>>()
using namespace espgui;
@ -151,4 +150,3 @@ void SelectBuildMenu::back()
{
switchScreen<OtaMenu>();
}
#endif

View File

@ -3,8 +3,6 @@
// local includes
#include "displays/bobbymenudisplay.h"
#ifdef FEATURE_OTA
class SelectBuildMenu : public BobbyMenuDisplay
{
using Base = BobbyMenuDisplay;
@ -21,4 +19,3 @@ private:
void buildMenuFromJson();
void buildMenuRequestError(std::string error);
};
#endif

View File

@ -10,9 +10,7 @@
// local includes
#include "utils.h"
#include "icons/wifi.h"
#if defined(FEATURE_BLUETOOTH) || defined(FEATURE_BLE)
#include "icons/bluetooth.h"
#endif
#include "icons/time.h"
#include "icons/hardware.h"
#include "icons/buzzer.h"
@ -25,12 +23,8 @@
#include "displays/menus/networksettingsmenu.h"
#include "displays/menus/bluetoothsettingsmenu.h"
#include "displays/menus/blesettingsmenu.h"
#ifdef FEATURE_CLOUD
#include "displays/menus/cloudsettingsmenu.h"
#endif
#ifdef FEATURE_UDPCLOUD
#include "displays/menus/udpcloudsettingsmenu.h"
#endif
#include "displays/menus/espnowmenu.h"
#include "displays/menus/selectbuildservermenu.h"
#include "displays/menus/timesettingsmenu.h"
@ -41,6 +35,7 @@
#include "displays/menus/crashmenu.h"
#include "displays/menus/aboutmenu.h"
#include "displays/menus/mainmenu.h"
#include "displays/menus/featureflagsmenu.h"
#include "bobbycheckbox.h"
namespace {
@ -58,6 +53,7 @@ constexpr char TEXT_TIME[] = "Time";
constexpr char TEXT_MODESSETTINGS[] = "Modes settings";
constexpr char TEXT_CONTROLLERHARDWARESETTINGS[] = "Controller H/W settings";
constexpr char TEXT_BOARDCOMPUTERHARDWARESETTINGS[] = "Boardcomputer H/W settings";
constexpr char TEXT_FEATUREFLAGS[] = "Feature flags";
constexpr char TEXT_AUTOCONNECTBMS[] = "Auto connect BMS";
constexpr char TEXT_BUZZER[] = "Buzzer";
constexpr char TEXT_FRONTLED[] = "Front LED";
@ -88,28 +84,24 @@ SettingsMenu::SettingsMenu()
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LIMITSSETTINGS>, SwitchScreenAction<LimitsSettingsMenu>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_NETWORKSETTINGS>, SwitchScreenAction<NetworkSettingsMenu>, StaticMenuItemIcon<&bobbyicons::wifi>>>();
#ifdef FEATURE_ESPNOW
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ESPNOW>, SwitchScreenAction<EspNowMenu>, StaticMenuItemIcon<&bobbyicons::wifi>>>();
#endif
if (configs.feature.esp_now.value)
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ESPNOW>, SwitchScreenAction<EspNowMenu>, StaticMenuItemIcon<&bobbyicons::wifi>>>();
#ifdef FEATURE_BLUETOOTH
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLUETOOTHSETTINGS>, SwitchScreenAction<BluetoothSettingsMenu>, StaticMenuItemIcon<&bobbyicons::bluetooth>>>();
#endif
#ifdef FEATURE_BLE
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLESETTINGS>, SwitchScreenAction<BleSettingsMenu>, StaticMenuItemIcon<&bobbyicons::bluetooth>>>();
#endif
#ifdef FEATURE_CLOUD
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CLOUDSETTINGS>, SwitchScreenAction<CloudSettingsMenu>>>();
#endif
#ifdef FEATURE_UDPCLOUD
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UDPCLOUDSETTINGS>, SwitchScreenAction<UdpCloudSettingsMenu>>>();
#endif
#ifdef FEATURE_OTA
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTBUILDSERVERMENU>, SwitchScreenAction<SelectBuildServerMenu>, StaticMenuItemIcon<&bobbyicons::update>>>();
#endif
if (configs.feature.ble.value)
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLESETTINGS>, SwitchScreenAction<BleSettingsMenu>, StaticMenuItemIcon<&bobbyicons::bluetooth>>>();
if (configs.feature.cloud.value)
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CLOUDSETTINGS>, SwitchScreenAction<CloudSettingsMenu>>>();
if (configs.feature.udpcloud.value)
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UDPCLOUDSETTINGS>, SwitchScreenAction<UdpCloudSettingsMenu>>>();
if (configs.feature.ota.value)
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTBUILDSERVERMENU>, SwitchScreenAction<SelectBuildServerMenu>, StaticMenuItemIcon<&bobbyicons::update>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_TIME>, SwitchScreenAction<TimeSettingsMenu>, StaticMenuItemIcon<&bobbyicons::time>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MODESSETTINGS>, SwitchScreenAction<ModesSettingsMenu>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CONTROLLERHARDWARESETTINGS>, SwitchScreenAction<ControllerHardwareSettingsMenu>, StaticMenuItemIcon<&bobbyicons::hardware>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BOARDCOMPUTERHARDWARESETTINGS>, SwitchScreenAction<BoardcomputerHardwareSettingsMenu>, StaticMenuItemIcon<&bobbyicons::hardware>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_FEATUREFLAGS>, SwitchScreenAction<FeatureFlagsMenu>, StaticMenuItemIcon<&bobbyicons::demos>>>();
//#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
// constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_AUTOCONNECTBMS>, BobbyCheckbox, AutoConnectBmsAccessor>>();
//#endif

View File

@ -69,7 +69,6 @@ using DaylightSavingModeChangeDisplay = espgui::makeComponent<
espgui::BackActionInterface<espgui::SwitchScreenAction<TimeSettingsMenu>>
>;
#ifdef FEATURE_NTP
using TimeServerChangeDisplay = espgui::makeComponent<
BobbyChangeValueDisplay<std::string>,
espgui::StaticText<TEXT_NTPSERVER>,
@ -102,7 +101,6 @@ public:
return fmt::format("Status: {}", espcpputils::toString(sntp_get_sync_status()));
}
};
#endif
} // namespace
TimeSettingsMenu::TimeSettingsMenu()
@ -112,13 +110,14 @@ TimeSettingsMenu::TimeSettingsMenu()
constructMenuItem<makeComponent<MenuItem, CurrentLocalDateTimeText, StaticFont<2>, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_OFFSET>, SwitchScreenAction<TimezoneOffsetChangeDisplay>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DAYLIGHTSAVINGMODE>, SwitchScreenAction<DaylightSavingModeChangeDisplay>>>();
#ifdef FEATURE_NTP
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_NTPENABLED>, BobbyCheckbox, TimeServerEnabledAccessor>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_NTPSERVER>, SwitchScreenAction<TimeServerChangeDisplay>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_NTPMODE>, SwitchScreenAction<TimeSyncModeChangeDisplay>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_NTPINTERVAL>, SwitchScreenAction<TimeSyncIntervalChangeDisplay>>>();
constructMenuItem<makeComponent<MenuItem, NtpSyncStatusText, DummyAction>>();
#endif
if (configs.feature.ntp.value)
{
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_NTPENABLED>, BobbyCheckbox, TimeServerEnabledAccessor>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_NTPSERVER>, SwitchScreenAction<TimeServerChangeDisplay>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_NTPMODE>, SwitchScreenAction<TimeSyncModeChangeDisplay>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_NTPINTERVAL>, SwitchScreenAction<TimeSyncIntervalChangeDisplay>>>();
constructMenuItem<makeComponent<MenuItem, NtpSyncStatusText, DummyAction>>();
}
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<SettingsMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
}

View File

@ -14,7 +14,6 @@
#include "displays/menus/settingsmenu.h"
#include "bobbycheckbox.h"
#ifdef FEATURE_UDPCLOUD
namespace {
constexpr char TEXT_UDPCLOUDSETTINGS[] = "UDP Cloud settings";
constexpr char TEXT_UDPCLOUDENABLED[] = "Udp Cloud enabled";
@ -50,4 +49,3 @@ void UdpCloudSettingsMenu::back()
{
switchScreen<SettingsMenu>();
}
#endif

View File

@ -3,7 +3,6 @@
// local includes
#include "displays/bobbymenudisplay.h"
#ifdef FEATURE_UDPCLOUD
class UdpCloudSettingsMenu : public BobbyMenuDisplay
{
public:
@ -13,4 +12,3 @@ public:
void back() override;
};
#endif

View File

@ -103,7 +103,8 @@ void StatusDisplay::redraw()
tft.fillRect(0, tft.height()-6, tft.width(), 6, TFT_BLACK);
}
}
#ifdef FEATURE_LEDSTRIP
if(configs.feature.ledstrip.value)
{
static bool blink_fill_with_black;
if (configs.ledstrip.enableVisualizeBlink.value && (espchrono::utc_clock::now().time_since_epoch() % 750ms < 375ms) && (blinkAnimation > 0))
@ -126,7 +127,6 @@ void StatusDisplay::redraw()
m_progressBarGas.start();
}
}
#endif
tft.setTextFont(2);
m_labelRawGas.redraw(raw_gas ? std::to_string(*raw_gas) : "?");
@ -150,16 +150,18 @@ void StatusDisplay::redraw()
m_backStatus.redraw(controllers.back);
tft.setTextFont(2);
#ifdef FEATURE_UDPCLOUD
if(configs.udpCloudSettings.udpCloudEnabled.value && configs.udpCloudSettings.enableCloudDebug.value)
if (configs.feature.udpcloud.value)
{
tft.fillRect(125, 258, 8, 8, (visualSendUdpPacket) ? TFT_DARKGREY : TFT_BLACK);
if(configs.udpCloudSettings.udpCloudEnabled.value && configs.udpCloudSettings.enableCloudDebug.value)
{
tft.fillRect(125, 258, 8, 8, (visualSendUdpPacket) ? TFT_DARKGREY : TFT_BLACK);
}
// else // is not needed because of redraw
// {
// tft.fillRect(125, 258, 8, 8, TFT_BLACK);
// }
}
// else // is not needed because of redraw
// {
// tft.fillRect(125, 258, 8, 8, TFT_BLACK);
// }
#endif
const auto staStatus = wifi_stack::get_sta_status();
if (staStatus == wifi_stack::WiFiStaStatus::CONNECTED)

View File

@ -10,10 +10,8 @@
// 3rdparty lib includes
#include <tftinstance.h>
#include <screenmanager.h>
#ifdef FEATURE_OTA
#include <espasyncota.h>
#include <esp_ota_ops.h>
#endif
// local includes
#include "globals.h"
@ -21,7 +19,6 @@
#include "displays/menus/otamenu.h"
#include "newsettings.h"
#ifdef FEATURE_OTA
void UpdateDisplay::initScreen()
{
Base::initScreen();
@ -118,4 +115,3 @@ void UpdateDisplay::buttonPressed(espgui::Button button)
default:;
}
}
#endif

View File

@ -7,7 +7,6 @@
// local includes
#include "bobbydisplay.h"
#ifdef FEATURE_OTA
class UpdateDisplay : public BobbyDisplay
{
using Base = BobbyDisplay;
@ -28,4 +27,3 @@ private:
espgui::Label m_newVersionLabel{20, 275};
};
#endif

View File

@ -1,14 +1,16 @@
// 3rd party
#ifdef FEATURE_DNS_NS
#include "dnsannounce.h"
// system includes
#include "lwip/dns.h"
// 3rdparty includes
#include <cpputils.h>
#include <randomutils.h>
#include <esprandom.h>
#include <espwifistack.h>
#include <FastLED.h>
// local
#include "dnsannounce.h"
#include "espwifistack.h"
#include "cpputils.h"
#include "lwip/dns.h"
// local includes
#include "globals.h"
#include "newsettings.h"
@ -22,7 +24,7 @@ void init_dns_announce()
void handle_dns_announce()
{
if (!configs.dns_announce_enabled.value)
if (!configs.feature.dnsannounce.value || !configs.dns_announce_enabled.value)
return;
if (wifi_stack::get_sta_status() != wifi_stack::WiFiStaStatus::CONNECTED)
@ -113,4 +115,3 @@ void handle_dns_announce()
dns_lastIpAddress_v6_global = "-";
}
}
#endif

View File

@ -3,11 +3,9 @@
// system includes
#include <string>
#ifdef FEATURE_DNS_NS
extern std::string dns_lastIpAddress_v4;
extern std::string dns_lastIpAddress_v6;
extern std::string dns_lastIpAddress_v6_global;
void init_dns_announce();
void handle_dns_announce();
#endif

View File

@ -85,9 +85,10 @@ std::array<bool, 10> Helper<OUT, IN1, IN2, IN3, IN4, IN5>::read()
result[7] = digitalRead(IN4);
result[9] = digitalRead(IN5);
#ifdef FEATURE_GSCHISSENE_DIODE
if (result[8] && result[9]) result[9] = 0;
#endif
if (configs.feature.gschissene_diode.value && (result[8] && result[9]))
{
result[9] = 0;
}
return result;
}

View File

@ -1,4 +1,3 @@
#ifdef FEATURE_ESPNOW
#include "espnowfunctions.h"
#include <espchrono.h>
@ -309,4 +308,3 @@ esp_err_t send_espnow_message(std::string_view message)
}
} // namespace espnow
#endif

View File

@ -1,5 +1,4 @@
#pragma once
#ifdef FEATURE_ESPNOW
#include <cstdint>
#include <deque>
#include <string>
@ -29,4 +28,4 @@ void handle();
void onRecvTs(uint64_t millis, bool isFromBobbycar = false);
esp_err_t send_espnow_message(std::string_view message);
} // namespace espnow
#endif

View File

@ -41,8 +41,10 @@ class HeapLargest32Text : public virtual espgui::TextInterface { public: std::st
class LastRebootReasonText : public virtual espgui::TextInterface { public: std::string text() const override {
return fmt::format("Last Reboot Reason: {}", espcpputils::toString(esp_reset_reason())); }};
#ifdef FEATURE_CAN
class CanIcCrashText : public virtual espgui::TextInterface { public: std::string text() const override {
return fmt::format("CAN IC reseted: {}", can::can_total_error_cnt); }};
#endif
constexpr char TEXT_ESPCHIPREVISION[] = "Chip revision: ";
using EspChipRevisionText = espgui::StaticText<TEXT_ESPCHIPREVISION>; //EspStatusTextHelper<TEXT_ESPCHIPREVISION, uint8_t, &EspClass::getChipRevision>;

View File

@ -32,8 +32,6 @@ bool simplified =
ProfileSettings profileSettings;
SettingsPersister settingsPersister;
std::array<CRGB, 8> ledstrip_custom_colors;
Controllers controllers;
#ifdef FEATURE_BLUETOOTH

View File

@ -55,8 +55,6 @@ extern bool simplified;
extern ProfileSettings profileSettings;
extern SettingsPersister settingsPersister;
extern std::array<CRGB, 8> ledstrip_custom_colors;
class Controllers : public std::array<Controller, 2>
{
public:

View File

@ -1,7 +1,6 @@
#include "bluetooth.h"
namespace bobbyicons {
#if defined(FEATURE_BLUETOOTH) || defined(FEATURE_BLE)
const espgui::Icon<24, 24> bluetooth{{
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x120F, 0x1A50, 0x0000, 0x01CF, 0x2AB1, 0x3B12, 0x4333, 0x4333, 0x3AF2, 0x2AB1, 0x01EF, // 0x0010 (16) pixels
0x0000, 0x1A50, 0x1210, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1210, 0x018E, 0x0007, 0x2AB1, // 0x0020 (32) pixels
@ -40,5 +39,4 @@ const espgui::Icon<24, 24> bluetooth{{
0x19ED, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0230 (560) pixels
0x00A6, 0x21EC, 0x2A6F, 0x32B1, 0x32B1, 0x2A6F, 0x19EC, 0x00A6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0240 (576) pixels
}, "bluetooth"};
#endif
} // namespace bobbyicons

View File

@ -3,7 +3,5 @@
#include "icon.h"
namespace bobbyicons {
#if defined(FEATURE_BLUETOOTH) || defined(FEATURE_BLE)
extern const espgui::Icon<24, 24> bluetooth;
#endif
} // namespace bobbyicons

View File

@ -13,7 +13,6 @@
using namespace std::chrono_literals;
#ifdef FEATURE_LEDSTRIP
std::vector<CRGB> leds;
uint8_t gHue = 0;
@ -22,13 +21,19 @@ uint16_t blinkAnimation = LEDSTRIP_OVERWRITE_NONE;
void initLedStrip()
{
leds.resize(configs.ledstrip.ledsCount.value);
FastLED.addLeds<NEOPIXEL, PINS_LEDSTRIP>(&*std::begin(leds), leds.size())
.setCorrection(TypicalSMD5050);
if (configs.feature.ledstrip.value)
{
leds.resize(configs.ledstrip.ledsCount.value);
FastLED.addLeds<NEOPIXEL, PINS_LEDSTRIP>(&*std::begin(leds), leds.size())
.setCorrection(TypicalSMD5050);
}
}
void updateLedStrip()
{
if(!configs.feature.ledstrip.value)
return;
EVERY_N_MILLISECONDS( 20 ) { gHue++; }
static bool have_disabled_beeper = false;
const bool enAnim = configs.ledstrip.enableAnimBlink.value;
@ -195,9 +200,7 @@ void showAnimation()
{
if (configs.ledstrip.enableLedAnimation.value
&& !simplified
#ifdef FEATURE_OTA
&& !(asyncOtaTaskStarted && configs.ledstrip.otaMode.value != OtaAnimationModes::None)
#endif
)
{
switch (configs.ledstrip.animationType.value)
@ -209,20 +212,17 @@ void showAnimation()
default: showDefaultLedstrip();
}
}
#ifdef FEATURE_OTA
else if (asyncOtaTaskStarted && configs.ledstrip.otaMode.value != OtaAnimationModes::None)
{
// show ota animation
showOtaAnimation();
}
#endif
else
{
std::fill(std::begin(leds), std::end(leds), CRGB{0, 0, 0});
}
}
#ifdef FEATURE_OTA
void showOtaAnimation()
{
std::fill(std::begin(leds), std::end(leds), CRGB{0,0,0});
@ -251,7 +251,6 @@ void showOtaAnimation()
}
}
}
#endif
void showBetterRainbow()
{
@ -280,12 +279,6 @@ void fill_rainbow_invert_at( struct CRGB * pFirstLED, int numToFill, int invertA
void showSpeedSyncAnimation()
{
#ifdef LEDS_PER_METER
const float leds_per_meter = LEDS_PER_METER;
#else
const float leds_per_meter = 144;
#endif
static auto last_interval = espchrono::millis_clock::now();
const auto difference_ms = espchrono::ago(last_interval) / 1ms;
@ -293,7 +286,7 @@ void showSpeedSyncAnimation()
const float hue_per_led = 1. / std::max(uint8_t(1), uint8_t(configs.ledstrip.animationMultiplier.value));
const float meter_per_second = avgSpeedKmh / 3.6;
const float leds_per_second = meter_per_second * leds_per_meter;
const float leds_per_second = meter_per_second * configs.ledstrip.leds_per_meter.value;
const float hue_per_second = leds_per_second * hue_per_led;
hue_result += hue_per_second * difference_ms / 1000.f;
@ -320,32 +313,30 @@ void showCustomColor()
const auto eighth_length = leds.size() / 8;
const auto center = (std::begin(leds) + (leds.size() / 2) + configs.ledstrip.centerOffset.value);
std::fill(std::begin(leds), std::end(leds), ledstrip_custom_colors[int(Bobbycar_Side::FRONT)]); // Front
std::fill(center - (eighth_length / 2), center + (eighth_length / 2), ledstrip_custom_colors[int(Bobbycar_Side::BACK)]); // Back
std::fill(std::begin(leds), std::end(leds), configs.ledstrip.custom_color[int(Bobbycar_Side::FRONT)].value); // Front
std::fill(center - (eighth_length / 2), center + (eighth_length / 2), configs.ledstrip.custom_color[int(Bobbycar_Side::BACK)].value); // Back
#ifdef LEDSTRIP_WRONG_DIRECTION
std::fill(center + (eighth_length / 2), center + (eighth_length / 2) + eighth_length, ledstrip_custom_colors[int(Bobbycar_Side::BACK_LEFT)]); // Back Left
std::fill(center - (eighth_length / 2) - eighth_length, center - (eighth_length / 2), ledstrip_custom_colors[int(Bobbycar_Side::BACK_RIGHT)]); // Back Right
std::fill(center + (eighth_length / 2), center + (eighth_length / 2) + eighth_length, configs.ledstrip.custom_color[int(Bobbycar_Side::BACK_LEFT)].value); // Back Left
std::fill(center - (eighth_length / 2) - eighth_length, center - (eighth_length / 2), configs.ledstrip.custom_color[int(Bobbycar_Side::BACK_RIGHT)].value); // Back Right
#else
std::fill(center + (eighth_length / 2), center + (eighth_length / 2) + eighth_length, ledstrip_custom_colors[int(Bobbycar_Side::BACK_RIGHT)]); // Back Right
std::fill(center - (eighth_length / 2) - eighth_length, center - (eighth_length / 2), ledstrip_custom_colors[int(Bobbycar_Side::BACK_LEFT)]); // Back Left
std::fill(center + (eighth_length / 2), center + (eighth_length / 2) + eighth_length, configs.ledstrip.custom_color[int(Bobbycar_Side::BACK_RIGHT)].value); // Back Right
std::fill(center - (eighth_length / 2) - eighth_length, center - (eighth_length / 2), configs.ledstrip.custom_color[int(Bobbycar_Side::BACK_LEFT)].value); // Back Left
#endif
#ifdef LEDSTRIP_WRONG_DIRECTION
std::fill(center + (eighth_length / 2) + eighth_length, center + (eighth_length / 2) + eighth_length + eighth_length, ledstrip_custom_colors[int(Bobbycar_Side::LEFT)]); // Left
std::fill(center - (eighth_length / 2) - eighth_length - eighth_length, center - (eighth_length / 2) - eighth_length, ledstrip_custom_colors[int(Bobbycar_Side::RIGHT)]); // Right
std::fill(center + (eighth_length / 2) + eighth_length, center + (eighth_length / 2) + eighth_length + eighth_length, configs.ledstrip.custom_color[int(Bobbycar_Side::LEFT)].value); // Left
std::fill(center - (eighth_length / 2) - eighth_length - eighth_length, center - (eighth_length / 2) - eighth_length, configs.ledstrip.custom_color[int(Bobbycar_Side::RIGHT)].value); // Right
#else
std::fill(center + (eighth_length / 2) + eighth_length, center + (eighth_length / 2) + eighth_length + eighth_length, ledstrip_custom_colors[int(Bobbycar_Side::RIGHT)]); // Right
std::fill(center - (eighth_length / 2) - eighth_length - eighth_length, center - (eighth_length / 2) - eighth_length, ledstrip_custom_colors[int(Bobbycar_Side::LEFT)]); // Left
std::fill(center + (eighth_length / 2) + eighth_length, center + (eighth_length / 2) + eighth_length + eighth_length, configs.ledstrip.custom_color[int(Bobbycar_Side::RIGHT)].value); // Right
std::fill(center - (eighth_length / 2) - eighth_length - eighth_length, center - (eighth_length / 2) - eighth_length, configs.ledstrip.custom_color[int(Bobbycar_Side::LEFT)].value); // Left
#endif
#ifdef LEDSTRIP_WRONG_DIRECTION
std::fill(center + (eighth_length / 2) + eighth_length + eighth_length, center + (eighth_length / 2) + eighth_length + eighth_length + eighth_length, ledstrip_custom_colors[int(Bobbycar_Side::FRONT_LEFT)]); // Front Left
std::fill(center - (eighth_length / 2) - eighth_length - eighth_length - eighth_length, center - (eighth_length / 2) - eighth_length - eighth_length, ledstrip_custom_colors[int(Bobbycar_Side::FRONT_RIGHT)]); // Front Right
std::fill(center + (eighth_length / 2) + eighth_length + eighth_length, center + (eighth_length / 2) + eighth_length + eighth_length + eighth_length, configs.ledstrip.custom_color[int(Bobbycar_Side::FRONT_LEFT)].value); // Front Left
std::fill(center - (eighth_length / 2) - eighth_length - eighth_length - eighth_length, center - (eighth_length / 2) - eighth_length - eighth_length, configs.ledstrip.custom_color[int(Bobbycar_Side::FRONT_RIGHT)].value); // Front Right
#else
std::fill(center + (eighth_length / 2) + eighth_length + eighth_length, center + (eighth_length / 2) + eighth_length + eighth_length + eighth_length, ledstrip_custom_colors[int(Bobbycar_Side::FRONT_RIGHT)]); // Front Right
std::fill(center - (eighth_length / 2) - eighth_length - eighth_length - eighth_length, center - (eighth_length / 2) - eighth_length - eighth_length, ledstrip_custom_colors[int(Bobbycar_Side::FRONT_LEFT)]); // Front Left
std::fill(center + (eighth_length / 2) + eighth_length + eighth_length, center + (eighth_length / 2) + eighth_length + eighth_length + eighth_length, configs.ledstrip.custom_color[int(Bobbycar_Side::FRONT_RIGHT)].value); // Front Right
std::fill(center - (eighth_length / 2) - eighth_length - eighth_length - eighth_length, center - (eighth_length / 2) - eighth_length - eighth_length, configs.ledstrip.custom_color[int(Bobbycar_Side::FRONT_LEFT)].value); // Front Left
#endif
}
#endif

View File

@ -23,7 +23,6 @@ DECLARE_BOBBYTYPESAFE_ENUM(OtaAnimationModes, : uint8_t, OtaAnimationModesValues
x(CustomColor)
DECLARE_BOBBYTYPESAFE_ENUM(LedstripAnimation, : uint8_t, LedstripAnimationValues)
#ifdef FEATURE_LEDSTRIP
enum Bobbycar_Side
{
FRONT_RIGHT,
@ -46,10 +45,7 @@ void showAnimation();
void showBetterRainbow();
void showSpeedSyncAnimation();
void showCustomColor();
#ifdef FEATURE_OTA
void showOtaAnimation();
#endif
void initLedStrip();
void updateLedStrip();
#endif

View File

@ -107,7 +107,8 @@ extern "C" void app_main()
for (auto &schedulerTask : schedulerTasks)
{
schedulerTask.loop();
if (schedulerTask.isInitialized())
schedulerTask.loop();
}
if (!lastStatsUpdate || now - *lastStatsUpdate >= 1000ms/configs.boardcomputerHardware.timersSettings.statsUpdateRate.value)

View File

@ -52,6 +52,21 @@ public:
staticDns2 {wifi_stack::ip_address_t{}, DoReset, {}, staticDns2Key }
{}
WiFiConfig(const char *ssidNvsKey, const char *keyNvsKey,
const char *useStaticIpKey, const char *staticIpKey, const char *staticSubnetKey, const char *staticGatewayKey,
const char *useStaticDnsKey, const char *staticDns0Key, const char *staticDns1Key, const char *staticDns2Key, const char *default_ssid, const char *default_key) :
ssid {default_ssid, DoReset, StringMaxSize<32>, ssidNvsKey },
key {default_key, DoReset, StringOr<StringEmpty, StringMinMaxSize<8, 64>>, keyNvsKey },
useStaticIp {false, DoReset, {}, useStaticIpKey },
staticIp {wifi_stack::ip_address_t{}, DoReset, {}, staticIpKey },
staticSubnet {wifi_stack::ip_address_t{}, DoReset, {}, staticSubnetKey },
staticGateway{wifi_stack::ip_address_t{}, DoReset, {}, staticGatewayKey },
useStaticDns {false, DoReset, {}, useStaticDnsKey },
staticDns0 {wifi_stack::ip_address_t{}, DoReset, {}, staticDns0Key },
staticDns1 {wifi_stack::ip_address_t{}, DoReset, {}, staticDns1Key },
staticDns2 {wifi_stack::ip_address_t{}, DoReset, {}, staticDns2Key }
{}
ConfigWrapper<std::string> ssid;
ConfigWrapper<std::string> key;
ConfigWrapper<bool> useStaticIp;
@ -98,7 +113,7 @@ public:
ConfigWrapper<std::string> hostname {defaultHostname, DoReset, StringMinMaxSize<4, 32>, "hostname" };
ConfigWrapper<bool> wifiStaEnabled {true, DoReset, {}, "wifiStaEnabled" };
std::array<WiFiConfig, 10> wifi_configs {
WiFiConfig {"wifi_ssid0", "wifi_key0", "wifi_usestatic0", "wifi_static_ip0", "wifi_stati_sub0", "wifi_stat_gate0", "wifi_usestadns0", "wifi_stat_dnsA0", "wifi_stat_dnsB0", "wifi_stat_dnsC0"},
WiFiConfig {"wifi_ssid0", "wifi_key0", "wifi_usestatic0", "wifi_static_ip0", "wifi_stati_sub0", "wifi_stat_gate0", "wifi_usestadns0", "wifi_stat_dnsA0", "wifi_stat_dnsB0", "wifi_stat_dnsC0", "bobbycar", "12345678"},
WiFiConfig {"wifi_ssid1", "wifi_key1", "wifi_usestatic1", "wifi_static_ip1", "wifi_stati_sub1", "wifi_stat_gate1", "wifi_usestadns1", "wifi_stat_dnsA1", "wifi_stat_dnsB1", "wifi_stat_dnsC1"},
WiFiConfig {"wifi_ssid2", "wifi_key2", "wifi_usestatic2", "wifi_static_ip2", "wifi_stati_sub2", "wifi_stat_gate2", "wifi_usestadns2", "wifi_stat_dnsA2", "wifi_stat_dnsB2", "wifi_stat_dnsC2"},
WiFiConfig {"wifi_ssid3", "wifi_key3", "wifi_usestatic3", "wifi_static_ip3", "wifi_stati_sub3", "wifi_stat_gate3", "wifi_usestadns3", "wifi_stat_dnsA3", "wifi_stat_dnsB3", "wifi_stat_dnsC3"},
@ -250,6 +265,17 @@ public:
ConfigWrapper<OtaAnimationModes> otaMode {OtaAnimationModes::GreenProgressBar, DoReset, {}, "ledOtaAnim" };
ConfigWrapper<uint32_t> maxMilliamps {3000, DoReset, {}, "ledMaxMilliamps" };
ConfigWrapper<bool> enableVisualizeBlink {false, DoReset, {}, "enVisualBlink" };
std::array<ConfigWrapper<uint32_t>, 8> custom_color {
ConfigWrapper<uint32_t> {0, DoReset, {}, "ledCustomCol1" },
ConfigWrapper<uint32_t> {0, DoReset, {}, "ledCustomCol2" },
ConfigWrapper<uint32_t> {0, DoReset, {}, "ledCustomCol3" },
ConfigWrapper<uint32_t> {0, DoReset, {}, "ledCustomCol4" },
ConfigWrapper<uint32_t> {0, DoReset, {}, "ledCustomCol5" },
ConfigWrapper<uint32_t> {0, DoReset, {}, "ledCustomCol6" },
ConfigWrapper<uint32_t> {0, DoReset, {}, "ledCustomCol7" },
ConfigWrapper<uint32_t> {0, DoReset, {}, "ledCustomCol8" },
};
ConfigWrapper<uint8_t> leds_per_meter {144, DoReset, {}, "ledsPerMeter" };
} ledstrip;
struct {
@ -294,6 +320,21 @@ public:
ConfigWrapper<bool> syncBlink {false, DoReset, {}, "espnowSyncBl" };
} espnow;
struct {
ConfigWrapper<bool> ledstrip {false, DoReset, {}, "f_ledstrip" };
ConfigWrapper<bool> webserver_disable_lock{false, DoReset, {}, "f_no_web_lock" };
ConfigWrapper<bool> garage {false, DoReset, {}, "f_garage" };
ConfigWrapper<bool> cloud {false, DoReset, {}, "f_cloud" };
ConfigWrapper<bool> udpcloud {false, DoReset, {}, "f_udpcloud" };
ConfigWrapper<bool> dnsannounce {false, DoReset, {}, "f_dnsannounce" };
ConfigWrapper<bool> ntp {false, DoReset, {}, "f_ntp" };
ConfigWrapper<bool> ble {false, DoReset, {}, "f_ble" };
ConfigWrapper<bool> ota {false, DoReset, {}, "f_ota" };
ConfigWrapper<bool> webserver {true, DoReset, {}, "featureWebserv" };
ConfigWrapper<bool> gschissene_diode {false, DoReset, {}, "featurDiodeHin" };
ConfigWrapper<bool> esp_now {false, DoReset, {}, "featureEspNow" };
} feature;
struct {
ConfigWrapper<bool> bleEnabled {true, DoReset, {}, "bleEnabled" };
} bleSettings;
@ -542,6 +583,17 @@ public:
x(ledstrip.maxMilliamps) \
x(ledstrip.enableVisualizeBlink) \
\
x(ledstrip.custom_color[0]) \
x(ledstrip.custom_color[1]) \
x(ledstrip.custom_color[2]) \
x(ledstrip.custom_color[3]) \
x(ledstrip.custom_color[4]) \
x(ledstrip.custom_color[5]) \
x(ledstrip.custom_color[6]) \
x(ledstrip.custom_color[7]) \
\
x(ledstrip.leds_per_meter) \
\
x(battery.cellsSeries) \
x(battery.cellsParallel) \
x(battery.cellType) \
@ -570,9 +622,36 @@ public:
\
x(espnow.syncTime) \
x(espnow.syncTimeWithOthers) \
x(espnow.syncBlink)
x(espnow.syncBlink) \
\
x(feature.ledstrip) \
x(feature.webserver_disable_lock) \
x(feature.garage) \
x(feature.udpcloud) \
x(feature.cloud) \
x(feature.dnsannounce) \
x(feature.ntp) \
x(feature.ble) \
x(feature.ota) \
x(feature.webserver) \
x(feature.gschissene_diode) \
x(feature.esp_now)
//x(bleSettings.bleEnabled)
#define FEATURES(x) \
x(feature.ledstrip) \
x(feature.webserver_disable_lock) \
x(feature.garage) \
x(feature.udpcloud) \
x(feature.cloud) \
x(feature.dnsannounce) \
x(feature.ntp) \
x(feature.ble) \
x(feature.ota) \
x(feature.esp_now) \
x(feature.webserver)
//x(feature.gschisseneDiode)
template<typename T>
void callForEveryConfig(T &&callback)
{
@ -591,6 +670,25 @@ public:
std::ref<ConfigWrapperInterface>(bleSettings.bleEnabled)
);
}
template<typename T>
void callForEveryFeature(T &&callback)
{
#define HELPER(x) callback(x);
FEATURES(HELPER)
#undef HELPER
callback(feature.gschissene_diode);
}
auto getAllFeatureParams()
{
return cpputils::make_array(
#define HELPER(x) std::ref<ConfigWrapperInterface>(x),
FEATURES(HELPER)
#undef HELPER
std::ref<ConfigWrapperInterface>(feature.gschissene_diode)
);
}
};
extern ConfigManager<ConfigContainer> configs;

View File

@ -6,7 +6,9 @@
// 3rdparty lib includes
#include <espwifistack.h>
#ifdef FEATURE_OTA
// local includes
#include "globals.h"
cpputils::DelayedConstruction<EspAsyncOta> asyncOta;
bool asyncOtaTaskStarted{};
@ -26,6 +28,9 @@ void handleOta()
tl::expected<void, std::string> triggerOta(std::string_view url)
{
if (!configs.feature.ota.value)
return tl::make_unexpected("OTA is not enabled!");
ESP_LOGI(TAG, "%.*s", url.size(), url.data());
if (!asyncOta)
@ -49,4 +54,3 @@ tl::expected<void, std::string> triggerOta(std::string_view url)
return {};
}
#endif

View File

@ -1,18 +1,12 @@
#pragma once
// 3rdparty lib includes
#ifdef FEATURE_OTA
#include <espasyncota.h>
#endif
#include <delayedconstruction.h>
// local includes
#ifdef FEATURE_OTA
extern cpputils::DelayedConstruction<EspAsyncOta> asyncOta;
extern bool asyncOtaTaskStarted;
void initOta();
void handleOta();
tl::expected<void, std::string> triggerOta(std::string_view url);
#endif

View File

@ -1,20 +1,7 @@
#pragma once
// esp-idf includes
#ifdef FEATURE_NTP
#include <lwip/apps/snmp.h>
#include <esp_sntp.h>
#endif
// 3rdparty lib includes
#include <espchrono.h>
// local includes
#include "profilesettings.h"
#include "ledstripdefines.h"
#include "ledstrip.h"
using namespace std::chrono_literals;
namespace presets {
constexpr ProfileSettings::Limits defaultLimits {

View File

@ -2,21 +2,8 @@
// system includes
#include <cstdint>
#include <array>
#include <FastLED.h>
// esp-idf includes
#include <esp_wifi_types.h>
#ifdef FEATURE_NTP
#include <lwip/apps/snmp.h>
#include <esp_sntp.h>
#endif
// 3rdparty lib includes
#include <espchrono.h>
// local includes
#include "bobbycar-common.h"
#include "unifiedmodelmode.h"
#include "modes/larsmmode.h"

View File

@ -6,10 +6,8 @@
// esp-idf includes
#include <esp_log.h>
#include <nvs_flash.h>
#ifdef FEATURE_NTP
#include <lwip/apps/snmp.h>
#include <esp_sntp.h>
#endif
// 3rdparty lib includes
#include <fmt/core.h>
@ -209,7 +207,6 @@ template<> struct nvsGetterHelper<espchrono::hours32> { static esp_err_t nvs_get
*out_value = espchrono::hours32(tempValue);
return err;
}};
#ifdef FEATURE_NTP
template<> struct nvsGetterHelper<sntp_sync_mode_t> { static esp_err_t nvs_get(nvs_handle handle, const char* key, sntp_sync_mode_t* out_value)
{
uint8_t tempValue;
@ -218,7 +215,6 @@ template<> struct nvsGetterHelper<sntp_sync_mode_t> { static esp_err_t nvs_get(n
*out_value = sntp_sync_mode_t(tempValue);
return err;
}};
#endif
template<> struct nvsGetterHelper<std::array<int8_t, 4>> { static esp_err_t nvs_get(nvs_handle handle, const char* key, std::array<int8_t, 4>* out_value)
{
uint32_t tempValue;
@ -322,12 +318,10 @@ template<> struct nvsSetterHelper<espchrono::hours32> { static esp_err_t nvs_set
{
return nvs_set_i32(handle, key, value.count());
}};
#ifdef FEATURE_NTP
template<> struct nvsSetterHelper<sntp_sync_mode_t> { static esp_err_t nvs_set(nvs_handle handle, const char* key, sntp_sync_mode_t value)
{
return nvs_set_u8(handle, key, uint8_t(value));
}};
#endif
template<> struct nvsSetterHelper<std::array<int8_t, 4>> { static esp_err_t nvs_set(nvs_handle handle, const char* key, std::array<int8_t, 4> value)
{
return nvs_set_u32(handle, key, std::bit_cast<uint32_t>(value));

View File

@ -9,9 +9,6 @@
// esp-idf includes
#include <esp_log.h>
// 3rdparty lib includes
#include <schedulertask.h>
// local includes
#include "wifi_bobbycar.h"
#include "dpad.h"
@ -33,9 +30,7 @@
#ifdef FEATURE_MOSFETS
#include "mosfets.h"
#endif
#ifdef FEATURE_NTP
#include "time_bobbycar.h"
#endif
#include "potis.h"
#ifdef FEATURE_BLUETOOTH
#include "bluetooth_bobby.h"
@ -50,32 +45,16 @@
#ifdef FEATURE_SERIAL
#include "serial_bobby.h"
#endif
#ifdef FEATURE_OTA
#include "ota.h"
#endif
#ifdef FEATURE_BLE
#include "ble_bobby.h"
#endif
#ifdef FEATURE_WEBSERVER
#include "webserver.h"
#endif
#ifdef FEATURE_LEDSTRIP
#include "ledstrip.h"
#endif
#ifdef FEATURE_ESPNOW
#include "espnowfunctions.h"
#endif
#ifdef FEATURE_CLOUD
#include "cloud.h"
#endif
#ifdef FEATURE_UDPCLOUD
#include "udpcloud.h"
#endif
#include "modes.h"
#include "drivingstatistics.h"
#ifdef FEATURE_DNS_NS
#include "dnsannounce.h"
#endif
#include "screens.h"
using namespace std::chrono_literals;
@ -85,81 +64,63 @@ constexpr const char * const TAG = "TASKS";
void not_needed() {}
espcpputils::SchedulerTask schedulerTasksArr[] {
espcpputils::SchedulerTask { "wifi", wifi_begin, wifi_update, 100ms },
BobbySchedulerTask schedulerTasksArr[] {
BobbySchedulerTask { "wifi", wifi_begin, wifi_update, 100ms },
#ifdef FEATURE_DPAD
espcpputils::SchedulerTask { "dpad", dpad::init, dpad::update, 20ms },
BobbySchedulerTask { "dpad", dpad::init, dpad::update, 20ms },
#endif
#ifdef FEATURE_DPAD_3WIRESW
espcpputils::SchedulerTask { "dpad3wire", dpad3wire::init, dpad3wire::update, 20ms },
BobbySchedulerTask { "dpad3wire", dpad3wire::init, dpad3wire::update, 20ms },
#endif
#ifdef FEATURE_DPAD_5WIRESW
espcpputils::SchedulerTask { "dpad5wire", dpad5wire::init, dpad5wire::update, 20ms },
BobbySchedulerTask { "dpad5wire", dpad5wire::init, dpad5wire::update, 20ms },
#endif
#ifdef FEATURE_DPAD_5WIRESW_2OUT
espcpputils::SchedulerTask { "dpad5wire_2out", dpad5wire_2out::init, dpad5wire_2out::update, 20ms },
BobbySchedulerTask { "dpad5wire_2out", dpad5wire_2out::init, dpad5wire_2out::update, 20ms },
#endif
#ifdef FEATURE_DPAD_6WIRESW
espcpputils::SchedulerTask { "dpad6wire", dpad6wire::init, dpad6wire::update, 20ms },
BobbySchedulerTask { "dpad6wire", dpad6wire::init, dpad6wire::update, 20ms },
#endif
#ifdef FEATURE_ROTARY
espcpputils::SchedulerTask { "rotary", initRotary, updateRotary, 20ms },
BobbySchedulerTask { "rotary", initRotary, updateRotary, 20ms },
#endif
#ifdef FEATURE_MOSFETS
espcpputils::SchedulerTask { "mosfets", init_mosfets, update_mosfets, 100ms },
BobbySchedulerTask { "mosfets", init_mosfets, update_mosfets, 100ms },
#endif
#ifdef FEATURE_NTP
espcpputils::SchedulerTask { "time", initTime, updateTime, 100ms },
#endif
espcpputils::SchedulerTask { "potis", initPotis, readPotis, 20ms },
BobbySchedulerTask { "time", initTime, updateTime, 100ms },
BobbySchedulerTask { "potis", initPotis, readPotis, 20ms },
#ifdef FEATURE_BLUETOOTH
espcpputils::SchedulerTask { "bluetooth", bluetooth_init, bluetooth_update, 100ms },
BobbySchedulerTask { "bluetooth", bluetooth_init, bluetooth_update, 100ms },
#ifdef FEATURE_BMS
espcpputils::SchedulerTask { "bms", bms::init, bms::update, 100ms },
BobbySchedulerTask { "bms", bms::init, bms::update, 100ms },
#endif
#endif
#ifdef FEATURE_CAN
espcpputils::SchedulerTask { "can", can::initCan, can::updateCan, 10ms },
BobbySchedulerTask { "can", can::initCan, can::updateCan, 10ms },
#endif
espcpputils::SchedulerTask { "debuginput", initDebugInput, handleDebugInput, 50ms },
BobbySchedulerTask { "debuginput", initDebugInput, handleDebugInput, 50ms },
#ifdef FEATURE_SERIAL
espcpputils::SchedulerTask { "serial", initSerial, updateSerial, 50ms },
BobbySchedulerTask { "serial", initSerial, updateSerial, 50ms },
#endif
#ifdef FEATURE_OTA
espcpputils::SchedulerTask { "ota", initOta, handleOta, 50ms },
#endif
#ifdef FEATURE_BLE
espcpputils::SchedulerTask { "ble", initBle, handleBle, 100ms },
#endif
#ifdef FEATURE_WEBSERVER
espcpputils::SchedulerTask { "webserver", initWebserver, handleWebserver, 100ms },
#endif
#ifdef FEATURE_LEDSTRIP
espcpputils::SchedulerTask { "ledstrip", initLedStrip, updateLedStrip, 30ms },
#endif
#ifdef FEATURE_ESPNOW
espcpputils::SchedulerTask { "espnow", espnow::initESPNow, espnow::handle, 100ms },
#endif
#ifdef FEATURE_CLOUD
espcpputils::SchedulerTask { "cloud", initCloud, updateCloud, 50ms },
#endif
#ifdef FEATURE_UDPCLOUD
espcpputils::SchedulerTask { "udpcloud", udpCloudInit, udpCloudUpdate, 50ms },
#endif
espcpputils::SchedulerTask { "drivingmode", initDrivingMode, updateDrivingMode, 20ms },
espcpputils::SchedulerTask { "drivingstatistics", initStatistics, calculateStatistics, 100ms },
#ifdef FEATURE_DNS_NS
espcpputils::SchedulerTask { "dnsannounce", init_dns_announce, handle_dns_announce, 100ms },
#endif
espcpputils::SchedulerTask { "updateDisp", not_needed, updateDisplay, 20ms },
espcpputils::SchedulerTask { "redrawDisp", not_needed, redrawDisplay, 20ms },
BobbySchedulerTask { "ota", initOta, handleOta, 50ms },
BobbySchedulerTask { "ble", initBle, handleBle, 100ms },
BobbySchedulerTask { "webserver", initWebserver, handleWebserver, 100ms },
BobbySchedulerTask { "ledstrip", initLedStrip, updateLedStrip, 30ms },
BobbySchedulerTask { "espnow", espnow::initESPNow, espnow::handle, 100ms },
BobbySchedulerTask { "cloud", initCloud, updateCloud, 50ms },
BobbySchedulerTask { "udpcloud", udpCloudInit, udpCloudUpdate, 50ms },
BobbySchedulerTask { "drivingmode", initDrivingMode, updateDrivingMode, 20ms },
BobbySchedulerTask { "drivingstatistics", initStatistics, calculateStatistics, 100ms },
BobbySchedulerTask { "dnsannounce", init_dns_announce, handle_dns_announce, 100ms },
BobbySchedulerTask { "updateDisp", not_needed, updateDisplay, 20ms },
BobbySchedulerTask { "redrawDisp", not_needed, redrawDisplay, 20ms },
};
} // namespace
cpputils::ArrayView<espcpputils::SchedulerTask> schedulerTasks{std::begin(schedulerTasksArr), std::end(schedulerTasksArr)};
cpputils::ArrayView<BobbySchedulerTask> schedulerTasks{std::begin(schedulerTasksArr), std::end(schedulerTasksArr)};
const espcpputils::SchedulerTask &drivingModeTask = []() -> const espcpputils::SchedulerTask & {
auto iter = std::find_if(std::begin(schedulerTasksArr), std::end(schedulerTasksArr), [](const espcpputils::SchedulerTask &task){
const BobbySchedulerTask &drivingModeTask = []() -> const BobbySchedulerTask & {
auto iter = std::find_if(std::begin(schedulerTasksArr), std::end(schedulerTasksArr), [](const BobbySchedulerTask &task){
return std::string_view{task.name()} == "drivingmode";
});
return *iter;

View File

@ -3,11 +3,11 @@
// 3rdparty lib includes
#include <arrayview.h>
// forward declares
namespace espcpputils { class SchedulerTask; }
// local includes
#include "bobbyschedulertask.h"
extern cpputils::ArrayView<espcpputils::SchedulerTask> schedulerTasks;
extern cpputils::ArrayView<BobbySchedulerTask> schedulerTasks;
extern const espcpputils::SchedulerTask &drivingModeTask;
extern const BobbySchedulerTask &drivingModeTask;
void sched_pushStats(bool printTasks);

View File

@ -2,10 +2,8 @@
// esp-idf includes
#include <esp_log.h>
#ifdef FEATURE_NTP
#include <lwip/apps/snmp.h>
#include <esp_sntp.h>
#endif
// 3rdparty lib includes
#include <espstrutils.h>
@ -30,7 +28,6 @@ namespace {
constexpr const char * const TAG = "BOBBYTIME";
} // namespace
#ifdef FEATURE_NTP
void time_sync_notification_cb(struct timeval *tv);
void initTime()
@ -54,6 +51,9 @@ void initTime()
void updateTime()
{
if (!configs.feature.ntp.value)
return;
if (bool(sntp_enabled()) != configs.timeServerEnabled.value)
{
if (configs.timeServerEnabled.value)
@ -107,7 +107,6 @@ void time_sync_notification_cb(struct timeval *tv)
else
ESP_LOGI("BOBBY", "nullptr");
}
#endif
void time_set_now(espchrono::utc_clock::time_point now)
{

View File

@ -7,9 +7,7 @@
espchrono::time_zone get_default_timezone() noexcept;
#ifdef FEATURE_NTP
void initTime();
void updateTime();
#endif
void time_set_now(espchrono::utc_clock::time_point now);

View File

@ -21,7 +21,6 @@
#include "drivingstatistics.h"
#include "newsettings.h"
#ifdef FEATURE_UDPCLOUD
using namespace std::chrono_literals;
namespace {
@ -40,6 +39,9 @@ void udpCloudInit()
void udpCloudUpdate()
{
if (!configs.feature.udpcloud.value)
return;
if (configs.udpCloudSettings.udpCloudEnabled.value && configs.udpCloudSettings.udpUid.touched())
sendUdpCloudPacket();
}
@ -372,4 +374,3 @@ void sendUdpCloudPacket()
visualSendUdpPacket = !visualSendUdpPacket;
}
}
#endif

View File

@ -3,7 +3,6 @@
// system includes
#include <string>
#ifdef FEATURE_UDPCLOUD
// Little "flash" on statusdisplay when udp stuff is happening
extern bool visualSendUdpPacket;
@ -14,4 +13,3 @@ void spamUdpBroadcast();
std::string buildUdpCloudJson();
std::string buildUdpCloudString();
void sendUdpCloudPacket();
#endif

View File

@ -61,3 +61,19 @@ float wattToMotorCurrent(float watt);
uint8_t time_to_percent(espchrono::milliseconds32 repeat, espchrono::milliseconds32 riseTime, espchrono::milliseconds32 fullTime, size_t numLeds, bool invert);
std::string local_clock_string();
int16_t map_analog_stick(uint16_t middle, uint16_t start, uint16_t end, uint16_t raw);
inline uint32_t CRGB_TO_UINT32(CRGB crgb)
{
return crgb.raw[0]<<16 | crgb.raw[1]<<8 | crgb.raw[2];
}
inline CRGB UINT32_TO_CRGB(uint32_t color)
{
CRGB crgb;
crgb.raw[0]=color>>16 & 0xFF;
crgb.raw[1]=color>>8 & 0xFF;
crgb.raw[2]=color & 0xFF;
return crgb;
}

View File

@ -20,20 +20,15 @@
// local includes
#include "webserver_lock.h"
#include "webserver_displaycontrol.h"
#ifdef FEATURE_OTA
#include "webserver_ota.h"
#endif
#include "webserver_settings.h"
#include "webserver_newsettings.h"
#ifdef OLD_NVS
#include "webserver_dumpnvs.h"
#endif
#include "globals.h"
#include "newsettings.h"
using namespace std::chrono_literals;
#ifdef FEATURE_WEBSERVER
namespace {
constexpr const char * const TAG = "BOBBYWEB";
@ -45,16 +40,42 @@ std::vector<std::pair<std::string, const espgui::MenuItemIcon*>> menuBuf{};
esp_err_t webserver_reboot_handler(httpd_req_t *req);
bool menuDisplayChanged();
esp_err_t webserver_status_handler(httpd_req_t *req);
} // namespace bobbywebserver
esp_err_t webserver_middleware_handler(httpd_req_t *req) {
const auto handler = reinterpret_cast<esp_err_t(*)(httpd_req_t*)>(req->user_ctx);
if (configs.feature.webserver_disable_lock.value)
{
return handler(req);
}
if (!webserver_lock.constructed())
{
webserver_lock.construct();
webserver_lock->take(portMAX_DELAY);
}
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
if (!helper.locked())
{
constexpr const std::string_view msg = "could not lock webserver_lock";
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
}
return handler(req);
}
} // namespace
httpd_handle_t httpdHandle;
void initWebserver()
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
webserver_lock.construct();
webserver_lock->take(portMAX_DELAY);
#endif
if(!configs.feature.webserver_disable_lock.value)
{
webserver_lock.construct();
webserver_lock->take(portMAX_DELAY);
}
{
httpd_config_t httpConfig HTTPD_DEFAULT_CONFIG();
@ -69,26 +90,22 @@ void initWebserver()
}
for (const httpd_uri_t &uri : {
httpd_uri_t { .uri = "/", .method = HTTP_GET, .handler = webserver_root_handler, .user_ctx = NULL },
httpd_uri_t { .uri = "/triggerRawButton", .method = HTTP_GET, .handler = webserver_triggerRawButton_handler, .user_ctx = NULL },
httpd_uri_t { .uri = "/triggerButton", .method = HTTP_GET, .handler = webserver_triggerButton_handler, .user_ctx = NULL },
httpd_uri_t { .uri = "/triggerItem", .method = HTTP_GET, .handler = webserver_triggerItem_handler, .user_ctx = NULL },
httpd_uri_t { .uri = "/setValue", .method = HTTP_GET, .handler = webserver_setValue_handler, .user_ctx = NULL },
httpd_uri_t { .uri = "/reboot", .method = HTTP_GET, .handler = webserver_reboot_handler, .user_ctx = NULL },
#ifdef FEATURE_OTA
httpd_uri_t { .uri = "/ota", .method = HTTP_GET, .handler = webserver_ota_handler, .user_ctx = NULL },
httpd_uri_t { .uri = "/otaPercent", .method = HTTP_GET, .handler = webserver_ota_percentage_handler, .user_ctx = NULL },
httpd_uri_t { .uri = "/triggerOta", .method = HTTP_GET, .handler = webserver_trigger_ota_handler, .user_ctx = NULL },
#endif
httpd_uri_t { .uri = "/settings", .method = HTTP_GET, .handler = webserver_settings_handler, .user_ctx = NULL },
httpd_uri_t { .uri = "/saveSettings", .method = HTTP_GET, .handler = webserver_saveSettings_handler, .user_ctx = NULL },
httpd_uri_t { .uri = "/newSettings", .method = HTTP_GET, .handler = webserver_newSettings_handler, .user_ctx = NULL },
httpd_uri_t { .uri = "/saveNewSettings", .method = HTTP_GET, .handler = webserver_saveNewSettings_handler, .user_ctx = NULL },
httpd_uri_t { .uri = "/resetNewSettings", .method = HTTP_GET, .handler = webserver_resetNewSettings_handler, .user_ctx = NULL },
#ifdef OLD_NVS
httpd_uri_t { .uri = "/dumpnvs", .method = HTTP_GET, .handler = webserver_dump_nvs_handler, .user_ctx = NULL },
#endif
httpd_uri_t { .uri = "/check", .method = HTTP_GET, .handler = webserver_status_handler, .user_ctx = NULL },
httpd_uri_t { .uri = "/", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_root_handler, },
httpd_uri_t { .uri = "/triggerRawButton", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_triggerRawButton_handler, },
httpd_uri_t { .uri = "/triggerButton", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_triggerButton_handler, },
httpd_uri_t { .uri = "/triggerItem", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_triggerItem_handler, },
httpd_uri_t { .uri = "/setValue", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_setValue_handler, },
httpd_uri_t { .uri = "/reboot", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_reboot_handler, },
httpd_uri_t { .uri = "/ota", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_ota_handler, },
httpd_uri_t { .uri = "/otaPercent", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_ota_percentage_handler, },
httpd_uri_t { .uri = "/triggerOta", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_trigger_ota_handler, },
httpd_uri_t { .uri = "/settings", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_settings_handler, },
httpd_uri_t { .uri = "/saveSettings", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_saveSettings_handler, },
httpd_uri_t { .uri = "/newSettings", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_newSettings_handler, },
httpd_uri_t { .uri = "/saveNewSettings", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_saveNewSettings_handler, },
httpd_uri_t { .uri = "/resetNewSettings", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_resetNewSettings_handler, },
httpd_uri_t { .uri = "/dumpnvs", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_dump_nvs_handler, },
httpd_uri_t { .uri = "/check", .method = HTTP_GET, .handler = webserver_middleware_handler, .user_ctx = (void*)&webserver_status_handler, },
})
{
const auto result = httpd_register_uri_handler(httpdHandle, &uri);
@ -100,11 +117,12 @@ void initWebserver()
void handleWebserver()
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
webserver_lock->give();
vTaskDelay(1);
webserver_lock->take(portMAX_DELAY);
#endif
if (!configs.feature.webserver_disable_lock.value)
{
webserver_lock->give();
vTaskDelay(1);
webserver_lock->take(portMAX_DELAY);
}
}
namespace {
@ -165,16 +183,8 @@ bool menuDisplayChanged()
esp_err_t webserver_status_handler(httpd_req_t *req)
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
if (!helper.locked())
{
constexpr const std::string_view msg = "could not lock webserver_lock";
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
}
#endif
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
std::string wants_json_query;
if (auto result = esphttpdutils::webserver_get_query(req))
wants_json_query = *result;
@ -207,4 +217,3 @@ esp_err_t webserver_status_handler(httpd_req_t *req)
}
} // namespace
#endif

View File

@ -1,14 +1,10 @@
#pragma once
// esp-idf includes
#ifdef FEATURE_WEBSERVER
#include <esp_http_server.h>
#endif
#ifdef FEATURE_WEBSERVER
extern httpd_handle_t httpdHandle;
void initWebserver();
void handleWebserver();
bool MenuDisplayChanged();
#endif

View File

@ -1,9 +1,7 @@
#include "webserver_displaycontrol.h"
// esp-idf includes
#ifdef FEATURE_WEBSERVER
#include <esp_http_server.h>
#endif
#include <esp_log.h>
// 3rdparty lib includes
@ -26,7 +24,6 @@
#include "webserver_lock.h"
#include "newsettings.h"
#ifdef FEATURE_WEBSERVER
using esphttpdutils::HtmlTag;
using namespace std::chrono_literals;
@ -36,15 +33,6 @@ constexpr const char * const TAG = "BOBBYWEB";
esp_err_t webserver_root_handler(httpd_req_t *req)
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
if (!helper.locked())
{
constexpr const std::string_view msg = "could not lock webserver_lock";
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
}
#endif
std::string body;
@ -180,10 +168,7 @@ esp_err_t webserver_root_handler(httpd_req_t *req)
{
HtmlTag pTag{"p", body};
body += "<b>Display control</b> - "
#ifdef FEATURE_OTA
"<a href=\"/ota\">Update</a> - "
#endif
"<a href=\"/settings\">Settings</a> - "
"<a href=\"/newSettings\">New Settings</a> - "
"<a href=\"/dumpnvs\">Dump NVS</a>";
@ -288,15 +273,6 @@ esp_err_t webserver_root_handler(httpd_req_t *req)
esp_err_t webserver_triggerRawButton_handler(httpd_req_t *req)
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
if (!helper.locked())
{
constexpr const std::string_view msg = "could not lock webserver_lock";
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
}
#endif
std::string query;
if (auto result = esphttpdutils::webserver_get_query(req))
@ -362,15 +338,6 @@ esp_err_t webserver_triggerRawButton_handler(httpd_req_t *req)
esp_err_t webserver_triggerButton_handler(httpd_req_t *req)
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
if (!helper.locked())
{
constexpr const std::string_view msg = "could not lock webserver_lock";
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
}
#endif
std::string query;
if (auto result = esphttpdutils::webserver_get_query(req))
@ -436,15 +403,7 @@ esp_err_t webserver_triggerButton_handler(httpd_req_t *req)
esp_err_t webserver_triggerItem_handler(httpd_req_t *req)
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
if (!helper.locked())
{
constexpr const std::string_view msg = "could not lock webserver_lock";
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
}
#endif
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
std::string query;
@ -525,15 +484,6 @@ esp_err_t webserver_triggerItem_handler(httpd_req_t *req)
esp_err_t webserver_setValue_handler(httpd_req_t *req)
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
if (!helper.locked())
{
constexpr const std::string_view msg = "could not lock webserver_lock";
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
}
#endif
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
@ -610,4 +560,3 @@ esp_err_t webserver_setValue_handler(httpd_req_t *req)
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Location", "/")
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::TemporaryRedirect, "text/html", "Ok, continue at <a href=\"/\">/</a>")
}
#endif

View File

@ -1,15 +1,11 @@
#pragma once
// esp-idf includes
#ifdef FEATURE_WEBSERVER
#include <esp_http_server.h>
#endif
#include <esp_err.h>
#ifdef FEATURE_WEBSERVER
esp_err_t webserver_root_handler(httpd_req_t *req);
esp_err_t webserver_triggerRawButton_handler(httpd_req_t *req);
esp_err_t webserver_triggerButton_handler(httpd_req_t *req);
esp_err_t webserver_triggerItem_handler(httpd_req_t *req);
esp_err_t webserver_setValue_handler(httpd_req_t *req);
#endif

View File

@ -1,9 +1,7 @@
#include "webserver_dumpnvs.h"
// esp-idf includes
#ifdef FEATURE_WEBSERVER
#include <esp_http_server.h>
#endif
#include <esp_log.h>
// 3rdparty lib includes
@ -38,9 +36,7 @@ typename std::enable_if<
!std::is_same<T, espchrono::minutes32>::value &&
!std::is_same<T, espchrono::DayLightSavingMode>::value &&
!std::is_same<T, UnifiedModelMode>::value
#if defined(FEATURE_LEDSTRIP) && defined(FEATURE_OTA)
&& !std::is_same<T, OtaAnimationModes>::value
#endif
, bool>::type
showInputForSetting(std::string_view key, T value, JsonObject &body)
{
@ -120,8 +116,6 @@ showInputForSetting(std::string_view key, T value, JsonObject &body)
return true;
}
#if defined(FEATURE_LEDSTRIP) && defined(FEATURE_OTA)
template<typename T>
typename std::enable_if<
std::is_same<T, OtaAnimationModes>::value
@ -131,21 +125,19 @@ showInputForSetting(std::string_view key, T value, JsonObject &body)
body[key] = int(value);
return true;
}
#endif
esp_err_t webserver_dump_nvs_handler(httpd_req_t *req)
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
if (!helper.locked())
{
constexpr const std::string_view msg = "could not lock webserver_lock";
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
}
#endif
DynamicJsonDocument doc(6144);
JsonObject settings = doc.createNestedObject("settings");
configs.callForEveryConfig([&](auto &config){
const std::string_view nvsName{config.nvsName()};
showInputForSetting(nvsName, config.value, settings);
});
const auto profile = settingsPersister.currentlyOpenProfileIndex();
const auto switchBackProfile = profile ? int(*profile) : 0;
@ -165,10 +157,9 @@ esp_err_t webserver_dump_nvs_handler(httpd_req_t *req)
const auto profile_str = cur_profile ? std::to_string(*cur_profile) : "-";
JsonObject profile = profiles.createNestedObject(profile_str);
JsonObject profile_settings = profile.createNestedObject("settings");
profileSettings.executeForEveryProfileSetting([&](const char *key, auto &value){
showInputForSetting(key, value, profile_settings);
showInputForSetting(key, value, profile);
});
}

View File

@ -1,12 +1,8 @@
#pragma once
// esp-idf includes
#ifdef FEATURE_WEBSERVER
#include <esp_http_server.h>
#endif
#include <esp_err.h>
#ifdef FEATURE_WEBSERVER
esp_err_t webserver_dump_nvs_handler(httpd_req_t *req);
#endif

View File

@ -1,5 +1,3 @@
#include "webserver_lock.h"
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
cpputils::DelayedConstruction<espcpputils::mutex_semaphore> webserver_lock;
#endif

View File

@ -4,6 +4,4 @@
#include <delayedconstruction.h>
#include <wrappers/mutex_semaphore.h>
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
extern cpputils::DelayedConstruction<espcpputils::mutex_semaphore> webserver_lock;
#endif

View File

@ -4,9 +4,7 @@
#include <limits>
// esp-idf includes
#ifdef FEATURE_WEBSERVER
#include <esp_http_server.h>
#endif
#include <esp_log.h>
// 3rdparty lib includes
@ -24,7 +22,6 @@
#include "newsettings.h"
#include "webserver_lock.h"
#ifdef FEATURE_WEBSERVER
using namespace std::chrono_literals;
using esphttpdutils::HtmlTag;
@ -262,16 +259,6 @@ showInputForSetting(std::string_view key, T value, std::string &body)
esp_err_t webserver_newSettings_handler(httpd_req_t *req)
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
ESP_LOGI(TAG, "trying to lock...");
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
if (!helper.locked())
{
constexpr const std::string_view msg = "could not lock webserver_lock";
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
}
#endif
std::string body;
@ -316,9 +303,7 @@ esp_err_t webserver_newSettings_handler(httpd_req_t *req)
{
HtmlTag pTag{"p", body};
body += "<a href=\"/\">Display control</a> - "
#ifdef FEATURE_OTA
"<a href=\"/ota\">Update</a> - "
#endif
"<a href=\"/settings\">Settings</a> - "
"<b>New Settings</b> - "
"<a href=\"/dumpnvs\">Dump NVS</a>";
@ -507,15 +492,6 @@ saveSetting(ConfigWrapper<T> &config, std::string_view newValue)
esp_err_t webserver_saveNewSettings_handler(httpd_req_t *req)
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
if (!helper.locked())
{
constexpr const std::string_view msg = "could not lock webserver_lock";
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
}
#endif
std::string query;
if (auto result = esphttpdutils::webserver_get_query(req))
@ -576,15 +552,6 @@ esp_err_t webserver_saveNewSettings_handler(httpd_req_t *req)
esp_err_t webserver_resetNewSettings_handler(httpd_req_t *req)
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
if (!helper.locked())
{
constexpr const std::string_view msg = "could not lock webserver_lock";
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
}
#endif
std::string query;
if (auto result = esphttpdutils::webserver_get_query(req))
@ -644,4 +611,3 @@ esp_err_t webserver_resetNewSettings_handler(httpd_req_t *req)
"text/plain",
body)
}
#endif

View File

@ -1,13 +1,9 @@
#pragma once
// esp-idf includes
#ifdef FEATURE_WEBSERVER
#include <esp_http_server.h>
#endif
#include <esp_err.h>
#ifdef FEATURE_WEBSERVER
esp_err_t webserver_newSettings_handler(httpd_req_t *req);
esp_err_t webserver_saveNewSettings_handler(httpd_req_t *req);
esp_err_t webserver_resetNewSettings_handler(httpd_req_t *req);
#endif

View File

@ -1,9 +1,7 @@
#include "webserver_ota.h"
// esp-idf includes
#ifdef FEATURE_WEBSERVER
#include <esp_http_server.h>
#endif
#include <esp_log.h>
#include <esp_ota_ops.h>
@ -17,14 +15,11 @@
#include <espstrutils.h>
// local includes
#ifdef FEATURE_OTA
#include "ota.h"
#endif
#include "webserver_lock.h"
#include "globals.h"
#include "newsettings.h"
#if defined(FEATURE_WEBSERVER) && defined(FEATURE_OTA)
using namespace std::chrono_literals;
using esphttpdutils::HtmlTag;
@ -34,16 +29,9 @@ constexpr const char * const TAG = "BOBBYWEB";
esp_err_t webserver_ota_percentage_handler(httpd_req_t *req)
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
if (!helper.locked())
{
constexpr const std::string_view msg = "could not lock webserver_lock";
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
}
#endif
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
std::string body;
std::string wants_json_query;
@ -93,16 +81,9 @@ esp_err_t webserver_ota_percentage_handler(httpd_req_t *req)
esp_err_t webserver_ota_handler(httpd_req_t *req)
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
if (!helper.locked())
{
constexpr const std::string_view msg = "could not lock webserver_lock";
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
}
#endif
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
std::string body;
std::string wants_json_query;
@ -361,16 +342,9 @@ esp_err_t webserver_ota_handler(httpd_req_t *req)
esp_err_t webserver_trigger_ota_handler(httpd_req_t *req)
{
#ifndef FEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
espcpputils::LockHelper helper{webserver_lock->handle, std::chrono::ceil<espcpputils::ticks>(5s).count()};
if (!helper.locked())
{
constexpr const std::string_view msg = "could not lock webserver_lock";
ESP_LOGE(TAG, "%.*s", msg.size(), msg.data());
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::BadRequest, "text/plain", msg);
}
#endif
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "http://web.bobbycar.cloud");
std::string query;
if (auto result = esphttpdutils::webserver_get_query(req))
query = *result;
@ -416,4 +390,3 @@ esp_err_t webserver_trigger_ota_handler(httpd_req_t *req)
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Location", "/ota")
CALL_AND_EXIT(esphttpdutils::webserver_resp_send, req, esphttpdutils::ResponseStatus::TemporaryRedirect, "text/html", "Ok, continue at <a href=\"/ota\">/</a>")
}
#endif

View File

@ -1,13 +1,9 @@
#pragma once
// esp-idf includes
#ifdef FEATURE_WEBSERVER
#include <esp_http_server.h>
#endif
#include <esp_err.h>
#if defined(FEATURE_WEBSERVER) && defined(FEATURE_OTA)
esp_err_t webserver_ota_handler(httpd_req_t *req);
esp_err_t webserver_ota_percentage_handler(httpd_req_t *req);
esp_err_t webserver_trigger_ota_handler(httpd_req_t *req);
#endif

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