更换拨号盘图片
authord15521469561 <d155214695615@qq.com>
Fri, 28 Apr 2023 08:33:17 +0000 (16:33 +0800)
committerd15521469561 <d155214695615@qq.com>
Fri, 28 Apr 2023 08:33:17 +0000 (16:33 +0800)
表盘字体更改

31 files changed:
2.sdk/Helios_SDK/services/microPython/ports/quectel/core/Makefile
2.sdk/Helios_SDK/services/microPython/ports/quectel/core/appAlipay.py
2.sdk/Helios_SDK/services/microPython/ports/quectel/core/appWechat.py
2.sdk/Helios_SDK/services/microPython/ports/quectel/core/mgr.py
2.sdk/Helios_SDK/services/microPython/ports/quectel/core/ui.py
2.sdk/Helios_SDK/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py
2.sdk/Helios_SDK/services/microPython/ports/quectel/core/ui_setting.py
3.code/1.watch/2.code/appAlipay.py
3.code/1.watch/2.code/appWechat.py
3.code/1.watch/2.code/main.py
3.code/1.watch/2.code/main_1.py
3.code/1.watch/2.code/mgr.py
3.code/1.watch/2.code/protocol.py
3.code/1.watch/2.code/static/IMAGE_BUTTON_DELKEY.png
3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL.png
3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL_CONTACT.png
3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY0_ICON.png
3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY1_ICON.png
3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY2_ICON.png
3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY3_ICON.png
3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY4_ICON.png
3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY5_ICON.png
3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY6_ICON.png
3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY7_ICON.png
3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY8_ICON.png
3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY9_ICON.png
3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYHASH_ICON.png
3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYSTAR_ICON.png
3.code/1.watch/2.code/ui.py
3.code/1.watch/2.code/ui_WatchFaceScreen.py
3.code/1.watch/2.code/ui_setting.py

index 7de462c..b4f6454 100644 (file)
@@ -896,7 +896,6 @@ frozen_mpy_list =   $(BUILD)/_boot.mpy \
                                        $(BUILD)/mgr.mpy \
                                        $(BUILD)/ui.mpy \
                                        $(BUILD)/ui_setting.mpy \
-                                       $(BUILD)/alarm.mpy \
                                        $(BUILD)/appAlipay.mpy \
                                        $(BUILD)/appWechat.mpy \
                                        $(BUILD)/ui_WatchFaceScreen.mpy \
index 065637e..2375db3 100644 (file)
@@ -85,7 +85,8 @@ class Alipay(Abstract):
         print("post_processor_after_instantiation")
         
         
-        
+        EventMesh.subscribe("alipay_unbind", self.alipay_unbind)
+
         EventMesh.subscribe("alipay_1", self.alipay_1)
         EventMesh.subscribe("get_payment_code", self.get_payment_code)
         EventMesh.subscribe("get_collect_code", self.get_collect_code)
@@ -264,6 +265,9 @@ class Alipay(Abstract):
        
     def get_binding_code(self, event, msg):
         return self.result
+    
+    def alipay_unbind(self, event, msg):
+        self.alipay.unbind()
 
     def get_payment_code(self, event, msg):
         if self.is_init == 0 : 
index f3c6f7b..6dd3def 100644 (file)
@@ -54,21 +54,21 @@ wechat_press_label.set_text("请按住说话")
 wechat_press_label.align(lv.ALIGN.CENTER, 10, 0)
 wechat_press_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
-wechat_label = lv.label(wechat_screen)
-wechat_label.center()
-wechat_label.set_size(240, 40)
-wechat_label.set_long_mode(lv.label.LONG.WRAP)
-wechat_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-wechat_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+# wechat_label = lv.label(wechat_screen)
+# wechat_label.center()
+# wechat_label.set_size(240, 40)
+# wechat_label.set_long_mode(lv.label.LONG.WRAP)
+# wechat_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+# wechat_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 
-wechat_press_label_countdown = lv.label(wechat_screen)
-wechat_press_label_countdown.set_pos(100, 100)
-wechat_press_label_countdown.set_size(40, 40)
-wechat_press_label_countdown.set_text(" ")
-wechat_press_label_countdown.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-wechat_press_label_countdown.set_long_mode(lv.label.LONG.WRAP)
-wechat_press_label_countdown.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0)
+# wechat_press_label_countdown = lv.label(wechat_screen)
+# wechat_press_label_countdown.set_pos(100, 100)
+# wechat_press_label_countdown.set_size(40, 40)
+# wechat_press_label_countdown.set_text(" ")
+# wechat_press_label_countdown.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+# wechat_press_label_countdown.set_long_mode(lv.label.LONG.WRAP)
+# wechat_press_label_countdown.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0)
 
 
 
@@ -115,20 +115,20 @@ class WechatScreen(Screen):
             self.volum_size = 8
         self.aud.setVolume(self.volum_size)
         self.meta = wechat_screen
-        wechat_press_btn.add_event_cb(lambda e: self.talking(e),
-                                     lv.EVENT.LONG_PRESSED, None)
-        wechat_press_btn.add_event_cb(lambda e: self.sending(e),
-                                     lv.EVENT.RELEASED, None)
+        # wechat_press_btn.add_event_cb(lambda e: self.talking(e),
+        #                              lv.EVENT.LONG_PRESSED, None)
+        # wechat_press_btn.add_event_cb(lambda e: self.sending(e),
+        #                              lv.EVENT.RELEASED, None)
         self.timer = osTimer()
         self.second_timer = osTimer()
         self.play_timer = osTimer()
         
-        wechat_label.set_text(" ")
+        
 
         self.startY = 0
         self.startWidth = 0
         self.check_json = 0
-        self.wechat_list =lv.obj(wechat_screen)
+        self.wechat_list = wechat_screen
         EventMesh.subscribe("wechat_updata_list_show", self.wechat_updata_list_show)
         EventMesh.subscribe("get_wechat_data", self.get_wechat_data)
         EventMesh.subscribe("set_wechat_data", self.set_wechat_data)
@@ -163,8 +163,8 @@ class WechatScreen(Screen):
 
     def wechat_updata_list_show(self, event, msg): 
         if (self.wechat_list.has_flag(lv.obj.FLAG.HIDDEN)) == False:
-            wechat_label.clear_flag(lv.obj.FLAG.HIDDEN)
-            wechat_label.set_text("接收中")
+            # wechat_label.clear_flag(lv.obj.FLAG.HIDDEN)
+            # wechat_label.set_text("接收中")
             self.updata_list_show(2)
             self.timer.start(1 * 1000, 0, self.reciving)
     
@@ -176,7 +176,7 @@ class WechatScreen(Screen):
             if self.wechat_num != 0:
                 if index == 0:
                     self.wechat_list.clear_flag(lv.obj.FLAG.HIDDEN)
-                    wechat_label.add_flag(lv.obj.FLAG.HIDDEN)
+                    # wechat_label.add_flag(lv.obj.FLAG.HIDDEN)
                 elif index == 2 or index == 1:
                     #读取json文件中的键作为label文本;
                     #print("self.wechat_list.self.wechat_num:{}".format(self.wechat_num))
@@ -290,9 +290,10 @@ class WechatScreen(Screen):
                     bottom_btn1.scroll_to_view(lv.ANIM.OFF)    
 
     def initialization(self):
-        wechat_label.add_flag(lv.obj.FLAG.HIDDEN)
-        wechat_press_label_countdown.add_flag(lv.obj.FLAG.HIDDEN)
-        self.wechat_list.clear_flag(lv.obj.FLAG.HIDDEN)
+        # wechat_label.set_text(" ")
+        # wechat_label.add_flag(lv.obj.FLAG.HIDDEN)
+        # wechat_press_label_countdown.add_flag(lv.obj.FLAG.HIDDEN)
+        # self.wechat_list.clear_flag(lv.obj.FLAG.HIDDEN)
         #读取json文件中的字典放到self.phonebook中
         #创建btn
         self.updata_list_show(1)
@@ -305,10 +306,10 @@ class WechatScreen(Screen):
         self.aud.stop()
         self.wechat_list.add_flag(lv.obj.FLAG.HIDDEN)#隐藏列表选项方框
         self.countdown = 1
-        wechat_label.clear_flag(lv.obj.FLAG.HIDDEN)
-        wechat_label.set_text("松开发送")
-        wechat_press_label_countdown.clear_flag(lv.obj.FLAG.HIDDEN)
-        wechat_press_label_countdown.set_text("{}S".format(str(self.countdown)))
+        # wechat_label.clear_flag(lv.obj.FLAG.HIDDEN)
+        # wechat_label.set_text("松开发送")
+        # wechat_press_label_countdown.clear_flag(lv.obj.FLAG.HIDDEN)
+        # wechat_press_label_countdown.set_text("{}S".format(str(self.countdown)))
         
 
         self.updata_list_show(2)#不需要显示语音列表
@@ -328,10 +329,10 @@ class WechatScreen(Screen):
      #松开发送   
     def sending(self,e):
         if self.press_state == 1:
-            wechat_label.clear_flag(lv.obj.FLAG.HIDDEN)
-            wechat_label.set_text("发送中")
-            wechat_press_label_countdown.add_flag(lv.obj.FLAG.HIDDEN)
-            wechat_press_label_countdown.set_text(" ")
+            # wechat_label.clear_flag(lv.obj.FLAG.HIDDEN)
+            # wechat_label.set_text("发送中")
+            # wechat_press_label_countdown.add_flag(lv.obj.FLAG.HIDDEN)
+            # wechat_press_label_countdown.set_text(" ")
 
             if self.countdown >= 15:
                 self.countdown = 15 
@@ -433,8 +434,8 @@ class WechatScreen(Screen):
     #松手2秒后发送数据
     def hide_label(self,*args):
         if self.ble_send != 1:
-            wechat_label.add_flag(lv.obj.FLAG.HIDDEN)
-            wechat_label.set_text(" ")
+            # wechat_label.add_flag(lv.obj.FLAG.HIDDEN)
+            # wechat_label.set_text(" ")
             self.updata_list_show(0)
 
      #获取是否在录音
@@ -459,7 +460,7 @@ class WechatScreen(Screen):
 
         if self.countdown >= 15:
             self.countdown = 15
-        wechat_press_label_countdown.set_text("{}S".format(str(self.countdown)))
+        # wechat_press_label_countdown.set_text("{}S".format(str(self.countdown)))
 
     def done_return(self):
         EventMesh.publish("load_screen", {"screen": "main_menu"})
index 2eec719..2c5803e 100644 (file)
@@ -12,7 +12,7 @@ import dataCall
 import checkNet
 import osTimer
 from ext import constants
-
+import sms
 from ext.common import Lock, Abstract, LogAdapter
 from ext.location import GPS, GPSMatch,CellLocator
 from misc import USB, Power, ADC
@@ -440,8 +440,9 @@ def voice_callback(args):
         tmp = []
         tmp = args[6]
         find_num = tmp[0]
-        b = tmp.isdigit()#判断是否不是数字开头 暂时不用 因为截取了+判断不了
-        if find_num != 0 and size_len > 11:
+        b = tmp[0].isdigit()#判断是否不是数字开头 暂时不用 因为截取了+判断不了 判断号码是否大于11位数,如果大于11位数 并且第一个字符是数字就按照最后11位做存储
+
+        if b == True and size_len > 11:
             tmp = tmp[size_len-11:]
         EventMesh.publish("load_screen", {"screen": "incoming_call","meta":str(tmp)})
 
@@ -451,8 +452,8 @@ def voice_callback(args):
         tmp = []
         tmp = args[6]
         find_num = tmp[0]
-        b = tmp.isdigit()#判断是否不是数字开头 暂时不用 因为截取了+判断不了
-        if find_num != 0 and size_len > 11:
+        b = tmp[0].isdigit()#判断是否不是数字开头 暂时不用 因为截取了+判断不了
+        if b == True and size_len > 11:
             tmp = tmp[size_len-11:]
         EventMesh.publish("load_screen", {"screen": "on_call","meta":str(tmp)})
 
@@ -511,9 +512,12 @@ class DeviceInfoManager(Abstract):
         self.Hr_Need_Open = 0
         self.Spo2_Need_Open = 0
         self.bat_time = 0
+        self.sms_full_flag = 0
+        self.clear_step = 0
 
         self.old_time = 0
         self.UD_time = 0
+
         self.UD_timeout = 7*60
         print("DeviceInfoManager:1")
         self.gsensor = SC7A20()
@@ -589,7 +593,9 @@ class DeviceInfoManager(Abstract):
         :return:
         """
 
+
         self.timer_push = self.timer_push+1
+
         #if self.timer_push > 10 :
         # EventMesh.publish("time", self.get_time())
         # EventMesh.publish("battery", self.get_battery())
@@ -609,30 +615,62 @@ class DeviceInfoManager(Abstract):
         
         self.get_hr_state = EventMesh.publish("get_hr_state")
         self.get_spo2_state = EventMesh.publish("get_spo2_state")
-        # print("hr_time:{} get_hr_state:{} get_spo2_state:{}".format(hr_time,self.get_hr_state,self.get_spo2_state))
         
+        hour = 0
+        min = 0
+        hour = date_tmp[3]
+        min = date_tmp[4]
+
+        if hour == 0:#清步数
+            if min <= 1:
+                if self.clear_step == 0:
+                    step = EventMesh.publish("get_old_step_value")
+                    if step > 0:
+                        EventMesh.publish("set_old_step_value",0)
+                        self.gsensor.reset_step()
+                    self.clear_step = 1
+            else:
+                if self.clear_step == 1:
+                    self.clear_step = 0
+        else:
+            if self.clear_step == 1:
+                self.clear_step = 0
+        
+        #电量小于20% 5分钟提醒一次
         battery = EventMesh.publish("screen_get_battery")
         self.bat_time+=10
+        # print("date_tmp:{} self.bat_time:{}".format(date_tmp,self.bat_time))
+
         if self.bat_time > 5*60:
             self.bat_time = 0
             if battery == 20:
-                EventMesh.publish("load_screen", {"screen": "low_power"})
-            
-           
+                EventMesh.publish("load_screen", {"screen": "LOW_POWER"})
+    
+        #消息已满
+        msg_nums = sms.getMsgNums() #获取短信条数
+        self.sms_full_flag+=10
+        if self.sms_full_flag >= 120:
+            self.sms_full_flag=0
+            if msg_nums >= 50:
+                EventMesh.publish("load_screen", {"screen": "message_full"})
+        
+        #print("hr......01....{}\r\n".format(hr_time))
         if hr_time != None:
             # print("hr......01....{}\r\n".format(hr_time))
             if hr_time > 0:
                 # print("get_hr_state:{} get_spo2_state:{} self.old_time:{} hr_time:{}".format(self.get_hr_state,self.get_spo2_state,self.old_time,hr_time))
                 if self.get_hr_state != 1 and self.get_spo2_state != 1:
-                    if self.HR_state == 0:
-                        self.HR_Onestate = 0
-                        self.HR_OneTime = 0
+                    if self.get_hr_state == 0 and self.get_spo2_state == 0:
+                        if self.HR_state == 0 or self.HR_state == 3:
+                            self.HR_Onestate = 0
+                            self.HR_OneTime = 0
                     
-                    if self.old_time != hr_time:
+                    if self.old_time != hr_time:#重复修改测量间隔时间
                         self.SENSOR_time = time_tmp#防止改变时间的时候正在开启测量突然10s就停止测量
                         if self.get_hr_state == 2 and self.HR_state == 1:#自动检测的心率还在测量立马关了测试
                             heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
                             if heart_value > 50 and heart_value != None:
+                                EventMesh.publish("set_old_hr_data",heart_value)
                                 EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)
                             EventMesh.publish(constants.EVENT.STOP_HEART)
                             self.HR_state = 0
@@ -640,21 +678,48 @@ class DeviceInfoManager(Abstract):
                             self.HR_state = 0
                             spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
                             if spo2_value > 85 and spo2_value != None:
+                                EventMesh.publish("set_old_spo2_data",spo2_value)
                                 EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
                             EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
                     self.old_time = hr_time
 
-                    # print("time_tmp :{} self.SENSOR_time :{} time_tmp - self.SENSOR_time:{} self.HR_state:{}".format(time_tmp,self.SENSOR_time,time_tmp - self.SENSOR_time,self.HR_state))
-                    if math.fabs(time_tmp - self.SENSOR_time) >= hr_time and self.HR_state == 0:
+                    if self.HR_state == 3 or self.HR_state == 0:#
+                        if (time_tmp - self.SENSOR_time) >= hr_time:
+                            if self.get_spo2_state == 3 or self.get_hr_state == 3:#单次测量没有完毕优先测量间隔时间测量的
+                                if self.get_hr_state == 3:
+                                    EventMesh.publish(constants.EVENT.STOP_HEART)
+                                    heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
+                                    if heart_value > 50 and heart_value != None:
+                                        EventMesh.publish("set_old_hr_data",heart_value)
+                                        EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)
+                                    
+                                elif self.get_spo2_state == 3:
+                                    EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
+                                    spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
+                                    if spo2_value > 85 and spo2_value != None:
+                                        EventMesh.publish("set_old_spo2_data",spo2_value)
+                                        EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
+
+                                self.HR_state = 0
+                                self.SENSOR_time = time_tmp
+                            self.SENSOR_time = time_tmp
+                            self.HR_state = 0
+                        
+                    #print("time_tmp :{} self.SENSOR_time :{} time_tmp - self.SENSOR_time:{} self.HR_state:{}".format(time_tmp,self.SENSOR_time,time_tmp - self.SENSOR_time,self.HR_state))
+                    if (time_tmp - self.SENSOR_time) == 0 and self.HR_state == 0:
                         print("START_HEART:1")
                         EventMesh.publish("set_hr_state",2)#2代表后台进入测试
                         EventMesh.publish(constants.EVENT.START_HEART)
                         self.HR_state = 1
-                    elif math.fabs(time_tmp - self.SENSOR_time) >= (hr_time+60) and self.HR_state == 1:
+                        self.HR_Onestate = 0
+                        self.HR_OneTime = 0
+                    elif (time_tmp - self.SENSOR_time) >= 60 and self.HR_state == 1:
                         EventMesh.publish("set_hr_state",0)#2代表后台进入测试
                         EventMesh.publish(constants.EVENT.STOP_HEART)
                         heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
+                        print("heart_value:{}".format(heart_value))
                         if heart_value > 50 and heart_value != None:
+                            EventMesh.publish("set_old_hr_data",heart_value)
                             EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据
                         #获取心率数据上传数据app
                         print("STOP_HEART:")
@@ -662,22 +727,22 @@ class DeviceInfoManager(Abstract):
                         EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)#K开血氧
                         print("START_BLOOD_OXYGEN:")
                         self.HR_state = 2
-                    elif math.fabs(time_tmp - self.SENSOR_time) >= (hr_time+120) and self.HR_state == 2:
+                    elif (time_tmp - self.SENSOR_time) >= 120 and self.HR_state == 2:
                         print("STOP_BLOOD_OXYGEN:")
                         EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试
                         EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#停止血氧测试
                         spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
                         print("spo2_value:{}".format(spo2_value))
                         if spo2_value > 85 and spo2_value != None:
+                            EventMesh.publish("set_old_spo2_data",spo2_value)
                             EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
-                        self.HR_state = 0
-                        self.SENSOR_time = time_tmp
+                        self.HR_state = 3
+                    
                 else:
-                    # print("endtime.........\r\n")
                     self.SENSOR_time = time_tmp
                     self.HR_state = 0
                     self.old_time = 0 
-                if self.HR_state == 0:#只有不在测量的时候才测单次的
+                if self.HR_state == 3 or self.HR_state == 0:#只有不在测量的时候才测单次的
                     if self.get_spo2_state == 3 or self.get_hr_state == 3:#单次测量
                         self.HR_state = 0
                         self.HR_OneTime+=1
@@ -705,18 +770,19 @@ class DeviceInfoManager(Abstract):
                                 heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
                                 if heart_value > 50 and heart_value != None:
                                     EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据
-                                    print("STOP_HEART.01:")
+                                    EventMesh.publish("set_old_hr_data",heart_value)
+                           
                                 if self.Spo2_Need_Open == 0 and self.get_spo2_state == 3:
                                     EventMesh.publish("set_spo2_state",3)#2代表后台进入血氧测试
                                     EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)#K开血氧
-                                    print("START_BLOOD_OXYGEN 02")
+                                    
                                     self.HR_Onestate = 2
                                     self.set_hsenor_crt = 2#血氧关闭
                                 else:
                                     self.HR_Onestate = 0
                                     self.HR_OneTime = 0
                                     self.set_hsenor_crt = 0#
-                                    print("START_end......")
+                                 
                                     EventMesh.publish("set_hr_state",0)#2代表后台进入血氧测试
                                     EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试
                             else:
@@ -724,9 +790,10 @@ class DeviceInfoManager(Abstract):
                                     EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试
                                     EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#K开血氧
                                     spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
-                                    print("spo2_value:{}.......01..".format(spo2_value))
+                                 
                                     if spo2_value > 85 and spo2_value != None:
                                         EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
+                                        EventMesh.publish("set_old_spo2_data",spo2_value)
                                     if self.Hr_Need_Open == 0 and self.get_hr_state == 3:
                                         EventMesh.publish("set_hr_state",3)#2代表后台进入测试
                                         EventMesh.publish(constants.EVENT.START_HEART)
@@ -736,7 +803,7 @@ class DeviceInfoManager(Abstract):
                                         self.HR_Onestate = 0
                                         self.HR_OneTime = 0
                                         self.set_hsenor_crt = 2#血氧关闭
-                                    print("STOP_BLOOD_OXYGEN:....09.....")
+                                    
                                     
                         elif self.HR_OneTime > 6+6 and self.HR_Onestate == 2:
                             print("HR_OneTime:....05")
@@ -744,16 +811,16 @@ class DeviceInfoManager(Abstract):
                                 EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试
                                 EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#停止血氧测试
                                 spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
-                                print("spo2_value:{}......08.....".format(spo2_value))
                                 if spo2_value > 85 and spo2_value != None:
                                     EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
+                                    EventMesh.publish("set_old_spo2_data",spo2_value)
                             elif self.set_hsenor_crt == 1:
                                 EventMesh.publish("set_hr_state",0)#0代表g关闭测试
                                 EventMesh.publish(constants.EVENT.STOP_HEART)
                                 heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
                                 if heart_value > 50 and heart_value != None:
+                                    EventMesh.publish("set_old_hr_data",heart_value)
                                     EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据
-                                    print("STOP_HEART.03:")
                             self.HR_Onestate = 0
                     else:
                         self.HR_Onestate = 0
@@ -764,12 +831,11 @@ class DeviceInfoManager(Abstract):
                 self.SENSOR_time = time_tmp#进入最后一次的时间戳
                 self.old_time = 0
 
-                if self.get_hr_state != 1 and self.get_spo2_state != 1:
+                if self.get_hr_state != 1 and self.get_spo2_state != 1:#没有设置间隔时间单次测量
                     if self.get_spo2_state == 3 or self.get_hr_state == 3:#单次测量
                         self.HR_state = 0
                         self.HR_OneTime+=1
                         if self.HR_OneTime == 1 and self.HR_Onestate == 0:
-                            print("hr.......01...\r\n")
                             if self.get_hr_state == 3:
                                 self.Hr_Need_Open = 1
                                 EventMesh.publish("set_hr_state",3)#2代表后台进入测试
@@ -784,26 +850,25 @@ class DeviceInfoManager(Abstract):
                             else:
                                 self.Spo2_Need_Open = 0
                             self.HR_Onestate = 1
-                            print("self.HR_Onestate....3")
+                      
                         elif self.HR_OneTime > 6 and self.HR_Onestate == 1:
-                            print("self.HR_Onestate...4..")
+                            print("stop_heart Onec ")
                             if self.Hr_Need_Open == 1:#需要关闭心率测量
                                 EventMesh.publish(constants.EVENT.STOP_HEART)
                                 heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
+                                print("stop_heart heart_value:{}".format(heart_value))
                                 if heart_value > 50 and heart_value != None:
+                                    EventMesh.publish("set_old_hr_data",heart_value)
                                     EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据
-                                    print("STOP_HEART.06:")
                                 if self.Spo2_Need_Open == 0 and self.get_spo2_state == 3:
                                     EventMesh.publish("set_spo2_state",3)#2代表后台进入血氧测试
                                     EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)#K开血氧
-                                    print("START_BLOOD_OXYGEN 06")
                                     self.HR_Onestate = 2
                                     self.set_hsenor_crt = 2#血氧关闭
                                 else:
                                     self.HR_Onestate = 0
                                     self.HR_OneTime = 0
                                     self.set_hsenor_crt = 0#
-                                    print("START_end....06..")
                                     EventMesh.publish("set_hr_state",0)#2代表后台进入血氧测试
                                     EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试
                             else:
@@ -813,6 +878,7 @@ class DeviceInfoManager(Abstract):
                                     spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
                                     print("spo2_value:{}.......01..".format(spo2_value))
                                     if spo2_value > 85 and spo2_value != None:
+                                        EventMesh.publish("set_old_spo2_data",spo2_value)
                                         EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
                                     if self.Hr_Need_Open == 0 and self.get_hr_state == 3:
                                         EventMesh.publish("set_hr_state",3)#2代表后台进入测试
@@ -826,21 +892,20 @@ class DeviceInfoManager(Abstract):
                                     print("STOP_BLOOD_OXYGEN:....06.....")
                                     
                         elif self.HR_OneTime > 6+6 and self.HR_Onestate == 2:
-                            print("HR_OneTime:....06")
                             if self.set_hsenor_crt == 2:
                                 EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试
                                 EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#停止血氧测试
                                 spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
-                                print("spo2_value:{}......06.....".format(spo2_value))
                                 if spo2_value > 85 and spo2_value != None:
+                                    EventMesh.publish("set_old_spo2_data",spo2_value)
                                     EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
                             elif self.set_hsenor_crt == 1:
                                 EventMesh.publish("set_hr_state",0)#0代表g关闭测试
                                 EventMesh.publish(constants.EVENT.STOP_HEART)
                                 heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
                                 if heart_value > 50 and heart_value != None:
+                                    EventMesh.publish("set_old_hr_data",heart_value)
                                     EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据
-                                    print("STOP_HEART.06:")
                             self.HR_Onestate = 0
                     else:
                         self.HR_Onestate = 0
@@ -1158,7 +1223,7 @@ class SockManager(Abstract):
         self.connect()
 
     def send(self, topic, msg):
-        # print("send msg:{}".format(msg))
+        print("TCP:send data:{}".format(msg))
         self.sock.send(msg)
 
     def recv(self):
@@ -1182,7 +1247,7 @@ class SockManager(Abstract):
             if data[-1] != 0x5d and len(data)<10*1024: #']':
                 continue
             self.connect_tmp = 1 #有数据,就认为是连接状态
-            print("TCP:recv:len:{} type:{}".format(len(data),type(data)))
+            print("TCP:recv: data:{}".format(data))
             EventMesh.publish(constants.EVENT.SET_CONNECT, 1)
             data_str = data.decode('ascii')
             data_str = data_str.split(']')
@@ -1532,11 +1597,38 @@ class PhoneCallingManager(Abstract):
     def get_phonenum(self, event, msg):
         return self.phonenum
 
-#获取心率 血氧历史数据
-class getOldHrDataManager(Abstract):
+#获取心率 血氧 步数历史数据
+class gethistoryDataManager(Abstract):
     def __init__(self):
         self.oldHr = 0
         self.oldspo2 = 0
+        self.oldstep = 0
+        self.old_step = 0
+        self.read_data = {}
+        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
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("set_old_hr_data", self.save_hr_value)
@@ -1544,18 +1636,46 @@ class getOldHrDataManager(Abstract):
         EventMesh.subscribe("set_old_spo2_data", self.save_spo2_value)
         EventMesh.subscribe("get_old_spo2_data", self.get_spo2_value)
 
+        EventMesh.subscribe("get_old_step_value", self.get_old_step_value)
+        EventMesh.subscribe("set_old_step_value", self.set_old_step_value)
+
     def save_hr_value(self, event, msg): 
-        self.oldHr = msg
+        if msg >= 50:
+            self.read_data = EventMesh.publish("get_storage_data")
+            self.read_data["old_hr"] = msg
+
+            EventMesh.publish("set_storage_data", self.read_data)
+            with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+                ujson.dump(self.read_data,fd)
+            self.oldHr = msg
 
     def get_hr_value(self, event, msg): 
         return self.oldHr
 
     def save_spo2_value(self, event, msg): 
-        self.oldspo2 = msg
+        if msg >= 85:
+            self.read_data = EventMesh.publish("get_storage_data")
+            self.read_data["old_spo2"] = msg
+
+            EventMesh.publish("set_storage_data", self.read_data)
+            with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+                ujson.dump(self.read_data,fd)
+            self.oldspo2 = msg
 
     def get_spo2_value(self, event, msg): 
         return self.oldspo2
     
+    def set_old_step_value(self, event, msg): 
+        self.oldstep = msg
+        
+        
+    def get_old_step_value(self, event, msg): 
+        step = EventMesh.publish(constants.EVENT.GET_STEP)
+        self.old_step = self.oldstep + step[0]
+        return self.old_step
+    
+    
+    
 
 class getWeatherDataManager(Abstract):
     # 获取天气数据
@@ -1632,7 +1752,7 @@ class getHrTimeManager(Abstract):
         
 class getBrightnessManager(Abstract):#获取亮度级别
     def __init__(self):
-        self.level = 5#默认值5
+        self.level = 6#默认值6
         self.read_data = {}
         self.PWM_backlight  = None
         check = ql_fs.path_exists("/ext/static/storage_file/config.json")
@@ -1658,7 +1778,7 @@ class getBrightnessManager(Abstract):#获取亮度级别
 
     def add(self, event, msg):
         if self.level < 10:
-            self.level = self.level + 1
+            self.level = self.level + 2
         self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, self.level, 10)
         self.PWM_backlight.open()
         
@@ -1671,7 +1791,7 @@ class getBrightnessManager(Abstract):#获取亮度级别
 
     def reduce(self, event, msg):
         if self.level > 0:
-            self.level = self.level - 1
+            self.level = self.level - 2
         if self.level <= 0:
             self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, 1, 10)
         else:
@@ -1730,3 +1850,4 @@ class getVolumSizeManager(Abstract):#设置或获取音量大小数据
     def get_volum_size(self, event, msg): 
         return self.volume_size
 
+
index b0a4694..0cc0125 100644 (file)
@@ -206,7 +206,8 @@ class Screen(Abstract):
         pass
 
 PHONE_CALL_MAX_DATA = 22
-line_points = [{"x":0,"y":0},{"x":0,"y":35}]
+
+phone_line_points = [{"x":0,"y":0},{"x":0,"y":40}]
 phone_screen = None
 phone_line = None
 phone_label = None
@@ -254,15 +255,15 @@ class PhoneScreen(Screen):
             phone_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
 
             phone_line = lv.line(phone_screen)
-            phone_line.set_points(line_points,2)
-            phone_line.set_pos(235,58)
-            phone_line.set_size(2,35)
+            phone_line.set_points(phone_line_points,2)
+            phone_line.set_pos(235,8)
+            phone_line.set_size(2,40)
             phone_line.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
             phone_line.add_style(style_line,0)
 
             phone_label = lv.label(phone_screen)
-            phone_label.set_pos(0, 45)
-            phone_label.set_size(0, 55)
+            phone_label.set_pos(0, 14)
+            phone_label.set_size(0, 48)
             phone_label.set_text(" ")
             phone_label.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
             phone_label.set_long_mode(lv.label.LONG.CLIP)
@@ -272,91 +273,92 @@ class PhoneScreen(Screen):
             phone_one.set_src("E:/static/IMAGE_NUMBER_KEY1_ICON.png")
             phone_one.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_one.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_one.set_pos(3, 100)
+            phone_one.set_pos(3, 60)
+            phone_one.set_size(76, 50)
 
             phone_two = lv.img(phone_screen)
-            phone_two.set_size(76, 40)
+            phone_two.set_size(76, 50)
             phone_two.set_src("E:/static/IMAGE_NUMBER_KEY2_ICON.png")
             phone_two.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_two.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_two.set_pos(82, 100)
+            phone_two.set_pos(82, 60)
 
             phone_three = lv.img(phone_screen)
-            phone_three.set_size(76, 40)
+            phone_three.set_size(76, 50)
             phone_three.set_src("E:/static/IMAGE_NUMBER_KEY3_ICON.png")
             phone_three.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_three.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_three.set_pos(161, 100)
+            phone_three.set_pos(161, 60)
 
             phone_four = lv.img(phone_screen)
-            phone_four.set_size(76, 40)
+            phone_four.set_size(76, 50)
             phone_four.set_src("E:/static/IMAGE_NUMBER_KEY4_ICON.png")
             phone_four.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_four.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_four.set_pos(3, 142)
+            phone_four.set_pos(3, 112)
 
             phone_five = lv.img(phone_screen)
-            phone_five.set_size(76, 40)
+            phone_five.set_size(76, 50)
             phone_five.set_src("E:/static/IMAGE_NUMBER_KEY5_ICON.png")
             phone_five.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_five.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_five.set_pos(82, 142)
+            phone_five.set_pos(82, 112)
 
             phone_six = lv.img(phone_screen)
-            phone_six.set_size(76, 40)
+            phone_six.set_size(76, 50)
             phone_six.set_src("E:/static/IMAGE_NUMBER_KEY6_ICON.png")
             phone_six.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_six.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_six.set_pos(161, 142)
+            phone_six.set_pos(161, 112)
 
             phone_seven = lv.img(phone_screen)
-            phone_seven.set_size(76, 40)
+            phone_seven.set_size(76, 50)
             phone_seven.set_src("E:/static/IMAGE_NUMBER_KEY7_ICON.png")
             phone_seven.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_seven.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_seven.set_pos(3, 184)
+            phone_seven.set_pos(3, 164)
 
             phone_eight = lv.img(phone_screen)
-            phone_eight.set_size(76, 40)
+            phone_eight.set_size(76, 50)
             phone_eight.set_src("E:/static/IMAGE_NUMBER_KEY8_ICON.png")
             phone_eight.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_eight.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_eight.set_pos(82, 184)
+            phone_eight.set_pos(82, 164)
 
             phone_nine = lv.img(phone_screen)
-            phone_nine.set_size(76, 40)
+            phone_nine.set_size(76, 50)
             phone_nine.set_src("E:/static/IMAGE_NUMBER_KEY9_ICON.png")
             phone_nine.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_nine.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_nine.set_pos(161, 184)
+            phone_nine.set_pos(161, 164)
 
             phone_start = lv.img(phone_screen)
-            phone_start.set_size(76, 40)
+            phone_start.set_size(76, 50)
             phone_start.set_src("E:/static/IMAGE_NUMBER_KEYSTAR_ICON.png")
             phone_start.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_start.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_start.set_pos(3, 226)
+            phone_start.set_pos(3, 216)
 
             phone_zero = lv.img(phone_screen)
-            phone_zero.set_size(76, 40)
+            phone_zero.set_size(76, 50)
             phone_zero.set_src("E:/static/IMAGE_NUMBER_KEY0_ICON.png")
             phone_zero.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_zero.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_zero.set_pos(82, 226)
+            phone_zero.set_pos(82, 216)
 
             phone_hash = lv.img(phone_screen)
-            phone_hash.set_size(76, 40)
+            phone_hash.set_size(76, 50)
             phone_hash.set_src("E:/static/IMAGE_NUMBER_KEYHASH_ICON.png")
             phone_hash.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_hash.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_hash.set_pos(161, 226)
+            phone_hash.set_pos(161, 216)
 
             phone_call = lv.img(phone_screen)
-            phone_call.set_size(76, 40)
+            phone_call.set_size(76, 50)
             phone_call.set_src("E:/static/IMAGE_BUTTON_DIAL.png")
             phone_call.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_call.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_call.set_pos(3, 268)
+            phone_call.set_pos(3, 270)
 
             phone_call_btn = lv.img(phone_screen)
             phone_call_btn.set_size(76, 52)
@@ -364,11 +366,11 @@ class PhoneScreen(Screen):
             phone_call_btn.set_pos(3, 268)
 
             phone_contact = lv.img(phone_screen)
-            phone_contact.set_size(64, 40)
+            phone_contact.set_size(64, 50)
             phone_contact.set_src("E:/static/IMAGE_BUTTON_DIAL_CONTACT.png")
             phone_contact.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_contact.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_contact.set_pos(87, 268)
+            phone_contact.set_pos(87, 270)
 
             phone_contact_btn = lv.img(phone_screen)
             phone_contact_btn.set_size(76, 52)
@@ -376,11 +378,11 @@ class PhoneScreen(Screen):
             phone_contact_btn.set_pos(87, 268)
 
             phone_delete = lv.img(phone_screen)
-            phone_delete.set_size(76, 40)
+            phone_delete.set_size(76, 50)
             phone_delete.set_src("E:/static/IMAGE_BUTTON_DELKEY.png")
             phone_delete.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_delete.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_delete.set_pos(161, 268)
+            phone_delete.set_pos(161, 270)
 
             phone_delete_btn = lv.img(phone_screen)
             phone_delete_btn.set_size(76, 52)
@@ -592,8 +594,8 @@ class PhoneScreen(Screen):
         len_t = len(self.phone_list)*40
         if len_t > 230:
             len_t = 230
-        phone_label.set_size(len_t,45)
-        phone_label.set_pos(230-len_t,60)
+        phone_label.set_size(len_t,48)
+        phone_label.set_pos(230-len_t,14)
         phone_label.set_text(self.phone_num)
 
     def done_return(self):
@@ -1141,7 +1143,7 @@ class PopupScreen(Screen):
             msg_list_t_done_img = lv.img(msg_list_t)
             msg_list_t_done_img.set_pos(53, 20)
             msg_list_t_done_img.set_size(134, 117)
-            msg_list_t_done_img.set_src("E:/static/IMAGE_NOTICE_NONE.jpg")
+            msg_list_t_done_img.set_src("E:/static/IMAGE_NOTICE_NONE.png")
             msg_list_t_done_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
 
             no_msg_text = lv.label(msg_list_t)
@@ -2009,56 +2011,57 @@ class WeatherScreen(Screen):
             weather_detail_label,weather_location_label,no_connect_label ,no_connect_label1 
         connect = EventMesh.publish(constants.EVENT.GET_CONNECT) #获取网络状态
         self.weather_data = EventMesh.publish("get_weather_data")
-        if connect != 0:
-            no_data = self.weather_data[8]
-            if no_data != 0:
-                no_weather_img.add_flag(lv.obj.FLAG.HIDDEN)
-                weather_img.clear_flag(lv.obj.FLAG.HIDDEN)
-                no_connect_label.set_text(" ")
-                no_connect_label1.set_text(" ")
-                # print("self.weather_data:{}".format(self.weather_data))
-                type = self.weather_data[3]
-                if type == None:
-                    weather_img.set_src("E:/static/update.png")#天气类型
-                else:
-                    weather_img.set_src("E:/static/{}_weather.png".format(type))#天气类型
+        if weather_screen != None:
+            if connect != 0 and self.weather_data != None:
+                no_data = self.weather_data[8]
+                if no_data != 0 :
+                    no_weather_img.add_flag(lv.obj.FLAG.HIDDEN)
+                    weather_img.clear_flag(lv.obj.FLAG.HIDDEN)
+                    no_connect_label.set_text(" ")
+                    no_connect_label1.set_text(" ")
+                    # print("self.weather_data:{}".format(self.weather_data))
+                    type = self.weather_data[3]
+                    if type == None:
+                        weather_img.set_src("E:/static/update.png")#天气类型
+                    else:
+                        weather_img.set_src("E:/static/{}_weather.png".format(type))#天气类型
 
-                temp = self.weather_data[4]
-                if temp == None:
-                    weather_tem_label.set_text("_ _")
-                else:
-                    weather_tem_label.set_text("{}".format(temp))
+                    temp = self.weather_data[4]
+                    if temp == None:
+                        weather_tem_label.set_text("_ _")
+                    else:
+                        weather_tem_label.set_text("{}".format(temp))
 
-                date = self.weather_data[0]
-                if date != '{}':
-                    date_month = date.split('-')[1]
-                    date_day = date.split('-')[2]
-                    weather_detail_label.set_text("{}/{}".format(date_month,date_day))#天气更新时间
-                else:
+                    date = self.weather_data[0]
+                    if date != '{}':
+                        date_month = date.split('-')[1]
+                        date_day = date.split('-')[2]
+                        weather_detail_label.set_text("{}/{}".format(date_month,date_day))#天气更新时间
+                    else:
+                        weather_detail_label.set_text("-/-")
+
+                    city = self.weather_data[7]
+                    if city != '{}':
+                        weather_location_label.set_text("{}".format(city))#城市
+                    else:
+                        weather_location_label.set_text("--")
+                else:#已联网未获取到天气数据
+                    weather_location_label.set_text(" ")
                     weather_detail_label.set_text("-/-")
+                    weather_tem_label.set_text("_ _")
 
-                city = self.weather_data[7]
-                if city != '{}':
-                    weather_location_label.set_text("{}".format(city))#城市
-                else:
-                    weather_location_label.set_text("--")
-            else:#已联网未获取到天气数据
+                    no_connect_label.set_text("未获取网络数据")
+                    no_connect_label1.set_text("请稍候重试")
+
+            else:
                 weather_location_label.set_text(" ")
                 weather_detail_label.set_text("-/-")
                 weather_tem_label.set_text("_ _")
-
-                no_connect_label.set_text("未获取网络数据")
-                no_connect_label1.set_text("请稍候重试")
-
-        else:
-            weather_location_label.set_text(" ")
-            weather_detail_label.set_text("-/-")
-            weather_tem_label.set_text("_ _")
-            
-            no_weather_img.clear_flag(lv.obj.FLAG.HIDDEN)
-            weather_img.add_flag(lv.obj.FLAG.HIDDEN)
-            no_connect_label.set_text("找不到服务器")
-            no_connect_label1.set_text("请联网后重试")
+                
+                no_weather_img.clear_flag(lv.obj.FLAG.HIDDEN)
+                weather_img.add_flag(lv.obj.FLAG.HIDDEN)
+                no_connect_label.set_text("找不到服务器")
+                no_connect_label1.set_text("请联网后重试")
 
     def done_return(self):
         EventMesh.publish("load_screen", {"screen": "toolbox"})
index 1cb64da..a09b73c 100644 (file)
@@ -11,11 +11,21 @@ import ujson
 from ui_main_menu import MainMenu2_Watchface
 
 
-style_font_youyuan_20 = lv.style_t()
-style_font_youyuan_20.init()
-style_font_youyuan_20.set_text_color(lv.color_make(0xff, 0xff, 0xff))
-style_font_youyuan_20.set_text_font_v2("font_22.bin",22,0)
+# style_font_youyuan_20 = lv.style_t()
+# style_font_youyuan_20.init()
+# style_font_youyuan_20.set_text_color(lv.color_make(0xff, 0xff, 0xff))
+# style_font_youyuan_20.set_text_font_v2("font_22.bin",22,0)
 
+watchface_style_default = lv.style_t()
+watchface_style_default.init()
+watchface_style_default.set_text_color(lv.color_make(0xff, 0xff, 0xff))
+watchface_style_default.set_text_font_v2("font_22.bin",22,0)
+
+
+style_font_youyuan_28 = lv.style_t()
+style_font_youyuan_28.init()
+style_font_youyuan_28.set_text_color(lv.color_make(0xFF, 0xFF, 0xFF))
+style_font_youyuan_28.set_text_font(lv.font_28_dial)
 
 Watchface = lv.obj()
 
@@ -80,7 +90,7 @@ style_font_youyuan_70_black.set_text_color(lv.color_make(0x32, 0xc8, 0xdb))
 style_font_youyuan_70_black.set_text_font(lv.font_70_bold)
 
 watchface1_time1_text = lv.label(Watchface1)
-watchface1_time1_text.set_pos(20, 60)
+watchface1_time1_text.set_pos(20, 50)
 watchface1_time1_text.set_size(190, 71)
 watchface1_time1_text.set_align(lv.TEXT_ALIGN.LEFT)
 watchface1_time1_text.set_text("12:00")
@@ -88,27 +98,27 @@ watchface1_time1_text.add_style(style_font_youyuan_70_black, lv.PART.MAIN|lv.STA
 
 #日期
 watchface1_date_span = lv.label(Watchface1)
-watchface1_date_span.set_pos(24, 131)
-watchface1_date_span.set_size(84, 30)
+watchface1_date_span.set_pos(24, 118)
+watchface1_date_span.set_size(140, 30)
 watchface1_date_span.set_align(lv.TEXT_ALIGN.LEFT)
 watchface1_date_span.set_text("12月9日")
-watchface1_date_span.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface1_date_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 #星期
 watchface1_week_span = lv.label(Watchface1)
-watchface1_week_span.set_pos(24, 163)
-watchface1_week_span.set_size(70, 30)
+watchface1_week_span.set_pos(24, 153)
+watchface1_week_span.set_size(100, 30)
 watchface1_week_span.set_align(lv.TEXT_ALIGN.LEFT)
 watchface1_week_span.set_text("星期四")
-watchface1_week_span.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface1_week_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 
 
 watchface1_step_span = lv.label(Watchface1)
-watchface1_step_span.set_pos(170, 163)
-watchface1_step_span.set_size(70, 30)
+watchface1_step_span.set_pos(158, 154)
+watchface1_step_span.set_size(78, 30)
 watchface1_step_span.set_align(lv.TEXT_ALIGN.LEFT)
 watchface1_step_span.set_text("0")
-watchface1_step_span.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface1_step_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 
 
@@ -117,7 +127,7 @@ watchface1_HB_span.set_pos(55, 235)
 watchface1_HB_span.set_size(80, 30)
 watchface1_HB_span.set_align(lv.TEXT_ALIGN.LEFT)
 watchface1_HB_span.set_text("0")
-watchface1_HB_span.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface1_HB_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 
 
@@ -126,7 +136,7 @@ watchface1_SPO2_span.set_pos(160, 235)
 watchface1_SPO2_span.set_size(80, 30)
 watchface1_SPO2_span.set_align(lv.TEXT_ALIGN.LEFT)
 watchface1_SPO2_span.set_text("0")
-watchface1_SPO2_span.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface1_SPO2_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 
 class WatchFace1():
@@ -160,9 +170,10 @@ class WatchFace1():
         if spo2Value :
             self.__oldSpo2Value(None, spo2Value)
         # print("main get_step msg:{}".format(msg))
-        step = EventMesh.publish(constants.EVENT.GET_STEP)
-        if step :
-            self.__stepValue(None, step[0])
+
+        # step = EventMesh.publish(constants.EVENT.GET_STEP)
+        step = EventMesh.publish("get_old_step_value")
+        self.__stepValue(None, step)
 
         
     def timerout_update(self):
@@ -188,9 +199,9 @@ class WatchFace1():
         if spo2Value :
             self.__oldSpo2Value(None, spo2Value)
         # print("main get_step msg:{}".format(msg))
-        step = EventMesh.publish(constants.EVENT.GET_STEP)
-        if step :
-            self.__stepValue(None, step[0])
+        # step = EventMesh.publish(constants.EVENT.GET_STEP)
+        step = EventMesh.publish("get_old_step_value")
+        self.__stepValue(None, step)
 
     def __time(self, event, msg):
         #时间
@@ -227,7 +238,10 @@ class WatchFace1():
         watchface1_SPO2_span.set_text(str(msg))
 
     def __stepValue(self, event, msg):
-        watchface1_step_span.set_text(str(msg))
+        if msg == None:    
+            watchface1_step_span.set_text("0")
+        else:
+            watchface1_step_span.set_text(str(msg))
 
     def Close(self):
         pass
@@ -294,69 +308,49 @@ style_font_youyuan_70_red.set_text_font(lv.font_70_bold)
 x = 30
 y = 80
 watchface2_time1_hour1_text = lv.label(Watchface2)
-watchface2_time1_hour1_text.set_pos(40, 80)
+watchface2_time1_hour1_text.set_pos(10, 80)
 watchface2_time1_hour1_text.set_size(50, 70)
 watchface2_time1_hour1_text.set_align(lv.TEXT_ALIGN.LEFT)
 watchface2_time1_hour1_text.set_text("1")
 watchface2_time1_hour1_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 watchface2_time1_hour2_text = lv.label(Watchface2)
-watchface2_time1_hour2_text.set_pos(90, 80)
+watchface2_time1_hour2_text.set_pos(55, 80)
 watchface2_time1_hour2_text.set_size(50, 70)
 watchface2_time1_hour2_text.set_align(lv.TEXT_ALIGN.LEFT)
 watchface2_time1_hour2_text.set_text("2")
 watchface2_time1_hour2_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 watchface2_time2_min1_text = lv.label(Watchface2)
-watchface2_time2_min1_text.set_pos(40, 156)
+watchface2_time2_min1_text.set_pos(10, 156)
 watchface2_time2_min1_text.set_size(50, 70)
 watchface2_time2_min1_text.set_align(lv.TEXT_ALIGN.LEFT)
 watchface2_time2_min1_text.set_text("0")
 watchface2_time2_min1_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 watchface2_time2_min2_text = lv.label(Watchface2)
-watchface2_time2_min2_text.set_pos(90, 156)
+watchface2_time2_min2_text.set_pos(55, 156)
 watchface2_time2_min2_text.set_size(50, 70)
 watchface2_time2_min2_text.set_align(lv.TEXT_ALIGN.LEFT)
 watchface2_time2_min2_text.set_text("0")
 watchface2_time2_min2_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT)
 
-# create style watchface2_style_default
-# watchface2_style_default = lv.style_t()
-# watchface2_style_default.init()
-# watchface2_style_default.set_radius(0)
-# watchface2_style_default.set_bg_color(lv.color_make(0x21,0x95,0xf6))
-# watchface2_style_default.set_bg_grad_color(lv.color_make(0x21,0x95,0xf6))
-# watchface2_style_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
-# watchface2_style_default.set_bg_opa(0)
-# watchface2_style_default.set_border_color(lv.color_make(0x00,0x00,0x00))
-# watchface2_style_default.set_border_width(0)
-# watchface2_style_default.set_border_opa(255)
-# watchface2_style_default.set_pad_left(0)
-# watchface2_style_default.set_pad_right(0)
-# watchface2_style_default.set_pad_top(0)
-# watchface2_style_default.set_pad_bottom(0)
-# watchface2_style_default.set_text_font_v2("font_22.bin",22,0) #将外部字体库与该style对象绑定
-
-watchface2_style_default = lv.style_t()
-watchface2_style_default.init()
-watchface2_style_default.set_text_color(lv.color_make(0xff, 0xff, 0xff))
-watchface2_style_default.set_text_font_v2("font_22.bin",22,0)
+
 
 
 #日期
 watchface2_date_span = lv.label(Watchface2)
-watchface2_date_span.set_pos(30+56+20+56, 100)
-watchface2_date_span.set_size(84, 35)
+watchface2_date_span.set_pos(30+56+20+6, 90)
+watchface2_date_span.set_size(240-(30+56+20+6), 35)
 watchface2_date_span.set_align(lv.TEXT_ALIGN.LEFT)
 watchface2_date_span.set_text("12月9日")
-watchface2_date_span.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface2_date_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 #星期
 
 
 watchface2_week = lv.img(Watchface2)
-watchface2_week.set_pos(int(30+15),int(y+20+56+56+30))
+watchface2_week.set_pos(int(30+56+20+25),int(y+56+30))
 watchface2_week.set_size(90,30)
 watchface2_week.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
 watchface2_week.set_src("E:/static/watch_plate/style_2/week/0_week.png")
@@ -364,34 +358,19 @@ watchface2_week.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEF
 
 
 
-#天气
-watchface2_temp_img = lv.img(Watchface2)
-watchface2_temp_img.set_pos(int(x+56+56+20),int(y+56+20))
-watchface2_temp_img.set_size(65,45)
-watchface2_temp_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface2_temp_img.set_src("E:/static/watch_plate/style_2/0_main2_weather.png")
-watchface2_temp_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface2_temp_degree = lv.img(Watchface2)
-watchface2_temp_degree.set_pos(int(x+56+56+65),int(215))
-watchface2_temp_degree.set_size(10,10)
-watchface2_temp_degree.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface2_temp_degree.set_src("E:/static/watch_plate/style_2/degree.png")
-watchface2_temp_degree.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface2_temp_txt = lv.label(Watchface2)
-watchface2_temp_txt.set_pos(int(x+56+56+39),int(215))
-watchface2_temp_txt.set_size(240-(x+56+56+34),30)
-watchface2_temp_txt.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_temp_txt.set_text("00")
-watchface2_temp_txt.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface2_no_temp_txt = lv.label(Watchface2)
-watchface2_no_temp_txt.set_pos(30+56+56+20, 176)
-watchface2_no_temp_txt.set_size(80, 35)
-watchface2_no_temp_txt.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_no_temp_txt.set_text("无数据")
-watchface2_no_temp_txt.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface2_step_img = lv.img(Watchface2)
+watchface2_step_img.set_pos(int(95),int(260))
+watchface2_step_img.set_size(26,21)
+watchface2_step_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+watchface2_step_img.set_src("E:/static/watch_plate/style_2/step.png")
+watchface2_step_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+watchface2_step_txt = lv.label(Watchface2)
+watchface2_step_txt.set_pos(125, 260)
+watchface2_step_txt.set_size(80, 35)
+watchface2_step_txt.set_align(lv.TEXT_ALIGN.LEFT)
+watchface2_step_txt.set_text("0")
+watchface2_step_txt.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 class WatchFace2():
     NAME = "Watchface2"
@@ -417,28 +396,8 @@ class WatchFace2():
         if time:
             self.__time(None, time)
 
-        connect = EventMesh.publish(constants.EVENT.GET_CONNECT) #获取网络状态
-        self.weather_data = EventMesh.publish("get_weather_data")
-        if connect == 1  and self.weather_data != None:
-            no_data = self.weather_data[8]
-            if no_data != 0:
-                type = self.weather_data[3]
-                if type == None:
-                    self.__weather_type(None,None)
-                else:
-                    self.__weather_type(None,type)
-
-                temp = self.weather_data[4]
-                if temp == None:
-                    self.__weather_value(None,None)
-                else:
-                   self.__weather_value(None,temp)
-            else:
-                self.__weather_type(None,None)
-                self.__weather_value(None,None)
-        else:
-            self.__weather_type(None,None)
-            self.__weather_value(None,None)
+        step = EventMesh.publish("get_old_step_value")
+        self.__stepValue(None, step)
 
 
     def timerout_update(self):
@@ -455,29 +414,9 @@ class WatchFace2():
         #print("publish_time:"+time)
         if time:
             self.__time(None, time)
-
-        connect = EventMesh.publish(constants.EVENT.GET_CONNECT) #获取网络状态
-        self.weather_data = EventMesh.publish("get_weather_data")
-        if connect != 0:
-            no_data = self.weather_data[8]
-            if no_data != 0:
-                type = self.weather_data[3]
-                if type == None:
-                    self.__weather_type(None,None)
-                else:
-                    self.__weather_type(None,type)
-
-                temp = self.weather_data[4]
-                if temp == None:
-                    self.__weather_value(None,None)
-                else:
-                   self.__weather_value(None,temp)
-            else:
-                self.__weather_type(None,None)
-                self.__weather_value(None,None)
-        else:
-            self.__weather_type(None,None)
-            self.__weather_value(None,None)
+        
+        step = EventMesh.publish("get_old_step_value")
+        self.__stepValue(None, step)
 
     def __time(self, event, msg):
         #时间
@@ -513,27 +452,33 @@ class WatchFace2():
 
         watchface2_res_stat_battery_img.set_src("E:/static/vbat_%d.png"%(msg[1]))#"E:/vbat_60.png"
         pass
-
-    def __weather_type(self, event, msg):
-        if msg == None:
-            watchface2_temp_img.add_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_no_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
+    def __stepValue(self, event, msg):
+        if msg == None:    
+            watchface2_step_txt.set_text("0")
         else:
-            type = int(msg)
-            watchface2_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_temp_img.clear_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_temp_img.set_src("E:/static/watch_plate/style_2/%d_main2_weather.png"%(type))
+            watchface2_step_txt.set_text(str(msg))
+
+
+    # def __weather_type(self, event, msg):
+    #     if msg == None:
+    #         watchface2_temp_img.add_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_no_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
+    #     else:
+    #         type = int(msg)
+    #         watchface2_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_temp_img.clear_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_temp_img.set_src("E:/static/watch_plate/style_2/%d_main2_weather.png"%(type))
     
-    def __weather_value(self, event, msg):
-        if msg == None:
-            watchface2_temp_degree.add_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_no_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
-        else:
-            watchface2_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_temp_degree.clear_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_temp_txt.set_text(str(msg))
+    # def __weather_value(self, event, msg):
+    #     if msg == None:
+    #         watchface2_temp_degree.add_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_no_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
+    #     else:
+    #         watchface2_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_temp_degree.clear_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_temp_txt.set_text(str(msg))
 
     def Close(self):
         pass  
index 4befb4a..23952b4 100644 (file)
@@ -802,18 +802,15 @@ class RestoreScreen(Screen):
         restore_confirm.add_event_cb(lambda e: self.confirm(e),lv.EVENT.CLICKED, None)
         restore_cancel.add_event_cb(lambda e: self.concel(e),lv.EVENT.CLICKED, None)
         
-
+    
     def confirm(self, e):
         ret = 0
         ret = ql_fs.path_exists("/ext/static/storage_file")#电话本
         if ret == True:
             ql_fs.rmdirs("/ext/static/storage_file")
             ql_fs.mkdirs("/ext/static/storage_file")
-        # [XT*334588000000156*0003*DLT]
+        EventMesh.publish("alipay_unbind")
         EventMesh.publish(constants.PROTOCOL.DLT_SEND)
-        
-        
-        # EventMesh.publish("load_screen", {"screen": "setting"})
 
     def concel(self, e):
         EventMesh.publish("load_screen", {"screen": "setting"})
@@ -930,8 +927,6 @@ class PoweroffScreen(Screen):
     def __init__(self):
         super().__init__()
         self.meta = poweroff_screen
-        self.timer = osTimer()
-        self.button_flag = 0
         poweroff_confirm_img.add_event_cb(lambda e: self.confirm(e),lv.EVENT.CLICKED, None)
         poweroff_return.add_event_cb(lambda e: self.concel(e),lv.EVENT.CLICKED, None)
 
@@ -971,8 +966,16 @@ class PoweroffConfirmScreen(Screen):
         super().__init__()
         self.meta = poweroff_confirm_screen
         self.timer = osTimer()
+        self.read_data = {}
     def initialization(self):
-        self.timer.start(2*1000,0,self.power_off)
+        step = EventMesh.publish("get_old_step_value")
+        if step != 0:
+            self.read_data = EventMesh.publish("get_storage_data")
+            self.read_data["old_step"] = step
+            EventMesh.publish("set_storage_data", self.read_data)
+            with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+                ujson.dump(self.read_data,fd)
+        self.timer.start(3*1000,0,self.power_off)
 
     def power_off(self,*args):
         Power.powerDown()
@@ -1034,6 +1037,7 @@ class DialswitchScreen(Screen):
     def watchface01(self,e):
         btn1_switch.add_state(lv.STATE.CHECKED)
         btn2_switch.clear_state(lv.STATE.CHECKED)
+        self.read_data = EventMesh.publish("get_storage_data")
         self.read_data["watchface"] = "Watchface1"
         EventMesh.publish("set_storage_data", self.read_data)
         with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
@@ -1045,6 +1049,7 @@ class DialswitchScreen(Screen):
     def watchface02(self,e):
         btn1_switch.clear_state(lv.STATE.CHECKED)
         btn2_switch.add_state(lv.STATE.CHECKED)
+        self.read_data = EventMesh.publish("get_storage_data")
         self.read_data["watchface"] = "Watchface2"
         EventMesh.publish("set_storage_data", self.read_data)
         with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
index 065637e..2375db3 100644 (file)
@@ -85,7 +85,8 @@ class Alipay(Abstract):
         print("post_processor_after_instantiation")
         
         
-        
+        EventMesh.subscribe("alipay_unbind", self.alipay_unbind)
+
         EventMesh.subscribe("alipay_1", self.alipay_1)
         EventMesh.subscribe("get_payment_code", self.get_payment_code)
         EventMesh.subscribe("get_collect_code", self.get_collect_code)
@@ -264,6 +265,9 @@ class Alipay(Abstract):
        
     def get_binding_code(self, event, msg):
         return self.result
+    
+    def alipay_unbind(self, event, msg):
+        self.alipay.unbind()
 
     def get_payment_code(self, event, msg):
         if self.is_init == 0 : 
index f3c6f7b..6dd3def 100644 (file)
@@ -54,21 +54,21 @@ wechat_press_label.set_text("请按住说话")
 wechat_press_label.align(lv.ALIGN.CENTER, 10, 0)
 wechat_press_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
-wechat_label = lv.label(wechat_screen)
-wechat_label.center()
-wechat_label.set_size(240, 40)
-wechat_label.set_long_mode(lv.label.LONG.WRAP)
-wechat_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-wechat_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+# wechat_label = lv.label(wechat_screen)
+# wechat_label.center()
+# wechat_label.set_size(240, 40)
+# wechat_label.set_long_mode(lv.label.LONG.WRAP)
+# wechat_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+# wechat_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 
-wechat_press_label_countdown = lv.label(wechat_screen)
-wechat_press_label_countdown.set_pos(100, 100)
-wechat_press_label_countdown.set_size(40, 40)
-wechat_press_label_countdown.set_text(" ")
-wechat_press_label_countdown.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-wechat_press_label_countdown.set_long_mode(lv.label.LONG.WRAP)
-wechat_press_label_countdown.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0)
+# wechat_press_label_countdown = lv.label(wechat_screen)
+# wechat_press_label_countdown.set_pos(100, 100)
+# wechat_press_label_countdown.set_size(40, 40)
+# wechat_press_label_countdown.set_text(" ")
+# wechat_press_label_countdown.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+# wechat_press_label_countdown.set_long_mode(lv.label.LONG.WRAP)
+# wechat_press_label_countdown.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0)
 
 
 
@@ -115,20 +115,20 @@ class WechatScreen(Screen):
             self.volum_size = 8
         self.aud.setVolume(self.volum_size)
         self.meta = wechat_screen
-        wechat_press_btn.add_event_cb(lambda e: self.talking(e),
-                                     lv.EVENT.LONG_PRESSED, None)
-        wechat_press_btn.add_event_cb(lambda e: self.sending(e),
-                                     lv.EVENT.RELEASED, None)
+        # wechat_press_btn.add_event_cb(lambda e: self.talking(e),
+        #                              lv.EVENT.LONG_PRESSED, None)
+        # wechat_press_btn.add_event_cb(lambda e: self.sending(e),
+        #                              lv.EVENT.RELEASED, None)
         self.timer = osTimer()
         self.second_timer = osTimer()
         self.play_timer = osTimer()
         
-        wechat_label.set_text(" ")
+        
 
         self.startY = 0
         self.startWidth = 0
         self.check_json = 0
-        self.wechat_list =lv.obj(wechat_screen)
+        self.wechat_list = wechat_screen
         EventMesh.subscribe("wechat_updata_list_show", self.wechat_updata_list_show)
         EventMesh.subscribe("get_wechat_data", self.get_wechat_data)
         EventMesh.subscribe("set_wechat_data", self.set_wechat_data)
@@ -163,8 +163,8 @@ class WechatScreen(Screen):
 
     def wechat_updata_list_show(self, event, msg): 
         if (self.wechat_list.has_flag(lv.obj.FLAG.HIDDEN)) == False:
-            wechat_label.clear_flag(lv.obj.FLAG.HIDDEN)
-            wechat_label.set_text("接收中")
+            # wechat_label.clear_flag(lv.obj.FLAG.HIDDEN)
+            # wechat_label.set_text("接收中")
             self.updata_list_show(2)
             self.timer.start(1 * 1000, 0, self.reciving)
     
@@ -176,7 +176,7 @@ class WechatScreen(Screen):
             if self.wechat_num != 0:
                 if index == 0:
                     self.wechat_list.clear_flag(lv.obj.FLAG.HIDDEN)
-                    wechat_label.add_flag(lv.obj.FLAG.HIDDEN)
+                    # wechat_label.add_flag(lv.obj.FLAG.HIDDEN)
                 elif index == 2 or index == 1:
                     #读取json文件中的键作为label文本;
                     #print("self.wechat_list.self.wechat_num:{}".format(self.wechat_num))
@@ -290,9 +290,10 @@ class WechatScreen(Screen):
                     bottom_btn1.scroll_to_view(lv.ANIM.OFF)    
 
     def initialization(self):
-        wechat_label.add_flag(lv.obj.FLAG.HIDDEN)
-        wechat_press_label_countdown.add_flag(lv.obj.FLAG.HIDDEN)
-        self.wechat_list.clear_flag(lv.obj.FLAG.HIDDEN)
+        # wechat_label.set_text(" ")
+        # wechat_label.add_flag(lv.obj.FLAG.HIDDEN)
+        # wechat_press_label_countdown.add_flag(lv.obj.FLAG.HIDDEN)
+        # self.wechat_list.clear_flag(lv.obj.FLAG.HIDDEN)
         #读取json文件中的字典放到self.phonebook中
         #创建btn
         self.updata_list_show(1)
@@ -305,10 +306,10 @@ class WechatScreen(Screen):
         self.aud.stop()
         self.wechat_list.add_flag(lv.obj.FLAG.HIDDEN)#隐藏列表选项方框
         self.countdown = 1
-        wechat_label.clear_flag(lv.obj.FLAG.HIDDEN)
-        wechat_label.set_text("松开发送")
-        wechat_press_label_countdown.clear_flag(lv.obj.FLAG.HIDDEN)
-        wechat_press_label_countdown.set_text("{}S".format(str(self.countdown)))
+        # wechat_label.clear_flag(lv.obj.FLAG.HIDDEN)
+        # wechat_label.set_text("松开发送")
+        # wechat_press_label_countdown.clear_flag(lv.obj.FLAG.HIDDEN)
+        # wechat_press_label_countdown.set_text("{}S".format(str(self.countdown)))
         
 
         self.updata_list_show(2)#不需要显示语音列表
@@ -328,10 +329,10 @@ class WechatScreen(Screen):
      #松开发送   
     def sending(self,e):
         if self.press_state == 1:
-            wechat_label.clear_flag(lv.obj.FLAG.HIDDEN)
-            wechat_label.set_text("发送中")
-            wechat_press_label_countdown.add_flag(lv.obj.FLAG.HIDDEN)
-            wechat_press_label_countdown.set_text(" ")
+            # wechat_label.clear_flag(lv.obj.FLAG.HIDDEN)
+            # wechat_label.set_text("发送中")
+            # wechat_press_label_countdown.add_flag(lv.obj.FLAG.HIDDEN)
+            # wechat_press_label_countdown.set_text(" ")
 
             if self.countdown >= 15:
                 self.countdown = 15 
@@ -433,8 +434,8 @@ class WechatScreen(Screen):
     #松手2秒后发送数据
     def hide_label(self,*args):
         if self.ble_send != 1:
-            wechat_label.add_flag(lv.obj.FLAG.HIDDEN)
-            wechat_label.set_text(" ")
+            # wechat_label.add_flag(lv.obj.FLAG.HIDDEN)
+            # wechat_label.set_text(" ")
             self.updata_list_show(0)
 
      #获取是否在录音
@@ -459,7 +460,7 @@ class WechatScreen(Screen):
 
         if self.countdown >= 15:
             self.countdown = 15
-        wechat_press_label_countdown.set_text("{}S".format(str(self.countdown)))
+        # wechat_press_label_countdown.set_text("{}S".format(str(self.countdown)))
 
     def done_return(self):
         EventMesh.publish("load_screen", {"screen": "main_menu"})
index 865c9b4..e3501ad 100644 (file)
@@ -51,9 +51,6 @@ if __name__ == '__main__':
     print("init3:{}".format(utime.localtime()))
     from ext.btn_device_ec800m import BtnDevice
     from ui_main_menu import MainMenuScreen
-    
-    
-    
     # from ui_WatchFaceScreen import WatchFaceScreen
     
     from ext.appFactoryMode import  FactoryModeLocationScreen,FactoryModeScreen 
@@ -80,7 +77,7 @@ if __name__ == '__main__':
     ui.add_screen(_ui.ContactsScreen()) 
     from appWechat import WechatScreen,TK_ProtoCol,MESSAGE_ProtoCol,NewWechatPopupScreen
     ui.add_screen(WechatScreen()) 
-    from alarm import ClkListScreen,ClockManager,NewEditClk,CLKTimeScreen,ClkPeriod,PopupAlarmScreen
+    from ext.alarm import ClkListScreen,ClockManager,NewEditClk,CLKTimeScreen,ClkPeriod,PopupAlarmScreen
     ui.add_screen(ClkListScreen()) 
     ui.add_screen(_ui.CountdownEndScreen()) 
     ui.add_screen(NewEditClk()) 
@@ -137,8 +134,8 @@ if __name__ == '__main__':
     import mgr as mgr
     print("init7:{}".format(utime.localtime()))
     
-    from mgr import ConfigStoreManager, LocationManager, SockManager,getVolumSizeManager, \
-    NetManager,AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldHrDataManager,getStorageDataManager,getBrightnessManager,getHrTimeManager
+    from mgr import ConfigStoreManager, LocationManager, SockManager,getVolumSizeManager,gethistoryDataManager, \
+    NetManager,AddrBookManager,MsgdetailManager,PhoneCallingManager,getStorageDataManager,getBrightnessManager,getHrTimeManager
     print("init8:{}".format(utime.localtime()))
     
     
@@ -176,7 +173,7 @@ if __name__ == '__main__':
     app.append_manager(mgr.getWeatherDataManager())
     app.append_manager(PhoneCallingManager())
     app.append_manager(ClockManager())
-    app.append_manager(getOldHrDataManager())
+    app.append_manager(gethistoryDataManager())
     app.append_manager(getHrTimeManager())
     app.append_manager(getBrightnessManager())
     app.append_manager(getStorageDataManager())
index 9f23697..e3501ad 100644 (file)
@@ -77,7 +77,7 @@ if __name__ == '__main__':
     ui.add_screen(_ui.ContactsScreen()) 
     from appWechat import WechatScreen,TK_ProtoCol,MESSAGE_ProtoCol,NewWechatPopupScreen
     ui.add_screen(WechatScreen()) 
-    from alarm import ClkListScreen,ClockManager,NewEditClk,CLKTimeScreen,ClkPeriod,PopupAlarmScreen
+    from ext.alarm import ClkListScreen,ClockManager,NewEditClk,CLKTimeScreen,ClkPeriod,PopupAlarmScreen
     ui.add_screen(ClkListScreen()) 
     ui.add_screen(_ui.CountdownEndScreen()) 
     ui.add_screen(NewEditClk()) 
@@ -134,8 +134,8 @@ if __name__ == '__main__':
     import mgr as mgr
     print("init7:{}".format(utime.localtime()))
     
-    from mgr import ConfigStoreManager, LocationManager, SockManager,getVolumSizeManager, \
-    NetManager,AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldHrDataManager,getStorageDataManager,getBrightnessManager,getHrTimeManager
+    from mgr import ConfigStoreManager, LocationManager, SockManager,getVolumSizeManager,gethistoryDataManager, \
+    NetManager,AddrBookManager,MsgdetailManager,PhoneCallingManager,getStorageDataManager,getBrightnessManager,getHrTimeManager
     print("init8:{}".format(utime.localtime()))
     
     
@@ -173,7 +173,7 @@ if __name__ == '__main__':
     app.append_manager(mgr.getWeatherDataManager())
     app.append_manager(PhoneCallingManager())
     app.append_manager(ClockManager())
-    app.append_manager(getOldHrDataManager())
+    app.append_manager(gethistoryDataManager())
     app.append_manager(getHrTimeManager())
     app.append_manager(getBrightnessManager())
     app.append_manager(getStorageDataManager())
index 307b888..2c5803e 100644 (file)
@@ -513,9 +513,11 @@ class DeviceInfoManager(Abstract):
         self.Spo2_Need_Open = 0
         self.bat_time = 0
         self.sms_full_flag = 0
+        self.clear_step = 0
 
         self.old_time = 0
         self.UD_time = 0
+
         self.UD_timeout = 7*60
         print("DeviceInfoManager:1")
         self.gsensor = SC7A20()
@@ -591,7 +593,9 @@ class DeviceInfoManager(Abstract):
         :return:
         """
 
