Skip to content

Commit

Permalink
Merge pull request #846 from darksidelemm/testing
Browse files Browse the repository at this point in the history
1.7.2-beta4 - Meisei iMS100 decoder bugfix
  • Loading branch information
darksidelemm authored Jan 5, 2024
2 parents 9dcb784 + 5878ad4 commit 78e1a55
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
2 changes: 1 addition & 1 deletion auto_rx/autorx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# MINOR - New sonde type support, other fairly big changes that may result in telemetry or config file incompatability issus.
# PATCH - Small changes, or minor feature additions.

__version__ = "1.7.2-beta3"
__version__ = "1.7.2-beta4"


# Global Variables
Expand Down
46 changes: 39 additions & 7 deletions demod/mod/meisei100mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ e.g. -b --br 2398

typedef struct {
int frnr; int frnr1;
int ref_yr;
int jahr; int monat; int tag;
int std; int min; float sek;
double lat; double lon; double alt;
Expand Down Expand Up @@ -326,11 +327,27 @@ static int reset_gpx(gpx_t *gpx) {

/* -------------------------------------------------------------------------- */

static int est_year_ims100(int _y, int _yr) {
int yr_rollover = 20; // default: 2020..2029
int yr_offset = 20;
if (_yr > 2003 && _yr < 2100) {
yr_rollover = _yr - 2004;
yr_offset = (yr_rollover / 10) * 10;
}
_y %= 10;
_y += yr_offset;
if (_y < yr_rollover) _y += 10;
return 2000+_y;
}

/* -------------------------------------------------------------------------- */


int main(int argc, char **argv) {

int option_verbose = 0,
option_raw = 0,
option_dbg = 0,
option_inv = 0,
option_ecc = 0, // BCH(63,51)
option_jsn = 0; // JSON output (auto_rx)
Expand Down Expand Up @@ -427,6 +444,7 @@ int main(int argc, char **argv) {
return 0;
}
else if ( (strcmp(*argv, "-r") == 0) ) { option_raw = 1; }
else if ( (strcmp(*argv, "--dbg") == 0) ) { option_dbg = 1; }
else if ( (strcmp(*argv, "-i") == 0) || (strcmp(*argv, "--invert") == 0) ) {
option_inv = 1; // nicht noetig
}
Expand All @@ -445,7 +463,7 @@ int main(int argc, char **argv) {
++argv;
if (*argv) {
baudrate = atof(*argv);
if (baudrate < 2200 || baudrate > 2400) baudrate = 2400; // default: 2400
if (baudrate < 2200 || baudrate > 2600) baudrate = 2400; // default: 2400
}
else return -1;
}
Expand Down Expand Up @@ -507,6 +525,12 @@ int main(int argc, char **argv) {
if (frq < 300000000) frq = -1;
cfreq = frq;
}
else if (strcmp(*argv, "--year") == 0) {
int _yr = 0;
++argv;
if (*argv) _yr = atoi(*argv); else return -1;
if (_yr > 2003 && _yr < 2100) gpx.ref_yr = _yr;
}
else if (strcmp(*argv, "-") == 0) {
int sample_rate = 0, bits_sample = 0, channels = 0;
++argv;
Expand Down Expand Up @@ -546,6 +570,9 @@ int main(int argc, char **argv) {

if (cfreq > 0) gpx.jsn_freq = (cfreq+500)/1000;

// ims100: default ref. year
if (gpx.ref_yr < 2000) gpx.ref_yr = 2024; // -> 2020..2029


#ifdef EXT_FSK
if (!option_softin) {
Expand Down Expand Up @@ -783,6 +810,10 @@ int main(int argc, char **argv) {
| ( (w16[0]&0xFF00)>>8 | (w16[0]&0xFF)<<8 );
fw32 = f32e2(w32);

if (option_dbg) {
printf(" # [%02d] %08x : %.1f # ", counter % 64, w32, fw32);
}

if (err_blks == 0) // err_frm zu schwach
{
gpx.cfg[counter%64] = fw32;
Expand Down Expand Up @@ -1016,6 +1047,10 @@ int main(int argc, char **argv) {
w16[0] = bits2val(subframe_bits+HEADLEN+46*1 , 16);
w16[1] = bits2val(subframe_bits+HEADLEN+46*1+17, 16);
w32 = (w16[1]<<16) | w16[0];

if (option_dbg) {
printf(" # [%02d] %08x : %.1f # ", counter % 64, w32, *fcfg);
}
// counter ok and w16[] ok (max 1 error)
if (err_frm == 0 && block_err[0] < 2 && block_err[1] < 2)
{
Expand Down Expand Up @@ -1117,12 +1152,9 @@ int main(int argc, char **argv) {
dat2 = bits2val(subframe_bits+HEADLEN, 16);
gpx.tag = dat2/1000;
gpx.monat = (dat2/10)%100;
_y = (dat2%10)+10;
if (_y < 14) _y += 10; // 2020
gpx.jahr = 2000 + _y;
//if (option_verbose) printf("%05u ", dat2);
//printf("(%02d-%02d-%02d) ", gpx.tag, gpx.monat, gpx.jahr%100); // 2020: +20 ?
printf("(%04d-%02d-%02d) ", gpx.jahr, gpx.monat, gpx.tag); // 2020: +20 ?
_y = dat2 % 10;
gpx.jahr = est_year_ims100(_y, gpx.ref_yr);
printf("(%04d-%02d-%02d) ", gpx.jahr, gpx.monat, gpx.tag);

lat1 = bits2val(subframe_bits+HEADLEN+46*0+17, 16);
lat2 = bits2val(subframe_bits+HEADLEN+46*1 , 16);
Expand Down

0 comments on commit 78e1a55

Please sign in to comment.