Skip to content

Commit

Permalink
total clicks rollover should be handled maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
steadramon committed Apr 7, 2024
1 parent 3e45cd1 commit ba0bc66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ESPGeiger/src/Counter/Counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ void Counter::secondticker() {
unsigned long int secidx = (millis() / 1000) % 60;
//Log::console(PSTR("Counter: Events - %d - %d"), eventCounter, secidx);
geigerTicks.add(eventCounter);
unsigned long previous_total_clicks = total_clicks;
total_clicks += eventCounter;
if (previous_total_clicks > total_clicks) {
total_clicks = eventCounter;
total_clicks_rollover++;
}

cpm_history.push(get_cpm());

Expand Down
1 change: 1 addition & 0 deletions ESPGeiger/src/Counter/Counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class Counter {
_bool_cpm_alert = false;
}
unsigned long clicks_hour = 0;
unsigned long total_clicks_rollover = 0;
unsigned long total_clicks = 0;
unsigned long clicks_today = 0;
unsigned long clicks_yesterday = 0;
Expand Down

0 comments on commit ba0bc66

Please sign in to comment.