k5:
authordxy15521469561 <1731678236@qq.com>
Mon, 21 Aug 2023 12:44:41 +0000 (20:44 +0800)
committerdxy15521469561 <1731678236@qq.com>
Mon, 21 Aug 2023 12:44:41 +0000 (20:44 +0800)
修复配置bug
k01:
整理代码

15 files changed:
2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/appWechat.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/constants.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/main_init.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/mgr.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/protocol.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_main_menu.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_setting.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui_setting.py

index 1c8344c..8cc3b00 100644 (file)
@@ -688,29 +688,45 @@ class playCurTimeManager(Abstract):#播放当前时间
                 self.min_tmp = str(min)
                 shi_value = int(self.step_tmp[0])#十
                 ge_value = int(self.step_tmp[1])#个
-                if hour > 9:
-                    if hour < 20:
-                        if self.play_count == 1:
-                            # R_READ_TIME_18 #10点
-                            pass
-                        elif self.play_count == 2:#点
+                if hour <= 9:
+                    if hour == 0:
+                        pass
+                    else:
+                        if min // 10 != 0:#09:45
+                            if min % 10 > 0:
+                                
+                                pass
+                            else:
+                                pass
+                        else:
                             pass
-                        elif self.play_count == 3:#点
-                            if min > 0:
+                        pass
+                elif hour <= 20:
+                    if hour % 10 != 0:
+                        if min // 10 != 0:#10:56
+                            if min % 10 > 0:  
                                 pass
-                        
+                            else:
+                                pass
+                        else:
+                            pass
                     else:
-                        pass
-                    if min > 9:
-                        if self.play_count == 1:
-                            if hour < 20:
+                        if min // 10 != 0:#10:35
+                            if min % 10 > 0:  
                                 pass
-                                # R_READ_TIME_19 #20点
                             else:
-                                pass#
-                        pass
+                                pass
+                        else:
+                            pass
+                else:
+                    if min // 10 != 0:#23:34
+                        if min % 10 > 0:  
+                            pass
+                        else:
+                            pass
                     else:
                         pass
+                    
               
 
 
index 98d3386..3d77c3c 100644 (file)
@@ -174,21 +174,7 @@ class WechatScreen(Screen):
         self.record_test.gain(4,12)
         self.aud = audio.Audio(0)
 
-        # check_volum = ql_fs.path_exists("/usr/static/storage_file/config.json")
-        # if check_volum == True :
-        #     with open("/usr/static/storage_file/config.json","r") as fd:#音频文件编号
-        #         self.read_data = ujson.load(fd)
-        #         if self.read_data != {}:
-        #             b = str("volum") in self.read_data.keys()
-        #             if b == True:
-        #                 self.volum_size = self.read_data["volum"]  
-        #             else:
-        #                 self.volum_size = 8
-        #         else:
-        #             self.volum_size = 8
-        # else:
-        #     self.volum_size = 8
-        # self.aud.setVolume(self.volum_size)
+
         self.meta = wechat_screen
         wechat_press_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.talking_cb(e)),
                                      lv.EVENT.LONG_PRESSED, None)
@@ -876,8 +862,7 @@ class TK_ProtoCol(ProtoCol):
             wechat_recode_list['num'] = 1
             EventMesh.publish("set_wechat_data",[MXA_MSG,wechat_recode_list])
             #写语音文件数据
-             
-            # path = "/ext/static/storage_file/audio_amr/amr/{}.amr".format(wechat_num)
+
             path = "/usr/static/storage_file/wechat.amr".format(wechat_num)
             with open(path,"w") as fd:
                 arm = bytearray()
index f4fe1e8..c8872b2 100644 (file)
@@ -113,7 +113,7 @@ class BtnDevice(Abstract):
             print("USB OUT")
             screen_NAME = EventMesh.publish("get_screen_NAME")
             if screen_NAME != None:
-                if screen_NAME == "poweron":
+                if screen_NAME == "poweron" or screen_NAME == "system_init":
                     return
             
             bat_tmp = EventMesh.publish("screen_get_battery")
@@ -125,7 +125,7 @@ class BtnDevice(Abstract):
             print("USB IN")
             screen_NAME = EventMesh.publish("get_screen_NAME")
             if screen_NAME != None:
-                if screen_NAME == "poweron":
+                if screen_NAME == "poweron" or screen_NAME == "system_init":
                     return
             bat_tmp = EventMesh.publish("screen_get_battery")
             if bat_tmp !=  None:
index e222191..6d39e8b 100644 (file)
@@ -118,6 +118,7 @@ class EVENT:
     SYSTEM_UP = "SYSTEM_UP"
     START_HEART = "START_HEART" 
     GET_HEART = "GET_HEART"
+    GET_WEAR = "GET_WEAR"
     STOP_HEART = "STOP_HEART"
     START_TEMP = "START_TEMP"
     STOP_TEMP = "STOP_TEMP"
index 2758488..85187ac 100644 (file)
@@ -57,11 +57,21 @@ def main_init():
     
     from appFactoryMode import  FactoryModeLocationScreen,FactoryModeScreen ,FactoryModeBatTestScreen
     import ui as _ui
-    
+
+    from mgr import testSmsSetIPManager,ConfigStoreManager,sosInfoCallManager,getBootOffManager,getSosFlagManager,CountdownManager, LocationManager, getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\
+    AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldTimeManager,getStorageDataManager,getBrightnessManager,getHrTimeManager,getTempTimeManager,getLowBatManager
+   
     # import ui as _ui
     print("init4:{}".format(utime.localtime()))
+ 
+    
+    app = watchApp()
+    app.append_manager(getStorageDataManager())
     ui = _ui.UI()
     ui.post_processor_after_instantiation()
+    app.set_ui(ui)
+    
+    
     ui.add_screen(_ui.SystemInitScreen()) 
     EventMesh.publish("load_screen", {"screen": "system_init"})
     print("init5:{}".format(utime.localtime()))
@@ -145,8 +155,7 @@ def main_init():
     import mgr as mgr
     print("init7:{}".format(utime.localtime()))
     
-    from mgr import testSmsSetIPManager,ConfigStoreManager,sosInfoCallManager,getBootOffManager,getSosFlagManager,CountdownManager, LocationManager, getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\
-    AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldTimeManager,getStorageDataManager,getBrightnessManager,getHrTimeManager,getTempTimeManager,getLowBatManager
+
     print("init8:{}".format(utime.localtime()))
     
     
@@ -161,9 +170,6 @@ def main_init():
     print("init10:{}".format(utime.localtime()))
     
 
-    app = watchApp()
-    app.set_ui(ui)
-    app.append_manager(getStorageDataManager())
     app.append_manager(mgr.AlarmVolumeLevelManager()) \
         .append_manager(mgr.MsgVolumeLevelManager()) \
         .append_manager(mgr.PhoneVolumeLevelManager()) \
