AP_ESC_Telem: don't set up parameters on iofirmware

add direct accessor for telemetry data to be used by iomcu
don't update telemetry data if no data
This commit is contained in:
Andy Piper 2023-10-03 20:25:00 +01:00 committed by Andrew Tridgell
parent 98aeade904
commit 6deff406e0
2 changed files with 8 additions and 1 deletions

View File

@ -49,7 +49,9 @@ AP_ESC_Telem::AP_ESC_Telem()
AP_HAL::panic("Too many AP_ESC_Telem instances");
}
_singleton = this;
#if !defined(IOMCU_FW)
AP_Param::setup_object_defaults(this, var_info);
#endif
}
// return the average motor RPM
@ -416,7 +418,7 @@ void AP_ESC_Telem::update_telem_data(const uint8_t esc_index, const AP_ESC_Telem
// can only get slightly more up-to-date information that perhaps they were expecting or might
// read data that has just gone stale - both of these are safe and avoid the overhead of locking
if (esc_index >= ESC_TELEM_MAX_ESCS) {
if (esc_index >= ESC_TELEM_MAX_ESCS || data_mask == 0) {
return;
}

View File

@ -32,6 +32,11 @@ public:
// get an individual ESC's raw rpm if available
bool get_raw_rpm(uint8_t esc_index, float& rpm) const;
// get raw telemetry data, used by IOMCU
const volatile AP_ESC_Telem_Backend::TelemetryData& get_telem_data(uint8_t esc_index) const {
return _telem_data[esc_index];
}
// return the average motor RPM
float get_average_motor_rpm(uint32_t servo_channel_mask) const;