From: p15692025051 <846603105@qq.com> Date: Mon, 8 May 2023 12:28:09 +0000 (+0800) Subject: TP新增按下消息 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=e862b40d943b622a1a387d22d5fa3072e0478c18;p=mirrors%2FASR1603_G5.git TP新增按下消息 --- diff --git a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/btn_device_ec800m.py b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/btn_device_ec800m.py index 310e0be0..ba4c187c 100644 --- a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/btn_device_ec800m.py +++ b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/btn_device_ec800m.py @@ -24,28 +24,31 @@ class BtnDevice(Abstract): self.__tp.set_callback(self.__ui_callback) def __ui_callback(self, para): - print("para = {}".format(para)) + #print("para = {}".format(para)) if para == 0: EventMesh.publish("done_left_to_right") - print("<-") + #print("<-") elif para == 1: EventMesh.publish("done_right_to_left") - print("->") + #print("->") elif para == 2: EventMesh.publish("done_bottom_to_top") - print("^") + #print("^") elif para == 3: EventMesh.publish("done_top_to_bottom") - print("V") + #print("V") elif para == 4: EventMesh.publish("done_return") - print("return") + #print("return") elif para == 5: EventMesh.publish("done_click") - print("CLICK") + #print("CLICK") + elif para == 6: + EventMesh.publish("done_press") + #print("press") elif (para == 6): EventMesh.publish("done_error") - print("error") + #print("error") def key_callback(self, l_list): print("key_callback:",str(l_list)) diff --git a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/tp_cst816.c b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/tp_cst816.c index e2226a72..2762dad7 100644 --- a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/tp_cst816.c +++ b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/tp_cst816.c @@ -413,6 +413,7 @@ typedef enum TP_DOWN_SLIDE, TP_RETURN, TP_CLICK, + TP_PRESS, TP_ERROR }TP_STATE_E; @@ -468,6 +469,9 @@ loop: static void get_silde_state(bool valid, uint16_t x, uint16_t y) { static bool state = false; static uint16_t x_s = 0, y_s = 0; + if(valid == true) + TP_CALLBACK_OP(TP_PRESS); + if(state == false && valid == true) { state = true; x_s = x; diff --git a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/ui.py b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/ui.py index 8cdf7b5d..b72e0986 100644 --- a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/ui.py +++ b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/ui.py @@ -3394,6 +3394,7 @@ class UI(object): EventMesh.subscribe("done_return", self.ui_press) EventMesh.subscribe("done_click", self.ui_press) EventMesh.subscribe("done_error", self.ui_press) + EventMesh.subscribe("done_press", self.ui_press) EventMesh.subscribe("call_in", self.publish_call_in) EventMesh.subscribe("get_lcd_state", self.get_lcd_state) @@ -3420,7 +3421,7 @@ class UI(object): def ui_press(self, event, key): self.system_sleep_timeout_rest() - print("ui press {}".format(event)) + #print("ui press {}".format(event)) if event == "done_left_to_right": self.screen.done_left_to_right() if event == "done_right_to_left": @@ -3433,6 +3434,8 @@ class UI(object): self.screen.done_return() if event == "done_click": self.screen.done_click() + # if event == "done_press": + # self.system_sleep_timeout_rest() def btn_press(self, event, key): print("btn_press: {}".format(event)) #主表盘按电源键,息屏