diff --git a/software/o_c_REV/OC_apps.ino b/software/o_c_REV/OC_apps.ino index 8388e98e..73b138a0 100644 --- a/software/o_c_REV/OC_apps.ino +++ b/software/o_c_REV/OC_apps.ino @@ -350,6 +350,15 @@ void draw_save_message(uint8_t c) { GRAPHICS_END_FRAME(); } +void Ui::SaveSettings() { + save_global_settings(); + save_app_data(); + // draw message: + int cnt = 0; + while(idle_time() < SETTINGS_SAVE_TIMEOUT_MS) + draw_save_message((cnt++) >> 4); +} + void Ui::AppSettings() { SetButtonIgnoreMask(); diff --git a/software/o_c_REV/OC_options.h b/software/o_c_REV/OC_options.h index bc884293..245b1f7e 100644 --- a/software/o_c_REV/OC_options.h +++ b/software/o_c_REV/OC_options.h @@ -30,7 +30,8 @@ //#define DAC8564 /* ------------ 0 / 10V range --------------------------------------------------------------------------------------------------------------------------- */ //#define IO_10V - +/* ------------ uncomment for all settings to get saved whenever the user invokes the screensaver shortcut ---------------------------------------------- */ +// #define screensaver_quick_save /* do not edit the stuff below (unless ... ) */ diff --git a/software/o_c_REV/OC_ui.h b/software/o_c_REV/OC_ui.h index cbc456c0..44661323 100644 --- a/software/o_c_REV/OC_ui.h +++ b/software/o_c_REV/OC_ui.h @@ -59,6 +59,7 @@ class Ui { void DebugStats(); void Calibrate(); void AppSettings(); + void SaveSettings(); UiMode DispatchEvents(OC::App *app); void Poll(); diff --git a/software/o_c_REV/o_c_REV.ino b/software/o_c_REV/o_c_REV.ino index 098bc866..34a0d7c8 100644 --- a/software/o_c_REV/o_c_REV.ino +++ b/software/o_c_REV/o_c_REV.ino @@ -190,8 +190,12 @@ void FASTRUN loop() { // State transition for app if (mode != ui_mode) { - if (OC::UI_MODE_SCREENSAVER == mode) + if (OC::UI_MODE_SCREENSAVER == mode) { + #ifdef screensaver_quick_save + OC::ui.SaveSettings(); + #endif OC::apps::current_app->HandleAppEvent(OC::APP_EVENT_SCREENSAVER_ON); + } else if (OC::UI_MODE_SCREENSAVER == ui_mode) OC::apps::current_app->HandleAppEvent(OC::APP_EVENT_SCREENSAVER_OFF); ui_mode = mode;