diff --git a/plugins/channel/lora/lorabits.h b/plugins/channel/lora/lorabits.h index 09d8f4777..76839a063 100644 --- a/plugins/channel/lora/lorabits.h +++ b/plugins/channel/lora/lorabits.h @@ -22,7 +22,7 @@ short LoRaDemod::toGray(short num) return (num >> 1) ^ num; } -// ignore FEC, data in lsb +// ignore FEC, try data in lsb, bigendian void LoRaDemod::hamming(char* inout, int size) { int i; @@ -35,11 +35,11 @@ void LoRaDemod::hamming(char* inout, int size) inout[i] = 0; } -// data whitening +// example data whitening (4 bit only - needs 6 bit for FEC) void LoRaDemod::prng(char* inout, int size) { const char otp[] = { - " " + "EHFGKHGMGKGMGHG@FKDN@EHBMGBOLFALO@GIBIICJNMDFIDHAHJHMHBBHLHCHLH@IINCAOJFMLF@EKBDIAJKMNBEMBGMBKLMAHOHFHDB@DH@H@HAIKKDKAOKGDBAMIGIBCMLGCFODFAFNLECBLIHKHNBALJA" }; int i, maxchars; @@ -47,6 +47,6 @@ void LoRaDemod::prng(char* inout, int size) if (size < maxchars) maxchars = size; for (i = 0; i < maxchars; i++) - inout[i] ^= otp[i] - 32; + inout[i] ^= otp[i]; } diff --git a/plugins/channel/lora/lorademod.cpp b/plugins/channel/lora/lorademod.cpp index 8ffa9f3c4..54c0965be 100644 --- a/plugins/channel/lora/lorademod.cpp +++ b/plugins/channel/lora/lorademod.cpp @@ -73,6 +73,7 @@ void LoRaDemod::configure(MessageQueue* messageQueue, Real Bandwidth) void LoRaDemod::dumpRaw() { + char hex[] = {"0123456789ABCDEFXXXX"}; short bin, j, max; max = m_time / 4 - 3; if (max > 80) @@ -84,12 +85,17 @@ void LoRaDemod::dumpRaw() } for ( j=0; j < max; j+=6) interleave(&text[j]); - prng(text, max); // ?? + prng(text, max); hamming(text, max); - for ( j=0; j < max; j++) - text[j] += 64; // 4 bits per symbol + for ( j=0; j < max; j++) { + text[j] = hex[ (0xf & text[j]) ]; + } +// for ( j=0; j < max / 2; j++) { +// if ((text[j] < 32 )||( text[j] > 126)) +// text[j] = 0x5f; +// } text[j] = 0; - printf(">%s<\n", text); + printf("%s\n", text); } short LoRaDemod::synch(short bin)