+
         self.timer_push = self.timer_push+1
+
         #if self.timer_push > 10 :
         # EventMesh.publish("time", self.get_time())
         # EventMesh.publish("battery", self.get_battery())
@@ -611,11 +615,32 @@ class DeviceInfoManager(Abstract):
         
         self.get_hr_state = EventMesh.publish("get_hr_state")
         self.get_spo2_state = EventMesh.publish("get_spo2_state")
-        # print("hr_time:{} get_hr_state:{} get_spo2_state:{}".format(hr_time,self.get_hr_state,self.get_spo2_state))
         
-        #电量小于20%5分钟提醒一次
+        hour = 0
+        min = 0
+        hour = date_tmp[3]
+        min = date_tmp[4]
+
+        if hour == 0:#清步数
+            if min <= 1:
+                if self.clear_step == 0:
+                    step = EventMesh.publish("get_old_step_value")
+                    if step > 0:
+                        EventMesh.publish("set_old_step_value",0)
+                        self.gsensor.reset_step()
+                    self.clear_step = 1
+            else:
+                if self.clear_step == 1:
+                    self.clear_step = 0
+        else:
+            if self.clear_step == 1:
+                self.clear_step = 0
+        
+        #电量小于20% 5分钟提醒一次
         battery = EventMesh.publish("screen_get_battery")
         self.bat_time+=10
