From: p15692025051 <846603105@qq.com> Date: Fri, 2 Jun 2023 01:20:54 +0000 (+0800) Subject: 1.微聊bug修正 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=a448e8172b64521213677fc66ee7cf4f3bb66c8e;p=mirrors%2FASR1603_G5.git 1.微聊bug修正 2.擅长obj的地方添加锁 --- 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 95f9040b..3329179f 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 @@ -75,6 +75,7 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_code_t event_code, void * param) /*Build a simple linked list from the objects used in the events *It's important to know if this object was deleted by a nested event *called from this `event_cb`.*/ + //LV_LOG_ERROR("event[%x]prev[%x]e[%x]\n", event_head, e.prev, &e); e.prev = event_head; event_head = &e; Helios_Mutex_Unlock(lv_event_mutex); @@ -84,6 +85,7 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_code_t event_code, void * param) /*Remove this element from the list*/ Helios_Mutex_Lock(lv_event_mutex, HELIOS_WAIT_FOREVER); + //LV_LOG_ERROR("event1[%x]prev[%x]e[%x]\n", event_head, e.prev, &e); event_head = e.prev; Helios_Mutex_Unlock(lv_event_mutex); @@ -169,6 +171,12 @@ void _lv_event_mark_deleted(lv_obj_t * obj) while(e) { if(e->current_target == obj || e->target == obj) e->deleted = 1; + if(e == e->prev) + { + event_head = NULL; + LV_LOG_ERROR("_lv_event_mark_deleted:assert\n"); + break; + } e = e->prev; } diff --git a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/misc/lv_timer.c b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/misc/lv_timer.c index f1cd3f29..51be3cff 100644 --- a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/misc/lv_timer.c +++ b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/misc/lv_timer.c @@ -59,28 +59,26 @@ void _lv_timer_core_init(void) /*Initially enable the lv_timer handling*/ lv_timer_enable(true); } -#include "helios_debug.h" -#define QPY_LVGL_LOG(msg, ...) custom_log(lvgl, msg, ##__VA_ARGS__) + /** * Call it periodically to handle lv_timers. * @return the time after which it must be called again */ LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler(void) { - QPY_LVGL_LOG("begin"); + TIMER_TRACE("begin"); /*Avoid concurrent running of the timer handler*/ static bool already_running = false; if(already_running) { - QPY_LVGL_LOG("already running, concurrent calls are not allow, returning"); + TIMER_TRACE("already running, concurrent calls are not allow, returning"); //return 1; } already_running = true; if(lv_timer_run == false) { already_running = false; /*Release mutex*/ - QPY_LVGL_LOG("lv_timer_run, concurrent calls are not allow, returning"); - //return 1; + return 1; } static uint32_t idle_period_start = 0; @@ -93,7 +91,7 @@ LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler(void) run_cnt++; if(run_cnt > 100) { run_cnt = 0; - QPY_LVGL_LOG("It seems lv_tick_inc() is not called."); + LV_LOG_WARN("It seems lv_tick_inc() is not called."); } } @@ -143,7 +141,7 @@ LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler(void) already_running = false; /*Release the mutex*/ - QPY_LVGL_LOG("finished (%d ms until the next timer call)", time_till_next); + TIMER_TRACE("finished (%d ms until the next timer call)", time_till_next); return time_till_next; } diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appWechat.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appWechat.py index 69dabb8d..70baa11c 100644 --- a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appWechat.py +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appWechat.py @@ -99,11 +99,16 @@ class WechatScreen(Screen): with open("/ext/static/storage_file/wechat_record.json","r") as fd:#音频文件编号 self.wechat_recode_list = ujson.load(fd) if not self.wechat_recode_list: + self.wechat_recode_list = {"num":0} self.wechat_num = 0 else: b = str("num") in self.wechat_recode_list.keys() if b == True: self.wechat_num = self.wechat_recode_list["num"] + else : + self.wechat_recode_list = {"num":0} + with open("/ext/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd: + ujson.dump(self.wechat_recode_list,fd) # if self.wechat_num != 0: # with open("/ext/static/storage_file/wechat_record.json","r",encoding="utf-8") as fd:#音频文件记录 # self.wechat_recode_list = ujson.load(fd)#读取每一个amr音频文件的时长ui_setting.py @@ -161,21 +166,23 @@ class WechatScreen(Screen): self.ble_send = 0 self.wechat_show = 0 self.wechat_show_list = 0 - self.old_num = self.wechat_num + #self.old_num = self.wechat_num + self.updata_list_show_lock =0 def get_wechat_data(self,event, msg): - return [self.MXA_MSG,self.wechat_num ,self.wechat_recode_list] + return [self.MXA_MSG ,self.wechat_recode_list] def set_wechat_data(self, event, msg): self.MXA_MSG = msg[0] - self.wechat_num = msg[1] - self.wechat_recode_list = msg[2] + + self.wechat_recode_list = msg[1] + self.wechat_num = self.wechat_recode_list["num"] with open("/ext/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd: ujson.dump(self.wechat_recode_list,fd) #写编号 - self.old_num = self.wechat_num - print("set_wechat_data:{} {}".format(self.wechat_num,self.old_num)) + #self.old_num = self.wechat_num + print("set_wechat_data:{} ".format(self.wechat_num)) # with open("/ext/static/storage_file/wechat_num.txt","w") as fd: # fd.write("{}".format(self.wechat_num)) @@ -189,7 +196,7 @@ class WechatScreen(Screen): - + #index=0 不改变列表控件显示到lcd上;index=2只更新列表控件,不显示;index=1更新列表并显示控件 def updata_list_show(self,index): global wechat_screen_list_screen if self.press_state != 1: @@ -198,6 +205,10 @@ class WechatScreen(Screen): self.wechat_list.clear_flag(lv.obj.FLAG.HIDDEN) wechat_label.add_flag(lv.obj.FLAG.HIDDEN) elif index == 2 or index == 1: + if self.updata_list_show_lock == 0: + self.updata_list_show_lock = 1 + else : + return #读取json文件中的键作为label文本; #print("self.wechat_list.self.wechat_num:{}".format(self.wechat_num)) @@ -291,7 +302,8 @@ class WechatScreen(Screen): _btn_img.set_src("E:/static/APP/wechat/S_3.png") _btn_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) bottom_btn1 = self.wechat_list.get_child(-1) - bottom_btn1.scroll_to_view(lv.ANIM.OFF) + bottom_btn1.scroll_to_view(lv.ANIM.OFF) + self.updata_list_show_lock = 0 def initialization(self): self.aud.setVolume(11)#设置最大声录音 @@ -323,7 +335,7 @@ class WechatScreen(Screen): self.wechat_num = 0 self.wechat_num += 1 self.wechat_show = self.wechat_num - + self.wechat_recode_list["num"] = self.wechat_num print("talking self.wechat_num ...:{} self.MXA_MSG:{}".format(self.wechat_num,self.MXA_MSG)) self.record_test.start("/ext/static/storage_file/{}.amr".format(self.wechat_num),16) self.second_timer.start(1000, 1, self.reduce_second) @@ -352,14 +364,8 @@ class WechatScreen(Screen): self.second_timer.stop() #停止计时器 self.countdown_old = self.countdown # print("self.countdown :{} self.wechat_num:{} self.wechat_recode_list:{} self.wechat_show:{}".format(self.countdown,self.wechat_num,self.wechat_recode_list,self.wechat_show)) - num_total = 0 - num_total = len(self.wechat_recode_list) - if num_total == 0: - num_total+=1 - if num_total >= 10: - num_total = self.MXA_MSG self.wechat_recode_list["%02d"%(self.wechat_show)] = "S:{}".format(str(self.countdown)) - self.wechat_recode_list["num"] = num_total + self.wechat_recode_list["num"] = self.wechat_show #读音频amr二进制数据 @@ -403,6 +409,11 @@ class WechatScreen(Screen): self.play_img_cnt.set_src("E:/static/APP/wechat/R_3.png") elif self.play_text == "S:": self.play_img_cnt.set_src("E:/static/APP/wechat/S_3.png") + get_play = EventMesh.publish("get_audio_state") + if get_play != None: + if get_play == 0: + if self.play_text == "R:" and self.play_sec > 0: + self.play_timer.stop() #点击播放 def play_label(self,e): @@ -595,9 +606,10 @@ class TK_ProtoCol(ProtoCol): # print("TK_ProtoCol:recv:datalen{}".format(len(msg))) arm_data = bytearray(str[1])#获取amr输出 get_wechat_data = EventMesh.publish("get_wechat_data") - wechat_num = get_wechat_data[1] + MXA_MSG = get_wechat_data[0] - wechat_recode_list = get_wechat_data[2] + wechat_recode_list = get_wechat_data[1] + wechat_num = wechat_recode_list["num"] # print("TK_ProtoCol:datalen:{} {} {}".format(wechat_num,MXA_MSG,wechat_recode_list)) if wechat_num >= MXA_MSG: @@ -606,22 +618,15 @@ class TK_ProtoCol(ProtoCol): wechat_num += 1 elif wechat_num > 0: wechat_num += 1 - #'01':'R:09' 'num':'01' - #写记录列表 - num_total = 0 - num_total = len(wechat_recode_list) - if num_total == 0: - num_total+=1 - if num_total >= 10: - num_total = 10 - - print("num_total:datalen:{} {} {}".format(num_total,MXA_MSG,wechat_recode_list)) + + + print("num_total:datalen:{} {}".format(MXA_MSG,wechat_recode_list)) wechat_recode_list["%02d"%(wechat_num)] = "R:{}".format(3) - wechat_recode_list['num'] = num_total - EventMesh.publish("set_wechat_data",[MXA_MSG,num_total,wechat_recode_list]) + wechat_recode_list['num'] = wechat_num + EventMesh.publish("set_wechat_data",[MXA_MSG,wechat_recode_list]) #写语音文件数据 - get_send_state=EventMesh.publish("get_send_state") - if get_send_state != 1: + screen_NAME=EventMesh.publish("get_screen_NAME") + if screen_NAME != "wechat": EventMesh.publish("load_screen", {"screen": "wechat_popup"}) else: EventMesh.publish("wechat_updata_list_show") @@ -686,9 +691,10 @@ class MESSAGE_ProtoCol(ProtoCol): get_wechat_data = EventMesh.publish("get_wechat_data") - wechat_num = get_wechat_data[1] + MXA_MSG = get_wechat_data[0] - wechat_recode_list = get_wechat_data[2] + wechat_recode_list = get_wechat_data[1] + wechat_num = wechat_recode_list["num"] # print("TK_ProtoCol:datalen:{} {} {}".format(wechat_num,MXA_MSG,wechat_recode_list)) if wechat_num >= MXA_MSG: @@ -699,22 +705,16 @@ class MESSAGE_ProtoCol(ProtoCol): wechat_num += 1 msg_txt = {} # 0 1 2 3 - num_total = 0 - num_total = len(wechat_recode_list) - if num_total == 0: - num_total+=1 - if num_total >= 10: - num_total = 10 print("wechat_num:init {}".format(wechat_num)) msg_txt = UnicodeHexStr_To_Utf8Str(msg_s) # print("msg_txt:{}".format(msg_txt)) wechat_recode_list["%02d"%(wechat_num)] = "T:{}".format(msg_txt) - wechat_recode_list['num'] = num_total - EventMesh.publish("set_wechat_data",[MXA_MSG,num_total,wechat_recode_list]) + wechat_recode_list['num'] = wechat_num + EventMesh.publish("set_wechat_data",[MXA_MSG,wechat_recode_list]) # print("wechat_recode_list:len data:{}".format(wechat_recode_list)) EventMesh.publish(constants.PROTOCOL.MESSAGE_SEND) - get_send_state=EventMesh.publish("get_send_state") - if get_send_state != 1: + screen_NAME=EventMesh.publish("get_screen_NAME") + if screen_NAME != "wechat": EventMesh.publish("load_screen", {"screen": "wechat_popup"}) else: EventMesh.publish("wechat_updata_list_show") 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 7f3a5397..0e783d2d 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 @@ -628,7 +628,7 @@ class CallLogScreen(Screen): self.read_call_log = {} self.check_json = 0 self.call_log_detail_list = None - + self.btn_create_lock = 0 self.timer = osTimer() EventMesh.subscribe("call_log_update_show_list", self.call_log_update_show_list) @@ -700,6 +700,10 @@ class CallLogScreen(Screen): h = 0 if call_log_screen != None: if self.check_json == True and len(self.read_call_log) != 0: + if self.btn_create_lock == 0: + self.btn_create_lock = 1 + else : + return none_call_log_title.set_text(" ") self.call_log_detail_list.delete()#先删除一次控件 self.call_log_detail_list = lv.obj(call_log_cont_list_screen) @@ -757,6 +761,7 @@ class CallLogScreen(Screen): _btn_label5.set_text(num_name) _btn_label5.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) h = h + 1 + self.btn_create_lock = 0 else: if call_log_cont_list_screen != None: none_call_log_title.set_text("暂无记录") @@ -1121,6 +1126,7 @@ class PopupScreen(Screen): self.msg_detail = {} self.msg_nums = 0 self.sms_detail_list = None + self.btn_create_lock = 0 def post_processor_before_initialization(self): self.msg_nums = sms.getMsgNums() #获取短信条数 @@ -1182,6 +1188,10 @@ class PopupScreen(Screen): j = 0 print("self.msg_nums:{}".format(self.msg_nums)) if self.msg_nums > 0 : + if self.btn_create_lock == 0 : + self.btn_create_lock = 1 + else : + return msg_list_t_done_img.add_flag(lv.obj.FLAG.HIDDEN) no_msg_text.add_flag(lv.obj.FLAG.HIDDEN) self.sms_detail_list.delete()#先删除一次控件 @@ -1241,6 +1251,7 @@ class PopupScreen(Screen): if msg == 1: bottom_btn = self.sms_detail_list.get_child(-1) bottom_btn.scroll_to_view(lv.ANIM.OFF) + self.btn_create_lock = 0 else: if msg_cont_list_screen != None: msg_list_t_done_img.clear_flag(lv.obj.FLAG.HIDDEN) @@ -2152,6 +2163,7 @@ class ContactsScreen(Screen): self.check_json = 0 self.timer = osTimer() self.contact_detail_list = None + self.btn_create_list_show_lock = 0 EventMesh.subscribe("contact_updata_list_show", self.btn_create_list) @@ -2210,6 +2222,10 @@ class ContactsScreen(Screen): global contacts_screen,contacts_cont,contacts_top_title,contact_none_label,contacts_screen_list_screen #读取json文件中的键作为label文本; if self.check_json == True and len(self.phonebook) != 0: + if self.btn_create_list_show_lock == 0: + self.btn_create_list_show_lock = 1 + else : + return contact_none_label.add_flag(lv.obj.FLAG.HIDDEN)#隐藏空文本 j =0 i = 0 @@ -2262,7 +2278,8 @@ class ContactsScreen(Screen): i += 1 if state == 1: bottom_btn = self.contact_detail_list.get_child(-1) - bottom_btn.scroll_to_view(lv.ANIM.OFF) + bottom_btn.scroll_to_view(lv.ANIM.OFF) + self.btn_create_list_show_lock = 1 else: if contacts_screen_list_screen != None: contact_none_label.clear_flag(lv.obj.FLAG.HIDDEN) #显示空文本 @@ -3682,7 +3699,7 @@ class UI(object): EventMesh.subscribe("set_interrup_incall", self.set_interrup_incall) EventMesh.subscribe("get_interrup_incall", self.get_interrup_incall) - + EventMesh.subscribe("get_screen_NAME",self.get_screen_NAME) self.system_sleep_timer.start(1000, 1, self.system_sleep_timer_cb) def set_interrup_incall(self, event, msg): @@ -3847,7 +3864,9 @@ class UI(object): self.screen_list.append(screen) return self - + def get_screen_NAME(self, event, msg): + return self.screen.NAME + def load_screen(self, topic, msg): print("msg1={}".format(msg)) if self.UI_high_priority_flag == 1:#电话界面屏蔽其他界面