From 8e1c48cd62100d14196b5d950e080dd005ceb875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Alexander=20Fellinghaug?= Date: Fri, 26 Oct 2018 10:29:22 +0200 Subject: [PATCH 1/4] ignore vscode stuff --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6292d33..c757128 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ output.dat # private config file config.yml *.db -.DS_Store \ No newline at end of file +.DS_Store +.vscode From 29a4acb207ca52bda39ccb87b575718a15961bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Alexander=20Fellinghaug?= Date: Wed, 31 Oct 2018 14:49:06 +0100 Subject: [PATCH 2/4] more ignores --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index c757128..9bfdaef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.pyc venv +venv3 # test files test_output.dat output.dat @@ -9,3 +10,4 @@ config.yml *.db .DS_Store .vscode +# ignore locale data folder From e8a5e828b9406b81bfe702634a9e77748eeef812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Alexander=20Fellinghaug?= Date: Wed, 31 Oct 2018 14:53:51 +0100 Subject: [PATCH 3/4] Addind GPS UTC fixes (max 5), then writing the last one to output stream --- ublox_mon/monitor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ublox_mon/monitor.py b/ublox_mon/monitor.py index c507a31..6271958 100644 --- a/ublox_mon/monitor.py +++ b/ublox_mon/monitor.py @@ -54,7 +54,7 @@ def __init__(self, device, output_prefix, db_path): # List of the last GPS fixes self._gps_fixes = deque([], 5) - self._gps_utc = None + self._gps_utc = deque([], 5) def rotate_output_file(self): """ @@ -123,8 +123,8 @@ def write(self, packet): last_gps_fix = self._gps_fixes[-1] else: last_gps_fix = {'lat': -1, 'lon': -1} - packet.update(last_gps_fix) + packet.update(last_gps_fix) packet["gps_ts"] = packet.get("utc") jam_ts = models.JamTimeseries(packet.get("timestamp_id"), @@ -196,7 +196,7 @@ def run(self, notify_callback=None): hour = msg.fields.get("hour") minutes = msg.fields.get("min") seconds = msg.fields.get("sec") - self._gps_utc = datetime.datetime(year, month, day, hour, minutes, seconds) + self._gps_utc.append(datetime.datetime(year, month, day, hour, minutes, seconds)) if msg.msg_type() == (ublox.CLASS_NAV, ublox.MSG_NAV_CLOCK): # log.debug("MSG-NAV-TIMEUTC: {}".format(msg.fields)) @@ -207,7 +207,7 @@ def run(self, notify_callback=None): packet = msg.fields packet['utc'] = datetime.datetime.now().replace(microsecond=0) - packet['gps_utc'] = self._gps_utc + packet['gps_utc'] = self._gps_utc[-1] packet['timestamp_id'] = self._next_id if 'jamInd' not in msg.fields: packet['jamInd'] = -1 From eacdd04d2d3a341fc297070f3fe7c8894c41ba7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Alexander=20Fellinghaug?= Date: Wed, 31 Oct 2018 15:15:53 +0100 Subject: [PATCH 4/4] Turns out that we already have 'agcCnt', just needed to included it in the output string --- ublox_mon/monitor.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ublox_mon/monitor.py b/ublox_mon/monitor.py index 6271958..8c57be6 100644 --- a/ublox_mon/monitor.py +++ b/ublox_mon/monitor.py @@ -93,7 +93,7 @@ def setup_output_file(self): if not os.path.exists(self._output): with open(self._output, 'a') as f: os.utime(self._output, None) - f.write("#id;utc;jamInd;lat;lon;gps_utc\n") + f.write("#id;utc;jamInd;agcCnt;lat;lon;gps_utc\n") self._file = open(self._output, 'a+') @@ -132,7 +132,7 @@ def write(self, packet): packet.get("lon"), packet.get("gps_ts")) self._session.add(jam_ts) - fmt = "{timestamp_id};{utc};{jamInd};{lat};{lon};{gps_utc}\n" + fmt = "{timestamp_id};{utc};{jamInd};{agcCnt};{lat};{lon};{gps_utc}\n" self._file.write(fmt.format(**packet)) def close(self): @@ -214,9 +214,6 @@ def run(self, notify_callback=None): packet['lat'] = 0 packet['lon'] = 0 - # TODO: Hent ut 'agcCnt' og logg. - # >> AGC Monitor (counts SIGHI xor SIGLO, range 0 to 8191) - log.debug("{}: {}".format(self._next_id, packet)) # Write data to timeseries output file