diff --git a/solarpump/solarpump.ino b/solarpump/solarpump.ino index 22cf8147db33130973eaa9778f4837a16424d123..e893c5284f008e86d88c977e870a44e215ccec4e 100644 --- a/solarpump/solarpump.ino +++ b/solarpump/solarpump.ino @@ -46,6 +46,11 @@ void controlPump(uint8_t pumpPin, float tempUp, float tempDown) { } } +/* + * prints a float where the decimals specify the numbers of digit, which are printed, + * after the decimal point and + * rightPad specifies the total length printed, where empty spots are filled with spaces + */ void printFloat(float f, uint8_t decimals, uint8_t rightPad) { String s = String(f, decimals); for (uint8_t i = s.length(); i < rightPad; ++i) { @@ -54,6 +59,11 @@ void printFloat(float f, uint8_t decimals, uint8_t rightPad) { lcd.print(s); } +/* + * display the temperature of the four temperature sensorse and + * also shows if the pump is running + * shows no temperature if sensor state is in LONG_TIME_ERROR + */ 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 @@ -124,6 +134,7 @@ void displayText(float t1up_C, float t1down_C, bool pump1, float t2up_C, float t } } +// turnes the display on for 30 seconds void displayLight(bool turnOn) { const uint32_t lightMillis = 30000; static bool curState = false; @@ -140,6 +151,12 @@ void displayLight(bool turnOn) { } } + +/* + * main setup function + * initialize every electronic component + */ +// main setup function void setup(void) { lcd.init(); @@ -153,6 +170,13 @@ void setup(void) { pinMode(BUTTON, INPUT_PULLUP); } +/* + * main loop function + * 1. Check if button was pressed. + * 2. If button was pressed,turn display on and say the temperetures. + * 3. Check if pumps should be turned on or out. + * 4. Update the display. + */ void loop(void) { static float t1up_C = 0.0; static float t1down_C = 0.0; diff --git a/solarpump/temperature.ino b/solarpump/temperature.ino index 35534d4360556fc03ad778dc4af4057767ee95ef..9c3b9eec7cb8de9ea1667f42da42ff43731efc52 100644 --- a/solarpump/temperature.ino +++ b/solarpump/temperature.ino @@ -127,4 +127,3 @@ void temperatureBegin(void) { dhtT2up.begin(); dhtT2down.begin(); } -