Return zeroes when the touchwheel isn't connected

custom
jacqueline 2 years ago
parent cdaa2ac97a
commit 8f0b942cdd
  1. 7
      src/drivers/touchwheel.cpp

@ -78,8 +78,11 @@ uint8_t TouchWheel::ReadRegister(uint8_t reg) {
.write_addr(kTouchWheelAddress, I2C_MASTER_READ) .write_addr(kTouchWheelAddress, I2C_MASTER_READ)
.read(&res, I2C_MASTER_NACK) .read(&res, I2C_MASTER_NACK)
.stop(); .stop();
transaction.Execute(); if (transaction.Execute() == ESP_OK) {
return res; return res;
} else {
return 0;
}
} }
void TouchWheel::Update() { void TouchWheel::Update() {

Loading…
Cancel
Save