From ffc55ef3c4f398c9042747220b10d3402f8cfcf6 Mon Sep 17 00:00:00 2001
From: Mario Engelmann <mario.engelmann@fau.de>
Date: Thu, 13 Oct 2022 16:29:00 +0200
Subject: [PATCH] added function very important

---
 solarpump/solarpump.ino | 87 ++++++++++++++++++++++-------------------
 1 file changed, 46 insertions(+), 41 deletions(-)

diff --git a/solarpump/solarpump.ino b/solarpump/solarpump.ino
index 322510c..2038dfa 100644
--- a/solarpump/solarpump.ino
+++ b/solarpump/solarpump.ino
@@ -170,6 +170,51 @@ void setup(void) {
 	pinMode(BUTTON, INPUT_PULLUP);
 }
 
+void sayInfos(void)
+{
+	playFileQueue(SOUND_EINS);
+	playFileQueue(SOUND_OBEN);
+	sayNumber(t1up_C, nachKommaStellen);
+
+	playFileQueue(SOUND_EINS);
+	playFileQueue(SOUND_UNTEN);
+	sayNumber(t1down_C, nachKommaStellen);
+
+	playFileQueue(SOUND_ZWEI);
+	playFileQueue(SOUND_OBEN);
+	sayNumber(t2up_C, nachKommaStellen);
+
+	playFileQueue(SOUND_ZWEI);
+	playFileQueue(SOUND_UNTEN);
+	sayNumber(t2down_C, nachKommaStellen);
+
+	if (digitalRead(PUMP1))
+	{
+		playFileQueue(SOUND_PUMPE);
+		playFileQueue(SOUND_EINS);
+		playFileQueue(SOUND_AN);
+	}
+	else
+	{
+		playFileQueue(SOUND_PUMPE);
+		playFileQueue(SOUND_EINS);
+		playFileQueue(SOUND_AUS);
+	}
+
+	if (digitalRead(PUMP2))
+	{
+		playFileQueue(SOUND_PUMPE);
+		playFileQueue(SOUND_ZWEI);
+		playFileQueue(SOUND_AN);
+	}
+	else
+	{
+		playFileQueue(SOUND_PUMPE);
+		playFileQueue(SOUND_ZWEI);
+		playFileQueue(SOUND_AUS);
+	}
+}
+
 /*
  * main loop function
  * 1. Check if button was pressed.
@@ -188,47 +233,7 @@ void loop(void) {
 
 	if (checkButton() == LOW) {
 		displayLight(true);
-		playFileQueue(SOUND_EINS);
-		playFileQueue(SOUND_OBEN);
-		sayNumber(t1up_C, nachKommaStellen);
-
-		playFileQueue(SOUND_EINS);
-		playFileQueue(SOUND_UNTEN);
-		sayNumber(t1down_C, nachKommaStellen);
-
-		playFileQueue(SOUND_ZWEI);
-		playFileQueue(SOUND_OBEN);
-		sayNumber(t2up_C, nachKommaStellen);
-
-		playFileQueue(SOUND_ZWEI);
-		playFileQueue(SOUND_UNTEN);
-		sayNumber(t2down_C, nachKommaStellen);
-
-		if (digitalRead(PUMP1)) 
-		{
-			playFileQueue(SOUND_PUMPE);
-			playFileQueue(SOUND_EINS);
-			playFileQueue(SOUND_AN);
-		}
-		else
-		{
-			playFileQueue(SOUND_PUMPE);
-			playFileQueue(SOUND_EINS);
-			playFileQueue(SOUND_AUS);
-		}
-
-		if (digitalRead(PUMP2))
-		{
-			playFileQueue(SOUND_PUMPE);
-			playFileQueue(SOUND_ZWEI);
-			playFileQueue(SOUND_AN);
-		}
-		else
-		{
-			playFileQueue(SOUND_PUMPE);
-			playFileQueue(SOUND_ZWEI);
-			playFileQueue(SOUND_AUS);
-		}
+		sayInfo();
 	} else {
 		displayLight(false);
 	}
-- 
GitLab