Skip to content

Commit

Permalink
Merge pull request #575 from projecthorus/testing
Browse files Browse the repository at this point in the history
v1.5.6 release.
  • Loading branch information
darksidelemm authored Sep 18, 2021
2 parents e9be378 + 5316aa2 commit edf32f5
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 95 deletions.
2 changes: 1 addition & 1 deletion auto_rx/autorx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"


# Global Variables
Expand Down
2 changes: 1 addition & 1 deletion auto_rx/autorx/decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
7 changes: 6 additions & 1 deletion auto_rx/autorx/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -143,7 +148,7 @@ def telemetry_to_string(self, telemetry):
telemetry["temp"],
telemetry["humidity"],
telemetry["pressure"],
telemetry["type"],
_type,
telemetry["freq_float"],
)

Expand Down
11 changes: 6 additions & 5 deletions auto_rx/autorx/sondehub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -199,8 +197,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"
Expand Down
6 changes: 3 additions & 3 deletions auto_rx/autorx/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 += "&nbsp;<a href='http://sondehub.org/" + _sondehub_id + "' title='View on Sondehub' target='_blank'>" + "<img src='{{ url_for('static', filename='img/sondehub.png')}}'/>" + "</a>";
Expand Down Expand Up @@ -1644,7 +1644,7 @@ <h2>Decoder Control</h2>
<option value="LMS6">LMS6 (400 MHz)</option>
<option value="MK2LMS">LMS6 (1680 MHz)</option>
<option value="IMET">iMet-4</option>
<option value="IMET5">iMet-53</option>
<option value="IMET5">iMet-50/54</option>
<option value="MEISEI">iMS-100</option>
<option value="MRZ">MRZ-H1</option>
</select>
Expand Down
21 changes: 11 additions & 10 deletions auto_rx/autorx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ 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:
# User is on latest testing branch 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"
Expand All @@ -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.
Expand Down Expand Up @@ -176,13 +176,13 @@ 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":
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":
Expand Down Expand Up @@ -210,13 +210,13 @@ 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":
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":
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -299,18 +300,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
"""
Expand Down
52 changes: 33 additions & 19 deletions demod/mod/imet54mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)?
Expand All @@ -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) {
Expand Down Expand Up @@ -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);

Expand All @@ -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 )
{
Expand All @@ -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);
}
Expand All @@ -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) {
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit edf32f5

Please sign in to comment.