Skip to content

Commit

Permalink
Merge branch 'main' into feat/gst-sentence
Browse files Browse the repository at this point in the history
  • Loading branch information
elpiel committed May 5, 2024
2 parents 61f33ee + 2f9cf42 commit 24af86b
Show file tree
Hide file tree
Showing 8 changed files with 337 additions and 68 deletions.
104 changes: 41 additions & 63 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[workspace]
members = [".", "benches-harness"]

[package]
name = "nmea"
version = "0.6.0"
Expand Down Expand Up @@ -64,7 +67,7 @@ defmt-03 = ["dep:defmt", "heapless/defmt-03"]

all-sentences = ["GNSS", "waypoint", "maritime", "water", "vendor-specific", "other"]
# GNSS specific sentences related to the possition or speed relative to the ground
GNSS = ["ALM", "GBS", "GGA", "GLL", "GNS", "GSA", "GST", "GSV", "RMC", "VTG"]
GNSS = ["APA", "ALM", "GBS", "GGA", "GLL", "GNS", "GSA", "GST", "GSV", "RMC", "VTG"]

waypoint = ["AAM", "BOD", "BWC", "BWW", "WNC", "ZFO", "ZTG"]
maritime = ["waypoint", "water"]
Expand All @@ -80,6 +83,10 @@ AAM = []
# feature: GNSS
ALM = []

# APA - Autopilot Sentence "A"
# feature: GNSS
APA = []

# BOD - Bearing - Waypoint to Waypoint
# feature: waypoint
BOD = []
Expand Down Expand Up @@ -182,6 +189,3 @@ required-features = ["all-sentences"]
[[test]]
name = "functional_tests"
required-features = ["all-sentences"]

[workspace]
members = [".", "benches-harness"]
11 changes: 11 additions & 0 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ pub fn parse_nmea_sentence(sentence: &str) -> core::result::Result<NmeaSentence,
pub enum ParseResult {
AAM(AamData),
ALM(AlmData),
APA(ApaData),
BOD(BodData),
BWC(BwcData),
BWW(BwwData),
Expand Down Expand Up @@ -142,6 +143,7 @@ impl From<&ParseResult> for SentenceType {
match parse_result {
ParseResult::AAM(_) => SentenceType::AAM,
ParseResult::ALM(_) => SentenceType::ALM,
ParseResult::APA(_) => SentenceType::APA,
ParseResult::BOD(_) => SentenceType::BOD,
ParseResult::BWC(_) => SentenceType::BWC,
ParseResult::BWW(_) => SentenceType::BWW,
Expand Down Expand Up @@ -219,6 +221,15 @@ pub fn parse_str(sentence_input: &str) -> Result<ParseResult, Error> {
}
}
}
SentenceType::APA => {
cfg_if! {
if #[cfg(feature = "APA")] {
parse_apa(nmea_sentence).map(ParseResult::APA)
} else {
return Err(Error::DisabledSentence);
}
}
}
SentenceType::BOD => {
cfg_if! {
if #[cfg(feature = "BOD")] {
Expand Down
1 change: 1 addition & 0 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ impl<'a> Nmea {
| ParseResult::GBS(_)
| ParseResult::GST(_)

Check warning on line 377 in src/parser.rs

View check run for this annotation

Codecov / codecov/patch

src/parser.rs#L377

Added line #L377 was not covered by tests
| ParseResult::AAM(_)
| ParseResult::APA(_)
| ParseResult::ALM(_)
| ParseResult::HDT(_)
| ParseResult::PGRMZ(_)
Expand Down
2 changes: 1 addition & 1 deletion src/sentences/aam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::{parse::NmeaSentence, sentences::utils::array_string, Error, Sentence
/// 1. Status, BOOLEAN, A = Arrival circle entered, V = not passed
/// 2. Status, BOOLEAN, A = perpendicular passed at waypoint, V = not passed
/// 3. Arrival circle radius
/// 4. Units of radiuos, nautical miles
/// 4. Units of radius, nautical miles
/// 5. Waypoint ID
/// 6. Checksum
///
Expand Down
Loading

0 comments on commit 24af86b

Please sign in to comment.