HAL_SITL: fixed constructoring ordering bug in AP_ESC_Telem

on cygwin RCOutput was being constructed before AP_ESC_Telem, leading
to a panic
This commit is contained in:
Andrew Tridgell 2021-05-13 10:10:42 +10:00 committed by Randy Mackay
parent 60e18d4b3c
commit 7c7d58d2a0
2 changed files with 7 additions and 2 deletions

View File

@ -85,7 +85,12 @@ void RCOutput::push(void)
memcpy(_sitlState->pwm_output, _pending, SITL_NUM_CHANNELS * sizeof(uint16_t));
_corked = false;
}
esc_telem.update();
if (esc_telem == nullptr) {
esc_telem = new AP_ESC_Telem_SITL;
}
if (esc_telem != nullptr) {
esc_telem->update();
}
}
/*

View File

@ -37,7 +37,7 @@ public:
private:
SITL_State *_sitlState;
AP_ESC_Telem_SITL esc_telem;
AP_ESC_Telem_SITL *esc_telem;
uint16_t _freq_hz;
uint16_t _enable_mask;