Skip to content

Commit

Permalink
fixed delay in leaving time panel
Browse files Browse the repository at this point in the history
  • Loading branch information
barry-ha committed Jan 26, 2024
1 parent b1a78f7 commit 414d612
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
18 changes: 10 additions & 8 deletions Griduino.ino
Expand Up @@ -964,9 +964,9 @@ void loop() {
model->makeLocation(&whereAmI);
trail.rememberGPS(whereAmI);
logger.fencepost("Griduino.ino new grid4",__LINE__); // debug
trail.saveGPSBreadcrumbTrail();
trail.saveGPSBreadcrumbTrail(); // entered new 4-digit grid

model->save(); // tell the model to save itself
model->save(); // entered new 4-digit grid

} else if (model->enteredNewGrid6()) {
if (!model->compare4digits) {
Expand All @@ -976,11 +976,12 @@ void loop() {
model->makeLocation(&whereAmI);
trail.rememberGPS(whereAmI); // when we enter a new 6-digit grid, save it in breadcrumb trail
logger.fencepost("Griduino.ino new grid6",__LINE__); // debug
trail.saveGPSBreadcrumbTrail(); // because one user's home was barely in the next grid6
// and we want to show his grid6 at next power up
trail.saveGPSBreadcrumbTrail(); // entered new 6-digit grid
// one user's home was barely in the next grid6
// and we want to show his grid6 at next power up
// ALSO when entering a 6-digit grid: tell the model to save itself!
// It's the _model_ that puts up the starting location at next power-up
model->save();
model->save(); // entered new 6-digit grid
}

// if we drove far enough, add this to the breadcrumb trail
Expand All @@ -993,7 +994,8 @@ void loop() {
prevRememberedGPS = currentGPS;

if (0 == (trail.getHistoryCount() % trail.saveInterval)) {
trail.saveGPSBreadcrumbTrail();
logger.fencepost("Moved a visible distance",__LINE__); // debug
trail.saveGPSBreadcrumbTrail(); // have moved a visible distance
}
}

Expand All @@ -1016,10 +1018,10 @@ void loop() {

Location whereAmI;
model->makeLocation(&whereAmI);
//logger.fencepost("Griduino.ino autolog timer",__LINE__); // debug
logger.fencepost("Griduino.ino autolog timer",__LINE__); // debug
//whereAmI.printLocation(); // debug
trail.rememberGPS(whereAmI);
trail.saveGPSBreadcrumbTrail();
trail.saveGPSBreadcrumbTrail(); // autosave timer
}

// if there's touchscreen input, handle it
Expand Down
4 changes: 3 additions & 1 deletion view_time.h
Expand Up @@ -220,7 +220,9 @@ void ViewTime::endScreen() {
// We save our settings here instead of on each button press
// because writing to NVR is slow (0.5 sec) and would delay the user
// while trying to press a button many times in a row.
model->save();
//model->save(); // BUT! this slows down showing the next view
// TODO: schedule the "model->save" until some idle time with no
// user input, say 10 seconds of no touches
}

bool ViewTime::onTouch(Point touch) {
Expand Down

0 comments on commit 414d612

Please sign in to comment.