Skip to content

Commit

Permalink
fix: set GSA fix_stas_prn from 12 to 18
Browse files Browse the repository at this point in the history
Signed-off-by: Lachezar Lechev <[email protected]>
  • Loading branch information
elpiel committed Dec 8, 2023
1 parent 4e10c12 commit 8e737b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub struct Nmea {
pub pdop: Option<f32>,
/// Geoid separation in meters
pub geoid_separation: Option<f32>,
pub fix_satellites_prns: Option<Vec<u32, 12>>,
pub fix_satellites_prns: Option<Vec<u32, 18>>,
satellites_scan: [SatsPack; GnssType::COUNT],
required_sentences_for_nav: SentenceMask,
last_fix_time: Option<NaiveTime>,
Expand Down
12 changes: 6 additions & 6 deletions src/sentences/gsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub enum GsaMode2 {
pub struct GsaData {
pub mode1: GsaMode1,
pub mode2: GsaMode2,
pub fix_sats_prn: Vec<u32, 12>,
pub fix_sats_prn: Vec<u32, 18>,
pub pdop: Option<f32>,
pub hdop: Option<f32>,
pub vdop: Option<f32>,
Expand All @@ -53,15 +53,15 @@ pub struct GsaData {
/// This function is take from `nom`, see `nom::multi::many0`
/// with one difference - we use a [`heapless::Vec`]
/// because we want `no_std` & no `alloc`
fn many0<I, O, E, F>(mut f: F) -> impl FnMut(I) -> IResult<I, Vec<O, 12>, E>
fn many0<I, O, E, F>(mut f: F) -> impl FnMut(I) -> IResult<I, Vec<O, 18>, E>
where
I: Clone + InputLength,
F: Parser<I, O, E>,
E: ParseError<I>,
O: core::fmt::Debug,
{
move |mut i: I| {
let mut acc = Vec::<_, 12>::new();
let mut acc = Vec::<_, 18>::new();
loop {
let len = i.input_len();
match f.parse(i.clone()) {
Expand All @@ -81,11 +81,11 @@ where
}
}

fn gsa_prn_fields_parse(i: &str) -> IResult<&str, Vec<Option<u32>, 12>> {
fn gsa_prn_fields_parse(i: &str) -> IResult<&str, Vec<Option<u32>, 18>> {
many0(terminated(opt(number::<u32>), char(',')))(i)
}

type GsaTail = (Vec<Option<u32>, 12>, Option<f32>, Option<f32>, Option<f32>);
type GsaTail = (Vec<Option<u32>, 18>, Option<f32>, Option<f32>, Option<f32>);

fn do_parse_gsa_tail(i: &str) -> IResult<&str, GsaTail> {
let (i, prns) = gsa_prn_fields_parse(i)?;
Expand Down Expand Up @@ -129,7 +129,7 @@ fn do_parse_gsa(i: &str) -> IResult<&str, GsaData> {
_ => unreachable!(),
},
fix_sats_prn: {
let mut fix_sats_prn = Vec::<u32, 12>::new();
let mut fix_sats_prn = Vec::<u32, 18>::new();
for sat in tail.0.iter().flatten() {
fix_sats_prn.push(*sat).unwrap()
}
Expand Down

0 comments on commit 8e737b0

Please sign in to comment.