FUTABA/TFHSS: fix failsafe

This commit is contained in:
pascallanger committed 2026-11-25 07:48:14 +01:00
1 parent 8120789e0c
commit c605e49334
4 files changed
+14 -13

No files matched your search

+8 -7
View File
@@ -39,7 +39,7 @@
// telemetry); then TFHSS_BIND_ACKED more with byte 1 bit 7 and its ID,
// which make the receiver store the bind (R334SBS firmware). Failsafe: every 5 s a group of 4 frames, one
// per channel: its F/S position, or hold (the 4PM Plus' default).
// In SR, the per channel "high speed"="narrow-band" flags in byte 9 (3 ms output frames) are driven by CH9..CH12
// In SR, the per channel "high speed"="narrow-band" flags in byte 9 (3 ms output frames) are driven by CH5..CH8
//
// Air (TFHSS_AIR): 128 kbps 2-FSK (the S-FHSS modem), 17 bytes, a frame
// every 15.04 ms; 16 channels in 9 slots of 11 bits (us - 880), a slot's
@@ -338,14 +338,13 @@ static void __attribute__((unused)) TFHSS_surface_packet()
#ifdef FAILSAFE_ENABLE
uint16_t v = Failsafe_data[c];
if(IS_FAILSAFE_VALUES_on && v != FAILSAFE_CHANNEL_HOLD && v != FAILSAFE_CHANNEL_NOPULSES)
{
+ { // F/S: code 4 without the hold flag (4PM Plus)
f |= 0x04;
fs = 0x00;
ch[c] = TFHSS_value(c, true);
}
#endif
}
uint8_t slot = TFHSS_frame & 3;
uint16_t e = TFHSS_value(4 + slot, false);
packet[0] = (sr ? 1 : 0) | (TFHSS_row & 7) << 5;
packet[1] = TFHSS_row >> 3 | (sr ? 0 : 0x10) | (f & 3) << 6;
packet[2] = (f >> 2) | (ch[0] & 0x0F) << 4;
@@ -355,10 +354,12 @@ static void __attribute__((unused)) TFHSS_surface_packet()
packet[6] = ch[2] >> 4;
packet[7] = ch[3];
packet[8] = (ch[3] >> 8) | 0x10;
// Bits 0..3: high speed flags of CH1..4
// In SR, the narrow-band outputs ("SR channels" of Futaba radios) are set by CH9..CH12
uint8_t nb = sr ? (Channel_AUX >> 4) & 0x0F : 0;
// packet[9] bits 0..3: high speed flags of CH1..4 . In SR, the narrow-band outputs ("SR channels" of Futaba radios) are set by CH5..CH8
uint8_t nb = sr ? Channel_AUX & 0x0F : 0;
packet[9] = fs | nb;
// One extra channel CH5..CH8 per frame but none in SR mode (4PM Plus)
uint8_t slot = sr ? 0 : TFHSS_frame & 3;
uint16_t e = sr ? 0 : TFHSS_value(4 + slot, false);
packet[10] = e;
packet[11] = (e >> 8) | slot << 4;
TFHSS_build(TFHSS_LEN, true);