Commander: checking COM_ARM_CHK_ESCS param for ESCs telemetry

COM_ARM_CHK_ESCS set to 0. The user will need to enable it manually.
Co-authored-by: Beat Küng <beat-kueng@gmx.net>
This commit is contained in:
Igor Mišić 2021-04-22 09:33:31 +02:00 committed by Nuno Marques
parent bff99f9794
commit d631a5d39f
3 changed files with 18 additions and 8 deletions

View File

@ -1961,14 +1961,24 @@ Commander::run()
/* ESCs status changed */
esc_status_check();
} else if (hrt_elapsed_time(&_last_esc_status_updated) > 700_ms) {
// Some DShot ESCs are unresponsive for ~550ms during their initialization, so we use a timeout higher than that
} else if (_param_escs_checks_required.get() != 0) {
if (!_status_flags.condition_escs_error) {
mavlink_log_critical(&_mavlink_log_pub, "ESCs telemetry timeout");
}
_status_flags.condition_escs_error = true;
if ((_last_esc_status_updated != 0) && (hrt_elapsed_time(&_last_esc_status_updated) > 700_ms)) {
/* Detect timeout after first telemetry packet received
* Some DShot ESCs are unresponsive for ~550ms during their initialization, so we use a timeout higher than that
*/
mavlink_log_critical(&_mavlink_log_pub, "ESCs telemetry timeout");
_status_flags.condition_escs_error = true;
} else if (_last_esc_status_updated == 0 && hrt_elapsed_time(&_boot_timestamp) > 5000_ms) {
/* Detect if esc telemetry is not connected after reboot */
mavlink_log_critical(&_mavlink_log_pub, "ESCs telemetry not connected ");
_status_flags.condition_escs_error = true;
}
}
}
estimator_check();

View File

@ -333,7 +333,7 @@ private:
hrt_abstime _high_latency_datalink_lost{0};
int _last_esc_online_flags{-1};
int _last_esc_failure[esc_status_s::CONNECTED_ESC_MAX] {0};
int _last_esc_failure[esc_status_s::CONNECTED_ESC_MAX] {};
hrt_abstime _last_esc_status_updated{0};
uint8_t _battery_warning{battery_status_s::BATTERY_WARNING_NONE};

View File

@ -902,12 +902,12 @@ PARAM_DEFINE_INT32(COM_FLT_PROFILE, 0);
* Enable checks on ESCs that report telemetry.
*
* If this parameter is set, the system will check ESC's online status and failures.
* This param is specific for ESCs reporting status. Normal ESCs configurations are not affected by the change of this param.
* This param is specific for ESCs reporting status. It shall be used only if ESCs support telemetry.
*
* @group Commander
* @boolean
*/
PARAM_DEFINE_INT32(COM_ARM_CHK_ESCS, 1);
PARAM_DEFINE_INT32(COM_ARM_CHK_ESCS, 0);
/**
* Condition to enter prearmed mode