Browse Source

fixed some bugs inside the button handling

Philipp Hinz 7 năm trước cách đây
mục cha
commit
f7877fb8b2
3 tập tin đã thay đổi với 14 bổ sung5 xóa
  1. 1 1
      CoffeeCode/buildno
  2. 1 1
      CoffeeCode/coffee.cpp
  3. 12 3
      CoffeeCode/hal.cpp

+ 1 - 1
CoffeeCode/buildno

@@ -1 +1 @@
-231
+233

+ 1 - 1
CoffeeCode/coffee.cpp

@@ -628,7 +628,7 @@ void brewTimeHandler(void) {
  * handles program termination
  */
 void coffeeTerminate(event_t *event) {
-	logger(V_BREW, "Coffee.cpp: Thread terminating");
+	logger(V_BREW, "Coffee.cpp: Terminating\n");
 	//stop brewing
 	halRelaisOff(RELAIS_PUMP);
 	brewTimer.stop();

+ 12 - 3
CoffeeCode/hal.cpp

@@ -215,8 +215,8 @@ void halInt1(void) {
 		if (flagIgnoreRlsInt1) {
 			flagIgnoreRlsInt1 = false;
 		} else {
-			Int0Time = 0;
-			Int0Timer.stop();
+			Int1Time = 0;
+			Int1Timer.stop();
 			halSendSignal(SigInt1Rls);
 		}
 	} else if(!halGetInt1() && pinState[1]) {
@@ -364,9 +364,15 @@ void halSendSignal(HalSig val) {
 
 	switch (val) {
 	case SigInt0Psh:
+	case SigInt1Psh:
+		idleCounter = 0;
+		if (idle) {
+			return;
+		}
+		break;
+
 	case SigInt0Rls:
 	case SigInt0RlsLong:
-	case SigInt1Psh:
 	case SigInt1Rls:
 	case SigInt1RlsLong:
 		idleCounter = 0;
@@ -374,7 +380,10 @@ void halSendSignal(HalSig val) {
 			halLeaveIdle();
 			return;
 		}
+		break;
 
+	default:
+		break;
 	}
 	sigval value = { 0 };
 	value.sival_int = (int) val;