Changes in / [d3bfa78:ecee2e6]


Ignore:
Location:
src/python
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/python/bin/gnuboat

    rd3bfa78 recee2e6  
    3131import pynmea2
    3232import traceback
    33 import math
    3433
    3534from gnuboat import daemon
    … …  
    107106        nmeafile.write('{}{}\r\n'.format(logsystemtime, str(pynmea2.RMC('GN', 'RMC',
    108107                                                     (gpsTime.strftime("%H%M%S"), gpsStatus,
    109                                                      '{:02d}{}'.format(latitude['degrees'], latitude['minutes']),
     108                                                     '{:02d}{:s}'.format(latitude['degrees'], latitude['minutes']),
    110109                                                     latitudeDirection,
    111                                                      '{:03d}{}'.format(longitude['degrees'], longitude['minutes']),
     110                                                     '{:03d}{:s}'.format(longitude['degrees'], longitude['minutes']),
    112111                                                     longitudeDirection,
    113112                                                     '{:04.1f}'.format(speedOverGround), '{:04.1f}'.format(courseOverGround),
    … …  
    121120
    122121def degreesDecimalToNmea(decimalDegrees):
    123     degrees = int(math.floor(decimalDegrees))
     122    degrees = math.floor(decimalDegrees)
    124123    minutes = 60.0 * (decimalDegrees - degrees)
    125124    return { 'degrees': degrees, 'minutes': minutes}
    … …  
    214213
    215214            # 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(
    217216                latitude, longitude, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix))
    218217
  • src/python/bin/gnuboat-data-generator

    rd3bfa78 recee2e6  
    103103        gpsFix = 3
    104104        # 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(
    106106                       current_time, latitude, longitude, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix))
    107107
  • src/python/bin/gnuboat-log-converter

    rd3bfa78 recee2e6  
    4343           return int(string)
    4444        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))
    4646           return 0
    4747
    … …  
    5454    matches = regex_nmea_position.match(nmea_value)
    5555    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))
    5757        return
    5858    decimalDegrees = toFloat(matches.group(1), current_row)
    … …  
    109109                            'water_depth': None,
    110110                            'water_temperature': None}
    111             elif nmea_sentence.sentence_type == 'DPT' 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)
    113113            elif nmea_sentence.sentence_type == 'MTW' and last_row is not None:
    114114                last_row['water_temperature'] = toFloat(nmea_sentence.temperature, current_row)
  • src/python/gnuboat/daemon/gpsdpoller.py

    rd3bfa78 recee2e6  
    4040        if self._currentValue == None or self.gpsFix() < 2:
    4141            return 0
    42         return self._currentValue.lat
     42        return self._currentValue.fix.latitude
    4343
    4444    def latitudeDirection(self):
    … …  
    4848        if self._currentValue == None or self.gpsFix() < 2:
    4949            return 0
    50         return self._currentValue.lon
     50        return self._currentValue.fix.longitude
    5151
    5252    def longitudeDirection(self):
    … …  
    5656        if self._currentValue == None or self.gpsFix() < 2:
    5757            return 0
    58         return self._currentValue.speed
     58        return self._currentValue.fix.speed
    5959
    6060    def courseOverGround(self):
    6161        if self._currentValue == None or self.gpsFix() < 2:
    6262            return 0
    63         return self._currentValue.track
     63        return self._currentValue.fix.track
    6464
    6565    def gpsFix(self):
    66         if self._currentValue == None or 'mode' not in self._currentValue:
     66        if self._currentValue == None:
    6767            return 0
    68         return self._currentValue.mode
     68        return self._currentValue.fix.mode
    6969
    7070    def status(self):
    … …  
    7676        if self._currentValue == None or self.gpsFix() < 2:
    7777            return None
    78         currentTime = self._currentValue.time
     78        currentTime = self._currentValue.fix.time
    7979        if isinstance(currentTime, float):
    8080            return datetime.datetime.fromtimestamp(currentTime)
    … …  
    9090                    if self._session is None:
    9191                        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()
    9793                except StopIteration:
    9894                    break
Note: See TracChangeset for help on using the changeset viewer.