mirror of
https://codeberg.org/ET-Kiel/tk102gpx.git
synced 2026-06-28 07:29:51 +02:00
Compare commits
No commits in common. "6a3bef6e1a630f64e31e80968f3051ab0208a3b1" and "1712ebbded2d19a7a5d9cb8cab5b641ad087ae74" have entirely different histories.
6a3bef6e1a
...
1712ebbded
2 changed files with 9 additions and 14 deletions
2
Makefile
2
Makefile
|
|
@ -9,7 +9,7 @@ all: $(patsubst %, %.gpx, $(FILES))
|
||||||
./tk102gpx.py $(TIMELIMIT) $< > $@
|
./tk102gpx.py $(TIMELIMIT) $< > $@
|
||||||
|
|
||||||
nc%: tk102-%.log
|
nc%: tk102-%.log
|
||||||
./tk102cat.py -p 1020$* | tee -a $< | cat -v
|
(while true; do nc -lp 1020$* -w 999; done) | tee -a $< | cat -v
|
||||||
|
|
||||||
tail%: tk102-%.log
|
tail%: tk102-%.log
|
||||||
./tk102gpx.py $(TIMELIMIT) -CFf $< | tee tk102-$*.txt
|
./tk102gpx.py $(TIMELIMIT) -CFf $< | tee tk102-$*.txt
|
||||||
|
|
|
||||||
21
tk102gpx.py
21
tk102gpx.py
|
|
@ -57,18 +57,18 @@ for o,v in options:
|
||||||
print(f"--serial={serial}", file=sys.stderr)
|
print(f"--serial={serial}", file=sys.stderr)
|
||||||
|
|
||||||
tk_re = re.compile(b"".join((
|
tk_re = re.compile(b"".join((
|
||||||
b"(?P<SERIAL>23[0-9]+),",
|
b"(?P<SERIAL>23[0-9]+)?,",
|
||||||
b"(?P<PHONE>[^,]+(,[^,]*)?),",
|
b"(?P<PHONE>\+?[^,]+)?,",
|
||||||
b"GPRMC,",
|
b"GPRMC,",
|
||||||
b"(?P<TIME>[0-9]{6}(\.[0-9]+)?),",
|
b"(?P<TIME>[0-9]{6}(\.[0-9]+)?)?,",
|
||||||
b"(?P<AV>[AV]),",
|
b"(?P<AV>[AV])?,",
|
||||||
b"(?P<LAT>[0-9]+\.[0-9]+),",
|
b"(?P<LAT>[0-9]+\.[0-9]+)?,",
|
||||||
b"(?P<NS>[NS]),",
|
b"(?P<NS>[NS]),",
|
||||||
b"(?P<LON>[0-9]+\.[0-9]+),",
|
b"(?P<LON>[0-9]+\.[0-9]+)?,",
|
||||||
b"(?P<EW>[EW]),",
|
b"(?P<EW>[EW]),",
|
||||||
b"(?P<SOG>[0-9]+\.[0-9]+)?,",
|
b"(?P<SOG>[0-9]+\.[0-9]+)?,",
|
||||||
b"(?P<COG>[0-9]+\.[0-9]+)?,",
|
b"(?P<COG>[0-9]+\.[0-9]+)?,",
|
||||||
b"(?P<DATE>[0-9]{6}),",
|
b"(?P<DATE>[0-9]{6})?,",
|
||||||
b"(?P<VAR>[^,]+)?,",
|
b"(?P<VAR>[^,]+)?,",
|
||||||
b"(?P<WHAT>[^,]*,)?",
|
b"(?P<WHAT>[^,]*,)?",
|
||||||
b"A\*(?P<GPCKS>[0-9A-F][0-9A-F]),",
|
b"A\*(?P<GPCKS>[0-9A-F][0-9A-F]),",
|
||||||
|
|
@ -122,7 +122,6 @@ class TKGPX(gpxpy.gpx.GPX):
|
||||||
if not ndata:
|
if not ndata:
|
||||||
break
|
break
|
||||||
data += ndata
|
data += ndata
|
||||||
m = tk_re.search(data)
|
|
||||||
if m is None:
|
if m is None:
|
||||||
if not follow:
|
if not follow:
|
||||||
break
|
break
|
||||||
|
|
@ -157,7 +156,7 @@ class TKGPX(gpxpy.gpx.GPX):
|
||||||
print(f"Signal is {repr(rd['SIGNAL'])} at {rd['SERIAL']}", file=sys.stderr)
|
print(f"Signal is {repr(rd['SIGNAL'])} at {rd['SERIAL']}", file=sys.stderr)
|
||||||
|
|
||||||
if verbose>0 and rd["MESSAGE"]:
|
if verbose>0 and rd["MESSAGE"]:
|
||||||
print(f"MESSAGE is {repr(rd['MESSAGE'])} at {rd['SERIAL']}", file=sys.stderr)
|
print(f"MESAAGE is {repr(rd['MESSAGE'])} at {rd['SERIAL']}", file=sys.stderr)
|
||||||
|
|
||||||
pd = {
|
pd = {
|
||||||
"latitude": gprmc2deg(rd["LAT"], rd["NS"]),
|
"latitude": gprmc2deg(rd["LAT"], rd["NS"]),
|
||||||
|
|
@ -228,10 +227,6 @@ class TKGPX(gpxpy.gpx.GPX):
|
||||||
if follow and not raw and verbose < 2:
|
if follow and not raw and verbose < 2:
|
||||||
print(repr(point), file=sys.stderr)
|
print(repr(point), file=sys.stderr)
|
||||||
|
|
||||||
if verbose > 1:
|
|
||||||
sys.stdout.flush()
|
|
||||||
print(f"Unprocessed data: {len(data)} Bytes: {repr(data)}", file=sys.stderr)
|
|
||||||
|
|
||||||
def strorbytes(rd, f):
|
def strorbytes(rd, f):
|
||||||
if not f in rd:
|
if not f in rd:
|
||||||
return {}
|
return {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue