Sebastian преди 7 години
родител
ревизия
52b22a131c
променени са 3 файла, в които са добавени 6 реда и са изтрити 6 реда
  1. 1 1
      CoffeeCode/buildno
  2. 3 3
      CoffeeCode/coffee.cpp
  3. 2 2
      CoffeeCode/display.cpp

+ 1 - 1
CoffeeCode/buildno

@@ -1 +1 @@
-239
+240

+ 3 - 3
CoffeeCode/coffee.cpp

@@ -467,7 +467,6 @@ void *coffeeThread(void *threadid) {
 			if (!halProxSensorCovered()) {
 				//execute the cleaning procedure
 				coffeeClean();
-				updateDescaling();
 				if (halIsHeating()) {
 					changeState(STATE_HEATING);
 				} else {
@@ -679,10 +678,13 @@ void coffeeClean(void) {
 	logger(V_BREW, "Cleaning...\n");
 	for (int i = 0; i < 20; i++) {
 		halRelaisOn(RELAIS_PUMP);
+		//TODO the sleep function returns when a signal is delivered
+		//this causes the cleaning to not work properly when the pressure is triggered
 		sleep(3);
 		halRelaisOff(RELAIS_PUMP);
 		sleep(15);
 	}
+	updateDescaling();
 	descaling = false;
 	event_trigger("descaling", &descaling, sizeof(bool));
 }
@@ -755,8 +757,6 @@ void stopBrewing() {
  */
 void coffeeIncreaseBrewCounter(void) {
 	brewCounter++;
-	if ((brewCounter % DIRTY_ESPRESSO) == 0)
-		descaling = true;
 }
 
 /**

+ 2 - 2
CoffeeCode/display.cpp

@@ -188,7 +188,7 @@ void displayDescaling(event_t *event) {
 		logger_error("Invalid use of event %s\n", event->event);
 		return;
 	}
-	coffeeDescaling = (bool) event->data;
+	coffeeDescaling = *(bool*) event->data;
 }
 
 /**
@@ -207,7 +207,7 @@ void displayTerminate(event_t *e) {
 
 void* displayThread(void* threadid) {
 	//TODO: the display is loosing the first events here since it is waiting before it is subscribing
-	//its loosing the descaling event triggered at the beginning of coffee initialisation
+	//its loosing the descaling event triggered at the beginning of coffee initialization
 	sleep(1); // Wait for other components to initialize
 	int tmp = sqlGetConf(CFGdisplaylang);
 	if (!tmp || tmp >= lang_last)