From a7a792e1c7c622d344545f0214c61427f7d3ebbf Mon Sep 17 00:00:00 2001 From: bugobliterator Date: Thu, 9 Nov 2023 18:40:54 +1100 Subject: [PATCH] AP_Periph: fix sending moving basline size greater than 300 bytes --- AP_Periph/sensor_gps.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/AP_Periph/sensor_gps.cpp b/AP_Periph/sensor_gps.cpp index 598d83c..7949ff6 100644 --- a/AP_Periph/sensor_gps.cpp +++ b/AP_Periph/sensor_gps.cpp @@ -172,11 +172,14 @@ void AP_Periph_DroneCAN::send_moving_baseline_msg() // send the packet from Moving Base to be used RelPosHeading calc by GPS module ardupilot_gnss_MovingBaselineData mbldata {}; // get the data from the moving base - static_assert(sizeof(ardupilot_gnss_MovingBaselineData::data.data) == RTCM3_MAX_PACKET_LEN, "Size of Moving Base data is wrong"); - mbldata.data.len = len; - memcpy(mbldata.data.data, data, len); - - moving_baseline_pub.broadcast(mbldata); + // static_assert(sizeof(ardupilot_gnss_MovingBaselineData::data.data) == RTCM3_MAX_PACKET_LEN, "Size of Moving Base data is wrong"); + while (len != 0) { + mbldata.data.len = MIN(len, sizeof(mbldata.data.data)); + memcpy(mbldata.data.data, data, mbldata.data.len); + moving_baseline_pub.broadcast(mbldata); + len -= mbldata.data.len; + data += mbldata.data.len; + } gps.clear_RTCMV3(); #endif // HAL_PERIPH_ENABLE_GPS && GPS_MOVING_BASELINE }