+        # print("date_tmp:{} self.bat_time:{}".format(date_tmp,self.bat_time))
+
         if self.bat_time > 5*60:
             self.bat_time = 0
             if battery == 20:
@@ -1198,7 +1223,7 @@ class SockManager(Abstract):
         self.connect()
 
     def send(self, topic, msg):
-        # print("send msg:{}".format(msg))
+        print("TCP:send data:{}".format(msg))
         self.sock.send(msg)
 
     def recv(self):
@@ -1222,7 +1247,7 @@ class SockManager(Abstract):
             if data[-1] != 0x5d and len(data)<10*1024: #']':
                 continue
             self.connect_tmp = 1 #有数据,就认为是连接状态
-            print("TCP:recv:len:{} type:{}".format(len(data),type(data)))
+            print("TCP:recv: data:{}".format(data))
             EventMesh.publish(constants.EVENT.SET_CONNECT, 1)
             data_str = data.decode('ascii')
             data_str = data_str.split(']')
@@ -1572,11 +1597,13 @@ class PhoneCallingManager(Abstract):
     def get_phonenum(self, event, msg):
         return self.phonenum
 
-#获取心率 血氧历史数据
-class getOldHrDataManager(Abstract):
+#获取心率 血氧 步数历史数据
+class gethistoryDataManager(Abstract):
     def __init__(self):
         self.oldHr = 0
         self.oldspo2 = 0
