1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

More bits decoding.

This commit is contained in:
John Greb 2015-02-11 22:06:09 +00:00
parent 2d55f3f347
commit dd8ffc3f31
2 changed files with 7 additions and 7 deletions

View File

@ -41,22 +41,22 @@ void LoRaDemod::hamming(char* c, int size)
i++; i++;
c[i] = ((c[i] & 1)<<2) | ((c[i] & 2)<<2) | ((c[i] & 4)>>1) | ((c[i] & 8)>>3); c[i] = ((c[i] & 1)<<2) | ((c[i] & 2)<<2) | ((c[i] & 4)>>1) | ((c[i] & 8)>>3);
i++; i++;
c[i] = ((c[i] & 1)<<3) | ((c[i] & 2)<<1) | ((c[i] & 4)>>1) | ((c[i] & 8)>>3); c[i] = ((c[i] & 32)>>2) | ((c[i] & 2)<<1) | ((c[i] & 4)>>1) | ((c[i] & 8)>>3);
i++; i++;
c[i] = ((c[i] & 1)<<3) | ((c[i] & 2)<<1) | ((c[i] & 4)>>1) | ((c[i] & 8)>>3); c[i] = ((c[i] & 1)<<3) | ((c[i] & 2)<<1) | ((c[i] & 4)>>1) | ((c[i] & 8)>>3);
i++; i++;
c[i] = ((c[i] & 1)<<3) | ((c[i] & 2)<<1) | ((c[i] & 4)>>1) | ((c[i] & 8)>>3); c[i] = ((c[i] & 1)<<3) | ((c[i] & 2)<<1) | ((c[i] & 4)>>1) | ((c[i] & 16)>>4);
i++; i++;
c[i] = ((c[i] & 1)<<3) | ((c[i] & 2)<<1) | ((c[i] & 4)>>2) | ((c[i] & 8)>>2); c[i] = ((c[i] & 1)<<3) | ((c[i] & 2)<<1) | ((c[i] & 4)>>2) | ((c[i] & 8)>>2);
} }
c[i] = 0; c[i] = 0;
} }
// example data whitening (4 bit only - needs 6 bit for FEC) // data whitening (6 bit)
void LoRaDemod::prng(char* inout, int size) void LoRaDemod::prng(char* inout, int size)
{ {
const char otp[] = { const char otp[] = {
"LBMGEJJENKKKJBN@KB@KAEDDMMDONIN@N@KFBGBCMCMCMIBJHBDHNJDJALDHE@A@DFGOBOMIM@M@BBBCBAMBMKDENDLEDKNKNBNHKJ@JADD@EAAADBOCGAGBLCDANFLGDCNGLOMOBIHHMLBHB@BHMJGJBLMLED@B" "5^ZSm0=cOGMgUB=bNcb<@a^T;_f=6DEB]2ImPIKg:j]RlYT4YZ<`9hZ\\PPb;@8X8i]Zmc_6B52\\8oUPHIcBOc>dY?d9[n5Lg]b]R8hR<0`T008h9c9QJm[c?a:lQEGa;nU=b_UbTW3=W5Aa<9i;F;ondS[LBA;[4S9]kkh]Vc2j>kX"
}; };
int i, maxchars; int i, maxchars;
@ -64,6 +64,6 @@ void LoRaDemod::prng(char* inout, int size)
if (size < maxchars) if (size < maxchars)
maxchars = size; maxchars = size;
for (i = 0; i < maxchars; i++) for (i = 0; i < maxchars; i++)
inout[i] ^= 0xf & otp[i]; inout[i] ^= (otp[i] - 48);
} }

View File

@ -84,8 +84,9 @@ void LoRaDemod::dumpRaw()
bin = (history[j * 4 + 12] + m_tune ) & (LORA_SFFT_LEN - 1); bin = (history[j * 4 + 12] + m_tune ) & (LORA_SFFT_LEN - 1);
text[j] = toGray(bin >> 1); text[j] = toGray(bin >> 1);
} }
interleave(text, max);
prng(text, max); prng(text, max);
interleave(text, max);
hamming(text, max); hamming(text, max);
for ( j=0; j < max / 2; j++) { for ( j=0; j < max / 2; j++) {
@ -93,7 +94,6 @@ void LoRaDemod::dumpRaw()
if ((text[j] < 32 )||( text[j] > 126)) if ((text[j] < 32 )||( text[j] > 126))
text[j] = 0x5f; text[j] = 0x5f;
} }
text[j] = 0; text[j] = 0;
printf("%s\n", text); printf("%s\n", text);
} }