AP_BLHeli: use get_esc_scaling() for motor range

this fixes an issue with blhelisuite init when min is not 1000
This commit is contained in:
Andrew Tridgell 2018-04-02 17:48:04 +10:00
parent 503bd9ce65
commit 61d513e91b
1 changed files with 8 additions and 5 deletions

View File

@ -335,7 +335,7 @@ void AP_BLHeli::msp_process_command(void)
case MSP_STATUS: { case MSP_STATUS: {
debug("MSP_STATUS"); debug("MSP_STATUS");
uint8_t buf[21]; uint8_t buf[21];
putU16(&buf[0], 2500); // loop time usec putU16(&buf[0], 1000); // loop time usec
putU16(&buf[2], 0); // i2c error count putU16(&buf[2], 0); // i2c error count
putU16(&buf[4], 0x27); // available sensors putU16(&buf[4], 0x27); // available sensors
putU32(&buf[6], 0); // flight modes putU32(&buf[6], 0); // flight modes
@ -361,10 +361,13 @@ void AP_BLHeli::msp_process_command(void)
case MSP_MOTOR_CONFIG: { case MSP_MOTOR_CONFIG: {
debug("MSP_MOTOR_CONFIG"); debug("MSP_MOTOR_CONFIG");
uint16_t min_pwm = 1000;
uint16_t max_pwm = 2000;
hal.rcout->get_esc_scaling(min_pwm, max_pwm);
uint8_t buf[6]; uint8_t buf[6];
putU16(&buf[0], 1070); // min throttle putU16(&buf[0], min_pwm+30); // min throttle
putU16(&buf[2], 2000); // max throttle putU16(&buf[2], max_pwm); // max throttle
putU16(&buf[4], 1000); // min command putU16(&buf[4], min_pwm); // min command
msp_send_reply(msp.cmdMSP, buf, sizeof(buf)); msp_send_reply(msp.cmdMSP, buf, sizeof(buf));
break; break;
} }