Add try/catch around az_map's parsing.

This commit is contained in:
Nick Foster 2013-06-18 11:45:58 -07:00
parent d508b39b31
commit 29f8a2c1b4

View File

@ -26,6 +26,7 @@ from PyQt4 import QtCore, QtGui
import threading import threading
import math import math
import air_modes import air_modes
from air_modes.exceptions import *
# model has max range vs. azimuth in n-degree increments # model has max range vs. azimuth in n-degree increments
@ -174,6 +175,7 @@ class az_map_output(air_modes.parse):
self.model = model self.model = model
def output(self, msg): def output(self, msg):
try:
[data, ecc, reference, timestamp] = msg.split() [data, ecc, reference, timestamp] = msg.split()
data = air_modes.modes_reply(long(data, 16)) data = air_modes.modes_reply(long(data, 16))
ecc = long(ecc, 16) ecc = long(ecc, 16)
@ -192,6 +194,8 @@ class az_map_output(air_modes.parse):
(altitude, decoded_lat, decoded_lon, distance, bearing) = self.parseBDS05(data) (altitude, decoded_lat, decoded_lon, distance, bearing) = self.parseBDS05(data)
self.model.addRecord(bearing, altitude, distance) self.model.addRecord(bearing, altitude, distance)
except ADSBError:
pass
############################## ##############################