From 6c127426bdeb0bf16e298a1e3e537d9372fb8455 Mon Sep 17 00:00:00 2001 From: "Git bot (blckmn)" Date: Wed, 21 May 2025 06:25:03 +0000 Subject: [PATCH 1/4] Auto updated submodule references [21-05-2025] --- src/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config b/src/config index 7db4179ef7..17892ac1bd 160000 --- a/src/config +++ b/src/config @@ -1 +1 @@ -Subproject commit 7db4179ef7159138deebf5f671373e7a46a8a162 +Subproject commit 17892ac1bd9bc74f77870c14a2da386a1c614dd3 From 51c8296f25bea598d88f3bf3e0f22fa72ad13cc2 Mon Sep 17 00:00:00 2001 From: Eric Katzfey <53063038+katzfey@users.noreply.github.com> Date: Wed, 21 May 2025 04:48:36 -0700 Subject: [PATCH 2/4] Added float specifier to literal to prevent compile error (#14396) --- src/main/flight/imu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/flight/imu.c b/src/main/flight/imu.c index 2b77a36871..ec797ac6bd 100644 --- a/src/main/flight/imu.c +++ b/src/main/flight/imu.c @@ -625,7 +625,7 @@ static void updateGpsHeadingUsable(float groundspeedGain, float imuCourseError, gpsHeadingConfidence += fmaxf(groundspeedGain - fabsf(imuCourseError), 0.0f) * dt; // recenter at 2.5s time constant // TODO: intent is to match IMU time constant, approximately, but I don't exactly know how to do that - gpsHeadingConfidence -= 0.4 * dt * gpsHeadingConfidence; + gpsHeadingConfidence -= 0.4f * dt * gpsHeadingConfidence; // if we accumulate enough 'points' over time, the IMU probably is OK // will need to reaccumulate after a disarm (will be retained partly for very brief disarms) canUseGPSHeading = gpsHeadingConfidence > 2.0f; From b03b57bd90805d3486bb7168c4c82ee8eeba9e18 Mon Sep 17 00:00:00 2001 From: Eric Katzfey <53063038+katzfey@users.noreply.github.com> Date: Wed, 21 May 2025 06:53:43 -0700 Subject: [PATCH 3/4] Added missing GCC diagnostic push pragma (#14397) Replaced faulty #pragma GCC diagnostic ignored "-Wunused-function" with the more elegant MAYBE_UNUSED macro --- src/main/msp/msp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/msp/msp.c b/src/main/msp/msp.c index 3f6aeca7b2..de6d7d2492 100644 --- a/src/main/msp/msp.c +++ b/src/main/msp/msp.c @@ -343,16 +343,13 @@ static void mspFcSetPassthroughCommand(sbuf_t *dst, sbuf_t *src, mspPostProcessF } } -// TODO: Remove the pragma once this is called from unconditional code -#pragma GCC diagnostic ignored "-Wunused-function" -static void configRebootUpdateCheckU8(uint8_t *parm, uint8_t value) +MAYBE_UNUSED static void configRebootUpdateCheckU8(uint8_t *parm, uint8_t value) { if (*parm != value) { setRebootRequired(); } *parm = value; } -#pragma GCC diagnostic pop static void mspRebootFn(serialPort_t *serialPort) { From aa8701ef87d768b41ddcc50e473792bceba67fce Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Thu, 22 May 2025 00:12:24 +0200 Subject: [PATCH 4/4] Fix inevitable timer overflow (#14374) * Fix beacon timer overflow * fix possible overflow in rc_stats * fix possible overflow in mixer.c * fix possible overflow in osd.c * Update src/main/osd/osd_warnings.c Co-authored-by: Petr Ledvina * Update src/main/osd/osd_warnings.c Co-authored-by: Petr Ledvina * Update src/main/rx/rc_stats.c Co-authored-by: Petr Ledvina * fix typo * Update src/main/osd/osd.c Co-authored-by: Petr Ledvina --------- Co-authored-by: Petr Ledvina --- src/main/flight/mixer.c | 2 +- src/main/osd/osd.c | 2 +- src/main/osd/osd_warnings.c | 10 ++++------ src/main/rx/rc_stats.c | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/flight/mixer.c b/src/main/flight/mixer.c index 97dabc3bc8..a2d5bc8b98 100644 --- a/src/main/flight/mixer.c +++ b/src/main/flight/mixer.c @@ -219,7 +219,7 @@ static void calculateThrottleAndCurrentMotorEndpoints(timeUs_t currentTimeUs) throttle = 0; currentThrottleInputRange = rcCommandThrottleRange3dHigh; } - if (currentTimeUs - reversalTimeUs < 250000) { + if (cmpTimeUs(currentTimeUs, reversalTimeUs) < 250000) { // keep iterm zero for 250ms after motor reversal pidResetIterm(); } diff --git a/src/main/osd/osd.c b/src/main/osd/osd.c index 0b2cbaef24..6825191585 100644 --- a/src/main/osd/osd.c +++ b/src/main/osd/osd.c @@ -1243,7 +1243,7 @@ STATIC_UNIT_TESTED bool osdProcessStats1(timeUs_t currentTimeUs) if (ARMING_FLAG(ARMED)) { osdUpdateStats(); - timeUs_t deltaT = currentTimeUs - lastTimeUs; + int deltaT = cmpTimeUs(currentTimeUs, lastTimeUs); osdFlyTime += deltaT; stats.armed_time += deltaT; #ifdef USE_LAUNCH_CONTROL diff --git a/src/main/osd/osd_warnings.c b/src/main/osd/osd_warnings.c index 4fac86d0f2..7390d94a02 100644 --- a/src/main/osd/osd_warnings.c +++ b/src/main/osd/osd_warnings.c @@ -115,12 +115,10 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr) #ifdef USE_DSHOT if (isTryingToArm() && !ARMING_FLAG(ARMED)) { - int armingDelayTime = (getLastDshotBeaconCommandTimeUs() + DSHOT_BEACON_GUARD_DELAY_US - currentTimeUs) / 1e5; - if (armingDelayTime < 0) { - armingDelayTime = 0; - } - if (armingDelayTime >= (DSHOT_BEACON_GUARD_DELAY_US / 1e5 - 5)) { - tfp_sprintf(warningText, " BEACON ON"); // Display this message for the first 0.5 seconds + const int beaconGuard = cmpTimeUs(currentTimeUs, getLastDshotBeaconCommandTimeUs()); + const int armingDelayTime = MAX(DSHOT_BEACON_GUARD_DELAY_US - beaconGuard, 0) / 100000; // time remaining until BEACON_GUARD_DELAY, in tenths of second + if (beaconGuard < 500 * 1000) { // first 0.5s since beacon + tfp_sprintf(warningText, " BEACON ON"); } else { tfp_sprintf(warningText, "ARM IN %d.%d", armingDelayTime / 10, armingDelayTime % 10); } diff --git a/src/main/rx/rc_stats.c b/src/main/rx/rc_stats.c index bf0ecf415f..13b943da69 100644 --- a/src/main/rx/rc_stats.c +++ b/src/main/rx/rc_stats.c @@ -44,7 +44,7 @@ int8_t previousThrottlePercent = 0; void rcStatsUpdate(timeUs_t currentTimeUs) { - uint32_t deltaT = currentTimeUs - previousTimeUs; + uint32_t deltaT = cmpTimeUs(currentTimeUs, previousTimeUs); previousTimeUs = currentTimeUs; const int8_t throttlePercent = calculateThrottlePercent();