You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
• Replace APFPV WiFi RSSI polling with a multi-Realtek-driver /proc scanner using stable adapter
indices.
• Publish per-adapter RSSI and optional RF-path temperatures as os_mon.wifi.* facts (APFPV only).
• Fix tag-matching iterator bug and add %d placeholder support for templated text widgets.
Diagram
graph TD
A["main.cpp APFPV loop"] --> B["WiFiMonitor"] --> C[("/proc/net/rtl*/<iface>")]
B --> D["OSD fact bus"] --> E["OSD widgets (config_osd.json)"]
F["GS menu mode toggle"] --> G["wifi_monitor_reset()"] --> D
subgraph Legend
direction LR
_mod["Module/Component"] ~~~ _fs[("Procfs / kernel")]
end
Loading
High-Level Assessment
The following are alternative approaches to this PR:
1. Use nl80211/netlink for signal + temperature
➕ More driver-agnostic than Realtek procfs layout
➕ Avoids parsing driver-specific debug text files
➖ Higher implementation complexity and testing burden across kernels/cards
➖ Temperature often not available or exposed differently; still needs per-driver handling
2. Persist adapter identity by MAC/PCI/USB path instead of index
➕ Stable widget bindings even when adapters are added/removed
➖ Requires extra discovery logic and storage (and mapping differs by bus type)
➖ More edge cases (renames, hotplug) than simple sorted interface ordering
3. Delegate APFPV WiFi stats to wfb-ng/wfbcli even in APFPV
➕ Single source of truth for link stats across modes
➕ Avoids duplicating parsing/sampling policy
➖ Requires running/maintaining wfb-ng in APFPV mode, which this PR explicitly avoids
Recommendation: The procfs-scanning approach is appropriate for the stated goal (APFPV-only Realtek cards) and keeps runtime dependencies minimal. If adapter-index churn becomes a practical issue, consider a follow-up to expose a stable hardware-id tag (MAC or USB path) alongside adapter, without replacing the current adapter indexing.
Files changed (10) +561 / -12
Enhancement (3) +388 / -2
WiFiMonitor.cppImplement multi-driver WiFi monitor with RSSI + thermal sampling+300/-0
Implement multi-driver WiFi monitor with RSSI + thermal sampling
• Introduces WiFiMonitor that scans /proc/net/rtl*/<iface>/ directories, parses trx_info_debug for RSSI/link state, and optionally parses thermal_state for per-RF-path temperatures. Publishes facts in batches with interface+adapter tags and provides a reset publisher via wifi_monitor_reset().
WiFiMonitor.hppAdd WiFiMonitor interface and tagging/sampling policy docs+86/-0
Add WiFiMonitor interface and tagging/sampling policy docs
• Defines the WiFiMonitor class, data structures, and helper methods. Documents adapter indexing, tag layout, supported procfs locations, and slower thermal sampling interval.
osd.cppFix FactMatcher tag lookup and add %d template token support+7/-2
Fix FactMatcher tag lookup and add %d template token support
• Fixes a tag-matching bug where the iterator returned by fact_tags.find() was compared against the wrong container end(), preventing correct mismatches and risking invalid dereference. Extends template tokenization to recognize %d placeholders (aliasing %i handling).
README.mdDocument new os_mon.wifi.* facts and font limitations+19/-2
Document new os_mon.wifi.* facts and font limitations
• Updates fact table types (RSSI int) and adds documentation for os_mon.wifi.rssi / os_mon.wifi.temperature tagging semantics in APFPV mode. Also clarifies LVGL font coverage and correct degree sign usage.
config_osd.jsonAdd APFPV widgets for per-adapter RSSI and RF temperatures+141/-0
Add APFPV widgets for per-adapter RSSI and RF temperatures
• Adds a parallel set of IconSelectorWidget RSSI indicators fed by os_mon.wifi.rssi (adapter/type) for multiple adapters/antennas. Adds text widgets to display RF-path temperatures via os_mon.wifi.temperature (adapter/rf_path).
1. Stale WiFi facts persist✓ Resolved🐞 Bug☼ Reliability
Description
WiFiMonitor::run() returns when no rtl* interfaces are found, but does not clear previously
published os_mon.wifi.* facts, so widgets can keep rendering the last RSSI/temperature after
adapters are unplugged or driver proc entries disappear. This can mislead the operator because facts
are only updated/cleared when explicitly flushed, not automatically retracted when a publisher stops
emitting them.
+ spdlog::error("No Realtek WiFi driver found below {}, no wifi stats will be published", base_path_);+ warned_no_driver_ = true;+ }+ return;
Evidence
WiFiMonitor returns without publishing or flushing when no interfaces exist, while the OSD keeps
previously set widget facts until an explicit flush clears them; since wifi_monitor.run() is called
periodically, this can happen after adapters disappear at runtime.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
`WiFiMonitor::run()` returns early when `find_interfaces()` yields no interfaces. In that path, no new facts are published and no existing facts are cleared, leaving OSD widgets bound to `os_mon.wifi.*` with stale last-known values.
### Issue Context
The OSD fact processor only updates widgets when a matching fact is published (`Osd::setFact`) and clears facts only when `osd_flush_facts()` requests a prefix flush (`Osd::flushFacts`). If WiFiMonitor stops publishing, previously set widget facts remain defined.
### Fix (recommended)
- When interfaces become empty (or when the interface set changes), call `osd_flush_facts()` for prefix `"os_mon.wifi."` so removed adapters/interfaces drop to undefined and widgets hide.
- Optionally, track the last seen interface list and flush only when it changes to avoid unnecessary work.
### Fix Focus Areas
- src/WiFiMonitor.cpp[74-119]
- src/osd.cpp[2780-2810]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
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
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.
For APFPV mode this PR will: