Skip to content

Commit

Permalink
fix uptime display - casting brackets (#441)
Browse files Browse the repository at this point in the history
uptime display: fix type casting parens

also: change all display time variables to unsigned
  • Loading branch information
t-pi committed Sep 12, 2021
1 parent 3c5bf9a commit 75095d9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions multigeiger/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ void display_status(void) {
display_statusline(output);
}

char *format_time(int secs) {
char *format_time(unsigned int secs) {
static char result[4];
int mins = secs / 60;
int hours = secs / (60 * 60);
int days = secs / (24 * 60 * 60);
unsigned int mins = secs / 60;
unsigned int hours = secs / (60 * 60);
unsigned int days = secs / (24 * 60 * 60);
if (secs < 60) {
snprintf(result, 4, "%2ds", secs);
} else if (mins < 60) {
Expand All @@ -147,7 +147,7 @@ char *format_time(int secs) {
return result;
}

void display_GMC(int TimeSec, int RadNSvph, int CPM, bool use_display) {
void display_GMC(unsigned int TimeSec, int RadNSvph, int CPM, bool use_display) {
if (!use_display) {
if (!displayIsClear) {
pu8x8->clear();
Expand Down
2 changes: 1 addition & 1 deletion multigeiger/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define _DISPLAY_H_

void setup_display(bool loraHardware);
void display_GMC(int TimeSec, int RadNSvph, int CPM, bool use_display);
void display_GMC(unsigned int TimeSec, int RadNSvph, int CPM, bool use_display);
void clear_displayline(int line);
void display_statusline(String txt);

Expand Down
2 changes: 1 addition & 1 deletion multigeiger/multigeiger.ino
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void publish(unsigned long current_ms, unsigned long current_counts, unsigned lo

// ... and update the data on display, notify via BLE
update_bledata((unsigned int)(Count_Rate * 60));
display_GMC(((int)accumulated_time / 1000), (int)(accumulated_Dose_Rate * 1000), (int)(Count_Rate * 60),
display_GMC((unsigned int)(accumulated_time / 1000), (int)(accumulated_Dose_Rate * 1000), (int)(Count_Rate * 60),
(showDisplay && switches.display_on));

// Sound local alarm?
Expand Down

0 comments on commit 75095d9

Please sign in to comment.