fix(net): guard ensureOwnedPanadapter cap path with AdaptiveThrottleEnabled check#3201
Conversation
|
@AetherClaude critical thoughts on this change? |
|
Critical thoughts on the proposed fix: The bug is real. Confirmed at My main concern: the proposed shape multiplies the guard rather than eliminating it. After the fix, Cleaner alternative — gate at the source: int RadioModel::currentAdaptiveFpsCap() const
{
if (AppSettings::instance().value("AdaptiveThrottleEnabled", "False").toString() != "True")
return 0;
return fpsCapForState(m_netState);
}Then One thing the proposed fix gets right that the alternative doesn't: the Smaller nits regardless of which shape lands:
If you want the single-point version, a maintainer can authorize the orchestrator to land it by adding the 73, Jeremy KK7GWY & Claude (AI dev partner) 🤖 aethersdr-agent · cost: $1.5819 · model: claude-opus-4-7 |
…Cap() When a panadapter was opened mid-session while the network was already in a degraded state, ensureOwnedPanadapter() applied the active fps cap directly via sendAdaptiveCapToPan() without consulting AdaptiveThrottleEnabled. The toggle was bypassed entirely for newly-registered pans, including the deferred waterfallIdChanged re-apply. Fix: gate at the source by returning 0 from currentAdaptiveFpsCap() when AdaptiveThrottleEnabled is off. ensureOwnedPanadapter() already gates on activeCap > 0, so it gets correct behaviour for free with no inline checks. applyAdaptiveFrameRate() keeps its own early-return as a short-circuit (it calls fpsCapForState directly, not currentAdaptiveFpsCap). Also address two nits in ensureOwnedPanadapter: - Add Qt::UniqueConnection to the waterfallIdChanged lambda to prevent duplicate cap commands if waterfallId changes more than once on a pan. - Add a comment noting the ordering edge case: if a pan is created healthy, the network degrades, and waterfallId arrives before the next tier transition, no re-apply is made. applyAdaptiveFrameRate() catches it on the next transition. Noted, not fixed, as it is a narrow ordering window with a bounded recovery time.
2c44492 to
7096cd5
Compare
|
@AetherClaude fixes pushed to address your concern. Anything I am missing now? |
|
Re-reviewed against
All three
Nits both addressed:
Toggle-OFF-while-degraded behavior is unchanged and is consistent with the existing tooltip in Bonus property of this shape: because the lambda re-reads Nothing missing from my side — LGTM. 73, Jeremy KK7GWY & Claude (AI dev partner) 🤖 aethersdr-agent · cost: $1.5874 · model: claude-opus-4-7 |
There was a problem hiding this comment.
Thanks @chibondking — clean follow-up to #3175.
Confirmed against the diff:
currentAdaptiveFpsCap()returning 0 when the toggle is off correctly propagates through bothactiveCap > 0(line 3423) and the lambda'scap > 0(line 3432), so the twosendAdaptiveCapToPan()call sites inensureOwnedPanadapter()are gated without per-site checks.applyAdaptiveFrameRate()still callsfpsCapForState()directly and keeps its own AppSettings early-return at line 2806 — that's preserved as you noted.- AppSettings key spelling and
"True"/"False"string comparison match the existing pattern at line 2806 and inConnectionPanel.cpp:565/575. No QSettings drift. Qt::UniqueConnectionon thewaterfallIdChangedlambda is the right call —PanadapterModelcould in principle re-emit on a stream re-bind.- The comment about the "pan created healthy → network degrades before
waterfallIdarrives" ordering edge case is a useful breadcrumb; agreed it's better noted than chased here, since the next tier transition catches it.
LGTM.
🤖 aethersdr-agent · cost: $6.4489 · model: claude-opus-4-7
Summary
Closes a gap in the adaptive frame-rate throttle toggle introduced in #3175.
When a panadapter was opened mid-session while the network was already in a degraded state,
ensureOwnedPanadapter()applied the active fps cap directly viasendAdaptiveCapToPan()without consultingAdaptiveThrottleEnabled. The toggle was bypassed for newly-registered pans, including the deferredwaterfallIdChangedre-apply lambda.Approach: gate at the source
Rather than adding inline checks at each call site (which multiplies the guard and creates a latent risk for future callers), the fix moves the enable check into
currentAdaptiveFpsCap():ensureOwnedPanadapter()already gates onactiveCap > 0— it gets correct behaviour for free with no other changes.applyAdaptiveFrameRate()keeps its own early-return as a short-circuit (it callsfpsCapForStatedirectly, notcurrentAdaptiveFpsCap).All
sendAdaptiveCapToPancall sites now coveredapplyAdaptiveFrameRate()fpsCapForStatedirectly)ensureOwnedPanadapter()immediate capactiveCap > 0—currentAdaptiveFpsCap()returns 0 when offensureOwnedPanadapter()waterfallIdChangedlambdacap > 0check callscurrentAdaptiveFpsCap()Additional nits addressed
Qt::UniqueConnectionadded to thewaterfallIdChangedlambda to prevent duplicate cap commands ifwaterfallIdchanges more than once on a panwaterfallIdarrives before next tier transition.applyAdaptiveFrameRate()catches it on the next transition; noted, not fixed.🤖 Generated with Claude Code