Skip to content
Snippets Groups Projects
Commit 7c3571e0 authored by Mario Engelmann's avatar Mario Engelmann
Browse files

comments

parent 4abf1c75
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -127,4 +127,3 @@ void temperatureBegin(void) {
dhtT2up.begin();
dhtT2down.begin();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment