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:
5
motor.c
5
motor.c
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user