NAN handling
This commit is contained in:
parent
0e3b5ad7fa
commit
e6d44fb85f
|
@ -180,6 +180,10 @@ static msg_t etbThread(void *arg) {
|
|||
*/
|
||||
static void setThrottleDutyCycle(float level) {
|
||||
scheduleMsg(&logger, "setting ETB duty=%f%%", level);
|
||||
if (cisnan(level)) {
|
||||
valueOverride = NAN;
|
||||
return;
|
||||
}
|
||||
|
||||
float dc = PERCENT_TO_DUTY(level);
|
||||
valueOverride = dc;
|
||||
|
@ -314,7 +318,7 @@ void initElectronicThrottle(void) {
|
|||
startETBPins();
|
||||
|
||||
//
|
||||
addConsoleActionF("set_etb", setThrottleDutyCycle);
|
||||
addConsoleActionNANF("set_etb", setThrottleDutyCycle);
|
||||
|
||||
|
||||
tuneWorkingPidSettings.pFactor = 1;
|
||||
|
|
|
@ -52,6 +52,10 @@ void PwmConfig::init(float *st, single_wave_s *waves) {
|
|||
* @param dutyCycle value between 0 and 1
|
||||
*/
|
||||
void SimplePwm::setSimplePwmDutyCycle(float dutyCycle) {
|
||||
if (cisnan(dutyCycle)) {
|
||||
warning(CUSTOM_ERR_6691, "spwd:dutyCycle %.2f", dutyCycle);
|
||||
return;
|
||||
}
|
||||
if (dutyCycle < 0 || dutyCycle > 1) {
|
||||
warning(CUSTOM_ERR_6579, "spwd:dutyCycle %.2f", dutyCycle);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue