diff --git a/src/sensorinterface/i2cimpl.h b/src/sensorinterface/i2cimpl.h index 14e258c..032c240 100644 --- a/src/sensorinterface/i2cimpl.h +++ b/src/sensorinterface/i2cimpl.h @@ -82,7 +82,9 @@ struct I2CImpl : public RegisterInterface { uint8_t getAddress() const override { return m_devAddr; } std::string toString() const { - return std::string("I2C(") + std::to_string(m_devAddr) + std::string(")"); + char buf[16]; + std::snprintf(buf, sizeof(buf), "I2C(0x%02x)", m_devAddr); + return std::string(buf); } private: diff --git a/src/sensors/SensorBuilder.h b/src/sensors/SensorBuilder.h index e2730ab..5bed41d 100644 --- a/src/sensors/SensorBuilder.h +++ b/src/sensors/SensorBuilder.h @@ -269,7 +269,7 @@ public: } ); } else { - auto& regInterface = getRegisterInterface( + auto& regInterface = *getRegisterInterface( sensorID, sensorInterface, accessInterface @@ -303,7 +303,7 @@ public: sensorDef.imuInterface.toString().c_str(), sensorDef.rotation, sensorDef.sensorInterface->toString().c_str(), - sensorDef.intPin->toString().c_str(), + sensorDef.intPin ? sensorDef.intPin->toString().c_str() : "None", sensorDef.extraParam, sensorDef.optional );