Skip to content

Commit

Permalink
Commander: checking COM_ARM_CHK_ESCS param for ESCs telemetry
Browse files Browse the repository at this point in the history
COM_ARM_CHK_ESCS set to 0. The user will need to enable it manually.
  • Loading branch information
Igor-Misic committed Apr 21, 2021
1 parent 263c56c commit b8f304f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
20 changes: 15 additions & 5 deletions src/modules/commander/Commander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 (hrt_elapsed_time(&_last_esc_status_updated) > 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();
Expand Down
4 changes: 2 additions & 2 deletions src/modules/commander/commander_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -904,12 +904,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
Expand Down

0 comments on commit b8f304f

Please sign in to comment.