W9 K01 UI调整
authordxy15521469561 <1731678236@qq.com>
Tue, 16 Jul 2024 03:12:27 +0000 (11:12 +0800)
committerdxy15521469561 <1731678236@qq.com>
Tue, 16 Jul 2024 03:12:27 +0000 (11:12 +0800)
17 files changed:
2.sdk-ZY/project/K01/sdk/services/microPython/ports/quectel/core/alarm.py
2.sdk-ZY/project/K01/sdk/services/microPython/ports/quectel/core/appWechat.py
2.sdk-ZY/project/K01/sdk/services/microPython/ports/quectel/core/mgr.py
2.sdk-ZY/project/K01/sdk/services/microPython/ports/quectel/core/ui.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/EventMesh.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/ai.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/alarm.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/appFactoryMode.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/appWechat.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/mgr.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/protocol.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/ui.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/ui_setting.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/ui_video.py
2.sdk-ZY/project/W9/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/autoconf.h
2.sdk-ZY/project/W9/usr/static/AI/ai_talk_bt.png [deleted file]
2.sdk-ZY/project/W9/usr/static/REDUCE_VOLUM_ICON.png [deleted file]

index b27a855..92a9a45 100644 (file)
@@ -128,7 +128,7 @@ no_add_alarm.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 alarm_list = [{'hour': 16, 'repeart': 10, 'idx': 0, 'enabled': 0, 'days': [0,1,2,3,4,5,6], 'minute': 39},
                {'hour': 16, 'repeart': 10, 'idx': 1, 'enabled': 0, 'days': [0,1,2,3,4,5,6], 'minute': 39}]
 #用于显示闹钟列表不包含开关机信息
-
+import usys
 class ClockManager(Abstract):
     def __init__(self):
         super().__init__()
@@ -139,8 +139,11 @@ class ClockManager(Abstract):
         IFEXIST = ql_fs.path_exists("/usr/static/storage_file/alarm_msg.json") 
         self.check_alarm_list = []     
         if IFEXIST == True:
-            with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
-                self.check_alarm_list = ujson.load(fd)
+            try:
+                with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
+                    self.check_alarm_list = ujson.load(fd)
+            except Exception as e:
+                usys.print_exception(e)
         print("self.check_alarm_list",self.check_alarm_list)
 
     def post_processor_after_instantiation(self):
@@ -180,8 +183,11 @@ class ClockManager(Abstract):
         global alarm_list     
         print("IFEXIST:{}".format(IFEXIST))
         if IFEXIST == True:
-            with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
-                alarm_list = ujson.load(fd)
+            try:
+                with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
+                    alarm_list = ujson.load(fd)
+            except Exception as e:
+                usys.print_exception(e)
         return alarm_list
 
     def add_alarm(self, event, msg):
index cad776a..4a02c43 100644 (file)
@@ -161,15 +161,18 @@ class WechatScreen(Screen):
         self.msg_tmp = ""
         check_txt = ql_fs.path_exists("/usr/static/storage_file/wechat_record.json")
         if check_txt == True :
-            with open("/usr/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"]
+            try:
+                with open("/usr/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"]
+            except Exception as e:
+                usys.print_exception(e)
         else :
             self.wechat_recode_list = {"num":0}
             with open("/usr/static/storage_file/wechat_record.json","w+",encoding="utf-8") as fd:
index ebe6a2d..886efa9 100644 (file)
@@ -2330,9 +2330,12 @@ class AddrBookManager(Abstract):
         self.check_json = ql_fs.path_exists("/usr/static/storage_file/phonebook.json")
 
         if self.check_json == True:
-            with open("/usr/static/storage_file/phonebook.json","r",encoding="utf-8") as fd:
-                self.read_phonebook = ujson.load(fd)
+            try:
+                with open("/usr/static/storage_file/phonebook.json","r",encoding="utf-8") as fd:
+                    self.read_phonebook = ujson.load(fd)
                 print("读取电话本")
+            except Exception as e:
+                usys.print_exception(e)
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("get_phonebook_list", self.get)
@@ -2354,9 +2357,12 @@ class videoBookManager(Abstract):
         self.check_json = ql_fs.path_exists("/usr/static/storage_file/videobook.json")
 
         if self.check_json == True:
-            with open("/usr/static/storage_file/videobook.json","r",encoding="utf-8") as fd:
-                self.videobook = ujson.load(fd)
-                print("读取视频通话账号列表")
+            try:
+                with open("/usr/static/storage_file/videobook.json","r",encoding="utf-8") as fd:
+                    self.videobook = ujson.load(fd)
+                    print("读取视频通话账号列表")
+            except Exception as e:
+                usys.print_exception(e)
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("get_videobook_list", self.get)
@@ -2447,9 +2453,12 @@ class CallLogManager(Abstract):
         self.check_json = ql_fs.path_exists("/usr/static/storage_file/Call_log.json")
 
         if self.check_json == True:
-            with open("/usr/static/storage_file/Call_log.json","r",encoding="utf-8") as fd:
-                self.read_call_log = ujson.load(fd)
-                print("读取通话记录")
+            try:
+                with open("/usr/static/storage_file/Call_log.json","r",encoding="utf-8") as fd:
+                    self.read_call_log = ujson.load(fd)
+                    print("读取通话记录")
+            except Exception as e:
+                usys.print_exception(e)
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("get_call_log_list", self.get)
@@ -2518,18 +2527,27 @@ class gethistoryDataManager(Abstract):
 
         check_hr= ql_fs.path_exists("/usr/static/storage_file/history_hr.json")
         if check_hr == True :
-            with open("/usr/static/storage_file/history_hr.json","r") as fd:#音频文件编号
-                self.read_histroy_hr_data = ujson.load(fd)
+            try:
+                with open("/usr/static/storage_file/history_hr.json","r") as fd:#音频文件编号
+                    self.read_histroy_hr_data = ujson.load(fd)
+            except Exception as e:
+                usys.print_exception(e)
         
         check_temp= ql_fs.path_exists("/usr/static/storage_file/history_temp.json")
         if check_temp == True :
-            with open("/usr/static/storage_file/history_temp.json","r") as fd:#音频文件编号
-                self.read_histroy_temp_data = ujson.load(fd)
+            try:
+                with open("/usr/static/storage_file/history_temp.json","r") as fd:#音频文件编号
+                    self.read_histroy_temp_data = ujson.load(fd)
+            except Exception as e:
+                usys.print_exception(e)
 
         check_spo2= ql_fs.path_exists("/usr/static/storage_file/history_spo2.json")
         if check_spo2 == True :
-            with open("/usr/static/storage_file/history_spo2.json","r") as fd:#音频文件编号
-                self.read_histroy_spo2_data = ujson.load(fd)
+            try:
+                with open("/usr/static/storage_file/history_spo2.json","r") as fd:#音频文件编号
+                    self.read_histroy_spo2_data = ujson.load(fd)
+            except Exception as e:
+                usys.print_exception(e)
         self.temp_value = 0
         
         # self.read_histroy_hr_data=[{"timeSec":16789890,"value":90},{"timeSec":16789888,"value":78},{"timeSec":16789688,"value":68},{"timeSec":16789898,"value":58},\
@@ -2860,8 +2878,14 @@ class getStorageDataManager(Abstract):#获取内存数据
         self.config_data = {}
         check = ql_fs.path_exists("/usr/static/storage_file/config.json")
         if check == True:
-            with open("/usr/static/storage_file/config.json","r") as fd:
-                self.config_data = ujson.load(fd)
+            try:
+                with open("/usr/static/storage_file/config.json","r") as fd:
+                    self.config_data = ujson.load(fd)
+            except Exception as e:
+                usys.print_exception(e)
+                self.config_data = {'old_time': 0, 'flip_sw': 0}
+            
+            
         else :
             self.config_data = {'old_time': 0, 'flip_sw': 0}
             pass
