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

View File

@@ -4,6 +4,7 @@
#include "timer.h"
#include "dcm.h"
#include "uart.h"
#include "status.h"
float integral[3] = {0.0f, 0.0f, 0.0f};
float last[3];
@@ -69,7 +70,7 @@ void motor_pid_update(float troll, float mroll,
out[1] = pitch * Kp + integral[1] * Ki + derivative[1] * Kd;
out[2] = yaw * Kp_y + integral[2] * Ki_y + derivative[2] * Kd_y;
if (armed) {
if (status_armed()) {
/* Front right */
motor[0] = throttle + out[0] + out[1] + out[2];
/* Front left */
@@ -147,7 +148,7 @@ void motor_kill(void) {
}
void motor_set_throttle(float t) {
if (armed)
if (status_armed())
throttle = t;
}