Browse Source

update:触屏框架提前开启中断避免错过时间过长

Dozingfiretruck 6 months ago
parent
commit
71aed51ebd
2 changed files with 10 additions and 13 deletions
  1. 8 9
      components/tp/luat_lib_tp.c
  2. 2 4
      components/tp/luat_tp.c

+ 8 - 9
components/tp/luat_lib_tp.c

@@ -77,20 +77,19 @@ static int l_tp_handler(lua_State* L, void* ptr) {
             lua_call(L, 2, 0);
         }
     }
-    luat_tp_config->opts->read_done(luat_tp_config);
     return 0;
 }
 
 int l_tp_callback(luat_tp_config_t* luat_tp_config, luat_tp_data_t* luat_tp_data){
-	for(uint8_t i = 0; i < LUAT_TP_TOUCH_MAX; i++) {
+	uint8_t i = 0;
+    for(i = 0; i < LUAT_TP_TOUCH_MAX; i++) {
 		if (luat_tp_data[i].event != TP_EVENT_TYPE_NONE) {
-		    rtos_msg_t msg = {.handler = l_tp_handler, .ptr=luat_tp_config, .arg1=luat_tp_data};
-		    luat_msgbus_put(&msg, 1);
-		    return 0;
-		}
-	}
-    luat_tp_config->opts->read_done(luat_tp_config);
-	return -1;
+            rtos_msg_t msg = {.handler = l_tp_handler, .ptr=luat_tp_config, .arg1=luat_tp_data};
+            luat_msgbus_put(&msg, 1);
+            return 0;
+        }
+    }
+    return -1;
 }
 
 /*

+ 2 - 4
components/tp/luat_tp.c

@@ -44,12 +44,10 @@ void luat_tp_task_entry(void* param){
         //     last_y = tp_data->y_coordinate;
         // }
         
-
-        if (luat_tp_config->callback == NULL){
-            luat_tp_config->opts->read_done(luat_tp_config);
-        }else{
+        if (luat_tp_config->callback){
             luat_tp_config->callback(luat_tp_config,tp_data);
         }
+        luat_tp_config->opts->read_done(luat_tp_config);
     }
 }