@@ -3369,15 +3393,18 @@ class cameraAlbumManager(Abstract):#保存相册数目
         self.album_num = 0
         check_txt = ql_fs.path_exists("/usr/static/storage_file/album_config.json")
         if check_txt == True :
-            with open("/usr/static/storage_file/album_config.json","r") as fd:#音频文件编号
-                self.album_list = ujson.load(fd)
-                if not self.album_list:
-                    self.album_list = {}
-                    self.album_num = 0 
-                else:
-                    b = str("num") in self.album_list.keys()
-                    if b == True:
-                        self.album_num = self.album_list["num"]
+            try:
+                with open("/usr/static/storage_file/album_config.json","r") as fd:#音频文件编号
+                    self.album_list = ujson.load(fd)
+                    if not self.album_list:
+                        self.album_list = {}
+                        self.album_num = 0 
+                    else:
+                        b = str("num") in self.album_list.keys()
+                        if b == True:
+                            self.album_num = self.album_list["num"]
+            except Exception as e:
+                usys.print_exception(e)
         else :
             self.album_list = {}
             with open("/usr/static/storage_file/album_config.json","w+",encoding="utf-8") as fd:
@@ -3426,11 +3453,13 @@ class setclassTimeManager(Abstract):#设置上课禁用时间
         check_json = ql_fs.path_exists("/usr/static/storage_file/class_msg.json")
 
         if check_json == True:
-            with open("/usr/static/storage_file/class_msg.json","r",encoding="utf-8") as fd:
-                self.class_buf = ujson.load(fd)
-                print("读取上课禁用时间段")
+            try:
+                with open("/usr/static/storage_file/class_msg.json","r",encoding="utf-8") as fd:
+                    self.class_buf = ujson.load(fd)
+                    print("读取上课禁用时间段")
                 # print("self.class_buf:",self.class_buf)
-        
+            except Exception as e:
+                usys.print_exception(e)
 
 
     def post_processor_after_instantiation(self):
index 92d1112..f6ca0ae 100644 (file)
@@ -6287,46 +6287,46 @@ class StopwatchScreen(Screen):
             stopwatch_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
             stopwatch_label_min = lv.label(stopwatch_screen)
-            stopwatch_label_min.set_pos(33, 50)
-            stopwatch_label_min.set_size(20, 30)
-            stopwatch_label_min.set_text("00")
+            stopwatch_label_min.set_pos(0, 50)
+            stopwatch_label_min.set_size(128, 30)
+            stopwatch_label_min.set_text("00:00.0")
             stopwatch_label_min.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
             stopwatch_label_min.set_long_mode(lv.label.LONG.WRAP)
-            stopwatch_label_min.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
+            stopwatch_label_min.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
 
-            stopwatch_mao = lv.label(stopwatch_screen)
-            stopwatch_mao.set_pos(53, 50)
-            stopwatch_mao.set_size(12, 30)
-            stopwatch_mao.set_text(":")
-            stopwatch_mao.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
-            stopwatch_mao.set_long_mode(lv.label.LONG.WRAP)
-            stopwatch_mao.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
+            # stopwatch_mao = lv.label(stopwatch_screen)
+            # stopwatch_mao.set_pos(53, 50)
+            # stopwatch_mao.set_size(12, 30)
+            # stopwatch_mao.set_text(":")
+            # stopwatch_mao.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
+            # stopwatch_mao.set_long_mode(lv.label.LONG.WRAP)
+            # stopwatch_mao.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
 
 
-            stopwatch_label_sec = lv.label(stopwatch_screen)
-            stopwatch_label_sec.set_pos(59, 50)
-            stopwatch_label_sec.set_size(20, 30)
-            stopwatch_label_sec.set_text("00")
-            stopwatch_label_sec.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
-            stopwatch_label_sec.set_long_mode(lv.label.LONG.WRAP)
-            stopwatch_label_sec.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            # stopwatch_label_sec = lv.label(stopwatch_screen)
+            # stopwatch_label_sec.set_pos(59, 50)
+            # stopwatch_label_sec.set_size(20, 30)
+            # stopwatch_label_sec.set_text("00")
+            # stopwatch_label_sec.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
+            # stopwatch_label_sec.set_long_mode(lv.label.LONG.WRAP)
+            # stopwatch_label_sec.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
 
-            stopwatch_mao1 = lv.label(stopwatch_screen)
-            stopwatch_mao1.set_pos(80, 50)
-            stopwatch_mao1.set_size(12, 30)
-            stopwatch_mao1.set_text(".")
-            stopwatch_mao1.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
-            stopwatch_mao1.set_long_mode(lv.label.LONG.WRAP)
-            stopwatch_mao1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
+            # stopwatch_mao1 = lv.label(stopwatch_screen)
+            # stopwatch_mao1.set_pos(80, 50)
+            # stopwatch_mao1.set_size(12, 30)
+            # stopwatch_mao1.set_text(".")
+            # stopwatch_mao1.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
+            # stopwatch_mao1.set_long_mode(lv.label.LONG.WRAP)
+            # stopwatch_mao1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
 
 
-            stopwatch_label_ms = lv.label(stopwatch_screen)
-            stopwatch_label_ms.set_pos(85, 50)
-            stopwatch_label_ms.set_size(12, 30)
-            stopwatch_label_ms.set_text("0")
-            stopwatch_label_ms.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
-            stopwatch_label_ms.set_long_mode(lv.label.LONG.WRAP)
-            stopwatch_label_ms.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
+            # stopwatch_label_ms = lv.label(stopwatch_screen)
+            # stopwatch_label_ms.set_pos(85, 50)
+            # stopwatch_label_ms.set_size(12, 30)
+            # stopwatch_label_ms.set_text("0")
+            # stopwatch_label_ms.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
+            # stopwatch_label_ms.set_long_mode(lv.label.LONG.WRAP)
+            # stopwatch_label_ms.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
 
 
 
@@ -6454,7 +6454,10 @@ class StopwatchScreen(Screen):
         self.timer.stop()
         self.show_value()
 
-    def _fun(self,e):
+    def _fun(self,*argc):
+        EventMesh.publish("publish_message_event_ui",{"func":self._fun_cb,"data":0})
+
+    def _fun_cb(self,e):
         self.ms_value += 1
         if self.ms_value > 9:
             self.ms_value = 0   
@@ -6480,11 +6483,11 @@ class StopwatchScreen(Screen):
         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"%(test_s)))
-        # stopwatch_label_sec.set_text("{}:{}.{}".format("%02d"%(test_m),"%02d"%(test_s),"%d"%(self.ms_value)))
-        stopwatch_label_min.set_text(str("%02d"%(test_m)))
+        stopwatch_label_min.set_text(str("%02d:%02d.%d"%(test_m,test_s,self.ms_value)))
+        # stopwatch_label_ms.set_text(str("%d"%(self.ms_value)))
+        # stopwatch_label_sec.set_text(str("%02d"%(test_s)))
+        # # stopwatch_label_sec.set_text("{}:{}.{}".format("%02d"%(test_m),"%02d"%(test_s),"%d"%(self.ms_value)))
+        # stopwatch_label_min.set_text(str("%02d"%(test_m)))
 
     def Close(self):
         if self.s_state == 1:
@@ -8273,8 +8276,9 @@ class UI(object):
 
     def ui_press(self, event, key):
         screen_NAME = EventMesh.publish("get_screen_NAME")
-        if screen_NAME == "system_init":
-            return
+        if screen_NAME != None:
+            if screen_NAME == "system_init":
+                return
         self.system_sleep_timeout_rest()
         #print("ui press {}".format(event))
         if event == "done_left_to_right":
@@ -8293,8 +8297,9 @@ class UI(object):
         #     self.system_sleep_timeout_rest()
     def btn_press(self, event, key):
         screen_NAME = EventMesh.publish("get_screen_NAME")
-        if screen_NAME == "system_init":
-            return
+        if screen_NAME != None:
+            if screen_NAME == "system_init":
+                return
         print("btn_press: {}".format(event))
         #主表盘按电源键,息屏
         
@@ -8343,8 +8348,9 @@ class UI(object):
 
     def btn_release(self, event, msg):
         screen_NAME = EventMesh.publish("get_screen_NAME")
-        if screen_NAME == "system_init":
-            return
+        if screen_NAME != None:
+            if screen_NAME == "system_init":
+                return
         print("btn_release: {}".format(event))
         # if self.main_flag != 1 and self.sleep_flag == 0:
         #     self.__lcd_on()
@@ -8447,7 +8453,10 @@ class UI(object):
         return self
     
     def get_screen_NAME(self, event, msg):
-        return self.screen.NAME
+        if self.screen != None:
+            return self.screen.NAME
+        else:
+            return None
     
     def load_screen_cb(self, topic, msg):
         EventMesh.publish("publish_message_event_ui",{"func":self.load_screen,"data":msg})  
index ecdd687..03eb2e5 100644 (file)
@@ -91,9 +91,9 @@ def txt_log(data):
     if Txt_Log != 0 :
         print(data)
         try:
-            f_stat = uos.stat("ext/log.txt")
+            f_stat = uos.stat("usr/log.txt")
             if f_stat[6] >50*1024:
-                uos.remove("ext/log.txt") 
+                uos.remove("usr/log.txt") 
         except Exception as e:
             usys.print_exception(e)
         with open("/usr/log.txt","a",encoding="utf-8") as fd:
index c2af60f..038bcfc 100644 (file)
@@ -408,6 +408,34 @@ al_talk_screen_icon1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
 # al_talk_screen_icon.add_flag(lv.obj.FLAG.CLICKABLE)
 # al_talk_screen_icon.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
 
+ai_talk_start_animal_spinner_1 = lv.spinner(AI_talk_screen, 0, 60)
+ai_talk_start_animal_spinner_1.set_pos(int((240-60)//2),int(110))
+ai_talk_start_animal_spinner_1.set_size(60,60)
+ai_talk_start_animal_spinner_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+ai_talk_start_animal_spinner_1_default = lv.style_t()
+ai_talk_start_animal_spinner_1_default.init()
+ai_talk_start_animal_spinner_1_default.set_bg_color(lv.color_make(0x00,0x00,0x00))
+ai_talk_start_animal_spinner_1_default.set_bg_grad_color(lv.color_make(0xee,0xee,0xf6))
+ai_talk_start_animal_spinner_1_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
+ai_talk_start_animal_spinner_1_default.set_bg_opa(255)
+ai_talk_start_animal_spinner_1_default.set_pad_left(0)
+ai_talk_start_animal_spinner_1_default.set_pad_right(0)
+ai_talk_start_animal_spinner_1_default.set_pad_top(0)
+ai_talk_start_animal_spinner_1_default.set_pad_bottom(0)
+ai_talk_start_animal_spinner_1_default.set_arc_color(lv.color_make(0x80,0x80,0x80))
+ai_talk_start_animal_spinner_1_default.set_arc_width(8)
+# add style for screen_spinner_1
+ai_talk_start_animal_spinner_1.add_style(ai_talk_start_animal_spinner_1_default, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+# create style style_screen_spinner_1_main_indicator_default
+style_screen_spinner_1_main_indicator_default = lv.style_t()
+style_screen_spinner_1_main_indicator_default.init()
+style_screen_spinner_1_main_indicator_default.set_arc_color(lv.color_make(0x23,0xf6,0x2a))
+style_screen_spinner_1_main_indicator_default.set_arc_width(8)
+
+# add style for screen_spinner_1
+ai_talk_start_animal_spinner_1.add_style(style_screen_spinner_1_main_indicator_default, lv.PART.INDICATOR|lv.STATE.DEFAULT)
+
 
 al_talk_screen_icon = lv.label(AI_talk_screen)
 al_talk_screen_icon.set_pos(int(5),int(210))
@@ -602,6 +630,36 @@ al_listen_screen_title1.set_text("识别中...")
 al_listen_screen_title1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
 al_listen_screen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
+ai_listen_animal_spinner_1 = lv.spinner(AI_listen_screen, 1000, 60)
+ai_listen_animal_spinner_1.set_pos(int((240-60)//2),int(110))
+ai_listen_animal_spinner_1.set_size(60,60)
+ai_listen_animal_spinner_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+ai_listen_animal_spinner_1_default = lv.style_t()
+ai_listen_animal_spinner_1_default.init()
+ai_listen_animal_spinner_1_default.set_bg_color(lv.color_make(0x00,0x00,0x00))
+ai_listen_animal_spinner_1_default.set_bg_grad_color(lv.color_make(0xee,0xee,0xf6))
+ai_listen_animal_spinner_1_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
+ai_listen_animal_spinner_1_default.set_bg_opa(255)
+ai_listen_animal_spinner_1_default.set_pad_left(0)
+ai_listen_animal_spinner_1_default.set_pad_right(0)
+ai_listen_animal_spinner_1_default.set_pad_top(0)
+ai_listen_animal_spinner_1_default.set_pad_bottom(0)
+ai_listen_animal_spinner_1_default.set_arc_color(lv.color_make(0x80,0x80,0x80))
+ai_listen_animal_spinner_1_default.set_arc_width(8)
+# add style for screen_spinner_1
+ai_listen_animal_spinner_1.add_style(ai_listen_animal_spinner_1_default, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+# create style style_screen_spinner_1_main_indicator_default
+style_screen_spinner_1_main_indicator_default = lv.style_t()
+style_screen_spinner_1_main_indicator_default.init()
+style_screen_spinner_1_main_indicator_default.set_arc_color(lv.color_make(0x23,0xf6,0x2a))
+style_screen_spinner_1_main_indicator_default.set_arc_width(8)
+
+# add style for screen_spinner_1
+ai_listen_animal_spinner_1.add_style(style_screen_spinner_1_main_indicator_default, lv.PART.INDICATOR|lv.STATE.DEFAULT)
+
+
+
 
 # al_listen_screen_icon1 = lv.gif(AI_listen_screen)
 # al_listen_screen_icon1.set_size(140,45)
@@ -620,6 +678,10 @@ al_listen_screen_icon1.set_src("U:/static/AI/AI_LISTEN_GIF001.png")
 
 al_listen_screen_icon1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
 
+
+
+
+
 # al_listen_screen_icon = lv.img(AI_listen_screen)
 # al_listen_screen_icon.set_size(230,58)
 # al_listen_screen_icon.set_pos((240-230)//2,210)
@@ -632,8 +694,8 @@ al_listen_screen_icon_bt.set_size(240, 190)
 al_listen_screen_icon_bt.set_pos(0,92)
 
 al_listen_screen_title4 = lv.label(AI_listen_screen)
-al_listen_screen_title4.set_pos(0, 220)
-al_listen_screen_title4.set_size(240, 58)
+al_listen_screen_title4.set_pos(0, 230)
+al_listen_screen_title4.set_size(240, 52)
 al_listen_screen_title4.set_text("正在聆听...")
 al_listen_screen_title4.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
 al_listen_screen_title4.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
@@ -654,6 +716,36 @@ al_think_screen_title1.set_text("正在思考...")
 al_think_screen_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
 al_think_screen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
+
+ai_think_animal_spinner_1 = lv.spinner(AI_think_screen, 1000, 60)
+ai_think_animal_spinner_1.set_pos(int((240-60)//2),int(110))
+ai_think_animal_spinner_1.set_size(60,60)
+ai_think_animal_spinner_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+# create style style_screen_spinner_1_main_main_default
+style_screen_spinner_1_main_main_default = lv.style_t()
+style_screen_spinner_1_main_main_default.init()
+style_screen_spinner_1_main_main_default.set_bg_color(lv.color_make(0x00,0x00,0x00))
+style_screen_spinner_1_main_main_default.set_bg_grad_color(lv.color_make(0xee,0xee,0xf6))
+style_screen_spinner_1_main_main_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
+style_screen_spinner_1_main_main_default.set_bg_opa(255)
+style_screen_spinner_1_main_main_default.set_pad_left(0)
+style_screen_spinner_1_main_main_default.set_pad_right(0)
+style_screen_spinner_1_main_main_default.set_pad_top(0)
+style_screen_spinner_1_main_main_default.set_pad_bottom(0)
+style_screen_spinner_1_main_main_default.set_arc_color(lv.color_make(0x80,0x80,0x80))
+style_screen_spinner_1_main_main_default.set_arc_width(8)
+
+# add style for screen_spinner_1
+ai_think_animal_spinner_1.add_style(style_screen_spinner_1_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+style_screen_spinner_1_main_indicator_default = lv.style_t()
+style_screen_spinner_1_main_indicator_default.init()
+style_screen_spinner_1_main_indicator_default.set_arc_color(lv.color_make(0x23,0xf6,0x2a))
+style_screen_spinner_1_main_indicator_default.set_arc_width(8)
+
+# add style for screen_spinner_1
+ai_think_animal_spinner_1.add_style(style_screen_spinner_1_main_indicator_default, lv.PART.INDICATOR|lv.STATE.DEFAULT)
+
 # al_think_screen_icon = lv.gif(AI_think_screen)
 # al_think_screen_icon.set_size(130,130)
 # al_think_screen_icon.set_pos((240-130)//2,65)
@@ -697,28 +789,6 @@ al_talk_screen_icon_main_main_default.set_pad_bottom(0)
 # add style for screen_label_1
 al_think_screen_icon1.add_style(al_talk_screen_icon_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
 
-# al_think_screen_icon1 = lv.btn(AI_think_screen)
-# al_think_screen_icon1.set_pos(int(5),int(210))
-# al_think_screen_icon1.set_size(230,58)
-# al_think_screen_icon1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# al_no_sim_popup_screen_icon1_label = lv.label(al_think_screen_icon1)
-# al_no_sim_popup_screen_icon1_label.set_text("取消")
-# al_think_screen_icon1.set_style_pad_all(0, lv.STATE.DEFAULT)
-# al_no_sim_popup_screen_icon1_label.align(lv.ALIGN.CENTER,0,0)
-# # create style style_screen_btn_1_main_main_default
-# al_no_sim_popup_screen_icon1_label_default = lv.style_t()
-# al_no_sim_popup_screen_icon1_label_default.init()
-# al_no_sim_popup_screen_icon1_label_default.set_radius(20)
-# al_no_sim_popup_screen_icon1_label_default.set_bg_color(lv.color_make(0x19,0x19,0x19))
-# al_no_sim_popup_screen_icon1_label_default.set_bg_grad_color(lv.color_make(0x19,0x19,0x19))
-# al_no_sim_popup_screen_icon1_label_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
-# al_no_sim_popup_screen_icon1_label_default.set_bg_opa(255)
-# al_no_sim_popup_screen_icon1_label_default.set_border_color(lv.color_make(0x19,0x19,0x19))
-# al_no_sim_popup_screen_icon1_label_default.set_border_width(0)
-# al_no_sim_popup_screen_icon1_label_default.set_border_opa(255)
-# al_no_sim_popup_screen_icon1_label_default.set_text_color(lv.color_make(253, 82, 19))
-# al_no_sim_popup_screen_icon1_label_default.set_text_font(lv.lv_font_20_ALL)
-# al_no_sim_popup_screen_icon1_label_default.set_text_align(lv.TEXT_ALIGN.CENTER)
 
 # # add style for screen_btn_1
 # al_think_screen_icon1.add_style(al_no_sim_popup_screen_icon1_label_default, lv.PART.MAIN|lv.STATE.DEFAULT)
@@ -809,28 +879,6 @@ al_talk_screen_icon_main_main_default.set_pad_bottom(0)
 # add style for screen_label_1
 al_connect_timerout_icon1.add_style(al_talk_screen_icon_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
 
-# al_connect_timerout_icon1 = lv.btn(AI_connect_timerout_screen)
-# al_connect_timerout_icon1.set_pos(int(5),int(210))
-# al_connect_timerout_icon1.set_size(230,58)
-# al_connect_timerout_icon1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# al_no_sim_popup_screen_icon1_label = lv.label(al_connect_timerout_icon1)
-# al_no_sim_popup_screen_icon1_label.set_text("确定")
-# al_connect_timerout_icon1.set_style_pad_all(0, lv.STATE.DEFAULT)
-# al_no_sim_popup_screen_icon1_label.align(lv.ALIGN.CENTER,0,0)
-# # create style style_screen_btn_1_main_main_default
-# al_no_sim_popup_screen_icon1_label_default = lv.style_t()
-# al_no_sim_popup_screen_icon1_label_default.init()
-# al_no_sim_popup_screen_icon1_label_default.set_radius(20)
-# al_no_sim_popup_screen_icon1_label_default.set_bg_color(lv.color_make(0x19,0x19,0x19))
-# al_no_sim_popup_screen_icon1_label_default.set_bg_grad_color(lv.color_make(0x19,0x19,0x19))
-# al_no_sim_popup_screen_icon1_label_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
-# al_no_sim_popup_screen_icon1_label_default.set_bg_opa(255)
-# al_no_sim_popup_screen_icon1_label_default.set_border_color(lv.color_make(0x19,0x19,0x19))
-# al_no_sim_popup_screen_icon1_label_default.set_border_width(0)
-# al_no_sim_popup_screen_icon1_label_default.set_border_opa(255)
-# al_no_sim_popup_screen_icon1_label_default.set_text_color(lv.color_make(0xff,0xff,0xff))
-# al_no_sim_popup_screen_icon1_label_default.set_text_font(lv.lv_font_20_ALL)
-# al_no_sim_popup_screen_icon1_label_default.set_text_align(lv.TEXT_ALIGN.CENTER)
 
 # # add style for screen_btn_1
 # al_connect_timerout_icon1.add_style(al_no_sim_popup_screen_icon1_label_default, lv.PART.MAIN|lv.STATE.DEFAULT)
@@ -920,28 +968,7 @@ al_talk_screen_icon_main_main_default.set_pad_bottom(0)
 # add style for screen_label_1
 al_not_listen_icon1.add_style(al_talk_screen_icon_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
 
-# al_not_listen_icon1 = lv.btn(AI_not_listen_text_screen)
-# al_not_listen_icon1.set_pos(int(5),int(210))
-# al_not_listen_icon1.set_size(230,58)
-# al_not_listen_icon1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# al_no_sim_popup_screen_icon1_label = lv.label(al_not_listen_icon1)
-# al_no_sim_popup_screen_icon1_label.set_text("确定")
-# al_not_listen_icon1.set_style_pad_all(0, lv.STATE.DEFAULT)
-# al_no_sim_popup_screen_icon1_label.align(lv.ALIGN.CENTER,0,0)
-# # create style style_screen_btn_1_main_main_default
-# al_no_sim_popup_screen_icon1_label_default = lv.style_t()
-# al_no_sim_popup_screen_icon1_label_default.init()
-# al_no_sim_popup_screen_icon1_label_default.set_radius(20)
-# al_no_sim_popup_screen_icon1_label_default.set_bg_color(lv.color_make(0x19,0x19,0x19))
-# al_no_sim_popup_screen_icon1_label_default.set_bg_grad_color(lv.color_make(0x19,0x19,0x19))
-# al_no_sim_popup_screen_icon1_label_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
-# al_no_sim_popup_screen_icon1_label_default.set_bg_opa(255)
-# al_no_sim_popup_screen_icon1_label_default.set_border_color(lv.color_make(0x19,0x19,0x19))
-# al_no_sim_popup_screen_icon1_label_default.set_border_width(0)
-# al_no_sim_popup_screen_icon1_label_default.set_border_opa(255)
-# al_no_sim_popup_screen_icon1_label_default.set_text_color(lv.color_make(0xff,0xff,0xff))
-# al_no_sim_popup_screen_icon1_label_default.set_text_font(lv.lv_font_20_ALL)
-# al_no_sim_popup_screen_icon1_label_default.set_text_align(lv.TEXT_ALIGN.CENTER)
+
 
 # # add style for screen_btn_1
 # al_not_listen_icon1.add_style(al_no_sim_popup_screen_icon1_label_default, lv.PART.MAIN|lv.STATE.DEFAULT)
@@ -981,7 +1008,7 @@ class AIScreen(Screen):#AI_GUI
         self.record.gain_set(4,10)
         self.aud = audio.Audio(0)
         self.audio_play_state = 1 #音频播放完状态
-        self.aud.setCallback(self.audio_cb)
+        
         
         self.TTS_PRO_TYPE = 0 #TTS协议类型,=0:用长文本合成接口,=1用音频流合成接口
         self.AI_audio_queue_thread_id = 0
@@ -1037,7 +1064,7 @@ class AIScreen(Screen):#AI_GUI
         self.play_flag = 0 
         self.play_end = 0
         self.play_flag_init = 0
-        AI_screen.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,1)),
+        AI_screen.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,0)),
                                       lv.EVENT.GESTURE, None)
         
         al_talk_screen_icon.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,1)),
@@ -1541,29 +1568,6 @@ class AIScreen(Screen):#AI_GUI
         self.websocket_connect_tts()
         
         pass
-    
-    def audio_cb(self,event):
-        if event == 0:
-            self.audio_play_state =1
-            EventMesh.publish("set_audio_state", 1)
-            print('audio-play start. ai')
-        elif event == 7:
-            self.audio_play_state = 0
-            EventMesh.publish("set_audio_state", 0)
-            # if self.AI_audio_queue.size() > 0:
-            #     data = self.AI_audio_queue.get()
-            #     print("audio_queue:data:{}".format(len(data)))
-            #     if len(data) > 1:
-            #         try:
-            #             # while self.audio_play_state :
-            #             #     utime.sleep_ms(1)
-            #             EventMesh.publish("system_sleep_rest")#防止黑屏
-            #             tmp=self.aud.playStream(3, data)#播放音频流文件
-            #             self.audio_play_state =1
-            #             print("playStream:{}".format(tmp))
-            #         except Exception as e:
-            #             usys.print_exception(e)    
-            #print('audio-play finish.')
     def AI_init(self):
         self.AI_audio_queue_thread_id = _thread.start_new_thread(self.AI_audio_queue_thread, ())
         self.AI_send_data_queue_thread_id = _thread.start_new_thread(self.AI_send_data_queue_thread, ())
index 5bad5df..d63eae9 100644 (file)
@@ -419,7 +419,7 @@ label_ok.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
 alarm_list = [{'hour': 16, 'repeart': 10, 'idx': 0, 'enabled': 0, 'days': [], 'minute': 39},
                {'hour': 16, 'repeart': 10, 'idx': 1, 'enabled': 0, 'days': [], 'minute': 39}]
 #用于显示闹钟列表不包含开关机信息
-
+import usys
 class ClockManager(Abstract):
     def __init__(self):
         super().__init__()
@@ -430,8 +430,11 @@ class ClockManager(Abstract):
         IFEXIST = ql_fs.path_exists("/usr/static/storage_file/alarm_msg.json") 
         self.check_alarm_list = []     
         if IFEXIST == True:
-            with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
-                self.check_alarm_list = ujson.load(fd)
+            try:
+                with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
+                    self.check_alarm_list = ujson.load(fd)
+            except Exception as e:
+                usys.print_exception(e)
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("push_clock_info", self.set)
@@ -470,8 +473,11 @@ class ClockManager(Abstract):
         global alarm_list     
         print("IFEXIST:{}".format(IFEXIST))
         if IFEXIST == True:
-            with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
-                alarm_list = ujson.load(fd)
+            try:
+                with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
+                    alarm_list = ujson.load(fd)
+            except Exception as e:
+                usys.print_exception(e)
         return alarm_list
 
     def add_alarm(self, event, msg):
index a3c7c78..18f19d2 100644 (file)
@@ -256,8 +256,11 @@ class FactoryModeLogScreen(Screen):
     def initialization(self):
         print("FactoryModeLogScreen")
         self.Log_timer.start(1000,1,self.Log_timer_cb) 
-        with open("/usr/log.txt","r",encoding="utf-8") as fd:
-            self.log_data = fd.read()
+        try:
+            with open("/usr/log.txt","r",encoding="utf-8") as fd:
+                self.log_data = fd.read()
+        except Exception as e:
+            usys.print_exception(e)
             print(self.log_data)
         if len(self.log_data) < screen_log_len:
             FactoryModeLog_label.set_text("第1页\n"+self.log_data)
index b7517a2..432936f 100644 (file)
@@ -95,22 +95,26 @@ class WechatScreen(Screen):
 
     def __init__(self):
         super().__init__()
-        self.MXA_MSG = 10
+        self.MXA_MSG = 2
         self.wechat_recode_list = {}
         self.wechat_num = 0
         self.volum_size = 8 
         self.msg_tmp = ""
         check_txt = ql_fs.path_exists("/usr/static/storage_file/wechat_record.json")
         if check_txt == True :
-            with open("/usr/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"]
+            try:
+                with open("/usr/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"]
+            except Exception as e:
+                usys.print_exception(e)
         else :
             self.wechat_recode_list = {"num":0}
             with open("/usr/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd:
@@ -218,7 +222,7 @@ class WechatScreen(Screen):
         self.MXA_MSG = msg[0]
         self.wechat_recode_list = msg[1]
         self.wechat_num = self.wechat_recode_list["num"]
-        with open("/usr/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd:
+        with open("/usr/static/storage_file/wechat_record.json","w+",encoding="utf-8") as fd:
                 ujson.dump(self.wechat_recode_list,fd)
             #写编号
         Wechat_log("set_wechat_data2:{} ".format(self.wechat_num))
@@ -558,7 +562,7 @@ class WechatScreen(Screen):
         if self.play_text == "R:" or self.play_text == "S:":#过滤掉文字显示 不需要播放音频文件
             self.aud = audio.Audio(0)
             self.aud.stop()#
-            self.aud.play(1, 1, '/ext/static/storage_file/{}.amr'.format(i))  #文件名前面要加上路径
+            self.aud.play(1, 1, 'U:/static/storage_file/{}.amr'.format(i))  #文件名前面要加上路径
         self.paay_btn_old_count = self.paay_btn_count
         Wechat_log("play_label2")
 
index 2c55eda..b39ff74 100644 (file)
@@ -2686,9 +2686,12 @@ class AddrBookManager(Abstract):
         self.check_json = ql_fs.path_exists("/usr/static/storage_file/phonebook.json")
 
         if self.check_json == True:
-            with open("/usr/static/storage_file/phonebook.json","r",encoding="utf-8") as fd:
-                self.read_phonebook = ujson.load(fd)
-                print("读取电话本")
+            try:
+                with open("/usr/static/storage_file/phonebook.json","r",encoding="utf-8") as fd:
+                    self.read_phonebook = ujson.load(fd)
+                    print("读取电话本")
+            except Exception as e:
+                usys.print_exception(e)
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("get_phonebook_list", self.get)
@@ -2762,9 +2765,12 @@ class CallLogManager(Abstract):
         self.check_json = ql_fs.path_exists("/usr/static/storage_file/Call_log.json")
 
         if self.check_json == True:
-            with open("/usr/static/storage_file/Call_log.json","r",encoding="utf-8") as fd:
-                self.read_call_log = ujson.load(fd)
-                print("读取通话记录")
+            try:
+                with open("/usr/static/storage_file/Call_log.json","r",encoding="utf-8") as fd:
+                    self.read_call_log = ujson.load(fd)
+                    print("读取通话记录")
+            except Exception as e:
+                usys.print_exception(e)
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("get_call_log_list", self.get)
@@ -2843,23 +2849,32 @@ class gethistoryDataManager(Abstract):
                     self.read_histroy_hr_data = []
         check_temp= ql_fs.path_exists("/usr/static/storage_file/history_temp.json")
         if check_temp == True :
-            with open("/usr/static/storage_file/history_temp.json","r") as fd:#音频文件编号
-                self.read_histroy_temp_data = ujson.load(fd)
-                if self.read_histroy_temp_data == None:
-                    self.read_histroy_temp_data = []
+            try:
+                with open("/usr/static/storage_file/history_temp.json","r") as fd:#音频文件编号
+                    self.read_histroy_temp_data = ujson.load(fd)
+                    if self.read_histroy_temp_data == None:
+                        self.read_histroy_temp_data = []
+            except Exception as e:
+                usys.print_exception(e)
         check_spo2= ql_fs.path_exists("/usr/static/storage_file/history_spo2.json")
         if check_spo2 == True :
-            with open("/usr/static/storage_file/history_spo2.json","r") as fd:#音频文件编号
-                self.read_histroy_spo2_data = ujson.load(fd)
-                if self.read_histroy_spo2_data == None:
-                    self.read_histroy_spo2_data = []
+            try:
+                with open("/usr/static/storage_file/history_spo2.json","r") as fd:#音频文件编号
+                    self.read_histroy_spo2_data = ujson.load(fd)
+                    if self.read_histroy_spo2_data == None:
+                        self.read_histroy_spo2_data = []
+            except Exception as e:
+                usys.print_exception(e)
         
         check_blood= ql_fs.path_exists("/usr/static/storage_file/history_blood.json")
         if check_blood == True :
-            with open("/usr/static/storage_file/history_blood.json","r") as fd:#音频文件编号
-                self.read_histroy_blood_data = ujson.load(fd)
-                if self.read_histroy_blood_data == None:
-                    self.read_histroy_blood_data = []
+            try:
+                with open("/usr/static/storage_file/history_blood.json","r") as fd:#音频文件编号
+                    self.read_histroy_blood_data = ujson.load(fd)
+                    if self.read_histroy_blood_data == None:
+                        self.read_histroy_blood_data = []
+            except Exception as e:
+                usys.print_exception(e)
         self.temp_value = 0
         
         # self.read_histroy_hr_data=[{"timeSec":16789890,"value":90},{"timeSec":16789888,"value":78},{"timeSec":16789688,"value":68},{"timeSec":16789898,"value":58},\
@@ -2905,7 +2920,7 @@ class gethistoryDataManager(Abstract):
             else:
                 self.read_histroy_blood_data.append({"timeSec": time_tmp, "blMax": self.blMax,"blMin": self.blMin}) 
 
-            with open("/usr/static/storage_file/history_blood.json","w",encoding="utf-8") as fd:
+            with open("/usr/static/storage_file/history_blood.json","w+",encoding="utf-8") as fd:
                 ujson.dump(self.read_histroy_blood_data,fd)
             print(self.read_histroy_blood_data)
             EventMesh.publish("show_history_blood_data")
@@ -2947,7 +2962,7 @@ class gethistoryDataManager(Abstract):
             else:
                 self.read_histroy_temp_data.append({"timeSec": time_tmp, "temp": self.temp_value}) 
 
-            with open("/usr/static/storage_file/history_temp.json","w",encoding="utf-8") as fd:
+            with open("/usr/static/storage_file/history_temp.json","w+",encoding="utf-8") as fd:
                 ujson.dump(self.read_histroy_temp_data,fd)
             #print(self.read_histroy_temp_data)
             EventMesh.publish("show_history_temp_data")
@@ -2985,7 +3000,7 @@ class gethistoryDataManager(Abstract):
                 self.read_histroy_hr_data.append({"timeSec": time_tmp, "hr": self.oldHr}) 
 
 
-            with open("/usr/static/storage_file/history_hr.json","w",encoding="utf-8") as fd:
+            with open("/usr/static/storage_file/history_hr.json","w+",encoding="utf-8") as fd:
                 ujson.dump(self.read_histroy_hr_data,fd)
             EventMesh.publish("show_history_hr_data")
             #print(self.read_histroy_hr_data)
@@ -3015,7 +3030,7 @@ class gethistoryDataManager(Abstract):
             else:
                 self.read_histroy_spo2_data.append({"timeSec": time_tmp, "spo2": self.oldspo2}) 
 
-            with open("/usr/static/storage_file/history_spo2.json","w",encoding="utf-8") as fd:
+            with open("/usr/static/storage_file/history_spo2.json","w+",encoding="utf-8") as fd:
                 ujson.dump(self.read_histroy_spo2_data,fd)
             EventMesh.publish("show_history_spo2_data")
             #print(self.read_histroy_spo2_data)
@@ -3278,8 +3293,12 @@ class getStorageDataManager(Abstract):#获取内存数据
         self.config_data = {}
         check = ql_fs.path_exists("/usr/static/storage_file/config.json")
         if check == True:
-            with open("/usr/static/storage_file/config.json","r") as fd:
-                self.config_data = ujson.load(fd)
+            try:
+                with open("/usr/static/storage_file/config.json","r") as fd:
+                    self.config_data = ujson.load(fd)
+            except Exception as e:
+                usys.print_exception(e)
+                self.config_data = {'old_time': 0, 'flip_sw': 0}
         else :
             self.config_data = {'old_time': 0, 'flip_sw': 0}
             pass
@@ -3512,11 +3531,11 @@ class playPowerAudioManager(Abstract):#播放开关机音频文件
         EventMesh.subscribe("play_poewr_off_event", self.play_poewr_off_event)
 
     def play_poewr_on_event(self, event, msg): 
-        self.aud.play(1, 1, 'U:/static/R_POWER_1.mp3')  #播放播放开机铃声
+        self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')  #播放播放开机铃声
 
     def play_poewr_off_event(self, event, msg): 
         self.aud.setVolume(11)
-        self.aud.play(1, 1, 'U:/static/R_POWER_OFF_1.mp3')  #播放关机铃声
+        self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')  #播放关机铃声
     
 class getBootOffManager(Abstract):#开关机时间
     def __init__(self):
@@ -3800,9 +3819,12 @@ class setclassTimeManager(Abstract):#设置上课禁用时间
         check_json = ql_fs.path_exists("/usr/static/storage_file/class_msg.json")
 
         if check_json == True:
-            with open("/usr/static/storage_file/class_msg.json","r",encoding="utf-8") as fd:
-                self.class_buf = ujson.load(fd)
-                print("读取上课禁用时间段")
+            try:
+                with open("/usr/static/storage_file/class_msg.json","r",encoding="utf-8") as fd:
+                    self.class_buf = ujson.load(fd)
+                    print("读取上课禁用时间段")
+            except Exception as e:
+                usys.print_exception(e)
                 # print("self.class_buf:",self.class_buf)
         
 
index ac79ec3..ea00b68 100644 (file)
@@ -812,7 +812,7 @@ class PHL_ProtoCol(ProtoCol):
             phonebook_oldtmp = phonebook_tmp
                 # print("phonebook_oldtmp!!!:{}".format(str(phonebook_oldtmp)))
         # print("phonebook!!!:{}".format(str(phonebook)))
-        with open("/usr/static/storage_file/phonebook.json","w",encoding="utf-8") as fd:
+        with open("/usr/static/storage_file/phonebook.json","w+",encoding="utf-8") as fd:
             ujson.dump(phonebook,fd)
             print("创建电话簿")
         
@@ -2255,7 +2255,7 @@ class TKS_ProtoCol(ProtoCol):
                 EventMesh.publish("wechat_updata_list_show")
             # path = "/usr/static/storage_file/audio_amr/amr/{}.amr".format(wechat_num)
             path = "/usr/static/storage_file/{}.amr".format(wechat_num)
-            with open(path,"w") as fd:
+            with open(path,"w+") as fd:
                 arm = bytearray()
                 j = 0
                 for i in range(len(arm_data)):
@@ -2385,7 +2385,7 @@ class TK_ProtoCol(ProtoCol):
                 EventMesh.publish("wechat_updata_list_show")
             # path = "/usr/static/storage_file/audio_amr/amr/{}.amr".format(wechat_num)
             path = "/usr/static/storage_file/{}.amr".format(wechat_num)
-            with open(path,"w") as fd:
+            with open(path,"w+") as fd:
                 arm = bytearray()
                 j = 0
                 for i in range(len(arm_data)):
index f2f0953..126ab18 100644 (file)
@@ -2072,7 +2072,7 @@ class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出
         tmp["number"] = content
 
         self.read_call_log[content] = tmp
-        with open("/usr/static/storage_file/Call_log.json","w",encoding="utf-8") as fd:
+        with open("/usr/static/storage_file/Call_log.json","w+",encoding="utf-8") as fd:
             ujson.dump(self.read_call_log,fd)
         print("创建通话记录")
         EventMesh.publish("set_call_log_list", [1,self.read_call_log])
@@ -2634,7 +2634,7 @@ class PopupScreen(Screen):
             msg_list_t_done_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
 
             no_msg_text = lv.label(msg_cont_list_screen)
-            no_msg_text.set_pos(0, 180)
+            no_msg_text.set_pos(0, 60)
             no_msg_text.set_size(LCD_SIZE_W, 40)
             no_msg_text.set_text("暂无信息")
             no_msg_text.set_long_mode(lv.label.LONG.WRAP)
@@ -3475,21 +3475,21 @@ class IncomingCallScreen(Screen):
         tmp["number"] = self.meta_info
 
         self.read_call_log[self.meta_info] = tmp
-        with open("/usr/static/storage_file/Call_log.json","w",encoding="utf-8") as fd:
+        with open("/usr/static/storage_file/Call_log.json","w+",encoding="utf-8") as fd:
             ujson.dump(self.read_call_log,fd)
             print("创建通话记录")
         EventMesh.publish("set_call_log_list", [1,self.read_call_log])
         EventMesh.publish("call_log_update_show_list")
         self.time_count = 0
         self.call_timer.start(1000, 1, self.call_timer_cb)
-        self.aud.play(1, 1, 'U:/static/R_CALL_mp3.mp3')  #播放来电铃声
+        self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')  #播放来电铃声
         EventMesh.publish("set_motor_time",[1,2,8*20,8,4])#设置马达参数
 
     def call_timer_cb(self,e):
        EventMesh.publish("system_sleep_rest")#防止黑屏
        self.time_count+=1
        if self.time_count % 6 == 0:
-            self.aud.play(1, 1, 'U:/static/R_CALL_mp3.mp3')  #播放来电铃声
+            self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')  #播放来电铃声
 
     def answer_cb(self,e):
         code = e.get_code()
@@ -5194,7 +5194,10 @@ class CountdownScreen(Screen):
         self.g_end = 0
         self.timer.stop()
 
-    def fun(self,e):
+    def fun(self,*argc):
+        EventMesh.publish("publish_message_event_ui",{"func":self.fun_cb,"data":0})
+
+    def fun_cb(self,e):
         if self.g_state == 1:
             date_tmp = utime.localtime()
             self.time_tmp = utime.mktime(date_tmp) 
@@ -5565,46 +5568,46 @@ class StopwatchScreen(Screen):
             stopwatch_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
             stopwatch_label_min = lv.label(stopwatch_screen)
-            stopwatch_label_min.set_pos(40, 140)
-            stopwatch_label_min.set_size(60, 30)
-            stopwatch_label_min.set_text("00")
+            stopwatch_label_min.set_pos(0, 140)
+            stopwatch_label_min.set_size(240, 30)
+            stopwatch_label_min.set_text("00:00.0")
             stopwatch_label_min.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
             stopwatch_label_min.set_long_mode(lv.label.LONG.WRAP)
-            stopwatch_label_min.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
+            stopwatch_label_min.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
 
-            stopwatch_mao = lv.label(stopwatch_screen)
-            stopwatch_mao.set_pos(92, 138)
-            stopwatch_mao.set_size(30, 30)
-            stopwatch_mao.set_text(":")
-            stopwatch_mao.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
-            stopwatch_mao.set_long_mode(lv.label.LONG.WRAP)
-            stopwatch_mao.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
+            # stopwatch_mao = lv.label(stopwatch_screen)
+            # stopwatch_mao.set_pos(92, 138)
+            # stopwatch_mao.set_size(30, 30)
+            # stopwatch_mao.set_text(":")
+            # stopwatch_mao.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
+            # stopwatch_mao.set_long_mode(lv.label.LONG.WRAP)
+            # stopwatch_mao.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
 
 
-            stopwatch_label_sec = lv.label(stopwatch_screen)
-            stopwatch_label_sec.set_pos(105, 140)
-            stopwatch_label_sec.set_size(60, 30)
-            stopwatch_label_sec.set_text("00")
-            stopwatch_label_sec.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
-            stopwatch_label_sec.set_long_mode(lv.label.LONG.WRAP)
-            stopwatch_label_sec.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
+            # stopwatch_label_sec = lv.label(stopwatch_screen)
+            # stopwatch_label_sec.set_pos(105, 140)
+            # stopwatch_label_sec.set_size(60, 30)
+            # stopwatch_label_sec.set_text("00")
+            # stopwatch_label_sec.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
+            # stopwatch_label_sec.set_long_mode(lv.label.LONG.WRAP)
+            # stopwatch_label_sec.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
 
-            stopwatch_mao1 = lv.label(stopwatch_screen)
-            stopwatch_mao1.set_pos(156, 138)
-            stopwatch_mao1.set_size(30, 30)
-            stopwatch_mao1.set_text(".")
-            stopwatch_mao1.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
-            stopwatch_mao1.set_long_mode(lv.label.LONG.WRAP)
-            stopwatch_mao1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
+            # stopwatch_mao1 = lv.label(stopwatch_screen)
+            # stopwatch_mao1.set_pos(156, 138)
+            # stopwatch_mao1.set_size(30, 30)
+            # stopwatch_mao1.set_text(".")
+            # stopwatch_mao1.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
+            # stopwatch_mao1.set_long_mode(lv.label.LONG.WRAP)
+            # stopwatch_mao1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
 
 
-            stopwatch_label_ms = lv.label(stopwatch_screen)
-            stopwatch_label_ms.set_pos(170, 140)
-            stopwatch_label_ms.set_size(60, 30)
-            stopwatch_label_ms.set_text("0")
-            stopwatch_label_ms.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
-            stopwatch_label_ms.set_long_mode(lv.label.LONG.WRAP)
-            stopwatch_label_ms.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
+            # stopwatch_label_ms = lv.label(stopwatch_screen)
+            # stopwatch_label_ms.set_pos(170, 140)
+            # stopwatch_label_ms.set_size(60, 30)
+            # stopwatch_label_ms.set_text("0")
+            # stopwatch_label_ms.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
+            # stopwatch_label_ms.set_long_mode(lv.label.LONG.WRAP)
+            # stopwatch_label_ms.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
 
 
 
@@ -5742,9 +5745,10 @@ class StopwatchScreen(Screen):
                 
                 self.show_value()
                 pass
-        
-
     def _fun(self,e):
+        EventMesh.publish("publish_message_event_ui",{"func":self._fun_cb,"data":0})
+
+    def _fun_cb(self,e):
         if self.s_state != 0:
             self.ms_value += 1
             if self.ms_value > 9:
@@ -5770,10 +5774,11 @@ class StopwatchScreen(Screen):
         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"%(test_s)))
-        stopwatch_label_min.set_text(str("%02d"%(test_m)))
+        stopwatch_label_min.set_text(str("%02d:%02d.%d"%(test_m,test_s,self.ms_value)))
+        # stopwatch_label_min.set_text(str("{}:{}.{}".format("%02d"%(test_m),"%02d"%(test_s),"%d"%(self.ms_value))))
+        # stopwatch_label_ms.set_text(str("%d"%(self.ms_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:
@@ -6888,7 +6893,7 @@ class sosrecvScreen(Screen):#设备接收平台发送的
 
         EventMesh.publish("set_motor_time",[1,2,10*10,10,5])#设置马达参数
         self.aud.stop()#
-        self.aud.play(1, 1, '/ext/static/SOS_PLAY.mp3')  #文件名前面要加上路径
+        self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')  #文件名前面要加上路径
         self.timer.start(1*1000,1,self.motor_cb)
 
     def close_sos_timer(self,event,msg):
@@ -6910,7 +6915,7 @@ class sosrecvScreen(Screen):#设备接收平台发送的
         EventMesh.publish("system_sleep_rest")#防止黑屏
         if EventMesh.publish("get_audio_state") == 0:
             self.aud.stop()#
-            self.aud.play(1, 1, '/ext/static/SOS_PLAY.mp3')
+            self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')
             
         self.count+=1
         if self.count >= 7:
index a598732..cb072e1 100644 (file)
@@ -1302,7 +1302,7 @@ class PowerOnScreen(Screen):
         self.aud.setVolume(11)
         temp = EventMesh.publish("get_adc_battery")
         if temp > 3400:#低电播放音频会导致一直复位
-            self.aud.play(1, 1, 'U:/static/R_POWER_1.mp3')  #播放来电铃声
+            self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')  #播放来电铃声
         # EventMesh.publish("set_motor_time",[1,2,8,8,4])#设置马达参数
         EventMesh.publish("set_motor_time",[1,2,8*1,8,4])#设置马达参数
         # self.timer.start(1000,1,self.fun)
index 0eb510b..07d8d0f 100644 (file)
@@ -1226,10 +1226,10 @@ class voiceInCallScreen(Screen):#语音通话打入中
         self.call_timer.start(6000, 1, self.call_timer_cb)
         self.timeout = 0
         self.call_timer1.start(1*1000, 1, self.get_video_state)
-        self.aud.play(1, 1, 'U:/static/R_CALL_mp3.mp3')  #播放来电铃声
+        self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')  #播放来电铃声
 
     def call_timer_cb(self,e):
-       self.aud.play(1, 1, 'U:/static/R_CALL_mp3.mp3')  #播放来电铃声
+       self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')  #播放来电铃声
     def get_video_state(self,*argc):
         EventMesh.publish("publish_message_event_ui",{"func":self.get_video_state_cb,"data":0})
 
@@ -1384,10 +1384,10 @@ class vedioCallingCallScreen(Screen):#视频通话打入中
         self.call_timer.start(6000, 1, self.call_timer_cb)
         self.timeout = 0
         self.call_timer1.start(1*1000, 1, self.get_video_state)
-        self.aud.play(1, 1, 'U:/static/R_CALL_mp3.mp3')  #播放来电铃声
+        self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')  #播放来电铃声
 
     def call_timer_cb(self,e):
-       self.aud.play(1, 1, 'U:/static/R_CALL_mp3.mp3')  #播放来电铃声
+       self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')  #播放来电铃声
     
     def get_video_state(self,*argc):
         EventMesh.publish("publish_message_event_ui",{"func":self.get_video_state_cb,"data":0})
@@ -2305,9 +2305,12 @@ class videoBookManager(Abstract):
         self.check_json = ql_fs.path_exists("/usr/static/storage_file/videobook.json")
 
         if self.check_json == True:
-            with open("/usr/static/storage_file/videobook.json","r",encoding="utf-8") as fd:
-                self.videobook = ujson.load(fd)
-                print("读取视频通话账号列表")
+            try:
+                with open("/usr/static/storage_file/videobook.json","r",encoding="utf-8") as fd:
+                    self.videobook = ujson.load(fd)
+                    print("读取视频通话账号列表")
+            except Exception as e:
+                usys.print_exception(e)
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("get_videobook_list", self.get)
@@ -2409,7 +2412,7 @@ class MEMBERS_ProtoCol(ProtoCol):#获取账号列表
             j+=1
         print("videobook!!!:{}".format(str(videobook)))
         # print("phonebook!!!:{}".format(str(phonebook)))
-        with open("/usr/static/storage_file/videobook.json","w",encoding="utf-8") as fd:
+        with open("/usr/static/storage_file/videobook.json","w+",encoding="utf-8") as fd:
             ujson.dump(videobook,fd)
             print("创建视频通话账号")
         
@@ -2683,7 +2686,7 @@ class JMEMBERS_ProtoCol(ProtoCol):#获取账号列表
             j+=1
         print("videobook!!!:{}".format(str(videobook)))
         # print("phonebook!!!:{}".format(str(phonebook)))
-        with open("/usr/static/storage_file/videobook.json","w",encoding="utf-8") as fd:
+        with open("/usr/static/storage_file/videobook.json","w+",encoding="utf-8") as fd:
             ujson.dump(videobook,fd)
             print("创建视频通话账号")
         
index 16fe13e..2aecc2b 100644 (file)
@@ -44,4 +44,5 @@
 //菊风视频通话
 #define CONFIG_juphoon 1
 //#define CONFIG_LVGL_USE_FREETYPE 1//矢量字库
-#define PROJECT_NAME_G3_K01_font 1
\ No newline at end of file
+#define LV_FONT_20_ALL 1 
+#define LV_FONT_70_BOLD 1
\ No newline at end of file
diff --git a/2.sdk-ZY/project/W9/usr/static/AI/ai_talk_bt.png b/2.sdk-ZY/project/W9/usr/static/AI/ai_talk_bt.png
deleted file mode 100644 (file)
index ec42e3e..0000000
Binary files a/2.sdk-ZY/project/W9/usr/static/AI/ai_talk_bt.png and /dev/null differ
diff --git a/2.sdk-ZY/project/W9/usr/static/REDUCE_VOLUM_ICON.png b/2.sdk-ZY/project/W9/usr/static/REDUCE_VOLUM_ICON.png
deleted file mode 100644 (file)
index 6e66a7c..0000000
Binary files a/2.sdk-ZY/project/W9/usr/static/REDUCE_VOLUM_ICON.png and /dev/null differ