+        self.oldstep = 0
+        self.old_step = 0
         self.read_data = {}
         check_json= ql_fs.path_exists("/ext/static/storage_file/config.json")
         if check_json == True :
@@ -1593,9 +1620,15 @@ class getOldHrDataManager(Abstract):
                         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
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("set_old_hr_data", self.save_hr_value)
@@ -1603,6 +1636,9 @@ class getOldHrDataManager(Abstract):
         EventMesh.subscribe("set_old_spo2_data", self.save_spo2_value)
         EventMesh.subscribe("get_old_spo2_data", self.get_spo2_value)
 
+        EventMesh.subscribe("get_old_step_value", self.get_old_step_value)
+        EventMesh.subscribe("set_old_step_value", self.set_old_step_value)
+
     def save_hr_value(self, event, msg): 
         if msg >= 50:
             self.read_data = EventMesh.publish("get_storage_data")
@@ -1629,6 +1665,17 @@ class getOldHrDataManager(Abstract):
     def get_spo2_value(self, event, msg): 
         return self.oldspo2
     
+    def set_old_step_value(self, event, msg): 
+        self.oldstep = msg
+        
+        
+    def get_old_step_value(self, event, msg): 
+        step = EventMesh.publish(constants.EVENT.GET_STEP)
+        self.old_step = self.oldstep + step[0]
+        return self.old_step
+    
+    
+    
 
 class getWeatherDataManager(Abstract):
     # 获取天气数据
