The unified diff between revisions [d0420ebd..] and [64de686d..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'stick.c'
# # old_revision [d0420ebd87c820e33a32b29727989516e15980a8] # new_revision [64de686d701acb9539dc52fe0bff299405612ab0] # # patch "stick.c" # from [b0c0cbffb3863a3992abc1ac1148fc90f019309b] # to [ad24bc7d9d8c95c497a1b5bd7a13d8e1619ca539] # ============================================================ --- stick.c b0c0cbffb3863a3992abc1ac1148fc90f019309b +++ stick.c ad24bc7d9d8c95c497a1b5bd7a13d8e1619ca539 @@ -13,6 +13,8 @@ #include "trig.h" #include "motor.h" #include "wmp.h" +#include "status.h" +#include "watchdog.h" #define TWO_PI 6.28318531f #define PI 3.14159265f @@ -50,8 +52,6 @@ unsigned int stick_counter; unsigned int stick_counter; -bool armed = FALSE; - void stick_update(float x, float y, float z) { float tz = delta_t * z; @@ -85,18 +85,17 @@ void stick_input(void) { throttle = timer_input(2); z = timer_input(3); - if (!armed) { + if (!status_armed()) { if ((throttle < MIN_THR) && (x > (CENTRE_X - CENTRE_ZONE)) && (x < (CENTRE_X + CENTRE_ZONE)) && (y > (CENTRE_Y - CENTRE_ZONE)) && (y < (CENTRE_Y + CENTRE_ZONE)) && (z > (CENTRE_Z - CENTRE_ZONE)) && - (z < (CENTRE_Z + CENTRE_ZONE)) && - (wmp_zero == FALSE)) { - putstr("ARMED!!!\r\n"); - armed = TRUE; - } + (z < (CENTRE_Z + CENTRE_ZONE))) + status_set_ready(STATUS_MODULE_STICK, TRUE); + else + status_set_ready(STATUS_MODULE_STICK,FALSE); } @@ -114,10 +113,13 @@ void stick_input(void) { y = 0.0f; z = 0.0f; throttle = 0.0f; + status_set_ready(STATUS_MODULE_STICK,FALSE); } motor_set_throttle(throttle); + watchdog_kick(WATCHDOG_STICK); + /* So the controls are back to front. Let's fix that. */ x = -x; y = -y;