diff --git a/quad/src/quad_app/control_algorithm.c b/quad/src/quad_app/control_algorithm.c index 9f2c8d5b9fdca403877c8a11112024a1fc75db17..3a1ab4675a94b2703094e35e9be227508269a5ae 100644 --- a/quad/src/quad_app/control_algorithm.c +++ b/quad/src/quad_app/control_algorithm.c @@ -356,9 +356,9 @@ int control_algorithm_init(parameter_t * ps) //memcpy(raw_actuator_struct->controller_corrected_motor_commands, user_input_struct->rc_commands, sizeof(int) * 6); // don't use the PID corrections if the throttle is less than about 10% of its range - - // re-enable the check for AUTO_FLIGHT_MODE when autonomous is fully enabled!!! - if((user_input_struct->rc_commands[THROTTLE] > 118000)) + // unless we are in autonomous + if((user_input_struct->rc_commands[THROTTLE] > 118000) || + user_defined_struct->flight_mode = AUTO_FLIGHT_MODE) { //THROTTLE diff --git a/quad/src/quad_app/initialize_components.c b/quad/src/quad_app/initialize_components.c index 967eaa6294b342641fc1dcdfb0b3327ea4490427..e476fd633eb9ecce40eb77af6570eac63462833a 100644 --- a/quad/src/quad_app/initialize_components.c +++ b/quad/src/quad_app/initialize_components.c @@ -21,14 +21,12 @@ int protection_loops(modular_structs_t *structs) struct PWMInputDriver *pwm_inputs = &structs->hardware_struct.pwm_inputs; read_rec_all(pwm_inputs, rc_commands); - - // wait for RC receiver to connect to transmitter - while(rc_commands[THROTTLE] < 75000) - read_rec_all(pwm_inputs, rc_commands); - - // wait until throttle is low and the gear switch is engaged (so you don't immediately break out of the main loop below) - // also wait for the flight mode to be set to manual - while(rc_commands[THROTTLE] > 125000 || read_kill(rc_commands[GEAR]) || !read_flap(rc_commands[FLAP])) { + + while(rc_commands[THROTTLE] < 75000 || // wait for RC receiver to connect to transmitter + rc_commands[THROTTLE] > 125000 || // Wait until throttle is low + read_kill(rc_commands[GEAR]) || // Wait until gear switch is engaged (so you don't immediately break out of the main loop below) + !read_flap(rc_commands[FLAP])) // Wait for the flight mode to be set to manual + { process_received(structs); read_rec_all(pwm_inputs, rc_commands); }