Reset blink error count, stop logging info data over serial

This commit is contained in:
Tanner Collin 2019-02-17 19:22:55 -07:00
parent a66b8c3422
commit c3d4da2a22

View File

@ -8,7 +8,7 @@
#include <Ticker.h> #include <Ticker.h>
#include <time.h> #include <time.h>
const char *FIRMWARE_VERSION = "MRWIZARD 0008 MRWIZARD"; const char *FIRMWARE_VERSION = "MRWIZARD 0010 MRWIZARD";
const char *WIFI_SSID PROGMEM = "Protospace"; const char *WIFI_SSID PROGMEM = "Protospace";
const char *WIFI_PASS PROGMEM = "yycmakers"; const char *WIFI_PASS PROGMEM = "yycmakers";
@ -118,6 +118,7 @@ enum eventCodes
LOG_CARD_ACCEPTED, LOG_CARD_ACCEPTED,
LOG_CARD_DENIED, LOG_CARD_DENIED,
LOG_UPDATE_FAILED, LOG_UPDATE_FAILED,
LOG_TEST,
}; };
struct __attribute__((packed)) logData { struct __attribute__((packed)) logData {
@ -296,14 +297,14 @@ void checkCard()
if (authorizedCards.indexOf(cardStr) >= 0) { if (authorizedCards.indexOf(cardStr) >= 0) {
if (SERIAL_LOGGING) Serial.println("[INFO] Card is authorized on machine."); if (SERIAL_LOGGING) Serial.println("[INFO] Card is authorized on machine.");
logEvent(LOG_CARD_ACCEPTED, cardStr.c_str(), cardStr.length());
if (lockState == LOCK_OFF) { if (lockState == LOCK_OFF) {
lockState = LOCK_PREARM; lockState = LOCK_PREARM;
} }
logEvent(LOG_CARD_ACCEPTED, cardStr.c_str(), cardStr.length());
} else { } else {
if (SERIAL_LOGGING) Serial.println("[INFO] Card not authorized on machine."); if (SERIAL_LOGGING) Serial.println("[INFO] Card not authorized on machine.");
logEvent(LOG_CARD_DENIED, cardStr.c_str(), cardStr.length());
LEDState = LED_ERROR; LEDState = LED_ERROR;
logEvent(LOG_CARD_DENIED, cardStr.c_str(), cardStr.length());
} }
} }
} }
@ -373,8 +374,8 @@ void processLockState()
} else { } else {
if (SERIAL_LOGGING) Serial.println("[ERROR] Buttons held, aborting."); if (SERIAL_LOGGING) Serial.println("[ERROR] Buttons held, aborting.");
logEvent(LOG_LOCK_ERROR); logEvent(LOG_LOCK_ERROR);
lockState = LOCK_OFF;
LEDState = LED_ERROR; LEDState = LED_ERROR;
lockState = LOCK_OFF;
} }
break; break;
case LOCK_ARMED: case LOCK_ARMED:
@ -474,6 +475,7 @@ void processLEDState()
greenLEDOff(); greenLEDOff();
redLEDOn(); redLEDOn();
} else { } else {
LEDErrorBlinkCount = 0;
LEDState = LED_OFF; LEDState = LED_OFF;
} }
break; break;
@ -651,9 +653,8 @@ void postInfolog()
if (SERIAL_LOGGING) Serial.println("[INFO] Info state HTTP begin."); if (SERIAL_LOGGING) Serial.println("[INFO] Info state HTTP begin.");
if (SERIAL_LOGGING) Serial.print("[INFO] HTTP POST: "); if (SERIAL_LOGGING) Serial.println("[INFO] HTTP POST.");
String postData = serializeLog(); String postData = serializeLog();
if (SERIAL_LOGGING) Serial.println(postData);
int16_t infoHTTPCode = infoHTTP.POST(postData); int16_t infoHTTPCode = infoHTTP.POST(postData);
String infoHTTPCodeStr = String(infoHTTPCode); String infoHTTPCodeStr = String(infoHTTPCode);