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

AP_RPM: Fix to SITL RPM driver instance #12909

Open
wants to merge 1 commit into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -111,24 +111,25 @@ void AP_RPM::init(void)
}
for (uint8_t i=0; i<RPM_MAX_INSTANCES; i++) {
uint8_t type = _type[i];

#if CONFIG_HAL_BOARD != HAL_BOARD_SITL
if (type == RPM_TYPE_PWM) {
// PWM option same as PIN option, for upgrade
type = RPM_TYPE_PIN;
}
if (type == RPM_TYPE_PIN) {
drivers[i] = new AP_RPM_Pin(*this, i, state[i]);
}
#if EFI_ENABLED
if (type == RPM_TYPE_EFI) {
drivers[i] = new AP_RPM_EFI(*this, i, state[i]);
}
#endif
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
#else
if (drivers[i] == nullptr) {
drivers[i] = new AP_RPM_SITL(*this, i, state[i]);
}
#endif
#endif
#if EFI_ENABLED

This comment has been minimized.

Copy link
@tridge

tridge Dec 3, 2019

Contributor

this breaks EFI in SITL

This comment has been minimized.

Copy link
@Gone4Dirt

Gone4Dirt Dec 3, 2019

Author Contributor

I have now moved the EFI driver instantiation outside of the check for HAL_BOARD_SITL.

This comment has been minimized.

Copy link
@tridge

tridge Dec 3, 2019

Contributor

that still doesn't look right, as it will allocate AP_RPM_SITL, then overwrite it with AP_RPM_EFI object?

if (type == RPM_TYPE_EFI) {
drivers[i] = new AP_RPM_EFI(*this, i, state[i]);
}
#endif

if (drivers[i] != nullptr) {
// we loaded a driver for this instance, so it must be
// present (although it may not be healthy)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.