Fix FQ777

This commit is contained in:
Pascal Langer 2021-01-11 12:30:12 +01:00
parent b51dedcea1
commit e5689d2f1b
3 changed files with 9 additions and 10 deletions

View File

@ -179,5 +179,5 @@
78,0,M-Link,Std,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
79,0,WFLY2,RF20x,0,CH5,CH6,CH7,CH8,CH9,CH10
80,0,E016Hv2,E016Hv2,1,TakLan,EmStop,Flip,Calib,HLess,RTH
81,0,E010r5,E010r5,1,Flip,HLess,RTH
81,0,E010r5,E010r5,1,Flip,LED,CALIB,HLess,RTH,UNK
82,0,LOLI,0,CH5,CH6,CH7,CH8

View File

@ -56,21 +56,20 @@ static void __attribute__((unused)) ssv_pack_dpl(uint8_t addr[], uint8_t pid, ui
{
uint8_t bytes[2];
uint16_t val;
} crc;
} crca;
crc=0x3c18;
for (i = 0; i < 7; ++i)
crc16_update(header[i],8);
for (i = 0; i < *len; ++i)
crc16_update(payload[i],8);
crc.val=crc;
// encode payload and crc
// xor with this:
for (i = 0; i < *len; ++i)
payload[i] ^= ssv_xor[i];
crc.bytes[1] ^= ssv_xor[i++];
crc.bytes[0] ^= ssv_xor[i++];
crc ^= ssv_xor[i++]<<8;
crc ^= ssv_xor[i++];
// pack the pcf, payload, and crc into packed_payload
packed_payload[0] = pcf >> 1;
@ -79,11 +78,11 @@ static void __attribute__((unused)) ssv_pack_dpl(uint8_t addr[], uint8_t pid, ui
for (i = 0; i < *len - 1; ++i)
packed_payload[i+2] = (payload[i] << 7) | (payload[i+1] >> 1);
packed_payload[i+2] = (payload[i] << 7) | (crc.val >> 9);
packed_payload[i+2] = (payload[i] << 7) | (crc >> 9);
++i;
packed_payload[i+2] = (crc.val >> 1 & 0x80 ) | (crc.val >> 1 & 0x7F);
packed_payload[i+2] = (crc >> 1 & 0x80 ) | (crc >> 1 & 0x7F);
++i;
packed_payload[i+2] = (crc.val << 7);
packed_payload[i+2] = (crc << 7);
*len += 4;
}

View File

@ -18,8 +18,8 @@
//******************
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_REVISION 1
#define VERSION_PATCH_LEVEL 99
#define VERSION_REVISION 2
#define VERSION_PATCH_LEVEL 00
//******************
// Protocols