浏览代码

Adding more menu pages

Sebastian Vendt 3 年之前
父节点
当前提交
41e205da58
共有 7 个文件被更改,包括 271 次插入37 次删除
  1. 141 14
      CoffeeCode/coffee.cpp
  2. 20 4
      CoffeeCode/coffee.h
  3. 5 0
      CoffeeCode/database.h
  4. 48 4
      CoffeeCode/display2.cpp
  5. 28 10
      CoffeeCode/display2.h
  6. 24 2
      CoffeeCode/hal.cpp
  7. 5 3
      CoffeeCode/hal.h

+ 141 - 14
CoffeeCode/coffee.cpp

@@ -2,14 +2,13 @@
  * coffee.cpp
  *
  *  Created on: Sep 25, 2017
- *      Author: sebastian
+ *      Author: Sebastian Vendt
  */
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-#include <stdint.h>
 #include <wiringPi.h>
 #include <pthread.h>
 #include <unistd.h>
@@ -51,10 +50,15 @@ const char* PageName[] = {
 		"RESTART",
 		"SETTINGS",
 		"RESETKWH",
+		"RESETKWH_VAL",
 		"CHANGEPREINF",
+		"CHANGEPREINF_VAL",
 		"CHANGEBREWTIME",
+		"CHANGEBREWTIME_VAL",
 		"CHANGEBREWML",
+		"CHANGEBREWML_VAL",
 		"CHANGESOAKTIME",
+		"CHANGESOAKTIME_VAL",
 		"LEAVESETTINGS",
 		"Exit",
 		"PAGE_NULL"
@@ -74,6 +78,8 @@ const char* StateName[] = {
 		"STATE_NULL",
 };
 
+struct coffeeConfig coffeeCFG = {AMOUNT_PREINFUSION, TIME_SOAK, TIME_INFUSION, AMOUNT_DBLESPRESSO};
+
 /**
  * Thread for the finite state machine
  * It represents the current state of the machine and handles signals coming from
@@ -121,13 +127,25 @@ void *coffeeThread(void *threadid) {
 		//pthread_exit(EXIT_SUCCESS);
 		exit(EXIT_FAILURE);
 	}
+	if (!(coffeeCFG.amount_dblespresso = sqlGetConf(CFGAmountDblEspresso))) {
+		logger_error("coffee.cpp: Couldn't read config CFGAmountDblEspresso from database\nFalling back to default!\n");
+	}
+	if (!(coffeeCFG.amount_preinfusion = sqlGetConf(CFGAmountPreinfusion))) {
+		logger_error("coffee.cpp: Couldn't read config CFGAmountPreinfusion from database\nFalling back to default!\n");
+	}
+	if (!(coffeeCFG.time_infusion = sqlGetConf(CFGTimeInfusion))) {
+		logger_error("coffee.cpp: Couldn't read config CFGTimeInfusion from database\nFalling back to default!\n");
+	}
+	if (!(coffeeCFG.time_soak = sqlGetConf(CFGTimeSoak))) {
+		logger_error("coffee.cpp: Couldn't read config CFGTimeSoak from database\nFalling back to default!\n");
+	}
 
 	checkDescaling();
 
 	event_subscribe("terminate", &coffeeTerminate, "coffee.cpp");
 
 	logger(V_BREW, "Determining inital state\n");
-	//determine inital state
+	//determine initial state
 	if (halGetRelaisState(RELAIS_POWER) && halGetRelaisState(RELAIS_HEAT)
 			&& !halGetRelaisState(RELAIS_PUMP)) {
 		//wait for heat relais to switch
@@ -335,7 +353,7 @@ void *coffeeThread(void *threadid) {
 
 			switch (getSigValue(MODE_MENU)) {
 			case SigInt0Rls:
-
+				changePage(PAGE_RESETKWH_VAL);
 				break;
 			case SigRotCW:
 				changePage(PAGE_CHANGEPREINF);
@@ -345,6 +363,28 @@ void *coffeeThread(void *threadid) {
 				break;
 			}
 			break;
+		case PAGE_RESETKWH_VAL:
+			if (SigValueEmpty() && mode == MODE_MENU)
+				pause();
+
+			switch (getSigValue(MODE_MENU)) {
+			case SigInt0Rls:
+				//Reset the KWH counter
+
+				changePage(PAGE_RESETKWH);
+				break;
+			case SigInt1Rls:
+				//Abort reseting the KWH counter
+				changePage(PAGE_RESETKWH);
+				break;
+			case SigRotCW:
+
+				break;
+			case SigRotCCW:
+
+				break;
+			}
+			break;
 		case PAGE_CHANGEPREINF:
 			if (SigValueEmpty() && mode == MODE_MENU)
 			    pause();
@@ -361,6 +401,22 @@ void *coffeeThread(void *threadid) {
 			    break;
 			}
 			break;
+		case PAGE_CHANGEPREINF_VAL:
+			if (SigValueEmpty() && mode == MODE_MENU)
+				pause();
+
+			switch (getSigValue(MODE_MENU)) {
+			case SigInt0Rls:
+				changePage(PAGE_CHANGEPREINF);
+				break;
+			case SigRotCW:
+
+				break;
+			case SigRotCCW:
+
+				break;
+			}
+			break;
 		case PAGE_CHANGEBREWTIME:
 			if (SigValueEmpty() && mode == MODE_MENU)
 			    pause();
@@ -377,6 +433,22 @@ void *coffeeThread(void *threadid) {
 			    break;
 			}
 			break;
+		case PAGE_CHANGEBREWTIME_VAL:
+			if (SigValueEmpty() && mode == MODE_MENU)
+				pause();
+
+			switch (getSigValue(MODE_MENU)) {
+			case SigInt0Rls:
+				changePage(PAGE_CHANGEBREWTIME);
+				break;
+			case SigRotCW:
+
+				break;
+			case SigRotCCW:
+
+				break;
+			}
+			break;
 		case PAGE_CHANGEBREWML:
 			if (SigValueEmpty() && mode == MODE_MENU)
 			    pause();
@@ -393,6 +465,22 @@ void *coffeeThread(void *threadid) {
 			    break;
 			}
 			break;
+		case PAGE_CHANGEBREWML_VAL:
+			if (SigValueEmpty() && mode == MODE_MENU)
+				pause();
+
+			switch (getSigValue(MODE_MENU)) {
+			case SigInt0Rls:
+				changePage(PAGE_CHANGEBREWML);
+				break;
+			case SigRotCW:
+
+				break;
+			case SigRotCCW:
+
+				break;
+			}
+			break;
 		case PAGE_CHANGESOAKTIME:
 			if (SigValueEmpty() && mode == MODE_MENU)
 			    pause();
@@ -409,6 +497,22 @@ void *coffeeThread(void *threadid) {
 			    break;
 			}
 			break;
+		case PAGE_CHANGESOAKTIME_VAL:
+			if (SigValueEmpty() && mode == MODE_MENU)
+				pause();
+
+			switch (getSigValue(MODE_MENU)) {
+			case SigInt0Rls:
+				changePage(PAGE_CHANGESOAKTIME);
+				break;
+			case SigRotCW:
+
+				break;
+			case SigRotCCW:
+
+				break;
+			}
+			break;
 		case PAGE_LEAVESETTINGS:
 			if (SigValueEmpty() && mode == MODE_MENU)
 				pause();
@@ -909,6 +1013,13 @@ time_t * getDescTimestamp (void) {
 	return &descRawTimestamp;
 }
 
+/**
+ * Returns the preinfusion amount in ml of the coffee config
+ */
+uint16_t getAmountPreinfusion (void) {
+	return coffeeCFG.amount_preinfusion;
+}
+
 
 /**
  * Counter for the menu timeout
@@ -963,20 +1074,33 @@ void writeBackCache(void) {
 	logger(V_BREW, "Writing back cache...\n");
 	logger(V_BREW, "Writing back brewCounter with %d\n", brewCounter);
 	if (sqlSetConf(CFGbrewcounter, brewCounter)) {
-		logger_error("coffee.cpp: Couldn't write brewcounter to database");
-		return;
+		logger_error("coffee.cpp: Couldn't write brewcounter to database!\n");
 	}
 	logger(V_BREW, "Writing back descaling brew counter %d\n", descBrewcount);
 	if (sqlSetConf(CFGDescBrewCount, descBrewcount)) {
-		logger_error("coffee.cpp: Couldn't write descaling brewcount to database");
-		return;
+		logger_error("coffee.cpp: Couldn't write descaling brewcount to database!\n");
 	}
 	struct tm * timeinfo;
 	timeinfo = localtime(&descRawTimestamp);
 	logger(V_BREW, "Writing back descaling timestamp %d-%d-%d %d:%d\n", timeinfo->tm_mday, timeinfo->tm_mon, timeinfo->tm_year+1900, timeinfo->tm_hour, timeinfo->tm_min);
 	if (sqlSetConf(CFGDescTimestamp, (uint64_t)descRawTimestamp)) {
-		logger_error("coffee.cpp: Couldn't write descaling timestamp to database");
-		return;
+		logger_error("coffee.cpp: Couldn't write descaling timestamp to database!\n");
+	}
+	logger(V_BREW, "Writing back CFGAmountPreinfusion with %d", coffeeCFG.amount_preinfusion);
+	if (sqlSetConf(CFGAmountPreinfusion, coffeeCFG.amount_preinfusion)) {
+		logger_error("coffee.cpp: Couldn't write CFGAmountPreinfusion to database!\n");
+	}
+	logger(V_BREW, "Writing back CFGTimeSoak with %d", coffeeCFG.time_soak);
+	if (sqlSetConf(CFGTimeSoak, coffeeCFG.time_soak)) {
+		logger_error("coffee.cpp: Couldn't write CFGTimeSoak to database!\n");
+	}
+	logger(V_BREW, "Writing back CFGTimeInfusion with %d", coffeeCFG.time_infusion);
+	if (sqlSetConf(CFGTimeInfusion, coffeeCFG.time_infusion)) {
+		logger_error("coffee.cpp: Couldn't write CFGTimeInfusion to database!\n");
+	}
+	logger(V_BREW, "Writing back CFGAmountDblEspresso with %d", coffeeCFG.amount_dblespresso);
+	if (sqlSetConf(CFGAmountDblEspresso, coffeeCFG.amount_dblespresso)) {
+		logger_error("coffee.cpp: Couldn't write CFGAmountDblEspresso to database!\n");
 	}
 }
 
@@ -1017,8 +1141,9 @@ void coffeeBrew(void) {
 	logger(V_BREW, "Starting preinfusion...\n");
 	halPumpOn();
 	while (halGetFlow() < AMOUNT_PREINFUSION && halGetFlowTime() < TIME_PREINFUSION) {
-		//TODO don't use coffeeNap here since we don't want to resume to sleep after a signal got caught...
-		coffeeNap(0, 50000000);
+		//TODO-Done don't use coffeeNap here since we don't want to resume to sleep after a signal got caught...
+		//coffeeNap(0, 50000000);
+		usleep(50000);
 		if (getSigValue(MODE_STATE) == SigInt0Rls) {
 			halPumpOff();
 			return;
@@ -1031,7 +1156,8 @@ void coffeeBrew(void) {
 	 */
 	brewTimer.start();
 	while (brewTime < TIME_SOAK) {
-		coffeeNap(1, 100000000);
+		//coffeeNap(1, 100000000);
+		usleep(100000);
 		if (getSigValue(MODE_STATE) == SigInt0Rls) {
 			brewTimer.stop();
 			brewTime = 0;
@@ -1047,7 +1173,8 @@ void coffeeBrew(void) {
 	logger(V_BREW, "Starting infusion...\n");
 	halPumpOn();
 	while (brewTime < TIME_INFUSION && halGetFlow() < AMOUNT_DBLESPRESSO) {
-		coffeeNap(1, 100000000);
+		//coffeeNap(1, 100000000);
+		usleep(100000);
 		if (getSigValue(MODE_STATE) == SigInt0Rls){
 			halPumpOff();
 			return;

+ 20 - 4
CoffeeCode/coffee.h

@@ -10,6 +10,7 @@
 
 #include <csignal>
 #include "events.h"
+#include <stdint.h>
 
 //define status
 typedef enum {
@@ -44,30 +45,45 @@ typedef enum {
 	PAGE_RESTART,
 	PAGE_SETTINGS,
 	PAGE_RESETKWH,
+	PAGE_RESETKWH_VAL,
 	PAGE_CHANGEPREINF,
+	PAGE_CHANGEPREINF_VAL,
 	PAGE_CHANGEBREWTIME,
+	PAGE_CHANGEBREWTIME_VAL,
 	PAGE_CHANGEBREWML,
+	PAGE_CHANGEBREWML_VAL,
 	PAGE_CHANGESOAKTIME,
+	PAGE_CHANGESOAKTIME_VAL,
+	PAGE_CHANGEAUTORESET,
+	PAGE_CHANGEAUTORESET_VAL,
 	PAGE_LEAVESETTINGS,
 	PAGE_EXIT,
 	PAGE_NULL
 	//Entering new PAGES? Don't forget to update pagenames in coffee.cpp!
 } coffee_menuPage_t;
 
-extern const char* StateName[];
-extern const char* PageName[];
+struct coffeeConfig{
+	uint16_t amount_preinfusion;
+	uint16_t time_soak;
+	uint16_t time_infusion;
+	uint16_t amount_dblespresso;
+};
 
 #define AMOUNT_PREINFUSION	24 		//Preinfusion amount in ml
 #define TIME_SOAK			5000 	//Time between preinfusion and infusion in ms
 #define TIME_INFUSION 		25000	//Infusion time in ms
 #define TIME_PREINFUSION	2500
-#define AMOUNT_DBLESPRESSO	59.0	//Size of a double espresso in ml
+#define AMOUNT_DBLESPRESSO	59		//Size of a double espresso in ml
 #define DIRTY_ESPRESSO		35		//Number of espressi until the next cleaning
 #define DIRTY_TIME			90		//Number of days until the next cleaning
 #define MENUTIMEOUT			30		//timeout of the menu when no input is received from the user (in seconds)
 #define CLEANING_CYCLES		20		//Number of On-Off cycles during the cleaning phase
-void *coffeeThread(void *threadid);
 
+extern const char* StateName[];
+extern const char* PageName[];
+extern coffeeConfig coffeeCFG;
+
+void *coffeeThread(void *threadid);
 void coffeeHandler(int signum, siginfo_t *siginfo, void *context);
 bool SigValueEmpty(void);
 void changeState(coffee_status_t newState);

+ 5 - 0
CoffeeCode/database.h

@@ -24,6 +24,11 @@ typedef enum {
 	CFGdisplaylang = 3,
 	CFGDescTimestamp = 4,
 	CFGDescBrewCount = 5,
+	CFGAmountPreinfusion = 10,
+	CFGTimeSoak = 11,
+	CFGTimeInfusion = 12,
+	CFGAmountDblEspresso = 13,
+	CFGFlowResetTime = 14
 } config_key_t;
 
 int sqlOpen();

+ 48 - 4
CoffeeCode/display2.cpp

@@ -49,13 +49,29 @@ typedef enum {
 	page_idx = 2
 } idx_t;
 
-void track(idx_t idx);
+
 void switchToNextPage(coffee_menuPage_t* history);
 void switchToNextMode(coffee_mode_t* history);
 void switchToNextState(coffee_status_t* history);
 void setRefreshRate(refreshRate_t rate);
 void setSwitchToNextTimeout(idx_t idx, uint16_t millis);
 
+void displayPrintTemp(int line);
+void displayPrintStats(int line);
+void displayPrintStats2(int line);
+void displayPrintNextDesc(int line);
+void displayPrintPostBrew(int line);
+void displayPrintBrewManual(int line);
+void displayPrintFlow(int line);
+void displayPrintAutoResetVal(int line);
+void displayPrintCleanCycle(int line);
+void displayStateUpdated(event_t *event);
+void displayModeUpdated(event_t *event);
+void displayPageUpdated(event_t *event);
+void displayDescaling(event_t *event);
+void displayPrintLogo(void);
+void displayTerminate(event_t *e);
+void track(idx_t idx);
 
 /**
  * Prints out the current time in a centered position
@@ -130,7 +146,7 @@ void displayPrintNextDesc(int line) {
 /**
  *
  */
-void displayPrintPostBrew(int line){
+void displayPrintPostBrew(int line) {
 	char buffer[17];
 	if (line > DISPLAY_ROWS) line = 0;
 
@@ -160,6 +176,15 @@ void displayPrintFlow(int line) {
 	lcdPrintf(lcd, "%s: %.0f ml    ", displayGetString(str_flow), flow);
 }
 
+/**
+ *
+ */
+void displayPrintAutoResetVal(int line) {
+	uint16_t restFlowTime = halGetFlowResetTime();
+	lcdPosition(lcd, 0, line);
+	lcdPrintf(lcd, "%.0f ms", restFlowTime);
+}
+
 /**
  * Prints the current cycle of the cleaning process
  */
@@ -169,6 +194,7 @@ void displayPrintCleanCycle(int line) {
 	sprintf(buffer, "%2d of %2d", getCurrentCleanCycle(), CLEANING_CYCLES);
 	displayPrintLn(line, buffer, true);
 }
+
 /**
  * Prints a string to a specific line, optionally centered.
  * This function also fills out the remaining row of the display with spaces,
@@ -177,7 +203,6 @@ void displayPrintCleanCycle(int line) {
  * @param *str String to print
  * @param centered Print centered or not
  */
-
 void displayPrintLn(int line, const char* str, bool centered) {
 	char buf[DISPLAY_COLS + 1];
 	int len = strlen(str);
@@ -217,7 +242,6 @@ void displayPrintLn(int line, const char* str, bool centered) {
  * Updates the display state to the matching coffee state
  * @param event Event data
  */
-
 void displayStateUpdated(event_t *event) {
 	if (event->len != sizeof(coffee_status_t)) {
 		logger_error("Invalid use of event %s\n", event->event);
@@ -587,22 +611,42 @@ void displayRefresh(void) {
 			displayPrintLn(0, displayGetString(str_menu_settings), true);
 			displayPrintLn(1, displayGetString(str_menu_resetkwh), true);
 			break;
+		case PAGE_RESETKWH_VAL: //confirmation dialog
+			displayPrintLn(0, displayGetString(str_menu_resetkwh_val), true);
+			break;
 		case PAGE_CHANGEPREINF:
 			displayPrintLn(0, displayGetString(str_menu_settings), true);
 			displayPrintLn(1, displayGetString(str_menu_changepreinf), true);
 			break;
+		case PAGE_CHANGEPREINF_VAL:
+			break;
 		case PAGE_CHANGEBREWTIME:
 			displayPrintLn(0, displayGetString(str_menu_settings), true);
 			displayPrintLn(1, displayGetString(str_menu_changebrewtime), true);
+			break;
+		case PAGE_CHANGEBREWTIME_VAL:
+
 			break;
 		case PAGE_CHANGEBREWML:
 			displayPrintLn(0, displayGetString(str_menu_settings), true);
 			displayPrintLn(1, displayGetString(str_menu_changebrewml), true);
 			break;
+		case PAGE_CHANGEBREWML_VAL:
+			break;
 		case PAGE_CHANGESOAKTIME:
 			displayPrintLn(0, displayGetString(str_menu_settings), true);
 			displayPrintLn(1, displayGetString(str_menu_changesoaktime), true);
 			break;
+		case PAGE_CHANGESOAKTIME_VAL:
+			break;
+		case PAGE_CHANGEAUTORESET:
+			displayPrintLn(0, displayGetString(str_menu_settings), true);
+			displayPrintLn(1, displayGetString(str_menu_changeAutoReset), true);
+			break;
+		case PAGE_CHANGEAUTORESET_VAL:
+			displayPrintLn(0, displayGetString(str_menu_changeAutoReset_val), true);
+			displayPrintAutoResetVal(1);
+			break;
 		case PAGE_LEAVESETTINGS:
 			displayPrintLn(0, displayGetString(str_menu_settings), true);
 			displayPrintLn(1, displayGetString(str_menu_leavesettings), true);

+ 28 - 10
CoffeeCode/display2.h

@@ -19,16 +19,6 @@
 #define DISPLAY_ROWS	2
 #define DISPLAY_COLS	16
 
-void *displayThread(void *threadid);
-void *displayTimerHandler(void *threadid);
-void displayInit(void);
-void displayPrintLn(int line, const char* str, bool centered);
-
-void displayPushState(coffee_status_t state);
-
-void displayRefresh(void);
-
-
 //(DO NOT change the following values unless you know what you do -> Integer division)
 typedef enum {
 	refresh_fast = 5, 	// Display refresh rate in Hz when active
@@ -63,10 +53,13 @@ typedef enum {
 	str_menu_exit,
 	str_menu_settings,
 	str_menu_resetkwh,
+	str_menu_resetkwh_val,
 	str_menu_changepreinf,
 	str_menu_changebrewtime,
 	str_menu_changebrewml,
 	str_menu_changesoaktime,
+	str_menu_changeAutoReset,
+	str_menu_changeAutoReset_val,
 	str_menu_leavesettings,
 	str_postBrew,
 	str_last
@@ -205,6 +198,12 @@ static const display_string_t display_strings[str_last] =
 						"Reset kWh"
 				}
 		},
+		{ // str_menu_resetkwh_val
+				{
+						"Zurücksetzen?",
+						"Confirm to reset"
+				}
+		},
 		{ // str_change_preinf
 		        {
 		                "Vorbrühmenge",
@@ -229,6 +228,18 @@ static const display_string_t display_strings[str_last] =
 		                "Soak time"
 		        }
 		},
+		{ // str_menu_changeAutoReset
+				{
+						"Auto reset anp",
+						"Auto reset adj"
+				}
+		},
+		{ // str_menu_changeAutoReset_val
+				{
+						"reset zeit (ms)",
+						"reset time (ms)"
+				}
+		},
 		{ // str_leavesettings
 		        {
 		                "Verlassen",
@@ -243,6 +254,13 @@ static const display_string_t display_strings[str_last] =
 		}
 };
 
+void *displayThread(void *threadid);
+void *displayTimerHandler(void *threadid);
+void displayInit(void);
+void displayPrintLn(int line, const char* str, bool centered);
+
+void displayPushState(coffee_status_t state);
+void displayRefresh(void);
 const char* displayGetString(display_strings_t string);
 void displaySetLang(display_lang_t lang);
 

+ 24 - 2
CoffeeCode/hal.cpp

@@ -45,8 +45,10 @@ int lastFlowcnt = 0;
 int flowResetValue = -1;
 bool brewmanual = false;
 
+//local copies of the corresponding database entries
 time_t heatingCycleStart = 0;
-uint64_t totalHeatingTime = 0; //local copies of the corresponding database entries
+uint64_t totalHeatingTime = 0;
+uint16_t flowResetTime = TIME_FLOWRESET; //see TIME_FLOWRESET for details
 
 int Int0Time, Int1Time;
 int idleCounter;
@@ -117,6 +119,10 @@ void halInit(void) {
 		exit(EXIT_FAILURE);
 	}
 
+	if (!(flowResetTime = sqlGetConf(CFGFlowResetTime))) {
+		logger_error("hal.cpp: Couldn't read the flow reset time from the database\nFalling back to defaults.\n");
+	}
+
 	if (optPower) {
 		halMachineOn();
 	} else {
@@ -385,7 +391,8 @@ void halIntFlow(void) {
 	//tracking of flowtime
 	if(!flowTimer.isActive()) flowTimer.start();
 
-	if (halGetFlow() >= BREW_MANUAL_TRIGGER && !brewSigFired) {
+	//trigger the brewing signal using the total flow time
+	if (halGetFlowTime() >= BREW_MANUAL_TRIGGER && !brewSigFired) {
 		halSendSignal(SigBrewOn);
 		brewSigFired = true;
 	}
@@ -484,6 +491,21 @@ float halGetLastFlow(void) {
 uint16_t halGetLastFlowTime(void){
 	return lastFlowTime;
 }
+
+/**
+ * Returns the time interval in ms between the last received flow signal and the reset of the flow counter
+ */
+uint16_t halGetFlowResetTime(void) {
+	return flowResetTime;
+}
+
+/**
+ * Set the value of the Flow reset time. Its the responsibility of the caller to also call halWriteBackCache()!
+ */
+void halSetFlowResetTime(uint16_t val) {
+	flowResetTime = val;
+}
+
 /**
  * Resets the Flow counter. Do not call this function manually. It will be automatically triggered
  * from the flow reset timer routine!

+ 5 - 3
CoffeeCode/hal.h

@@ -29,9 +29,9 @@
 #define ROTARY_STEPSIZE		15
 
 
-#define TIME_FLOWRESET			600	//Wait time in ms to reset flow counter after the last received flow signal
-#define TIME_BUTTONLONGPRESS	3	//Time in s until a Signal for a long pressed button is sent
-#define BREW_MANUAL_TRIGGER		26	//specifies the ml after which a brew_manual signal is triggered
+#define TIME_FLOWRESET			600		//Wait time in ms to reset flow counter after the last received flow signal
+#define TIME_BUTTONLONGPRESS	3		//Time in s until a Signal for a long pressed button is sent
+#define BREW_MANUAL_TRIGGER		7500	//specifies the ms after which a brew_manual signal is triggered
 /*
  * Explanation for the signal levels
  * SigInt_Psh 			Button is pushed
@@ -93,6 +93,8 @@ float halGetFlow(void);
 uint16_t halGetFlowTime(void);
 float halGetLastFlow(void);
 uint16_t halGetLastFlowTime(void);
+uint16_t halGetFlowResetTime(void);
+void halSetFlowResetTime(uint16_t val);
 void halResetFlow(void);
 bool halIsHeating(void);
 bool halProxSensorCovered(void);