ソースを参照

Optimizations for brewing, bug fixes

Philipp Hinz 8 年 前
コミット
be164532ee
6 ファイル変更17 行追加13 行削除
  1. 1 1
      CoffeeCode/buildno
  2. 1 1
      CoffeeCode/coffee.cpp
  3. 3 3
      CoffeeCode/coffee.h
  4. 8 5
      CoffeeCode/display.cpp
  5. 1 1
      CoffeeCode/display.h
  6. 3 2
      CoffeeCode/hal.cpp

+ 1 - 1
CoffeeCode/buildno

@@ -1 +1 @@
-87
+97

+ 1 - 1
CoffeeCode/coffee.cpp

@@ -301,7 +301,6 @@ void coffeeBrew(void) {
 	}
 	brewTimer.stop();
 	brewTime = 0;
-	halResetFlow();
 	halRelaisOff(RELAIS_PUMP);
 
 	/*
@@ -315,6 +314,7 @@ void coffeeBrew(void) {
 	}
 	brewTimer.stop();
 	brewTime = 0;
+	halResetFlow();
 
 	/*
 	 * Brewing the actual espresso

+ 3 - 3
CoffeeCode/coffee.h

@@ -21,10 +21,10 @@ typedef enum {
 	STATE_ERROR
 } coffee_status_t;
 
-#define AMOUNT_PREINFUSION	3 //Preinfusion amount in ml
-#define TIME_SOAK			3000 //Time between preinfusion and infusion in ms
+#define AMOUNT_PREINFUSION	28 //Preinfusion amount in ml
+#define TIME_SOAK			5000 //Time between preinfusion and infusion in ms
 #define TIME_INFUSION 		25000	//Infusion time in ms
-#define AMOUNT_DBLESPRESSO	25.0	//Size of a double espresso in ml
+#define AMOUNT_DBLESPRESSO	49.0	//Size of a double espresso in ml
 void *coffeeThread(void *threadid);
 
 void coffeeHandler(int signum, siginfo_t *siginfo, void *context);

+ 8 - 5
CoffeeCode/display.cpp

@@ -52,7 +52,7 @@ void displayPrintTime(int line) {
 void displayPrintFlow(int line) {
 	float flow = halGetFlow();
 	lcdPosition(lcd, 0, line);
-	lcdPrintf(lcd, "%s: %.0f", displayGetString(str_flow), flow);
+	lcdPrintf(lcd, "%s: %.0f ml    ", displayGetString(str_flow), flow);
 }
 
 /**
@@ -219,11 +219,13 @@ void displayRefresh(void) {
 		break;
 
 	case STATE_BREW:
-		if (elapsedCnt <= REFRESH_RATE) {
-		displayPrintLn(0, "CoffeePi", true);
-		displayPrintLn(1, displayGetString(str_brewing), true);
-		} else
+		if (elapsedCnt <= 2*REFRESH_RATE) {
+			displayPrintLn(0, "CoffeePi", true);
+			displayPrintLn(1, displayGetString(str_brewing), true);
+		} else {
+			displayPrintLn(0, displayGetString(str_brewing), true);
 			displayPrintFlow(1);
+		}
 		break;
 
 	case STATE_BREWMANUAL:
@@ -270,6 +272,7 @@ void displayPushState(coffee_status_t state) {
 	if (state != coffeeState) {
 		coffeeState = state;
 		timerScaler--;
+		elapsedCnt = 0;
 		displayTimer.call();
 	}
 }

+ 1 - 1
CoffeeCode/display.h

@@ -84,7 +84,7 @@ static const display_string_t display_strings[str_last] =
 		}
 };
 
-#define DEFAULT_LANG 	lang_de /**< Default display language */
+#define DEFAULT_LANG 	lang_en /**< Default display language */
 #define REFRESH_RATE	10 /**< Display refresh rate in Hz */
 #define DISPLAY_ROWS	2
 #define DISPLAY_COLS	16

+ 3 - 2
CoffeeCode/hal.cpp

@@ -14,7 +14,7 @@
 #include "logger.h"
 #include "timer.h"
 
-int flowcnt = 0;
+volatile int flowcnt = 0;
 
 int Int0Time;
 int Int1Time;
@@ -176,7 +176,7 @@ void halInt1(void) {
  */
 void halInt1TimerHandler(void) {
 	Int1Time += 200;
-	if (Int1Time >= TIME_BUTTONLONGPRESS) {
+	if (Int1Time >= (TIME_BUTTONLONGPRESS * 1000)) {
 		halSendSignal(SigInt1RlsLong);
 		flagIgnoreRlsInt1 = true;
 		Int1Time = 0;
@@ -233,6 +233,7 @@ float halGetFlow(void) {
  * Resets the Flow counter
  */
 void halResetFlow(void) {
+	logger(V_HAL, "Flow counter reset, amount so far: %.2f ml\n", halGetFlow());
 	flowcnt = 0;
 }