Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add quick save option via screensaver shortcut #95

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions software/o_c_REV/OC_apps.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion software/o_c_REV/OC_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ... ) */

Expand Down
1 change: 1 addition & 0 deletions software/o_c_REV/OC_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class Ui {
void DebugStats();
void Calibrate();
void AppSettings();
void SaveSettings();
UiMode DispatchEvents(OC::App *app);

void Poll();
Expand Down
6 changes: 5 additions & 1 deletion software/o_c_REV/o_c_REV.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down