Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAL_ChibiOS: fixed cork/push #29521

Merged
merged 1 commit into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion libraries/AP_HAL_ChibiOS/RCOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,13 @@ void RCOutput::write(uint8_t chan, uint16_t period_us)

chan -= chan_offset;

period[chan] = period_us;
if (corked) {
// when corked we put the updated period in a separate array which is
// copied to period[] when we push
period_corked[chan] = period_us;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean shouldn't this always be the case? Couldn't you just assert on the non-corked case?

Copy link
Contributor Author

@tridge tridge Mar 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there could be special cases where we write non-corked, for something going into 4.6.0 I wouldn't want to rule out non-corked output on some weird vehicle setup
one example would be ReplayGyroFFT
another in toy_mode test code
for 4.7.0 I'd be happy to enforce corked only, starting with SITL

} else {
period[chan] = period_us;
}

if (chan < num_fmu_channels) {
active_fmu_channels = MAX(chan+1, active_fmu_channels);
Expand Down Expand Up @@ -1344,6 +1350,7 @@ void RCOutput::push(void)
INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
}
corked = false;
memcpy(period, period_corked, sizeof(period));
push_local();
#if HAL_WITH_IO_MCU
if (iomcu_enabled) {
Expand Down
1 change: 1 addition & 0 deletions libraries/AP_HAL_ChibiOS/RCOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ class ChibiOS::RCOutput : public AP_HAL::RCOutput
// these values are for the local channels. Non-local channels are handled by IOMCU
uint32_t en_mask;
uint16_t period[max_channels];
uint16_t period_corked[max_channels];

// handling of bi-directional dshot
struct {
Expand Down
Loading