Changes in / [d3bfa78:ecee2e6]
- Location:
- src/python
- Files:
-
- 4 edited
-
bin/gnuboat (modified) (4 diffs)
-
bin/gnuboat-data-generator (modified) (1 diff)
-
bin/gnuboat-log-converter (modified) (3 diffs)
-
gnuboat/daemon/gpsdpoller.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/python/bin/gnuboat
rd3bfa78 recee2e6 31 31 import pynmea2 32 32 import traceback 33 import math34 33 35 34 from gnuboat import daemon … … 107 106 nmeafile.write('{}{}\r\n'.format(logsystemtime, str(pynmea2.RMC('GN', 'RMC', 108 107 (gpsTime.strftime("%H%M%S"), gpsStatus, 109 '{:02d}{ }'.format(latitude['degrees'], latitude['minutes']),108 '{:02d}{:s}'.format(latitude['degrees'], latitude['minutes']), 110 109 latitudeDirection, 111 '{:03d}{ }'.format(longitude['degrees'], longitude['minutes']),110 '{:03d}{:s}'.format(longitude['degrees'], longitude['minutes']), 112 111 longitudeDirection, 113 112 '{:04.1f}'.format(speedOverGround), '{:04.1f}'.format(courseOverGround), … … 121 120 122 121 def degreesDecimalToNmea(decimalDegrees): 123 degrees = int(math.floor(decimalDegrees))122 degrees = math.floor(decimalDegrees) 124 123 minutes = 60.0 * (decimalDegrees - degrees) 125 124 return { 'degrees': degrees, 'minutes': minutes} … … 214 213 215 214 # update rrd database for the webservice 216 daemon.rrd_update(rrdfile, 'N:{ }:{}:{}:{}:{}:{}:{}:{}'.format(215 daemon.rrd_update(rrdfile, 'N:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}'.format( 217 216 latitude, longitude, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix)) 218 217 -
src/python/bin/gnuboat-data-generator
rd3bfa78 recee2e6 103 103 gpsFix = 3 104 104 # update rrd database for the webservice 105 daemon.rrd_update(rrdfile, '{ }:{}:{}:{}:{}:{}:{}:{}:{}'.format(105 daemon.rrd_update(rrdfile, '{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}'.format( 106 106 current_time, latitude, longitude, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix)) 107 107 -
src/python/bin/gnuboat-log-converter
rd3bfa78 recee2e6 43 43 return int(string) 44 44 except ValueError as error: 45 print('INFO: Failed to convert value from line {} into numeric: {}\n Message: {}'.format(current_row, string, error))45 print('INFO: Failed to convert value from line %s into numeric: {:s}\n Message: {:s}'.format(current_row, string, error)) 46 46 return 0 47 47 … … 54 54 matches = regex_nmea_position.match(nmea_value) 55 55 if matches is None: 56 print('INFO: Failed to convert position value from line { } into decimal degrees: {}'.format(current_row, nmea_value))56 print('INFO: Failed to convert position value from line {:s} into decimal degrees: {:s}'.format(current_row, nmea_value)) 57 57 return 58 58 decimalDegrees = toFloat(matches.group(1), current_row) … … 109 109 'water_depth': None, 110 110 'water_temperature': None} 111 elif nmea_sentence.sentence_type == 'D PT' and last_row is not None:112 last_row['water_depth'] = toFloat(nmea_sentence.depth , current_row)111 elif nmea_sentence.sentence_type == 'DBT' and last_row is not None: 112 last_row['water_depth'] = toFloat(nmea_sentence.depth_meters, current_row) 113 113 elif nmea_sentence.sentence_type == 'MTW' and last_row is not None: 114 114 last_row['water_temperature'] = toFloat(nmea_sentence.temperature, current_row) -
src/python/gnuboat/daemon/gpsdpoller.py
rd3bfa78 recee2e6 40 40 if self._currentValue == None or self.gpsFix() < 2: 41 41 return 0 42 return self._currentValue. lat42 return self._currentValue.fix.latitude 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. lon50 return self._currentValue.fix.longitude 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. speed58 return self._currentValue.fix.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. track63 return self._currentValue.fix.track 64 64 65 65 def gpsFix(self): 66 if self._currentValue == None or 'mode' not in self._currentValue:66 if self._currentValue == None: 67 67 return 0 68 return self._currentValue. mode68 return self._currentValue.fix.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. time78 currentTime = self._currentValue.fix.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 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 92 self._currentValue = self._session.next() 97 93 except StopIteration: 98 94 break
Note:
See TracChangeset
for help on using the changeset viewer.
