diff --git a/src/drivers/tap_esc/drv_tap_esc.h b/src/drivers/tap_esc/drv_tap_esc.h index a84cdee4ac..abf210751b 100644 --- a/src/drivers/tap_esc/drv_tap_esc.h +++ b/src/drivers/tap_esc/drv_tap_esc.h @@ -78,6 +78,7 @@ #define RPMMAX 1900 #define RPMMIN 1200 +#define RPMSTOPPED (RPMMIN - 10) #define MAX_BOOT_TIME_MS (500) // Minimum time to wait after Power on before sending commands diff --git a/src/drivers/tap_esc/tap_esc.cpp b/src/drivers/tap_esc/tap_esc.cpp index 1536ed2b99..80c6f5c1f1 100644 --- a/src/drivers/tap_esc/tap_esc.cpp +++ b/src/drivers/tap_esc/tap_esc.cpp @@ -417,8 +417,8 @@ void TAP_ESC:: send_esc_outputs(const float *pwm, const unsigned num_pwm) if (rpm[i] > RPMMAX) { rpm[i] = RPMMAX; - } else if (rpm[i] < RPMMIN) { - rpm[i] = RPMMIN; + } else if (rpm[i] < RPMSTOPPED) { + rpm[i] = RPMSTOPPED; } } @@ -678,7 +678,7 @@ TAP_ESC::cycle() * This will be clearly visible on the servo status and will limit the risk of accidentally * spinning motors. It would be deadly in flight. */ - _outputs.output[i] = 900; + _outputs.output[i] = RPMSTOPPED; } } @@ -694,7 +694,7 @@ TAP_ESC::cycle() if (test_motor_updated) { struct test_motor_s test_motor; orb_copy(ORB_ID(test_motor), _test_motor_sub, &test_motor); - _outputs.output[test_motor.motor_number] = 900.f + (1100.f * test_motor.value); //scale to [900, 2000] + _outputs.output[test_motor.motor_number] = RPMSTOPPED + ((RPMMAX - RPMSTOPPED) * test_motor.value); PX4_INFO("setting motor %i to %.1lf", test_motor.motor_number, (double)_outputs.output[test_motor.motor_number]); } @@ -702,7 +702,7 @@ TAP_ESC::cycle() /* set the invalid values to the minimum */ for (unsigned i = 0; i < num_outputs; i++) { if (!PX4_ISFINITE(_outputs.output[i])) { - _outputs.output[i] = 900; + _outputs.output[i] = RPMSTOPPED; } }