Factory Reset

This commit is contained in:
Dejvino 2026-02-17 00:52:36 +01:00
parent 225d04a53c
commit c6e2248090

View File

@ -37,7 +37,7 @@ const int mainMenuCount = sizeof(mainMenu) / sizeof(char*);
const char* randomizeMenu[] = { "Back", "Melody", "Flavour", "Scale", "Tempo", "Mutation", "Song Mode", "Theme 1", "Theme 2", "Theme 3", "Theme 4", "Theme 5", "Theme 6", "Theme 7" }; const char* randomizeMenu[] = { "Back", "Melody", "Flavour", "Scale", "Tempo", "Mutation", "Song Mode", "Theme 1", "Theme 2", "Theme 3", "Theme 4", "Theme 5", "Theme 6", "Theme 7" };
const int THEME_1_INDEX = 7; const int THEME_1_INDEX = 7;
const int randomizeMenuCount = sizeof(randomizeMenu) / sizeof(char*); const int randomizeMenuCount = sizeof(randomizeMenu) / sizeof(char*);
const char* setupMenu[] = { "Back", "Channel", "Save", "Load" }; const char* setupMenu[] = { "Back", "Channel", "Factory Reset" };
const int setupMenuCount = sizeof(setupMenu) / sizeof(char*); const int setupMenuCount = sizeof(setupMenu) / sizeof(char*);
int menuSelection = 0; int menuSelection = 0;
@ -149,6 +149,15 @@ bool loadSequence() {
return true; return true;
} }
void factoryReset() {
ui.showMessage("RESETTING...");
uint32_t magic = 0;
EEPROM.put(0, magic);
EEPROM.commit();
delay(500);
rp2040.reboot();
}
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
@ -356,14 +365,7 @@ void handleInput() {
case UI_MENU_SETUP: case UI_MENU_SETUP:
if (menuSelection == 0) { currentState = UI_MENU_MAIN; menuSelection = 2; } if (menuSelection == 0) { currentState = UI_MENU_MAIN; menuSelection = 2; }
if (menuSelection == 1) currentState = UI_SETUP_CHANNEL_EDIT; if (menuSelection == 1) currentState = UI_SETUP_CHANNEL_EDIT;
if (menuSelection == 2) { if (menuSelection == 2) factoryReset();
saveSequence();
currentState = UI_MENU_MAIN;
}
if (menuSelection == 3) {
if (loadSequence()) ui.showMessage("LOADED!");
currentState = UI_MENU_MAIN;
}
break; break;
case UI_SETUP_CHANNEL_EDIT: case UI_SETUP_CHANNEL_EDIT:
currentState = UI_MENU_SETUP; currentState = UI_MENU_SETUP;