summaryrefslogtreecommitdiff
path: root/src/drivers/touchwheel.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-05-02 16:01:41 +1000
committerjacqueline <me@jacqueline.id.au>2023-05-02 16:01:41 +1000
commitee559cd72288053e263c473a7d60c279b6bc65a1 (patch)
treec807e4578959bb33a998f0013895c1431a082106 /src/drivers/touchwheel.cpp
parent09ad66136d11909c0e6e258a8dc953f2d2b46c41 (diff)
downloadtangara-fw-ee559cd72288053e263c473a7d60c279b6bc65a1.tar.gz
Give the touchwheel a little more juice for debugging
Diffstat (limited to 'src/drivers/touchwheel.cpp')
-rw-r--r--src/drivers/touchwheel.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/drivers/touchwheel.cpp b/src/drivers/touchwheel.cpp
index 51a67187..d47b19a1 100644
--- a/src/drivers/touchwheel.cpp
+++ b/src/drivers/touchwheel.cpp
@@ -35,6 +35,10 @@ TouchWheel::TouchWheel() {
vTaskDelay(pdMS_TO_TICKS(1));
WriteRegister(Register::SLIDER_OPTIONS, 0b11000000);
WriteRegister(Register::CALIBRATE, 1);
+ // Confusingly-named; this sets to max-power max-response-time.
+ WriteRegister(Register::LOW_POWER, 1);
+ // TODO(jacqueline): Temp to debug touchwheel responsiveness.
+ WriteRegister(Register::CHARGE_TIME, 8);
}
TouchWheel::~TouchWheel() {}
@@ -78,6 +82,10 @@ void TouchWheel::Update() {
// Still calibrating.
return;
}
+ if (status & 0b01000000) {
+ // Probably okay, but we should keep an eye on this for development.
+ ESP_LOGW(kTag, "touchwheel acquisition >16ms");
+ }
if (status & 0b10) {
// Slider detect.
data_.wheel_position = ReadRegister(Register::SLIDER_POSITION);
@@ -85,6 +93,10 @@ void TouchWheel::Update() {
if (status & 0b1) {
// Key detect.
// TODO(daniel): implement me
+ // Ensure we read all status registers -- even if we're not using them -- to
+ // ensure that INT can float high again.
+ ReadRegister(Register::KEY_STATUS_A);
+ ReadRegister(Register::KEY_STATUS_B);
}
}