mirror of
https://github.com/SlimeVR/SlimeVR-Tracker-ESP.git
synced 2026-04-05 17:51:57 +02:00
Fix build and runtime crash (#451)
- Fix pointer issue - Fix null reference to string issue (int 255) - Recreate hex output for IMU address
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -269,7 +269,7 @@ public:
|
||||
}
|
||||
);
|
||||
} else {
|
||||
auto& regInterface = getRegisterInterface<SensorType>(
|
||||
auto& regInterface = *getRegisterInterface<SensorType>(
|
||||
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
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user