|
@@ -40,10 +40,39 @@ bool descaling; //flag to indicate descaling and cleaning
|
|
|
uint16_t descBrewcount;
|
|
|
time_t descRawTimestamp;
|
|
|
|
|
|
-const char* PageName[] = { "SoftOff", "Kill", "Stats", "Stats2", "Descaling", "Temp", "Clean", "Restart",
|
|
|
- "Exit" };
|
|
|
-const char* StateName[] = { "OFF", "HEATING", "INITHEAT", "IDLE", "BREW",
|
|
|
- "BREWMAN", "CLEAN", "ERROR", "WAITOFF" };
|
|
|
+const char* PageName[] = {
|
|
|
+ "SOFTOFF",
|
|
|
+ "KILL",
|
|
|
+ "STATS",
|
|
|
+ "STATS2",
|
|
|
+ "DESCALING",
|
|
|
+ "TEMP",
|
|
|
+ "CLEAN",
|
|
|
+ "RESTART",
|
|
|
+ "SETTINGS",
|
|
|
+ "RESETKWH",
|
|
|
+ "CHANGEPREINF",
|
|
|
+ "CHANGEBREWTIME",
|
|
|
+ "CHANGEBREWML",
|
|
|
+ "CHANGESOAKTIME",
|
|
|
+ "LEAVESETTINGS",
|
|
|
+ "Exit",
|
|
|
+ "PAGE_NULL"
|
|
|
+};
|
|
|
+
|
|
|
+const char* StateName[] = {
|
|
|
+ "OFF",
|
|
|
+ "HEATING",
|
|
|
+ "INITHEAT",
|
|
|
+ "IDLE",
|
|
|
+ "BREW",
|
|
|
+ "BREWMAN",
|
|
|
+ "CLEAN",
|
|
|
+ "ERROR",
|
|
|
+ "WAITOFF",
|
|
|
+ "FULLTANK",
|
|
|
+ "STATE_NULL",
|
|
|
+};
|
|
|
|
|
|
/**
|
|
|
* Thread for the finite state machine
|
|
@@ -119,9 +148,8 @@ void *coffeeThread(void *threadid) {
|
|
|
logger(V_BREW, "Starting Coffee FSM\n");
|
|
|
//begin FSM
|
|
|
while (1) {
|
|
|
-
|
|
|
/*
|
|
|
- * Menue FSM
|
|
|
+ * Menu FSM
|
|
|
*/
|
|
|
switch (page) {
|
|
|
case PAGE_NULL:
|
|
@@ -277,7 +305,7 @@ void *coffeeThread(void *threadid) {
|
|
|
|
|
|
switch (getSigValue(MODE_MENU)) {
|
|
|
case SigRotCW:
|
|
|
- changePage(PAGE_EXIT);
|
|
|
+ changePage(PAGE_SETTINGS);
|
|
|
break;
|
|
|
|
|
|
case SigRotCCW:
|
|
@@ -285,6 +313,118 @@ void *coffeeThread(void *threadid) {
|
|
|
break;
|
|
|
}
|
|
|
break;
|
|
|
+ case PAGE_SETTINGS:
|
|
|
+ if (SigValueEmpty() && mode == MODE_MENU)
|
|
|
+ pause();
|
|
|
+
|
|
|
+ switch (getSigValue(MODE_MENU)) {
|
|
|
+ case SigInt0Rls:
|
|
|
+ changePage(PAGE_RESETKWH);
|
|
|
+ break;
|
|
|
+ case SigRotCW:
|
|
|
+ changePage(PAGE_EXIT);
|
|
|
+ break;
|
|
|
+ case SigRotCCW:
|
|
|
+ changePage(PAGE_DESCALING);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PAGE_RESETKWH:
|
|
|
+ if (SigValueEmpty() && mode == MODE_MENU)
|
|
|
+ pause();
|
|
|
+
|
|
|
+ switch (getSigValue(MODE_MENU)) {
|
|
|
+ case SigInt0Rls:
|
|
|
+
|
|
|
+ break;
|
|
|
+ case SigRotCW:
|
|
|
+ changePage(PAGE_CHANGEPREINF);
|
|
|
+ break;
|
|
|
+ case SigRotCCW:
|
|
|
+ changePage(PAGE_LEAVESETTINGS);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PAGE_CHANGEPREINF:
|
|
|
+ if (SigValueEmpty() && mode == MODE_MENU)
|
|
|
+ pause();
|
|
|
+
|
|
|
+ switch (getSigValue(MODE_MENU)) {
|
|
|
+ case SigInt0Rls:
|
|
|
+
|
|
|
+ break;
|
|
|
+ case SigRotCW:
|
|
|
+ changePage(PAGE_CHANGEBREWTIME);
|
|
|
+ break;
|
|
|
+ case SigRotCCW:
|
|
|
+ changePage(PAGE_RESETKWH);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PAGE_CHANGEBREWTIME:
|
|
|
+ if (SigValueEmpty() && mode == MODE_MENU)
|
|
|
+ pause();
|
|
|
+
|
|
|
+ switch (getSigValue(MODE_MENU)) {
|
|
|
+ case SigInt0Rls:
|
|
|
+
|
|
|
+ break;
|
|
|
+ case SigRotCW:
|
|
|
+ changePage(PAGE_CHANGEBREWML);
|
|
|
+ break;
|
|
|
+ case SigRotCCW:
|
|
|
+ changePage(PAGE_CHANGEPREINF);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PAGE_CHANGEBREWML:
|
|
|
+ if (SigValueEmpty() && mode == MODE_MENU)
|
|
|
+ pause();
|
|
|
+
|
|
|
+ switch (getSigValue(MODE_MENU)) {
|
|
|
+ case SigInt0Rls:
|
|
|
+
|
|
|
+ break;
|
|
|
+ case SigRotCW:
|
|
|
+ changePage(PAGE_CHANGESOAKTIME);
|
|
|
+ break;
|
|
|
+ case SigRotCCW:
|
|
|
+ changePage(PAGE_CHANGEBREWTIME);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PAGE_CHANGESOAKTIME:
|
|
|
+ if (SigValueEmpty() && mode == MODE_MENU)
|
|
|
+ pause();
|
|
|
+
|
|
|
+ switch (getSigValue(MODE_MENU)) {
|
|
|
+ case SigInt0Rls:
|
|
|
+
|
|
|
+ break;
|
|
|
+ case SigRotCW:
|
|
|
+ changePage(PAGE_LEAVESETTINGS);
|
|
|
+ break;
|
|
|
+ case SigRotCCW:
|
|
|
+ changePage(PAGE_CHANGEBREWML);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PAGE_LEAVESETTINGS:
|
|
|
+ if (SigValueEmpty() && mode == MODE_MENU)
|
|
|
+ pause();
|
|
|
+
|
|
|
+ switch (getSigValue(MODE_MENU)) {
|
|
|
+ case SigInt0Rls:
|
|
|
+ changePage(PAGE_SETTINGS);
|
|
|
+ break;
|
|
|
+ case SigRotCW:
|
|
|
+ changePage(PAGE_RESETKWH);
|
|
|
+ break;
|
|
|
+ case SigRotCCW:
|
|
|
+ changePage(PAGE_CHANGESOAKTIME);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
case PAGE_EXIT:
|
|
|
if (SigValueEmpty() && mode == MODE_MENU)
|
|
|
pause();
|
|
@@ -305,7 +445,7 @@ void *coffeeThread(void *threadid) {
|
|
|
break;
|
|
|
|
|
|
case SigRotCCW:
|
|
|
- changePage(PAGE_DESCALING);
|
|
|
+ changePage(PAGE_SETTINGS);
|
|
|
break;
|
|
|
}
|
|
|
break;
|