sx1302_hal
sx1302_hal copied to clipboard
Temperature sensor is optional
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:
- lora_pkt_fwd started with configuration from the repository => fails because temperature sensor is not found => OK
- lora_pkt_fwd with
"temp_dev_path"=""
in the configuration => starts and communication with server OK, no temp transmitted in the stat json packet => OK - temp_dev_path without -d option to use default I2C path => starts and use the proper path, fails because no temperature sensor => OK
- temp_dev_path with -d option to pass the I2C path => starts and use the proper path, fails because no temperature sensor => OK
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
Hello maintainers ! Any questions or remarks about my PR ? Thanks, Joel
Up ?
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!