add handling for not given pin (-1 or 255) (#406)

This commit fixes the use case BNO08x whit out a interrupt pin.
This commit is contained in:
unlogisch04
2025-03-17 14:48:16 +01:00
committed by GitHub
parent c87c3456d8
commit cade3ebcf5

View File

@@ -94,6 +94,9 @@ void SensorManager::setup() {
std::map<std::tuple<int, int, int, int>, I2CPCASensorInterface*> pcaWireInterfaces;
auto directPin = [&](int pin) {
if (pin == 255 || pin == -1) {
return static_cast<DirectPinInterface*>(nullptr);
}
if (!directPinInterfaces.contains(pin)) {
auto ptr = new DirectPinInterface(pin);
directPinInterfaces[pin] = ptr;