iMet-54 v0.4.0: inverse polarization fix

pull/37/head
Zilog80 2021-01-24 15:06:25 +01:00
rodzic 45e98f887a
commit 76c2c2028c
1 zmienionych plików z 12 dodań i 6 usunięć

Wyświetl plik

@ -654,13 +654,16 @@ int main(int argc, char *argv[]) {
// init circular header bit buffer // init circular header bit buffer
hdb.hdr = imet54_header; hdb.hdr = imet54_header;
hdb.len = strlen(imet54_header); hdb.len = strlen(imet54_header);
hdb.thb = 1.0 - 3.1/(float)hdb.len; // 1.0-max_bit_errors/hdrlen //db.thb = 1.0 - 3.1/(float)hdb.len; // 1.0-max_bit_errors/hdrlen
hdb.bufpos = -1; hdb.bufpos = -1;
hdb.buf = NULL;
/*
hdb.buf = calloc(hdb.len, sizeof(char)); hdb.buf = calloc(hdb.len, sizeof(char));
if (hdb.buf == NULL) { if (hdb.buf == NULL) {
fprintf(stderr, "error: malloc\n"); fprintf(stderr, "error: malloc\n");
return -1; return -1;
} }
*/
hdb.ths = 0.7; // caution/test false positive hdb.ths = 0.7; // caution/test false positive
hdb.sbuf = calloc(hdb.len, sizeof(float)); hdb.sbuf = calloc(hdb.len, sizeof(float));
if (hdb.sbuf == NULL) { if (hdb.sbuf == NULL) {
@ -712,21 +715,24 @@ int main(int argc, char *argv[]) {
} }
if ( bitQ == EOF ) break; // liest 2x EOF if ( bitQ == EOF ) break; // liest 2x EOF
gpx.frame_bits[pos] = hsbit.hb & 1; if (gpx.option.inv) {
hsbit.hb ^= 1;
hsbit.sb = -hsbit.sb;
bit ^= 1;
}
if (gpx.option.inv) bit ^= 1; gpx.frame_bits[pos] = hsbit.hb & 1;
bitpos += 1; bitpos += 1;
pos++; pos++;
} }
gpx.frame_bits[pos] = 0;
print_frame(&gpx, pos, 1); print_frame(&gpx, pos, 1);
if (pos < BITFRAME_LEN) break; if (pos < BITFRAME_LEN) break;
header_found = 0; header_found = 0;
// bis Ende der Sekunde vorspulen; allerdings Doppel-Frame alle 10 sek // bis Ende der Sekunde vorspulen
while ( 0 && bitpos < 3*BITFRAME_LEN/4 ) { while ( 0 && bitpos < 4*BITFRAME_LEN/3 ) {
if (option_softin) { if (option_softin) {
float s = 0.0; float s = 0.0;
bitQ = f32soft_read(fp, &s); bitQ = f32soft_read(fp, &s);