1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 03:20:00 +03:00

Merge branch 'master' into RP2350

This commit is contained in:
blckmn 2025-05-23 19:57:31 +10:00
commit 9cc48c36d9
7 changed files with 10 additions and 15 deletions

@ -1 +1 @@
Subproject commit 7db4179ef7159138deebf5f671373e7a46a8a162 Subproject commit 17892ac1bd9bc74f77870c14a2da386a1c614dd3

View file

@ -625,7 +625,7 @@ static void updateGpsHeadingUsable(float groundspeedGain, float imuCourseError,
gpsHeadingConfidence += fmaxf(groundspeedGain - fabsf(imuCourseError), 0.0f) * dt; gpsHeadingConfidence += fmaxf(groundspeedGain - fabsf(imuCourseError), 0.0f) * dt;
// recenter at 2.5s time constant // 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 // 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 // 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) // will need to reaccumulate after a disarm (will be retained partly for very brief disarms)
canUseGPSHeading = gpsHeadingConfidence > 2.0f; canUseGPSHeading = gpsHeadingConfidence > 2.0f;

View file

@ -219,7 +219,7 @@ static void calculateThrottleAndCurrentMotorEndpoints(timeUs_t currentTimeUs)
throttle = 0; throttle = 0;
currentThrottleInputRange = rcCommandThrottleRange3dHigh; currentThrottleInputRange = rcCommandThrottleRange3dHigh;
} }
if (currentTimeUs - reversalTimeUs < 250000) { if (cmpTimeUs(currentTimeUs, reversalTimeUs) < 250000) {
// keep iterm zero for 250ms after motor reversal // keep iterm zero for 250ms after motor reversal
pidResetIterm(); pidResetIterm();
} }

View file

@ -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 MAYBE_UNUSED static void configRebootUpdateCheckU8(uint8_t *parm, uint8_t value)
#pragma GCC diagnostic ignored "-Wunused-function"
static void configRebootUpdateCheckU8(uint8_t *parm, uint8_t value)
{ {
if (*parm != value) { if (*parm != value) {
setRebootRequired(); setRebootRequired();
} }
*parm = value; *parm = value;
} }
#pragma GCC diagnostic pop
static void mspRebootFn(serialPort_t *serialPort) static void mspRebootFn(serialPort_t *serialPort)
{ {

View file

@ -1243,7 +1243,7 @@ STATIC_UNIT_TESTED bool osdProcessStats1(timeUs_t currentTimeUs)
if (ARMING_FLAG(ARMED)) { if (ARMING_FLAG(ARMED)) {
osdUpdateStats(); osdUpdateStats();
timeUs_t deltaT = currentTimeUs - lastTimeUs; int deltaT = cmpTimeUs(currentTimeUs, lastTimeUs);
osdFlyTime += deltaT; osdFlyTime += deltaT;
stats.armed_time += deltaT; stats.armed_time += deltaT;
#ifdef USE_LAUNCH_CONTROL #ifdef USE_LAUNCH_CONTROL

View file

@ -115,12 +115,10 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr)
#ifdef USE_DSHOT #ifdef USE_DSHOT
if (isTryingToArm() && !ARMING_FLAG(ARMED)) { if (isTryingToArm() && !ARMING_FLAG(ARMED)) {
int armingDelayTime = (getLastDshotBeaconCommandTimeUs() + DSHOT_BEACON_GUARD_DELAY_US - currentTimeUs) / 1e5; const int beaconGuard = cmpTimeUs(currentTimeUs, getLastDshotBeaconCommandTimeUs());
if (armingDelayTime < 0) { const int armingDelayTime = MAX(DSHOT_BEACON_GUARD_DELAY_US - beaconGuard, 0) / 100000; // time remaining until BEACON_GUARD_DELAY, in tenths of second
armingDelayTime = 0; if (beaconGuard < 500 * 1000) { // first 0.5s since beacon
} tfp_sprintf(warningText, " BEACON ON");
if (armingDelayTime >= (DSHOT_BEACON_GUARD_DELAY_US / 1e5 - 5)) {
tfp_sprintf(warningText, " BEACON ON"); // Display this message for the first 0.5 seconds
} else { } else {
tfp_sprintf(warningText, "ARM IN %d.%d", armingDelayTime / 10, armingDelayTime % 10); tfp_sprintf(warningText, "ARM IN %d.%d", armingDelayTime / 10, armingDelayTime % 10);
} }

View file

@ -44,7 +44,7 @@ int8_t previousThrottlePercent = 0;
void rcStatsUpdate(timeUs_t currentTimeUs) void rcStatsUpdate(timeUs_t currentTimeUs)
{ {
uint32_t deltaT = currentTimeUs - previousTimeUs; uint32_t deltaT = cmpTimeUs(currentTimeUs, previousTimeUs);
previousTimeUs = currentTimeUs; previousTimeUs = currentTimeUs;
const int8_t throttlePercent = calculateThrottlePercent(); const int8_t throttlePercent = calculateThrottlePercent();