Skip to content

feat(UI): Show antenna RSSI/SNR as 'XX YY' instead of single value for multiple antennas setups - #9

Open
koriaf wants to merge 1 commit into
wkumik:mainfrom
koriaf:fix-3
Open

feat(UI): Show antenna RSSI/SNR as 'XX YY' instead of single value for multiple antennas setups#9
koriaf wants to merge 1 commit into
wkumik:mainfrom
koriaf:fix-3

Conversation

@koriaf

@koriaf koriaf commented Aug 4, 2026

Copy link
Copy Markdown

this feature must be enabled by creating a file as shown in the code, default behavior - no changes

image
doc_2026-08-04_08-27-40.mp4

@PetruSoroaga FYI

@wkumik

wkumik commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Thanks for this — per-antenna visibility is genuinely useful on multi-antenna ground setups, and gating it behind showantennavalues keeps it zero-risk for everyone else. Two things I'd like resolved before this goes in, one of them a cross-version compatibility break.

1. The struct you extended is transmitted over the radio, not just shared memory

shared_mem_radio_stats_radio_interface_rx_signal_all (shared_mem_radio.h:54) is embedded as signalInfo in both shared_mem_radio_stats_radio_interface (:70) and shared_mem_radio_stats_radio_interface_compact (:115). The vehicle sends both to the ground station (r_vehicle/periodic_loop.cpp:449/469/493), and the GS validates them by exact size:

// r_central/process_router_messages.cpp:1398
if ( pPH->total_length == (sizeof(t_packet_header) + 2*sizeof(u8) + sizeof(shared_mem_radio_stats_radio_interface)) )

Two int[MAX_RADIO_ANTENNAS] adds 32 bytes, so a GS built with this patch talking to a vehicle without it (or vice versa) fails that comparison and silently drops every vehicle Rx stats packet — the vehicle radio stats OSD pages just go empty. Anyone running a mixed pair while updating one side at a time hits it.

Since the OSD only reads g_SM_RadioStats.radio_interfaces[i] — the ground station's own cards — these values never need to cross the link. Moving them to a new top-level field in shared_mem_radio_stats (which is shm-only and never transmitted), e.g. int iAntennaDBM[MAX_RADIO_INTERFACES][MAX_RADIO_ANTENNAS], gives you the same feature with the wire format untouched.

2. SNR is computed without checking the noise value is valid

In osd_links.cpp:

aAntennaSNR[iAntennaValidCount] = iAntDBM - g_SM_RadioStats.radio_interfaces[i].signalInfo.iAntennaDBMNoise[k];

Only the dBm side is range-checked. radiolink.c:1104 guards the noise side before doing the same subtraction:

if ( iAntennaDBMNoise[i] < 500 )
   int iSNR = iAntennaDBM[i] - iAntennaDBMNoise[i];

That guard matters on Realtek 8812 cards: the driver never reports the radiotap antenna-noise field, so iAntennaDBMNoise stays at the 1000 sentinel (this is why the normal OSD shows SNR: --- on those cards). The subtraction then yields -65 - 1000 = -1065, and _osd_format_antenna_values() runs it through abs(), so the OSD displays 1065 1070 instead of SNR: ---. Same < 500 check here, falling back to the existing single-value path when noise is unavailable, should cover it.

Minor

  • Per-antenna values are never aged out — once an antenna has reported, its last dBm persists indefinitely in runtimeInterfaceInfoRx, so a dead or unplugged antenna keeps displaying a stale reading. The aggregate path recomputes per packet, so this is new behaviour.
  • _osd_show_antenna_values_enabled() caches on first call, so creating or removing the marker file needs a ruby_central restart. Worth a line in the PR description.
  • In SNR mode the multi-antenna string drops the SNR: prefix, so 65 70 renders identically to the dBm case.

Everything else checks out — buffers are comfortably sized (szLine1/2 are 64 bytes against a ~20 char worst case), the default arguments are fine since _osd_show_radio_bars_info is file-local with no header declaration, and the aAntenna* arrays are never read when iAntennaValidCount <= 1.

Happy to push the two fixes myself if you'd rather not — just say the word.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants