diff --git a/.gitignore b/.gitignore index bdae45c..8acc0a0 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,6 @@ desktop.ini /config.cmake /sdkconfig /sdkconfig.old* +/ignore /.idea /.ccache diff --git a/config_comred.cmake b/config_comred.cmake index 8457313..0cf4a11 100644 --- a/config_comred.cmake +++ b/config_comred.cmake @@ -115,3 +115,8 @@ set(BOBBYCAR_BUILDFLAGS -DLEDSTRIP_ANIMATION_DEFAULT=1 -DLEDS_PER_METER=60 ) + +if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ignore/lockscreen_plugin.cmake") + include("${CMAKE_CURRENT_SOURCE_DIR}/ignore/lockscreen_plugin.cmake") + message(WARNING "Including lockscreen_plugin") +endif() diff --git a/config_peter.cmake b/config_peter.cmake index cb82cb3..257e7c7 100644 --- a/config_peter.cmake +++ b/config_peter.cmake @@ -95,3 +95,8 @@ set(BOBBYCAR_BUILDFLAGS -DLEDSTRIP_ANIMATION_DEFAULT=2 -DLEDS_PER_METER=144 ) + +if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ignore/lockscreen_plugin.cmake") + include("${CMAKE_CURRENT_SOURCE_DIR}/ignore/lockscreen_plugin.cmake") + message(WARNING "Including lockscreen_plugin") +endif() diff --git a/main/can.h b/main/can.h index 9053458..8a6bc9b 100644 --- a/main/can.h +++ b/main/can.h @@ -17,7 +17,13 @@ #include "globals.h" #include "buttons.h" +#ifdef CAN_PLUGIN +#pragma message "Activating Can Plugin" +#include CAN_PLUGIN +#endif + namespace can { + namespace { std::optional can_gas, can_brems; espchrono::millis_clock::time_point last_can_gas{}, last_can_brems{}; @@ -366,28 +372,40 @@ void sendCanCommands() if (back) send(MotorController::Command::CtrlMod, back->command.right.ctrlMod); break; case 3: - if (front) send(MotorController::Command::IMotMax, front->command.left.iMotMax); - if (front) send(MotorController::Command::IMotMax, front->command.right.iMotMax); - if (back) send(MotorController::Command::IMotMax, back->command.left.iMotMax); - if (back) send(MotorController::Command::IMotMax, back->command.right.iMotMax); +#if defined(HAS_SIMPLIFIED) + SIMPLIFIED_IMOTMAX +#endif + if (front) send(MotorController::Command::IMotMax, front->command.left.iMotMax); + if (front) send(MotorController::Command::IMotMax, front->command.right.iMotMax); + if (back) send(MotorController::Command::IMotMax, back->command.left.iMotMax); + if (back) send(MotorController::Command::IMotMax, back->command.right.iMotMax); break; case 4: - if (front) send(MotorController::Command::IDcMax, front->command.left.iDcMax); - if (front) send(MotorController::Command::IDcMax, front->command.right.iDcMax); - if (back) send(MotorController::Command::IDcMax, back->command.left.iDcMax); - if (back) send(MotorController::Command::IDcMax, back->command.right.iDcMax); +#if defined(HAS_SIMPLIFIED) + SIMPLIFIED_IDCMAX +#endif + if (front) send(MotorController::Command::IDcMax, front->command.left.iDcMax); + if (front) send(MotorController::Command::IDcMax, front->command.right.iDcMax); + if (back) send(MotorController::Command::IDcMax, back->command.left.iDcMax); + if (back) send(MotorController::Command::IDcMax, back->command.right.iDcMax); break; case 5: - if (front) send(MotorController::Command::NMotMax, front->command.left.nMotMax); - if (front) send(MotorController::Command::NMotMax, front->command.right.nMotMax); - if (back) send(MotorController::Command::NMotMax, back->command.left.nMotMax); - if (back) send(MotorController::Command::NMotMax, back->command.right.nMotMax); +#if defined(HAS_SIMPLIFIED) + SIMPLIFIED_NMOTMAX +#endif + if (front) send(MotorController::Command::NMotMax, front->command.left.nMotMax); + if (front) send(MotorController::Command::NMotMax, front->command.right.nMotMax); + if (back) send(MotorController::Command::NMotMax, back->command.left.nMotMax); + if (back) send(MotorController::Command::NMotMax, back->command.right.nMotMax); break; case 6: - if (front) send(MotorController::Command::FieldWeakMax, front->command.left.fieldWeakMax); - if (front) send(MotorController::Command::FieldWeakMax, front->command.right.fieldWeakMax); - if (back) send(MotorController::Command::FieldWeakMax, back->command.left.fieldWeakMax); - if (back) send(MotorController::Command::FieldWeakMax, back->command.right.fieldWeakMax); +#if defined(HAS_SIMPLIFIED) + SIMPLIFIED_FIELDWEAKMAX +#endif + if (front) send(MotorController::Command::FieldWeakMax, front->command.left.fieldWeakMax); + if (front) send(MotorController::Command::FieldWeakMax, front->command.right.fieldWeakMax); + if (back) send(MotorController::Command::FieldWeakMax, back->command.left.fieldWeakMax); + if (back) send(MotorController::Command::FieldWeakMax, back->command.right.fieldWeakMax); break; case 7: if (front) send(MotorController::Command::PhaseAdvMax, front->command.left.phaseAdvMax); diff --git a/main/displays/lockscreen.h b/main/displays/lockscreen.h index 5f9e4f8..05a3cb8 100644 --- a/main/displays/lockscreen.h +++ b/main/displays/lockscreen.h @@ -12,6 +12,10 @@ #include "modes/ignoreinputmode.h" #include "buttons.h" +#ifdef LOCKSCREEN_PLUGIN +#include "ledstrip.h" +#endif + namespace { class MainMenu; } @@ -118,6 +122,10 @@ void Lockscreen::redraw() if (m_numbers == settings.lockscreen.pin) { switchScreen(); +#ifdef LOCKSCREEN_PLUGIN +#pragma message "Activating Lockscreen Plugin" +#include LOCKSCREEN_PLUGIN +#endif return; } diff --git a/main/displays/menus/ledstripmenu.h b/main/displays/menus/ledstripmenu.h index a635a8f..17d7dc8 100644 --- a/main/displays/menus/ledstripmenu.h +++ b/main/displays/menus/ledstripmenu.h @@ -76,18 +76,18 @@ class LedstripMenu : public: LedstripMenu() { - constructMenuItem, ToggleBoolAction, CheckboxIcon, EnableLedAnimationAccessor>>(); - constructMenuItem, ToggleBoolAction, CheckboxIcon, EnableBrakeLightsAccessor>>(); - constructMenuItem, ToggleBoolAction, CheckboxIcon, EnableBeepWhenBlinkAccessor>>(); - constructMenuItem, ToggleBoolAction, CheckboxIcon, EnableFullBlinkAccessor>>(); - constructMenuItem, SwitchScreenAction>>(); - constructMenuItem, SwitchScreenAction>>(); - constructMenuItem, SwitchScreenAction>>(); - constructMenuItem, SwitchScreenAction>>(); - constructMenuItem, SwitchScreenAction>>(); - constructMenuItem, SwitchScreenAction>>(); - constructMenuItem, SwitchScreenAction>>(); - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); + constructMenuItem, ToggleBoolAction, CheckboxIcon, EnableLedAnimationAccessor>>(); + constructMenuItem, ToggleBoolAction, CheckboxIcon, EnableBrakeLightsAccessor>>(); + constructMenuItem, ToggleBoolAction, CheckboxIcon, EnableBeepWhenBlinkAccessor>>(); + constructMenuItem, ToggleBoolAction, CheckboxIcon, EnableFullBlinkAccessor>>(); + constructMenuItem, SwitchScreenAction>>(); + constructMenuItem, SwitchScreenAction>>(); + if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } + if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } + if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } + if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } + if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } + constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); } }; #endif diff --git a/main/displays/menus/mainmenu.h b/main/displays/menus/mainmenu.h index f5e7739..e5c3020 100644 --- a/main/displays/menus/mainmenu.h +++ b/main/displays/menus/mainmenu.h @@ -57,36 +57,36 @@ class MainMenu : public: MainMenu() { - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::modes>>>(); + constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); + constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::modes>>>(); #ifdef FEATURE_LEDSTRIP - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::neopixel>>>(); + constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::neopixel>>>(); #endif - constructMenuItem, ModeSettingsAction>>(); - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::presets>>>(); - constructMenuItem, SwitchScreenAction>>(); - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::graph>>>(); + if (!simplified) { constructMenuItem, ModeSettingsAction>>(); } + if (!simplified) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::presets>>>(); } + if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } + if (!simplified) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::graph>>>(); } #if defined(FEATURE_CAN) && defined(FEATURE_POWERSUPPLY) - constructMenuItem, SwitchScreenAction>>(); + if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } #endif #if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS) - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::bms>>>(); + if (!simplified) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::bms>>>(); } #endif - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::settings>>>(); - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::lock>>>(); + if (!simplified) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::settings>>>(); } + constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::lock>>>(); #ifdef FEATURE_MOSFETS - constructMenuItem, SwitchScreenAction>>(); + if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } #endif - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::demos>>>(); + constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::demos>>>(); #ifdef FEATURE_GARAGE - constructMenuItem, SwitchScreenAction>>(); + if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } #endif #ifdef FEATURE_OTA - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::update>>>(); + if (!simplified) { constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::update>>>(); } #endif - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::poweroff>>>(); - constructMenuItem, RebootAction, StaticMenuItemIcon<&icons::reboot>>>(); - constructMenuItem, SwitchScreenAction>>(); + constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&icons::poweroff>>>(); + constructMenuItem, RebootAction, StaticMenuItemIcon<&icons::reboot>>>(); + if (!simplified) { constructMenuItem, SwitchScreenAction>>(); } } }; } // namespace diff --git a/main/displays/menus/selectmodemenu.h b/main/displays/menus/selectmodemenu.h index 65a64c0..800eb53 100644 --- a/main/displays/menus/selectmodemenu.h +++ b/main/displays/menus/selectmodemenu.h @@ -47,14 +47,14 @@ class SelectModeMenu : public: SelectModeMenu() { - constructMenuItem, MultiAction>>>(); - constructMenuItem, MultiAction>>>(); - constructMenuItem, MultiAction>>>(); - constructMenuItem, MultiAction>>>(); + constructMenuItem, MultiAction>>>(); + if (!simplified) { constructMenuItem, MultiAction>>>(); } + constructMenuItem, MultiAction>>>(); + if (!simplified) { constructMenuItem, MultiAction>>>(); } #ifdef FEATURE_GAMETRAK - constructMenuItem, MultiAction>>>(); + constructMenuItem, MultiAction>>>(); #endif - constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); + constructMenuItem, SwitchScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>(); } void start() override; diff --git a/main/globals.h b/main/globals.h index a40a453..8429f1c 100644 --- a/main/globals.h +++ b/main/globals.h @@ -41,6 +41,12 @@ float avgSpeed, avgSpeedKmh, sumCurrent; char deviceName[32] = STRING(DEVICE_PREFIX) "_ERR"; +#if defined(SIMPLIFIED_TRIGGER_TRIGGERONPRESET) +bool simplified = true; +#else +bool simplified = false; +#endif + Settings settings; StringSettings stringSettings; SettingsPersister settingsPersister; diff --git a/main/settings.h b/main/settings.h index 8092b81..3424252 100644 --- a/main/settings.h +++ b/main/settings.h @@ -29,7 +29,6 @@ struct Settings #ifdef FEATURE_BMS bool autoConnectBms; #endif - struct Buzzer { bool reverseBeep; uint8_t reverseBeepFreq0; diff --git a/main/settingsutils.h b/main/settingsutils.h index eef720d..c06e19f 100644 --- a/main/settingsutils.h +++ b/main/settingsutils.h @@ -13,6 +13,13 @@ void switchProfile(uint8_t index) settings = presets::defaultSettings; stringSettings = presets::makeDefaultStringSettings(); +#ifdef SIMPLIFIED_TRIGGER_TRIGGERONPRESET + if (index == SIMPLIFIED_TRIGGER_TRIGGERONPRESET) + { + simplified = true; + } +#endif + if (!settingsPersister.openProfile(index)) { ESP_LOGE("BOBBY", "openProfile() failed"); diff --git a/main/utils.h b/main/utils.h index 317e2a8..e032f4e 100644 --- a/main/utils.h +++ b/main/utils.h @@ -238,6 +238,7 @@ bool loadSettings() bool saveSettings() { + if (simplified) return true; bool result{true}; if (!settingsPersister.save(settings)) result = false;