bikeshedder / sunspec

Rust crate for accessing SunSpec compliant devices in a safe and convenient way.
Apache License 2.0
4 stars 3 forks source link

fix: Ignore IllegalDataAddress in the discovery phase #1

Closed jacobsvante closed 10 months ago

jacobsvante commented 10 months ago

Address 0 for my Fronius GEN24 inverter returned IllegalDataAddress. This fixed the issue for me.

jacobsvante commented 10 months ago

Also - thanks for this great library! I especially love read_model and all the auto-generated documentation!

bikeshedder commented 10 months ago

Thanks a lot. It really is just a workaround.

bikeshedder commented 10 months ago

I refactored that code a bit by moving the logic into the read_fixed_size function and changing the match into a Err(e) if ... expression. I think a io::Result<Option<T>> makes sense for the read_fixed_size function anyways if devices are free to reply with that kind of error. See 420d386115d1b1d1d2099c9189dd32dbfce19537

I just released sunspec 0.3.1 to crates.io including your fix. Thanks a lot!

📦 https://crates.io/crates/sunspec/0.3.1

jacobsvante commented 10 months ago

Great, thanks! 😃