index cef0c81..abf3840 100644 (file)
@@ -455,7 +455,7 @@ class ConfigStoreManager(Abstract):
     """
 
     def __init__(self):
-        self.file_name = "/usr/conf_store.json"
+        self.file_name = "//conf_store.json"
         self.lock = Lock()
         self.map = dict()
 
@@ -488,7 +488,6 @@ class sosInfoCallManager(Abstract):
 
     def set_sos_info_call(self, event, msg):
         hangup_mode = EventMesh.publish("get_hangup_mode")
-        print('hangup_mode ',hangup_mode)
         if hangup_mode == 1:
             EventMesh.publish("set_sos_flag",0)
             EventMesh.publish("set_sos_num",0)
@@ -683,7 +682,6 @@ class DeviceInfoManager(Abstract):
         self.log = LogAdapter(self.__class__.__name__)
         self.rtc = RTC()
         self.aud = audio.Audio(0)
-        print("DeviceInfoManager:1")
         self.gsensor = SC7A20()
         print("DeviceInfoManager:1.0")
         self.gsensor.activate()
@@ -691,18 +689,8 @@ class DeviceInfoManager(Abstract):
         self.gsensor.init()
         print("DeviceInfoManager:2")
         self.gsensor.set_callback(self.gsensor_cb)
-        # try :
-        #     self.hsensor = HX3918()
-        # except Exception as e:
-        #     print("Hsensor none HX3918:{}".format(e))   
-        # try :
-        #     self.hsensor = GH3018()
-        # except Exception as e:
-        #     print("Hsensor none GH3018:{}".format(e))   
-        # #
-        # self.hsensor.activate()
-        # self.hsensor.init()
-        # self.hsensor.close()
+      
+
         self.old_temp_time = 0
         # #print("hsensor.open_heart:%d\r\n"%(self.hsensor.open_heart()))
         print("DeviceInfoManager:3")
@@ -746,6 +734,8 @@ class DeviceInfoManager(Abstract):
         EventMesh.subscribe(constants.EVENT.STOP_HEART, self.stop_heart)
         EventMesh.subscribe(constants.EVENT.GET_BLOOD_OXYGEN, self.get_blood_oxygen)
         EventMesh.subscribe(constants.EVENT.GET_HEART, self.get_heart)
+        EventMesh.subscribe(constants.EVENT.GET_WEAR, self.get_wear)
+        EventMesh.subscribe("get_Hsensor", self.get_Hsensor)
         EventMesh.subscribe("Hsensor_set_sleep", self.Hsensor_set_sleep)
 
         EventMesh.subscribe(constants.EVENT.START_TEMP, self.start_temp)
@@ -779,15 +769,20 @@ class DeviceInfoManager(Abstract):
 
     def gsensor_cb(self, para):
         print("gsensor_cb:{}".format(para))
+        flip_sw = EventMesh.publish("get_storage_config","flip_sw")
+        
         if para == 0: #跌倒报警
             pass
             #EventMesh.publish("load_screen", {"screen": "FIND"})
         elif para == 1: #抬腕
-            pass
-            # EventMesh.publish(constants.EVENT.SYSTEM_UP)
+            
+            if flip_sw == 1:
+                EventMesh.publish(constants.EVENT.SYSTEM_UP)
+            
         elif para == 2: #放手
             pass
-            # EventMesh.publish(constants.EVENT.SYSTEM_SLEEP)
+            # if flip_sw == 1:
+            #     EventMesh.publish(constants.EVENT.SYSTEM_SLEEP)
 
     def publish_event_cb(self, *args, **kwargs):
         EventMesh.publish("publish_message_event_DeviceInfo",{"func":self.publish_event,"data":0})  
@@ -848,7 +843,7 @@ class DeviceInfoManager(Abstract):
         bat_total_value = bat_total_value//curr_count#一分钟更新一次电量 10个平均值
 
         EventMesh.publish("set_curr_battery_level",bat_total_value)
-        print("self.vbat_buf:{}".format(self.vbat_buf))
+        # print("self.vbat_buf:{} curr_count :{} bat_total_value:{} temp:{}".format(self.vbat_buf,curr_count,bat_total_value,temp))
        
         
         bat_tmp = EventMesh.publish("screen_get_battery")
@@ -896,6 +891,7 @@ class DeviceInfoManager(Abstract):
             if min <= 1:
                 if self.clear_step == 0:
                     step = EventMesh.publish("get_old_step_value")
+                    EventMesh.publish("set_old_time_data",time_tmp)
                     if step > 0:
                         EventMesh.publish("set_old_step_value",0)
                         self.gsensor.reset_step()
@@ -943,11 +939,24 @@ class DeviceInfoManager(Abstract):
             else:
                 self.sms_full_flag = 0
 
+        WEAR = EventMesh.publish(constants.EVENT.GET_WEAR)#佩戴数据
         get_temp_time  = EventMesh.publish("get_temp_time")
         get_temp_state  = EventMesh.publish("get_temp_state")
         hr_time = {}
         hr_time = EventMesh.publish("get_time_hr_spo2")#获取时间是否大于0
-        if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1 and battery[0] != "1":
+        if get_temp_state != None : #突然脱腕
+            if get_temp_state > 1 and WEAR != 1:
+                EventMesh.publish(constants.EVENT.STOP_TEMP)
+                EventMesh.publish("set_temp_state",0)       
+            if (self.get_hr_state > 1 or self.get_spo2_state > 1) and WEAR != 1:
+                if self.get_hr_state > 1 :
+                    EventMesh.publish("set_hr_state",0)#2代表后台进入测试,定时测心率 1ui界面测试洗心率 
+                    EventMesh.publish(constants.EVENT.STOP_HEART) 
+                elif self.get_spo2_state > 1:
+                    EventMesh.publish("set_spo2_state",0)#2代表后台进入测试
+                    EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
+        if 0:
+
             # print("get_temp_time:{} self.temp_one_state:{}".format(get_temp_time,self.temp_one_state))
             if get_temp_time != None:#定时测量体温
                 if get_temp_time > 0:
@@ -975,6 +984,7 @@ class DeviceInfoManager(Abstract):
                                 self.temp_state = 0
                                 self.temp_one_state = 0
                                 temp = EventMesh.publish(constants.EVENT.GET_TEMP) 
+                                temp += 0.5
                                 if temp < 25 or temp > 42:
                                     temp = 0
                                 tmp_f = str(temp).split('.')[0] 
@@ -1001,6 +1011,7 @@ class DeviceInfoManager(Abstract):
                                     elif self.temp_one_state > 6:
                                         self.temp_one_state = 0
                                         temp = EventMesh.publish(constants.EVENT.GET_TEMP) 
+                                        temp += 0.5
                                         if temp < 25 or temp > 42:
                                             temp = 0
                                         tmp_f = str(temp).split('.')[0] 
@@ -1041,6 +1052,7 @@ class DeviceInfoManager(Abstract):
                         elif self.temp_one_state > 6:
                             self.temp_one_state = 0
                             temp = EventMesh.publish(constants.EVENT.GET_TEMP) 
+                            temp += 0.5
                             if temp < 25 or temp > 42:
                                 temp = 0
                             tmp_f = str(temp).split('.')[0] 
@@ -1372,7 +1384,8 @@ class DeviceInfoManager(Abstract):
                     if get_temp_state == 2 or get_temp_state == 3:
                         self.temp_one_state = 0
                         self.temp_state = 0
-                        temp = EventMesh.publish(constants.EVENT.GET_TEMP)             
+                        temp = EventMesh.publish(constants.EVENT.GET_TEMP)       
+                        temp += 0.5      
                         if temp < 25 or temp > 42:
                             temp = 0
 
@@ -1589,7 +1602,7 @@ class DeviceInfoManager(Abstract):
         d = int(
             time_msg / 86400)  # The int call removes the decimals.  Conveniently, it always rounds down.  int(2.9) returns 2 instead of 3, for example.
         time_msg -= (
-            d * 86400)  # This updates the value of x to show that the already counted seconds won't be double counted or anything.
+                d * 86400)  # This updates the value of x to show that the already counted seconds won't be double counted or anything.
         h = int(time_msg / 3600)
         time_msg -= (h * 3600)
         m = int(time_msg / 60)
@@ -1637,31 +1650,29 @@ class DeviceInfoManager(Abstract):
         return self.connect
 
     def start_blood_oxygen(self, topic, msg):
-        print("start_blood_oxygen!!!")
         pass
-        # self.hsensor.open_blood_oxygen()
 
     def start_heart(self, topic, msg):
-        print("start_heart!!!")
         pass
-        # self.hsensor.open_heart()
 
     def stop_blood_oxygen(self, topic, msg):
-        print("stop_blood_oxygen!!!")
         pass
-        # self.hsensor.close()
 
     def stop_heart(self, topic, msg):
-        print("stop_heart!!!")
         pass
-        # self.hsensor.close()
 
     def get_blood_oxygen(self, topic, msg):
-        # data = self.hsensor.get_all_data()
+        
         return 0
 
     def get_heart(self, topic, msg):
-        # data = self.hsensor.get_all_data()
+        
+        return 0
+    
+    def get_wear(self, topic, msg):
+        return 0
+    
+    def get_Hsensor(self, topic, msg):
         return 0
     
     def Hsensor_set_sleep(self, topic, msg):
@@ -1669,31 +1680,13 @@ class DeviceInfoManager(Abstract):
 
     def start_temp(self, topic, msg):
         pass
-        # WHO_AM_I = bytearray([0x01, 0])
-        # I2C_SLAVE_ADDR = 0x49
-        # r_data = bytearray(2)
-        # data = bytearray([0x61A0, 0])   # 唤醒
-        # return self.i2c0.write(I2C_SLAVE_ADDR, WHO_AM_I, 1, data, 2)
     def stop_temp(self, topic, msg):
         pass
-        # WHO_AM_I = bytearray([0x01, 0])
-        # I2C_SLAVE_ADDR = 0x49
-        # r_data = bytearray(2)
-        # data = bytearray([0x60A0, 0])   #休眠
-        # return self.i2c0.write(I2C_SLAVE_ADDR, WHO_AM_I, 1, data, 2)
+        
         
     def get_temp(self, topic, msg):
-        pass
-        # WHO_AM_I = bytearray([0x00, 0])
-        # I2C_SLAVE_ADDR = 0x49
-        # r_data = bytearray(2)
-        # self.i2c0.read(I2C_SLAVE_ADDR, WHO_AM_I, 1, r_data, 2, 0)
-        # #print("temp_data:{}".format(r_data))
-        # temp_s = ((r_data[0]<<8) | (r_data[1]))>>4
-        # #print("temp_s:{}".format(temp_s))
-        # temp_data = temp_s * 0.0625
-        # #print("temp_data:{}".format(temp_data))
-        # return temp_data
+        
+        return 0
  
             
 
@@ -1879,18 +1872,16 @@ class LocationManager(Abstract):
         step = 0
         step = EventMesh.publish("get_old_step_value")
         if step != 0:
-            read_data = EventMesh.publish("get_storage_data")
-            b = str("old_step_new") in read_data.keys()
-            if b == True:
-                old_step = read_data["old_step_new"]
-            else:
-                old_step = 0
+            
+
+            tmp_data  = EventMesh.publish("get_storage_config","old_step_new")
+            if tmp_data != None:
+                old_step = tmp_data
+
             if old_step !=  step:
-                read_data["old_step"] = step
-                read_data["old_step_new"] = step
-                EventMesh.publish("set_storage_data", read_data)
-                with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-                    ujson.dump(read_data,fd)
+                EventMesh.publish("set_storage_config",["old_step",step])
+                EventMesh.publish("set_storage_config",["old_step_new",step])
+                
         old_step = step
         # step = str(EventMesh.publish(constants.EVENT.GET_STEP)[0])
         #翻转次数
@@ -2008,14 +1999,14 @@ class LocationManager(Abstract):
                     if self.location_type == 1: #测试模式
                         EventMesh.publish("PUSH_LOCATION_DATA", [data,self.wifi_data,self.cell_data]) 
                     elif self.location_type == 0: #正常模式     
-                        if self.gps_data  != [] or self.location_timer_count > 40: #or( self.wifi_data != [] and self.cell_data != []): 
+                        if self.gps_data  != [] or self.location_timer_count > 60: #or( self.wifi_data != [] and self.cell_data != []): 
                             self.Location_send([self.gps_data,self.wifi_data,self.cell_data])
                             EventMesh.publish(constants.EVENT.CLOSE_LOCATION)#关闭定位
                             #break
                         if len(match_gsv_data) >= 3:
                             #print("match_gsv_data[3]:{}".format(match_gsv_data[3]))
                             #if  (self.wifi_data != [] and self.cell_data != [] and self.location_timer_count > 10): #超过10秒且卫星个数少于3  
-                            if (int(match_gsv_data[3]) < 3 and self.wifi_data != [] and self.cell_data != [] and self.location_timer_count > 10): #超过10秒且卫星个数少于3
+                            if (int(match_gsv_data[3]) < 3 and self.wifi_data != [] and self.cell_data != [] and self.location_timer_count > 20): #超过10秒且卫星个数少于3
                                 self.Location_send([self.gps_data,self.wifi_data,self.cell_data])
                                 
                                 EventMesh.publish(constants.EVENT.CLOSE_LOCATION)#关闭定位    
@@ -2172,44 +2163,17 @@ class gethistoryDataManager(Abstract):
         self.read_histroy_temp_data = []
         self.read_histroy_spo2_data = []
 
-        read_data = EventMesh.publish("get_storage_data")
-        if read_data != None:
-            b = str("old_hr") in read_data.keys()
-            if b == True:
-                self.oldHr = read_data["old_hr"]  
+        oldHr  = EventMesh.publish("get_storage_config","old_hr")
+        if oldHr != None:
+            self.oldHr = oldHr  
+        old_spo2  = EventMesh.publish("get_storage_config","old_spo2")
+        if old_spo2 != None:
+            self.oldspo2 = old_spo2 
+        old_step  = EventMesh.publish("get_storage_config","old_step")    
+        if old_step != None:
+            self.oldstep = old_step
+
 
-            old_spo2 = str("old_spo2") in read_data.keys()
-            if old_spo2 == True:
-                self.oldspo2 = read_data["old_spo2"] 
-            
-            old_step = str("old_step") in read_data.keys()
-            if old_step == True:
-                self.oldstep = read_data["old_step"]  
-
-        # check_json= ql_fs.path_exists("/ext/static/storage_file/config.json")
-        # if check_json == True :
-        #     with open("/ext/static/storage_file/config.json","r") as fd:#音频文件编号
-        #         self.read_data = ujson.load(fd)
-        #         if self.read_data != {}:
-        #             b = str("old_hr") in self.read_data.keys()
-        #             if b == True:
-        #                 self.oldHr = self.read_data["old_hr"]  
-        #             else:
-        #                 self.oldHr = 0
-        #             old_spo2 = str("old_spo2") in self.read_data.keys()
-        #             if old_spo2 == True:
-        #                 self.oldspo2 = self.read_data["old_spo2"]  
-        #             else:
-        #                 self.oldspo2 = 0
-        #             old_step = str("old_step") in self.read_data.keys()
-        #             if old_step == True:
-        #                 self.oldstep = self.read_data["old_step"]  
-        #             else:
-        #                 self.oldstep = 0
-        #         else:
-        #             self.oldHr = 0
-        #             self.oldspo2 = 0
-        #             self.oldstep = 0
         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:#音频文件编号
@@ -2248,7 +2212,7 @@ class gethistoryDataManager(Abstract):
         EventMesh.subscribe("get_history_spo2_value", self.get_history_spo2_value)
         EventMesh.subscribe("set_history_spo2_value", self.set_history_spo2_value)
 
-    def get_history_spo2_value(self, event, msg): #近7次体温历史数据统计显示
+    def get_history_spo2_value(self, event, msg): #近7次血氧历史数据统计显示
         return self.read_histroy_spo2_data
 
     def set_history_spo2_value(self, event, msg): 
@@ -2276,7 +2240,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_spo2.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)
 
@@ -2290,11 +2254,9 @@ class gethistoryDataManager(Abstract):
 
     def save_hr_value(self, event, msg): 
         if msg >= 50:
-            
-            read_data_hr = EventMesh.publish("get_storage_data")
-            read_data_hr["old_hr"] = msg
+            EventMesh.publish("set_storage_config",["old_hr",msg])
             self.oldHr = msg
-            EventMesh.publish("set_storage_data", read_data_hr)
+            
 
             date_tmp = utime.localtime()
             time_tmp = utime.mktime(date_tmp)
@@ -2310,8 +2272,6 @@ class gethistoryDataManager(Abstract):
             else:
                 self.read_histroy_hr_data.append({"timeSec": time_tmp, "hr": self.oldHr}) 
 
-            with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-                ujson.dump(read_data_hr,fd)
 
             with open("/usr/static/storage_file/history_hr.json","w",encoding="utf-8") as fd:
                 ujson.dump(self.read_histroy_hr_data,fd)
@@ -2323,10 +2283,9 @@ class gethistoryDataManager(Abstract):
 
     def save_spo2_value(self, event, msg): 
         if msg >= 85:
-            read_data_spo2 = EventMesh.publish("get_storage_data")
-            read_data_spo2["old_spo2"] = msg
+            EventMesh.publish("set_storage_config",["old_spo2",msg])
             self.oldspo2 = msg
-            EventMesh.publish("set_storage_data", read_data_spo2)
+
 
             date_tmp = utime.localtime()
             time_tmp = utime.mktime(date_tmp)
@@ -2342,9 +2301,6 @@ class gethistoryDataManager(Abstract):
             else:
                 self.read_histroy_spo2_data.append({"timeSec": time_tmp, "spo2": self.oldspo2}) 
 
-            with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-                ujson.dump(read_data_spo2,fd)
-
             with open("/usr/static/storage_file/history_spo2.json","w",encoding="utf-8") as fd:
                 ujson.dump(self.read_histroy_spo2_data,fd)
             #print(self.read_histroy_spo2_data)
@@ -2365,21 +2321,10 @@ class getOldTimeManager(Abstract):
     # 获取天气数据
     def __init__(self):
         self.time_sec = 0
-        read_data = EventMesh.publish("get_storage_data")
-        if read_data != None:
-            b = str("old_time") in read_data.keys()
-            if b == True:
-                self.time_sec = read_data["old_time"]  
-
-        # check_json= ql_fs.path_exists("/ext/static/storage_file/config.json")
-        # if check_json == True :
-        #     with open("/ext/static/storage_file/config.json","r") as fd:#音频文件编号
-        #         self.read_data = ujson.load(fd)
-        #         if self.read_data != {}:
-        #             b = str("old_time") in self.read_data.keys()
-        #             if b == True:
-        #                 self.time_sec = self.read_data["old_time"]  
-
+        tmp_data = EventMesh.publish("get_storage_config","old_time")
+        if tmp_data !=None :
+            self.time_sec = tmp_data
+          
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("get_old_time_data", self.get_old_time_data)
         EventMesh.subscribe("set_old_time_data", self.set_old_time_data)
@@ -2389,11 +2334,9 @@ class getOldTimeManager(Abstract):
 
     def set_old_time_data(self, event, msg):
         self.time_sec = msg
-        read_data_time = EventMesh.publish("get_storage_data")
-        read_data_time["old_time"] = msg
-        EventMesh.publish("set_storage_data", read_data_time)
-        with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-            ujson.dump(read_data_time,fd)
+        EventMesh.publish("set_storage_config",["old_time",msg])
+
+        
 
 
         
@@ -2437,27 +2380,15 @@ class getHrTimeManager(Abstract):
         self.set_hr = 0 #0关闭 1手动 2 自动测量按照时间间隔测试心率
         self.set_spo2 = 0
         self.open_btn = 0
-        self.get_temp = 0
-        read_data = EventMesh.publish("get_storage_data")
+        read_data = EventMesh.publish("get_storage_config","measure_time")
+        if read_data != None:
+            self.set_time = read_data  
+        read_data = EventMesh.publish("get_storage_config","open_hr_btn")
+                
         if read_data != None:
-            b = str("measure_time") in read_data.keys()
-            if b == True:
-                self.set_time = read_data["measure_time"]   
-            btn = str("open_hr_btn") in read_data.keys()
-            if btn == True:
-                self.open_btn = read_data["measure_time"]   
-
-        # check = ql_fs.path_exists("/ext/static/storage_file/config.json")
-        # if check == True:
-        #     with open("/ext/static/storage_file/config.json","r") as fd:
-        #         self.read_data = ujson.load(fd)
-        #         if self.read_data != {}:
-        #             b = str("measure_time") in self.read_data.keys()
-        #             if b == True:
-        #                 self.set_time = self.read_data["measure_time"]   
-        #             btn = str("open_hr_btn") in self.read_data.keys()
-        #             if btn == True:
-        #                 self.open_btn = self.read_data["measure_time"]   
+            self.open_btn = read_data   
+
+
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("set_time_hr_spo2", self.set_time_hr_spo2)
@@ -2471,9 +2402,10 @@ class getHrTimeManager(Abstract):
     def set_time_hr_spo2(self, event, msg): 
         self.open_btn = msg[0]
         self.set_time = msg[1]
+        EventMesh.publish("set_storage_config",["measure_time",self.set_time])
+        EventMesh.publish("set_storage_config",["open_hr_btn",self.open_btn])
 
     def get_time_hr_spo2(self, event, msg): 
-
         return [self.open_btn,self.set_time]
 
     def set_hr_state(self, event, msg): 
@@ -2493,19 +2425,11 @@ class getTempTimeManager(Abstract):
     def __init__(self):
         self.set_time = 0
         self.get_temp = 0
-        read_data = EventMesh.publish("get_storage_data")
+        read_data = EventMesh.publish("get_storage_config","temp_time")
+
         if read_data != None:
-            b = str("temp_time") in read_data.keys()
-            if b == True:
-                self.set_time = read_data["temp_time"] 
-        # check = ql_fs.path_exists("/ext/static/storage_file/config.json")
-        # if check == True:
-        #     with open("/ext/static/storage_file/config.json","r") as fd:
-        #         self.read_data = ujson.load(fd)
-        #         if self.read_data != {}:
-        #             b = str("temp_time") in self.read_data.keys()
-        #             if b == True:
-        #                 self.set_time = self.read_data["temp_time"]   
+            self.set_time = read_data
+ 
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("set_temp_time", self.set_temp_time)
@@ -2517,9 +2441,9 @@ class getTempTimeManager(Abstract):
 
     def set_temp_time(self, event, msg): 
         self.set_time = msg
+        EventMesh.publish("set_storage_config",["set_temp_time",self.set_time])
 
     def get_temp_time(self, event, msg): 
-
         return self.set_time
     
     def set_temp_state(self, event, msg): 
@@ -2534,10 +2458,7 @@ class getBrightnessManager(Abstract):#获取亮度级别
         # self.read_data = {}
         self.time = 5
         self.PWM_backlight  = None
-        # check = ql_fs.path_exists("/ext/static/storage_file/config.json")
-        # if check == True:
-        #     with open("/ext/static/storage_file/config.json","r") as fd:
-        #         self.read_data = ujson.load(fd)
+
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("get_brightness_level", self.get_brightness_level)
@@ -2550,25 +2471,22 @@ class getBrightnessManager(Abstract):#获取亮度级别
 
     def set_brightness_level(self, event, msg): 
         self.level = msg
-    
+        EventMesh.publish("set_storage_config", ["brightness_level",self.level])
+
     def get_brightness_level(self, event, msg): 
-        read_data = EventMesh.publish("get_storage_data")
-        if read_data != {}:
-            b = str("brightness_level") in read_data.keys()
-            if b == True:
-                self.level = read_data["brightness_level"]
+        tmp = EventMesh.publish("get_storage_config","brightness_level")
+        if tmp != None:
+            self.level = tmp
         return self.level
     
     def set_brightness_time(self, event, msg): 
         self.time = msg
+        EventMesh.publish("set_storage_config", ["brightness_time",self.time])
     
     def get_brightness_time(self, event, msg): 
-        # print("get_brightness_time self.read_data:{} self.time:{}".format(self.read_data,self.time))
-        read_data = EventMesh.publish("get_storage_data")
-        if read_data != {}:
-            b = str("brightness_time") in read_data.keys()
-            if b == True:
-                self.time = read_data["brightness_time"]
+        tmp = EventMesh.publish("get_storage_config","brightness_time")
+        if tmp != None:
+            self.time = tmp
         return self.time
     
 
@@ -2576,72 +2494,84 @@ class getBrightnessManager(Abstract):#获取亮度级别
     def add(self, event, msg):
         if self.level < 10:
             self.level = self.level + 2
-        if self.level >= 10:
-            self.level = 10
-        print("add self.level:{}".format(self.level))
         self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_10US, self.level*100, 1000)
         self.PWM_backlight.open()
-        
-        read_data = EventMesh.publish("get_storage_data")
-        read_data["brightness_level"] = self.level
+        EventMesh.publish("set_storage_config", ["brightness_level",self.level])
+        level = EventMesh.publish("get_storage_config","brightness_level")
 
-        EventMesh.publish("set_storage_data", read_data)
-        with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-            ujson.dump(read_data,fd)
 
     def reduce(self, event, msg):
         if self.level > 0:
             self.level = self.level - 2
-        print("reduce self.level:{}".format(self.level))
         if self.level <= 0:
             self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_10US, 1*100, 1000)
         else:
             self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_10US,self.level*100, 1000)
 
         self.PWM_backlight.open()
-        read_data = EventMesh.publish("get_storage_data")
-        read_data["brightness_level"] = self.level
-        EventMesh.publish("set_storage_data", read_data)
-        with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-            ujson.dump(read_data,fd)
+        EventMesh.publish("set_storage_config", ["brightness_level",self.level])
+       
     
 class getStorageDataManager(Abstract):#获取内存数据
     def __init__(self):
-        self.read_data = {}
+        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.read_data = ujson.load(fd)
+                self.config_data = ujson.load(fd)
+        else :
+            self.config_data = {'old_time': 0, 'flip_sw': 0}
+            pass
+        print("self.config_data:{}".format(self.config_data)) 
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("set_storage_data", self.set_storage_data)
+        EventMesh.subscribe("set_storage_config", self.set_storage_config)
         EventMesh.subscribe("get_storage_data", self.get_storage_data)
+        EventMesh.subscribe("get_storage_config", self.get_storage_config)
 
     def set_storage_data(self, event, msg): 
+        # print("set_storage_data:{}".format(msg))
         if msg != None:
-            self.read_data = msg
-
-    def get_storage_data(self, event, msg): 
-        return self.read_data 
+            self.config_data = msg
+            with open("/usr/static/storage_file/config.json",'w+',encoding="utf-8") as fd:
+                ujson.dump(self.config_data,fd)
     
 
+    def set_storage_config(self,event,msg): 
+        # print("set_storage_key_data1:{}".format(msg))
+        if len(msg) >= 2:
+            self.config_data[msg[0]]=msg[1]
+            # print("set_storage_key_data2:{}".format(self.config_data[msg[0]]))
+            EventMesh.publish("publish_message_event_ui",{"func":self.set_storage_save,"data":0})
+    def set_storage_save(self, data): 
+            print("set_storage_key_data2:{}".format(self.config_data))
+            with open("/usr/static/storage_file/config.json",'w+',encoding="utf-8") as fd:
+                ujson.dump(self.config_data,fd)
+    def get_storage_data(self, event, msg): 
+        # print("get_storage_data:{}".format(self.config_data))
+        return self.config_data 
+    def get_storage_config(self,event,msg):
+        # print("get_storage_key_data1:{}".format(msg))
+        b = msg in self.config_data.keys()
+        if b == True:
+            print("get_storage_key_data2:{}".format(self.config_data[msg]))
+            return self.config_data[msg]
+        else :
+            return None
+        # try:
+        #     return self.config_data[msg]
+        # except:
+        #     print("get_storage_key_data:none key:{}",msg)
+        #     return None
 #定位频率
 class getUpLoadDataManager(Abstract):#
     def __init__(self):
         self.upload_time = 1800
-        read_data = EventMesh.publish("get_storage_data")
+        read_data = EventMesh.publish("get_storage_config","upload_time")
         if read_data != None:
-            b = str("upload_time") in read_data.keys()
-            if b == True:
-                self.upload_time = read_data["upload_time"]  
-        # check = ql_fs.path_exists("/ext/static/storage_file/config.json")
-        # if check == True:
-        #     with open("/ext/static/storage_file/config.json","r") as fd:
-        #         self.read_data = ujson.load(fd)
-        #         if self.read_data != {}:
-        #             b = str("upload_time") in self.read_data.keys()
-        #             if b == True:
-        #                 self.upload_time = self.read_data["upload_time"]   
+            self.upload_time = read_data 
+           
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("set_upload_data", self.set_upload_data)
@@ -2670,32 +2600,17 @@ class getplayAudiodStateManager(Abstract):#获取设置播放音频状态
 class getVolumSizeManager(Abstract):#设置或获取音量大小数据
     def __init__(self):
         self.volume_size = 8
-        read_data = EventMesh.publish("get_storage_data")
+        read_data = EventMesh.publish("get_storage_config","volum")
         if read_data != None:
-            b = str("volum") in read_data.keys()
-            if b == True:
-                self.volume_size = read_data["volum"]  
-        # self.read_data = {}
-        # check = ql_fs.path_exists("/ext/static/storage_file/config.json")
-        
-        # if check == True:
-        #     with open("/ext/static/storage_file/config.json","r") as fd:
-        #         self.read_data = ujson.load(fd)
-        #         if self.read_data != {}:
-        #             b = str("volum") in self.read_data.keys()
-        #             if b == True:
-        #                 self.volume_size = self.read_data["volum"]   
-        #             else:
-        #                 self.volume_size = 8
-        # else:
-        #     self.volume_size = 8
-        # print("self.volume_size:{}".format(self.volume_size))
+            self.volume_size = read_data
+    
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("set_volum_size", self.set_volum_size)
         EventMesh.subscribe("get_volum_size", self.get_volum_size)
 
     def set_volum_size(self, event, msg): 
         self.volume_size = msg
+        EventMesh.publish("set_storage_config", ["volum",self.volume_size])
 
     def get_volum_size(self, event, msg): 
         return self.volume_size
@@ -2708,37 +2623,17 @@ class getSosFlagManager(Abstract):#设置sos
         self.call_timer = osTimer()
         self.sos_numer1 = []
         self.callnumer =""
-        read_data = EventMesh.publish("get_storage_data")
-        if read_data != None:
-            b1 = str("SOS_NUMBER1") in read_data.keys()
-            if b1 == True:
-                self.sos_numer1 = [read_data["SOS_NUMBER1"]]
-            b2 = str("SOS_NUMBER2") in read_data.keys()
-            if b2 == True:
-                self.sos_numer1 = [read_data["SOS_NUMBER1"], read_data["SOS_NUMBER2"]]
-
-            b3 = str("SOS_NUMBER3") in read_data.keys()
-            if b3 == True:
-                self.sos_numer1 = [read_data["SOS_NUMBER1"], read_data["SOS_NUMBER2"],read_data["SOS_NUMBER3"]]
-        # self.read_data = {}
-        # check = ql_fs.path_exists("/ext/static/storage_file/config.json")
-        
-        # if check == True:
-        #     with open("/ext/static/storage_file/config.json","r") as fd:
-        #         self.read_data = ujson.load(fd)
-        #         if self.read_data != {}:
-        #             b1 = str("SOS_NUMBER1") in self.read_data.keys()
-        #             if b1 == True:
-        #                 self.sos_numer1 = [self.read_data["SOS_NUMBER1"]]
-        #             b2 = str("SOS_NUMBER2") in self.read_data.keys()
-        #             if b2 == True:
-        #                 self.sos_numer1 = [self.read_data["SOS_NUMBER1"], self.read_data["SOS_NUMBER2"]]
-
-        #             b3 = str("SOS_NUMBER3") in self.read_data.keys()
-        #             if b3 == True:
-        #                 self.sos_numer1 = [self.read_data["SOS_NUMBER1"], self.read_data["SOS_NUMBER2"],self.read_data["SOS_NUMBER3"]]
-                        
-        # print("self.sos_numer1:{} self.read_data:{}".format(self.sos_numer1,self.read_data))
+        SOS_NUMBER1 = EventMesh.publish("get_storage_config","SOS_NUMBER1")
+        if SOS_NUMBER1 != None:
+                self.sos_numer1 = SOS_NUMBER1
+        SOS_NUMBER2 = EventMesh.publish("get_storage_config","SOS_NUMBER2")
+        if SOS_NUMBER1 != None:        
+            self.sos_numer1 = [SOS_NUMBER1, SOS_NUMBER2]
+
+        SOS_NUMBER3 = EventMesh.publish("get_storage_config","SOS_NUMBER3")
+        if SOS_NUMBER3 != None:        
+            self.sos_numer1 = [SOS_NUMBER1, SOS_NUMBER2,SOS_NUMBER3]
+
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("set_sos_flag", self.set_sos_flag)#设置sos拨打标识
@@ -2804,20 +2699,9 @@ class getLowBatManager(Abstract):#低电提醒
     def __init__(self):
 
         self.low_btn = 0
-        read_data = EventMesh.publish("get_storage_data")
+        read_data = EventMesh.publish("get_storage_config","low_on")
         if read_data != None:
-            b1 = str("low_on") in read_data.keys()
-            if b1 == True:
-                self.low_btn = read_data["low_on"]
-        # check = ql_fs.path_exists("/ext/static/storage_file/config.json")
-        
-        # if check == True:
-        #     with open("/ext/static/storage_file/config.json","r") as fd:
-        #         self.read_data = ujson.load(fd)
-        #         if self.read_data != {}:
-        #             b1 = str("low_on") in self.read_data.keys()
-        #             if b1 == True:
-        #                 self.low_btn = self.read_data["low_on"]
+            self.low_btn = read_data
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("set_low_bat_btn", self.set_low_bat_btn)#
@@ -2825,25 +2709,12 @@ class getLowBatManager(Abstract):#低电提醒
 
     def set_low_bat_btn(self, event, msg): 
         self.low_btn = msg
+        EventMesh.publish("set_storage_config",["low_on",self.low_btn])
 
     def get_low_bat_btn(self, event, msg): 
         return self.low_btn
     
-class getCountDownManager(Abstract):#倒计时
-    def __init__(self):
-        self.read_data = {}
-        self.low_btn = 0
-        
 
-    def post_processor_after_instantiation(self):
-        EventMesh.subscribe("set_low_bat_btn", self.set_low_bat_btn)#
-        EventMesh.subscribe("get_low_bat_btn", self.get_low_bat_btn)
-
-    def set_low_bat_btn(self, event, msg): 
-        self.low_btn = msg
-
-    def get_low_bat_btn(self, event, msg): 
-        return self.low_btn
 
 class playPowerAudioManager(Abstract):#播放开关机音频文件
     def __init__(self):
@@ -2866,48 +2737,28 @@ class getBootOffManager(Abstract):#开关机时间
         self.off_msg = {}
         self.off_flag = 0
         self.rtc =  RTC()
-        read_data = EventMesh.publish("get_storage_data")
+        
+        read_data = EventMesh.publish("get_storage_config","off_on")
         if read_data != None:
-            b1 = str("off_on") in read_data.keys()
-            if b1 == True:
-                self.off_on = read_data["off_on"]
-            b2 = str("off_start") in read_data.keys()
-            if b2 == True:
-                self.off_start= read_data["off_start"]
-
-            b3 = str("off_end") in read_data.keys()
-            if b3 == True:
-                self.off_end = read_data["off_end"]
-        # if check == True:
-        #     with open("/ext/static/storage_file/config.json","r") as fd:
-        #         self.read_data = ujson.load(fd)
-        #         if self.read_data != {}:
-        #             b1 = str("off_on") in self.read_data.keys()
-        #             if b1 == True:
-        #                 self.off_on = self.read_data["off_on"]
-        #             b2 = str("off_start") in self.read_data.keys()
-        #             if b2 == True:
-        #                 self.off_start= self.read_data["off_start"]
-
-        #             b3 = str("off_end") in self.read_data.keys()
-        #             if b3 == True:
-        #                 self.off_end = self.read_data["off_end"]
-                        
-        # print("self.sos_numer1:{} self.read_data:{}".format(self.sos_numer1,self.read_data))
+            self.off_on = read_data
+        read_data = EventMesh.publish("get_storage_config","off_start")
+        if read_data != None:
+            self.off_start= read_data
+        read_data = EventMesh.publish("get_storage_config","off_end")
+        if read_data != None:
+            self.off_end = read_data
+
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("set_boot_off_time", self.set_boot_off_time)#设置关机时间
         EventMesh.subscribe("get_boot_off_time", self.get_boot_off_time)
 
     def set_boot_off_time(self, event, msg): 
-        read_data = EventMesh.publish("get_storage_data")
-        read_data["off_on"] = msg[0]
-        read_data["off_start"] = msg[1]
-        read_data["off_end"] = msg[2]
-        with open("/usr/static/storage_file/config.json", 'w+',encoding='utf-8') as fd:
-            ujson.dump(read_data,fd)
+        EventMesh.publish("get_storage_config",["off_on",msg[0]])
+        EventMesh.publish("get_storage_config",["off_start",msg[1]])
+        EventMesh.publish("get_storage_config",["off_end",msg[2]])
         self.off_msg = msg
-        # print("read_data:{} self.off_msg:{}".format(read_data,self.off_msg))
+
 
     def get_boot_off_time(self, event, msg):
         flag = 0
@@ -2934,7 +2785,6 @@ class setSmsIndexManager(Abstract):#
     def set_sms_index(self, event, msg): 
         self.index = msg
         
-        # print("read_data:{} self.off_msg:{}".format(read_data,self.off_msg))
 
     def get_sms_index(self, event, msg):
         
@@ -2943,68 +2793,20 @@ class setSmsIndexManager(Abstract):#
 class testSmsSetIPManager(Abstract):#
     def __init__(self):
         self.timer = osTimer()
-        self.newip = ""#默认防走丢协议
-        self.newcom = 0
-
-        read_data = EventMesh.publish("get_storage_data")
-        if read_data != None:
-            b1 = str("set_new_ip_addr") in read_data.keys()
-            if b1 == True:
-                self.newip = read_data["set_new_ip_addr"]
-            else:
-                self.newip = "api.xcloudtech.com"
-            
-            b2 = str("set_new_com") in read_data.keys()
-            if b2 == True:
-                self.newcom = read_data["set_new_com"]
-            else:
-                self.newcom = 9000
-
-            b3 = str("set_new_md5") in read_data.keys()
-            if b3 == True:
-                self.newmd5 = read_data["set_new_md5"]
-            else:
-                self.newmd5 = "bZld0ALsZTt15tKEZhOlLPgbsO75BLTP"
-
-        # check = ql_fs.path_exists("/ext/static/storage_file/config.json")
-        # if check == True:
-        #     with open("/ext/static/storage_file/config.json","r") as fd:
-        #         self.read_data = ujson.load(fd)
-        #         print("config.json:{}".format(self.read_data))
-        #         b1 = str("set_new_ip_addr") in self.read_data.keys()
-        #         if b1 == True:
-        #             self.newip = self.read_data["set_new_ip_addr"]
-        #         else:
-        #             self.newip = "api.xcloudtech.com"
-
-        #         b2 = str("set_new_com") in self.read_data.keys()
-        #         if b2 == True:
-        #             self.newcom = self.read_data["set_new_com"]
-        #         else:
-        #             self.newcom = 9000
-
-        #         b3 = str("set_new_md5") in self.read_data.keys()
-        #         if b3 == True:
-        #             self.newmd5 = self.read_data["set_new_md5"]
-        #         else:
-        #             self.newmd5 = "bZld0ALsZTt15tKEZhOlLPgbsO75BLTP"
-                
-        #         self.read_data["set_new_ip_addr"] = self.newip
-        #         self.read_data["set_new_com"] = self.newcom
-        #         # self.read_data["set_new_md5"] = self.newmd5
+        self.newip = "api.xcloudtech.com"#默认防走丢协议
+        self.newcom = 9000
+        self.newmd5 = "bZld0ALsZTt15tKEZhOlLPgbsO75BLTP"
+        tmp_data = EventMesh.publish("get_storage_config","set_new_ip_addr")
+        if tmp_data != None:
+            self.newip = tmp_data
+        tmp_data = EventMesh.publish("get_storage_config","set_new_com")
+        if tmp_data != None:
+            self.newcom = tmp_data
+        tmp_data = EventMesh.publish("get_storage_config","set_new_md5")
+        if tmp_data != None:
+            self.newmd5 = tmp_data    
 
 
-        #         with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
-        #             ujson.dump(self.read_data,fd)
-        # else:
-        #     self.newip = "api.xcloudtech.com"#默认防走丢协议
-        #     self.newcom = 9000
-        #     # self.newmd5 = "bZld0ALsZTt15tKEZhOlLPgbsO75BLTP"
-        # print("config.json:{}".format(self.read_data))
-        # server_addr = "tcptest.tx.kidxin.com"
-        # #SETIP:api.xcloudtech.com:9000
-        # server_port = 11500
-
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("set_new_ip", self.set_new_ip)#设置关机时间
@@ -3015,21 +2817,16 @@ class testSmsSetIPManager(Abstract):#
         self.newcom = int(msg[1])
         # self.newmd5 = str(msg[2])
         #短信格式:SETIP:api.xcloudtech.com:9000:bZld0ALsZTt15tKEZhOlLPgbsO75BLTP 以冒号分隔 SETIP:ip地址:ip端口号:ip密钥key
-        read_data = EventMesh.publish("get_storage_data")
-        read_data["set_new_ip_addr"] = self.newip #通过短信设置ip地址
-        read_data["set_new_com"]= self.newcom #通过短信设置ip端口号
+
         # self.read_data["set_new_md5"] = self.newmd5  #通过短信设置ip的key密钥
        
-        
-        with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-            ujson.dump(read_data,fd)
-        with open("/usr/static/storage_file/config.json","r") as fd:
-            read_data = ujson.load(fd)
-        print("config.json:{}".format(read_data))
-        # print("msg:{} self.read_data:{}".format(msg,self.read_data))
+
+        EventMesh.publish("set_storage_config",["set_new_ip_addr",self.newip])
+        EventMesh.publish("set_storage_config",["set_new_com",self.newcom])
+
         number = str(msg[2])
         sms.sendPduMsg(number, 'set ok', 'UCS2')
-        self.timer.start(5*1000,0,self.fun)
+        self.timer.start(10*1000,0,self.fun)
         
     def fun(self,*argc):
         Power.powerRestart()
index 251cc65..ac65269 100644 (file)
@@ -469,20 +469,16 @@ class KA_ProtoCol(ProtoCol):
         old_step = 0
         step = 0
         step = EventMesh.publish("get_old_step_value")
-        if step != 0:
-            read_data = EventMesh.publish("get_storage_data")
-            b = str("old_step_new") in read_data.keys()
-            if b == True:
-                old_step = read_data["old_step_new"]
-            else:
-                old_step = 0
-            if old_step !=  step:
-                # print("old_step:send:%d %d"%(old_step,step))
-                read_data["old_step"] = step
-                read_data["old_step_new"] = step+10
-                EventMesh.publish("set_storage_data", read_data)
-                with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-                    ujson.dump(read_data,fd)
+        if step != None:
+            if step != 0:
+                read_data = EventMesh.publish("get_storage_config","old_step_new")
+                if read_data != None:
+                    old_step = read_data
+                
+                if old_step !=  step:
+                    # print("old_step:send:%d %d"%(old_step,step))
+                    EventMesh.publish("set_storage_config",["old_step_new",step+10])
+                    EventMesh.publish("set_storage_config",["old_step_new",step])
 
         old_step = step
         # step = EventMesh.publish(constants.EVENT.GET_STEP)[0]
@@ -803,6 +799,7 @@ class REMIND_ProtoCol(ProtoCol):
         # EventMesh.publish("add_alarm",[0,msg_tmp])
         EventMesh.publish(constants.PROTOCOL.REMIND_SEND)
 
+
 class HRSTART_ProtoCol(ProtoCol):
     """心率频率数据"""
     TYPE = "hrtstart"
@@ -849,17 +846,10 @@ class HRSTART_ProtoCol(ProtoCol):
                 elif hrTotal >= 65536:
                     hrTotal = 65536
                 print("HRSTART_ 3".format(hrTotal))
-                storage_tmp = EventMesh.publish("get_storage_data")
-                storage_tmp["measure_time"] = hrTotal
-                storage_tmp["open_hr_btn"] = 1
-
-                EventMesh.publish("set_storage_data", storage_tmp)
                 EventMesh.publish("set_time_hr_spo2",[1,hrTotal])
-                with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-                    ujson.dump(storage_tmp,fd)
 
-        EventMesh.publish(constants.PROTOCOL.HRTSTART_SEND)
 
+        EventMesh.publish(constants.PROTOCOL.HRTSTART_SEND)
 class HEART_ProtoCol(ProtoCol):
     """心率数据"""
     TYPE = "heart"
@@ -1010,13 +1000,10 @@ class WDSTART_ProtoCol(ProtoCol):
                 tempTotal = 300
             elif tempTotal >= 65536:
                 tempTotal = 65536
-            storage_tmp = EventMesh.publish("get_storage_data")
-            storage_tmp["temp_time"] = tempTotal
-            EventMesh.publish("set_storage_data", storage_tmp)
+            
             EventMesh.publish("set_temp_time",tempTotal)
-            print("storage_tmp:{}".format(storage_tmp))
-            with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-                ujson.dump(storage_tmp,fd)
+
+            
         
         EventMesh.publish(constants.PROTOCOL.WDSTART_SEND)
 #解绑
@@ -1069,12 +1056,9 @@ class UPLOAD_ProtoCol(ProtoCol):
         msg_tmp = msg_tmp.split(',')
         msg_tmp = msg_tmp[1]
         upload_time = int(msg_tmp)
-        storage_tmp = EventMesh.publish("get_storage_data")
-        storage_tmp["upload_time"] = upload_time
-        EventMesh.publish("set_storage_data", storage_tmp)
+        EventMesh.publish("set_storage_config",["upload_time",upload_time])
+
         EventMesh.publish("set_upload_data", upload_time)
-        with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-            ujson.dump(storage_tmp,fd)
         EventMesh.publish(constants.PROTOCOL.UPLOAD_SEND)
 
 #设置快捷号码
@@ -1103,11 +1087,7 @@ class CENTER_ProtoCol(ProtoCol):
         msg_tmp = msg_tmp[1]
         print("CENTER_ProtoCol RECV msg:{} msg_:{}".format(msg,msg_tmp))
         center_dial = str(msg_tmp)
-        storage_tmp = EventMesh.publish("get_storage_data")
-        storage_tmp["center_dial"] = center_dial
-        EventMesh.publish("set_storage_data", storage_tmp)
-        with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-            ujson.dump(storage_tmp,fd)
+        EventMesh.publish("set_storage_config",["center_dial",center_dial])
         EventMesh.publish(constants.PROTOCOL.CENTER_SEND)  
 
 #呼叫快捷电话号码
@@ -1193,8 +1173,6 @@ class sosHome_dial_ProtoCol(ProtoCol):
         """
 
         # b'[SZKW*867387060319166*000A*SOS_SEND]'
-        read_data = {}
-        read_data = EventMesh.publish("get_storage_data")
         msg = msg[1:-1]
         msg_tmp = msg.decode('ascii')
         msg_tmp = msg_tmp.split(',')
@@ -1205,7 +1183,7 @@ class sosHome_dial_ProtoCol(ProtoCol):
         for i in range(len(msg_tmp)-1):
             # print("sos:send data :{}".format(msg_tmp[i+1]))
             if len(msg_tmp[i+1]) != 0:
-                read_data["SOS_NUMBER{}".format(i+1)] =  msg_tmp[i+1]
+                EventMesh.publish("set_storage_config",["SOS_NUMBER{}".format(i+1),msg_tmp[i+1]])
                 # print("read_data:{} msg_tmp:{}".format(read_data,msg_tmp[i+1]))
        
         if (len(msg_tmp)-1) == 3:
@@ -1214,13 +1192,7 @@ class sosHome_dial_ProtoCol(ProtoCol):
             EventMesh.publish("set_dial_sos_number",[msg_tmp[1],msg_tmp[2]])
         elif (len(msg_tmp)-1) == 1:
             EventMesh.publish("set_dial_sos_number",[msg_tmp[1]])
-            
-            
-        if (len(msg_tmp)-1) != 0:
-            EventMesh.publish("set_storage_data",read_data)
-            # print("read_data:{}".format(read_data))
-            with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-                ujson.dump(read_data,fd)
+             
         EventMesh.publish(constants.PROTOCOL.SOS_SEND)  
   
 # 低电提醒
