Skip to content

Commit

Permalink
continue replacing "Serial.print()" with "logger.subject()"
Browse files Browse the repository at this point in the history
  • Loading branch information
barry-ha committed Sep 2, 2024
1 parent 6763cdc commit c90e512
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 25 deletions.
8 changes: 4 additions & 4 deletions cfg_audio_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class ViewCfgAudioType : public View {

// ---------- local functions for this derived class ----------
void setMorse() {
logger.info("->->-> Clicked MORSE CODE button.");
logger.config("->->-> Clicked MORSE CODE button.");
selectedAudio = MORSE;
updateScreen(); // update UI before the long pause to send sample audio

Expand All @@ -120,7 +120,7 @@ class ViewCfgAudioType : public View {
}

void setSpeech() {
logger.info("->->-> Clicked SPEECH button.");
logger.config("->->-> Clicked SPEECH button.");
selectedAudio = MORSE; // 2024-01-03 disabled "SPEECH" temporarily because it's a crasher
updateScreen(); // update UI before the long pause to send sample audio

Expand All @@ -130,7 +130,7 @@ class ViewCfgAudioType : public View {
announceGrid(newGrid4, 4); // announce 4-digit grid by Morse code OR speech
}
void setNone() {
logger.info("->->-> Clicked NO AUDIO button.");
logger.config("->->-> Clicked NO AUDIO button.");
selectedAudio = NO_AUDIO;
updateScreen(); // update UI before the long pause to send sample audio
}
Expand Down Expand Up @@ -221,7 +221,7 @@ void ViewCfgAudioType::endScreen() {
}

bool ViewCfgAudioType::onTouch(Point touch) {
logger.info("->->-> Touched settings screen.");
logger.config("->->-> Touched settings screen.");
bool handled = false; // assume a touch target was not hit
for (int ii = 0; ii < nButtonsAudio; ii++) {
FunctionButton item = myButtons[ii];
Expand Down
6 changes: 3 additions & 3 deletions cfg_crossing.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ViewCfgCrossing : public View {

// ---------- local functions for this derived class ----------
void f4Digit() {
logger.info("->->-> Clicked 4-DIGIT button.");
logger.config("->->-> Clicked 4-DIGIT button.");
model->compare4digits = true;
this->updateScreen(); // update UI before starting the slow morse code

Expand All @@ -104,7 +104,7 @@ class ViewCfgCrossing : public View {
}

void f6Digit() {
logger.info("->->-> Clicked 6-DIGIT button.");
logger.config("->->-> Clicked 6-DIGIT button.");
model->compare4digits = false;
this->updateScreen(); // update UI before starting the slow morse code

Expand Down Expand Up @@ -205,7 +205,7 @@ void ViewCfgCrossing::startScreen() {
} // end startScreen()

bool ViewCfgCrossing::onTouch(Point touch) {
logger.info("->->-> Touched settings screen.");
logger.config("->->-> Touched settings screen.");
bool handled = false; // assume a touch target was not hit
for (int ii = 0; ii < nButtonsDigits; ii++) {
FunctionButton item = myButtons[ii];
Expand Down
11 changes: 5 additions & 6 deletions cfg_gps.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,26 +110,25 @@ class ViewCfgGPS : public View {

// ---------- local functions for this derived class ----------
void fClear() {
logger.info("->->-> Clicked CLEAR button.");
logger.config("->->-> Clicked CLEAR button.");
trail.clearHistory();
trail.rememberPUP();
trail.deleteFile(); // out with the old history file
logger.fencepost("cfg_gps.h", __LINE__);
trail.saveGPSBreadcrumbTrail(); // start over with new history file
}
void fReceiver() {
// select GPS receiver data
logger.info("->->-> Clicked GPS RECEIVER button.");
logger.config("->->-> Clicked GPS RECEIVER button.");
fSetReceiver(); // use "class Model" for GPS receiver hardware
}
void fSimulated() {
// simulate satellite track
logger.info("->->-> Clicked GPS SIMULATOR button.");
logger.config("->->-> Clicked GPS SIMULATOR button.");
fSetSimulated(); // use "class MockModel" for simulated track
}
void fFactoryReset() {
// todo: clear all settings, erase all saved files
logger.info("->->-> Clicked FACTORY RESET button.");
logger.config("->->-> Clicked FACTORY RESET button.");
}

}; // end class ViewCfgGPS
Expand Down Expand Up @@ -211,7 +210,7 @@ void ViewCfgGPS::startScreen() {
}

bool ViewCfgGPS::onTouch(Point touch) {
logger.info("->->-> Touched settings screen.");
logger.config("->->-> Touched settings screen.");
bool handled = false; // assume a touch target was not hit
for (int ii = 0; ii < nButtonsGPS; ii++) {
FunctionButton item = settings2Buttons[ii];
Expand Down
4 changes: 2 additions & 2 deletions cfg_gps_reset.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ enum buttonID {

// ---------- local functions for this derived class ----------
void fRestart() {
logger.info("->->-> Clicked RESTART button.");
logger.config("->->-> Clicked RESTART button.");
txtStatic[CONFIRMATION].color = cVALUEFAINT;
txtStatic[CONFIRMATION].dirty = true;
txtStatic[CONFIRMATION].print();
Expand Down Expand Up @@ -171,7 +171,7 @@ void ViewCfgGpsReset::startScreen() {
} // end startScreen()

bool ViewCfgGpsReset::onTouch(Point touch) {
logger.info("->->-> Touched GPS restart screen.");
logger.config("->->-> Touched GPS restart screen.");
bool handled = false; // assume a touch target was not hit
for (int ii = 0; ii < nRestartButtons; ii++) {
FunctionButton item = myButtons[ii];
Expand Down
8 changes: 4 additions & 4 deletions cfg_reboot.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ enum buttonID {
// ---------- local functions for this derived class ----------
void rebootGriduino() { // operator confirmed: reboot to USB for software update
// Do The Thing!
logger.info("---> REBOOTING"); // the end of our world is nigh
logger.warning("---> REBOOTING"); // the end of our world is nigh
delay(100); // allow time for Serial to send message

this->clearScreen(this->background); // clear screen and post message
Expand Down Expand Up @@ -159,11 +159,11 @@ enum buttonID {
#endif
}
void fCancel() {
logger.info("->->-> Clicked CANCEL button.");
logger.config("->->-> Clicked CANCEL button.");
selectNewView(goto_next_cfg);
}
void fReboot() {
logger.info("->->-> Clicked REBOOT button.");
logger.config("->->-> Clicked REBOOT button.");
rebootGriduino();
}

Expand Down Expand Up @@ -212,7 +212,7 @@ void ViewCfgReboot::startScreen() {
} // end startScreen()

bool ViewCfgReboot::onTouch(Point touch) {
logger.info("->->-> Touched reboot screen.");
logger.config("->->-> Touched reboot screen.");
bool handled = false; // assume a touch target was not hit
for (int ii = 0; ii < nRebootButtons; ii++) {
FunctionButton item = myButtons[ii];
Expand Down
4 changes: 2 additions & 2 deletions cfg_rotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class ViewCfgRotation : public View {

// ---------- local functions for this derived class ----------
void fRotateScreen() {
logger.info("->->-> Clicked OTHER EDGE UP button.");
logger.config("->->-> Clicked OTHER EDGE UP button.");
if (this->screenRotation == LANDSCAPE) {
this->setScreenRotation(FLIPPED_LANDSCAPE);
} else {
Expand Down Expand Up @@ -191,7 +191,7 @@ void ViewCfgRotation::startScreen() {
} // end startScreen()

bool ViewCfgRotation::onTouch(Point touch) {
logger.info("->->-> Touched settings screen.");
logger.config("->->-> Touched settings screen.");
bool handled = false; // assume a touch target was not hit
for (int ii = 0; ii < nButtons; ii++) {
FunctionButton item = myButtons[ii];
Expand Down
4 changes: 2 additions & 2 deletions cfg_units.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ class ViewCfgUnits : public View {

// ---------- local functions for this derived class ----------
void setEnglish() {
logger.info("->->-> Clicked ENGLISH UNITS button.");
logger.config("->->-> Clicked ENGLISH UNITS button.");
model->setEnglish();
}
void setMetric() {
logger.info("->->-> Clicked METRIC UNITS button.");
logger.config("->->-> Clicked METRIC UNITS button.");
model->setMetric();
}

Expand Down
2 changes: 1 addition & 1 deletion cfg_volume.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ void ViewVolume::endScreen() {
}

bool ViewVolume::onTouch(Point touch) {
logger.info("->->-> Touched volume screen.");
logger.config("->->-> Touched volume screen.");
bool handled = false; // assume a touch target was not hit
for (int ii = 0; ii < nVolButtons; ii++) {
FunctionButton item = volButtons[ii];
Expand Down
2 changes: 1 addition & 1 deletion cfg_volume2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void startVolume2Screen() {
updateVolume2Screen(); // fill in values immediately, don't wait for loop() to eventually get around to it
}
bool onTouchVolume2(Point touch) {
logger.info("->->-> Touched volume2 screen.");
logger.config("->->-> Touched volume2 screen.");
bool handled = false; // assume a touch target was not hit
for (int ii = 0; ii < nVolButtons; ii++) {
Button item = volButtons2[ii];
Expand Down
9 changes: 9 additions & 0 deletions logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Logger {
bool print_fencepost = false; // set TRUE to send function entry/exit reports to the console
bool print_commands = false; // set TRUE to tell the console about commands received (commands.cpp)
bool print_gps_setup = true; // set TRUE to echo on the console all commands we send to our GPS chip
bool print_config = false; // set TRUE to report all screen touches

// severities
bool print_debug = false; // true;
Expand Down Expand Up @@ -114,6 +115,7 @@ class Logger {
Serial.println("] ");
}
}
// This is used in commands.cpp to log all incoming commands from the USB port API
void commands(const char *pText) {
if (print_commands) {
Serial.print(pText);
Expand All @@ -124,6 +126,13 @@ class Logger {
Serial.println(pText);
}
}
// This is used in all modules named "cfg_xxxxx"
// to log all setup-screen touches and resulting actions
void config(const char *pText) {
if (print_config) {
Serial.println(pText);
}
}

// ---------- Severities ----------
void info(const char *pText) { // one string arg
Expand Down

0 comments on commit c90e512

Please sign in to comment.