Skip to content
Snippets Groups Projects
Commit 04e5d5bd authored by dawehr's avatar dawehr
Browse files

Processing communication commands before controller is turned on.

Allowing throttle to be down during autonomous.
parent b7640424
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment