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

Receivers implementation (impl Display) #140

Open
elpiel opened this issue Dec 24, 2024 · 2 comments
Open

Receivers implementation (impl Display) #140

elpiel opened this issue Dec 24, 2024 · 2 comments

Comments

@elpiel
Copy link
Member

elpiel commented Dec 24, 2024

We want to create a Proof of concept with 1 or more sentences for implementing Display for sentences.

This could be used to create receivers firmware or any other device that requires generating and sending NMEA 0183.

  • use parse_display crate to format the strings easily

Caveats

This proof of concept is required because sentences use floating point numbers and given the maximum sentence length, this could lead to problems when displaying the sentences.

  • Length of generated sentences
  • floating points rounding and accuracy (fractional part of the number)
@Dushistov
Copy link
Collaborator

Dushistov commented Dec 24, 2024

This proof of concept is required because sentences use floating point numbers
floating points rounding and accuracy (fractional part of the number)

In fact, if we choose proper type to represent all numbers from nmea sentences we can easily get the proper result,
but if choose wrong type, f32 for example, where only f64 enough, then we would get problem.

So converting back data to nmea help to test proper choice of types.

But I not sure that Display trait is the proper choice. It is for human readable representation,
may be it should From trait that convert to String|Vec<u8>|[u8; CONTANT],
or may be custom trait with suitable name, like RestoreOrigin.

@elpiel
Copy link
Member Author

elpiel commented Dec 26, 2024

I think f32 should be enough in most cases although devices might use different accuracy.
See the other issue for more details.
I actually think f32 is the right way to go or go as far as Fixed (w/ the fixed crate) numbers in some cases.

We could use our own trait, I believe that NMEA 0183, being a human readable format (aka string) can really benefit from implementing Display.
Maybe only the whole sentence can have a function that creates a fixed-length String alongside the Display impl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants