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

Panic unwrapping a float #48

Open
D1plo1d opened this issue Jul 23, 2020 · 2 comments
Open

Panic unwrapping a float #48

D1plo1d opened this issue Jul 23, 2020 · 2 comments

Comments

@D1plo1d
Copy link

D1plo1d commented Jul 23, 2020

I got a panic in gcode after sending M28 teg.gcode. Sadly, I haven't been able to reproduce the error so there may be more to it then just parsing an M28 teg.gcode. My question is could we replace this (and any other use) of unwrap with a result?

I'm using this lib in the send gcode to printer loop for https://tegapp.io so a panic here can abort a print whereas a result could be logged safely as a warning on my end (it's non-critical that every gcode gets parsed).

PS. Thanks for making this library - it's been super helpful!

Original Error:

thread 'main' panicked at ': ParseFloatError { kind: Invalid }', /home/d1plo1d/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/gcode-0.5.2/src/words.rs:100:33               
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@D1plo1d D1plo1d changed the title Panic's unwrapping a float Panic unwrapping a float Jul 23, 2020
@D1plo1d
Copy link
Author

D1plo1d commented Jul 23, 2020

Update: I can now recreate the issue reliably by sending M28 teg.gcode.

Also for reference here are the Marlin Firmware Docs for M28: https://marlinfw.org/docs/gcode/M028.html

@D1plo1d
Copy link
Author

D1plo1d commented Jul 28, 2020

Ok, initially I started working on a patch to fix this in gcode-rs. Then I decided I wanted to learn Nom.

Now for better or worse there is a nom-gcode parser.

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

No branches or pull requests

1 participant