Explorar o código

Added Statename to logging, removed the Logging of every flow event

Sebastian %!s(int64=7) %!d(string=hai) anos
pai
achega
bfd5aebef6
Modificáronse 2 ficheiros con 3 adicións e 1 borrados
  1. 2 1
      CoffeeCode/coffee.cpp
  2. 1 0
      CoffeeCode/coffee.h

+ 2 - 1
CoffeeCode/coffee.cpp

@@ -151,6 +151,7 @@ void *coffeeThread(void *threadid) {
 			}
 			/*
 			 * @TODO FIXME:
+			 * Put in HAL
 			 * The time measurement makes no sense, since the FSM loops and there are a lot of interrupts that
 			 * should be considered (like buttons or proximity sensor)
 			 * Suggestion: capture time snapshot once at change to heating. If a change to another state occurs,
@@ -261,7 +262,7 @@ bool SigValueEmpty(void) {
  * @param newState
  */
 void changeState(coffee_status_t newState) {
-	logger(V_BREW, "Changing state to %d\n", newState);
+	logger(V_BREW, "Changing state to %s\n", StateName[newState]);
 	state = newState;
 
 	event_trigger("statechange", &state, sizeof(state));

+ 1 - 0
CoffeeCode/coffee.h

@@ -20,6 +20,7 @@ typedef enum {
 	STATE_CLEANING,
 	STATE_ERROR
 } coffee_status_t;
+static const char StateName[] = {"OFF", "HEATING", "INITHEAT", "IDLE", "BREW", "BREWMAN", "CLEAN", "ERROR"};
 
 #define AMOUNT_PREINFUSION	25 //Preinfusion amount in ml
 #define TIME_SOAK			5000 //Time between preinfusion and infusion in ms