Merge pull request #368 from bobbycar-graz/improvements
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
set(BOBBY_APP_NAME testdevice)
|
set(BOBBY_APP_NAME testdevice)
|
||||||
|
set(BOBBY_DEFAULT_OTA_NAME testdevice)
|
||||||
|
|
||||||
add_definitions(
|
add_definitions(
|
||||||
-DUSER_SETUP_LOADED=1
|
-DUSER_SETUP_LOADED=1
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
set(BOBBY_APP_NAME testdevice2)
|
set(BOBBY_APP_NAME testdevice2)
|
||||||
|
set(BOBBY_DEFAULT_OTA_NAME testdevice2)
|
||||||
|
|
||||||
add_definitions(
|
add_definitions(
|
||||||
-DUSER_SETUP_LOADED=1
|
-DUSER_SETUP_LOADED=1
|
||||||
|
@ -24,6 +24,7 @@ set(headers
|
|||||||
actions/modesettingsaction.h
|
actions/modesettingsaction.h
|
||||||
actions/qraction.h
|
actions/qraction.h
|
||||||
actions/rebootaction.h
|
actions/rebootaction.h
|
||||||
|
actions/resetnvsaction.h
|
||||||
actions/savesettingsaction.h
|
actions/savesettingsaction.h
|
||||||
actions/switchprofileaction.h
|
actions/switchprofileaction.h
|
||||||
actions/tempomatmodeapplycurrentpeedaction.h
|
actions/tempomatmodeapplycurrentpeedaction.h
|
||||||
@ -278,6 +279,7 @@ set(sources
|
|||||||
actions/modesettingsaction.cpp
|
actions/modesettingsaction.cpp
|
||||||
actions/qraction.cpp
|
actions/qraction.cpp
|
||||||
actions/rebootaction.cpp
|
actions/rebootaction.cpp
|
||||||
|
actions/resetnvsaction.cpp
|
||||||
actions/savesettingsaction.cpp
|
actions/savesettingsaction.cpp
|
||||||
actions/switchprofileaction.cpp
|
actions/switchprofileaction.cpp
|
||||||
actions/tempomatmodeapplycurrentpeedaction.cpp
|
actions/tempomatmodeapplycurrentpeedaction.cpp
|
||||||
|
11
main/actions/resetnvsaction.cpp
Normal file
11
main/actions/resetnvsaction.cpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include "resetnvsaction.h"
|
||||||
|
|
||||||
|
// system includes
|
||||||
|
#include <esp_system.h>
|
||||||
|
#include <nvs_flash.h>
|
||||||
|
|
||||||
|
void ResetNVSAction::triggered()
|
||||||
|
{
|
||||||
|
nvs_flash_erase();
|
||||||
|
esp_restart();
|
||||||
|
}
|
10
main/actions/resetnvsaction.h
Normal file
10
main/actions/resetnvsaction.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// 3rdparty lib includes
|
||||||
|
#include <actioninterface.h>
|
||||||
|
|
||||||
|
class ResetNVSAction : public virtual espgui::ActionInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void triggered() override;
|
||||||
|
};
|
@ -5,12 +5,15 @@
|
|||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "actions/rebootaction.h"
|
#include "actions/rebootaction.h"
|
||||||
|
#include "actions/resetnvsaction.h"
|
||||||
#include "bobbycheckbox.h"
|
#include "bobbycheckbox.h"
|
||||||
#include "bobbyerrorhandler.h"
|
#include "bobbyerrorhandler.h"
|
||||||
|
#include "icons/info.h"
|
||||||
#include "icons/reboot.h"
|
#include "icons/reboot.h"
|
||||||
#include "newsettings.h"
|
#include "newsettings.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
constexpr char TEXT_RESET_NVS[] = "Reset NVS";
|
||||||
constexpr char TEXT_REBOOT[] = "Reboot";
|
constexpr char TEXT_REBOOT[] = "Reboot";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +50,7 @@ RecoveryMenu::RecoveryMenu()
|
|||||||
configs.callForEveryFeature([&](ConfiguredFeatureFlag &feature){
|
configs.callForEveryFeature([&](ConfiguredFeatureFlag &feature){
|
||||||
constructMenuItem<BasicFeatureFlagMenuItem>(feature);
|
constructMenuItem<BasicFeatureFlagMenuItem>(feature);
|
||||||
});
|
});
|
||||||
|
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_RESET_NVS>, ResetNVSAction, StaticMenuItemIcon<&bobbyicons::info>>>();
|
||||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_REBOOT>, RebootAction, StaticMenuItemIcon<&bobbyicons::reboot>>>();
|
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_REBOOT>, RebootAction, StaticMenuItemIcon<&bobbyicons::reboot>>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +101,8 @@ extern "C" void app_main()
|
|||||||
if (const auto result = configs.init("bobbycar"); result != ESP_OK)
|
if (const auto result = configs.init("bobbycar"); result != ESP_OK)
|
||||||
ESP_LOGE(TAG, "config_init_settings() failed with %s", esp_err_to_name(result));
|
ESP_LOGE(TAG, "config_init_settings() failed with %s", esp_err_to_name(result));
|
||||||
|
|
||||||
|
updateRotation();
|
||||||
|
|
||||||
profileSettings = presets::defaultProfileSettings;
|
profileSettings = presets::defaultProfileSettings;
|
||||||
|
|
||||||
if (settingsPersister.init())
|
if (settingsPersister.init())
|
||||||
|
@ -33,6 +33,16 @@ void initScreen()
|
|||||||
bootLabel.start();
|
bootLabel.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateRotation()
|
||||||
|
{
|
||||||
|
if (tft.getRotation() != (configs.boardcomputerHardware.flipScreen.value() ? 2 : 0))
|
||||||
|
{
|
||||||
|
tft.setRotation(configs.boardcomputerHardware.flipScreen.value() ? 2 : 0);
|
||||||
|
if (currentDisplay)
|
||||||
|
currentDisplay->initScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void updateDisplay()
|
void updateDisplay()
|
||||||
{
|
{
|
||||||
if (currentDisplay)
|
if (currentDisplay)
|
||||||
@ -44,12 +54,7 @@ void updateDisplay()
|
|||||||
changeScreenCallback = {};
|
changeScreenCallback = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tft.getRotation() != (configs.boardcomputerHardware.flipScreen.value() ? 2 : 0))
|
updateRotation();
|
||||||
{
|
|
||||||
tft.setRotation(configs.boardcomputerHardware.flipScreen.value() ? 2 : 0);
|
|
||||||
if (currentDisplay)
|
|
||||||
currentDisplay->initScreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (const int8_t rawButton = rawButtonRequest.load(); rawButton != -1 && currentDisplay)
|
if (const int8_t rawButton = rawButtonRequest.load(); rawButton != -1 && currentDisplay)
|
||||||
{
|
{
|
||||||
|
@ -7,4 +7,5 @@ extern espgui::Label bootLabel;
|
|||||||
|
|
||||||
void initScreen();
|
void initScreen();
|
||||||
void updateDisplay();
|
void updateDisplay();
|
||||||
|
void updateRotation();
|
||||||
void redrawDisplay();
|
void redrawDisplay();
|
||||||
|
Reference in New Issue
Block a user