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 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; 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/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) { 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();