rockwood / exbee

Communicate with XBee wireless radios in Elixir
https://hex.pm/packages/exbee
Other
6 stars 4 forks source link

relax length constraint on rx_sample_read_frame value #4

Closed msm closed 5 years ago

msm commented 5 years ago

Hi there!

Thanks for writing & publishing the exbee library!

While using it with some Digi L/T/H sensors[1] I have noticed that sensor-reported samples were not being decoded as the rx_sample_read_frame pattern matched against an exactly-16bit data value, but these sample lengths were longer.

I'm not sure there is necessarily a great reason to keep the value field hard-coded to 2 bytes, so I have attached a commit to this PR that relaxes the pattern match to essentially "the rest" of the data payload. This change allows 0x92 packets to be parsed correctly and contain L/T/H sensor values now.

1: https://www.digi.com/resources/documentation/digidocs/90001537/references/r_xbee_sensors.htm

rockwood commented 5 years ago

@msm Good call. Thanks for your help!