change touch controller readouts to verbose logger

This commit is contained in:
hiruna 2023-06-01 20:08:43 +10:00
parent 16f9f93dab
commit 50b212aa56
4 changed files with 35 additions and 40 deletions

View file

@ -150,7 +150,7 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) {
data->point.x = touch_inputs.last_x; data->point.x = touch_inputs.last_x;
data->point.y = touch_inputs.last_y; data->point.y = touch_inputs.last_y;
data->state = touch_inputs.current_state; data->state = touch_inputs.current_state;
ESP_LOGD(TAG, "X=%u Y=%u", data->point.x, data->point.y); ESP_LOGV(TAG, "X=%u Y=%u", data->point.x, data->point.y);
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE #if CONFIG_LV_FT6X36_COORDINATES_QUEUE
xQueueOverwrite( ft6x36_touch_queue_handle, &touch_inputs ); xQueueOverwrite( ft6x36_touch_queue_handle, &touch_inputs );

View file

@ -138,7 +138,7 @@ bool gt911_read(lv_indev_drv_t *drv, lv_indev_data_t *data) {
data->point.x = last_x; data->point.x = last_x;
data->point.y = last_y; data->point.y = last_y;
data->state = LV_INDEV_STATE_PR; data->state = LV_INDEV_STATE_PR;
ESP_LOGI(TAG, "X=%u Y=%u", data->point.x, data->point.y); ESP_LOGV(TAG, "X=%u Y=%u", data->point.x, data->point.y);
ESP_LOGV(TAG, "X=%u Y=%u", data->point.x, data->point.y); ESP_LOGV(TAG, "X=%u Y=%u", data->point.x, data->point.y);
return false; return false;
} }

View file

@ -72,8 +72,7 @@ static void ra8875_corr(int * x, int * y);
* GLOBAL FUNCTIONS * GLOBAL FUNCTIONS
**********************/ **********************/
void ra8875_touch_init(void) void ra8875_touch_init(void) {
{
struct { struct {
uint8_t cmd; // Register address of command uint8_t cmd; // Register address of command
uint8_t data; // Value to write to register uint8_t data; // Value to write to register
@ -92,8 +91,7 @@ void ra8875_touch_init(void)
ra8875_touch_enable(true); ra8875_touch_enable(true);
} }
void ra8875_touch_enable(bool enable) void ra8875_touch_enable(bool enable) {
{
ESP_LOGI(TAG, "%s touch.", enable ? "Enabling" : "Disabling"); ESP_LOGI(TAG, "%s touch.", enable ? "Enabling" : "Disabling");
uint8_t val = enable ? (0x80 | TPCR0_VAL) : (TPCR0_VAL); uint8_t val = enable ? (0x80 | TPCR0_VAL) : (TPCR0_VAL);
ra8875_write_cmd(RA8875_REG_TPCR0, val); ra8875_write_cmd(RA8875_REG_TPCR0, val);
@ -104,8 +102,7 @@ void ra8875_touch_enable(bool enable)
* @param data store the read data here * @param data store the read data here
* @return false: because no more data to be read * @return false: because no more data to be read
*/ */
bool ra8875_touch_read(lv_indev_drv_t * drv, lv_indev_data_t * data) bool ra8875_touch_read(lv_indev_drv_t *drv, lv_indev_data_t *data) {
{
static int x = 0; static int x = 0;
static int y = 0; static int y = 0;
@ -121,9 +118,9 @@ bool ra8875_touch_read(lv_indev_drv_t * drv, lv_indev_data_t * data)
x = (x << 2) | (xy & 0x03); x = (x << 2) | (xy & 0x03);
y = (y << 2) | ((xy >> 2) & 0x03); y = (y << 2) | ((xy >> 2) & 0x03);
#if DEBUG
ESP_LOGI(TAG, "Touch Poll Raw: %d,%d", x, y); ESP_LOGV(TAG, "Touch Poll Raw: %d,%d", x, y);
#endif
// Convert to display coordinates // Convert to display coordinates
ra8875_corr(&x, &y); ra8875_corr(&x, &y);
@ -135,9 +132,8 @@ bool ra8875_touch_read(lv_indev_drv_t * drv, lv_indev_data_t * data)
data->point.x = x; data->point.x = x;
data->point.y = y; data->point.y = y;
#if DEBUG ESP_LOGV(TAG, "Touch Poll - Event: %d; %d,%d", data->state, data->point.x, data->point.y);
ESP_LOGI(TAG, "Touch Poll - Event: %d; %d,%d", data->state, data->point.x, data->point.y);
#endif
return false; return false;
} }
@ -147,8 +143,7 @@ bool ra8875_touch_read(lv_indev_drv_t * drv, lv_indev_data_t * data)
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
static void ra8875_corr(int * x, int * y) static void ra8875_corr(int *x, int *y) {
{
#if RA8875_XY_SWAP != 0 #if RA8875_XY_SWAP != 0
int tmp = *x; int tmp = *x;
*x = *y; *x = *y;

View file

@ -94,19 +94,19 @@ bool xpt2046_read(lv_indev_drv_t * drv, lv_indev_data_t * data)
x = xpt2046_cmd(CMD_X_READ); x = xpt2046_cmd(CMD_X_READ);
y = xpt2046_cmd(CMD_Y_READ); y = xpt2046_cmd(CMD_Y_READ);
ESP_LOGI(TAG, "P(%d,%d)", x, y); ESP_LOGV(TAG, "P(%d,%d)", x, y);
/*Normalize Data back to 12-bits*/ /*Normalize Data back to 12-bits*/
x = x >> 4; x = x >> 4;
y = y >> 4; y = y >> 4;
ESP_LOGI(TAG, "P_norm(%d,%d)", x, y); ESP_LOGV(TAG, "P_norm(%d,%d)", x, y);
xpt2046_corr(&x, &y); xpt2046_corr(&x, &y);
xpt2046_avg(&x, &y); xpt2046_avg(&x, &y);
last_x = x; last_x = x;
last_y = y; last_y = y;
ESP_LOGI(TAG, "x = %d, y = %d", x, y); ESP_LOGV(TAG, "x = %d, y = %d", x, y);
} }
else else
{ {