Improve spkmomdem reliability by adding a separator between bytes.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-01-21 14:55:30 +01:00
parent 115c2cc180
commit 822b726b33
2 changed files with 12 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2013-01-21 Vladimir Serbinenko <phcoder@gmail.com>
Improve spkmomdem reliability by adding a separator between bytes.
2013-01-21 Colin Watson <cjwatson@ubuntu.com> 2013-01-21 Colin Watson <cjwatson@ubuntu.com>
* grub-core/partmap/msdos.c (embed_signatures): Add the signature of * grub-core/partmap/msdos.c (embed_signatures): Add the signature of

View File

@ -24,7 +24,7 @@
/* Usage: parecord --channels=1 --rate=48000 --format=s16le | ./spkmodem-recv */ /* Usage: parecord --channels=1 --rate=48000 --format=s16le | ./spkmodem-recv */
#define SAMPLES_PER_TRAME 240 #define SAMPLES_PER_TRAME 240
#define FREQ_SEP_MIN 6 #define FREQ_SEP_MIN 5
#define FREQ_SEP_MAX 15 #define FREQ_SEP_MAX 15
#define FREQ_DATA_MIN 15 #define FREQ_DATA_MIN 15
#define FREQ_DATA_THRESHOLD 25 #define FREQ_DATA_THRESHOLD 25
@ -32,6 +32,7 @@
#define THRESHOLD 500 #define THRESHOLD 500
#define DEBUG 0 #define DEBUG 0
#define FLUSH_TIMEOUT 1
static signed short trame[2 * SAMPLES_PER_TRAME]; static signed short trame[2 * SAMPLES_PER_TRAME];
static signed short pulse[2 * SAMPLES_PER_TRAME]; static signed short pulse[2 * SAMPLES_PER_TRAME];
@ -70,15 +71,18 @@ main ()
int bitn = 7; int bitn = 7;
char c = 0; char c = 0;
int i; int i;
int llp = 0;
while (!feof (stdin)) while (!feof (stdin))
{ {
if (lp > 20000) if (lp > 3 * SAMPLES_PER_TRAME)
{ {
fflush (stdout);
bitn = 7; bitn = 7;
c = 0; c = 0;
lp = 0; lp = 0;
llp++;
} }
if (llp == FLUSH_TIMEOUT)
fflush (stdout);
if (f2 > FREQ_SEP_MIN && f2 < FREQ_SEP_MAX if (f2 > FREQ_SEP_MIN && f2 < FREQ_SEP_MAX
&& f1 > FREQ_DATA_MIN && f1 < FREQ_DATA_MAX) && f1 > FREQ_DATA_MIN && f1 < FREQ_DATA_MAX)
{ {
@ -100,6 +104,7 @@ main ()
c = 0; c = 0;
} }
lp = 0; lp = 0;
llp = 0;
for (i = 0; i < SAMPLES_PER_TRAME; i++) for (i = 0; i < SAMPLES_PER_TRAME; i++)
read_sample (); read_sample ();
continue; continue;