Skip to content

Commit

Permalink
Merge branch 'master' into pcb-v12
Browse files Browse the repository at this point in the history
  • Loading branch information
barry-ha committed Feb 15, 2024
2 parents 5c0b899 + c5ba901 commit f1b6be7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
9 changes: 6 additions & 3 deletions cfg_nmea.h
Expand Up @@ -102,17 +102,19 @@ class ViewCfgNMEA : public View {
// label origin size touch-target
// text x,y w,h x,y w,h radius color functionID
{"Send NMEA", xButton, yButton1, 150, 40, {130, yButton1, 184, 50}, 4, cVALUE, eSTART_NMEA},
{"None", xButton, yButton2, 150, 40, {130, yButton2, 184, 60}, 4, cVALUE, eSTOP_NMEA},
{"No report", xButton, yButton2, 150, 40, {130, yButton2, 184, 60}, 4, cVALUE, eSTOP_NMEA},
};
// clang-format on

// ---------- local functions for this derived class ----------
void fStartNMEA() {
selectedOption = SEND_NMEA;
start_nmea(); // start sending nmea sentences
this->updateScreen();
}

void fStopNMEA() {
selectedOption = SILENT;
stop_nmea(); // stop nmea
this->updateScreen();
}
Expand Down Expand Up @@ -231,8 +233,8 @@ void ViewCfgNMEA::loadConfig() {
// resource-heavy functions like updateScreen()

SaveRestore config(NMEA_CONFIG_FILE, NMEA_CONFIG_VERSION);
byte tempOption;
int result = config.readConfig((byte *)&tempOption, sizeof(tempOption));
int tempOption = 0;
int result = config.readConfig((byte *)&tempOption, sizeof(tempOption));
if (result) {
switch (tempOption) {
case SEND_NMEA:
Expand Down Expand Up @@ -263,6 +265,7 @@ void ViewCfgNMEA::loadConfig() {
// ----- save to SDRAM -----
void ViewCfgNMEA::saveConfig() {
SaveRestore config(NMEA_CONFIG_FILE, NMEA_CONFIG_VERSION);
logger.info("Saving value: %d", selectedOption);
int rc = config.writeConfig((byte *)&selectedOption, sizeof(selectedOption));
logger.info("Finished ViewCfgRotation::saveConfig(%d) with rc = %d", selectedOption, rc); // debug
}
4 changes: 2 additions & 2 deletions cfg_volume.h
Expand Up @@ -320,8 +320,8 @@ bool ViewVolume::onTouch(Point touch) {
// ----- load from SDRAM -----
void ViewVolume::loadConfig() {
SaveRestore config(VOLUME_CONFIG_FILE, CONFIG_VOLUME_VERSION);
int tempVolIndex;
int result = config.readConfig((byte *)&tempVolIndex, sizeof(tempVolIndex));
int tempVolIndex = 0;
int result = config.readConfig((byte *)&tempVolIndex, sizeof(tempVolIndex));
if (result) {
gVolIndex = constrain(tempVolIndex, 0, 10); // global volume index
setVolume(gVolIndex); // set the hardware to this volume index
Expand Down
3 changes: 2 additions & 1 deletion save_restore.cpp
Expand Up @@ -77,7 +77,7 @@ int SaveRestore::deleteFile(const char *vFilename) {
int SaveRestore::readConfig(byte *pData, const unsigned int sizeData) {
// returns 1=success, 0=failure
int result = 1; // assume success
logger.info("Starting to read config from SDRAM...");
logger.info("Reading config from SDRAM...");
logger.info(". ", fqFilename);

result = openFlash(); // open file system and report errors
Expand Down Expand Up @@ -137,6 +137,7 @@ int SaveRestore::readConfig(byte *pData, const unsigned int sizeData) {
}

logger.info(". Data length: %d", sizeData);
// logger.info(". Data value: %d", *pData);

// close files and clean up
readFile.close();
Expand Down

0 comments on commit f1b6be7

Please sign in to comment.