Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for parsing failure on some track lines #3

Merged
merged 3 commits into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cggtts/src/track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,14 @@ impl std::str::FromStr for Track {
let smdi = f64::from_str(items[16])? * 0.1E-12;

let (msio, smsi, isg, fr, hc, frc, ck) :
(Option<f64>,Option<f64>,Option<f64>,u8,u8,String,u8)
(Option<f64>,Option<f64>,Option<f64>,u8,u8,String,&str)
= match items.len() {
TRACK_WITHOUT_IONOSPHERIC => {
(None,None,None,
u8::from_str_radix(items[17], 16)?,
u8::from_str_radix(items[18], 10)?,
items[19].to_string(),
u8::from_str_radix(items[20], 16)?)
items[20])
},
TRACK_WITH_IONOSPHERIC => {
(Some(f64::from_str(items[17])? * 0.1E-9),
Expand All @@ -402,13 +402,13 @@ impl std::str::FromStr for Track {
u8::from_str_radix(items[20], 16)?,
u8::from_str_radix(items[21], 16)?,
items[22].to_string(),
u8::from_str_radix(items[23], 16)?)
items[23])
},
_ => return Err(Error::InvalidDataFormatError(String::from(cleanedup))),
};

// checksum
let end_pos = line.rfind(&format!("{:2X}",ck))
let end_pos = line.rfind(ck)
.unwrap(); // already matching
let _cksum = calc_crc(&line.split_at(end_pos-1).0)?;
// verification
Expand Down