mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-17 10:37:36 +08:00
VTOL transition switch parameter checking (#5545)
* VTOL transition switch parameter checking * Code style
This commit is contained in:
committed by
Lorenz Meier
parent
bd922e4eed
commit
c4eabbd083
@@ -52,7 +52,7 @@
|
||||
|
||||
#define RC_INPUT_MAP_UNMAPPED 0
|
||||
|
||||
int rc_calibration_check(orb_advert_t *mavlink_log_pub, bool report_fail)
|
||||
int rc_calibration_check(orb_advert_t *mavlink_log_pub, bool report_fail, bool isVTOL)
|
||||
{
|
||||
|
||||
char nbuf[20];
|
||||
@@ -68,6 +68,32 @@ int rc_calibration_check(orb_advert_t *mavlink_log_pub, bool report_fail)
|
||||
|
||||
unsigned j = 0;
|
||||
|
||||
/* if VTOL, check transition switch mapping */
|
||||
if (isVTOL) {
|
||||
param_t trans_parm = param_find("RC_MAP_TRANS_SW");
|
||||
|
||||
if (trans_parm == PARAM_INVALID) {
|
||||
if (report_fail) { mavlink_and_console_log_critical(mavlink_log_pub, "ERR: RC_MAP_TRANS_SW PARAMETER MISSING"); }
|
||||
|
||||
/* give system time to flush error message in case there are more */
|
||||
usleep(100000);
|
||||
map_fail_count++;
|
||||
|
||||
} else {
|
||||
int32_t transition_switch;
|
||||
param_get(trans_parm, &transition_switch);
|
||||
|
||||
if (transition_switch < 1) {
|
||||
if (report_fail) { mavlink_and_console_log_critical(mavlink_log_pub, "ERR: transition switch (RC_MAP_TRANS_SW) not set"); }
|
||||
|
||||
map_fail_count++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* first check channel mappings */
|
||||
while (rc_map_mandatory[j] != 0) {
|
||||
|
||||
|
||||
@@ -49,6 +49,6 @@ __BEGIN_DECLS
|
||||
* @return 0 / OK if RC calibration is ok, index + 1 of the first
|
||||
* channel that failed else (so 1 == first channel failed)
|
||||
*/
|
||||
__EXPORT int rc_calibration_check(orb_advert_t *mavlink_log_pub, bool report_fail);
|
||||
__EXPORT int rc_calibration_check(orb_advert_t *mavlink_log_pub, bool report_fail, bool isVTOL);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
Reference in New Issue
Block a user