Changeset 713b56e
- Timestamp:
- Sep 21, 2017, 7:32:01 PM (9 years ago)
- Branches:
- 0.5, debian/bullseye, debian/jessie, master
- Children:
- 873002d
- Parents:
- 9773514
- Location:
- src/python
- Files:
-
- 2 edited
-
bin/gnuboat (modified) (4 diffs)
-
gnuboat/daemon/gpsdpoller.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/python/bin/gnuboat
r9773514 r713b56e 31 31 import pynmea2 32 32 import traceback 33 import math 33 34 34 35 from gnuboat import daemon … … 106 107 nmeafile.write('{}{}\r\n'.format(logsystemtime, str(pynmea2.RMC('GN', 'RMC', 107 108 (gpsTime.strftime("%H%M%S"), gpsStatus, 108 '{:02d}{ :s}'.format(latitude['degrees'], latitude['minutes']),109 '{:02d}{}'.format(latitude['degrees'], latitude['minutes']), 109 110 latitudeDirection, 110 '{:03d}{ :s}'.format(longitude['degrees'], longitude['minutes']),111 '{:03d}{}'.format(longitude['degrees'], longitude['minutes']), 111 112 longitudeDirection, 112 113 '{:04.1f}'.format(speedOverGround), '{:04.1f}'.format(courseOverGround), … … 120 121 121 122 def degreesDecimalToNmea(decimalDegrees): 122 degrees = math.floor(decimalDegrees)123 degrees = int(math.floor(decimalDegrees)) 123 124 minutes = 60.0 * (decimalDegrees - degrees) 124 125 return { 'degrees': degrees, 'minutes': minutes} … … 213 214 214 215 # update rrd database for the webservice 215 daemon.rrd_update(rrdfile, 'N:{ :s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}'.format(216 daemon.rrd_update(rrdfile, 'N:{}:{}:{}:{}:{}:{}:{}:{}'.format( 216 217 latitude, longitude, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix)) 217 218 -
src/python/gnuboat/daemon/gpsdpoller.py
r9773514 r713b56e 40 40 if self._currentValue == None or self.gpsFix() < 2: 41 41 return 0 42 return self._currentValue. fix.latitude42 return self._currentValue.lat 43 43 44 44 def latitudeDirection(self): … … 48 48 if self._currentValue == None or self.gpsFix() < 2: 49 49 return 0 50 return self._currentValue. fix.longitude50 return self._currentValue.lon 51 51 52 52 def longitudeDirection(self): … … 56 56 if self._currentValue == None or self.gpsFix() < 2: 57 57 return 0 58 return self._currentValue. fix.speed58 return self._currentValue.speed 59 59 60 60 def courseOverGround(self): 61 61 if self._currentValue == None or self.gpsFix() < 2: 62 62 return 0 63 return self._currentValue. fix.track63 return self._currentValue.track 64 64 65 65 def gpsFix(self): 66 if self._currentValue == None :66 if self._currentValue == None or 'mode' not in self._currentValue: 67 67 return 0 68 return self._currentValue. fix.mode68 return self._currentValue.mode 69 69 70 70 def status(self): … … 76 76 if self._currentValue == None or self.gpsFix() < 2: 77 77 return None 78 currentTime = self._currentValue. fix.time78 currentTime = self._currentValue.time 79 79 if isinstance(currentTime, float): 80 80 return datetime.datetime.fromtimestamp(currentTime) … … 90 90 if self._session is None: 91 91 self._session = gps.gps(mode=gps.WATCH_ENABLE) 92 self._currentValue = self._session.next() 92 current_value = self._session.next() 93 # only update current value, if we got an epX entry 94 # dop entries are ignored right now 95 if 'mode' in current_value: 96 self._currentValue = current_value 93 97 except StopIteration: 94 98 break
Note:
See TracChangeset
for help on using the changeset viewer.
