S.Port: no broken packets when the radio pushes too fast, no stalls after a full buffer (#1224)

* S.Port: drop a radio packet when the downlink buffer is full

SportQueue() wrote the stuffed packet without checking for room: a radio
pushing faster than the RF link drains (8 bytes per frame) wrapped the
64-byte SportData ring over the bytes not sent yet, and the receivers got
broken S.Port frames. Now the whole new packet is dropped when it doesn't
fit (stuffed length 9 + 1 per 7D/7E byte). The buffer low flag is set as
before, and also on a drop.

* S.Port: report the downlink buffer state once, also when it has room

The buffer low flag was cleared silently, so the radio only learnt at
the next periodic status (up to 500 ms) and held its packets with the
buffer empty: 442 B/s instead of ~1150 B/s with the flag honoured (4-in-1
and MPM v2 benches). Send the status as soon as the flag clears. While
the flag is set, the status is no longer forced again on every packet:
only when the flag gets set, the periodic status repeats it.

---------

Co-authored-by: Raphael Coeffic <1050031+raphaelcoeffic@users.noreply.github.com>
This commit is contained in:
Raphael CoefficandRaphael Coeffic authored and GitHub committed 2026-12-04 17:20:35 +01:00
1 parent fd08975a03
commit 1056d13dad
2 files changed
+31 -34

No files matched your search

+3 -2
View File
@@ -449,9 +449,10 @@ void Frsky_init_clone(void)
used += MAX_SPORT_BUFFER - SportHead ;
else
used -= SportHead ;
if ( used < (MAX_SPORT_BUFFER>>1) )
{
if ( used < (MAX_SPORT_BUFFER>>1) && IS_DATA_BUFFER_LOW_on )
{// The status at once: the radio sends again
DATA_BUFFER_LOW_off;
SEND_MULTI_STATUS_on;
debugln("Ok buf:%d",used);
}
}