RC_Channel: don't change trim if radio in is zero

This commit is contained in:
Andrew Tridgell 2013-01-25 14:27:22 +11:00
parent b74fe10aa9
commit 9b4c75c66b
1 changed files with 4 additions and 2 deletions

View File

@ -126,8 +126,10 @@ RC_Channel_aux::set_radio_trim(RC_Channel_aux::Aux_servo_function_t function)
{ {
for (uint8_t i = 0; i < 7; i++) { for (uint8_t i = 0; i < 7; i++) {
if (_aux_channels[i] && _aux_channels[i]->function.get() == function) { if (_aux_channels[i] && _aux_channels[i]->function.get() == function) {
_aux_channels[i]->radio_trim = _aux_channels[i]->radio_in; if (_aux_channels[i]->radio_in != 0) {
_aux_channels[i]->radio_trim.save(); _aux_channels[i]->radio_trim = _aux_channels[i]->radio_in;
_aux_channels[i]->radio_trim.save();
}
} }
} }
} }