Merge remote-tracking branch 'upstream/testing' into testing

pull/120/head
Mark Jessop 2019-02-27 20:12:08 +10:30
commit 745321d931
2 zmienionych plików z 36 dodań i 5 usunięć

Wyświetl plik

@ -358,9 +358,8 @@ def telemetry_filter(telemetry):
# ~2025-2030, so have expanded the regex to match (and also support some older RS92s)
vaisala_callsign_valid = re.match(r'[E-Z][0-5][\d][1-7]\d{4}', _serial)
# Regex to check DFM06/09 callsigns.
# TODO: Check if this valid for DFM06s, and find out what's up with the 8-digit DFM09 callsigns.
dfm_callsign_valid = re.match(r'DFM0[69]-\d{6}', _serial)
# Regex to check DFM06/09/15/17 callsigns.
dfm_callsign_valid = re.match(r'DFM[01][5679]-\d{6}', _serial)
if vaisala_callsign_valid or dfm_callsign_valid or 'M10' in telemetry['type']:
return True

Wyświetl plik

@ -42,13 +42,25 @@ def telemetry_to_aprs_position(sonde_data, object_name="<id>", aprs_comment="BOM
elif sonde_data['type'] == 'DFM':
# The DFM sonde IDs are too long to use directly.
# Grab the last six digits of the sonde ID (which is the serial number)
# TODO: Align this with whatever other decoders do.
_id_suffix = sonde_data['id'][-6:]
if "DFM09" in sonde_data['id']:
_object_name = "DF9" + _id_suffix
else:
sonde_data['type'] = 'DFM09'
elif "DFM06" in sonde_data['id']:
_object_name = "DF6" + _id_suffix
sonde_data['type'] = 'DFM06'
elif "DFM15" in sonde_data['id']:
_object_name = "DF5" + _id_suffix
sonde_data['type'] = 'DFM15'
elif "DFM17" in sonde_data['id']:
_object_name = "DF7" + _id_suffix
sonde_data['type'] = 'DFM17'
else:
return (None, None)
elif 'M10' in sonde_data['type']:
# Use the generated id same as dxlARPS
# Use the generated id same as dxlAPRS
_object_name = sonde_data['dxlid']
# New Sonde types will be added in here.
else:
@ -566,4 +578,24 @@ class APRSUploader(object):
if __name__ == "__main__":
# Some unit tests for the APRS packet generation code.
# ['frame', 'id', 'datetime', 'lat', 'lon', 'alt', 'temp', 'type', 'freq', 'freq_float', 'datetime_dt']
test_telem = [
{'id':'DFM06-123456', 'frame':10, 'lat':-10.0, 'lon':10.0, 'alt':10000, 'temp':1.0, 'type':'DFM', 'freq':'401.520 MHz', 'freq_float':401.52, 'heading':0.0, 'vel_h':5.1, 'vel_v':-5.0, 'datetime_dt':datetime.datetime.utcnow()},
{'id':'DFM09-123456', 'frame':10, 'lat':-10.0, 'lon':10.0, 'alt':10000, 'temp':1.0, 'type':'DFM', 'freq':'401.520 MHz', 'freq_float':401.52, 'heading':0.0, 'vel_h':5.1, 'vel_v':-5.0, 'datetime_dt':datetime.datetime.utcnow()},
{'id':'DFM15-123456', 'frame':10, 'lat':-10.0, 'lon':10.0, 'alt':10000, 'temp':1.0, 'type':'DFM', 'freq':'401.520 MHz', 'freq_float':401.52, 'heading':0.0, 'vel_h':5.1, 'vel_v':-5.0, 'datetime_dt':datetime.datetime.utcnow()},
{'id':'DFM17-12345678', 'frame':10, 'lat':-10.0, 'lon':10.0, 'alt':10000, 'temp':1.0, 'type':'DFM', 'freq':'401.520 MHz', 'freq_float':401.52, 'heading':0.0, 'vel_h':5.1, 'vel_v':-5.0, 'datetime_dt':datetime.datetime.utcnow()},
{'id':'N1234567', 'frame':10, 'lat':-10.0, 'lon':10.0, 'alt':10000, 'temp':1.0, 'type':'RS41', 'freq':'401.520 MHz', 'freq_float':401.52, 'heading':0.0, 'vel_h':5.1, 'vel_v':-5.0, 'datetime_dt':datetime.datetime.utcnow()},
{'id':'M1234567', 'frame':10, 'lat':-10.0, 'lon':10.0, 'alt':10000, 'temp':1.0, 'type':'RS92', 'freq':'401.520 MHz', 'freq_float':401.52, 'heading':0.0, 'vel_h':5.1, 'vel_v':-5.0, 'datetime_dt':datetime.datetime.utcnow()},
]
comment_field = "Clb=<vel_v> t=<temp> <freq> Type=<type> Radiosonde http://bit.ly/2Bj4Sfk"
for _telem in test_telem:
out_str = telemetry_to_aprs_position(_telem, object_name="<id>", aprs_comment=comment_field, position_report=False)
print(out_str)