Skip to content

Commit

Permalink
Wipe array on format change
Browse files Browse the repository at this point in the history
  • Loading branch information
lbussy committed Nov 28, 2020
1 parent 0f72cd7 commit 1c70675
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/bubbles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ void Bubbles::setLast(double last)
bubAvg.push(last);
}

void Bubbles::wipeArray()
{
tempAmbAvg.clear();
tempVesAvg.clear();
}

void setDoBub()
{
// Allow a Bubble count to fire
Expand Down
1 change: 1 addition & 0 deletions src/bubbles.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct Bubbles
float getAvgAmbient();
float getAvgVessel();
float getAvgBpm();
void wipeArray(); // Wipe array on format change
void setLast(double); // Push last reading on reboot

// Public Properties
Expand Down
3 changes: 1 addition & 2 deletions src/webserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,7 @@ void setSettingsAliases()
config.bubble.tempinf = true;
}
Log.notice(F("Settings update, [%s]:(%s) applied." CR), name, value);
// TODO:
// bubbles.wipeArray(); // Clear temp array out in case we changed format
bubbles.wipeArray(); // Clear temp array out in case we changed format
saveConfig();
strcat(redirect, hashloc); // Redirect to Temp Control
Log.notice(F("POSTed tempformat, redirecting to %s." CR), redirect);
Expand Down

0 comments on commit 1c70675

Please sign in to comment.