From 59c5bbc8b8e9a2b3e18d51898769676babbd0692 Mon Sep 17 00:00:00 2001 From: yaapu Date: Thu, 15 Oct 2020 10:22:30 +0200 Subject: [PATCH] AP_BLHeli: added missing ack to MSP_SET_MOTOR message --- libraries/AP_BLHeli/AP_BLHeli.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/libraries/AP_BLHeli/AP_BLHeli.cpp b/libraries/AP_BLHeli/AP_BLHeli.cpp index 26a7e06cf5..262dcb10a7 100644 --- a/libraries/AP_BLHeli/AP_BLHeli.cpp +++ b/libraries/AP_BLHeli/AP_BLHeli.cpp @@ -254,6 +254,15 @@ bool AP_BLHeli::blheli_4way_process_byte(uint8_t c) return true; } + +/* + send a MSP protocol ack + */ +void AP_BLHeli::msp_send_ack(uint8_t cmd) +{ + msp_send_reply(cmd, 0, 0); +} + /* send a MSP protocol reply */ @@ -265,7 +274,10 @@ void AP_BLHeli::msp_send_reply(uint8_t cmd, const uint8_t *buf, uint8_t len) *b++ = '>'; *b++ = len; *b++ = cmd; - memcpy(b, buf, len); + // acks do not have a payload + if (len > 0) { + memcpy(b, buf, len); + } b += len; uint8_t c = 0; for (uint8_t i=0; i