Commit Graph
6 Commits
Author SHA1 Message Date
Raphael Coeffic 54ad3d26fd SFHSS: failsafe values on the same scale as the channels (#1210)
The F/S words are 0x800 | a signed 10-bit offset from 1520 us in
1.25 us steps (bit 10 ignored), the same unit as the normal data, as
a T14SG sends them. 2571..3571 put the F/S positions at 1.25x the
live range, and past about +-102 % the offset wraps to the other end
of the travel. 2672..3472 matches the live 1020..2020 us.
2026-11-21 16:02:55 +01:00
Raphael Coeffic f41d954224 DSM: the missing ';' after debug("Clone ID=") (DEBUG_BIND builds) (#1204) 2026-11-21 16:02:10 +01:00
Raphael Coeffic 9baaede9f5 FrSky X: S.Port frames to the receiver stored at payload[i-start-2] (#1203)
FrSkyX_seq_sport() (SPORT_SEND) stored the outgoing bytes at
payload[i-start+2], i.e. payload[4] to payload[11] for the 8 bytes of
an LBT packet: up to 4 bytes past each frame's 8-byte payload (into the
next frame's count and payload, past the array for frame 3). The
retransmits sent payload[i] and payload[i-start+2], bytes from beyond
the frame. All three now use payload[i-start-2] (0 to 7).
2026-11-21 16:01:35 +01:00
Raphael Coeffic 3369b9e0a6 DSM: compute the DSMR hop table, drop the 22 IDs (-0.6 KB) (#1200)
* DSM: compute the DSMR hop table (-0.5 KB)

The DSMR hops come from the DSMX generator (inverted ID, same LCG, parity
of id[3], at most 8/7/8 channels per band), drawing over 0x4A channels
instead of 0x49 and shifting every channel up by 1: channels 4..77, bands
4-28/29-52/53-77, and the parity opposite to DSMX. This gives back the 23
channels of the 22 DSMR_ID_FREQ rows, in the same order, each row starting
at another hop (6, 13, 1, 22, ...): the captures did not begin at hop 0.
DSM packets carry no hop index, so the starting point should not matter.

Only the 22 IDs are kept. DSMX and DSM_RX hops are unchanged (2M IDs
compared with the previous code on the host).

* DSM: DSMR uses the CYRF manufacturer ID like DSMX (-152 B)

Now that the DSMR hops are computed from the ID, the 22 hard coded IDs
are not needed anymore: DSMR takes the CYRF manufacturer ID xor RX num
like the other DSM subprotocols, so radios no longer share the same 22
IDs. Models bound with the previous IDs have to be bound again. Clone
stays unavailable in DSMR, and the OrangeRX sop_col fix stays off.
2026-11-21 16:01:09 +01:00
Raphael Coeffic ca86cb0aa3 E010R5: wait for the end of the packet before hopping (#1197)
RF2500_SendPayload() returns once the CYRF6936 buffer is filled, while
the end of the packet is still being sent: changing the channel right
after it corrupted the last packet before each hop (1 in 6, measured).
Wait for TX_IRQ_STATUS TXC first (bounded loop): 100% of the packets
received right, same timing.
2026-11-21 16:00:44 +01:00
Raphael Coeffic d3293afdab HoTT, XN297 emu: compute the hop and CRC xorout tables (-1.2 KB) (#1199)
* HoTT: compute the hop table from the hop value (-1 KB)

The 16 hop tables are generated from the 16 bit value sent in packet[0..1]:
the C library rand() LCG (low 16 bits: x = x * 0x4E6D + 0x3039) seeded with
it drives forward Fisher-Yates shuffles, first of the order of the 5 bands of
15 channels, then of the channels of each band, hop i being in the band at
position i%5. This gives back the 16 tables bit for bit, and for any seed a
75 channel permutation with the same band structure.

* XN297 emu: compute the CRC xorout instead of the 4 tables

The XN297 CRC is CRC-16/CCITT with init 0xFFFF and xorout 0xFFFF over the
unscrambled address, pcf and payload, sent scrambled. The emulation computes
it from 0xB5D2 over the bits as sent, so the xorout for a CRC over n bits is
CRC(init 0xFFFF^0xB5D2) of n scramble (or zero) bits, xor 0xFFFF, xor the 16
scramble bits at the CRC. The scramble bits come from the LFSR behind
xn297_scramble[] (1110001, then s[i] = s[i-7] ^ s[i-3]), which also covers
the last enhanced entries, past the end of that table. It is the generator
Goebish gave for the scramble sequence in a comment on
https://mcumix.blogspot.com/2016/07/reverse-engineering-24ghz-rf-chip-xn297.html
(seed 0x71, feedback bit 6 ^ bit 2, MSB first).

All the entries of the 4 tables are given back but two: entry 0 (3 byte
address, no payload) was a 0 placeholder, and scrambled entry 1 (3 byte
address, 1 byte payload) was 0x3448 where the formula gives 0xE348.
2026-10-23 12:02:20 +02:00