Changeset d3bfa78


Ignore:
Timestamp:
Sep 22, 2017, 8:29:35 AM (9 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, debian/jessie
Children:
0027f53
Parents:
ecee2e6 (diff), 873002d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch '0.5' into debian/jessie

Location:
src/python
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/python/bin/gnuboat

    recee2e6 rd3bfa78  
    3131import pynmea2
    3232import traceback
     33import math
    3334
    3435from gnuboat import daemon
    … …  
    106107        nmeafile.write('{}{}\r\n'.format(logsystemtime, str(pynmea2.RMC('GN', 'RMC',
    107108                                                     (gpsTime.strftime("%H%M%S"), gpsStatus,
    108                                                      '{:02d}{:s}'.format(latitude['degrees'], latitude['minutes']),
     109                                                     '{:02d}{}'.format(latitude['degrees'], latitude['minutes']),
    109110                                                     latitudeDirection,
    110                                                      '{:03d}{:s}'.format(longitude['degrees'], longitude['minutes']),
     111                                                     '{:03d}{}'.format(longitude['degrees'], longitude['minutes']),
    111112                                                     longitudeDirection,
    112113                                                     '{:04.1f}'.format(speedOverGround), '{:04.1f}'.format(courseOverGround),
    … …  
    120121
    121122def degreesDecimalToNmea(decimalDegrees):
    122     degrees = math.floor(decimalDegrees)
     123    degrees = int(math.floor(decimalDegrees))
    123124    minutes = 60.0 * (decimalDegrees - degrees)
    124125    return { 'degrees': degrees, 'minutes': minutes}
    … …  
    213214
    214215            # 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(
    216217                latitude, longitude, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix))
    217218
  • src/python/bin/gnuboat-data-generator

    recee2e6 rd3bfa78  
    103103        gpsFix = 3
    104104        # update rrd database for the webservice
    105         daemon.rrd_update(rrdfile, '{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}'.format(
     105        daemon.rrd_update(rrdfile, '{}:{}:{}:{}:{}:{}:{}:{}:{}'.format(
    106106                       current_time, latitude, longitude, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix))
    107107
  • src/python/bin/gnuboat-log-converter

    recee2e6 rd3bfa78  
    4343           return int(string)
    4444        except ValueError as error:
    45            print('INFO: Failed to convert value from line %s into numeric: {:s}\n      Message: {:s}'.format(current_row, string, error))
     45           print('INFO: Failed to convert value from line {} into numeric: {}\n      Message: {}'.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 {:s} into decimal degrees: {:s}'.format(current_row, nmea_value))
     56        print('INFO: Failed to convert position value from line {} into decimal degrees: {}'.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 == 'DBT' and last_row is not None:
    112                 last_row['water_depth'] = toFloat(nmea_sentence.depth_meters, current_row)
     111            elif nmea_sentence.sentence_type == 'DPT' and last_row is not None:
     112                last_row['water_depth'] = toFloat(nmea_sentence.depth, 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

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