Repository navigation
jaguar2/examples: survive a failed register read under co-channel load #511
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
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
edafdb9
busy window: a failed arm leaves nothing armed
snokvist 584aec8
usb: name the libusb error when rtw_read fails
snokvist 6175128
examples: telemetry pollers survive a failed register read
snokvist 6e50f1d
jaguar2: count and rate-limit thermal-track skips like DIG
snokvist 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* A demo telemetry thread's answer to a failed register read. | ||
| * | ||
| * A register read throws on a failed control transfer, and the pollers | ||
| * that call the device on their own cadence (busy window, thermal meter, RX | ||
| * energy) run on threads of their own or inside a demo's main loop, where an | ||
| * uncaught throw is std::terminate. Under co-channel load these reads do fail while the chip | ||
| * works on (src/jaguar2/CLAUDE.md has the measured rate), so a poller catches, | ||
| * counts and skips the sample - the same shape as the library's DIG loop - | ||
| * and the next tick reads afresh. The warning is rate-limited (failures 1, | ||
| * 101, 201, ...) and always carries the running count, so a | ||
| * long session neither floods stderr nor hides how often it happened. */ | ||
| #ifndef DEVOURER_POLL_SKIP_H | ||
| #define DEVOURER_POLL_SKIP_H | ||
|
|
||
| #include <cstdint> | ||
| #include <exception> | ||
|
|
||
| #include "logger.h" | ||
|
|
||
| namespace devourer { | ||
|
|
||
| class PollSkips { | ||
| public: | ||
| explicit PollSkips(const char *what) : _what(what) {} | ||
|
|
||
| void note(Logger &log, const std::exception &e) { | ||
| if (_n++ % 100 == 0) | ||
| log.warn("{}: sample skipped after a failed register access ({}), {} so " | ||
| "far", _what, e.what(), _n); | ||
| } | ||
|
|
||
| private: | ||
| const char *_what; | ||
| uint64_t _n = 0; | ||
| }; | ||
|
|
||
| } // namespace devourer | ||
|
|
||
| #endif /* DEVOURER_POLL_SKIP_H */ |
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
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
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.
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.