-
Notifications
You must be signed in to change notification settings - Fork 16.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AP_Button: range check PWM input #20070
Changes from all commits
b042e67
1d92e8f
661ff77
6ca1829
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,6 @@ | |
*/ | ||
|
||
// motor test definitions | ||
#define MOTOR_TEST_PWM_MIN 800 // min pwm value accepted by the test | ||
#define MOTOR_TEST_PWM_MAX 2200 // max pwm value accepted by the test | ||
#define MOTOR_TEST_TIMEOUT_MS_MAX 30000 // max timeout is 30 seconds | ||
|
||
// motor_test_output - checks for timeout and sends updates to motors objects | ||
|
@@ -68,7 +66,7 @@ void QuadPlane::motor_test_output() | |
} | ||
|
||
// sanity check throttle values | ||
if (pwm >= MOTOR_TEST_PWM_MIN && pwm <= MOTOR_TEST_PWM_MAX ) { | ||
if (pwm >= RC_Channel::RC_MIN_LIMIT_PWM && pwm <= RC_Channel::RC_MAX_LIMIT_PWM) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd just like to point out here that we are arguably mixing up pwm inputs with output... |
||
// turn on motor to specified pwm vlaue | ||
motors->output_test_seq(motor_test.seq, pwm); | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -274,7 +274,7 @@ class RC_Channel { | |
const char *string_for_aux_function(AUX_FUNC function) const; | ||
#endif | ||
// pwm value under which we consider that Radio value is invalid | ||
static const uint16_t RC_MIN_LIMIT_PWM = 900; | ||
static const uint16_t RC_MIN_LIMIT_PWM = 800; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks OK but I can't resist saying that this constant's name should really be, "RC_PWM_LIMIT_MIN". Wouldn't that be better? Anyway, no need to change it I just want to pass on my naming wisdom. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, removing the LIMIT part would also be a fine change.. but not today I'm sure.. |
||
// pwm value above which we consider that Radio value is invalid | ||
static const uint16_t RC_MAX_LIMIT_PWM = 2200; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting that this time out is different vs copters timeout.