From: d15521469561 Date: Mon, 29 May 2023 07:20:44 +0000 (+0800) Subject: 修改部分ui X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=a98431c4c4db0849704d76ad10cb0f22493ce5fb;p=mirrors%2FASR1603_G5.git 修改部分ui --- diff --git a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/core/lv_event.c b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/core/lv_event.c index 143ff34b..95f9040b 100644 --- a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/core/lv_event.c +++ b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/core/lv_event.c @@ -8,6 +8,7 @@ *********************/ #include "lv_obj.h" #include "lv_indev.h" +#include "helios_os.h" /********************* * DEFINES @@ -34,7 +35,7 @@ static bool event_is_bubbled(lv_event_t * e); /********************** * STATIC VARIABLES **********************/ -static lv_event_t * event_head; +static lv_event_t * event_head = NULL; /********************** * MACROS @@ -49,11 +50,17 @@ static lv_event_t * event_head; * GLOBAL FUNCTIONS **********************/ +static Helios_Mutex_t lv_event_mutex = 0; + + lv_res_t lv_event_send(lv_obj_t * obj, lv_event_code_t event_code, void * param) { if(obj == NULL) return LV_RES_OK; - + if(0 == lv_event_mutex) { + lv_event_mutex = Helios_Mutex_Create(); + } LV_ASSERT_OBJ(obj, MY_CLASS); + Helios_Mutex_Lock(lv_event_mutex, HELIOS_WAIT_FOREVER); lv_event_t e; e.target = obj; @@ -70,12 +77,15 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_code_t event_code, void * param) *called from this `event_cb`.*/ e.prev = event_head; event_head = &e; + Helios_Mutex_Unlock(lv_event_mutex); /*Send the event*/ lv_res_t res = event_send_core(&e); /*Remove this element from the list*/ + Helios_Mutex_Lock(lv_event_mutex, HELIOS_WAIT_FOREVER); event_head = e.prev; + Helios_Mutex_Unlock(lv_event_mutex); return res; } @@ -150,12 +160,19 @@ uint32_t lv_event_register_id(void) void _lv_event_mark_deleted(lv_obj_t * obj) { + + if(0 == lv_event_mutex) { + lv_event_mutex = Helios_Mutex_Create(); + } + Helios_Mutex_Lock(lv_event_mutex, HELIOS_WAIT_FOREVER); lv_event_t * e = event_head; while(e) { if(e->current_target == obj || e->target == obj) e->deleted = 1; e = e->prev; } + + Helios_Mutex_Unlock(lv_event_mutex); } diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui.py index 5796ce4e..7f3a5397 100644 --- a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui.py +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui.py @@ -3206,6 +3206,8 @@ class StopwatchScreen(Screen): self.sec_value = 0 self.min_value = 0 self.s_state = 0 + self.total_time = 0 + self.TimeSecond = 0 self.timer = osTimer() def initialization(self): @@ -3309,7 +3311,20 @@ class StopwatchScreen(Screen): if self.s_state == 0: self.reset(0) - + if self.s_state == 1: + date_tmp = utime.localtime() + timeSecond = utime.mktime(date_tmp) + reduce = timeSecond - self.TimeSecond + self.total_time = self.total_time+reduce + if self.total_time >= 99*60: + self.total_time = 99*60 + self.ms_value = 0 + stopwatch_start_img.clear_flag(lv.obj.FLAG.HIDDEN) + stopwatch_stop_img.add_flag(lv.obj.FLAG.HIDDEN) + self.show_value() + else: + self.timer.start(100,1,self._fun) + def start(self, e): global stopwatch_screen,stopwatch_title,stopwatch_label_min,stopwatch_mao,stopwatch_label_sec ,\ @@ -3325,10 +3340,11 @@ class StopwatchScreen(Screen): self.s_state = 1 if self.s_state != 2: self.s_state = 1 - if self.ms_value > 0 or self.sec_value > 0 or self.min_value > 0: + if self.total_time >= 99*60: self.ms_value = 0 self.sec_value = 0 self.min_value = 0 + self.total_time = 0 self.show_value() self.timer.start(100,1,self._fun) stopwatch_stop_img.clear_flag(lv.obj.FLAG.HIDDEN) @@ -3357,6 +3373,7 @@ class StopwatchScreen(Screen): self.min_value = 0 self.ms_value = 0 self.s_state = 0 + self.total_time = 0 stopwatch_start_img.clear_flag(lv.obj.FLAG.HIDDEN) stopwatch_stop_img.add_flag(lv.obj.FLAG.HIDDEN) self.timer.stop() @@ -3367,11 +3384,11 @@ class StopwatchScreen(Screen): if self.ms_value > 9: self.ms_value = 0 self.sec_value += 1 - if self.sec_value > 60: + self.total_time+=1 + if self.sec_value > 59: self.sec_value = 0 - self.min_value += 1 - if self.min_value > 99: - self.min_value = 99 + if self.total_time > 99*60: + self.total_time = 99*60 self.timer.stop() stopwatch_start_img.clear_flag(lv.obj.FLAG.HIDDEN) stopwatch_stop_img.add_flag(lv.obj.FLAG.HIDDEN) @@ -3382,12 +3399,56 @@ class StopwatchScreen(Screen): global stopwatch_screen,stopwatch_title,stopwatch_label_min,stopwatch_mao,stopwatch_label_sec ,\ stopwatch_mao1 ,stopwatch_label_ms,stopwatch_reset_img ,topwatch_reset_imgbtn ,stopwatch_start_img ,\ stopwatch_start_imgbtn, stopwatch_stop_img - if self.min_value >= 99: - self.min_value = 99 + if self.total_time >= 99*60: + self.total_time = 99*60 + test_s = self.total_time % 60 + test_m = self.total_time//60 + # print("test_s:{} test_m:{} self.total_time:{}".format(test_s,test_m,self.total_time)) stopwatch_label_ms.set_text(str("%d"%(self.ms_value))) - stopwatch_label_sec.set_text(str("%02d"%(self.sec_value))) - stopwatch_label_min.set_text(str("%02d"%(self.min_value))) + stopwatch_label_sec.set_text(str("%02d"%(test_s))) + stopwatch_label_min.set_text(str("%02d"%(test_m))) + + def Close(self): + if self.s_state == 1: + self.timer.stop() + date_tmp = utime.localtime() + self.TimeSecond = utime.mktime(date_tmp) + + def lcd_on(self): + if self.s_state == 1: + date_tmp = utime.localtime() + timeSecond = utime.mktime(date_tmp) + reduce = timeSecond - self.TimeSecond + self.total_time = self.total_time+reduce + total = self.total_time // 60 + if total >= 99: + self.total_time = 99*60 + self.timer.stop() + self.s_state = 0 + self.ms_value = 0 + stopwatch_start_img.clear_flag(lv.obj.FLAG.HIDDEN) + stopwatch_stop_img.add_flag(lv.obj.FLAG.HIDDEN) + self.show_value() + else: + + print("stopwatch reset start:{}".format(self.s_state)) + #self.timer.start(100, 1, self._fun) + self.show_value() + self.timer.start(100,1,self._fun) + stopwatch_stop_img.clear_flag(lv.obj.FLAG.HIDDEN) + stopwatch_start_img.add_flag(lv.obj.FLAG.HIDDEN) + # print("ms_value start:{} {} {}".format(self.ms_value,self.sec_value,self.min_value)) + + pass + + def lcd_off(self): + if self.s_state == 1: + date_tmp = utime.localtime() + timeSecond = utime.mktime(date_tmp) + self.TimeSecond = timeSecond + self.timer.stop() + pass def done_return(self): if self.s_state == 0: @@ -3789,7 +3850,7 @@ class UI(object): def load_screen(self, topic, msg): print("msg1={}".format(msg)) - if self.UI_high_priority_flag == 1: + if self.UI_high_priority_flag == 1:#电话界面屏蔽其他界面 return for scr in self.screen_list: if scr.NAME == msg["screen"]: