mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-09 15:03:56 +01:00
added wx check to map out i2c addrs already used by power sensors
This commit is contained in:
parent
796ba35357
commit
a10efdebcc
|
|
@ -26,6 +26,7 @@ namespace BATTERY_Utils {
|
|||
|
||||
void adcCalibration();
|
||||
void adcCalibrationCheck();
|
||||
uint8_t externalI2CSensorActive();
|
||||
|
||||
void setup();
|
||||
float checkInternalVoltage();
|
||||
|
|
|
|||
|
|
@ -126,6 +126,13 @@ namespace BATTERY_Utils {
|
|||
return ina219.begin();
|
||||
}
|
||||
|
||||
uint8_t externalI2CSensorActive() {
|
||||
if ( externalI2CSensorType != 0 ) {
|
||||
return externalI2CSensorAddress;
|
||||
}
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
void setup() {
|
||||
if ((Config.battery.sendExternalVoltage || Config.battery.monitorExternalVoltage) && Config.battery.voltageDividerR2 != 0) voltageDividerTransformation = (Config.battery.voltageDividerR1 + Config.battery.voltageDividerR2) / Config.battery.voltageDividerR2;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "board_pinout.h"
|
||||
#include "wx_utils.h"
|
||||
#include "display.h"
|
||||
#include "battery_utils.h"
|
||||
|
||||
|
||||
#define SEALEVELPRESSURE_HPA (1013.25)
|
||||
|
|
@ -60,7 +61,13 @@ namespace WX_Utils {
|
|||
|
||||
void getWxModuleAddres() {
|
||||
uint8_t err, addr;
|
||||
uint8_t extI2Caddr = BATTERY_Utils::externalI2CSensorActive();
|
||||
|
||||
for(addr = 1; addr < 0x7F; addr++) {
|
||||
if (addr == extI2Caddr) {
|
||||
Serial.printf("0x%x occupied by I2C power sensor, skipping at Wx setup", addr);
|
||||
continue;
|
||||
}
|
||||
#ifdef SENSOR_I2C_BUS
|
||||
SENSOR_I2C_BUS.beginTransmission(addr);
|
||||
err = SENSOR_I2C_BUS.endTransmission();
|
||||
|
|
@ -78,7 +85,7 @@ namespace WX_Utils {
|
|||
if (addr == 0x76 || addr == 0x77) { // BME or BMP
|
||||
wxModuleAddress = addr;
|
||||
return;
|
||||
} else if (addr == 0x40) { // Si7011
|
||||
} else if (addr == 0x40) { // Si7021
|
||||
wxModuleAddress = addr;
|
||||
return;
|
||||
} else if (addr == 0x70) { // SHTC3
|
||||
|
|
|
|||
Loading…
Reference in a new issue