Improve handling of arming, providing LED blink codes if the arming fails.

Also, implement a software watchdog to make sure that the main real-time
modules are actually being run. Provide a panic facility, also giving blink
codes to indicate the panic reason.
This commit is contained in:
2012-09-22 12:08:07 +00:00
parent e36ec4d5b1
commit 999e129e2c
15 changed files with 336 additions and 22 deletions

36
status.h Normal file
View File

@@ -0,0 +1,36 @@
/* status.h */
#include "types.h"
bool status_armed(void);
void status_set_ready(unsigned int module, bool ready);
void status_set_led_pattern(unsigned int module);
void init_status(void);
#define STATUS_MODULE_GYRO_ZERO 0
#define STATUS_MODULE_GYRO_RATE 1
#define STATUS_MODULE_ATTITUDE 2
#define STATUS_MODULE_DCM_ERROR 3
#define STATUS_MODULE_STICK 4
#define STATUS_MODULES 5
#define STATUS_COUNT { \
STATUS_COUNT_GYRO_ZERO, \
STATUS_COUNT_GYRO_RATE, \
STATUS_COUNT_ATTITUDE, \
STATUS_COUNT_DCM_ERROR, \
STATUS_COUNT_STICK \
}
/*
* Each condition must be valid for so many samples, typically once
* per 100Hz loop
*/
#define STATUS_COUNT_STICK 100
#define STATUS_COUNT_GYRO_ZERO 1
#define STATUS_COUNT_GYRO_RATE 100
#define STATUS_COUNT_ATTITUDE 100
#define STATUS_COUNT_DCM_ERROR 100