Skip to content

Commit

Permalink
[APPS] save/visual feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmxmx committed Jan 24, 2017
1 parent 670bfee commit d9efcc9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 15 additions & 1 deletion software/o_c_REV/OC_apps.ino
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void save_app_data() {
}

AppChunkHeader *chunk = reinterpret_cast<AppChunkHeader *>(data);
SERIAL_PRINTLN("*");
SERIAL_PRINTLN("* storing: ");
chunk->id = app.id;
chunk->length = storage_size;
size_t used = app.Save(chunk + 1);
Expand Down Expand Up @@ -304,6 +304,16 @@ void draw_app_menu(const menu::ScreenCursor<5> &cursor) {
GRAPHICS_END_FRAME();
}

void draw_save_message(uint8_t c) {

GRAPHICS_BEGIN_FRAME(true);
graphics.movePrintPos(weegfx::Graphics::kFixedFontW, 0);
graphics.print("saving ");
for (int i = 0; i < c; i++)
graphics.print(".");
GRAPHICS_END_FRAME();
}

void Ui::AppSettings() {

SetButtonIgnoreMask();
Expand Down Expand Up @@ -352,6 +362,10 @@ void Ui::AppSettings() {
if (save) {
save_global_settings();
save_app_data();
// draw message:
int cnt = 0;
while(idle_time() < SETTINGS_SAVE_TIMEOUT_MS)
draw_save_message((cnt++) >> 7);
}
}

Expand Down
1 change: 1 addition & 0 deletions software/o_c_REV/OC_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ static constexpr unsigned long SPLASHSCREEN_DELAY_MS = 1000;
static constexpr unsigned long SPLASHSCREEN_TIMEOUT_MS = 2048;

static constexpr unsigned long APP_SELECTION_TIMEOUT_MS = 25000;
static constexpr unsigned long SETTINGS_SAVE_TIMEOUT_MS = 1000;

#define EEPROM_CALIBRATIONDATA_START 0
#define EEPROM_CALIBRATIONDATA_END 128
Expand Down

0 comments on commit d9efcc9

Please sign in to comment.