inprove check for RAK12035VBSOIL Sensor by checking device registry for expected values..

This commit is contained in:
Justin E. Mann 2024-12-02 11:05:01 -07:00
parent 3aed9e6e9b
commit c9abb81f41
2 changed files with 22 additions and 23 deletions

11
.vscode/settings.json vendored
View File

@ -7,5 +7,16 @@
"cmake.configureOnOpen": false, "cmake.configureOnOpen": false,
"[cpp]": { "[cpp]": {
"editor.defaultFormatter": "trunk.io" "editor.defaultFormatter": "trunk.io"
},
"files.associations": {
"array": "cpp",
"chrono": "cpp",
"functional": "cpp",
"istream": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp"
} }
} }

View File

@ -291,33 +291,21 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
case RAK12035VB_ADDR: // (0x20) can be RAK12023VB Soil Sensor or TCA9535 I2C expander case RAK12035VB_ADDR: // (0x20) can be RAK12023VB Soil Sensor or TCA9535 I2C expander
// check if it is a RAK12035, if not can assume it is a TCA9535 I2C expander // Check if it is a RAK12035, if not can assume it is a TCA9535 I2C expander
// registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x20), 1); // get ID // additional info about registry values can be found here [https://github.com/RAKWireless/RAK12035_SoilMoisture/blob/main/RAK12035_SoilMoisture.h]
// if (registerValue == 0xC0) { registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x02), 1); // get the default address for the device (stored in registry here [0x02]).. should come back as 0x20
// type = RAK12035VB; LOG_INFO("Checking for RAK12035VB Soil Sensor with registry address 0x02...");
// LOG_INFO("RAK12035VB Soil Sensor found"); if (registerValue == 0x20) {
// } else { LOG_INFO("Found registry value 0x%x", registerValue);
//#ifdef RAK4631
// type = NCP5623;
// logFoundDevice("NCP5623", (uint8_t)addr.address);
//#endif
// type = TCA9535;
// LOG_INFO("TCA9535 I2C expander found\n");
// }
// break;
// ^^^^^^^^^^^ not working... so we will just assume it is a RAK12035VB Soil Sensor so I can keep testing.
#ifdef RAK4631
type = RAK12035VB; type = RAK12035VB;
LOG_INFO("RAK12035VB Soil Sensor found"); LOG_INFO("RAK12035VB Soil Sensor found");
#endif } else {
LOG_INFO("Found registry value 0x%x", registerValue);
type = TCA9535;
LOG_INFO("TCA9535 I2C expander found\n");
}
break; break;
case MCP9808_ADDR: case MCP9808_ADDR:
// We need to check for STK8BAXX first, since register 0x07 is new data flag for the z-axis and can produce some // We need to check for STK8BAXX first, since register 0x07 is new data flag for the z-axis and can produce some
// weird result. and register 0x00 doesn't seems to be colliding with MCP9808 and LIS3DH chips. // weird result. and register 0x00 doesn't seems to be colliding with MCP9808 and LIS3DH chips.