Add listener position to telemetry

pull/374/head
Mark Jessop 2021-01-30 22:30:45 +10:30
rodzic bf2d6ad0f4
commit a6ca45461c
2 zmienionych plików z 19 dodań i 2 usunięć

Wyświetl plik

@ -888,8 +888,19 @@ def main():
exporter_functions.append(_rotator.add) exporter_functions.append(_rotator.add)
if config["sondehub_enabled"]: if config["sondehub_enabled"]:
if config["habitat_upload_listener_position"] is False:
_sondehub_station_position = None
else:
_sondehub_station_position = (
config["station_lat"],
config["station_lon"],
config["station_alt"],
)
_sondehub = SondehubUploader( _sondehub = SondehubUploader(
user_callsign=config["habitat_uploader_callsign"], user_callsign=config["habitat_uploader_callsign"],
user_position=_sondehub_station_position,
user_antenna=config["habitat_uploader_antenna"],
upload_rate=config["habitat_upload_rate"], upload_rate=config["habitat_upload_rate"],
) )

Wyświetl plik

@ -59,6 +59,8 @@ class SondehubUploader(object):
upload_timeout=20, upload_timeout=20,
upload_retries=5, upload_retries=5,
user_callsign="N0CALL", user_callsign="N0CALL",
user_position=None,
user_antenna=""
): ):
""" Initialise and start a Sondehub uploader """ Initialise and start a Sondehub uploader
@ -72,6 +74,8 @@ class SondehubUploader(object):
self.upload_timeout = upload_timeout self.upload_timeout = upload_timeout
self.upload_retries = upload_retries self.upload_retries = upload_retries
self.user_callsign = user_callsign self.user_callsign = user_callsign
self.user_position = user_position
self.user_antenna = user_antenna
# Input Queue. # Input Queue.
self.input_queue = Queue() self.input_queue = Queue()
@ -91,7 +95,7 @@ class SondehubUploader(object):
# Attempt to reformat the data. # Attempt to reformat the data.
_telem = self.reformat_data(telemetry) _telem = self.reformat_data(telemetry)
# self.log_debug("Telem: %s" % str(_telem)) self.log_debug("Telem: %s" % str(_telem))
# Add it to the queue if we are running. # Add it to the queue if we are running.
if self.input_processing_running and _telem: if self.input_processing_running and _telem:
@ -107,6 +111,8 @@ class SondehubUploader(object):
"software_name": "radiosonde_auto_rx", "software_name": "radiosonde_auto_rx",
"software_version": autorx.__version__, "software_version": autorx.__version__,
"uploader_callsign": self.user_callsign, "uploader_callsign": self.user_callsign,
"uploader_position": self.user_position,
"uploader_antenna": self.user_antenna,
"time_received": datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.%fZ") "time_received": datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.%fZ")
} }
@ -285,7 +291,7 @@ class SondehubUploader(object):
_upload_success = False _upload_success = False
_start_time = time.time() _start_time = time.time()
while _retries < self.upload_retries: while _retries < self.upload_retries:
# Run the request. # Run the request.
try: try: