kopia lustrzana https://github.com/rs1729/RS
C34 Fletcher16
rodzic
25fccbd4df
commit
b47193868d
11
c34/c34.txt
11
c34/c34.txt
|
@ -13,9 +13,8 @@ Datenpaket besteht aus 8 byte:
|
|||
header 2 byte 00FF
|
||||
pck_id 1 byte N
|
||||
data 4 byte val (big endian)
|
||||
chksum 2 byte Summe ueber byte[0]=pck_id,byte[1]=data[0],...,byte[4]=data[3]
|
||||
byte1: (sum_i byte[i]) & 0xFF
|
||||
byte2: (-1 - sum_i byte[i]*(5-i)) & 0xFF = ~(sum_i byte[i]*(5-i)) & 0xFF
|
||||
chksum 2 byte Fletcher16 (hier: byte2 1's-complement am Ende)
|
||||
|
||||
|
||||
Telemetrie pck_id N:
|
||||
0x14: date: 0x00027173 = 160115 -> 2015-01-16
|
||||
|
@ -29,7 +28,7 @@ GPS-lat/lon wie NMEA mit Faktor 1e4
|
|||
|
||||
|
||||
Checksum:
|
||||
2 byte
|
||||
2 byte, Summe ueber byte[0]=pck_id,byte[1]=data[0],...,byte[4]=data[3]
|
||||
byte1: (sum_i byte[i]) & 0xFF
|
||||
byte2: (-1 - sum_i byte[i]*(5-i)) & 0xFF = ~(sum_i byte[i]*(5-i)) & 0xFF
|
||||
|
||||
|
@ -44,6 +43,10 @@ FrameID 0x15 (time):
|
|||
00FF 15 0001E605 01C2
|
||||
00FF 15 0001E606 02C1
|
||||
|
||||
-> Fletcher16:
|
||||
5*byte[0]+4*byte[1]+3*byte[2]+2*byte[3]+1*byte[4]
|
||||
= byte[0] + (byte[0]+byte[1]) + (byte[0]+byte[1]+byte[2]) + (byte[0]+byte[1]+byte[2]+byte[3]) + (byte[0]+byte[1]+byte[2]+byte[3]+byte[4])
|
||||
|
||||
|
||||
PTU-Data: float32?
|
||||
|
||||
|
|
14
c34/c34dft.c
14
c34/c34dft.c
|
@ -306,6 +306,7 @@ void printGPX() {
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
// Chechsum Fletcher16
|
||||
unsigned check2(ui8_t *bytes, int len) {
|
||||
int sum1, sum2;
|
||||
int i;
|
||||
|
@ -321,6 +322,19 @@ unsigned check2(ui8_t *bytes, int len) {
|
|||
|
||||
return sum2 | (sum1<<8);
|
||||
}
|
||||
/* // equivalent
|
||||
unsigned check16(ui8_t *bytes, int len) {
|
||||
unsigned sum1, sum2;
|
||||
int i;
|
||||
sum1 = sum2 = 0;
|
||||
for (i = 0; i < len; i++) {
|
||||
sum1 = (sum1 + bytes[i]) % 0x100;
|
||||
sum2 = (sum2 + sum1) % 0x100;
|
||||
}
|
||||
sum2 = (~sum2) & 0xFF; // 1's complement
|
||||
return sum2 | (sum1<<8);
|
||||
}
|
||||
*/
|
||||
|
||||
double NMEAll(int ll) { // NMEA GGA,GLL: ll/1e4=(D)DDMM.mmmm
|
||||
int deg = ll / 1000000;
|
||||
|
|
Ładowanie…
Reference in New Issue