diff --git a/solarpump/solarpump.ino b/solarpump/solarpump.ino index 8e8425a0b4e9b7e53226d5ea05ec000068743f2b..bf894c20105ccaa069aea5da71ec283f8d5aaad4 100644 --- a/solarpump/solarpump.ino +++ b/solarpump/solarpump.ino @@ -54,10 +54,10 @@ void printFloat(float f, uint8_t decimals, uint8_t rightPad) { lcd.print(s); } -void displayText(float t1up_C, float t1down_C, bool pump1, float t2up_C, float t2down_C, bool pump2, - UPDATESTATE state_t1up, UPDATESTATE state_t1down, UPDATESTATE state_t2up, UPDATESTATE state_t2down) { - // update the display only after a second passed - const uint32_t textMillis = 1000; +void displayText(float t1up_C, float t1down_C, bool pump1, float t2up_C, float t2down_C, bool pump2, + UPDATESTATE state_t1up, UPDATESTATE state_t1down, UPDATESTATE state_t2up, UPDATESTATE state_t2down) { + // update the display only after a second has passed + const uint32_t textMillis = 1000; static uint32_t prevMillis = 0; uint32_t curMillis = millis(); if (curMillis - prevMillis < textMillis) { @@ -65,27 +65,27 @@ void displayText(float t1up_C, float t1down_C, bool pump1, float t2up_C, float t } prevMillis = curMillis; - // print top row: temperature 1 up - temperature 1 down - pump runnung (r) or stopping (s) + // print top row: temperature 1 up - temperature 1 down - pump runnung (r) or stopping (s) lcd.setCursor(0, 0); lcd.print("1U:"); - if(state_t1up == LONG_TIME_ERROR) - { - lcd.print("---"); - } - else - { - printFloat(t1up_C, 0, 3); - } + if(state_t1up == LONG_TIME_ERROR) + { + lcd.print("---"); + } + else + { + printFloat(t1up_C, 0, 3); + } lcd.setCursor(6, 0); lcd.print(" 1D:"); - if(state_t1down == LONG_TIME_ERROR) - { - lcd.print("---"); - } - else - { - printFloat(t1down_C, 0, 3); - } + if(state_t1down == LONG_TIME_ERROR) + { + lcd.print("---"); + } + else + { + printFloat(t1down_C, 0, 3); + } lcd.setCursor(13, 0); lcd.print(" P"); if (pump1) { @@ -94,27 +94,27 @@ void displayText(float t1up_C, float t1down_C, bool pump1, float t2up_C, float t lcd.print("S"); } - // print bottom row: temperature 2 up - temperature 2 down - pump runnung (r) or stopping (s) + // print bottom row: temperature 2 up - temperature 2 down - pump runnung (r) or stopping (s) lcd.setCursor(0, 1); lcd.print("2U:"); - if(state_t2up == LONG_TIME_ERROR) - { - lcd.print("---"); - } - else - { - printFloat(t2up_C, 0, 3); - } + if(state_t2up == LONG_TIME_ERROR) + { + lcd.print("---"); + } + else + { + printFloat(t2up_C, 0, 3); + } lcd.setCursor(6, 1); lcd.print(" 2D:"); - if(state_t2down == LONG_TIME_ERROR) - { - lcd.print("---"); - } - else - { + if(state_t2down == LONG_TIME_ERROR) + { + lcd.print("---"); + } + else + { printFloat(t2down_C, 0, 3); - } + } lcd.setCursor(13, 1); lcd.print(" P"); if (pump2) { @@ -187,6 +187,6 @@ void loop(void) { controlPump(PUMP2, t2up_C, t2down_C); } - displayText(t1up_C, t1down_C, digitalRead(PUMP1), t1up_C, t2down_C, digitalRead(PUMP2), - t1up(&t1up_C), t1down(&t1down_C), t2up(&t2up_C), t2down(&t2down_C)); + displayText(t1up_C, t1down_C, digitalRead(PUMP1), t1up_C, t2down_C, digitalRead(PUMP2), + t1up(&t1up_C), t1down(&t1down_C), t2up(&t2up_C), t2down(&t2down_C)); }