ArduCopter: make SRV_Channels::cork non-static

for symmetry with the push function
This commit is contained in:
Peter Barker 2024-11-13 08:09:59 +11:00 committed by Andrew Tridgell
parent 89936bab3d
commit a2f35b3150
3 changed files with 17 additions and 12 deletions

View File

@ -146,9 +146,10 @@ MAV_RESULT Copter::mavlink_compassmot(const GCS_MAVLINK &gcs_chan)
read_radio();
// pass through throttle to motors
SRV_Channels::cork();
auto &srv = AP::srv();
srv.cork();
motors->set_throttle_passthrough_for_esc_calibration(channel_throttle->get_control_in() * 0.001f);
AP::srv().push();
srv.push();
// read some compass values
compass.read();

View File

@ -95,9 +95,10 @@ void Copter::esc_calibration_passthrough()
hal.scheduler->delay(3);
// pass through to motors
SRV_Channels::cork();
auto &srv = AP::srv();
srv.cork();
motors->set_throttle_passthrough_for_esc_calibration(channel_throttle->get_control_in() * 0.001f);
AP::srv().push();
srv.push();
}
#endif // FRAME_CONFIG != HELI_FRAME
}
@ -112,25 +113,26 @@ void Copter::esc_calibration_auto()
esc_calibration_setup();
// raise throttle to maximum
SRV_Channels::cork();
auto &srv = AP::srv();
srv.cork();
motors->set_throttle_passthrough_for_esc_calibration(1.0f);
AP::srv().push();
srv.push();
// delay for 5 seconds while outputting pulses
uint32_t tstart = millis();
while (millis() - tstart < 5000) {
SRV_Channels::cork();
srv.cork();
motors->set_throttle_passthrough_for_esc_calibration(1.0f);
AP::srv().push();
srv.push();
esc_calibration_notify();
hal.scheduler->delay(3);
}
// block until we restart
while(1) {
SRV_Channels::cork();
srv.cork();
motors->set_throttle_passthrough_for_esc_calibration(0.0f);
AP::srv().push();
srv.push();
esc_calibration_notify();
hal.scheduler->delay(3);
}

View File

@ -156,8 +156,10 @@ void Copter::motors_output()
// output any servo channels
SRV_Channels::calc_pwm();
auto &srv = AP::srv();
// cork now, so that all channel outputs happen at once
SRV_Channels::cork();
srv.cork();
// update output on any aux channels, for manual passthru
SRV_Channels::output_ch_all();
@ -181,7 +183,7 @@ void Copter::motors_output()
}
// push all channels
AP::srv().push();
srv.push();
}
// check for pilot stick input to trigger lost vehicle alarm