Merge pull request #113 from bobbycar-graz/bug-fixes

Improved performance and usablity
This commit is contained in:
2021-10-18 14:56:29 +02:00
committed by GitHub
26 changed files with 316 additions and 76 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

2
coredump.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
espcoredump.py -p /dev/ttyUSB0 dbg_corefile ./build/bobbyquad_*.elf

View File

@ -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

View File

@ -4,11 +4,19 @@
#include "utils.h"
#include "globals.h"
#include "ledstrip.h"
#include "ledstripdefines.h"
// #include "ledstripdefines.h"
using namespace espgui;
namespace {
template<int16_t type>
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; }
};
*/
}

View File

@ -0,0 +1,4 @@
#pragma once
#include "actioninterface.h"
#include "globals.h"

0
main/buildserver.h Normal file
View File

View File

View File

@ -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 <esp_log.h>
// 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<TEXT_CRASHMENU>,
public BackActionInterface<SwitchScreenAction<SettingsMenu>>
{
public:
CrashMenu()
{
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CRASH_ASSERT>, AssertAction>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CRASH_DIVZERO>, DivideByZeroAction>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<SettingsMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
}
};
} // namespace

View File

@ -45,9 +45,9 @@ namespace {
{
constructMenuItem<makeComponent<MenuItem, currentSelectedAnimationText, DisabledColor, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, EmptyText, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_DEFAULTRAINBOW>, LedstripAnimationDefaultRainbowAction>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_BETTERRAINBOW>, LedstripAnimationBetterRainbowAction>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_SPEEDSYNCANIMATION>, LedstripAnimationSyncToSpeedAction>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_DEFAULTRAINBOW>, LedStripSetAnimationAction<LEDSTRIP_ANIMATION_TYPE_DEFAULTRAINBOW>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_BETTERRAINBOW>, LedStripSetAnimationAction<LEDSTRIP_ANIMATION_TYPE_BETTERRAINBOW>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_SPEEDSYNCANIMATION>, LedStripSetAnimationAction<LEDSTRIP_ANIMATION_TYPE_SPEEDSYNCANIMATION>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<LedstripMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
}
};

View File

@ -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<makeComponent<MenuItem, StaticText<TEXT_LEDSTRIP>, SwitchScreenAction<LedstripMenu>, StaticMenuItemIcon<&bobbyicons::neopixel>>>();
#endif
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MODESETTINGS>, ModeSettingsAction>>(); }
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_PRESETS>, SwitchScreenAction<PresetsMenu>, StaticMenuItemIcon<&bobbyicons::presets>>>(); }
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_PROFILES>, SwitchScreenAction<ProfilesMenu>>>(); }
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GRAPHS>, SwitchScreenAction<GraphsMenu>, StaticMenuItemIcon<&bobbyicons::graph>>>(); }
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BATTERY>, SwitchScreenAction<BatteryMenu>, StaticMenuItemIcon<&bobbyicons::battery>>>(); }
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MODESETTINGS>, ModeSettingsAction>>(); }
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_PRESETS>, SwitchScreenAction<PresetsMenu>, StaticMenuItemIcon<&bobbyicons::presets>>>(); }
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_PROFILES>, SwitchScreenAction<ProfilesMenu>>>(); }
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GRAPHS>, SwitchScreenAction<GraphsMenu>, StaticMenuItemIcon<&bobbyicons::graph>>>(); }
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BATTERY>, SwitchScreenAction<BatteryMenu>, StaticMenuItemIcon<&bobbyicons::battery>>>(); }
#if defined(FEATURE_CAN) && defined(FEATURE_POWERSUPPLY)
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POWERSUPPLY>, SwitchScreenAction<PowerSupplyDisplay>>>(); }
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POWERSUPPLY>, SwitchScreenAction<PowerSupplyDisplay>>>(); }
#endif
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BMS>, SwitchScreenAction<BmsMenu>, StaticMenuItemIcon<&bobbyicons::bms>>>(); }
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BMS>, SwitchScreenAction<BmsMenu>, StaticMenuItemIcon<&bobbyicons::bms>>>(); }
#endif
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SETTINGS>, SwitchScreenAction<SettingsMenu>, StaticMenuItemIcon<&bobbyicons::settings>>>(); }
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LOCKVEHICLE>, SwitchScreenAction<Lockscreen>, StaticMenuItemIcon<&bobbyicons::lock>>>();
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SETTINGS>, SwitchScreenAction<SettingsMenu>, StaticMenuItemIcon<&bobbyicons::settings>>>(); }
#ifdef FEATURE_MOSFETS
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MOSFETS>, SwitchScreenAction<MosfetsMenu>>>(); }
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MOSFETS>, SwitchScreenAction<MosfetsMenu>>>(); }
#endif
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DEMOS>, SwitchScreenAction<DemosMenu>, StaticMenuItemIcon<&bobbyicons::demos>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LOCKVEHICLE>, SwitchScreenAction<Lockscreen>, StaticMenuItemIcon<&bobbyicons::lock>>>();
#ifdef FEATURE_GARAGE
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GARAGE>, SwitchScreenAction<GarageDisplay>>>(); }
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GARAGE>, SwitchScreenAction<GarageDisplay>>>(); }
#endif
#ifdef FEATURE_OTA
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UPDATE>, SwitchScreenAction<UpdateDisplay>, StaticMenuItemIcon<&bobbyicons::update>>>(); }
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UPDATE>, SwitchScreenAction<UpdateDisplay>, StaticMenuItemIcon<&bobbyicons::update>>>(); }
#endif
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POWEROFF>, SwitchScreenAction<PoweroffDisplay>, StaticMenuItemIcon<&bobbyicons::poweroff>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_REBOOT>, RebootAction, StaticMenuItemIcon<&bobbyicons::reboot>>>();
if (!simplified) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DEBUG>, SwitchScreenAction<DebugMenu>>>(); }
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DEBUG>, SwitchScreenAction<DebugMenu>>>(); }
#ifdef MAINMENU_PLUGIN
GMEN1
#endif
}
};
} // namespace

