From 016e5cb98beef93094fb6c00f34532701768b2b2 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Sat, 28 Jul 2018 14:47:51 +0930 Subject: [PATCH] Add some error handling to telemetry parsing. Fix burst tooltip display. --- horusmapper.py | 15 +++++++++++---- templates/index.html | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/horusmapper.py b/horusmapper.py index ec61b9d..98067b9 100644 --- a/horusmapper.py +++ b/horusmapper.py @@ -453,9 +453,13 @@ def ozi_listener_callback(data): output['callsign'] = "Payload" output['time_dt'] = data['time'] - logging.info("OziMux Data: %.5f, %.5f %.1f" % (data['lat'], data['lon'], data['alt'])) + logging.info("OziMux Data: %.5f, %.5f, %.1f" % (data['lat'], data['lon'], data['alt'])) + + try: + handle_new_payload_position(output) + except Exception as e: + logging.error("Error Handling Payload Position - %s" % str(e)) - handle_new_payload_position(output) def udp_listener_summary_callback(data): @@ -469,7 +473,7 @@ def udp_listener_summary_callback(data): output['alt'] = data['altitude'] output['callsign'] = data['callsign'] - logging.info("Horus UDP Data: %.5f, %.5f %.1f" % (output['lat'], output['lon'], output['alt'])) + logging.info("Horus UDP Data: %.5f, %.5f, %.1f" % (output['lat'], output['lon'], output['alt'])) # Process the 'short time' value if we have been provided it. if 'time' in data.keys(): @@ -479,7 +483,10 @@ def udp_listener_summary_callback(data): # Otherwise use the current UTC time. output['time_dt'] = datetime.utcnow() - handle_new_payload_position(output) + try: + handle_new_payload_position(output) + except Exception as e: + logging.error("Error Handling Payload Position - %s" % str(e)) def udp_listener_car_callback(data): diff --git a/templates/index.html b/templates/index.html index d6e54b0..e916b71 100644 --- a/templates/index.html +++ b/templates/index.html @@ -617,13 +617,14 @@ } if(data.burst.length == 3){ // There is burst data! + var _burst_txt = _callsign + " Burst (" + data.burst[2].toFixed(0) + "m)"; if (balloon_positions[_callsign].burst_marker == null){ - var _burst_txt = _callsign + " Burst (" + data.burst[2].toFixed(0) + "m)"; balloon_positions[_callsign].burst_marker = L.marker(data.burst,{title:_burst_txt, icon: burstIcon}) .bindTooltip(_burst_txt,{permanent:false,direction:'right'}) .addTo(map); }else{ balloon_positions[_callsign].burst_marker.setLatLng(data.burst); + balloon_positions[_callsign].burst_marker.setTooltipContent(_burst_txt); } }else{ // No burst data, or we are in descent.