index 59c3193..4fb472f 100644 (file)
@@ -87,7 +87,7 @@ class ProtoCol(Abstract):
 
     def handler(self, event, msg):
         self.password = EventMesh.publish(constants.EVENT.GET_PASSWORD)
-        self.imei = EventMesh.publish(constants.EVENT.GET_IMEI)#"867387060319166" #EventMesh.publish(constants.EVENT.GET_IMEI)#"867387060319166"#EventMesh.publish(constants.EVENT.GET_IMEI) #"867387060319166"#EventMesh.publish(constants.EVENT.GET_IMEI) #"867387060319166"#"867387060319188"#"867387060319177"#"867387060319166"#"860132060004322"#"867387060319166"#"860132060004322"#EventMesh.publish(constants.EVENT.GET_IMEI)
+        self.imei = EventMesh.publish(constants.EVENT.GET_IMEI)#"867387060319166"#EventMesh.publish(constants.EVENT.GET_IMEI)#"867387060319166" #EventMesh.publish(constants.EVENT.GET_IMEI)#"867387060319166"#EventMesh.publish(constants.EVENT.GET_IMEI) #"867387060319166"#EventMesh.publish(constants.EVENT.GET_IMEI) #"867387060319166"#"867387060319188"#"867387060319177"#"867387060319166"#"860132060004322"#"867387060319166"#"860132060004322"#EventMesh.publish(constants.EVENT.GET_IMEI)
         self.cid = EventMesh.publish(constants.EVENT.GET_CID)
         self.imsi = EventMesh.publish(constants.EVENT.GET_IMSI)
         self.key = EventMesh.publish(constants.EVENT.GET_KEY)
@@ -200,7 +200,26 @@ class KA_ProtoCol(ProtoCol):
         date = date[2:]
         #print("date:",date)
         #步数
