touch: adapt touch-related code to compile with -Wno-format flag

This commit is contained in:
wangyuanze
2022-08-08 14:42:59 +08:00
parent c25c254666
commit 48ce5d7c01
5 changed files with 56 additions and 53 deletions

View File

@@ -8,5 +8,4 @@ if(IDF_TARGET IN_LIST TOUCH_ELEMENT_COMPATIBLE_TARGETS)
INCLUDE_DIRS include
REQUIRES driver
PRIV_REQUIRES esp_timer)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
endif()

View File

@@ -12,6 +12,7 @@
#include <string.h>
#include <sys/queue.h>
#include <inttypes.h>
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "esp_log.h"

View File

@@ -5,6 +5,7 @@
*/
#include <string.h>
#include <inttypes.h>
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "freertos/queue.h"
@@ -402,7 +403,7 @@ static void te_proc_timer_cb(void *arg)
ESP_LOGD(TE_DEBUG_TAG, "Set waterproof shield level");
}
}
ESP_LOGD(TE_DEBUG_TAG, "read denoise channel %d", s_te_obj->denoise_channel_raw);
ESP_LOGD(TE_DEBUG_TAG, "read denoise channel %"PRIu32, s_te_obj->denoise_channel_raw);
} else if (te_intr_msg.intr_type == TE_INTR_TIMEOUT) { //Timeout processing
touch_pad_timeout_resume();
}
@@ -516,7 +517,7 @@ esp_err_t te_dev_set_threshold(te_dev_t *device)
{
uint32_t smo_val = te_read_smooth_signal(device->channel);
esp_err_t ret = touch_pad_set_thresh(device->channel, device->sens * smo_val);
ESP_LOGD(TE_DEBUG_TAG, "channel: %d, smo_val: %d", device->channel, smo_val);
ESP_LOGD(TE_DEBUG_TAG, "channel: %"PRIu8", smo_val: %"PRIu32, device->channel, smo_val);
return ret;
}
@@ -812,14 +813,14 @@ static bool waterproof_channel_check(touch_pad_t channel_num)
te_waterproof_handle_t waterproof_handle = s_te_obj->waterproof_handle;
if (waterproof_shield_check_state()) {
if (channel_num == waterproof_handle->shield_channel) {
ESP_LOGE(TE_TAG, "TOUCH_PAD_NUM%d has been used for waterproof shield channel,"
ESP_LOGE(TE_TAG, "TOUCH_PAD_NUM%"PRIu8" has been used for waterproof shield channel,"
" please change the touch sensor channel or disable waterproof", channel_num);
return true;
}
}
if (waterproof_guard_check_state()) {
if (channel_num == waterproof_handle->guard_device->channel) {
ESP_LOGE(TE_TAG, "TOUCH_PAD_NUM%d has been used for waterproof guard channel,"
ESP_LOGE(TE_TAG, "TOUCH_PAD_NUM%"PRIu8" has been used for waterproof guard channel,"
" please change the touch sensor channel or disable waterproof", channel_num);
return true;
}

View File

@@ -12,6 +12,7 @@
#include <string.h>
#include <sys/queue.h>
#include <inttypes.h>
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "esp_log.h"
@@ -575,7 +576,7 @@ static void matrix_proc_state(te_matrix_handle_t matrix_handle)
if (matrix_handle->current_state == TE_STATE_PRESS) {
if (matrix_handle->last_state == TE_STATE_IDLE) { //IDLE ---> Press = On_Press
matrix_update_position(matrix_handle, press_pos);
ESP_LOGD(TE_DEBUG_TAG, "matrix press (%d, %d)", matrix_handle->position.x_axis, matrix_handle->position.y_axis);
ESP_LOGD(TE_DEBUG_TAG, "matrix press (%"PRIu8", %"PRIu8")", matrix_handle->position.x_axis, matrix_handle->position.y_axis);
if (event_mask & TOUCH_ELEM_EVENT_ON_PRESS) {
matrix_handle->event = TOUCH_MATRIX_EVT_ON_PRESS;
matrix_dispatch(matrix_handle, dispatch_method);
@@ -583,7 +584,7 @@ static void matrix_proc_state(te_matrix_handle_t matrix_handle)
} else if (matrix_handle->last_state == TE_STATE_PRESS) { //Press ---> Press = On_LongPress
if (event_mask & TOUCH_ELEM_EVENT_ON_LONGPRESS) {
if (++matrix_handle->trigger_cnt >= matrix_handle->trigger_thr) {
ESP_LOGD(TE_DEBUG_TAG, "matrix longpress (%d, %d)", matrix_handle->position.x_axis, matrix_handle->position.y_axis);
ESP_LOGD(TE_DEBUG_TAG, "matrix longpress (%"PRIu8", %"PRIu8")", matrix_handle->position.x_axis, matrix_handle->position.y_axis);
matrix_handle->event = TOUCH_MATRIX_EVT_ON_LONGPRESS;
matrix_dispatch(matrix_handle, dispatch_method);
matrix_handle->trigger_cnt = 0;
@@ -592,7 +593,7 @@ static void matrix_proc_state(te_matrix_handle_t matrix_handle)
}
} else if (matrix_handle->current_state == TE_STATE_RELEASE) {
if (matrix_handle->last_state == TE_STATE_PRESS) { //Press ---> Release = On_Release
ESP_LOGD(TE_DEBUG_TAG, "matrix release (%d, %d)", matrix_handle->position.x_axis, matrix_handle->position.y_axis);
ESP_LOGD(TE_DEBUG_TAG, "matrix release (%"PRIu8", %"PRIu8")", matrix_handle->position.x_axis, matrix_handle->position.y_axis);
if (event_mask & TOUCH_ELEM_EVENT_ON_RELEASE) {
matrix_handle->event = TOUCH_MATRIX_EVT_ON_RELEASE;
matrix_dispatch(matrix_handle, dispatch_method);