kopia lustrzana https://github.com/projecthorus/wenet
scrambling prototype
rodzic
083ed6fc23
commit
d16756b5ef
|
@ -48,6 +48,7 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include "mpdecode_core.h"
|
||||
#include "wenet_scramble.h"
|
||||
|
||||
/* Machine generated consts, H_rows, H_cols, test input/output data to
|
||||
change LDPC code regenerate this file. */
|
||||
|
@ -74,7 +75,10 @@
|
|||
/* UW pattern we look for, including start/stop bits */
|
||||
|
||||
uint8_t uw[] = {
|
||||
1,0,1,0,1,0,1,1,1,1,0,0,1,1,0,1,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,1
|
||||
1,0,1,0,1,0,1,1,
|
||||
1,1,0,0,1,1,0,1,
|
||||
1,1,1,0,1,1,1,1,
|
||||
0,0,0,0,0,0,0,1,
|
||||
};
|
||||
|
||||
|
||||
|
@ -200,8 +204,8 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
if (state == COLLECT_PACKET) {
|
||||
symbol_buf[ind++] = symbol;
|
||||
|
||||
symbol_buf[ind] = symbol * scramble_code[ind%(sizeof(scramble_code)/sizeof(scramble_code[0]))];
|
||||
ind++;
|
||||
if (ind == SYMBOLS_PER_PACKET) {
|
||||
|
||||
/* now LDPC decode */
|
||||
|
|
|
@ -18,7 +18,7 @@ MYCALL=CHANGEME
|
|||
# Wenet Transmission Centre Frequency:
|
||||
|
||||
# Default Wenet Frequency, as used on most Project Horus flights.
|
||||
RXFREQ=441200000
|
||||
RXFREQ=443500000
|
||||
# Secondary downlink frequency, used on dual-launch flights
|
||||
#RXFREQ=443500000
|
||||
|
||||
|
@ -34,7 +34,7 @@ BIAS=0
|
|||
# building the rtl-sdr utils from this repo: https://github.com/rtlsdrblog/rtl-sdr
|
||||
|
||||
# drs232_ldpc (traditional) or wenet_ldpc (wenet v2)
|
||||
FRAMING_MODE=drs232_ldpc
|
||||
FRAMING_MODE=wenet_ldpc
|
||||
|
||||
# Change the following path as appropriate.
|
||||
# If running this from a .desktop file, you may need to set an absolute path here
|
||||
|
|
|
@ -132,9 +132,9 @@ class PacketTX(object):
|
|||
|
||||
if fec:
|
||||
parity = ldpc_encode(packet + crc)
|
||||
return self.preamble + self.unique_word + packet + crc + parity
|
||||
return self.preamble + self.unique_word + self.radio.scramble(packet + crc + parity)
|
||||
else:
|
||||
return self.preamble + self.unique_word + packet + crc
|
||||
return self.preamble + self.unique_word + self.radio.scramble(packet + crc )
|
||||
|
||||
|
||||
def set_idle_message(self, message):
|
||||
|
|
|
@ -140,6 +140,8 @@ class RFM98W(object):
|
|||
else:
|
||||
logging.critical("RFM98W - TX Mode not set correctly!")
|
||||
|
||||
def scramble(self,data):
|
||||
return data
|
||||
|
||||
def shutdown(self):
|
||||
"""
|
||||
|
@ -363,6 +365,45 @@ class RFM98W_I2S(RFM98W):
|
|||
logging.error("No alsaaudio - debugging mode")
|
||||
self.pcm = BinaryDebug()
|
||||
|
||||
# first 1000 digits of "A Million Random Digits with 100,000 Normal Deviates"
|
||||
# convert to binary by doing odd/even
|
||||
|
||||
# a = "1009..."
|
||||
# binary_list=[]
|
||||
# for digit in a:
|
||||
# binary_list.append (1 if int(digit) % 2 else 0)
|
||||
|
||||
# y=0
|
||||
# byte_out=0
|
||||
# for x in binary_list:
|
||||
# byte_out = byte_out | (x << y)
|
||||
# y += 1
|
||||
# if y > 7:
|
||||
# print(hex(byte_out))
|
||||
# byte_out=0
|
||||
# y=0
|
||||
|
||||
def scramble(self,data):
|
||||
scramble_code = [0xb9, 0x97, 0x93, 0x13, 0xf7, 0xab, 0x1e, 0x88, 0x12, 0xc4,
|
||||
0x28, 0x80, 0x9, 0xf8, 0xb4, 0x92, 0xfc, 0x32, 0xc6, 0xa6,
|
||||
0xae, 0xf7, 0x8b, 0x3a, 0xd2, 0xf1, 0xf1, 0x8a, 0x72, 0xcf,
|
||||
0x3d, 0xc3, 0x9e, 0x52, 0x6e, 0x7a, 0x7e, 0x37, 0xa2, 0x7,
|
||||
0x17, 0x71, 0x2d, 0x9d, 0x1c, 0x58, 0xc1, 0xb4, 0x65, 0xe4,
|
||||
0xbe, 0x5b, 0xd1, 0xf, 0xa0, 0x5a, 0x3c, 0x6f, 0xd9, 0x8,
|
||||
0x9c, 0x6c, 0x5c, 0x6e, 0x85, 0x94, 0xb1, 0x5d, 0xde, 0xd4,
|
||||
0xc3, 0x55, 0x20, 0x61, 0xd7, 0x6a, 0x81, 0x78, 0x52, 0x46,
|
||||
0x7c, 0x43, 0x40, 0x63, 0xf1, 0x25, 0xcb, 0xf1, 0x8c, 0xa7,
|
||||
0x83, 0x5c, 0xa3, 0xba, 0x5c, 0xa3, 0xc5, 0xb6, 0xf, 0x2a,
|
||||
0x64, 0x5f, 0xec, 0x98, 0xcf, 0xf5, 0xb6, 0x3d, 0x96, 0x42,
|
||||
0x16, 0x7, 0xec, 0x20, 0x32, 0x4d, 0xc6, 0x17, 0x92, 0xa6,
|
||||
0x91, 0xc1, 0x92, 0x43, 0x69]
|
||||
|
||||
out_data = b''
|
||||
index=0
|
||||
for x in data:
|
||||
out_data += (x ^ scramble_code[index%len(scramble_code)]).to_bytes()
|
||||
index+=1
|
||||
return out_data
|
||||
|
||||
def precompute_bytes(self):
|
||||
logging.debug("Precomputing byte lookup table")
|
||||
|
@ -459,7 +500,8 @@ class SerialOnly(object):
|
|||
self.serial = BinaryDebug()
|
||||
logging.info("SerialOnly - No serial port provided - using Binary Debug output (binary_debug.bin)")
|
||||
|
||||
|
||||
def scramble(self,data):
|
||||
return data
|
||||
|
||||
def shutdown(self):
|
||||
"""
|
||||
|
|
Ładowanie…
Reference in New Issue