-
-
Notifications
You must be signed in to change notification settings - Fork 118
feat(hl2): drive the HL2 IO Board over I2C2 for band-following amp control #5362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jensenpat
merged 4 commits into
aethersdr:main
from
randal007:feat/hl2-io-board-tx-frequency
Sep 6, 2026
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
419752c
feat(hl2): drive the HL2 IO Board over I2C2 for band-following amp co…
randal007 93e7307
fix(hl2): address review — IO board scheduling guards and TX interlock
randal007 b70823d
Fix HL2 IO-board scheduling and session cleanup. Principle XI.
jensenpat 1f400de
Merge remote-tracking branch 'origin/main' into HEAD
jensenpat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| #pragma once | ||
|
|
||
| // When an IO-board frequency push may go out, as a pure decision. | ||
| // | ||
| // WHY THIS IS A POLICY AND NOT AN `if` CHAIN IN THE BACKEND. The encoder that | ||
| // builds the five I2C banks is straightforward and was right first time; every | ||
| // defect in this feature has been in the SCHEDULING around it — a guard present | ||
| // on the trailing edge of a throttle and missing on the leading one, an armed | ||
| // timer surviving a disconnect, a band change coalesced as though it were | ||
| // ordinary frequency drift. Those are conditions, not arithmetic, and they are | ||
| // only testable if they live somewhere a test can reach without a radio. | ||
| // | ||
| // The thing being scheduled points an amplifier's band relay. That is the | ||
| // reason the ordering below is fixed and commented rather than left to whoever | ||
| // next edits the call site. | ||
|
|
||
| namespace AetherSDR::hl2 { | ||
|
|
||
| enum class IoBoardAction { | ||
| // Push now. The caller sends, records the band, and restarts the cooldown. | ||
| Send, | ||
| // Same-band movement inside the cooldown: remember it as pending and let | ||
| // the timer deliver the latest value when the window expires. | ||
| Coalesce, | ||
| // Transmitting. Do nothing at all, and do NOT stash the value: unkey runs | ||
| // the whole path again and recomputes from the TX receiver, which is | ||
| // fresher than anything held here. | ||
| DeferKeyed, | ||
| // Not connected. Do nothing AND discard any pending value. | ||
| DropDisconnected, | ||
| }; | ||
|
|
||
| // The decision, in the order the conditions must be tested. | ||
| // | ||
| // DISCONNECTED FIRST, because the consequence outlives the session: | ||
| // MetisClient::m_oneShot is cleared by neither start() nor stop(), and the | ||
| // IO-board frequency — unlike the filter byte — is not re-primed through | ||
| // Params. A bank queued while the link is down therefore becomes the FIRST | ||
| // thing the next connect transmits, pointing an amplifier at the band the | ||
| // previous session ended on. | ||
| // | ||
| // KEYED SECOND, because switching a band relay under RF burns its contacts. | ||
| // The operator normally cannot retune mid-transmission on this radio, but | ||
| // connect-time pushes and the automation bridge can both reach the scheduler | ||
| // while MOX is up, and the cost of being wrong is someone's hardware. | ||
| // | ||
| // BAND CHANGE BEATS THE THROTTLE, because the rate limit exists for VFO sweeps | ||
| // (~10 events/second against a board that asks for two) and a band crossing is | ||
| // not that case: applyBandFilter moves the physical filter relay immediately, | ||
| // so deferring the amplifier leaves the two disagreeing for up to the cooldown | ||
| // — and keying in that window is exactly the hazard. Rate-limit frequency | ||
| // tracking; never rate-limit which band the amplifier is on. | ||
| [[nodiscard]] constexpr IoBoardAction ioBoardAction(bool connected, | ||
| bool keyed, | ||
| bool throttleActive, | ||
| bool bandChanged) noexcept | ||
| { | ||
| if (!connected) | ||
| return IoBoardAction::DropDisconnected; | ||
| if (keyed) | ||
| return IoBoardAction::DeferKeyed; | ||
| if (throttleActive && !bandChanged) | ||
| return IoBoardAction::Coalesce; | ||
| return IoBoardAction::Send; | ||
| } | ||
|
|
||
| } // namespace AetherSDR::hl2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.