kopia lustrzana https://github.com/projecthorus/horusdemodlib
Handle EOF properly, handle no internet a bit better too
rodzic
ba24b76353
commit
3ad81e0094
|
@ -1 +1 @@
|
|||
__version__ = "0.3.6"
|
||||
__version__ = "0.3.7"
|
||||
|
|
|
@ -232,7 +232,7 @@ class HabitatUploader(object):
|
|||
try:
|
||||
self.habitat_upload_queue.put_nowait(sentence)
|
||||
except Exception as e:
|
||||
logging.error("Error adding sentence to queue: %s" % str(e))
|
||||
logging.error("Habitat - Error adding sentence to queue, queue full.")
|
||||
|
||||
def close(self):
|
||||
""" Shutdown uploader thread. """
|
||||
|
|
|
@ -180,6 +180,10 @@ class SondehubAmateurUploader(object):
|
|||
_output["lon"] = telemetry["longitude"]
|
||||
_output["alt"] = telemetry["altitude"]
|
||||
|
||||
if (_output["lat"] == 0.0) and (_output["lon"] == 0.0):
|
||||
self.log_error("Lat/Lon both 0.0 - not uploading telemetry.")
|
||||
return None
|
||||
|
||||
# # Optional Fields
|
||||
if "temperature" in telemetry:
|
||||
if telemetry["temperature"] > -273.15:
|
||||
|
@ -188,6 +192,10 @@ class SondehubAmateurUploader(object):
|
|||
if "satellites" in telemetry:
|
||||
_output["sats"] = telemetry["satellites"]
|
||||
|
||||
if _output["sats"] == 0:
|
||||
self.log_error("Satellites field provided, and is 0. Not uploading due to potentially inaccurate position.")
|
||||
return None
|
||||
|
||||
if "battery_voltage" in telemetry:
|
||||
if telemetry["battery_voltage"] >= 0.0:
|
||||
_output["batt"] = telemetry["battery_voltage"]
|
||||
|
@ -372,7 +380,8 @@ class SondehubAmateurUploader(object):
|
|||
headers=headers,
|
||||
)
|
||||
except Exception as e:
|
||||
self.log_error("Upload Failed: %s" % str(e))
|
||||
self.log_error("Station position upload failed: %s" % str(e))
|
||||
self.last_user_position_upload = time.time()
|
||||
return
|
||||
|
||||
if _req.status_code == 200:
|
||||
|
|
|
@ -158,7 +158,7 @@ def main():
|
|||
|
||||
if (data == ''):
|
||||
# Empty line means stdin has been closed.
|
||||
logging.info("Caught EOF, exiting.")
|
||||
logging.critical("Caught EOF (rtl_fm / horus_demod processes have exited, maybe because there's no RTLSDR?), exiting.")
|
||||
break
|
||||
|
||||
# Otherwise, strip any newlines, and continue.
|
||||
|
@ -250,6 +250,7 @@ def main():
|
|||
logging.info("Caught CTRL-C, exiting.")
|
||||
|
||||
habitat_uploader.close()
|
||||
sondehub_uploader.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "horusdemodlib"
|
||||
version = "0.3.6"
|
||||
version = "0.3.7"
|
||||
description = "Project Horus HAB Telemetry Demodulators"
|
||||
authors = ["Mark Jessop"]
|
||||
license = "LGPL-2.1-or-later"
|
||||
|
|
Ładowanie…
Reference in New Issue