View File

@ -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<TEXT_SELECTBUILDSERVERMENU>,
public BackActionInterface<SwitchScreenAction<SettingsMenu>>
{
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<makeComponent<MenuItem, ChangeableText, DummyAction>>();
menuitem.setTitle(name);
numDisplayedServers++;
}
}
if (!numDisplayedServers)
{
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_NOBUILDSERVERCONFIGURED>, DummyAction>>();
}
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<SettingsMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
}
};
} // namespace

View File

@ -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<makeComponent<MenuItem, StaticText<TEXT_BACKLIGHT>, ToggleBoolAction, CheckboxIcon, BacklightAccessor>>();
#endif
if (!simplified)
{
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LIMITSSETTINGS>, SwitchScreenAction<LimitsSettingsMenu>>>();
}
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_WIFISETTINGS>, SwitchScreenAction<WifiSettingsMenu>, StaticMenuItemIcon<&bobbyicons::wifi>>>();
#ifdef FEATURE_BLUETOOTH
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLUETOOTHSETTINGS>, SwitchScreenAction<BluetoothSettingsMenu>, StaticMenuItemIcon<&bobbyicons::bluetooth>>>();
@ -69,6 +76,9 @@ public:
#endif
#ifdef FEATURE_CLOUD
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CLOUDSETTINGS>, SwitchScreenAction<CloudSettingsMenu>>>();
#endif
#ifdef FEATURE_OTA
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTBUILDSERVERMENU>, SwitchScreenAction<SelectBuildServerMenu>, StaticMenuItemIcon<&bobbyicons::update>>>();
#endif
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_TIME>, SwitchScreenAction<TimeSettingsMenu>, StaticMenuItemIcon<&bobbyicons::time>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MODESSETTINGS>, SwitchScreenAction<ModesSettingsMenu>>>();
@ -80,6 +90,7 @@ public:
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BUZZER>, SwitchScreenAction<BuzzerMenu>, StaticMenuItemIcon<&bobbyicons::buzzer>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_FRONTLED>, ToggleBoolAction, CheckboxIcon, FrontLedAccessor>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACKLED>, ToggleBoolAction, CheckboxIcon, BackLedAccessor>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CRASHMENU>, SwitchScreenAction<CrashMenu>, StaticMenuItemIcon<&bobbyicons::demos>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ABOUT>, SwitchScreenAction<AboutMenu>, StaticMenuItemIcon<&bobbyicons::info>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<MainMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
}

View File

@ -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<BmsDisplay>();

View File

@ -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;

View File

@ -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

View File

@ -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"

View File

@ -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<ConfiguredWifi, 10> {
@ -322,6 +323,20 @@ StringSettings makeDefaultStringSettings()
#endif
#ifdef FEATURE_NTP
.timeServer = "europe.pool.ntp.org",
#endif
#ifdef FEATURE_OTA
.otaServers = std::array<ConfiguredOtaServer, 2> {
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
};
}

View File

@ -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");

View File

@ -36,6 +36,15 @@ struct StringSettings
template<typename T>
void executeForEveryProfileSetting(T &&callable);
#ifdef FEATURE_OTA
struct ConfiguredOtaServer {
std::string name;
std::string url;
};
std::array<ConfiguredOtaServer, 2> otaServers;
#endif
};
template<typename T>
@ -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<typename T>

View File

@ -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

View File

@ -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

View File

@ -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