@@ -304,8 +304,10 @@ bool Touch::readRawData(int points_num, int buttons_num, int timeout_ms)
304
304
// Get the points
305
305
ESP_UTILS_CHECK_FALSE_RETURN (readRawDataPoints (points_num), false , " Read points failed" );
306
306
307
+ #if CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0
307
308
// Get the buttons
308
309
ESP_UTILS_CHECK_FALSE_RETURN (readRawDataButtons (buttons_num), false , " Read buttons failed" );
310
+ #endif
309
311
310
312
ESP_UTILS_LOG_TRACE_EXIT_WITH_THIS ();
311
313
@@ -610,10 +612,10 @@ bool Touch::readRawDataButtons(int buttons_num)
610
612
}
611
613
// Limit the max buttons number
612
614
if (buttons_num > BUTTONS_MAX_NUM) {
613
- buttons_num = BUTTONS_MAX_NUM;
614
615
ESP_UTILS_LOGW (
615
616
" The target buttons number(%d) out of range, use the max number(%d) instead" , buttons_num, BUTTONS_MAX_NUM
616
617
);
618
+ buttons_num = BUTTONS_MAX_NUM;
617
619
}
618
620
if (buttons_num <= 0 ) {
619
621
ESP_UTILS_LOGD (" Ignore to read buttons" );
@@ -627,13 +629,14 @@ bool Touch::readRawDataButtons(int buttons_num)
627
629
628
630
for (int i = 0 ; i < buttons_num; i++) {
629
631
button_state = 0 ;
632
+ #if CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0
630
633
auto ret = esp_lcd_touch_get_button_state (touch_panel, i, &button_state);
631
634
if (ret == ESP_ERR_INVALID_ARG) {
632
635
ESP_UTILS_LOGD (" Button(%d) is not supported" , i);
633
636
break ;
634
637
}
635
638
ESP_UTILS_CHECK_ERROR_RETURN (ret, false , " Get button(%d) state failed" , i);
636
-
639
+ # endif
637
640
buttons.emplace_back (i, button_state);
638
641
}
639
642
0 commit comments