diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-07-31 11:09:31 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-07-31 11:09:31 +1000 |
| commit | 8f0b942cdd964f0bfa3d775e7d8c3269c8d59edc (patch) | |
| tree | c88d91516461dab01212628ef8f7dc829264965e /src/drivers | |
| parent | cdaa2ac97ac663de7c0c2b0361871c97269b1675 (diff) | |
| download | tangara-fw-8f0b942cdd964f0bfa3d775e7d8c3269c8d59edc.tar.gz | |
Return zeroes when the touchwheel isn't connected
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/touchwheel.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/drivers/touchwheel.cpp b/src/drivers/touchwheel.cpp index 2e44adfd..59c2911e 100644 --- a/src/drivers/touchwheel.cpp +++ b/src/drivers/touchwheel.cpp @@ -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() { |
