You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
867 B
47 lines
867 B
#ifndef LOGGING_H |
|
#define LOGGING_H |
|
|
|
#include "firmware.h" |
|
|
|
#define SERIAL_LOGGING true |
|
|
|
#define LOG_SIZE 90 // 100 blew up the stack |
|
#define LOG_DATA_LENGTH 10 |
|
|
|
enum eventCodes |
|
{ |
|
LOG_BOOT_UP, |
|
LOG_INIT_COMPLETE, |
|
LOG_WIFI_CONNECTED, |
|
LOG_WIFI_DISCONNECTED, |
|
LOG_COMM_LOCK_ARM, |
|
LOG_COMM_LOCK_DISARM, |
|
LOG_COMM_LOCK_FAIL, |
|
LOG_COMM_CARD_FAIL, |
|
LOG_COMM_INFO_FAIL, |
|
LOG_LOCK_OFF, |
|
LOG_LOCK_ARMED, |
|
LOG_LOCK_TIMEOUT, |
|
LOG_LOCK_ON, |
|
LOG_LOCK_DISARM, |
|
LOG_LOCK_ERROR, |
|
LOG_CARD_GOOD_READ, |
|
LOG_CARD_ACCEPTED, |
|
LOG_CARD_DENIED, |
|
LOG_UPDATE_FAILED, |
|
LOG_TEST, |
|
}; |
|
|
|
struct __attribute__((packed)) logData { |
|
uint32_t unixTime; |
|
uint8_t eventCode; |
|
char data[LOG_DATA_LENGTH]; |
|
}; |
|
|
|
extern struct logData eventLog[LOG_SIZE]; |
|
extern uint16_t logPosition; |
|
|
|
void logEvent(uint8_t eventCode, const char *data = nullptr, size_t num = 0); |
|
void removeLogRecords(uint8_t num); |
|
|
|
#endif
|
|
|