Lora-net / sx1302_hal

SX1302/SX1303 Hardware Abstraction Layer and Tools (packet forwarder...)
Other
219 stars 272 forks source link

Temperature sensor is optional #63

Closed joelguittet closed 1 year ago

joelguittet commented 2 years ago

Hello

Following the issue reported at https://github.com/Lora-net/sx1302_hal/issues/58, this is a Pull-Request to propose a solution permitting to have the temperature sensor optional.

To disable the temperature sensor, the configuration key temp_dev_path has been introduced and should be an empty string (the behavior is identical to gps_tty_path which disable the GPS when the path is empty). The default value in the global_conf files in the repo is "/dev/i2c-1", which was the value of the I2C_DEVICE definition (removed).

Because I2C_DEVICE has been removed, the pa_dev_path for the pull duplex operation has been introduced as well. The implementation permit to have full duplex without temperature, temperature without full duplex, none of them, or both of them. Just need to do the proper configuration, i2c devices paths are independent.

The temp field in the stat json packet is not transmitted to the server if the temperature can't be read, for any reason (disabled or any other error, the other fields are transmitted anyway).

The PR also fix a remaining TODO in the test_lorawan_i2c program (device from the command with option -d is now available, default option is still "/dev/i2c-1").

I have no concentrator board with temperature sensor, I have only a RAK2287 (SX1302 with SPI interface), so testing I have done are the following:

Please let me known anything about this PR, if it's suitable or not, if the philosophy should be a little bit different etc.

Joel

joelguittet commented 2 years ago

Hello maintainers ! Any questions or remarks about my PR ? Thanks, Joel

joelguittet commented 1 year ago

Up ?

smtc-bot commented 1 year ago

Thank you for your inquiry.

Customers are encouraged to submit technical questions via our dedicated support portal at https://semtech.force.com/ldp/ldp_support.

We invite all users to visit the LoRa Developer Portal Forum at https://forum.lora-developers.semtech.com and to join the thriving LoRa development community!