From 23d16052b4022ed6422bbc8fffde7c7f6af24c1a Mon Sep 17 00:00:00 2001 From: Steven Honson Date: Tue, 17 Aug 2021 18:43:41 +1000 Subject: [PATCH 01/10] Alert on newer, not different --- auto_rx/autorx/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/auto_rx/autorx/utils.py b/auto_rx/autorx/utils.py index 79944410..9959f0e2 100644 --- a/auto_rx/autorx/utils.py +++ b/auto_rx/autorx/utils.py @@ -110,7 +110,7 @@ def check_autorx_versions(current_version=auto_rx_version): # User is on a testing branch version. # Compare against the testing branch version - when a release is made, the testing # branch will have the same version as the main branch, then will advance. - if semver.compare(_testing_branch_version, current_version): + if semver.compare(_testing_branch_version, current_version) == 1: # Newer testing version available. return _testing_branch_version else: @@ -118,7 +118,7 @@ def check_autorx_versions(current_version=auto_rx_version): return "Latest" else: # User is running the main branch - if semver.compare(_main_branch_version, current_version): + if semver.compare(_main_branch_version, current_version) == 1: return _main_branch_version else: return "Latest" @@ -299,18 +299,18 @@ def generate_aprs_id(sonde_data): else: # Unknown sonde type, don't know how to handle this yet. _object_name = None - + # Pad or clip to 9 characters if len(_object_name) > 9: _object_name = _object_name[:9] elif len(_object_name) < 9: _object_name = _object_name + " " * (9 - len(_object_name)) - + return _object_name def readable_timedelta(duration: timedelta): - """ + """ Convert a timedelta into a readable string. From: https://codereview.stackexchange.com/a/245215 """ From ff53b600e7cf3ae590327540519aa466c215d085 Mon Sep 17 00:00:00 2001 From: Steven Honson Date: Tue, 17 Aug 2021 18:50:17 +1000 Subject: [PATCH 02/10] Bump version --- auto_rx/autorx/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auto_rx/autorx/__init__.py b/auto_rx/autorx/__init__.py index 60dc39cf..21a75b4c 100644 --- a/auto_rx/autorx/__init__.py +++ b/auto_rx/autorx/__init__.py @@ -17,7 +17,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.5.5" +__version__ = "1.5.6-beta1" # Global Variables From 5dc766ae2d14b259cdf96d9208bca3ee75be7bab Mon Sep 17 00:00:00 2001 From: Steven Honson Date: Tue, 17 Aug 2021 22:40:20 +1000 Subject: [PATCH 03/10] Use debian bullseye as the base --- Dockerfile | 4 ++-- Dockerfile.dev | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index fc4d6fe2..08f248fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # ------------------- # The build container # ------------------- -FROM debian:buster-slim AS build +FROM debian:bullseye-slim AS build # Upgrade base packages. RUN apt-get update && \ @@ -48,7 +48,7 @@ RUN /bin/sh build.sh # ------------------------- # The application container # ------------------------- -FROM debian:buster-slim +FROM debian:bullseye-slim EXPOSE 5000/tcp diff --git a/Dockerfile.dev b/Dockerfile.dev index 3523f3a5..a05b3471 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM debian:buster-slim +FROM debian:bullseye-slim EXPOSE 5000/tcp From 9ce8f6ba5a51d913bcbceb7bfe71b612b97b6f48 Mon Sep 17 00:00:00 2001 From: Steven Honson Date: Wed, 18 Aug 2021 00:19:33 +1000 Subject: [PATCH 04/10] Flush stdout only --- utils/fsk_demod.c | 70 ++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/utils/fsk_demod.c b/utils/fsk_demod.c index 9c96b139..3def541a 100644 --- a/utils/fsk_demod.c +++ b/utils/fsk_demod.c @@ -6,7 +6,7 @@ C test driver for fsk_demod in fsk.c. Reads in a stream of 32 bit cpu endian floats and writes out the detected bits - + \*---------------------------------------------------------------------------*/ @@ -76,7 +76,7 @@ int main(int argc,char *argv[]){ int nsym = FSK_DEFAULT_NSYM; int mask = 0; int tx_tone_separation = 100; - + int o = 0; int opt_idx = 0; while( o != -1 ){ @@ -94,9 +94,9 @@ int main(int argc,char *argv[]){ {"mask", required_argument, 0, 'm'}, {0, 0, 0, 0} }; - + o = getopt_long(argc,argv,"fhlp:cdt::sb:u:m",long_opts,&opt_idx); - + switch(o){ case 'c': complex_input = 2; @@ -152,12 +152,12 @@ int main(int argc,char *argv[]){ } } int dx = optind; - + if( (argc - dx) < 5){ fprintf(stderr, "Too few arguments\n"); goto helpmsg; } - + if( (argc - dx) > 5) { fprintf(stderr, "Too many arguments\n"); helpmsg: @@ -180,24 +180,24 @@ int main(int argc,char *argv[]){ fprintf(stderr," --mask TxFreqSpace Use \"mask\" freq estimator (default is \"peak\" estimator)\n"); exit(1); } - + /* Extract parameters */ M = atoi(argv[dx]); Fs = atoi(argv[dx + 1]); Rs = atoi(argv[dx + 2]); - + if( (M!=2) && (M!=4) ){ fprintf(stderr,"Mode %d is not valid. Mode must be 2 or 4.\n",M); goto helpmsg; } - + /* Open files */ if(strcmp(argv[dx + 3],"-")==0){ fin = stdin; }else{ fin = fopen(argv[dx + 3],"r"); } - + if(strcmp(argv[dx + 4],"-")==0){ fout = stdout; }else{ @@ -222,22 +222,22 @@ int main(int argc,char *argv[]){ fsk_set_freq_est_limits(fsk,fsk_lower,fsk_upper); fsk_set_freq_est_alg(fsk, mask); - + if(fin==NULL || fout==NULL || fsk==NULL){ fprintf(stderr,"Couldn't open files\n"); exit(1); } /* set up testframe mode */ - + int testframecnt, bitcnt, biterr, testframe_detected; uint8_t *bitbuf_tx = NULL, *bitbuf_rx = NULL; if (testframe_mode) { bitbuf_tx = (uint8_t*)malloc(sizeof(uint8_t)*TEST_FRAME_SIZE); assert(bitbuf_tx != NULL); bitbuf_rx = (uint8_t*)malloc(sizeof(uint8_t)*TEST_FRAME_SIZE); assert(bitbuf_rx != NULL); - + /* Generate known tx frame from known seed */ - + srand(158324); for(i=0; iNbits); assert(sdbuf != NULL); @@ -265,13 +265,13 @@ int main(int argc,char *argv[]){ modbuf = (COMP*)malloc(sizeof(COMP)*(fsk->N+fsk->Ts*2)); /* set up signal handler so we can terminate gracefully */ - + if (signal(SIGTERM, sig_handler) == SIG_ERR) { printf("\ncan't catch SIGTERM\n"); } - + /* Demodulate! */ - + while( fread(rawbuf,bytes_per_sample*complex_input,fsk_nin(fsk),fin) == fsk_nin(fsk) ){ /* convert input to a buffer of floats. Note scaling isn't really necessary for FSK */ @@ -297,7 +297,7 @@ int main(int argc,char *argv[]){ modbuf[i].real = ((float)rawbuf[2*i])/FDMDV_SCALE; modbuf[i].imag = ((float)rawbuf[2*i+1]/FDMDV_SCALE); } - } + } } if(soft_dec_mode){ @@ -305,7 +305,7 @@ int main(int argc,char *argv[]){ }else{ fsk_demod(fsk,bitbuf,modbuf); } - + testframe_detected = 0; if (testframe_mode) { /* attempt to find a testframe and update stats */ @@ -332,7 +332,7 @@ int main(int argc,char *argv[]){ errs++; } } - + if (errs < 0.1*TEST_FRAME_SIZE) { /* OK, we have a valid test frame sync, so lets count errors */ testframe_detected = 1; @@ -346,7 +346,7 @@ int main(int argc,char *argv[]){ } } } /* if (testframe_mode) ... */ - + if (enable_stats) { if ((stats_ctr < 0) || testframe_detected) { fsk_get_demod_stats(fsk,&stats); @@ -369,11 +369,11 @@ int main(int argc,char *argv[]){ if(fsk->mode == 4){ fprintf(stderr,", \"f3_est\":%.1f, \"f4_est\":%.1f",f_est[2],f_est[3]); } - + if (testframe_mode == 0) { /* Print the eye diagram */ - fprintf(stderr,",\t\"eye_diagram\":["); + fprintf(stderr,",\t\"eye_diagram\":["); for(i=0;iNdft/2; @@ -394,12 +394,12 @@ int main(int argc,char *argv[]){ } fprintf(stderr,"]"); } - + if (testframe_mode) { fprintf(stderr,", \"frames\":%d, \"bits\":%d, \"errs\":%d",testframecnt,bitcnt,biterr); } - - fprintf(stderr,"}\n"); + + fprintf(stderr,"}\n"); if (stats_ctr < 0) { stats_ctr = stats_loop; @@ -416,30 +416,26 @@ int main(int argc,char *argv[]){ fwrite(bitbuf,sizeof(uint8_t),fsk->Nbits,fout); } - if(fin == stdin || fout == stdin){ - fflush(fin); - fflush(fout); - } + if (fout == stdout) fflush(stdout); } /* while(fread ...... */ if (testframe_mode) { free(bitbuf_tx); free(bitbuf_rx); } - + if(soft_dec_mode){ free(sdbuf); }else{ free(bitbuf); } - + free(rawbuf); free(modbuf); - + fclose(fin); fclose(fout); fsk_destroy(fsk); return 0; } - From 678c0e6f2cdf2683fb696c73da65dfc49dc4b7c9 Mon Sep 17 00:00:00 2001 From: Steven Honson Date: Fri, 20 Aug 2021 13:43:47 +1000 Subject: [PATCH 05/10] Revert "Use debian bullseye as the base" This reverts commit 5dc766ae2d14b259cdf96d9208bca3ee75be7bab. --- Dockerfile | 4 ++-- Dockerfile.dev | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 08f248fc..fc4d6fe2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # ------------------- # The build container # ------------------- -FROM debian:bullseye-slim AS build +FROM debian:buster-slim AS build # Upgrade base packages. RUN apt-get update && \ @@ -48,7 +48,7 @@ RUN /bin/sh build.sh # ------------------------- # The application container # ------------------------- -FROM debian:bullseye-slim +FROM debian:buster-slim EXPOSE 5000/tcp diff --git a/Dockerfile.dev b/Dockerfile.dev index a05b3471..3523f3a5 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM debian:bullseye-slim +FROM debian:buster-slim EXPOSE 5000/tcp From d5c923363c1fbc79d2bde4065f363a394b8778d5 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Sun, 5 Sep 2021 17:14:00 +0930 Subject: [PATCH 06/10] Add subtype support for iMet-54/iMet-50 --- auto_rx/autorx/__init__.py | 2 +- auto_rx/autorx/decode.py | 2 +- auto_rx/autorx/logger.py | 7 ++++- auto_rx/autorx/sondehub.py | 5 +++- demod/mod/imet54mod.c | 52 ++++++++++++++++++++++++-------------- 5 files changed, 45 insertions(+), 23 deletions(-) diff --git a/auto_rx/autorx/__init__.py b/auto_rx/autorx/__init__.py index 21a75b4c..40404458 100644 --- a/auto_rx/autorx/__init__.py +++ b/auto_rx/autorx/__init__.py @@ -17,7 +17,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.5.6-beta1" +__version__ = "1.5.6-beta2" # Global Variables diff --git a/auto_rx/autorx/decode.py b/auto_rx/autorx/decode.py index 9b4af7ba..da64185c 100644 --- a/auto_rx/autorx/decode.py +++ b/auto_rx/autorx/decode.py @@ -1326,7 +1326,7 @@ def handle_decoder_line(self, data): ) _telemetry["id"] = self.imet_id - # iMet-54 Specific Actions + # iMet-5x Specific Actions if self.sonde_type == "IMET5": # Fix up the time. _telemetry["datetime_dt"] = fix_datetime(_telemetry["datetime"]) diff --git a/auto_rx/autorx/logger.py b/auto_rx/autorx/logger.py index bdb29df3..40697b25 100644 --- a/auto_rx/autorx/logger.py +++ b/auto_rx/autorx/logger.py @@ -130,6 +130,11 @@ def telemetry_to_string(self, telemetry): telemetry (dict): Telemetry dictionary to process. """ # timestamp,serial,frame,lat,lon,alt,vel_v,vel_h,heading,temp,humidity,type,freq,other + if 'subtype' in telemetry: + _type = telemetry['subtype'] + else: + _type = telemetry['type'] + _log_line = "%s,%s,%d,%.5f,%.5f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%s,%.3f" % ( telemetry["datetime"], telemetry["id"], @@ -143,7 +148,7 @@ def telemetry_to_string(self, telemetry): telemetry["temp"], telemetry["humidity"], telemetry["pressure"], - telemetry["type"], + _type, telemetry["freq_float"], ) diff --git a/auto_rx/autorx/sondehub.py b/auto_rx/autorx/sondehub.py index 42c84856..998eccf6 100644 --- a/auto_rx/autorx/sondehub.py +++ b/auto_rx/autorx/sondehub.py @@ -199,8 +199,11 @@ def reformat_data(self, telemetry): elif telemetry["type"] == "IMET5": _output["manufacturer"] = "Intermet Systems" - _output["type"] = "iMet-54" + _output["type"] = "iMet-5x" _output["serial"] = telemetry["id"].split("-")[1] + if "subtype" in telemetry: + _output["type"] = telemetry["subtype"] + _output["subtype"] = telemetry["subtype"] elif telemetry["type"] == "MEISEI": _output["manufacturer"] = "Meisei" diff --git a/demod/mod/imet54mod.c b/demod/mod/imet54mod.c index 3be89cb6..ba3d17ff 100644 --- a/demod/mod/imet54mod.c +++ b/demod/mod/imet54mod.c @@ -123,11 +123,7 @@ static int deinter64(ui8_t *in, ui8_t *out, int len) { while (n+64 <= len) { for (i = 0; i < 8; i++) { - for (j = 0; j < 8; j++) bits64[i][j] = in[n + 8*i+j]; - } - for (i = 0; i < 8; i++) { - //for (j = 0; j < 8; j++) out[n + 8*i+j] = bits64[j][7-i]; - for (j = 0; j < 8; j++) out[n + 8*i+j] = bits64[j][i]; + for (j = 0; j < 8; j++) out[n + 8*j+i] = in[n + 8*i+j]; } n += 64; } @@ -265,6 +261,10 @@ static ui16_t u2be(ui8_t *bytes) { // 16bit unsigned int #define pos_PTU_T 0x1C // float32 #define pos_PTU_RH 0x20 // float32 #define pos_PTU_Trh 0x24 // float32 // ? +// +#define pos_STATUS 0x2A // 2 byte +#define pos_F8 0x52 // 1 byte +#define pos_CNT11 0x5E // 1 byte static int get_SN(gpx_t *gpx) { @@ -326,11 +326,13 @@ static int get_PTU(gpx_t *gpx) { int val = 0; float *f = (float*)&val; float rh = -1.0f; + int count_1e9 = 0; // air temperature val = i4be(gpx->frame + pos_PTU_T); if (*f > -120.0f && *f < 80.0f) gpx->T = *f; else gpx->T = -273.15f; + if (val == 0x4E6E6B28) count_1e9 += 1; // raw RH? // water vapor saturation pressure (Hyland and Wexler)? @@ -339,24 +341,26 @@ static int get_PTU(gpx_t *gpx) { if (*f < 0.0f) gpx->_RH = 0.0f; else if (*f > 100.0f) gpx->_RH = 100.0f; else gpx->_RH = *f; + if (val == 0x4E6E6B28) count_1e9 += 1; // temperatur of r.h. sensor? val = i4be(gpx->frame + pos_PTU_Trh); if (*f > -120.0f && *f < 80.0f) gpx->Trh = *f; else gpx->Trh = -273.15f; + if (val == 0x4E6E6B28) count_1e9 += 1; // (Hyland and Wexler) if (gpx->T > -273.0f && gpx->Trh > -273.0f) { rh = gpx->_RH * vaporSatP(gpx->Trh)/vaporSatP(gpx->T); - if (rh < 0.0f) rh = 0.0; - if (rh > 100.0f) rh = 100.0; + if (rh < 0.0f) rh = 0.0f; + if (rh > 100.0f) rh = 100.0f; } else { // if Trh unusable, sensor damaged? // rh = gpx->_RH; } gpx->RH = rh; - return 0; + return count_1e9; } static int reset_gpx(gpx_t *gpx) { @@ -384,9 +388,13 @@ static int print_position(gpx_t *gpx, int len, int ecc_frm, int ecc_gps) { int prnGPS = 0, prnPTU = 0, prnSTS = 0; - int frm_ok = 0; + int ptu1e9 = 0; + int pos_ok = 0, + frm_ok = 0; + int rs_type = 54; - frm_ok = (ecc_frm >= 0 && len > pos_PTU_Trh+4); + pos_ok = (ecc_frm >= 0 && len > pos_STATUS+2); + frm_ok = (ecc_frm >= 0 && len > pos_F8); reset_gpx(gpx); @@ -398,14 +406,21 @@ static int print_position(gpx_t *gpx, int len, int ecc_frm, int ecc_gps) { } if (len > pos_PTU_Trh+4) { - get_PTU(gpx); + ptu1e9 = get_PTU(gpx); prnPTU = 1; } - if (len > 42+2) { - gpx->status = u2be(gpx->frame + 42); + if (len > pos_STATUS+2) { + gpx->status = u2be(gpx->frame + pos_STATUS); prnSTS = 1; } - + if (frm_ok) { + int pos; + int sum = 0; + for (pos = pos_STATUS+2; pos < pos_F8; pos++) { + sum += gpx->frame[pos]; + } + if (sum == 0 && (gpx->status&0xF0F)==0 && ptu1e9 == 3) rs_type = 50; + } if ( prnGPS && !gpx->option.slt ) { @@ -426,7 +441,7 @@ static int print_position(gpx_t *gpx, int len, int ecc_frm, int ecc_gps) { if (gpx->RH > -0.5f) fprintf(stdout, " RH=%.0f%% ", gpx->RH); } - // (GPS) status: 003E + // (imet54:GPS+PTU) status: 003E , (imet50:GPS); 0030 if (gpx->option.vbs && prnSTS) { fprintf(stdout, " [%04X] ", gpx->status); } @@ -443,10 +458,11 @@ static int print_position(gpx_t *gpx, int len, int ecc_frm, int ecc_gps) { // prnGPS,prnTPU if (gpx->option.jsn && frm_ok && (gpx->status&0x30)==0x30) { char *ver_jsn = NULL; + char *subtype = (rs_type == 54) ? "iMet-54" : "iMet-50"; unsigned long count_day = (unsigned long)(gpx->std*3600 + gpx->min*60 + gpx->sek+0.5); // (gpx->timems/1e3+0.5) has gaps fprintf(stdout, "{ \"type\": \"%s\"", "IMET5"); fprintf(stdout, ", \"frame\": %lu", count_day); - fprintf(stdout, ", \"id\": \"IMET54-%u\", \"datetime\": \"%02d:%02d:%06.3fZ\", \"lat\": %.5f, \"lon\": %.5f, \"alt\": %.5f", + fprintf(stdout, ", \"id\": \"IMET5-%u\", \"datetime\": \"%02d:%02d:%06.3fZ\", \"lat\": %.5f, \"lon\": %.5f, \"alt\": %.5f", gpx->SNu32, gpx->std, gpx->min, gpx->sek, gpx->lat, gpx->lon, gpx->alt); if (gpx->option.ptu) { if (gpx->T > -273.0f) { @@ -456,7 +472,7 @@ static int print_position(gpx_t *gpx, int len, int ecc_frm, int ecc_gps) { fprintf(stdout, ", \"humidity\": %.1f", gpx->RH ); } } - //fprintf(stdout, ", \"subtype\": \"%s\"", "IMET54"); + fprintf(stdout, ", \"subtype\": \"%s\"", subtype); // "IMET54"/"IMET50" if (gpx->jsn_freq > 0) { fprintf(stdout, ", \"freq\": %d", gpx->jsn_freq); } @@ -487,8 +503,6 @@ static void print_frame(gpx_t *gpx, int len, int b2B) { memset(bits8n1, 0, BITFRAME_LEN+10); memset(bits, 0, BITFRAME_LEN); - memset(bits, 0, BITFRAME_LEN); - de8n1(gpx->frame_bits, bits8n1, len); len = (8*len)/10; From 446d20a0b258dcb0f6a07d32b55f1a6f3e37f72b Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Mon, 6 Sep 2021 17:54:04 +0930 Subject: [PATCH 07/10] Fix regex for IMET5 --- auto_rx/autorx/__init__.py | 2 +- auto_rx/autorx/templates/index.html | 6 +++--- auto_rx/autorx/utils.py | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/auto_rx/autorx/__init__.py b/auto_rx/autorx/__init__.py index 40404458..d0b40276 100644 --- a/auto_rx/autorx/__init__.py +++ b/auto_rx/autorx/__init__.py @@ -17,7 +17,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.5.6-beta2" +__version__ = "1.5.6-beta3" # Global Variables diff --git a/auto_rx/autorx/templates/index.html b/auto_rx/autorx/templates/index.html index 69f694c4..8727116c 100644 --- a/auto_rx/autorx/templates/index.html +++ b/auto_rx/autorx/templates/index.html @@ -482,8 +482,8 @@ {title:'Freq (MHz)', field:"freq", headerSort:true}, {title:"ID", field:"id", width:125, headerSort:true, formatter:function(cell, formatterParams, onRendered){ _cell_data = cell.getData(); - _id = _cell_data.id.replace(/^(DFM|M10|M20|IMET|IMET54|MRZ)-/,""); - _sondehub_id = _cell_data.id.replace(/^(DFM|M10|M20|IMET|IMET54|MRZ)-/,""); + _id = _cell_data.id.replace(/^(DFM|M10|M20|IMET|IMET5|IMET54|MRZ)-/,""); + _sondehub_id = _cell_data.id.replace(/^(DFM|M10|M20|IMET|IMET5|IMET54|MRZ)-/,""); // Add Sondehub Link _id += " " + "" + ""; @@ -1644,7 +1644,7 @@

