projects
/
gps-watch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
application: Factor out the configure_push_buttons() function.
[gps-watch.git]
/
src
/
common
/
gps.rs
diff --git
a/src/common/gps.rs
b/src/common/gps.rs
index b9fcbc3f23d9a732676082fbc3cccac4d2535310..64772c775189526e06bec8cb8b604e8e7055c427 100644
(file)
--- a/
src/common/gps.rs
+++ b/
src/common/gps.rs
@@
-209,13
+209,17
@@
impl Gps {
let hexdigits = b"0123456789abcdef";
while let Some(received) = try_read() {
let hexdigits = b"0123456789abcdef";
while let Some(received) = try_read() {
+ if received == b'$' {
+ self.state = ParseState::InPacket;
+ self.offset = 0;
+ self.checksum = 0x00;
+
+ continue;
+ }
+
match self.state {
ParseState::Start => {
match self.state {
ParseState::Start => {
- if received == b'$' {
- self.state = ParseState::InPacket;
- self.offset = 0;
- self.checksum = 0x00;
- }
+ // Empty.
},
ParseState::InPacket => {
if received == b'*' {
},
ParseState::InPacket => {
if received == b'*' {
@@
-343,8
+347,16
@@
impl Gps {
return false;
}
return false;
}
- if pos_fix_indicator != b"1" {
- return false;
+ match pos_fix_indicator {
+ b"1" => {
+ // Valid standard GPS fix (low resolution).
+ },
+ b"2" => {
+ // Valid differential GPS fix (high resolution).
+ },
+ _ => {
+ return false;
+ }
}
if utc_time.len() < 6 {
}
if utc_time.len() < 6 {