AP_ESC_Telem: allow IOMCU to work in example fw

example firmwares don't instantate AP_ESC_Telem
This commit is contained in:
Andrew Tridgell 2023-12-30 08:33:06 +11:00
parent ce9c7dfdd1
commit 15d3ec3113
1 changed files with 5 additions and 0 deletions

View File

@ -20,14 +20,19 @@
#if HAL_WITH_ESC_TELEM
#include <AP_Math/AP_Math.h>
#include <AP_Vehicle/AP_Vehicle_Type.h>
extern const AP_HAL::HAL& hal;
AP_ESC_Telem_Backend::AP_ESC_Telem_Backend() {
_frontend = AP_ESC_Telem::_singleton;
#if !APM_BUILD_TYPE(APM_BUILD_UNKNOWN)
// we allow for no frontend in example fw and tools to make it
// possible to run them on hardware with IOMCU
if (_frontend == nullptr) {
AP_HAL::panic("No ESC frontend");
}
#endif
}
// callback to update the rpm in the frontend, should be called by the driver when new data is available