kopia lustrzana https://github.com/inmcm/micropyGPS
Changed exception handling and removed whitespaces
The whitespaces which were removed and messed up the git history were added again. Instead of catching all exceptions, we just now just catch the IndexError.pull/12/head
rodzic
cdd37a0ff7
commit
564031ffd3
|
@ -217,7 +217,7 @@ Beyond the pyBoard and ESP32, micropyGPS should run on other embedded platforms
|
|||
[Micropython]:https://micropython.org/
|
||||
[frozen module]:https://learn.adafruit.com/micropython-basics-loading-modules/frozen-modules
|
||||
[NMEA-0183]:http://aprs.gids.nl/nmea/
|
||||
[TinyGPS]:http://arduiniana.org/libraries/tinygps/
|
||||
[TinyGPS]:http://arduiniana.org/libraries/tinygps/
|
||||
[pyboard]:http://docs.micropython.org/en/latest/pyboard/pyboard/quickref.html
|
||||
[MTK_command]:https://github.com/inmcm/MTK_commands
|
||||
[Ultimate GPS Breakout]:http://www.adafruit.com/product/746
|
||||
|
|
|
@ -495,32 +495,23 @@ class MicropyGPS(object):
|
|||
if self.gps_segments[sats]:
|
||||
try:
|
||||
sat_id = int(self.gps_segments[sats])
|
||||
except ValueError:
|
||||
return False
|
||||
except Exception:
|
||||
except (ValueError,IndexError):
|
||||
return False
|
||||
|
||||
try: # elevation can be null (no value) when not tracking
|
||||
elevation = int(self.gps_segments[sats+1])
|
||||
except ValueError:
|
||||
elevation = None
|
||||
except Exception:
|
||||
except (ValueError,IndexError):
|
||||
elevation = None
|
||||
|
||||
try: # azimuth can be null (no value) when not tracking
|
||||
azimuth = int(self.gps_segments[sats+2])
|
||||
except ValueError:
|
||||
azimuth = None
|
||||
except Exception:
|
||||
except (ValueError,IndexError):
|
||||
azimuth = None
|
||||
|
||||
try: # SNR can be null (no value) when not tracking
|
||||
snr = int(self.gps_segments[sats+3])
|
||||
except ValueError:
|
||||
except (ValueError,IndexError):
|
||||
snr = None
|
||||
except Exception:
|
||||
snr = None
|
||||
|
||||
# If no PRN is found, then the sentence has no more satellites to read
|
||||
else:
|
||||
break
|
||||
|
|
Ładowanie…
Reference in New Issue