HAL accepts to work with both temperature sensors

This commit is contained in:
bboulet 2019-07-22 15:42:58 +02:00
commit 218876a8d5
3 changed files with 38 additions and 21 deletions

View file

@ -564,7 +564,7 @@ int lgw_debug_setconf(struct lgw_conf_debug_s * conf) {
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
int lgw_start(void) {
int i, err;
int i, err, err_ID1,err_ID2;
int reg_stat;
if (CONTEXT_STARTED == true) {
@ -714,8 +714,9 @@ int lgw_start(void) {
#endif
/* Open I2C */
err = i2c_linuxdev_open(I2C_DEVICE, I2C_PORT_TEMP_SENSOR, &lgw_i2c_target);
if ((err != 0) || (lgw_i2c_target <= 0)) {
err_ID1 = i2c_linuxdev_open(I2C_DEVICE, I2C_PORT_TEMP_SENSOR_1, &lgw_i2c_target);
err_ID2 = i2c_linuxdev_open(I2C_DEVICE, I2C_PORT_TEMP_SENSOR_2, &lgw_i2c_target);
if (((err_ID1 != 0) || (lgw_i2c_target <= 0)) && ((err_ID2 != 0) || (lgw_i2c_target <= 0))) {
printf("ERROR: failed to open I2C device %s (err=%i)\n", I2C_DEVICE, err);
return LGW_HAL_ERROR;
}