kopia lustrzana https://github.com/inmcm/micropyGPS
Fixed uart_test.py to be just the UART test and added the good_sentences.py for checking which sentences fail parsing
rodzic
804c70d584
commit
f49c3dc83c
|
@ -0,0 +1,25 @@
|
||||||
|
from pyb import UART
|
||||||
|
from micropyGPS import MicropyGPS
|
||||||
|
|
||||||
|
uart = UART(3, 9600)
|
||||||
|
|
||||||
|
my_gps = MicropyGPS()
|
||||||
|
|
||||||
|
|
||||||
|
# Reads 300 sentences and reports how many were parsed and if any failed the CRC check
|
||||||
|
sentence_count = 0
|
||||||
|
while True:
|
||||||
|
if uart.any():
|
||||||
|
stat = my_gps.update(chr(uart.readchar()))
|
||||||
|
if stat:
|
||||||
|
print(stat)
|
||||||
|
stat = None
|
||||||
|
sentence_count += 1
|
||||||
|
if sentence_count == 300:
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
print('Sentences Found:', my_gps.clean_sentences)
|
||||||
|
print('Sentences Parsed:', my_gps.parsed_sentences)
|
||||||
|
print('CRC_Fails:', my_gps.crc_fails)
|
||||||
|
|
|
@ -1,29 +1,13 @@
|
||||||
from pyb import UART
|
from pyb import UART
|
||||||
from micropyGPS import MicropyGPS
|
|
||||||
|
|
||||||
|
# Setup the connection to your GPS here
|
||||||
|
# This example uses UART 3 with RX on pin Y10
|
||||||
|
# Baudrate is 9600bps, with the standard 8 bits, 1 stop bit, no parity
|
||||||
uart = UART(3, 9600)
|
uart = UART(3, 9600)
|
||||||
|
|
||||||
# Basic UART --> terminal printer, use to test your GPS module
|
# Basic UART --> terminal printer, use to test your GPS module
|
||||||
# while True:
|
|
||||||
# if uart.any():
|
|
||||||
# print(chr(uart.readchar()), end='')
|
|
||||||
|
|
||||||
|
|
||||||
my_gps = MicropyGPS()
|
|
||||||
|
|
||||||
sentence_count = 0
|
|
||||||
while True:
|
while True:
|
||||||
if uart.any():
|
if uart.any():
|
||||||
stat = my_gps.update(chr(uart.readchar()))
|
print(chr(uart.readchar()), end='')
|
||||||
if stat:
|
|
||||||
print(stat)
|
|
||||||
stat = None
|
|
||||||
sentence_count += 1
|
|
||||||
if sentence_count == 300:
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
print('Sentences Found:', my_gps.clean_sentences)
|
|
||||||
print('Sentences Parsed:', my_gps.parsed_sentences)
|
|
||||||
print('CRC_Fails:', my_gps.crc_fails)
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue