Copter: Move landing gear code into new file
This commit is contained in:
parent
c297aaeeab
commit
20fce5c9ff
@ -1545,29 +1545,5 @@ static void tuning(){
|
||||
}
|
||||
}
|
||||
|
||||
// Run landing gear controller at 10Hz
|
||||
static void landinggear_update(){
|
||||
|
||||
// If landing gear control is active, run update function.
|
||||
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
|
||||
static bool last_deploy_status;
|
||||
|
||||
landinggear.update();
|
||||
|
||||
// send event message to datalog if status has changed
|
||||
if (landinggear.deployed() != last_deploy_status){
|
||||
if (landinggear.deployed()){
|
||||
Log_Write_Event(DATA_LANDING_GEAR_DEPLOYED);
|
||||
} else {
|
||||
Log_Write_Event(DATA_LANDING_GEAR_RETRACTED);
|
||||
}
|
||||
}
|
||||
|
||||
last_deploy_status = landinggear.deployed();
|
||||
}
|
||||
}
|
||||
|
||||
AP_HAL_MAIN();
|
||||
|
||||
|
26
ArduCopter/LandingGear.pde
Normal file
26
ArduCopter/LandingGear.pde
Normal file
@ -0,0 +1,26 @@
|
||||
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
||||
|
||||
// Run landing gear controller at 10Hz
|
||||
static void landinggear_update(){
|
||||
|
||||
// If landing gear control is active, run update function.
|
||||
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
|
||||
static bool last_deploy_status;
|
||||
|
||||
landinggear.update();
|
||||
|
||||
// send event message to datalog if status has changed
|
||||
if (landinggear.deployed() != last_deploy_status){
|
||||
if (landinggear.deployed()){
|
||||
Log_Write_Event(DATA_LANDING_GEAR_DEPLOYED);
|
||||
} else {
|
||||
Log_Write_Event(DATA_LANDING_GEAR_RETRACTED);
|
||||
}
|
||||
}
|
||||
|
||||
last_deploy_status = landinggear.deployed();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user