summaryrefslogtreecommitdiff
path: root/src/main/main.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-04-04 14:48:35 +1000
committerjacqueline <me@jacqueline.id.au>2023-04-04 14:48:35 +1000
commit1b245316fe282035f094a3656f717d419e8bd526 (patch)
tree04522bf36f9257e638137c82f3f4e60348651589 /src/main/main.cpp
parent9799ab458d8ad870aaec048abf5b1b1d93aa7aff (diff)
downloadtangara-fw-1b245316fe282035f094a3656f717d419e8bd526.tar.gz
fix up touchpad timeouts, make it less chatty
Diffstat (limited to 'src/main/main.cpp')
-rw-r--r--src/main/main.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/main/main.cpp b/src/main/main.cpp
index 692b97fb..8860befe 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -1,4 +1,5 @@
#include <dirent.h>
+#include <stdint.h>
#include <stdio.h>
#include <cstddef>
@@ -121,16 +122,9 @@ extern "C" void app_main(void) {
storage = std::move(storage_res.value());
}
- /*
ESP_LOGI(TAG, "Init touch wheel");
- auto touchwheel_res = drivers::TouchWheel::create(expander);
- std::shared_ptr<drivers::TouchWheel> touchwheel;
- if (touchwheel_res.has_error()) {
- ESP_LOGE(TAG, "Failed!");
- } else {
- touchwheel = std::move(touchwheel_res.value());
- }
- */
+ std::unique_ptr<drivers::TouchWheel> touchwheel =
+ std::make_unique<drivers::TouchWheel>();
LvglArgs* lvglArgs = (LvglArgs*)calloc(1, sizeof(LvglArgs));
lvglArgs->gpio_expander = expander;
@@ -156,9 +150,14 @@ extern "C" void app_main(void) {
console::AppConsole console(playback.get());
console.Launch();
+ uint8_t prev_position = 0;
while (1) {
- //touchwheel->Update();
- //ESP_LOGI(TAG, "Touch wheel pos: %d", touchwheel->GetTouchWheelData().wheel_position);
+ touchwheel->Update();
+ auto wheel_data = touchwheel->GetTouchWheelData();
+ if (wheel_data.wheel_position != prev_position) {
+ prev_position = wheel_data.wheel_position;
+ ESP_LOGI(TAG, "Touch wheel pos: %u", prev_position);
+ }
vTaskDelay(pdMS_TO_TICKS(100));
}
}