Return zeroes when the touchwheel isn't connected

This commit is contained in:
jacqueline
2023-07-31 11:09:31 +10:00
parent cdaa2ac97a
commit 8f0b942cdd
+5 -2
View File
@@ -78,8 +78,11 @@ uint8_t TouchWheel::ReadRegister(uint8_t reg) {
.write_addr(kTouchWheelAddress, I2C_MASTER_READ)
.read(&res, I2C_MASTER_NACK)
.stop();
transaction.Execute();
return res;
if (transaction.Execute() == ESP_OK) {
return res;
} else {
return 0;
}
}
void TouchWheel::Update() {