@@ -1243,21 +1215,16 @@ class LOWBAT_ProtoCol(ProtoCol):
         @param msg: 接收到的下行数据
         """
         # b'[SZKW*867387060319166*000A*LOWBAT]'
-        read_data = {}
-        read_data = EventMesh.publish("get_storage_data")
+
         msg = msg[1:-1]
         msg_tmp = msg.decode('ascii')
         msg_tmp = msg_tmp.split(',')
         on_bt = msg_tmp[1]
         print("LOWBAT:send data:{}".format(on_bt))
         #b'[SZKW*860132060006970*0015*LOWBAT,1,06:00,23:59]'
-
-        read_data["low_on"] = on_bt
-        EventMesh.publish("set_storage_data",read_data)
         EventMesh.publish("set_low_bat_btn",on_bt)
-        with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-            ujson.dump(read_data,fd)
         EventMesh.publish(constants.PROTOCOL.LOWBAT_SEND)  
+
 #KEYBRD
 class KEYBRD_ProtoCol(ProtoCol):
     """低电提醒"""
index b7f2e53..36b7e1c 100644 (file)
@@ -2799,24 +2799,7 @@ class IncomingCallScreen(Screen):
         self.CALL_LOG_MAX = CALL_LOG_MAX
         self.read_data = {}
         self.meta_type = "popup"
-        # self.volum_size = 8
-        # check_volum = ql_fs.path_exists("/usr/static/storage_file/config.json")
-        # if check_volum == True :
-        #     with open("/usr/static/storage_file/config.json","r") as fd:#音频文件编号
-        #         self.read_data = ujson.load(fd)
-        #         if self.read_data != {}:
-        #             b = str("volum") in self.read_data.keys()
-        #             if b == True:
-        #                 self.volum_size = self.read_data["volum"]  
-        #             else:
-        #                 self.volum_size = 8
-        #         else:
-        #             self.volum_size = 8
-        # else:
-        #     self.volum_size = 8
         self.aud = audio.Audio(0)
-        # self.aud.set_pa(Pin.GPIO29)
-        # self.aud.setVolume(self.volum_size)
         self.call_timer = osTimer()
         self.name = None
         self.phonebook = {}
@@ -3354,6 +3337,7 @@ class OnCallScreen(Screen):
         self.button = 0
         self.mute_state = 0
         on_call_volum_label.set_style_text_color(lv.color_make(255,255,255), lv.STATE.DEFAULT)
+        voiceCall.mute(2,0,0)
 
     def show_num(self):
         global on_call_screen_tab_label
@@ -3556,10 +3540,12 @@ class OnCallScreen(Screen):
         global on_call_screen_tab,on_call_screen,on_call_obj
         if self.mute_state == 0:#默认是开启
             self.mute_state = 1
+            voiceCall.mute(2,1,0)
             on_call_volum_label.set_style_text_color(lv.color_make(0, 169, 242), lv.STATE.DEFAULT)
         else:
             on_call_volum_label.set_style_text_color(lv.color_make(255,255,255), lv.STATE.DEFAULT)
             self.mute_state = 0
+            voiceCall.mute(2,0,0)
        # self.aud.setVolume(0)
         # if self.open_volum_state == 1:
         #     self.open_volum_state = 0
@@ -3603,14 +3589,8 @@ class OnCallScreen(Screen):
     def show_bar(self,msg):
         on_call_bar.set_value((100 // 11) * self.volum_size, lv.ANIM.OFF)
         if msg == 1:
-            self.read_data = EventMesh.publish("get_storage_data")
-            self.read_data["volum"] = self.volum_size
             self.aud.setVolume(self.volum_size)
-            EventMesh.publish("set_storage_data", self.read_data)
             EventMesh.publish("set_volum_size",self.volum_size)
-            # print("self.read_data:size :{}".format(self.read_data))
-            with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-                ujson.dump(self.read_data,fd)
 
     def post_processor_after_initialization(self):
         global on_call_screen_tab,on_call_obj
@@ -6091,26 +6071,7 @@ class UIFINDScreen(Screen):
     NAME = "FIND"
     def __init__(self):
         super().__init__()
-        self.read_data = {}
-        # self.volum_size = 8
-
-        # check_volum = ql_fs.path_exists("/usr/static/storage_file/config.json")
-        # if check_volum == True :
-        #     with open("/usr/static/storage_file/config.json","r") as fd:#音频文件编号
-        #         self.read_data = ujson.load(fd)
-        #         if self.read_data != {}:
-        #             b = str("volum") in self.read_data.keys()
-        #             if b == True:
-        #                 self.volum_size = self.read_data["volum"]  
-        #             else:
-        #                 self.volum_size = 8
-        #         else:
-        #             self.volum_size = 8
-        # else:
-        #     self.volum_size = 8
         self.aud = audio.Audio(0)
-        # self.aud.set_pa(Pin.GPIO29)
-        # self.aud.setVolume(self.volum_size)
         self.FIND_timer = osTimer()
         self.FIND_timer_count = 0
         self.meta = None
@@ -6877,51 +6838,21 @@ class UI(object):
         self.system_sleep_timer = osTimer()
         self.system_sleep_timer_count = 0
         self.sleep_flag = 1
-        self.level = 2
         self.aud = audio.Audio(0)
         self.aud.set_pa(Pin.GPIO29)
-        
-        self.volum_size = 8
-        self.level = EventMesh.publish("get_brightness_level")
-        read_data = EventMesh.publish("get_storage_data")
+        self.level = 2
         self.main_flag = 0
         self.main_id = 0
         self.set_interrup_flag = 0
         self.UI_high_priority_flag = 0 #如果=1,则当前ui不被打断
-        # print("self.read_data:{} self.level:{}".format(self.read_data,self.level))
-        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:
-                read_data = ujson.load(fd)
-                if read_data != {}:
-                    b = str("brightness_level") in read_data.keys()
-                    if b == True:
-                        self.level = read_data["brightness_level"]
-                    else:
-                        self.level = 2
-                        read_data["brightness_level"] = self.level
-                       
-
-                    volum = str("volum") in read_data.keys()
-                    if volum == True:
-                        self.volume_size = read_data["volum"]  
-                    else:
-                        self.volume_size = 8
-                        read_data["volum"] = self.volume_size
-
-                    EventMesh.publish("set_storage_data",read_data)
-                    with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-                        ujson.dump(read_data,fd)
-        else:
-            self.level = 2 #默认是2级别
-            self.volume_size = 8
-
+        self.level = EventMesh.publish("get_storage_config","brightness_level")
+        print("self.level:{}".format(self.level))
+        
         if self.level == None:
             self.level = 2
         self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_10US, self.level*100, 1000)
         self.PWM_backlight.open()
         self.sleep_lock = 0
-        self.aud.setVolume(self.volum_size)
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("load_screen", self.load_screen_cb)
@@ -6981,7 +6912,7 @@ class UI(object):
             #         break
     def return_prev_screen(self, event, msg):
         if self.screen_prev != None:
-            print("return_prev_screen",self.screen_prev)
+            # print("return_prev_screen",self.screen_prev)
             EventMesh.publish("load_screen", {"screen": self.screen_prev.NAME})
 
     def set_interrup_incall(self, event, msg):
index 15733b2..1465054 100644 (file)
@@ -581,20 +581,11 @@ class WatchFace():
         self.watchface_list = []
         self.timer_update = osTimer()
         EventMesh.subscribe("set_change_face", self.change_face)
-        self.read_data = {}
         self.PWM_backlight  = None
-        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.read_data = ujson.load(fd)
-                if self.read_data != {}:
-                    b = str("watchface") in self.read_data.keys()
-                    if b == True:
-                        self.watchface_style_num = self.read_data["watchface"]
-                    else:
-                        self.watchface_style_num = "Watchface1"
-        else:
-            self.watchface_style_num = "Watchface1"
+        read_data = EventMesh.publish("get_storage_config","watchface")
+        if read_data != None:
+            self.watchface_style_num = read_data
+
 
     def initialization(self,main_menu):
         if self.watchface_list == [] : #第一次初始化
index 94f9360..2559e32 100644 (file)
@@ -220,20 +220,20 @@ label_text = lv.label(MainMenu2_camera)
 label_text.set_pos(0, 0)
 label_text.set_size(0, 0)
 label_text.set_text("{}".format(MainMenu2_num))
-MainMenu2_img_toolbox = lv.img(MainMenu2_camera)
-MainMenu2_img_toolbox.set_size(80,80)
-MainMenu2_img_toolbox.set_pos(24,10)
-MainMenu2_img_toolbox.set_src("U:/static/IMAGE_ONE_PAGE_CAMERA.png")
-MainMenu2_img_toolbox.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_toolbox.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-MainMenu2_img_toolbox_txt = lv.label(MainMenu2_camera)
-MainMenu2_img_toolbox_txt.set_pos(int(0),int(100))
-MainMenu2_img_toolbox_txt.set_size(128,20)
-MainMenu2_img_toolbox_txt.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_toolbox_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-MainMenu2_img_toolbox_txt.set_text("拍照")
-MainMenu2_img_toolbox_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT)
+MainMenu2_img_camera = lv.img(MainMenu2_camera)
+MainMenu2_img_camera.set_size(80,80)
+MainMenu2_img_camera.set_pos(24,10)
+MainMenu2_img_camera.set_src("U:/static/IMAGE_ONE_PAGE_CAMERA.png")
+MainMenu2_img_camera.add_flag(lv.obj.FLAG.CLICKABLE)
+MainMenu2_img_camera.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+MainMenu2_img_camera_txt = lv.label(MainMenu2_camera)
+MainMenu2_img_camera_txt.set_pos(int(0),int(100))
+MainMenu2_img_camera_txt.set_size(128,20)
+MainMenu2_img_camera_txt.add_flag(lv.obj.FLAG.CLICKABLE)
+MainMenu2_img_camera_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+MainMenu2_img_camera_txt.set_text("相机")
+MainMenu2_img_camera_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT)
 MainMenu2_num+=1
 MainMenu2x+=1
 
index 311ba7e..a09f664 100644 (file)
@@ -458,6 +458,11 @@ menu_btn2_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.KNOB
 
 
 # -------------------------------------------app screen----------------------------------------------------------
+style_font_youyuan_20_default = lv.style_t()
+style_font_youyuan_20_default.init()
+style_font_youyuan_20_default.set_text_color(lv.color_make(0xff, 0xff, 0xff))
+# style_font_youyuan_20_black.set_text_font(lv.K01_font_16_ALL)
+
 #app_screen = lv.obj()
 app_screen = lv.obj()
 print("app_screen")
@@ -487,7 +492,7 @@ app_label.set_size(128, 38)
 app_label.set_text(" ")
 app_label.set_long_mode(lv.label.LONG.WRAP)
 app_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-app_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+app_label.add_style(style_font_youyuan_20_default, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 
 # -------------------------------------------volume screen----------------------------------------------------------
@@ -1041,14 +1046,11 @@ class PoweroffConfirmScreen(Screen):
 
     def initialization(self):
         step = EventMesh.publish("get_old_step_value")
-        read_data = EventMesh.publish("get_storage_data")
         if step != 0:
-            read_data["old_step"] = step
+            EventMesh.publish("set_storage_config",["old_step",step])
+            
         date_tmp = utime.localtime()
-        read_data["old_timesecond"] = date_tmp#关机保存一个是时间
-        #print("read_data:{}".format(read_data))
-        with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-            ujson.dump(read_data,fd)
+        EventMesh.publish("set_storage_config",["old_timesecond",date_tmp])#关机保存一个是时间
         self.count = 0
         self.aud.play(1, 1, 'U:/static/R_VOLUME_SET_1.mp3')  #文件名前面要加上路径
         self.timer.start(1*1000,1,self.power_off)
@@ -1089,22 +1091,13 @@ class PowerOnScreen(Screen):
         self.timer2 = osTimer()
         self.aud = audio.Audio(0)
         self.aud.set_pa(Pin.GPIO29)
-        read_data = {}
         self.volum_size = 8
-        check_volum = ql_fs.path_exists("/usr/static/storage_file/config.json")
-        if check_volum == True :
-            with open("/usr/static/storage_file/config.json","r") as fd:#音频文件编号
-                read_data= ujson.load(fd)
-                if read_data != {}:
-                    b = str("volum") in read_data.keys()
-                    if b == True:
-                        self.volum_size = read_data["volum"]  
-                    else:
-                        self.volum_size = 8
-                else:
-                    self.volum_size = 8
-        else:
-            self.volum_size = 8
+        check_volum = EventMesh.publish("get_storage_config","volum")
+
+        if check_volum != None:
+            self.volum_size = check_volum
+
+
         self.aud.setVolume(self.volum_size)
         self.count = 0
 
@@ -1242,11 +1235,6 @@ class DialswitchScreen(Screen):
             
     def enter_main_show(self,e):
         self.dial_num = 1
-        # self.read_data = EventMesh.publish("get_storage_data")
-        # self.read_data["watchface"] = "Watchface{}".format(self.dial_num)
-        # EventMesh.publish("set_storage_data", self.read_data)
-        # with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-        #     ujson.dump(self.read_data,fd)
         EventMesh.publish("set_change_face", "Watchface{}".format(self.dial_num))
         EventMesh.publish("watch_top_show")
         EventMesh.publish("load_screen", {"screen": "main_menu"})
@@ -1364,7 +1352,7 @@ imei_label.set_size(128, 38)
 imei_label.set_text(" ")
 imei_label.set_long_mode(lv.label.LONG.WRAP)
 imei_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-imei_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+imei_label.add_style(style_font_youyuan_20_default, lv.PART.MAIN | lv.STATE.DEFAULT)
 class ImeiScreen(Screen):
     NAME = "imei"
 
@@ -1538,12 +1526,6 @@ class BrightnessScreen(Screen):
         if self.time > 5:
             self.time-=5
         EventMesh.publish("set_brightness_time",self.time)
-        self.read_data = EventMesh.publish("get_storage_data")
-        self.read_data["brightness_time"] = self.time
-
-        EventMesh.publish("set_storage_data", self.read_data)
-        with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-            ujson.dump(self.read_data,fd)
         brightness_label_time_text.set_text("{}秒".format(self.time))
         # print("reduce_time_level:{}".format(self.read_data))
 
@@ -1551,13 +1533,7 @@ class BrightnessScreen(Screen):
         self.time+=5
         if self.time >= 30:
             self.time = 30
-        EventMesh.publish("set_brightness_time",self.time)
-        self.read_data = EventMesh.publish("get_storage_data")
-        self.read_data["brightness_time"] = self.time
-
-        EventMesh.publish("set_storage_data", self.read_data)
-        with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-            ujson.dump(self.read_data,fd)
+        EventMesh.publish("set_brightness_time",self.time)        
         brightness_label_time_text.set_text("{}秒".format(self.time))
         # print("add_time_level:{}".format(self.read_data))
     
@@ -1817,14 +1793,8 @@ class totalvolumeScreen(Screen):
     def show_bar(self,msg):
         totalvolume_bar.set_value((100 // 11) * self.volum_size, lv.ANIM.OFF)
         if msg == 1:
-            self.read_data = EventMesh.publish("get_storage_data")
-            self.read_data["volum"] = self.volum_size
             self.aud.setVolume(self.volum_size)
-            EventMesh.publish("set_storage_data", self.read_data)
             EventMesh.publish("set_volum_size",self.volum_size)
-            # print("self.read_data:size :{}".format(self.read_data))
-            with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
-                ujson.dump(self.read_data,fd)
             self.aud.play(1, 1, 'U:/static/R_VOLUME_SET_1.mp3')  #播放声音
  
     def Close(self):
index 29178ce..5340f28 100644 (file)
@@ -123,7 +123,7 @@ class BtnDevice(Abstract):
         if status == 1:#拔出
             screen_NAME = EventMesh.publish("get_screen_NAME")
             if screen_NAME != None:
-                if screen_NAME == "poweron":
+                if screen_NAME == "poweron" or screen_NAME == "system_init":
                     return
             bat_tmp = EventMesh.publish("screen_get_battery")
             if bat_tmp !=  None:
@@ -133,7 +133,7 @@ class BtnDevice(Abstract):
         elif status == 0:#插入usb
             screen_NAME = EventMesh.publish("get_screen_NAME")
             if screen_NAME != None:
-                if screen_NAME == "poweron":
+                if screen_NAME == "poweron" or screen_NAME == "system_init":
                     return
             bat_tmp = EventMesh.publish("screen_get_battery")
             if bat_tmp !=  None:
index 106381f..879b618 100644 (file)
@@ -1902,12 +1902,9 @@ class LocationManager(Abstract):
         step = 0
         step = EventMesh.publish("get_old_step_value")
         if step != 0:
-            
-
             tmp_data  = EventMesh.publish("get_storage_config","old_step_new")
             if tmp_data != None:
                 old_step = tmp_data
-
             if old_step !=  step:
                 EventMesh.publish("set_storage_config",["old_step",step])
                 EventMesh.publish("set_storage_config",["old_step_new",step])
index d0e0d09..8350d5e 100644 (file)
@@ -6296,13 +6296,13 @@ class UI(object):
         self.sleep_flag = 1
         self.level = 6
         self.aud = audio.Audio(0)
-        self.level = EventMesh.publish("get_brightness_level")
+        
         self.main_flag = 0
         self.main_id = 0
         self.set_interrup_flag = 0
         self.UI_high_priority_flag = 0 #如果=1,则当前ui不被打断
-        
-        print(" self.level:{}".format(self.level))
+        self.level = EventMesh.publish("get_storage_config","brightness_level")
+
 
         if self.level == None:
             self.level = 6
index 010f1eb..dcb24b4 100644 (file)
@@ -1019,12 +1019,10 @@ class PowerOnScreen(Screen):
         self.timer = osTimer()
         self.aud = audio.Audio(0)
         self.aud.set_pa(Pin.GPIO29)
-        read_data = {}
         self.volum_size = 8
         check_volum = EventMesh.publish("get_storage_config","volum")
-
         if check_volum != None:
-            self.volum_size = read_data["volum"]  
+            self.volum_size =  check_volum
 
 
         self.aud.setVolume(self.volum_size)