Skip to content

Commit

Permalink
ext-gps: discard data after pps parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
gauteh committed Oct 2, 2024
1 parent 8da00fa commit 1061f88
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sfy-buoy/sfy-ext-gps/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,18 +488,23 @@ fn GPIO() {
Ok(w) => {
match w {
b'\n' => { break; },
w => { buf.push(w); }
w => { buf.push(w); } // TODO: abort if buf is full.
}
}

Err(nb::Error::WouldBlock) => { /* wait */ }
Err(nb::Error::WouldBlock) => { /* wait */ } // TODO: timeout
Err(nb::Error::Other(e)) => {
break;
}
}
}

// ready to parse `buf` (on main?).

// make sure there is nothing in the uart now, otherwise it should be drained.
while let Ok(_) = gps.read() {
defmt::error!("ext-gps: more data on uart after PPS parsing. discarding.");
}
});
}

Expand Down

0 comments on commit 1061f88

Please sign in to comment.