Skip to content

Commit

Permalink
updated fencepost debug statements
Browse files Browse the repository at this point in the history
  • Loading branch information
barry-ha committed Apr 30, 2023
1 parent cd96ea6 commit 2760cd6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Griduino.ino
Original file line number Diff line number Diff line change
Expand Up @@ -759,11 +759,13 @@ void setup() {
pinMode(RED_LED, OUTPUT); // diagnostics RED LED

// ----- restore GPS driving track breadcrumb trail
logger.fencepost("Griduino.ino restore",__LINE__); // debug
trail.restoreGPSBreadcrumbTrail(); // this takes noticeable time (~0.2 sec)
model->restore(); //
model->gHaveGPSfix = false; // assume no satellite signal yet
model->gSatellites = 0;
trail.rememberPUP(); // log a "power up" event
logger.fencepost("Griduino.ino save after restore",__LINE__); // debug
trail.saveGPSBreadcrumbTrail(); // ensure its saved for posterity

// ----- restore barometric pressure log
Expand Down Expand Up @@ -868,6 +870,7 @@ void loop() {
TimeElements tm{GPS.seconds, GPS.minute, GPS.hour, 0, GPS.day, GPS.month, (byte)(2000-1970+GPS.year)};
time_t firstTime = makeTime(tm);
trail.rememberFirstValidTime(firstTime, GPS.satellites);
logger.fencepost("Griduino.ino first valid time",__LINE__); // debug
trail.saveGPSBreadcrumbTrail(); // ensure its saved for posterity
}

Expand Down Expand Up @@ -946,6 +949,7 @@ void loop() {

Location whereAmI = model->makeLocation();
trail.rememberGPS(whereAmI);
logger.fencepost("Griduino.ino new grid4",__LINE__); // debug
trail.saveGPSBreadcrumbTrail();

} else if (model->enteredNewGrid6()) {
Expand All @@ -954,6 +958,7 @@ void loop() {
}
Location whereAmI = model->makeLocation();
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
}
Expand All @@ -967,6 +972,7 @@ void loop() {
prevRememberedGPS = currentGPS;

if (0 == (trail.getHistoryCount() % trail.saveInterval)) {
logger.fencepost("Griduino.ino distance",__LINE__); // debug
trail.saveGPSBreadcrumbTrail();
}
}
Expand All @@ -977,6 +983,7 @@ void loop() {

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

Expand Down
1 change: 1 addition & 0 deletions commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ void erase_gps_history() {
trail.clearHistory();
trail.rememberPUP();
trail.deleteFile(); // out with the old history file
logger.fencepost("commands.cpp", __LINE__);
trail.saveGPSBreadcrumbTrail(); // start over with new history file
}

Expand Down
3 changes: 1 addition & 2 deletions model_gps.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Model {
bool compare4digits = true; // true=4 digit, false=6 digit comparisons

protected:
int gPrevFix = false; // previous value of gHaveGPSfix, to help detect "signal lost"
int gPrevFix = false; // previous value of gPrevFix, to help detect "signal lost"
char sPrevGrid4[5] = INIT_GRID4; // previous value of gsGridName, to help detect "enteredNewGrid4()"
char sPrevGrid6[7] = INIT_GRID6; // previous value of gsGridName, to help detect "enteredNewGrid6()"

Expand Down Expand Up @@ -114,7 +114,6 @@ class Model {
}
// note: the caller is responsible for fixups to the model,
// e.g., indicate 'lost satellite signal'
logger.fencepost("model_gps.h", __LINE__);
return rc; // return success
}

Expand Down
2 changes: 1 addition & 1 deletion save_restore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ int SaveRestoreStrings::open(const char *fqFilename, const char *mode) { // ht
if (*mode == 'w') {
logger.info("Writing to file system: ", fqFilename);
} else {
logger.info("Opening text file system: ", fqFilename);
logger.info("Reading from file system: ", fqFilename);
}

int result = openFlash(); // open file system and report errors
Expand Down

0 comments on commit 2760cd6

Please sign in to comment.