From 0279568c6857379f274083fb67b9f8450c1f07df Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Fri, 15 Aug 2025 18:54:20 +0200 Subject: [PATCH] Fix for native touch --- Drivers/EspLcdCompat/Source/EspLcdNativeTouch.cpp | 10 +++++++++- Tactility/Include/Tactility/hal/touch/NativeTouch.h | 7 +++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Drivers/EspLcdCompat/Source/EspLcdNativeTouch.cpp b/Drivers/EspLcdCompat/Source/EspLcdNativeTouch.cpp index d0d52be6..d40f4b18 100644 --- a/Drivers/EspLcdCompat/Source/EspLcdNativeTouch.cpp +++ b/Drivers/EspLcdCompat/Source/EspLcdNativeTouch.cpp @@ -1,5 +1,13 @@ #include "EspLcdNativeTouch.h" -bool EspLcdNativeTouch::getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* pointCount, uint8_t maxPointCount) { +#include + +constexpr char* TAG = "EspLcdNativeTouch"; + +bool EspLcdNativeTouch::getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* _Nullable strength, uint8_t* pointCount, uint8_t maxPointCount) { + if (esp_lcd_touch_read_data(handle) != ESP_OK) { + TT_LOG_E(TAG, "Read data failed"); + return false; + } return esp_lcd_touch_get_coordinates(handle, x, y, strength, pointCount, maxPointCount) == ESP_OK; } diff --git a/Tactility/Include/Tactility/hal/touch/NativeTouch.h b/Tactility/Include/Tactility/hal/touch/NativeTouch.h index 63bfa1f4..d91ece8c 100644 --- a/Tactility/Include/Tactility/hal/touch/NativeTouch.h +++ b/Tactility/Include/Tactility/hal/touch/NativeTouch.h @@ -11,14 +11,13 @@ public: * * @param[in] x array of X coordinates * @param[in] y array of Y coordinates - * @param[in] strength Array of strengths + * @param[in] strength optional array of strengths * @param[in] pointCount the number of points currently touched on the screen * @param[in] maxPointCount the maximum number of points that can be touched at once * - * @return - * - Returns true, when touched and coordinates readed. Otherwise returns false. + * @return true when touched and coordinates are available */ - virtual bool getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* pointCount, uint8_t maxPointCount) = 0; + virtual bool getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* _Nullable strength, uint8_t* pointCount, uint8_t maxPointCount) = 0; }; }