Merge pull request #146 from darksidelemm/testing

Latch iMet serial numbers to avoid issues with iMet-1-RS units.
pull/149/head
Mark Jessop 2019-03-18 18:36:26 +10:30 zatwierdzone przez GitHub
commit 05c028b6a8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 21 dodań i 6 usunięć

Wyświetl plik

@ -467,7 +467,7 @@ def main():
# Start up the flask server.
# This needs to occur AFTER logging is setup, else logging breaks horribly for some reason.
start_flask(port=config['web_port'])
start_flask(host=config['web_host'], port=config['web_port'])
# If we have been supplied a frequency via the command line, override the whitelist settings
# to only include the supplied frequency.
@ -611,7 +611,7 @@ def main():
# within a cronjob.
if (_timeout > 0) and ((time.time()-_start_time) > _timeout):
logging.info("Shutdown time reached. Closing.")
stop_flask(port=config['web_port'])
stop_flask(host=config['web_host'], port=config['web_port'])
stop_all()
break
@ -624,11 +624,11 @@ if __name__ == "__main__":
main()
except KeyboardInterrupt:
# Upon CTRL+C, shutdown all threads and exit.
stop_flask(port=config['web_port'])
stop_flask(host=config['web_host'], port=config['web_port'])
stop_all()
except Exception as e:
# Upon exceptions, attempt to shutdown threads and exit.
traceback.print_exc()
print("Main Loop Error - %s" % str(e))
stop_flask(port=config['web_port'])
stop_flask(host=config['web_host'], port=config['web_port'])
stop_all()

Wyświetl plik

@ -84,6 +84,7 @@ def read_auto_rx_config(filename):
'station_beacon_comment': "radiosonde_auto_rx SondeGate v<version>",
'station_beacon_icon': '/r',
# Web Settings,
'web_host' : '0.0.0.0',
'web_port' : 5000,
'web_archive_age': 120,
# Advanced Parameters
@ -213,10 +214,12 @@ def read_auto_rx_config(filename):
# New settings added in 20180624.
try:
auto_rx_config['web_host'] = config.get('web', 'web_host')
auto_rx_config['web_port'] = config.getint('web', 'web_port')
auto_rx_config['web_archive_age'] = config.getint('web', 'archive_age')
except:
logging.error("Config - Missing Web Server settings. Using defaults.")
auto_rx_config['web_host'] = '0.0.0.0'
auto_rx_config['web_port'] = 5000
auto_rx_config['web_archive_age'] = 120
@ -312,4 +315,4 @@ if __name__ == '__main__':
config = read_auto_rx_config(sys.argv[1])
pprint.pprint(global_config)
pprint.pprint(global_config)

Wyświetl plik

@ -124,6 +124,12 @@ class SondeDecoder(object):
self.rs92_ephemeris = rs92_ephemeris
self.imet_location = imet_location
# iMet ID store. We latch in the first iMet ID we calculate, to avoid issues with iMet-1-RS units
# which don't necessarily have a consistent packet count to time increment ratio.
# This is a tradeoff between being able to handle multiple iMet sondes on a single frequency, and
# not flooding the various databases with sonde IDs in the case of a bad sonde.
self.imet_id = None
# This will become our decoder thread.
self.decoder = None
@ -434,7 +440,11 @@ class SondeDecoder(object):
# Fix up the time.
_telemetry['datetime_dt'] = imet_fix_datetime(_telemetry['datetime'])
# Generate a unique ID based on the power-on time and frequency, as iMet sondes don't send one.
_telemetry['id'] = imet_unique_id(_telemetry, custom=self.imet_location)
# Latch this ID and re-use it for the entire decode run.
if self.imet_id == None:
self.imet_id = imet_unique_id(_telemetry, custom=self.imet_location)
_telemetry['id'] = self.imet_id
# If we have been provided a telemetry filter function, pass the telemetry data

Wyświetl plik

@ -264,6 +264,8 @@ per_sonde_log = True
# WEB INTERFACE SETTINNGS #
###########################
[web]
# Server Host - Can be set to :: to listen on IPv6
web_host = 0.0.0.0
# Server Port - Ports below 1024 can only be used if you run auto_rx as root (not recommended)
web_port = 5000
# Archive Age - How long to keep a sonde telemetry in memory for the web client to access, in minutes