fix(P4): Tipp auf einen Knopf löst nicht mehr mehrfach aus (1.6.9)
Der GT9271 lässt gelegentlich einen Messzyklus aus oder liefert ein unplausibles Paket. Der Hersteller-Treiber kann "gerade nichts Neues" nicht von "Finger weg" unterscheiden und meldet beides als losgelassen. Seit die Abtastrate mit 1.6.8 von 33 auf 16 ms gestiegen ist, wurde daraus sichtbar Drücken-Loslassen-Drücken-Loslassen. Vor den Treiber ist jetzt ein eigener get_xy-Aufsatz gesetzt: Er verwirft unplausible Rohwerte und hält den letzten gültigen Punkt noch WS7_TOUCH_HOLD_MS lang (Vorgabe 40 ms). Der Aufsatz wird zur Laufzeit in das Touch-Handle eingehängt, die Herstellerdateien bleiben unverändert. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018QoLDQeUh1dCQz7yYZVb4Y
This commit is contained in:
co-authored by
Claude Opus 5
parent
480708c992
commit
328dc06983
@@ -29,6 +29,7 @@
|
||||
#include "esp_cache.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_rom_sys.h"
|
||||
#include "esp_timer.h"
|
||||
#include "esp_ldo_regulator.h"
|
||||
#include "esp_lcd_panel_io.h"
|
||||
#include "esp_lcd_panel_ops.h"
|
||||
@@ -184,6 +185,63 @@ IRAM_ATTR static bool on_vsync(esp_lcd_panel_handle_t panel,
|
||||
}
|
||||
|
||||
#if JC_PANEL_TYPE == WS_PANEL_7H
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
// Aussetzer des GT9271 ueberbruecken
|
||||
//
|
||||
// Der Controller laesst gelegentlich einen Messzyklus aus und liefert ab und zu ein
|
||||
// unplausibles Paket - die Werks-Testskizze hat solche Pakete ebenfalls verworfen. Der
|
||||
// Hersteller-Treiber kann "gerade nichts Neues" nicht von "Finger weg" unterscheiden und
|
||||
// meldet beides als losgelassen. Seit die Oberflaeche doppelt so oft abtastet, faellt das
|
||||
// auf: Aus einem Tipp wird Druecken-Loslassen-Druecken-Loslassen, der Knopf loest also
|
||||
// mehrfach aus.
|
||||
//
|
||||
// Deshalb liegt hier ein eigener get_xy-Aufsatz vor dem Treiber: Er verwirft unplausible
|
||||
// Rohwerte und haelt den letzten gueltigen Punkt kurz fest. Losgelassen wird erst
|
||||
// gemeldet, wenn WS7_TOUCH_HOLD_MS lang wirklich nichts mehr kam.
|
||||
// ------------------------------------------------------------------------------------
|
||||
static bool (*s_touch_get_xy_orig)(esp_lcd_touch_handle_t, uint16_t *, uint16_t *,
|
||||
uint16_t *, uint8_t *, uint8_t) = NULL;
|
||||
static uint16_t s_touch_last_x = 0;
|
||||
static uint16_t s_touch_last_y = 0;
|
||||
static int64_t s_touch_last_us = 0;
|
||||
static bool s_touch_down = false;
|
||||
|
||||
static bool ws7_touch_get_xy(esp_lcd_touch_handle_t tp, uint16_t *x, uint16_t *y,
|
||||
uint16_t *strength, uint8_t *point_num, uint8_t max_point_num)
|
||||
{
|
||||
bool got = s_touch_get_xy_orig(tp, x, y, strength, point_num, max_point_num);
|
||||
int64_t now = esp_timer_get_time();
|
||||
|
||||
// Unplausible Rohwerte gelten als Aussetzer, nicht als Beruehrung.
|
||||
if (got && *point_num > 0 &&
|
||||
(x[0] > WS7_TOUCH_RAW_X_MAX || y[0] > WS7_TOUCH_RAW_Y_MAX)) {
|
||||
got = false;
|
||||
*point_num = 0;
|
||||
}
|
||||
|
||||
if (got && *point_num > 0) {
|
||||
s_touch_last_x = x[0];
|
||||
s_touch_last_y = y[0];
|
||||
s_touch_last_us = now;
|
||||
s_touch_down = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
#if WS7_TOUCH_HOLD_MS > 0
|
||||
if (s_touch_down && (now - s_touch_last_us) < ((int64_t)WS7_TOUCH_HOLD_MS * 1000)) {
|
||||
x[0] = s_touch_last_x;
|
||||
y[0] = s_touch_last_y;
|
||||
if (strength) strength[0] = 0;
|
||||
*point_num = 1;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
s_touch_down = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Der GT9271 des Waveshare-Panels meldet im Hochformat (Roh-X 0..720, Roh-Y 0..1280),
|
||||
// das Bild laeuft aber im Querformat 1280x720. Achsentausch (und bei Bedarf Spiegelung)
|
||||
// deshalb ueber den process_coordinates-Hook, der VOR den swap/mirror-Flags von
|
||||
@@ -467,6 +525,12 @@ bool jc_board_bringup(void)
|
||||
esp_rom_printf("[Panel] Touch-Controller nicht gefunden - Anzeige laeuft ohne Bedienung.\n");
|
||||
tp_handle = NULL;
|
||||
}
|
||||
#if JC_PANEL_TYPE == WS_PANEL_7H
|
||||
if (tp_handle) { // Aussetzer-Filter vor den Treiber haengen
|
||||
s_touch_get_xy_orig = tp_handle->get_xy;
|
||||
tp_handle->get_xy = ws7_touch_get_xy;
|
||||
}
|
||||
#endif
|
||||
|
||||
lvgl_port_interface_t interface =
|
||||
(dpi_config.flags.use_dma2d) ? LVGL_PORT_INTERFACE_MIPI_DSI_DMA
|
||||
|
||||
Reference in New Issue
Block a user