diff --git a/config_comred.cmake b/config_comred.cmake index 3c9a2f7..e21a2f1 100644 --- a/config_comred.cmake +++ b/config_comred.cmake @@ -44,6 +44,7 @@ set(BOBBYCAR_BUILDFLAGS -DAP_PASSWORD=Passwort_123 -DFEATURE_WEBSERVER -DFEATURE_OTA + -DOTA_USERNAME="comred" # -DFEATURE_DPAD_5WIRESW # -DPINS_DPAD_5WIRESW_OUT=4 # -DPINS_DPAD_5WIRESW_IN1=5 diff --git a/config_feedc0de.cmake b/config_feedc0de.cmake index f38ecdc..03d7bcf 100644 --- a/config_feedc0de.cmake +++ b/config_feedc0de.cmake @@ -44,6 +44,7 @@ set(BOBBYCAR_BUILDFLAGS -DAP_PASSWORD=Passwort_123 -DFEATURE_WEBSERVER -DFEATURE_OTA + -DOTA_USERNAME="feedc0de" -DFEATURE_DPAD_5WIRESW -DPINS_DPAD_5WIRESW_OUT=18 -DPINS_DPAD_5WIRESW_IN1=19 diff --git a/config_greyhash.cmake b/config_greyhash.cmake index ce9bd42..d4705dd 100644 --- a/config_greyhash.cmake +++ b/config_greyhash.cmake @@ -44,6 +44,7 @@ set(BOBBYCAR_BUILDFLAGS -DAP_PASSWORD=Passwort_123 -DFEATURE_WEBSERVER -DFEATURE_OTA + -DOTA_USERNAME="greyhash" -DFEATURE_DPAD_5WIRESW -DPINS_DPAD_5WIRESW_OUT=4 -DPINS_DPAD_5WIRESW_IN1=5 diff --git a/config_mick.cmake b/config_mick.cmake index da9cfa2..c9902c3 100644 --- a/config_mick.cmake +++ b/config_mick.cmake @@ -44,6 +44,7 @@ set(BOBBYCAR_BUILDFLAGS -DAP_PASSWORD=Passwort_123 -DFEATURE_WEBSERVER # -DFEATURE_OTA +# -DOTA_USERNAME="mick" # -DFEATURE_DPAD_5WIRESW # -DPINS_DPAD_5WIRESW_OUT=4 # -DPINS_DPAD_5WIRESW_IN1=5 diff --git a/config_peter.cmake b/config_peter.cmake index 257e7c7..003bc61 100644 --- a/config_peter.cmake +++ b/config_peter.cmake @@ -44,6 +44,7 @@ set(BOBBYCAR_BUILDFLAGS -DAP_PASSWORD=Passwort_123 -DFEATURE_WEBSERVER -DFEATURE_OTA + -DOTA_USERNAME="peter" -DFEATURE_DPAD_5WIRESW_2OUT -DPINS_DPAD_5WIRESW_OUT1=18 -DPINS_DPAD_5WIRESW_OUT2=19 diff --git a/coredump.sh b/coredump.sh new file mode 100755 index 0000000..581cdf1 --- /dev/null +++ b/coredump.sh @@ -0,0 +1,2 @@ +#!/bin/bash +espcoredump.py -p /dev/ttyUSB0 dbg_corefile ./build/bobbyquad_*.elf diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index c139075..6241553 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -5,6 +5,7 @@ set(headers bluetoothmode.h bluetoothtexthelpers.h bmsutils.h + buildserver.h buttons.h can.h changevaluedisplay_bluetoothmode.h @@ -76,6 +77,7 @@ set(headers actions/multiaction.h actions/rebootaction.h actions/savesettingsaction.h + actions/selectbuildserveraction.h actions/switchprofileaction.h actions/tempomatmodeapplycurrentpeedaction.h actions/updateswapfrontbackaction.h @@ -102,6 +104,7 @@ set(headers displays/menus/cloudsettingsmenu.h displays/menus/commanddebugmenu.h displays/menus/controllerhardwaresettingsmenu.h + displays/menus/crashmenu.h displays/menus/debugmenu.h displays/menus/defaultmodesettingsmenu.h displays/menus/demosmenu.h @@ -126,6 +129,7 @@ set(headers displays/menus/presetsmenu.h displays/menus/profilesmenu.h displays/menus/selectbatterytypemenu.h + displays/menus/selectbuildservermenu.h displays/menus/selectmodemenu.h displays/menus/settingsmenu.h displays/menus/stationwifisettingsmenu.h @@ -278,6 +282,7 @@ set(sources displays/menus/cloudsettingsmenu.cpp displays/menus/commanddebugmenu.cpp displays/menus/controllerhardwaresettingsmenu.cpp + displays/menus/crashmenu.cpp displays/menus/debugmenu.cpp displays/menus/defaultmodesettingsmenu.cpp displays/menus/demosmenu.cpp diff --git a/main/actions/ledstripanimationactions.h b/main/actions/ledstripanimationactions.h index d125d06..2d58f69 100644 --- a/main/actions/ledstripanimationactions.h +++ b/main/actions/ledstripanimationactions.h @@ -4,11 +4,19 @@ #include "utils.h" #include "globals.h" #include "ledstrip.h" -#include "ledstripdefines.h" +// #include "ledstripdefines.h" using namespace espgui; namespace { +template +class LedStripSetAnimationAction : public virtual ActionInterface +{ +public: + void triggered() override { animation_type = type; } +}; + +/* class LedstripAnimationDefaultRainbowAction : public virtual ActionInterface { public: @@ -26,4 +34,5 @@ class LedstripAnimationSyncToSpeedAction : public virtual ActionInterface public: void triggered() override { animation_type = LEDSTRIP_ANIMATION_TYPE_SPEEDSYNCANIMATION; } }; +*/ } diff --git a/main/actions/selectbuildserveraction.h b/main/actions/selectbuildserveraction.h new file mode 100644 index 0000000..61e87de --- /dev/null +++ b/main/actions/selectbuildserveraction.h @@ -0,0 +1,4 @@ +#pragma once + +#include "actioninterface.h" +#include "globals.h" diff --git a/main/buildserver.h b/main/buildserver.h new file mode 100644 index 0000000..e69de29 diff --git a/main/displays/menus/crashmenu.cpp b/main/displays/menus/crashmenu.cpp new file mode 100644 index 0000000..e69de29 diff --git a/main/displays/menus/crashmenu.h b/main/displays/menus/crashmenu.h new file mode 100644 index 0000000..474f1d7 --- /dev/null +++ b/main/displays/menus/crashmenu.h @@ -0,0 +1,39 @@ +#pragma once + +// local includes +#include "menudisplay.h" +#include "utils.h" +#include "actions/dummyaction.h" +#include "icons/back.h" +#include "texts.h" +#include + + +// forward declares +namespace { +class SettingsMenu; + +class AssertAction : public virtual ActionInterface { public: void triggered() override { assert(0); } }; +class DivideByZeroAction : public virtual ActionInterface { public: void triggered() override { int goodbye = 42 / 0; ESP_LOGW("divByZero", "%i", goodbye); } }; + + +} // namespace + +using namespace espgui; + +namespace { + +class CrashMenu : + public MenuDisplay, + public StaticText, + public BackActionInterface> +{ +public: + CrashMenu() + { + constructMenuItem, AssertAction>>(); + constructMenuItem, DivideByZeroAction>>(); + constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); + } +}; +} // namespace diff --git a/main/displays/menus/ledstripselectanimationmenu.h b/main/displays/menus/ledstripselectanimationmenu.h index 6d07fb7..783f972 100644 --- a/main/displays/menus/ledstripselectanimationmenu.h +++ b/main/displays/menus/ledstripselectanimationmenu.h @@ -45,9 +45,9 @@ namespace { { constructMenuItem>(); constructMenuItem>(); - constructMenuItem, LedstripAnimationDefaultRainbowAction>>(); - constructMenuItem, LedstripAnimationBetterRainbowAction>>(); - constructMenuItem, LedstripAnimationSyncToSpeedAction>>(); + constructMenuItem, LedStripSetAnimationAction>>(); + constructMenuItem, LedStripSetAnimationAction>>(); + constructMenuItem, LedStripSetAnimationAction>>(); constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); } }; diff --git a/main/displays/menus/mainmenu.h b/main/displays/menus/mainmenu.h index ff8527b..f46fde9 100644 --- a/main/displays/menus/mainmenu.h +++ b/main/displays/menus/mainmenu.h @@ -27,6 +27,9 @@ #endif #include "icons/poweroff.h" #include "icons/reboot.h" +#ifdef MAINMENU_PLUGIN +#include MAINMENU_PLUGIN +#endif // forward declares namespace { @@ -47,6 +50,14 @@ class UpdateDisplay; class PoweroffDisplay; class DebugMenu; class BatteryMenu; +#ifdef MAINMENU_PLUGIN + GMEN2 +#endif +#if !defined(MAINMENU_PLUGIN) and !defined(GMEN3) +#define SHOWITEM !simplified +#else +#define SHOWITEM GMEN3 +#endif } // namespace using namespace espgui; @@ -65,32 +76,35 @@ public: #ifdef FEATURE_LEDSTRIP constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::neopixel>>>(); #endif - if (!simplified) { constructMenuItem, ModeSettingsAction>>(); } - if (!simplified) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::presets>>>(); } - if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } - if (!simplified) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::graph>>>(); } - if (!simplified) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::battery>>>(); } + if (SHOWITEM) { constructMenuItem, ModeSettingsAction>>(); } + if (SHOWITEM) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::presets>>>(); } + if (SHOWITEM) { constructMenuItem, SwitchScreenAction>>(); } + if (SHOWITEM) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::graph>>>(); } + if (SHOWITEM) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::battery>>>(); } #if defined(FEATURE_CAN) && defined(FEATURE_POWERSUPPLY) - if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } + if (SHOWITEM) { constructMenuItem, SwitchScreenAction>>(); } #endif #if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS) - if (!simplified) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::bms>>>(); } + if (SHOWITEM) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::bms>>>(); } #endif - if (!simplified) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::settings>>>(); } - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::lock>>>(); + if (SHOWITEM) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::settings>>>(); } #ifdef FEATURE_MOSFETS - if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } + if (SHOWITEM) { constructMenuItem, SwitchScreenAction>>(); } #endif constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::demos>>>(); + constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::lock>>>(); #ifdef FEATURE_GARAGE - if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } + if (SHOWITEM) { constructMenuItem, SwitchScreenAction>>(); } #endif #ifdef FEATURE_OTA - if (!simplified) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::update>>>(); } + if (SHOWITEM) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::update>>>(); } #endif constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::poweroff>>>(); constructMenuItem, RebootAction, StaticMenuItemIcon<&bobbyicons::reboot>>>(); - if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } + if (SHOWITEM) { constructMenuItem, SwitchScreenAction>>(); } +#ifdef MAINMENU_PLUGIN + GMEN1 +#endif } }; } // namespace diff --git a/main/displays/menus/selectbuildservermenu.h b/main/displays/menus/selectbuildservermenu.h new file mode 100644 index 0000000..21cf7fe --- /dev/null +++ b/main/displays/menus/selectbuildservermenu.h @@ -0,0 +1,53 @@ +#pragma once + +// local includes +#include "menudisplay.h" +#include "utils.h" +#include "actions/dummyaction.h" +#include "actions/selectbuildserveraction.h" +#include "icons/back.h" +#include "texts.h" +#include "globals.h" + + +// forward declares +namespace { +class SettingsMenu; +} // namespace + +using namespace espgui; + +namespace { + +class SelectBuildServerMenu : + public MenuDisplay, + public StaticText, + public BackActionInterface> +{ +public: + SelectBuildServerMenu() { + + auto numDisplayedServers = 0; + + for (auto index = 0; index < stringSettings.otaServers.size(); index++) + { + auto otaServer = stringSettings.otaServers[index]; + std::string url = otaServer.url; + std::string name = (otaServer.name.empty()) ? url : otaServer.name; + + if (!name.empty()) { + auto menuitem = constructMenuItem>(); + menuitem.setTitle(name); + numDisplayedServers++; + } + } + + if (!numDisplayedServers) + { + constructMenuItem, DummyAction>>(); + } + + constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); + } +}; +} // namespace diff --git a/main/displays/menus/settingsmenu.h b/main/displays/menus/settingsmenu.h index 54253df..bbbdfd7 100644 --- a/main/displays/menus/settingsmenu.h +++ b/main/displays/menus/settingsmenu.h @@ -14,7 +14,9 @@ #include "icons/hardware.h" #include "icons/buzzer.h" #include "icons/info.h" +#include "icons/demos.h" #include "icons/back.h" +#include "icons/update.h" #include "texts.h" #include "globals.h" #include "accessors/settingsaccessors.h" @@ -33,6 +35,8 @@ class BoardcomputerHardwareSettingsMenu; class BuzzerMenu; class AboutMenu; class MainMenu; +class CrashMenu; +class SelectBuildServerMenu; } using namespace espgui; @@ -59,7 +63,10 @@ public: #ifdef FEATURE_LEDBACKLIGHT constructMenuItem, ToggleBoolAction, CheckboxIcon, BacklightAccessor>>(); #endif + if (!simplified) + { constructMenuItem, SwitchScreenAction>>(); + } constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::wifi>>>(); #ifdef FEATURE_BLUETOOTH constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::bluetooth>>>(); @@ -69,6 +76,9 @@ public: #endif #ifdef FEATURE_CLOUD constructMenuItem, SwitchScreenAction>>(); +#endif +#ifdef FEATURE_OTA + constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::update>>>(); #endif constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::time>>>(); constructMenuItem, SwitchScreenAction>>(); @@ -80,6 +90,7 @@ public: constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::buzzer>>>(); constructMenuItem, ToggleBoolAction, CheckboxIcon, FrontLedAccessor>>(); constructMenuItem, ToggleBoolAction, CheckboxIcon, BackLedAccessor>>(); + constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::demos>>>(); constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&bobbyicons::info>>>(); constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); } diff --git a/main/displays/statusdisplay.h b/main/displays/statusdisplay.h index 98bdc74..3560ed5 100644 --- a/main/displays/statusdisplay.h +++ b/main/displays/statusdisplay.h @@ -23,6 +23,8 @@ namespace { class MainMenu; class BmsDisplay; class MetersDisplay; + +static uint16_t counter = 24; } namespace { @@ -158,6 +160,7 @@ void StatusDisplay::initScreen() m_labelProfile.start(); tft.setTextColor(TFT_WHITE, TFT_BLACK); + counter = 0; } void StatusDisplay::redraw() @@ -170,9 +173,15 @@ void StatusDisplay::redraw() m_labelBrems.redraw(brems ? fmt::format("{:.2f}", *brems) : "?"); m_progressBarBrems.redraw(brems ? *brems : 0); - m_batterypercent.redraw(getBatteryPercentageString()); - m_watthoursleft.redraw(getBatteryRemainingWattHoursString()); - m_kilometersleft.redraw(getRemainingRangeString()); + if (counter < 1) + { + counter = 25; + m_batterypercent.redraw(getBatteryPercentageString()); + m_watthoursleft.redraw(getBatteryRemainingWattHoursString()); + m_kilometersleft.redraw(getRemainingRangeString()); + } + else + counter--; m_frontStatus.redraw(controllers.front); m_backStatus.redraw(controllers.back); @@ -241,6 +250,7 @@ clearIp: void StatusDisplay::rotate(int offset) { + counter = 0; if (offset < 0) #ifdef FEATURE_BMS switchScreen(); diff --git a/main/globals.h b/main/globals.h index 457d6fb..5909e73 100644 --- a/main/globals.h +++ b/main/globals.h @@ -41,7 +41,11 @@ float avgSpeed, avgSpeedKmh, sumCurrent; char deviceName[32] = STRING(DEVICE_PREFIX) "_ERR"; -#if defined(SIMPLIFIED_TRIGGER_TRIGGERONPRESET) +#ifdef GLOBALS_PLUGIN +#include GLOBALS_PLUGIN +#endif + +#if defined(HAS_SIMPLIFIED) bool simplified = true; #else bool simplified = false; diff --git a/main/ledstrip.h b/main/ledstrip.h index cdaa50c..1b4fc44 100644 --- a/main/ledstrip.h +++ b/main/ledstrip.h @@ -149,19 +149,21 @@ void updateLedStrip() } void showAnimation() { - if (animation_type == LEDSTRIP_ANIMATION_TYPE_DEFAULTRAINBOW) showDefaultLedstrip(); - else if (animation_type == LEDSTRIP_ANIMATION_TYPE_BETTERRAINBOW) showBetterRainbow(); - else if (animation_type == LEDSTRIP_ANIMATION_TYPE_SPEEDSYNCANIMATION) showSpeedSyncAnimation(); - else showDefaultLedstrip(); + if (settings.ledstrip.enableLedAnimation && !simplified) + { + if (animation_type == LEDSTRIP_ANIMATION_TYPE_DEFAULTRAINBOW) showDefaultLedstrip(); + else if (animation_type == LEDSTRIP_ANIMATION_TYPE_BETTERRAINBOW) showBetterRainbow(); + else if (animation_type == LEDSTRIP_ANIMATION_TYPE_SPEEDSYNCANIMATION) showSpeedSyncAnimation(); + else showDefaultLedstrip(); + } + else + { + std::fill(std::begin(leds), std::end(leds), CRGB{0, 0, 0}); + } } void showBetterRainbow() { - if (settings.ledstrip.enableLedAnimation) - { - fill_rainbow(&*std::begin(leds), leds.size(), gHue); - } - else - std::fill(std::begin(leds), std::end(leds), CRGB{0, 0, 0}); + fill_rainbow(&*std::begin(leds), leds.size(), gHue); } void fill_rainbow_invert_at( struct CRGB * pFirstLED, int numToFill, int invertAtLed, @@ -185,49 +187,39 @@ void fill_rainbow_invert_at( struct CRGB * pFirstLED, int numToFill, int invertA } void showSpeedSyncAnimation() { - if (settings.ledstrip.enableLedAnimation) - { #ifdef LEDS_PER_METER - const float leds_per_meter = LEDS_PER_METER; + const float leds_per_meter = LEDS_PER_METER; #else - const float leds_per_meter = 144; + const float leds_per_meter = 144; #endif - static auto last_interval = espchrono::millis_clock::now(); - auto difference_ms = espchrono::ago(last_interval).count(); + static auto last_interval = espchrono::millis_clock::now(); + auto difference_ms = espchrono::ago(last_interval).count(); - static float hue_result = 0; + static float hue_result = 0; - const float hue_per_led = 1. / std::max(uint8_t(1), uint8_t(settings.ledstrip.animationMultiplier)); - const float meter_per_second = avgSpeedKmh / 3.6; - const float leds_per_second = meter_per_second * leds_per_meter; - const float hue_per_second = leds_per_second * hue_per_led; + const float hue_per_led = 1. / std::max(uint8_t(1), uint8_t(settings.ledstrip.animationMultiplier)); + const float meter_per_second = avgSpeedKmh / 3.6; + const float leds_per_second = meter_per_second * leds_per_meter; + const float hue_per_second = leds_per_second * hue_per_led; - hue_result += hue_per_second * difference_ms / 1000.f; + hue_result += hue_per_second * difference_ms / 1000.f; - fill_rainbow_invert_at(&*std::begin(leds), leds.size(),leds.size()/2, hue_result,-hue_per_led); + fill_rainbow_invert_at(&*std::begin(leds), leds.size(),leds.size()/2, hue_result,-hue_per_led); - last_interval = espchrono::millis_clock::now(); - } - else - std::fill(std::begin(leds), std::end(leds), CRGB{0, 0, 0}); + last_interval = espchrono::millis_clock::now(); } void showDefaultLedstrip() { - if (settings.ledstrip.enableLedAnimation) - { - fadeToBlackBy(&*std::begin(leds), leds.size(), 20); + fadeToBlackBy(&*std::begin(leds), leds.size(), 20); - uint8_t dothue = 0; - for (int i = 0; i < 8; i++) - { - leds[beatsin16(i + 7, 0, leds.size())] |= CHSV(dothue, 200, 255); - dothue += 32; - } + uint8_t dothue = 0; + for (int i = 0; i < 8; i++) + { + leds[beatsin16(i + 7, 0, leds.size())] |= CHSV(dothue, 200, 255); + dothue += 32; } - else - std::fill(std::begin(leds), std::end(leds), CRGB{0, 0, 0}); } } // namespace #endif diff --git a/main/main.cpp b/main/main.cpp index 534b9f3..39f794e 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -38,6 +38,7 @@ using namespace std::chrono_literals; #endif #include "displays/menus/buzzermenu.h" #include "displays/menus/commanddebugmenu.h" +#include "displays/menus/crashmenu.h" #include "displays/menus/debugmenu.h" #include "displays/menus/defaultmodesettingsmenu.h" #include "displays/menus/demosmenu.h" @@ -126,6 +127,7 @@ using namespace std::chrono_literals; #include "serialhandler.h" #ifdef FEATURE_OTA #include "ota.h" +#include "displays/menus/selectbuildservermenu.h" #endif #include "presets.h" #include "statistics.h" diff --git a/main/presets.h b/main/presets.h index eea3b68..afcfa1c 100644 --- a/main/presets.h +++ b/main/presets.h @@ -258,10 +258,10 @@ constexpr Settings::Battery defaultBattery { .cellsParallel = 4, .cellType = 0, .watthoursPerKilometer = 20, - .front30VoltCalibration = 30, - .back30VoltCalibration = 30, - .front50VoltCalibration = 50, - .back50VoltCalibration = 50, + .front30VoltCalibration = 3000, + .back30VoltCalibration = 3000, + .front50VoltCalibration = 5000, + .back50VoltCalibration = 5000, .applyCalibration = true }; @@ -297,6 +297,7 @@ constexpr Settings defaultSettings { StringSettings makeDefaultStringSettings() { using ConfiguredWifi = StringSettings::ConfiguredWifi; + using ConfiguredOtaServer = StringSettings::ConfiguredOtaServer; return { .wifis = std::array { @@ -322,6 +323,20 @@ StringSettings makeDefaultStringSettings() #endif #ifdef FEATURE_NTP .timeServer = "europe.pool.ntp.org", +#endif +#ifdef FEATURE_OTA + .otaServers = std::array { + ConfiguredOtaServer { .name = {}, .url = {} }, + ConfiguredOtaServer { .name = {}, .url = {} },/* + ConfiguredOtaServer { .name = {}, .url = {} }, + ConfiguredOtaServer { .name = {}, .url = {} }, + ConfiguredOtaServer { .name = {}, .url = {} }, + ConfiguredOtaServer { .name = {}, .url = {} }, + ConfiguredOtaServer { .name = {}, .url = {} }, + ConfiguredOtaServer { .name = {}, .url = {} }, + ConfiguredOtaServer { .name = {}, .url = {} }, + ConfiguredOtaServer { .name = {}, .url = {} },*/ + }, #endif }; } diff --git a/main/settingsutils.h b/main/settingsutils.h index 96bcb5e..a72191e 100644 --- a/main/settingsutils.h +++ b/main/settingsutils.h @@ -10,17 +10,20 @@ namespace { void switchProfile(uint8_t index) { - settings = presets::defaultSettings; - stringSettings = presets::makeDefaultStringSettings(); - #ifdef SIMPLIFIED_TRIGGER_TRIGGERONPRESET if (index == SIMPLIFIED_TRIGGER_TRIGGERONPRESET) { simplified = true; +#ifdef SETTINGSUTILS_PLUGIN +#include SETTINGSUTILS_PLUGIN +#endif return; } #endif + settings = presets::defaultSettings; + stringSettings = presets::makeDefaultStringSettings(); + if (!settingsPersister.openProfile(index)) { ESP_LOGE("BOBBY", "openProfile() failed"); diff --git a/main/stringsettings.h b/main/stringsettings.h index e3ec0f7..835c890 100644 --- a/main/stringsettings.h +++ b/main/stringsettings.h @@ -36,6 +36,15 @@ struct StringSettings template void executeForEveryProfileSetting(T &&callable); + +#ifdef FEATURE_OTA + struct ConfiguredOtaServer { + std::string name; + std::string url; + }; + + std::array otaServers; +#endif }; template @@ -76,6 +85,28 @@ void StringSettings::executeForEveryCommonSetting(T &&callable) #ifdef FEATURE_NTP callable("timeServer", timeServer); #endif +#ifdef FEATURE_OTA + callable("otaName0", otaServers[0].name); + callable("otaUrl0", otaServers[0].url); + callable("otaName1", otaServers[1].name); + callable("otaUrl1", otaServers[1].url);/* + callable("otaName2", otaServers[2].name); + callable("otaUrl2", otaServers[2].url); + callable("otaName3", otaServers[3].name); + callable("otaUrl3", otaServers[3].url); + callable("otaName4", otaServers[4].name); + callable("otaUrl4", otaServers[4].url); + callable("otaName5", otaServers[5].name); + callable("otaUrl5", otaServers[5].url); + callable("otaName6", otaServers[6].name); + callable("otaUrl6", otaServers[6].url); + callable("otaName7", otaServers[7].name); + callable("otaUrl7", otaServers[7].url); + callable("otaName8", otaServers[8].name); + callable("otaUrl8", otaServers[8].url); + callable("otaName9", otaServers[9].name); + callable("otaUrl9", otaServers[9].url);*/ +#endif } template diff --git a/main/texts.h b/main/texts.h index a452db2..6ad8451 100644 --- a/main/texts.h +++ b/main/texts.h @@ -9,6 +9,10 @@ constexpr char TEXT_BACK[] = "Back"; constexpr char TEXT_ACCESSPOINTWIFISETTINGS[] = "Access Point WiFi settings"; //constexpr char TEXT_BACK[] = "Back"; +#ifdef TEXTS_PLUGIN +#include TEXTS_PLUGIN +#endif + #ifdef FEATURE_BLUETOOTH //BluetoothSettingsMenu constexpr char TEXT_BLUETOOTHSETTINGS[] = "Bluetooth settings"; @@ -462,6 +466,15 @@ constexpr char TEXT_WIFI_POWER_2dBm[] = "2dBm"; constexpr char TEXT_WIFI_POWER_MINUS_1dBm[] = "-1dBm"; //constexpr char TEXT_BACK[] = "Back"; +//Crashmenu +constexpr char TEXT_CRASHMENU[] = "Crash Menu"; +constexpr char TEXT_CRASH_ASSERT[] = "assert(0)"; +constexpr char TEXT_CRASH_DIVZERO[] = "42 / 0"; + +//SelectBuildServerMenu +constexpr char TEXT_SELECTBUILDSERVERMENU[] = "Select Buildserver"; +constexpr char TEXT_NOBUILDSERVERCONFIGURED[] = "Not configured"; + #ifdef FEATURE_CAN constexpr char TEXT_POWERSUPPLY[] = "Powersupply"; #endif diff --git a/sdkconfig_comred b/sdkconfig_comred index 4df478d..c496d51 100644 --- a/sdkconfig_comred +++ b/sdkconfig_comred @@ -681,9 +681,16 @@ CONFIG_ESP32_PHY_MAX_TX_POWER=20 # # Core dump # -# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set +CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=y # CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set -CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y +# CONFIG_ESP_COREDUMP_ENABLE_TO_NONE is not set +# CONFIG_ESP_COREDUMP_DATA_FORMAT_BIN is not set +CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=y +# CONFIG_ESP_COREDUMP_CHECKSUM_CRC32 is not set +CONFIG_ESP_COREDUMP_CHECKSUM_SHA256=y +CONFIG_ESP_COREDUMP_ENABLE=y +CONFIG_ESP_COREDUMP_MAX_TASKS_NUM=64 +CONFIG_ESP_COREDUMP_STACK_SIZE=0 # end of Core dump # @@ -769,7 +776,7 @@ CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y # CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set # CONFIG_FREERTOS_ASSERT_DISABLE is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 -CONFIG_FREERTOS_ISR_STACKSIZE=1536 +CONFIG_FREERTOS_ISR_STACKSIZE=2096 # CONFIG_FREERTOS_LEGACY_HOOKS is not set CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16 CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y @@ -1442,9 +1449,16 @@ CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y # CONFIG_ESP32S2_PANIC_GDBSTUB is not set CONFIG_TIMER_TASK_STACK_SIZE=3584 CONFIG_SW_COEXIST_ENABLE=y -# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set +CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH=y # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set -CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y +# CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE is not set +# CONFIG_ESP32_COREDUMP_DATA_FORMAT_BIN is not set +CONFIG_ESP32_COREDUMP_DATA_FORMAT_ELF=y +# CONFIG_ESP32_COREDUMP_CHECKSUM_CRC32 is not set +CONFIG_ESP32_COREDUMP_CHECKSUM_SHA256=y +CONFIG_ESP32_ENABLE_COREDUMP=y +CONFIG_ESP32_CORE_DUMP_MAX_TASKS_NUM=64 +CONFIG_ESP32_CORE_DUMP_STACK_SIZE=0 CONFIG_MB_MASTER_TIMEOUT_MS_RESPOND=150 CONFIG_MB_MASTER_DELAY_MS_CONVERT=200 CONFIG_MB_QUEUE_LENGTH=20 diff --git a/sdkconfig_peter b/sdkconfig_peter index 4df478d..c496d51 100644 --- a/sdkconfig_peter +++ b/sdkconfig_peter @@ -681,9 +681,16 @@ CONFIG_ESP32_PHY_MAX_TX_POWER=20 # # Core dump # -# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set +CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=y # CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set -CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y +# CONFIG_ESP_COREDUMP_ENABLE_TO_NONE is not set +# CONFIG_ESP_COREDUMP_DATA_FORMAT_BIN is not set +CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=y +# CONFIG_ESP_COREDUMP_CHECKSUM_CRC32 is not set +CONFIG_ESP_COREDUMP_CHECKSUM_SHA256=y +CONFIG_ESP_COREDUMP_ENABLE=y +CONFIG_ESP_COREDUMP_MAX_TASKS_NUM=64 +CONFIG_ESP_COREDUMP_STACK_SIZE=0 # end of Core dump # @@ -769,7 +776,7 @@ CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y # CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set # CONFIG_FREERTOS_ASSERT_DISABLE is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 -CONFIG_FREERTOS_ISR_STACKSIZE=1536 +CONFIG_FREERTOS_ISR_STACKSIZE=2096 # CONFIG_FREERTOS_LEGACY_HOOKS is not set CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16 CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y @@ -1442,9 +1449,16 @@ CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y # CONFIG_ESP32S2_PANIC_GDBSTUB is not set CONFIG_TIMER_TASK_STACK_SIZE=3584 CONFIG_SW_COEXIST_ENABLE=y -# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set +CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH=y # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set -CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y +# CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE is not set +# CONFIG_ESP32_COREDUMP_DATA_FORMAT_BIN is not set +CONFIG_ESP32_COREDUMP_DATA_FORMAT_ELF=y +# CONFIG_ESP32_COREDUMP_CHECKSUM_CRC32 is not set +CONFIG_ESP32_COREDUMP_CHECKSUM_SHA256=y +CONFIG_ESP32_ENABLE_COREDUMP=y +CONFIG_ESP32_CORE_DUMP_MAX_TASKS_NUM=64 +CONFIG_ESP32_CORE_DUMP_STACK_SIZE=0 CONFIG_MB_MASTER_TIMEOUT_MS_RESPOND=150 CONFIG_MB_MASTER_DELAY_MS_CONVERT=200 CONFIG_MB_QUEUE_LENGTH=20