34 #include "../PreFlightCheck.hpp" 43 #define RC_INPUT_MAX_DEADZONE_US 500 48 #define RC_INPUT_LOWEST_MIN_US 500 53 #define RC_INPUT_HIGHEST_MAX_US 2500 58 param_t _parameter_handles_min, _parameter_handles_trim, _parameter_handles_max,
59 _parameter_handles_rev, _parameter_handles_dz;
61 unsigned map_fail_count = 0;
63 const char *rc_map_mandatory[] = {
75 if (report_fail) {
mavlink_log_critical(mavlink_log_pub,
"RC_MAP_TRANS_SW PARAMETER MISSING."); }
82 int32_t transition_switch;
83 param_get(trans_parm, &transition_switch);
85 if (transition_switch < 1) {
86 if (report_fail) {
mavlink_log_critical(mavlink_log_pub,
"Transition switch RC_MAP_TRANS_SW not set."); }
94 while (rc_map_mandatory[j] !=
nullptr) {
99 if (report_fail) {
mavlink_log_critical(mavlink_log_pub,
"RC ERROR: PARAM %s MISSING.", rc_map_mandatory[j]); }
111 if (mapping > input_rc_s::RC_INPUT_MAX_CHANNELS) {
112 if (report_fail) {
mavlink_log_critical(mavlink_log_pub,
"RC ERROR: %s >= NUMBER OF CHANNELS.", rc_map_mandatory[j]); }
120 if (report_fail) {
mavlink_log_critical(mavlink_log_pub,
"RC ERROR: mandatory %s is unmapped.", rc_map_mandatory[j]); }
130 unsigned total_fail_count = 0;
131 unsigned channels_failed = 0;
133 for (
unsigned i = 0; i < input_rc_s::RC_INPUT_MAX_CHANNELS; i++) {
138 float param_min = 0.0f;
139 float param_max = 0.0f;
140 float param_trim = 0.0f;
141 float param_rev = 0.0f;
145 sprintf(nbuf,
"RC%d_MIN", i + 1);
147 param_get(_parameter_handles_min, ¶m_min);
150 sprintf(nbuf,
"RC%d_TRIM", i + 1);
152 param_get(_parameter_handles_trim, ¶m_trim);
155 sprintf(nbuf,
"RC%d_MAX", i + 1);
157 param_get(_parameter_handles_max, ¶m_max);
160 sprintf(nbuf,
"RC%d_REV", i + 1);
162 param_get(_parameter_handles_rev, ¶m_rev);
165 sprintf(nbuf,
"RC%d_DZ", i + 1);
167 param_get(_parameter_handles_dz, ¶m_dz);
188 if (param_trim < param_min) {
191 if (report_fail) {
mavlink_log_critical(mavlink_log_pub,
"RC ERROR: RC%d_TRIM < MIN (%d/%d).", i + 1, (
int)param_trim, (
int)param_min); }
197 if (param_trim > param_max) {
200 if (report_fail) {
mavlink_log_critical(mavlink_log_pub,
"RC ERROR: RC%d_TRIM > MAX (%d/%d).", i + 1, (
int)param_trim, (
int)param_max); }
215 total_fail_count += count;
222 if (channels_failed) {
228 (total_fail_count > 1) ?
"s" :
"", channels_failed, (channels_failed > 1) ?
"s" :
"");
234 return total_fail_count + map_fail_count;
#define PARAM_INVALID
Handle returned when a parameter cannot be found.
#define RC_INPUT_MAX_DEADZONE_US
Maximum deadzone value.
static orb_advert_t * mavlink_log_pub
#define mavlink_log_critical(_pub, _text,...)
Send a mavlink critical message and print to console.
__EXPORT int param_get(param_t param, void *val)
Copy the value of a parameter.
Global flash based parameter store.
static int rcCalibrationCheck(orb_advert_t *mavlink_log_pub, bool report_fail, bool isVTOL)
__BEGIN_DECLS typedef void * orb_advert_t
ORB topic advertiser handle.
__EXPORT param_t param_find(const char *name)
Look up a parameter by name.
#define RC_INPUT_HIGHEST_MAX_US
Maximum value.
#define RC_INPUT_LOWEST_MIN_US
Minimum value.
uint32_t param_t
Parameter handle.