-        step = EventMesh.publish(constants.EVENT.GET_STEP)[0]
+        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("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+                    ujson.dump(read_data,fd)
+
+        old_step = step
+        # step = EventMesh.publish(constants.EVENT.GET_STEP)[0]
         # 电池电量百分比 
         bat_tmp = EventMesh.publish("screen_get_battery")
         battery_caption =  bat_tmp[1]
@@ -265,7 +284,24 @@ class UD_ProtoCol(ProtoCol):
         bat_tmp = EventMesh.publish("screen_get_battery")
         battery_caption =  str(bat_tmp[1])
         #步数
-        step = str(EventMesh.publish(constants.EVENT.GET_STEP)[0])
+        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:
+                read_data["old_step"] = step
+                read_data["old_step_new"] = step
+                EventMesh.publish("set_storage_data", read_data)
+                with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+                    ujson.dump(read_data,fd)
+        old_step = step
+        # step = str(EventMesh.publish(constants.EVENT.GET_STEP)[0])
         #翻转次数
         turn_count = "0"
         #终端状态
index bc007d7..05b4c68 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_BUTTON_DELKEY.png and b/3.code/1.watch/2.code/static/IMAGE_BUTTON_DELKEY.png differ
index 1bd304a..df9dd10 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL.png and b/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL.png differ
index 202af96..2865f2b 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL_CONTACT.png and b/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL_CONTACT.png differ
index afeec62..15b6108 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY0_ICON.png and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY0_ICON.png differ
index 64fb0a8..ac732ec 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY1_ICON.png and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY1_ICON.png differ
index ef5c917..ab8e9cd 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY2_ICON.png and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY2_ICON.png differ
index 2f02325..9715c25 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY3_ICON.png and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY3_ICON.png differ
index 6922ab2..abd24f2 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY4_ICON.png and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY4_ICON.png differ
index 90acbc7..37ffa53 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY5_ICON.png and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY5_ICON.png differ
index b221387..1164e23 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY6_ICON.png and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY6_ICON.png differ
index db21533..86893a4 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY7_ICON.png and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY7_ICON.png differ
index 9d58122..13ffa6b 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY8_ICON.png and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY8_ICON.png differ
index 856baa3..4bc6134 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY9_ICON.png and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY9_ICON.png differ
index cc524c5..b3803db 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYHASH_ICON.png and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYHASH_ICON.png differ
index 0e84738..c3e133f 100644 (file)
Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYSTAR_ICON.png and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYSTAR_ICON.png differ
index b0a4694..0cc0125 100644 (file)
@@ -206,7 +206,8 @@ class Screen(Abstract):
         pass
 
 PHONE_CALL_MAX_DATA = 22
-line_points = [{"x":0,"y":0},{"x":0,"y":35}]
+
+phone_line_points = [{"x":0,"y":0},{"x":0,"y":40}]
 phone_screen = None
 phone_line = None
 phone_label = None
@@ -254,15 +255,15 @@ class PhoneScreen(Screen):
             phone_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
 
             phone_line = lv.line(phone_screen)
-            phone_line.set_points(line_points,2)
-            phone_line.set_pos(235,58)
-            phone_line.set_size(2,35)
+            phone_line.set_points(phone_line_points,2)
+            phone_line.set_pos(235,8)
+            phone_line.set_size(2,40)
             phone_line.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
             phone_line.add_style(style_line,0)
 
             phone_label = lv.label(phone_screen)
-            phone_label.set_pos(0, 45)
-            phone_label.set_size(0, 55)
+            phone_label.set_pos(0, 14)
+            phone_label.set_size(0, 48)
             phone_label.set_text(" ")
             phone_label.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
             phone_label.set_long_mode(lv.label.LONG.CLIP)
@@ -272,91 +273,92 @@ class PhoneScreen(Screen):
             phone_one.set_src("E:/static/IMAGE_NUMBER_KEY1_ICON.png")
             phone_one.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_one.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_one.set_pos(3, 100)
+            phone_one.set_pos(3, 60)
+            phone_one.set_size(76, 50)
 
             phone_two = lv.img(phone_screen)
-            phone_two.set_size(76, 40)
+            phone_two.set_size(76, 50)
             phone_two.set_src("E:/static/IMAGE_NUMBER_KEY2_ICON.png")
             phone_two.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_two.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_two.set_pos(82, 100)
+            phone_two.set_pos(82, 60)
 
             phone_three = lv.img(phone_screen)
-            phone_three.set_size(76, 40)
+            phone_three.set_size(76, 50)
             phone_three.set_src("E:/static/IMAGE_NUMBER_KEY3_ICON.png")
             phone_three.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_three.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_three.set_pos(161, 100)
+            phone_three.set_pos(161, 60)
 
             phone_four = lv.img(phone_screen)
-            phone_four.set_size(76, 40)
+            phone_four.set_size(76, 50)
             phone_four.set_src("E:/static/IMAGE_NUMBER_KEY4_ICON.png")
             phone_four.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_four.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_four.set_pos(3, 142)
+            phone_four.set_pos(3, 112)
 
             phone_five = lv.img(phone_screen)
-            phone_five.set_size(76, 40)
+            phone_five.set_size(76, 50)
             phone_five.set_src("E:/static/IMAGE_NUMBER_KEY5_ICON.png")
             phone_five.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_five.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_five.set_pos(82, 142)
+            phone_five.set_pos(82, 112)
 
             phone_six = lv.img(phone_screen)
-            phone_six.set_size(76, 40)
+            phone_six.set_size(76, 50)
             phone_six.set_src("E:/static/IMAGE_NUMBER_KEY6_ICON.png")
             phone_six.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_six.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_six.set_pos(161, 142)
+            phone_six.set_pos(161, 112)
 
             phone_seven = lv.img(phone_screen)
-            phone_seven.set_size(76, 40)
+            phone_seven.set_size(76, 50)
             phone_seven.set_src("E:/static/IMAGE_NUMBER_KEY7_ICON.png")
             phone_seven.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_seven.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_seven.set_pos(3, 184)
+            phone_seven.set_pos(3, 164)
 
             phone_eight = lv.img(phone_screen)
-            phone_eight.set_size(76, 40)
+            phone_eight.set_size(76, 50)
             phone_eight.set_src("E:/static/IMAGE_NUMBER_KEY8_ICON.png")
             phone_eight.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_eight.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_eight.set_pos(82, 184)
+            phone_eight.set_pos(82, 164)
 
             phone_nine = lv.img(phone_screen)
-            phone_nine.set_size(76, 40)
+            phone_nine.set_size(76, 50)
             phone_nine.set_src("E:/static/IMAGE_NUMBER_KEY9_ICON.png")
             phone_nine.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_nine.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_nine.set_pos(161, 184)
+            phone_nine.set_pos(161, 164)
 
             phone_start = lv.img(phone_screen)
-            phone_start.set_size(76, 40)
+            phone_start.set_size(76, 50)
             phone_start.set_src("E:/static/IMAGE_NUMBER_KEYSTAR_ICON.png")
             phone_start.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_start.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_start.set_pos(3, 226)
+            phone_start.set_pos(3, 216)
 
             phone_zero = lv.img(phone_screen)
-            phone_zero.set_size(76, 40)
+            phone_zero.set_size(76, 50)
             phone_zero.set_src("E:/static/IMAGE_NUMBER_KEY0_ICON.png")
             phone_zero.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_zero.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_zero.set_pos(82, 226)
+            phone_zero.set_pos(82, 216)
 
             phone_hash = lv.img(phone_screen)
-            phone_hash.set_size(76, 40)
+            phone_hash.set_size(76, 50)
             phone_hash.set_src("E:/static/IMAGE_NUMBER_KEYHASH_ICON.png")
             phone_hash.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_hash.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_hash.set_pos(161, 226)
+            phone_hash.set_pos(161, 216)
 
             phone_call = lv.img(phone_screen)
-            phone_call.set_size(76, 40)
+            phone_call.set_size(76, 50)
             phone_call.set_src("E:/static/IMAGE_BUTTON_DIAL.png")
             phone_call.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_call.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_call.set_pos(3, 268)
+            phone_call.set_pos(3, 270)
 
             phone_call_btn = lv.img(phone_screen)
             phone_call_btn.set_size(76, 52)
@@ -364,11 +366,11 @@ class PhoneScreen(Screen):
             phone_call_btn.set_pos(3, 268)
 
             phone_contact = lv.img(phone_screen)
-            phone_contact.set_size(64, 40)
+            phone_contact.set_size(64, 50)
             phone_contact.set_src("E:/static/IMAGE_BUTTON_DIAL_CONTACT.png")
             phone_contact.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_contact.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_contact.set_pos(87, 268)
+            phone_contact.set_pos(87, 270)
 
             phone_contact_btn = lv.img(phone_screen)
             phone_contact_btn.set_size(76, 52)
@@ -376,11 +378,11 @@ class PhoneScreen(Screen):
             phone_contact_btn.set_pos(87, 268)
 
             phone_delete = lv.img(phone_screen)
-            phone_delete.set_size(76, 40)
+            phone_delete.set_size(76, 50)
             phone_delete.set_src("E:/static/IMAGE_BUTTON_DELKEY.png")
             phone_delete.add_flag(lv.obj.FLAG.CLICKABLE)
             phone_delete.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            phone_delete.set_pos(161, 268)
+            phone_delete.set_pos(161, 270)
 
             phone_delete_btn = lv.img(phone_screen)
             phone_delete_btn.set_size(76, 52)
@@ -592,8 +594,8 @@ class PhoneScreen(Screen):
         len_t = len(self.phone_list)*40
         if len_t > 230:
             len_t = 230
-        phone_label.set_size(len_t,45)
-        phone_label.set_pos(230-len_t,60)
+        phone_label.set_size(len_t,48)
+        phone_label.set_pos(230-len_t,14)
         phone_label.set_text(self.phone_num)
 
     def done_return(self):
@@ -1141,7 +1143,7 @@ class PopupScreen(Screen):
             msg_list_t_done_img = lv.img(msg_list_t)
             msg_list_t_done_img.set_pos(53, 20)
             msg_list_t_done_img.set_size(134, 117)
-            msg_list_t_done_img.set_src("E:/static/IMAGE_NOTICE_NONE.jpg")
+            msg_list_t_done_img.set_src("E:/static/IMAGE_NOTICE_NONE.png")
             msg_list_t_done_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
 
             no_msg_text = lv.label(msg_list_t)
@@ -2009,56 +2011,57 @@ class WeatherScreen(Screen):
             weather_detail_label,weather_location_label,no_connect_label ,no_connect_label1 
         connect = EventMesh.publish(constants.EVENT.GET_CONNECT) #获取网络状态
         self.weather_data = EventMesh.publish("get_weather_data")
-        if connect != 0:
-            no_data = self.weather_data[8]
-            if no_data != 0:
-                no_weather_img.add_flag(lv.obj.FLAG.HIDDEN)
-                weather_img.clear_flag(lv.obj.FLAG.HIDDEN)
-                no_connect_label.set_text(" ")
-                no_connect_label1.set_text(" ")
-                # print("self.weather_data:{}".format(self.weather_data))
-                type = self.weather_data[3]
-                if type == None:
-                    weather_img.set_src("E:/static/update.png")#天气类型
-                else:
-                    weather_img.set_src("E:/static/{}_weather.png".format(type))#天气类型
+        if weather_screen != None:
+            if connect != 0 and self.weather_data != None:
+                no_data = self.weather_data[8]
+                if no_data != 0 :
+                    no_weather_img.add_flag(lv.obj.FLAG.HIDDEN)
+                    weather_img.clear_flag(lv.obj.FLAG.HIDDEN)
+                    no_connect_label.set_text(" ")
+                    no_connect_label1.set_text(" ")
+                    # print("self.weather_data:{}".format(self.weather_data))
+                    type = self.weather_data[3]
+                    if type == None:
+                        weather_img.set_src("E:/static/update.png")#天气类型
+                    else:
+                        weather_img.set_src("E:/static/{}_weather.png".format(type))#天气类型
 
-                temp = self.weather_data[4]
-                if temp == None:
-                    weather_tem_label.set_text("_ _")
-                else:
-                    weather_tem_label.set_text("{}".format(temp))
+                    temp = self.weather_data[4]
+                    if temp == None:
+                        weather_tem_label.set_text("_ _")
+                    else:
+                        weather_tem_label.set_text("{}".format(temp))
 
-                date = self.weather_data[0]
-                if date != '{}':
-                    date_month = date.split('-')[1]
-                    date_day = date.split('-')[2]
-                    weather_detail_label.set_text("{}/{}".format(date_month,date_day))#天气更新时间
-                else:
+                    date = self.weather_data[0]
+                    if date != '{}':
+                        date_month = date.split('-')[1]
+                        date_day = date.split('-')[2]
+                        weather_detail_label.set_text("{}/{}".format(date_month,date_day))#天气更新时间
+                    else:
+                        weather_detail_label.set_text("-/-")
+
+                    city = self.weather_data[7]
+                    if city != '{}':
+                        weather_location_label.set_text("{}".format(city))#城市
+                    else:
+                        weather_location_label.set_text("--")
+                else:#已联网未获取到天气数据
+                    weather_location_label.set_text(" ")
                     weather_detail_label.set_text("-/-")
+                    weather_tem_label.set_text("_ _")
 
-                city = self.weather_data[7]
-                if city != '{}':
-                    weather_location_label.set_text("{}".format(city))#城市
-                else:
-                    weather_location_label.set_text("--")
-            else:#已联网未获取到天气数据
+                    no_connect_label.set_text("未获取网络数据")
+                    no_connect_label1.set_text("请稍候重试")
+
+            else:
                 weather_location_label.set_text(" ")
                 weather_detail_label.set_text("-/-")
                 weather_tem_label.set_text("_ _")
-
-                no_connect_label.set_text("未获取网络数据")
-                no_connect_label1.set_text("请稍候重试")
-
-        else:
-            weather_location_label.set_text(" ")
-            weather_detail_label.set_text("-/-")
-            weather_tem_label.set_text("_ _")
-            
-            no_weather_img.clear_flag(lv.obj.FLAG.HIDDEN)
-            weather_img.add_flag(lv.obj.FLAG.HIDDEN)
-            no_connect_label.set_text("找不到服务器")
-            no_connect_label1.set_text("请联网后重试")
+                
+                no_weather_img.clear_flag(lv.obj.FLAG.HIDDEN)
+                weather_img.add_flag(lv.obj.FLAG.HIDDEN)
+                no_connect_label.set_text("找不到服务器")
+                no_connect_label1.set_text("请联网后重试")
 
     def done_return(self):
         EventMesh.publish("load_screen", {"screen": "toolbox"})
index 1cb64da..a09b73c 100644 (file)
@@ -11,11 +11,21 @@ import ujson
 from ui_main_menu import MainMenu2_Watchface
 
 
-style_font_youyuan_20 = lv.style_t()
-style_font_youyuan_20.init()
-style_font_youyuan_20.set_text_color(lv.color_make(0xff, 0xff, 0xff))
-style_font_youyuan_20.set_text_font_v2("font_22.bin",22,0)
+# style_font_youyuan_20 = lv.style_t()
+# style_font_youyuan_20.init()
+# style_font_youyuan_20.set_text_color(lv.color_make(0xff, 0xff, 0xff))
+# style_font_youyuan_20.set_text_font_v2("font_22.bin",22,0)
 
+watchface_style_default = lv.style_t()
+watchface_style_default.init()
+watchface_style_default.set_text_color(lv.color_make(0xff, 0xff, 0xff))
+watchface_style_default.set_text_font_v2("font_22.bin",22,0)
+
+
+style_font_youyuan_28 = lv.style_t()
+style_font_youyuan_28.init()
+style_font_youyuan_28.set_text_color(lv.color_make(0xFF, 0xFF, 0xFF))
+style_font_youyuan_28.set_text_font(lv.font_28_dial)
 
 Watchface = lv.obj()
 
@@ -80,7 +90,7 @@ style_font_youyuan_70_black.set_text_color(lv.color_make(0x32, 0xc8, 0xdb))
 style_font_youyuan_70_black.set_text_font(lv.font_70_bold)
 
 watchface1_time1_text = lv.label(Watchface1)
-watchface1_time1_text.set_pos(20, 60)
+watchface1_time1_text.set_pos(20, 50)
 watchface1_time1_text.set_size(190, 71)
 watchface1_time1_text.set_align(lv.TEXT_ALIGN.LEFT)
 watchface1_time1_text.set_text("12:00")
@@ -88,27 +98,27 @@ watchface1_time1_text.add_style(style_font_youyuan_70_black, lv.PART.MAIN|lv.STA
 
 #日期
 watchface1_date_span = lv.label(Watchface1)
-watchface1_date_span.set_pos(24, 131)
-watchface1_date_span.set_size(84, 30)
+watchface1_date_span.set_pos(24, 118)
+watchface1_date_span.set_size(140, 30)
 watchface1_date_span.set_align(lv.TEXT_ALIGN.LEFT)
 watchface1_date_span.set_text("12月9日")
-watchface1_date_span.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface1_date_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 #星期
 watchface1_week_span = lv.label(Watchface1)
-watchface1_week_span.set_pos(24, 163)
-watchface1_week_span.set_size(70, 30)
+watchface1_week_span.set_pos(24, 153)
+watchface1_week_span.set_size(100, 30)
 watchface1_week_span.set_align(lv.TEXT_ALIGN.LEFT)
 watchface1_week_span.set_text("星期四")
-watchface1_week_span.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface1_week_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 
 
 watchface1_step_span = lv.label(Watchface1)
-watchface1_step_span.set_pos(170, 163)
-watchface1_step_span.set_size(70, 30)
+watchface1_step_span.set_pos(158, 154)
+watchface1_step_span.set_size(78, 30)
 watchface1_step_span.set_align(lv.TEXT_ALIGN.LEFT)
 watchface1_step_span.set_text("0")
-watchface1_step_span.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface1_step_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 
 
@@ -117,7 +127,7 @@ watchface1_HB_span.set_pos(55, 235)
 watchface1_HB_span.set_size(80, 30)
 watchface1_HB_span.set_align(lv.TEXT_ALIGN.LEFT)
 watchface1_HB_span.set_text("0")
-watchface1_HB_span.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface1_HB_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 
 
@@ -126,7 +136,7 @@ watchface1_SPO2_span.set_pos(160, 235)
 watchface1_SPO2_span.set_size(80, 30)
 watchface1_SPO2_span.set_align(lv.TEXT_ALIGN.LEFT)
 watchface1_SPO2_span.set_text("0")
-watchface1_SPO2_span.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface1_SPO2_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 
 class WatchFace1():
@@ -160,9 +170,10 @@ class WatchFace1():
         if spo2Value :
             self.__oldSpo2Value(None, spo2Value)
         # print("main get_step msg:{}".format(msg))
-        step = EventMesh.publish(constants.EVENT.GET_STEP)
-        if step :
-            self.__stepValue(None, step[0])
+
+        # step = EventMesh.publish(constants.EVENT.GET_STEP)
+        step = EventMesh.publish("get_old_step_value")
+        self.__stepValue(None, step)
 
         
     def timerout_update(self):
@@ -188,9 +199,9 @@ class WatchFace1():
         if spo2Value :
             self.__oldSpo2Value(None, spo2Value)
         # print("main get_step msg:{}".format(msg))
-        step = EventMesh.publish(constants.EVENT.GET_STEP)
-        if step :
-            self.__stepValue(None, step[0])
+        # step = EventMesh.publish(constants.EVENT.GET_STEP)
+        step = EventMesh.publish("get_old_step_value")
+        self.__stepValue(None, step)
 
     def __time(self, event, msg):
         #时间
@@ -227,7 +238,10 @@ class WatchFace1():
         watchface1_SPO2_span.set_text(str(msg))
 
     def __stepValue(self, event, msg):
-        watchface1_step_span.set_text(str(msg))
+        if msg == None:    
+            watchface1_step_span.set_text("0")
+        else:
+            watchface1_step_span.set_text(str(msg))
 
     def Close(self):
         pass
@@ -294,69 +308,49 @@ style_font_youyuan_70_red.set_text_font(lv.font_70_bold)
 x = 30
 y = 80
 watchface2_time1_hour1_text = lv.label(Watchface2)
-watchface2_time1_hour1_text.set_pos(40, 80)
+watchface2_time1_hour1_text.set_pos(10, 80)
 watchface2_time1_hour1_text.set_size(50, 70)
 watchface2_time1_hour1_text.set_align(lv.TEXT_ALIGN.LEFT)
 watchface2_time1_hour1_text.set_text("1")
 watchface2_time1_hour1_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 watchface2_time1_hour2_text = lv.label(Watchface2)
-watchface2_time1_hour2_text.set_pos(90, 80)
+watchface2_time1_hour2_text.set_pos(55, 80)
 watchface2_time1_hour2_text.set_size(50, 70)
 watchface2_time1_hour2_text.set_align(lv.TEXT_ALIGN.LEFT)
 watchface2_time1_hour2_text.set_text("2")
 watchface2_time1_hour2_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 watchface2_time2_min1_text = lv.label(Watchface2)
-watchface2_time2_min1_text.set_pos(40, 156)
+watchface2_time2_min1_text.set_pos(10, 156)
 watchface2_time2_min1_text.set_size(50, 70)
 watchface2_time2_min1_text.set_align(lv.TEXT_ALIGN.LEFT)
 watchface2_time2_min1_text.set_text("0")
 watchface2_time2_min1_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 watchface2_time2_min2_text = lv.label(Watchface2)
-watchface2_time2_min2_text.set_pos(90, 156)
+watchface2_time2_min2_text.set_pos(55, 156)
 watchface2_time2_min2_text.set_size(50, 70)
 watchface2_time2_min2_text.set_align(lv.TEXT_ALIGN.LEFT)
 watchface2_time2_min2_text.set_text("0")
 watchface2_time2_min2_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT)
 
-# create style watchface2_style_default
-# watchface2_style_default = lv.style_t()
-# watchface2_style_default.init()
-# watchface2_style_default.set_radius(0)
-# watchface2_style_default.set_bg_color(lv.color_make(0x21,0x95,0xf6))
-# watchface2_style_default.set_bg_grad_color(lv.color_make(0x21,0x95,0xf6))
-# watchface2_style_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
-# watchface2_style_default.set_bg_opa(0)
-# watchface2_style_default.set_border_color(lv.color_make(0x00,0x00,0x00))
-# watchface2_style_default.set_border_width(0)
-# watchface2_style_default.set_border_opa(255)
-# watchface2_style_default.set_pad_left(0)
-# watchface2_style_default.set_pad_right(0)
-# watchface2_style_default.set_pad_top(0)
-# watchface2_style_default.set_pad_bottom(0)
-# watchface2_style_default.set_text_font_v2("font_22.bin",22,0) #将外部字体库与该style对象绑定
-
-watchface2_style_default = lv.style_t()
-watchface2_style_default.init()
-watchface2_style_default.set_text_color(lv.color_make(0xff, 0xff, 0xff))
-watchface2_style_default.set_text_font_v2("font_22.bin",22,0)
+
 
 
 #日期
 watchface2_date_span = lv.label(Watchface2)
-watchface2_date_span.set_pos(30+56+20+56, 100)
-watchface2_date_span.set_size(84, 35)
+watchface2_date_span.set_pos(30+56+20+6, 90)
+watchface2_date_span.set_size(240-(30+56+20+6), 35)
 watchface2_date_span.set_align(lv.TEXT_ALIGN.LEFT)
 watchface2_date_span.set_text("12月9日")
-watchface2_date_span.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface2_date_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 #星期
 
 
 watchface2_week = lv.img(Watchface2)
-watchface2_week.set_pos(int(30+15),int(y+20+56+56+30))
+watchface2_week.set_pos(int(30+56+20+25),int(y+56+30))
 watchface2_week.set_size(90,30)
 watchface2_week.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
 watchface2_week.set_src("E:/static/watch_plate/style_2/week/0_week.png")
@@ -364,34 +358,19 @@ watchface2_week.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEF
 
 
 
-#天气
-watchface2_temp_img = lv.img(Watchface2)
-watchface2_temp_img.set_pos(int(x+56+56+20),int(y+56+20))
-watchface2_temp_img.set_size(65,45)
-watchface2_temp_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface2_temp_img.set_src("E:/static/watch_plate/style_2/0_main2_weather.png")
-watchface2_temp_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface2_temp_degree = lv.img(Watchface2)
-watchface2_temp_degree.set_pos(int(x+56+56+65),int(215))
-watchface2_temp_degree.set_size(10,10)
-watchface2_temp_degree.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface2_temp_degree.set_src("E:/static/watch_plate/style_2/degree.png")
-watchface2_temp_degree.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface2_temp_txt = lv.label(Watchface2)
-watchface2_temp_txt.set_pos(int(x+56+56+39),int(215))
-watchface2_temp_txt.set_size(240-(x+56+56+34),30)
-watchface2_temp_txt.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_temp_txt.set_text("00")
-watchface2_temp_txt.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface2_no_temp_txt = lv.label(Watchface2)
-watchface2_no_temp_txt.set_pos(30+56+56+20, 176)
-watchface2_no_temp_txt.set_size(80, 35)
-watchface2_no_temp_txt.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_no_temp_txt.set_text("无数据")
-watchface2_no_temp_txt.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface2_step_img = lv.img(Watchface2)
+watchface2_step_img.set_pos(int(95),int(260))
+watchface2_step_img.set_size(26,21)
+watchface2_step_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+watchface2_step_img.set_src("E:/static/watch_plate/style_2/step.png")
+watchface2_step_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+watchface2_step_txt = lv.label(Watchface2)
+watchface2_step_txt.set_pos(125, 260)
+watchface2_step_txt.set_size(80, 35)
+watchface2_step_txt.set_align(lv.TEXT_ALIGN.LEFT)
+watchface2_step_txt.set_text("0")
+watchface2_step_txt.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 class WatchFace2():
     NAME = "Watchface2"
@@ -417,28 +396,8 @@ class WatchFace2():
         if time:
             self.__time(None, time)
 
-        connect = EventMesh.publish(constants.EVENT.GET_CONNECT) #获取网络状态
-        self.weather_data = EventMesh.publish("get_weather_data")
-        if connect == 1  and self.weather_data != None:
-            no_data = self.weather_data[8]
-            if no_data != 0:
-                type = self.weather_data[3]
-                if type == None:
-                    self.__weather_type(None,None)
-                else:
-                    self.__weather_type(None,type)
-
-                temp = self.weather_data[4]
-                if temp == None:
-                    self.__weather_value(None,None)
-                else:
-                   self.__weather_value(None,temp)
-            else:
-                self.__weather_type(None,None)
-                self.__weather_value(None,None)
-        else:
-            self.__weather_type(None,None)
-            self.__weather_value(None,None)
+        step = EventMesh.publish("get_old_step_value")
+        self.__stepValue(None, step)
 
 
     def timerout_update(self):
@@ -455,29 +414,9 @@ class WatchFace2():
         #print("publish_time:"+time)
         if time:
             self.__time(None, time)
-
-        connect = EventMesh.publish(constants.EVENT.GET_CONNECT) #获取网络状态
-        self.weather_data = EventMesh.publish("get_weather_data")
-        if connect != 0:
-            no_data = self.weather_data[8]
-            if no_data != 0:
-                type = self.weather_data[3]
-                if type == None:
-                    self.__weather_type(None,None)
-                else:
-                    self.__weather_type(None,type)
-
-                temp = self.weather_data[4]
-                if temp == None:
-                    self.__weather_value(None,None)
-                else:
-                   self.__weather_value(None,temp)
-            else:
-                self.__weather_type(None,None)
-                self.__weather_value(None,None)
-        else:
-            self.__weather_type(None,None)
-            self.__weather_value(None,None)
+        
+        step = EventMesh.publish("get_old_step_value")
+        self.__stepValue(None, step)
 
     def __time(self, event, msg):
         #时间
@@ -513,27 +452,33 @@ class WatchFace2():
 
         watchface2_res_stat_battery_img.set_src("E:/static/vbat_%d.png"%(msg[1]))#"E:/vbat_60.png"
         pass
-
-    def __weather_type(self, event, msg):
-        if msg == None:
-            watchface2_temp_img.add_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_no_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
+    def __stepValue(self, event, msg):
+        if msg == None:    
+            watchface2_step_txt.set_text("0")
         else:
-            type = int(msg)
-            watchface2_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_temp_img.clear_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_temp_img.set_src("E:/static/watch_plate/style_2/%d_main2_weather.png"%(type))
+            watchface2_step_txt.set_text(str(msg))
+
+
+    # def __weather_type(self, event, msg):
+    #     if msg == None:
+    #         watchface2_temp_img.add_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_no_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
+    #     else:
+    #         type = int(msg)
+    #         watchface2_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_temp_img.clear_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_temp_img.set_src("E:/static/watch_plate/style_2/%d_main2_weather.png"%(type))
     
-    def __weather_value(self, event, msg):
-        if msg == None:
-            watchface2_temp_degree.add_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_no_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
-        else:
-            watchface2_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_temp_degree.clear_flag(lv.obj.FLAG.HIDDEN)
-            watchface2_temp_txt.set_text(str(msg))
+    # def __weather_value(self, event, msg):
+    #     if msg == None:
+    #         watchface2_temp_degree.add_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_no_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
+    #     else:
+    #         watchface2_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_temp_degree.clear_flag(lv.obj.FLAG.HIDDEN)
+    #         watchface2_temp_txt.set_text(str(msg))
 
     def Close(self):
         pass  
index 4befb4a..23952b4 100644 (file)
@@ -802,18 +802,15 @@ class RestoreScreen(Screen):
         restore_confirm.add_event_cb(lambda e: self.confirm(e),lv.EVENT.CLICKED, None)
         restore_cancel.add_event_cb(lambda e: self.concel(e),lv.EVENT.CLICKED, None)
         
-
+    
     def confirm(self, e):
         ret = 0
         ret = ql_fs.path_exists("/ext/static/storage_file")#电话本
         if ret == True:
             ql_fs.rmdirs("/ext/static/storage_file")
             ql_fs.mkdirs("/ext/static/storage_file")
-        # [XT*334588000000156*0003*DLT]
+        EventMesh.publish("alipay_unbind")
         EventMesh.publish(constants.PROTOCOL.DLT_SEND)
-        
-        
-        # EventMesh.publish("load_screen", {"screen": "setting"})
 
     def concel(self, e):
         EventMesh.publish("load_screen", {"screen": "setting"})
@@ -930,8 +927,6 @@ class PoweroffScreen(Screen):
     def __init__(self):
         super().__init__()
         self.meta = poweroff_screen
-        self.timer = osTimer()
-        self.button_flag = 0
         poweroff_confirm_img.add_event_cb(lambda e: self.confirm(e),lv.EVENT.CLICKED, None)
         poweroff_return.add_event_cb(lambda e: self.concel(e),lv.EVENT.CLICKED, None)
 
@@ -971,8 +966,16 @@ class PoweroffConfirmScreen(Screen):
         super().__init__()
         self.meta = poweroff_confirm_screen
         self.timer = osTimer()
+        self.read_data = {}
     def initialization(self):
-        self.timer.start(2*1000,0,self.power_off)
+        step = EventMesh.publish("get_old_step_value")
+        if step != 0:
+            self.read_data = EventMesh.publish("get_storage_data")
+            self.read_data["old_step"] = step
+            EventMesh.publish("set_storage_data", self.read_data)
+            with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+                ujson.dump(self.read_data,fd)
+        self.timer.start(3*1000,0,self.power_off)
 
     def power_off(self,*args):
         Power.powerDown()
@@ -1034,6 +1037,7 @@ class DialswitchScreen(Screen):
     def watchface01(self,e):
         btn1_switch.add_state(lv.STATE.CHECKED)
         btn2_switch.clear_state(lv.STATE.CHECKED)
+        self.read_data = EventMesh.publish("get_storage_data")
         self.read_data["watchface"] = "Watchface1"
         EventMesh.publish("set_storage_data", self.read_data)
         with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
@@ -1045,6 +1049,7 @@ class DialswitchScreen(Screen):
     def watchface02(self,e):
         btn1_switch.clear_state(lv.STATE.CHECKED)
         btn2_switch.add_state(lv.STATE.CHECKED)
+        self.read_data = EventMesh.publish("get_storage_data")
         self.read_data["watchface"] = "Watchface2"
         EventMesh.publish("set_storage_data", self.read_data)
         with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd: