Hexadecimal.

This commit is contained in:
John Greb 2015-02-07 10:03:51 +00:00
parent df7aef1379
commit c513f5ca04
2 changed files with 14 additions and 8 deletions

View File

@ -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];
}

View File

@ -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)