Decoder Control

- + diff --git a/auto_rx/autorx/utils.py b/auto_rx/autorx/utils.py index 9959f0e2..c9a01b59 100644 --- a/auto_rx/autorx/utils.py +++ b/auto_rx/autorx/utils.py @@ -145,7 +145,7 @@ def strip_sonde_serial(serial): """ Strip off any leading sonde type that may be present in a serial number """ # Look for serials with prefixes matching the following known sonde types. - _re = re.compile("^(DFM|M10|M20|IMET|IMET54|MRZ|LMS6)-") + _re = re.compile("^(DFM|M10|M20|IMET|IMET5|IMET54|MRZ|LMS6)-") # If we have a match, return the trailing part of the serial, re-adding # any - separators if they exist. @@ -182,7 +182,7 @@ def short_type_lookup(type_name): elif type_name == "IMET": return "Intermet Systems iMet-1/4" elif type_name == "IMET5": - return "Intermet Systems iMet-54" + return "Intermet Systems iMet-5x" elif type_name == "MEISEI": return "Meisei iMS-100/RS-11" elif type_name == "MRZ": @@ -216,7 +216,7 @@ def short_short_type_lookup(type_name): elif type_name == "IMET": return "iMet-1/4" elif type_name == "IMET5": - return "iMet-54" + return "iMet-5x" elif type_name == "MEISEI": return "iMS-100" elif type_name == "MRZ": @@ -269,6 +269,7 @@ def generate_aprs_id(sonde_data): # Use the last 5 characters of the unique ID we have generated. _object_name = "IMET" + sonde_data["id"][-5:] + elif "LMS" in sonde_data["type"]: # Use the last 5 hex digits of the sonde ID. _id_suffix = int(sonde_data["id"].split("-")[1]) From aac4b6a9a8be55dcd14205ef534c7ec111c7c8ff Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Sun, 12 Sep 2021 10:11:48 +0930 Subject: [PATCH 08/10] Rebase LMS6 decoder to handle newer LMS6 sondes, bump version --- auto_rx/autorx/__init__.py | 2 +- demod/mod/lms6Xmod.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/auto_rx/autorx/__init__.py b/auto_rx/autorx/__init__.py index d0b40276..94c198b8 100644 --- a/auto_rx/autorx/__init__.py +++ b/auto_rx/autorx/__init__.py @@ -17,7 +17,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.5.6-beta3" +__version__ = "1.5.6-beta4" # Global Variables diff --git a/demod/mod/lms6Xmod.c b/demod/mod/lms6Xmod.c index 884cc4e7..cf3265b4 100644 --- a/demod/mod/lms6Xmod.c +++ b/demod/mod/lms6Xmod.c @@ -108,6 +108,7 @@ static ui8_t rs_sync[] = { 0x00, 0x58, 0xf3, 0x3f, 0xb8}; static char blk_syncbits[] = "0000000000000000""0000001101011101""0100100111000010""0100111111110010""0110100001101011"; static ui8_t frm_sync6[] = { 0x24, 0x54, 0x00, 0x00}; +//static ui8_t frm_sync6_05[] = { 0x24, 0x54, 0x00, 0x05}; static ui8_t frm_syncX[] = { 0x24, 0x46, 0x05, 0x00}; @@ -792,9 +793,14 @@ static int frmsync_6(gpx_t *gpx, ui8_t block_bytes[], int blk_pos) { int j; while ( blk_pos-SYNC_LEN < FRM_LEN ) { + int sf6_00 = 0; + int sf6_05 = 0; gpx->sf6 = 0; - for (j = 0; j < 4; j++) gpx->sf6 += (block_bytes[blk_pos+j] == frm_sync6[j]); - if (gpx->sf6 == 4) { + for (j = 0; j < 3; j++) gpx->sf6 += (block_bytes[blk_pos+j] == frm_sync6[j]); + sf6_00 = gpx->sf6 + (block_bytes[blk_pos+3] == 0x00); + sf6_05 = gpx->sf6 + (block_bytes[blk_pos+3] == 0x05); + if (sf6_00 == 4 || sf6_05 == 4) { + gpx->sf6 = 4; gpx->frm_pos = 0; break; } @@ -919,9 +925,14 @@ static void proc_frame(gpx_t *gpx, int len) { if (gpx->sfX < 4) { //blk_pos = SYNC_LEN; while ( blk_pos-SYNC_LEN < FRM_LEN ) { + int sf6_00 = 0; + int sf6_05 = 0; gpx->sf6 = 0; - for (j = 0; j < 4; j++) gpx->sf6 += (block_bytes[blk_pos+j] == frm_sync6[j]); - if (gpx->sf6 == 4) { + for (j = 0; j < 3; j++) gpx->sf6 += (block_bytes[blk_pos+j] == frm_sync6[j]); + sf6_00 = gpx->sf6 + (block_bytes[blk_pos+3] == 0x00); + sf6_05 = gpx->sf6 + (block_bytes[blk_pos+3] == 0x05); + if (sf6_00 == 4 || sf6_05 == 4) { + gpx->sf6 = 4; gpx->frm_pos = 0; if (gpx->auto_detect) { gpx->typ = 6; gpx->reset_dsp = 1; } break; From 18ac41efe568475ceb3beb7f68dab89f412b2492 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Sun, 12 Sep 2021 18:30:03 +0930 Subject: [PATCH 09/10] LMS6-403 subtypes --- auto_rx/autorx/__init__.py | 2 +- auto_rx/autorx/sondehub.py | 6 ++---- auto_rx/autorx/utils.py | 4 ++-- demod/mod/lms6Xmod.c | 40 +++++++++++++++++++++++++------------- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/auto_rx/autorx/__init__.py b/auto_rx/autorx/__init__.py index 94c198b8..aa34a47b 100644 --- a/auto_rx/autorx/__init__.py +++ b/auto_rx/autorx/__init__.py @@ -17,7 +17,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.5.6-beta4" +__version__ = "1.5.6-beta5" # Global Variables diff --git a/auto_rx/autorx/sondehub.py b/auto_rx/autorx/sondehub.py index 998eccf6..bfd6a06b 100644 --- a/auto_rx/autorx/sondehub.py +++ b/auto_rx/autorx/sondehub.py @@ -181,10 +181,8 @@ def reformat_data(self, telemetry): elif telemetry["type"] == "LMS6": _output["manufacturer"] = "Lockheed Martin" - if "LMSX" in telemetry["id"]: - _output["type"] = "LMSX-400" - else: - _output["type"] = "LMS6-400" + _output["type"] = "LMS6-403" + _output["subtype"] = telemetry["subtype"] _output["serial"] = telemetry["id"].split("-")[1] elif telemetry["type"] == "MK2LMS": diff --git a/auto_rx/autorx/utils.py b/auto_rx/autorx/utils.py index c9a01b59..5f9c67e3 100644 --- a/auto_rx/autorx/utils.py +++ b/auto_rx/autorx/utils.py @@ -176,7 +176,7 @@ def short_type_lookup(type_name): elif type_name.startswith("M20"): return "Meteomodem M20" elif type_name == "LMS6": - return "Lockheed Martin LMS6-400" + return "Lockheed Martin LMS6-403" elif type_name == "MK2LMS": return "Lockheed Martin LMS6-1680" elif type_name == "IMET": @@ -210,7 +210,7 @@ def short_short_type_lookup(type_name): elif type_name.startswith("M20"): return "M20" elif type_name == "LMS6": - return "LMS6-400" + return "LMS6-403" elif type_name == "MK2LMS": return "LMS6-1680" elif type_name == "IMET": diff --git a/demod/mod/lms6Xmod.c b/demod/mod/lms6Xmod.c index cf3265b4..01633443 100644 --- a/demod/mod/lms6Xmod.c +++ b/demod/mod/lms6Xmod.c @@ -576,8 +576,8 @@ static int get_GPSlat(gpx_t *gpx) { for (i = 0; i < 4; i++) { gpslat |= gpslat_bytes[i] << (8*(3-i)); } - if (gpx->typ == 6) lat = gpslat / B60B60; - else /*typ==10*/ lat = gpslat / 1e7; + if ((gpx->typ & 0xFF) == 6) lat = gpslat / B60B60; + else /* gpx->typ == 10 */ lat = gpslat / 1e7; gpx->lat = lat; @@ -597,8 +597,8 @@ static int get_GPSlon(gpx_t *gpx) { gpslon |= gpslon_bytes[i] << (8*(3-i)); } - if (gpx->typ == 6) lon = gpslon / B60B60; - else /*typ==10*/ lon = gpslon / 1e7; + if ((gpx->typ & 0xFF) == 6) lon = gpslon / B60B60; + else /* gpx->typ == 10 */ lon = gpslon / 1e7; gpx->lon = lon; @@ -618,8 +618,8 @@ static int get_GPSalt(gpx_t *gpx) { gpsheight |= gpsheight_bytes[i] << (8*(3-i)); } - if (gpx->typ == 6) alt = gpsheight / 1000.0; - else /*typ==10*/ alt = gpsheight / 100.0; + if ((gpx->typ & 0xFF) == 6) alt = gpsheight / 1000.0; + else /* gpx->typ == 10 */ alt = gpsheight / 100.0; gpx->alt = alt; @@ -726,7 +726,7 @@ static void print_frame(gpx_t *gpx, int crc_err, int len) { get_GPSlat(gpx); get_GPSlon(gpx); err2 = get_GPSalt(gpx); - if (gpx->typ == 6) + if ((gpx->typ & 0xFF) == 6) { err1 = get_GPStime(gpx, crc_err); get_GPSvel24(gpx); @@ -764,15 +764,17 @@ static void print_frame(gpx_t *gpx, int crc_err, int len) { if (crc_err==0) { // CRC-OK // UTC oder GPS? char *ver_jsn = NULL; - char sntyp[] = "LMS6-"; - if (gpx->typ == 10) sntyp[3] = 'X'; + char sntyp[] = "LMS6-"; + char subtyp[] = "LMS6-403\0\0"; + if (gpx->typ == 10) { sntyp[3] = 'X'; subtyp[3] = 'X'; } + else if (gpx->typ == 0x0206) strcpy(subtyp, "LMS6-403-2"); printf("{ \"type\": \"%s\"", "LMS"); printf(", \"frame\": %d, \"id\": \"%s%d\", \"datetime\": \"", gpx->frnr, sntyp, gpx->sn ); //if (gpx->week > 0) printf("%04d-%02d-%02dT", gpx->jahr, gpx->monat, gpx->tag ); printf("%02d:%02d:%06.3fZ\", \"lat\": %.5f, \"lon\": %.5f, \"alt\": %.5f, \"vel_h\": %.5f, \"heading\": %.5f, \"vel_v\": %.5f", gpx->std, gpx->min, gpx->sek, gpx->lat, gpx->lon, gpx->alt, gpx->vH, gpx->vD, gpx->vV ); printf(", \"gpstow\": %d", gpx->gpstow ); - printf(", \"subtype\": \"%c\"", sntyp[3]); // "6":LMS6-403, "X":lms6X, "MK2A":LMS6-1680/Mk2a + printf(", \"subtype\": \"%s\"", subtyp); // "LMS6-403", "LMS6-403-2", "LMSX-403"; "MK2A":LMS6-1680/Mk2a if (gpx->jsn_freq > 0) { printf(", \"freq\": %d", gpx->jsn_freq); } @@ -802,6 +804,8 @@ static int frmsync_6(gpx_t *gpx, ui8_t block_bytes[], int blk_pos) { if (sf6_00 == 4 || sf6_05 == 4) { gpx->sf6 = 4; gpx->frm_pos = 0; + gpx->typ = 6; + if (sf6_05 == 4) gpx->typ |= 0x0200; break; } blk_pos++; @@ -871,7 +875,7 @@ static void proc_frame(gpx_t *gpx, int len) { blk_pos = SYNC_LEN; - if (gpx->typ == 6) + if ((gpx->typ & 0xFF) == 6) { if (gpx->option.ecc) { for (j = 0; j < rs_N; j++) rs_cw[rs_N-1-j] = block_bytes[SYNC_LEN+j]; @@ -934,7 +938,11 @@ static void proc_frame(gpx_t *gpx, int len) { if (sf6_00 == 4 || sf6_05 == 4) { gpx->sf6 = 4; gpx->frm_pos = 0; - if (gpx->auto_detect) { gpx->typ = 6; gpx->reset_dsp = 1; } + if (gpx->auto_detect) { + gpx->reset_dsp = 1; + gpx->typ = 6; + if (sf6_05 == 4) gpx->typ |= 0x0200; + } break; } blk_pos++; @@ -944,7 +952,11 @@ static void proc_frame(gpx_t *gpx, int len) { // LMS6: frm_rate = 4800.0 * FRAME_LEN/BLOCK_LEN = 4800*300/260 = 5538 // LMSX: delta_mp = 4797.8 (longer timesync-frames possible) if (gpx->frm_rate > 5000.0 || gpx->frm_rate < 4000.0) { // lms6-blocklen = 260/300 sr, sync wird ueberlesen ... - if (gpx->auto_detect) { gpx->typ = 6; gpx->reset_dsp = 1; } + if (gpx->auto_detect) { + gpx->reset_dsp = 1; + gpx->typ = 6; + //if (sf6_05 == 4) gpx->typ |= 0x0200; + } } } else @@ -1419,7 +1431,7 @@ int main(int argc, char **argv) { bitofs = bitofsX + shift; } - if (gpx->typ == 6) { + if ((gpx->typ & 0xFF) == 6) { // set lms6 rawbitblock_len = RAWBITBLOCK_LEN_6; dsp.br = (float)BAUD_RATE6; From af47a5e187357d44c104ade57a0092071c250cd9 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Sat, 18 Sep 2021 16:19:29 +0930 Subject: [PATCH 10/10] Bump version before merge --- auto_rx/autorx/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auto_rx/autorx/__init__.py b/auto_rx/autorx/__init__.py index aa34a47b..a4ec5a18 100644 --- a/auto_rx/autorx/__init__.py +++ b/auto_rx/autorx/__init__.py @@ -17,7 +17,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.5.6-beta5" +__version__ = "1.5.6" # Global Variables