Copter: rename landing_gear.pde

This commit is contained in:
Randy Mackay 2015-01-07 11:51:06 +09:00
parent 62b5f32643
commit 5f3c2bcd11
1 changed files with 7 additions and 8 deletions

View File

@ -2,31 +2,30 @@
// Run landing gear controller at 10Hz // Run landing gear controller at 10Hz
static void landinggear_update(){ static void landinggear_update(){
// If landing gear control is active, run update function. // If landing gear control is active, run update function.
if (g.ch7_option == AUX_SWITCH_LANDING_GEAR || g.ch8_option == AUX_SWITCH_LANDING_GEAR){ if (g.ch7_option == AUX_SWITCH_LANDING_GEAR || g.ch8_option == AUX_SWITCH_LANDING_GEAR){
// last status (deployed or retracted) used to check for changes // last status (deployed or retracted) used to check for changes
static bool last_deploy_status; static bool last_deploy_status;
// if we are doing an automatic landing procedure, force the landing gear to deploy. // if we are doing an automatic landing procedure, force the landing gear to deploy.
// To-Do: should we pause the auto-land procedure to give time for gear to come down? // To-Do: should we pause the auto-land procedure to give time for gear to come down?
if (control_mode == LAND || (control_mode==RTL && rtl_state == Land) || (control_mode == AUTO && auto_mode == Auto_Land)){ if (control_mode == LAND || (control_mode==RTL && rtl_state == Land) || (control_mode == AUTO && auto_mode == Auto_Land)){
landinggear.force_deploy(true); landinggear.force_deploy(true);
} }
landinggear.update(); landinggear.update();
// send event message to datalog if status has changed // send event message to datalog if status has changed
if (landinggear.deployed() != last_deploy_status){ if (landinggear.deployed() != last_deploy_status){
if (landinggear.deployed()){ if (landinggear.deployed()) {
Log_Write_Event(DATA_LANDING_GEAR_DEPLOYED); Log_Write_Event(DATA_LANDING_GEAR_DEPLOYED);
} else { } else {
Log_Write_Event(DATA_LANDING_GEAR_RETRACTED); Log_Write_Event(DATA_LANDING_GEAR_RETRACTED);
} }
} }
last_deploy_status = landinggear.deployed(); last_deploy_status = landinggear.deployed();
} }
} }