gpsd python error (#352)

gpsd script occasionally results in python error.
cause: the expected info from GPS unit on each update has more than 10 lines, therefore, python didn't find the expected wording and result in a python error
correction: increase the line from gpspipe from 10 to 20 lines
This commit is contained in:
Kanok Chantrasmi
2021-03-06 01:01:57 +01:00
committed by GitHub
parent 7a757ba70b
commit ff8eba473e
+2 -2
View File
@@ -26,7 +26,7 @@ TMPFILE=$(mktemp)
trap "rm -f $TMPFILE" 0 2 3 15
# Write GPSPIPE Data to Temp File
$BIN_GPIPE -w -n 10 > $TMPFILE
$BIN_GPIPE -w -n 20 > $TMPFILE
# Parse Temp file for GPSD Data
VERSION=`cat $TMPFILE | $BIN_GREP -m 1 "VERSION" | $BIN_PYTHON -c 'import sys,json;print json.load(sys.stdin)["rev"]'`
@@ -42,4 +42,4 @@ SATSUSED=`cat $TMPFILE | $BIN_GREP -m 1 "SKY" | $BIN_PYTHON -c 'import sys,json;
# Output info for SNMP Extend
echo '{"data":{"mode":"'$GPSDMODE'", "hdop":"'$HDOP'", "vdop":"'$VDOP'", "latitude":"'$LAT'", "longitude":"'$LONG'", "altitude":"'$ALT'", "satellites":"'$SATS'", "satellites_used":"'$SATSUSED'"}, "error":"0", "errorString":"", "version":"'$VERSION'"}'
rm $TMPFILE
rm $TMPFILE