K01:
authordxy15521469561 <1731678236@qq.com>
Mon, 6 Nov 2023 12:16:34 +0000 (20:16 +0800)
committerdxy15521469561 <1731678236@qq.com>
Mon, 6 Nov 2023 12:16:34 +0000 (20:16 +0800)
UI优化

27 files changed:
2.sdk/project/C06S/ext/static/setting/menu_app_qrcode.png
2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/sleep_test.py
2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/Makefile
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/alarm.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/calculator.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/code.py [deleted file]
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/constants.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/main_init.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/mgr.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/pp_main.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/protocol.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_health.py [deleted file]
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_main_menu.py
2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_setting.py
2.sdk/project/K01/usr/static/00_WM.png [new file with mode: 0644]
2.sdk/project/K01/usr/static/01_WM.png [new file with mode: 0644]
2.sdk/project/K01/usr/static/02_WM.png [new file with mode: 0644]
2.sdk/project/K01/usr/static/03_WM.png [new file with mode: 0644]
2.sdk/project/K01/usr/static/04_WM.png [new file with mode: 0644]
2.sdk/project/K01/usr/static/DIAL_PREV01.png
2.sdk/project/K01/usr/static/bg.png
2.sdk/project/K01/usr/static/degree.png
2.sdk/project/K01/usr/static/pause.png [deleted file]
2.sdk/project/K01/usr/static/pp_friend04.png [new file with mode: 0644]

index 9096384..481a73c 100644 (file)
Binary files a/2.sdk/project/C06S/ext/static/setting/menu_app_qrcode.png and b/2.sdk/project/C06S/ext/static/setting/menu_app_qrcode.png differ
index 609a9e3..7fa9d09 100644 (file)
@@ -43,7 +43,7 @@ import ql_fs
 # hsensor.init()
 # hsensor.open_blood_oxygen()
 # utime.sleep(5)
-# PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, 0, 1)
+# PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_10US, 0, 1)
 # PWM_backlight.open()
 # hsensor.close()
 # tp_cst816.suspend()
index 3e626ed..4b85983 100644 (file)
@@ -1013,12 +1013,7 @@ class DeviceInfoManager(Abstract):
             sms_data = sms.getSaveLoc()
             sms_max = sms_data[0][2]
             if msg_nums >= sms_max-1:
-                self.sms_full_flag+=10
-                if self.sms_full_flag >= 60:
-                    self.sms_full_flag=0
-                    EventMesh.publish("remove_all_sms_cb")#
-            else:
-                self.sms_full_flag = 0
+                EventMesh.publish("remove_all_sms_cb")#
 
         """定时测量心率,血氧,体温"""
         WEAR = EventMesh.publish(constants.EVENT.GET_WEAR)#佩戴数据
index 76d9803..fcb2db7 100644 (file)
@@ -955,7 +955,6 @@ frozen_mpy_list =   $(BUILD)/_boot.mpy \
                                        $(BUILD)/appWechat.mpy \
                                        $(BUILD)/btn_device_ec800m.mpy \
                                        $(BUILD)/capacitive_hynitron_cst816d_update.mpy \
-                                       $(BUILD)/code.mpy \
                                        $(BUILD)/common.mpy \
                                        $(BUILD)/constants.mpy \
                                        $(BUILD)/EventMesh.mpy \
@@ -967,11 +966,9 @@ frozen_mpy_list =  $(BUILD)/_boot.mpy \
                                        $(BUILD)/ui_main_menu.mpy \
                                        $(BUILD)/ui_setting.mpy \
                                        $(BUILD)/ui_WatchFaceScreen.mpy \
-                                       $(BUILD)/ui_health.mpy \
                                        $(BUILD)/main_init.mpy \
                                        $(BUILD)/calculator.mpy \
                                        $(BUILD)/versions.mpy \
-                                       $(BUILD)/websocket_test.mpy \
                                        $(BUILD)/pp_main.mpy \
 
 endif
index 5775680..2045fdc 100644 (file)
@@ -1078,153 +1078,153 @@ class ClkListScreen(Screen):
 
 
 
-class NewEditClk(Screen):
-    NAME = "new_edit_clk"
+# class NewEditClk(Screen):
+#     NAME = "new_edit_clk"
 
-    def __init__(self):
-        super().__init__()
-        self.meta = clk_edit_screen
-        clk_edit_weekday.add_event_cb(lambda e: EventMesh.callback_wrapper(self.edit_weekday(e)), lv.EVENT.CLICKED, None)
-        clk_edit_time.add_event_cb(lambda e: EventMesh.callback_wrapper(self.edit_time(e)), lv.EVENT.CLICKED, None)
-        clk_delete_alarm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.delete_alarm(e)), lv.EVENT.CLICKED, None)
+#     def __init__(self):
+#         super().__init__()
+#         self.meta = clk_edit_screen
+#         clk_edit_weekday.add_event_cb(lambda e: EventMesh.callback_wrapper(self.edit_weekday(e)), lv.EVENT.CLICKED, None)
+#         clk_edit_time.add_event_cb(lambda e: EventMesh.callback_wrapper(self.edit_time(e)), lv.EVENT.CLICKED, None)
+#         clk_delete_alarm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.delete_alarm(e)), lv.EVENT.CLICKED, None)
 
-    def initialization(self):  
-        print("hahahahh",self.meta_info["idx"])
+#     def initialization(self):  
+#         print("hahahahh",self.meta_info["idx"])
 
-    def delete_alarm(self, e):
-        EventMesh.publish("remove_alarm",self.meta_info)
+#     def delete_alarm(self, e):
+#         EventMesh.publish("remove_alarm",self.meta_info)
 
-        EventMesh.publish("load_screen", {"screen": "clk_list"})
+#         EventMesh.publish("load_screen", {"screen": "clk_list"})
 
 
-    def edit_weekday(self,e):
-        self.load_screen(e, {"screen": "clk_period",
-                             "meta": self.meta_info})
+#     def edit_weekday(self,e):
+#         self.load_screen(e, {"screen": "clk_period",
+#                              "meta": self.meta_info})
 
-    def edit_time(self,e):
-        self.load_screen(e, {"screen": "clk_time",
-                             "meta": self.meta_info})
+#     def edit_time(self,e):
+#         self.load_screen(e, {"screen": "clk_time",
+#                              "meta": self.meta_info})
 
-    def done_return(self):
-        EventMesh.publish("load_screen", {"screen": "clk_list"})
+#     def done_return(self):
+#         EventMesh.publish("load_screen", {"screen": "clk_list"})
                
-    def btn1_release(self):
-        EventMesh.publish("load_screen", {"screen": "clk_list"})
+#     def btn1_release(self):
+#         EventMesh.publish("load_screen", {"screen": "clk_list"})
 
-    def btn8_press(self):
-        EventMesh.publish("load_screen", {"screen": "clk_list"})
+#     def btn8_press(self):
+#         EventMesh.publish("load_screen", {"screen": "clk_list"})
 
-class CLKTimeScreen(Screen):
-    NAME = "clk_time"
+# class CLKTimeScreen(Screen):
+#     NAME = "clk_time"
 
-    def __init__(self):
-        super().__init__()
-        self.meta = clk_time_screen
-        # alarm_ok.add_event_cb(lambda e: self.handler(e), lv.EVENT.PRESSED, None)
+#     def __init__(self):
+#         super().__init__()
+#         self.meta = clk_time_screen
+#         # alarm_ok.add_event_cb(lambda e: self.handler(e), lv.EVENT.PRESSED, None)
 
-    def initialization(self):
-        roll_1_v = self.meta_info["hour"]
-        roll_2_v = self.meta_info["minute"]
+#     def initialization(self):
+#         roll_1_v = self.meta_info["hour"]
+#         roll_2_v = self.meta_info["minute"]
         
-        clk_time_roller_1.set_selected(int(roll_1_v), lv.ANIM.ON)
-        clk_time_roller_2.set_selected(int(roll_2_v), lv.ANIM.ON)
-
-    def handler(self, e):
-        option_1 = " " * 10
-        option_2 = " " * 10
-        clk_time_roller_2.get_selected_str(option_2, len(option_2))
-        clk_time_roller_1.get_selected_str(option_1, len(option_1))
-        option_1_strip = option_1.strip()[:2]
-        option_2_strip = option_2.strip()[:2]
-        print("option_1_strip = {} option_2_strip = {}".format(option_1_strip, option_2_strip))
-        self.meta_info["hour"] = int(option_1_strip)
-        self.meta_info["minute"] = int(option_2_strip)
-        EventMesh.publish("push_clock_info", self.meta_info)
-
-        EventMesh.publish("load_screen", {"screen": "clk_list"})
-
-    def done_return(self):
-        EventMesh.publish("load_screen", {"screen": "clk_list"})
+#         clk_time_roller_1.set_selected(int(roll_1_v), lv.ANIM.ON)
+#         clk_time_roller_2.set_selected(int(roll_2_v), lv.ANIM.ON)
+
+#     def handler(self, e):
+#         option_1 = " " * 10
+#         option_2 = " " * 10
+#         clk_time_roller_2.get_selected_str(option_2, len(option_2))
+#         clk_time_roller_1.get_selected_str(option_1, len(option_1))
+#         option_1_strip = option_1.strip()[:2]
+#         option_2_strip = option_2.strip()[:2]
+#         print("option_1_strip = {} option_2_strip = {}".format(option_1_strip, option_2_strip))
+#         self.meta_info["hour"] = int(option_1_strip)
+#         self.meta_info["minute"] = int(option_2_strip)
+#         EventMesh.publish("push_clock_info", self.meta_info)
+
+#         EventMesh.publish("load_screen", {"screen": "clk_list"})
+
+#     def done_return(self):
+#         EventMesh.publish("load_screen", {"screen": "clk_list"})
                
-    def btn1_release(self):
-        EventMesh.publish("load_screen", {"screen": "clk_list"})
-
-    def btn8_press(self):
-        EventMesh.publish("load_screen", {"screen": "clk_list"})
-
-class ClkPeriod(Screen):
-    NAME = "clk_period"
-
-    def __init__(self):
-        super().__init__()
-        self.meta = clk_repeat_screen
-        self.choice_list=[]
-        self.alarm_info={}
-        self.clk_switch_list = [
-            clk_repeat_switch6,
-            clk_repeat_switch,
-            clk_repeat_switch1,
-            clk_repeat_switch2,
-            clk_repeat_switch3,
-            clk_repeat_switch4,
-            clk_repeat_switch5,
-
-        ]
-
-        clk_repeat_switch.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e,1)), lv.EVENT.VALUE_CHANGED, None)
-        clk_repeat_switch1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e,2)), lv.EVENT.VALUE_CHANGED, None)
-        clk_repeat_switch2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e,3)), lv.EVENT.VALUE_CHANGED, None)
-        clk_repeat_switch3.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e,4)), lv.EVENT.VALUE_CHANGED, None)
-        clk_repeat_switch4.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e,5)), lv.EVENT.VALUE_CHANGED, None)
-        clk_repeat_switch5.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e,6)), lv.EVENT.VALUE_CHANGED, None)
-        clk_repeat_switch6.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e,0)), lv.EVENT.VALUE_CHANGED, None)
-
-    def initialization(self):
-        self.choice_list = self.meta_info["days"]
-        self.alarm_info = self.meta_info
-        print("初始化:{},{}".format(self.alarm_info,self.choice_list))
-
-
-        for i in range(0,6):
-            if i in self.choice_list:
-                self.clk_switch_list[i].add_state(lv.STATE.CHECKED)
-
-            else:
-                self.clk_switch_list[i].clear_state(lv.STATE.CHECKED)
-
-
-    def save_choice(self,e,i):
-        if i in self.choice_list:
-            self.clk_switch_list[i].clear_state(lv.STATE.CHECKED)
-            self.choice_list.remove(i)
-            print("here1-----",self.choice_list,i)
-
-        else:
-            self.clk_switch_list[i].add_state(lv.STATE.CHECKED)
-            self.choice_list.append(i)
-            print("here2-----",self.choice_list,i)
-
-        print("here-----",self.choice_list)
-        self.alarm_info["days"] = self.choice_list
-
-        print("编辑星期:{}".format(self.alarm_info))
-        if self.alarm_info["days"] == []:
-            self.alarm_info["repeart"] = 1
-        else:
-            num = self.alarm_info["days"]
-            if len(num) >= 7:
-                self.alarm_info["repeart"] = 2
-            else:
-                self.alarm_info["repeart"] = 3
-
-        EventMesh.publish("push_clock_info", self.alarm_info)
-
-    def done_return(self):
-        EventMesh.publish("load_screen", {"screen": "clk_list"})
+#     def btn1_release(self):
+#         EventMesh.publish("load_screen", {"screen": "clk_list"})
+
+#     def btn8_press(self):
+#         EventMesh.publish("load_screen", {"screen": "clk_list"})
+
+# class ClkPeriod(Screen):
+#     NAME = "clk_period"
+
+#     def __init__(self):
+#         super().__init__()
+#         self.meta = clk_repeat_screen
+#         self.choice_list=[]
+#         self.alarm_info={}
+#         self.clk_switch_list = [
+#             clk_repeat_switch6,
+#             clk_repeat_switch,
+#             clk_repeat_switch1,
+#             clk_repeat_switch2,
+#             clk_repeat_switch3,
+#             clk_repeat_switch4,
+#             clk_repeat_switch5,
+
+#         ]
+
+#         clk_repeat_switch.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e,1)), lv.EVENT.VALUE_CHANGED, None)
+#         clk_repeat_switch1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e,2)), lv.EVENT.VALUE_CHANGED, None)
+#         clk_repeat_switch2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e,3)), lv.EVENT.VALUE_CHANGED, None)
+#         clk_repeat_switch3.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e,4)), lv.EVENT.VALUE_CHANGED, None)
+#         clk_repeat_switch4.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e,5)), lv.EVENT.VALUE_CHANGED, None)
+#         clk_repeat_switch5.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e,6)), lv.EVENT.VALUE_CHANGED, None)
+#         clk_repeat_switch6.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e,0)), lv.EVENT.VALUE_CHANGED, None)
+
+#     def initialization(self):
+#         self.choice_list = self.meta_info["days"]
+#         self.alarm_info = self.meta_info
+#         print("初始化:{},{}".format(self.alarm_info,self.choice_list))
+
+
+#         for i in range(0,6):
+#             if i in self.choice_list:
+#                 self.clk_switch_list[i].add_state(lv.STATE.CHECKED)
+
+#             else:
+#                 self.clk_switch_list[i].clear_state(lv.STATE.CHECKED)
+
+
+#     def save_choice(self,e,i):
+#         if i in self.choice_list:
+#             self.clk_switch_list[i].clear_state(lv.STATE.CHECKED)
+#             self.choice_list.remove(i)
+#             print("here1-----",self.choice_list,i)
+
+#         else:
+#             self.clk_switch_list[i].add_state(lv.STATE.CHECKED)
+#             self.choice_list.append(i)
+#             print("here2-----",self.choice_list,i)
+
+#         print("here-----",self.choice_list)
+#         self.alarm_info["days"] = self.choice_list
+
+#         print("编辑星期:{}".format(self.alarm_info))
+#         if self.alarm_info["days"] == []:
+#             self.alarm_info["repeart"] = 1
+#         else:
+#             num = self.alarm_info["days"]
+#             if len(num) >= 7:
+#                 self.alarm_info["repeart"] = 2
+#             else:
+#                 self.alarm_info["repeart"] = 3
+
+#         EventMesh.publish("push_clock_info", self.alarm_info)
+
+#     def done_return(self):
+#         EventMesh.publish("load_screen", {"screen": "clk_list"})
                
-    def btn1_release(self):
-        EventMesh.publish("load_screen", {"screen": "clk_list"})
+#     def btn1_release(self):
+#         EventMesh.publish("load_screen", {"screen": "clk_list"})
 
-    def btn8_press(self):
-        EventMesh.publish("load_screen", {"screen": "clk_list"})
+#     def btn8_press(self):
+#         EventMesh.publish("load_screen", {"screen": "clk_list"})
 
index 73d9c43..94cd22a 100644 (file)
@@ -2,7 +2,7 @@ import lvgl as lv
 import ql_fs
 import EventMesh
 from misc import Power
-from ui import style_screen,style_font_youyuan_20_black,style_btn,style_img,Screen,style_contact_btn,style_bar,style_bar_indic
+from ui import style_font_youyuan_20_red,style_white_screen,style_font_youyuan_20,style_screen,style_font_youyuan_20_black,style_btn,style_img,Screen,style_contact_btn,style_bar,style_bar_indic
 import constants
 import osTimer
 import audio
@@ -10,21 +10,83 @@ from machine import Pin
 import usys
 
 
+#style_font_youyuan_20_red.set_text_font_v2("font_28.bin",28,0)
+
 calculator_screen = lv.obj()
 print("calculator_screen")
 calculator_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
 calculator_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 # 创建文本框
+# calculator_label = lv.label(calculator_screen)
+# calculator_label.set_pos(0, 5)
+# calculator_label.set_size(200, 20)
+# calculator_label.set_text(" ")
+# calculator_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+# calculator_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+
+
+# calculator_new_screen = lv.obj(calculator_screen)
+# print("calculator_new_screen")
+# calculator_new_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+# calculator_new_screen.add_style(style_white_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+# calculator_new_screen.set_size(128, 32)
+# calculator_new_screen.set_pos(0, 0)
+
+# calculator_label = lv.label(calculator_new_screen)
+# calculator_label.set_text(" ")
+# calculator_label.set_base_dir(lv.BASE_DIR.RTL)#LV_BASE_DIR_LTR
+# calculator_label.add_style(style_font_youyuan_20_red, lv.PART.MAIN | lv.STATE.DEFAULT)
+
 calculator_label = lv.textarea(calculator_screen)
 calculator_label.set_one_line(True)  # 关闭1行模式
 calculator_label.set_size(128, 32)  # 设置宽高
-calculator_label.align(lv.ALIGN.TOP_MID, 0, -2)  # 设置位置
+# calculator_label.set_style_base_dir(lv.BASE_DIR.RTL,0)#LV_BASE_DIR_LTR
+calculator_label.align(lv.ALIGN.TOP_RIGHT,0,0)  # 设置位置LV_ALIGN_LEFT_MID CENTER LV_ALIGN_TOP_RIGHT
 calculator_label.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) #不显示滚动条
-#calculator_label.add_event_cb(lambda e: self.textarea_event_handler(e, ta), lv.EVENT.READY, None)  # 添加回调函数
-calculator_label.add_state(lv.STATE.FOCUSED)   # 设置光标
+calculator_label.set_cursor_click_pos(False)
+calculator_label.set_password_show_time(0)
+calculator_label.set_cursor_pos(0x7fff)
 calculator_label.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT)
 
+style_screen_ta_1_main_scrollbar_default = lv.style_t()
+style_screen_ta_1_main_scrollbar_default.init()
+style_screen_ta_1_main_scrollbar_default.set_radius(0)
+style_screen_ta_1_main_scrollbar_default.set_bg_color(lv.color_make(0x21,0x95,0xf6))
+style_screen_ta_1_main_scrollbar_default.set_bg_grad_color(lv.color_make(0x21,0x95,0xf6))
+style_screen_ta_1_main_scrollbar_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
+style_screen_ta_1_main_scrollbar_default.set_bg_opa(255)
+
+# add style for screen_ta_1
+calculator_label.add_style(style_screen_ta_1_main_scrollbar_default, lv.PART.SCROLLBAR|lv.STATE.DEFAULT)
+
+# create style style_screen_ta_1_main_main_default
+style_screen_ta_1_main_main_default = lv.style_t()
+style_screen_ta_1_main_main_default.init()
+style_screen_ta_1_main_main_default.set_radius(4)
+style_screen_ta_1_main_main_default.set_bg_color(lv.color_make(0xff,0xff,0xff))
+style_screen_ta_1_main_main_default.set_bg_grad_color(lv.color_make(0xff,0xff,0xff))
+style_screen_ta_1_main_main_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
+style_screen_ta_1_main_main_default.set_bg_opa(255)
+style_screen_ta_1_main_main_default.set_border_color(lv.color_make(0xe6,0xe6,0xe6))
+style_screen_ta_1_main_main_default.set_border_width(2)
+style_screen_ta_1_main_main_default.set_border_opa(255)
+style_screen_ta_1_main_main_default.set_text_color(lv.color_make(0x00,0x00,0x00))
+style_screen_ta_1_main_main_default.set_text_letter_space(2)
+style_screen_ta_1_main_main_default.set_text_align(lv.TEXT_ALIGN.RIGHT)
+style_screen_ta_1_main_main_default.set_pad_left(0)
+style_screen_ta_1_main_main_default.set_pad_right(0)
+style_screen_ta_1_main_main_default.set_pad_top(0)
+style_screen_ta_1_main_main_default.set_pad_bottom(0)
+
+# add style for screen_ta_1
+calculator_label.add_style(style_screen_ta_1_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+# # calculator_label = lv.label(calculator_label1)
+# # calculator_label.set_pos(0, 0)
+# # calculator_label.set_size(0, 0)
+# # calculator_label.set_text(" ")
+# # calculator_label.add_style(style_font_youyuan_20_red, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 calculator_num = lv.btnmatrix(calculator_screen)
 calculator_num.set_pos(int(0),int(30))
@@ -40,17 +102,17 @@ calculator_num.set_map(btnm_map)
 # create style style_calculator_num_main_default
 style_calculator_num_main_default = lv.style_t()
 style_calculator_num_main_default.init()
-style_calculator_num_main_default.set_radius(4)
+style_calculator_num_main_default.set_radius(0)
 style_calculator_num_main_default.set_bg_color(lv.color_make(0xff,0xff,0xff))
 style_calculator_num_main_default.set_bg_grad_color(lv.color_make(0xff,0xff,0xff))
 style_calculator_num_main_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
 style_calculator_num_main_default.set_bg_opa(255)
 style_calculator_num_main_default.set_border_color(lv.color_make(0xff,0xff,0xff))
-style_calculator_num_main_default.set_border_width(1)
+style_calculator_num_main_default.set_border_width(0)
 style_calculator_num_main_default.set_border_opa(255)
-style_calculator_num_main_default.set_pad_left(2)
+style_calculator_num_main_default.set_pad_left(0)
 style_calculator_num_main_default.set_pad_right(0)
-style_calculator_num_main_default.set_pad_top(2)
+style_calculator_num_main_default.set_pad_top(0)
 style_calculator_num_main_default.set_pad_bottom(0)
 style_calculator_num_main_default.set_pad_row(1)
 style_calculator_num_main_default.set_pad_column(1)
@@ -67,7 +129,7 @@ style_calculator_num_items_default.set_bg_grad_color(lv.color_make(0xe6,0xe6,0xe
 style_calculator_num_items_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
 style_calculator_num_items_default.set_bg_opa(255)
 style_calculator_num_items_default.set_border_color(lv.color_make(0xd6,0xdd,0xe3))
-style_calculator_num_items_default.set_border_width(1)
+style_calculator_num_items_default.set_border_width(0)
 style_calculator_num_items_default.set_border_opa(255)
 style_calculator_num_items_default.set_text_color(lv.color_make(0x00,0x00,0x00))
 try:
@@ -77,6 +139,16 @@ except AttributeError:
 
 # add style for calculator_num
 calculator_num.add_style(style_calculator_num_items_default, lv.PART.ITEMS|lv.STATE.DEFAULT)
+
+waring_label = lv.label(calculator_screen)
+waring_label.set_pos(0, 55)
+waring_label.set_size(128, 20)
+waring_label.set_text("最大位数为10个")
+waring_label.add_style(style_font_youyuan_20_red, lv.PART.MAIN | lv.STATE.DEFAULT)
+waring_label.set_long_mode(lv.label.LONG.CLIP)
+waring_label.add_flag(lv.obj.FLAG.HIDDEN)
+waring_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+
 def my_round(src,  idx):
     src_flag = 1 #正负数
     if src < 0:
@@ -84,7 +156,7 @@ def my_round(src,  idx):
     src = abs(src)
     tmp_str = "{}".format(src)
     tmp_str_l= tmp_str.split(".")
-    print("tmp_str1:{} {}".format(tmp_str,tmp_str_l))
+    # print("tmp_str1:{} {}".format(tmp_str,tmp_str_l))
     if len(tmp_str_l)>1 :
         if len(tmp_str_l[1]) > idx:
             for i in range(idx):
@@ -92,7 +164,7 @@ def my_round(src,  idx):
             dest = int(src)
             if src >= dest+0.5 :
                 dest += 1
-            print("dest:{}".format(dest))
+            # print("dest:{}".format(dest))
             tmp_str = "{}".format(dest)
             if len(tmp_str) > idx:
                 tmp_str = tmp_str[:len(tmp_str)-idx]+'.'+tmp_str[len(tmp_str)-idx:]
@@ -100,14 +172,14 @@ def my_round(src,  idx):
                 zero_str = ""
                 for j in range(idx-len(tmp_str)):
                     zero_str += "0" 
-                print("zero_str:{}".format(zero_str))
+                # print("zero_str:{}".format(zero_str))
                 tmp_str = '0.'+zero_str+tmp_str
             tmp_str = tmp_str.rstrip('0')#去掉尾数的 0
             if "." in tmp_str:
                 tmp_str = tmp_str.rstrip('.')#去掉尾数的 .
             # for i in range(idx):
             #     dest /=10
-            print("tmp_str:{}".format(tmp_str))
+            # print("tmp_str:{}".format(tmp_str))
     if src_flag == 0 :
         tmp_str = "-" + tmp_str
     return tmp_str
@@ -120,25 +192,38 @@ class calculatorScreen(Screen):
         super().__init__()
         self.meta = None
         self.calculator_num = ''
+        self.calculator_buf1 = ''
+        self.calculator_buf2 = ''
         self.calculator_list = []
         self.button = 0
         self.timer = osTimer()
         self.timer_cb = 0
         self.count = 0
         self.str = ""
+        self.equal = ''
         calculator_num.add_event_cb(lambda e: self.calculator_event_cb(e,calculator_num), lv.EVENT.VALUE_CHANGED, None)
-        self.calculator_flag = 0
-        self.result = ""
+        self.calculator_flag = ''
+        self.result = ''
         self.num_count = 0 #限制输入位数 20位
     def initialization(self):
-        
+        self.result = ''
+        self.calculator_buf1 = ''
+        self.calculator_buf2 = ''
+        self.equal = ''
+        self.str = ''
+        self.calculator_flag = ''
+        waring_label.add_flag(lv.obj.FLAG.HIDDEN)
+        calculator_label.clear_flag(lv.obj.FLAG.HIDDEN)
+        calculator_label.set_text(" ")
         self.meta = calculator_screen
+        
 
     def calculator_eval(self,str):
         print("calculator_eval:str{}".format)
         try :  
             num = eval(str)
             ret = "{}".format((my_round(num,8))) #只保留小数点8位
+            print("calcutlor result:",ret)
             # tmp = ret.split('.')
             # if len(tmp) > 1:
             #     if len(tmp[1]) > 8 : #保留小数点失败
@@ -150,15 +235,25 @@ class calculatorScreen(Screen):
             usys.print_exception(e)
             e_tmp = "{}".format(e)
             if e_tmp.find("divide by zero") != -1 :
+                waring_label.add_flag(lv.obj.FLAG.HIDDEN)
+                calculator_label.clear_flag(lv.obj.FLAG.HIDDEN)
                 calculator_label.set_text("除数不能为0")
             elif e_tmp.find("invalid syntax") != -1 :
                 EventMesh.txt_log("calculator:{} {}".format(self.calculator_flag,self.str))
+                waring_label.add_flag(lv.obj.FLAG.HIDDEN)
+                calculator_label.clear_flag(lv.obj.FLAG.HIDDEN)
                 calculator_label.set_text("无效语法")
             else :
                 EventMesh.txt_log("calculator:{} {}".format(self.calculator_flag,self.str))
+                waring_label.add_flag(lv.obj.FLAG.HIDDEN)
+                calculator_label.clear_flag(lv.obj.FLAG.HIDDEN)
                 calculator_label.set_text("运算异常")
             self.str = ""
-            self.calculator_flag = 0
+            self.result = ''
+            self.calculator_buf2 = ''
+            self.calculator_buf1 = ''
+            self.calculator_flag = ''
+            self.equal = ''
             return  -1
     def calculator_event_cb(self,e,calculator_num):
         src = e.get_target()
@@ -168,108 +263,407 @@ class calculatorScreen(Screen):
             txt = src.get_btn_text(src.get_selected_btn())  # 获取被点击的按钮的内容
             try :    
                 if txt == "<-":  # 如果是退格键,那么就删除1个字符
-                    if self.calculator_flag != 2  :
-                        if len(self.str) > 1:
-                            str_tmp = self.str[-1]
-                            if  str_tmp == "/" or str_tmp == "*" or str_tmp == "-" or str_tmp == "+" : #最后一个是运算符
-                                self.calculator_flag = 0 
-                            self.str = self.str[0:-1]
-                        else :
-                            self.str = ""
-                            self.calculator_flag = 0
-                    if self.num_count > 0 :
-                        self.num_count-=1
-                    #calculator_label.del_char()
+                    if self.equal == '=':
+                        return
+                    if self.calculator_buf1 != '':
+                        if self.calculator_flag != '':
+                            if self.calculator_buf2 != '':
+                                data_str = list(self.calculator_buf2)
+                                data_tmp = data_str.pop()
+                                self.calculator_buf2 = ''.join(data_str)
+                                self.str =  self.calculator_buf1+self.calculator_flag+self.calculator_buf2
+                            else:
+                                data_str = list(self.calculator_flag)
+                                data_tmp = data_str.pop()
+                                self.calculator_flag = ''.join(data_str)
+                                self.str = self.calculator_buf1+self.calculator_flag
+                        else:
+                            data_str = list(self.calculator_buf1)
+                            
+                            data_tmp = data_str.pop()
+                            self.calculator_buf1 = ''.join(data_str)
+                            print("data_str",data_str,data_tmp,self.calculator_buf1)
+                            self.str = self.calculator_buf1
+
                 elif txt == "C": #清除键
+                    self.equal = ''
                     self.num_count = 0
                     self.str = ""
-                    calculator_label.set_text("")
-                    self.calculator_flag = 0
+                    self.calculator_buf1 = ''
+                    self.calculator_buf2 = ''
+                    self.calculator_flag = ''
+                    self.result = ''
+                    waring_label.add_flag(lv.obj.FLAG.HIDDEN)
+                    calculator_label.clear_flag(lv.obj.FLAG.HIDDEN)
+                    calculator_label.set_text(" ")
+                    
+
                 elif txt == "=" :
-                    if(self.calculator_flag == 1): #有运算符
-                        str_tmp = self.str[-1]
-                        if  str_tmp == "/" or str_tmp == "*" or str_tmp == "-" or str_tmp == "+" : #最后一个是运算符
-                            return
-                        else:
-                            self.num_count = 0
-                            self.result = self.calculator_eval(self.str)
-                            if self.result == -1:
+                    # if self.result != '':
+                    #     self.calculator_buf1=self.result
+                    #     self.calculator_flag=''
+                    #     self.calculator_buf2 = ''
+                    #     self.str = self.calculator_buf1
+                    # else:
+                    print("self.calculator_flag",self.calculator_flag)
+                    if self.calculator_flag == '/':
+                        if self.calculator_buf2 != '':
+                            if self.calculator_buf2.find('.') != -1:
+                                data = self.calculator_buf2.split('.')[1]
+                                if len(data) == 0:
+                                    self.calculator_buf2 = self.calculator_buf2.split('.')[0]
+                            if float(self.calculator_buf2) == 0.0 or float(self.calculator_buf2) == 0:
+                                self.timer.stop()
+                                self.timer.start(2000,0,self.refresh_line)
+                                waring_label.clear_flag(lv.obj.FLAG.HIDDEN)
+                                waring_label.set_text("除数不能为0")
                                 return
-                            self.str += txt+self.result
-                    self.calculator_flag = 2
-                elif txt == "%" :
-                    str_tmp = self.str[-1]
-                    if  str_tmp == "/" or str_tmp == "*" or str_tmp == "-" or str_tmp == "+" : #最后一个是运算符
-                        self.str = self.str[:-1]
+
+                    self.equal = '='
                     
-                    self.num_count = 0
-                    self.result = self.calculator_eval(self.str+"/100")
-                    if self.result == -1:
-                        return
-                    self.str += txt+"="+self.result
-                    self.calculator_flag = 2
-                elif txt == "/" or txt == "*" or txt == "-" or txt == "+" :  # 如果是符号,就运算
-                    self.num_count = 0
-                    if self.calculator_flag == 0:#无运算符
-                        if len(self.str) == 0: #开头不能为运算符
-                            return
-                        self.calculator_flag = 1
-                        self.str +=  txt
-                    elif self.calculator_flag == 1 :     #有运算符
-                        str_tmp = self.str[-1]
-                        if  str_tmp == "/" or str_tmp == "*" or str_tmp == "-" or str_tmp == "+" : #最后一个是运算符
-                            self.str = self.str[:-1]+txt
-                            
-                        elif str_tmp == ".": #最后一个是.,去除再运算
-                            self.str = self.str[0:-1]
-                            self.result = self.calculator_eval(self.str)
-                            if self.result == -1:
+                    if self.calculator_buf1 != '':
+                        if self.calculator_flag != '':
+                            if self.calculator_buf2 != '':
+                                self.str = self.calculator_buf1+self.calculator_flag+self.calculator_buf2
+                                self.result = self.calculator_eval(self.str)
+                                self.calculator_buf1=self.result
+                                self.calculator_flag=''
+                                self.calculator_buf2 = ''
+                                self.str = self.calculator_buf1
+
+                            else:
+                                self.result  = self.calculator_buf1
+                                self.calculator_flag = ''
+                                self.calculator_buf2 = ''
+                                self.str = self.calculator_buf1
+                        else:
+                            self.result  = self.calculator_buf1
+                            self.calculator_flag = ''
+                            self.calculator_buf2 = ''
+                            self.str = self.calculator_buf1
+
+                elif txt == "%" :
+                    if self.calculator_flag == '/':
+                        if self.calculator_buf2 != '':
+                            if self.calculator_buf2.find('.') != -1:
+                                data = self.calculator_buf2.split('.')[1]
+                                if len(data) == 0:
+                                    self.calculator_buf2 = self.calculator_buf2.split('.')[0]
+                            if float(self.calculator_buf2) == 0.0 or float(self.calculator_buf2) == 0:
+                                self.timer.stop()
+                                self.timer.start(2000,0,self.refresh_line)
+                                waring_label.clear_flag(lv.obj.FLAG.HIDDEN)
+                                waring_label.set_text("除数不能为0")
                                 return
-                            self.str = self.result+txt
-                        else :
+                    self.equal = '%'
+                    if self.calculator_buf1 != '':
+                        if self.calculator_flag != '':
+                            if self.calculator_buf2 != '':
+                                if self.calculator_buf2.find('.') != -1:
+                                    data = self.calculator_buf2.split('.')[1]
+                                    if len(data) == 0:
+                                        self.calculator_buf2 = self.calculator_buf2.split('.')[0]
+                                self.str = self.calculator_buf1+self.calculator_flag+self.calculator_buf2
+                                dat_tmp = self.calculator_eval(self.str)
+                                self.result = self.calculator_eval(dat_tmp+'/100')
+                            
+                                self.calculator_buf1 = self.result
+                                self.calculator_flag = ''
+                                self.calculator_buf2 = ''
+                                self.str = self.calculator_buf1
+                            else:
+                                self.str = self.calculator_buf1+"/100"
+                                self.result = self.calculator_eval(self.str)
+                                self.calculator_buf1 = self.result
+                                self.calculator_flag = ''
+                                self.calculator_buf2 = ''
+                                self.str = self.calculator_buf1
+                        else:
+                            if self.calculator_buf1.find('.') != -1:
+                                data = self.calculator_buf1.split('.')[1]
+                                if len(data) == 0:
+                                    self.calculator_buf1 = self.calculator_buf1.split('.')[0]
+
+                            self.str = self.calculator_buf1+"/100"
                             self.result = self.calculator_eval(self.str)
-                            if self.result == -1:
-                                return
-                            self.str = self.result+txt
-                    elif self.calculator_flag == 2 : #已经运算了一次
-                        self.str = self.result + txt
-                        self.calculator_flag = 1
+                            self.calculator_buf1 = self.result
+                            self.calculator_flag = ''
+                            self.calculator_buf2 = ''
+                            self.str = self.calculator_buf1
+
+
+                elif txt == "/" or txt == "*" or txt == "-" or txt == "+" :  # 如果是符号,就运算
+                    # print("result",txt,self.result)
+                    self.equal = txt
+                    if self.calculator_buf1 != '':
+                        if self.calculator_buf1.find('.') != -1:
+                            data = self.calculator_buf1.split('.')[1]
+                            if len(data) == 0:
+                                self.calculator_buf1 = self.calculator_buf1.split('.')[0]
+
+                        if self.calculator_flag != '':
+                            if self.calculator_buf2 != '':#第二个数据不为空,则运算结果
+                                
+                                if self.calculator_buf2.find('.') != -1:
+                                    data = self.calculator_buf2.split('.')[1]
+                                    if len(data) == 0:
+                                        self.calculator_buf2 = self.calculator_buf2.split('.')[0]
+                                if txt == '/' or self.calculator_flag == '/':
+
+                                    if float(self.calculator_buf2) == 0.0 or float(self.calculator_buf2) == 0:
+                                        self.timer.stop()
+                                        self.timer.start(2000,0,self.refresh_line)
+                                        waring_label.clear_flag(lv.obj.FLAG.HIDDEN)
+                                        waring_label.set_text("除数不能为0")
+                                        # calculator_label.add_flag(lv.obj.FLAG.HIDDEN)
+                                        return
+                                self.calculator_flag = txt
+                                self.str =  self.calculator_buf1+self.calculator_flag+self.calculator_buf2
+                                self.result = self.calculator_eval(self.str)
+                                self.calculator_buf1 = self.result
+                                self.calculator_flag = ''
+                                self.calculator_buf2 = ''
+                                self.str = self.calculator_buf1
+                            else:#第二个数据为空不算结果 直接显示最新的符号
+                                self.calculator_flag = str(txt)
+                                self.str =  self.calculator_buf1+self.calculator_flag
+                            
+                        else:
+                            self.calculator_flag = str(txt)
+                            self.str = self.calculator_buf1+self.calculator_flag
+                    
                 elif txt == ".":
-                    if self.num_count >=20:
-                        return
-                    self.num_count += 1 
-                    str_tmp = self.str[-1]
-                    if str_tmp == "." :#最后一个是. 不再添加
-                        pass
-                    elif str_tmp == "/" or str_tmp == "*" or str_tmp == "-" or str_tmp == "+": #最后一个是符号 前面加一个0
-                        self.str = self.str + "0"+ txt
-                    else :
-                        self.str+=txt 
+                    self.equal = txt
+                    if self.result != '':
+                        if self.calculator_flag == '':
+                            self.result = ''
+                            self.calculator_buf1 = ''
+                            self.calculator_buf2 = ''
+                            self.str = ''
+                            self.calculator_flag = ''
+
+                    if self.calculator_buf1 == '':
+                        self.calculator_buf1+='0.'
+                        self.str = self.calculator_buf1
+                    else:
+                        if self.calculator_flag == '':#没有特殊字符 + - / * 一直会将数字添加到数字1中 否则添加到数字2中
+                            if len(self.calculator_buf1) >= 10:
+                                self.timer.stop()
+                                self.timer.start(2000,0,self.refresh_line) 
+                                waring_label.clear_flag(lv.obj.FLAG.HIDDEN)
+                                waring_label.set_text("最大位数为10个")
+                                # calculator_label.add_flag(lv.obj.FLAG.HIDDEN)
+                                return
+                            if self.calculator_buf1.find('.') == -1:#数据1有点了不再加点了直接相加
+                                self.calculator_buf1+=txt
+                            
+
+                            self.str = self.calculator_buf1+self.calculator_flag
+                            
+                        else:
+                            if self.calculator_buf2 != '':
+                                if len(self.calculator_buf2) >= 10:
+                                    self.timer.stop()
+                                    self.timer.start(2000,0,self.refresh_line) 
+                                    waring_label.clear_flag(lv.obj.FLAG.HIDDEN)
+                                    waring_label.set_text("最大位数为10个")
+                                    # calculator_label.add_flag(lv.obj.FLAG.HIDDEN)
+                                    return
+                                if self.calculator_buf2.find('.') == -1:#数据1有点了不再加点了直接相加
+                                    self.calculator_buf2+=txt
+
+                                self.str = self.calculator_buf1+self.calculator_flag+self.calculator_buf2
+                                
+                            else:# 0 0. 122121
+                                self.calculator_buf2=self.calculator_buf2+'0.'
+                                self.str = self.calculator_buf1+self.calculator_flag+self.calculator_buf2
+
                 elif txt:#数字
-                    if self.num_count >=20:
-                        return
-                    self.num_count += 1 
-                    #calculator_label.add_text(txt)  # 如果不是回车键,那么就将当前数字显示到文本框
-                    self.str+=txt
-                    if self.calculator_flag == 2 :
-                        self.str=txt
-                        self.calculator_flag = 0 
+                    self.equal = txt
+                    if self.result != '':
+                        if self.calculator_flag == '':
+                            self.result = ''
+                            self.calculator_buf1 = ''
+                            self.calculator_buf2 = ''
+                            self.str = ''
+                            self.calculator_flag = ''
+
+                    if self.calculator_buf1 == '':
+                        if txt == '0':
+                            self.calculator_buf1+='0'
+                        else:
+                            self.calculator_buf1+=txt
+                        self.str = self.calculator_buf1
+                    else:
+                        if self.calculator_flag == '':#没有特殊字符 + - / * 一直会将数字添加到数字1中 否则添加到数字2中
+                            if len(self.calculator_buf1) >= 10:
+                                self.timer.stop()
+                                self.timer.start(2000,0,self.refresh_line) 
+                                waring_label.clear_flag(lv.obj.FLAG.HIDDEN)
+                                waring_label.set_text("最大位数为10个")
+                                # calculator_label.add_flag(lv.obj.FLAG.HIDDEN)
+                                return
+                            if len(self.calculator_buf1) == 1:#0
+                                if self.calculator_buf1 == '0':
+                                    self.calculator_buf1 = txt
+                                else:
+                                    self.calculator_buf1+=txt
+                            else:
+                                self.calculator_buf1+=txt
+                            self.str = self.calculator_buf1
+                            
+                        else:
+                            if self.calculator_buf2 != '':
+                                if len(self.calculator_buf2) >= 10:
+                                    self.timer.stop()
+                                    self.timer.start(2000,1,self.refresh_line) 
+                                    waring_label.clear_flag(lv.obj.FLAG.HIDDEN)
+                                    waring_label.set_text("最大位数为10个")
+                                    # calculator_label.add_flag(lv.obj.FLAG.HIDDEN)
+                                    return
+                                if len(self.calculator_buf2) == 1:
+                                    if self.calculator_buf2 == '0':
+                                        self.calculator_buf2 = txt
+                                    else:
+                                        self.calculator_buf2+=txt
+                                else:
+                                    self.calculator_buf2+=txt
+                                # self.str = self.calculator_buf1+self.calculator_flag+self.calculator_buf2
+                                self.str = self.calculator_buf1+self.calculator_flag+self.calculator_buf2
+                                
+                            else:# 0 0. 122121
+                                if txt == "0":#0 2
+                                    if self.calculator_buf2.find('.') != -1:
+                                        self.calculator_buf2+=txt
+                                    else:
+                                        if len(self.calculator_buf2) > 1:#0.0 
+                                            self.calculator_buf2=self.calculator_buf2+txt
+                                        else:#0.
+                                            self.calculator_buf2=self.calculator_buf2+'0'
+                                else:
+                                    self.calculator_buf2+=txt
+                                # self.str = self.calculator_buf1+self.calculator_flag+self.calculator_buf2
+                                self.str = self.calculator_buf1+self.calculator_flag+self.calculator_buf2
+
+                # print("self.str",self.str,self.calculator_buf1,self.calculator_buf2,self.calculator_flag,self.result)
+                waring_label.add_flag(lv.obj.FLAG.HIDDEN)
                 calculator_label.set_text(self.str)
+            
+                # if txt == "<-":  # 如果是退格键,那么就删除1个字符
+                #     if self.calculator_flag != 2  :
+                #         if len(self.str) > 1:
+                #             str_tmp = self.str[-1]
+                #             if  str_tmp == "/" or str_tmp == "*" or str_tmp == "-" or str_tmp == "+" : #最后一个是运算符
+                #                 self.calculator_flag = 0 
+                #             self.str = self.str[0:-1]
+                #         else :
+                #             self.str = ""
+                #             self.calculator_flag = 0
+                #     if self.num_count > 0 :
+                #         self.num_count-=1
+                #     #calculator_label.del_char()
+                # elif txt == "C": #清除键
+                #     self.num_count = 0
+                #     self.str = ""
+                #     calculator_label.set_text("")
+                #     self.calculator_flag = 0
+                # elif txt == "=" :
+                #     if(self.calculator_flag == 1): #有运算符
+                #         str_tmp = self.str[-1]
+                #         if  str_tmp == "/" or str_tmp == "*" or str_tmp == "-" or str_tmp == "+" : #最后一个是运算符
+                #             return
+                #         else:
+                #             self.num_count = 0
+                #             self.result = self.calculator_eval(self.str)
+                #             if self.result == -1:
+                #                 return
+                #             self.str += txt+self.result
+                #     self.calculator_flag = 2
+                # elif txt == "%" :
+                #     str_tmp = self.str[-1]
+                #     if  str_tmp == "/" or str_tmp == "*" or str_tmp == "-" or str_tmp == "+" : #最后一个是运算符
+                #         self.str = self.str[:-1]
+                    
+                #     self.num_count = 0
+                #     self.result = self.calculator_eval(self.str+"/100")
+                #     if self.result == -1:
+                #         return
+                #     self.str += txt+"="+self.result
+                #     self.calculator_flag = 2
+                # elif txt == "/" or txt == "*" or txt == "-" or txt == "+" :  # 如果是符号,就运算
+                #     self.num_count = 0
+                #     if self.calculator_flag == 0:#无运算符
+                #         if len(self.str) == 0: #开头不能为运算符
+                #             return
+                #         self.calculator_flag = 1
+                #         self.str +=  txt
+                #     elif self.calculator_flag == 1 :     #有运算符
+                #         str_tmp = self.str[-1]
+                #         if  str_tmp == "/" or str_tmp == "*" or str_tmp == "-" or str_tmp == "+" : #最后一个是运算符
+                #             self.str = self.str[:-1]+txt
+                            
+                #         elif str_tmp == ".": #最后一个是.,去除再运算
+                #             self.str = self.str[0:-1]
+                #             self.result = self.calculator_eval(self.str)
+                #             if self.result == -1:
+                #                 return
+                #             self.str = self.result+txt
+                #         else :
+                #             self.result = self.calculator_eval(self.str)
+                #             if self.result == -1:
+                #                 return
+                #             self.str = self.result+txt
+                #     elif self.calculator_flag == 2 : #已经运算了一次
+                #         self.str = self.result + txt
+                #         self.calculator_flag = 1
+                # elif txt == ".":
+                #     if self.num_count >=20:
+                #         return
+                #     self.num_count += 1 
+                #     str_tmp = self.str[-1]
+                #     if str_tmp == "." :#最后一个是. 不再添加
+                #         pass
+                #     elif str_tmp == "/" or str_tmp == "*" or str_tmp == "-" or str_tmp == "+": #最后一个是符号 前面加一个0
+                #         self.str = self.str + "0"+ txt
+                #     else :
+                #         self.str+=txt 
+                # elif txt:#数字
+                #     if self.num_count >=20:
+                #         return
+                #     self.num_count += 1 
+                #     #calculator_label.add_text(txt)  # 如果不是回车键,那么就将当前数字显示到文本框
+                #     self.str+=txt
+                #     if self.calculator_flag == 2 :
+                #         self.str=txt
+                #         self.calculator_flag = 0 
+                # calculator_label.set_text(self.str)
             except Exception as e:
                 usys.print_exception(e)
                 e_tmp = "{}".format(e)
                 if e_tmp.find("divide by zero") != -1 :
+                    waring_label.add_flag(lv.obj.FLAG.HIDDEN)
+                    calculator_label.clear_flag(lv.obj.FLAG.HIDDEN)
                     calculator_label.set_text("0不能为除数")
                     self.str = ""
-                    self.calculator_flag = 0
+                    self.equal = ''
+                    self.result = ''
+                    self.calculator_buf1 = ''
+                    self.calculator_buf2 = ''
+                    self.calculator_flag = ''
                 else :
                     EventMesh.txt_log("calculator:{} {} {}".format(self.calculator_flag,self.str,txt))
+                    waring_label.add_flag(lv.obj.FLAG.HIDDEN)
+                    calculator_label.clear_flag(lv.obj.FLAG.HIDDEN)
                     calculator_label.set_text("运算异常")
                     self.str = ""
-                    self.calculator_flag = 0
+                    self.equal = ''
+                    self.result = ''
+                    self.calculator_buf1 = ''
+                    self.calculator_buf2 = ''
+                    self.calculator_flag = ''
                 #print("ui_queue_thread:ERROR:{}".format(e))
             
-            print("calculator_clicked:flag:{} str{} ".format(self.calculator_flag,self.str)) 
+            # print("calculator_clicked:flag:{} str{} ".format(self.calculator_flag,self.str)) 
          
 
 
@@ -277,14 +671,17 @@ class calculatorScreen(Screen):
         if self.timer_cb != 0:
             self.timer_cb = 0
             #self.timer.start(1000,1,self.refresh_line) 
-    
+    def refresh_line(self,*argc):
+        waring_label.add_flag(lv.obj.FLAG.HIDDEN)
+        calculator_label.clear_flag(lv.obj.FLAG.HIDDEN)
+        
     def lcd_off(self):
         self.timer_cb = 1
         self.timer.stop() 
 
 
     def done_return(self):
-        EventMesh.publish("load_screen", {"screen": "main_menu"})
+        EventMesh.publish("load_screen", {"screen": "toolbox"})
 
     def btn1_release(self):
         EventMesh.publish("load_screen", {"screen": "main_menu"})
diff --git a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/code.py b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/code.py
deleted file mode 100644 (file)
index 3f9b53c..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-import lvgl as lv
-import code128
-# 界面风格1
-# style_bar = lv.style_t()
-# style_bar.init()
-# style_bar.set_border_width(0)
-# style_bar.set_radius(0)
-# style_bar.set_pad_top(0)
-# style_bar.set_pad_bottom(0)
-# style_bar.set_pad_left(0)
-# style_bar.set_pad_right(0)
-style_bar = lv.style_t()
-style_bar.init()
-style_bar.set_radius(0)
-style_bar.set_bg_color(lv.color_make(0x00, 0x00, 0x00))
-style_bar.set_bg_opa(255)
-style_bar.set_border_width(0)
-style_bar.set_pad_left(0)
-style_bar.set_pad_right(0)
-style_bar.set_pad_top(0)
-style_bar.set_pad_bottom(0)
-#screen = lv.obj()
-
-
-
-def code_128_generate_barcode(screen, data, width=180, height=80):
-   
-    left_curr_line = 0
-
-    # 删除上次的container
-    old_container = screen.get_child(-1)
-    if old_container:
-        old_container.delete()
-
-    # 生成二进制码
-    binary_data = code128.encode(data)
-    if not binary_data:
-        return
-    # print("binary_data is ",binary_data)
-
-    # 在LVGL中创建一个容器对象
-    container = lv.obj(screen)
-    container.set_size(width, height)
-    container.set_pos(0, 33)
-    container.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-    container.add_style(style_bar,lv.PART.MAIN | lv.STATE.DEFAULT)
-
-    # 计算每个条的宽度
-    bar_width = width // (len(binary_data))
-    # print("bar_width is :{} len(binary_data):{}".format(bar_width,len(binary_data)))
-    # 按照二进制码中的1和0,分别创建LVGL矩形对象
-    for i in range(len(binary_data)):
-        # print("left_curr_line is :{} width:{}".format(left_curr_line,width))
-        bar = lv.obj(container)
-        bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT)
-        real_width = bar_width * 1
-        bar.set_size(1,90)
-        left = (width - len(binary_data))//2#240-152 = 88 //2 ==44
-        bar.set_pos(left+left_curr_line,0)
-        if binary_data[i] == 0xff:
-            bar.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff), lv.PART.MAIN | lv.STATE.DEFAULT)
-        else:
-            bar.set_style_bg_color(lv.color_make(0x00, 0x00, 0x00), lv.PART.MAIN | lv.STATE.DEFAULT)
-        left_curr_line += real_width
-
-
-# if __name__ == "__main__":
-#     code_39_generate_barcode(screen,"A123 321")
-#     lv.scr_load(screen)
-
index 878752d..e4541a3 100644 (file)
@@ -93,8 +93,20 @@ class PROTOCOL:
     PP_SEND = "PP_SEND"
     PP_RECV = "PP_RECV"
 
-    PP_INFOR_SEND = "pp_SEND"
-    PP_INFOR_RECV = "pp_RECV"
+    MFCODE_FRIEND_DEL_REQ_SEND = "MFCODE_FRIEND_DEL_REQ_SEND"
+    MFCODE_FRIEND_DEL_REQ_RECV = "MFCODE_FRIEND_DEL_REQ_RECV"
+
+    MFCODE_FRIEND_REQ_SEND = "MFCODE_FRIEND_REQ_SEND"
+    MFCODE_FRIEND_REQ_RECV = "MFCODE_FRIEND_REQ_RECV"
+
+    MFCODE_FRIEND_SEND = "MFCODE_FRIEND_SEND"
+    MFCODE_FRIEND_RECV = "MFCODE_FRIEND_RECV"
+
+    FACTORY_SEND = "FACTORY_SEND"
+    FACTORY_RECV = "FACTORY_RECV"
+
+    RESET_SEND = "RESET_SEND"
+    RESET_RECV = "RESET_RECV"
 
 
 class EVENT:
index 4852f45..5289a66 100644 (file)
@@ -58,10 +58,10 @@ def main_init():
     from appFactoryMode import  FactoryModeLocationScreen,FactoryModeScreen ,FactoryModeBatTestScreen
     import ui as _ui
 
-    from mgr import cameraAlbumManager,setclassTimeManager,setkeyboardManager,testSmsSetIPManager,ConfigStoreManager,sosInfoCallManager,getBootOffManager,getSosFlagManager,CountdownManager, LocationManager, getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\
+    from mgr import AddPPManager,cameraAlbumManager,setclassTimeManager,setkeyboardManager,testSmsSetIPManager,ConfigStoreManager,sosInfoCallManager,getBootOffManager,getSosFlagManager,CountdownManager, LocationManager, getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\
     AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldTimeManager,getStorageDataManager,getBrightnessManager,getHrTimeManager,getTempTimeManager,getLowBatManager
    
-    from pp_main import ppMainScreen,ppMainPopupScreen
+    
     # import ui as _ui
     print("init4:{}".format(utime.localtime()))
  
@@ -95,14 +95,14 @@ def main_init():
     from appWechat import WechatScreen,TK_ProtoCol,MESSAGE_ProtoCol,NewWechatPopupScreen,AIScreen
     ui.add_screen(WechatScreen()) 
     ui.add_screen(AIScreen())
-    from alarm import ClkListScreen,ClockManager,NewEditClk,CLKTimeScreen,ClkPeriod,PopupAlarmScreen
-    from ui_health import HealthScreen
+    from alarm import ClkListScreen,ClockManager,PopupAlarmScreen
+    # from ui_health import HealthScreen
     from calculator import calculatorScreen
     ui.add_screen(ClkListScreen()) 
     ui.add_screen(_ui.CountdownEndScreen()) 
-    ui.add_screen(NewEditClk()) 
-    ui.add_screen(CLKTimeScreen()) 
-    ui.add_screen(ClkPeriod()) 
+    # ui.add_screen(NewEditClk()) 
+    # ui.add_screen(CLKTimeScreen()) 
+    # ui.add_screen(ClkPeriod()) 
     # ui.add_screen(_ui_setting.LanguageScreen()) 
     ui.add_screen(_ui_setting.PowerOnScreen())
     ui.add_screen(_ui_setting.DialswitchScreen()) 
@@ -133,8 +133,6 @@ def main_init():
     ui.add_screen(FactoryModeScreen())
     ui.add_screen(FactoryModeBatTestScreen())
     ui.add_screen(PopupAlarmScreen())
-    ui.add_screen(ppMainScreen())
-    ui.add_screen(ppMainPopupScreen())
     ui.add_screen(_ui.LowPowerScreen())
     ui.add_screen(_ui.NewMessageScreen())
     ui.add_screen(_ui.sosScreen())
@@ -162,14 +160,27 @@ def main_init():
     ui.add_screen(_ui.down_Screen())
     ui.add_screen(_ui.up_Screen())
 
+    from pp_main import allppPopupScreen,delOnePopupScreen,ppListScreen,noppPopupScreen,delppsucessPopupScreen,ppMainScreen,addfaileppPopupScreen,ppMainPopupScreen,addppPopupScreen,addedppPopupScreen,ownaddppPopupScreen
+    ui.add_screen(ppMainScreen())
+    ui.add_screen(ppMainPopupScreen())
+    ui.add_screen(addppPopupScreen())
+    ui.add_screen(addedppPopupScreen())
+    ui.add_screen(ownaddppPopupScreen())
+    ui.add_screen(addfaileppPopupScreen())
+    ui.add_screen(delppsucessPopupScreen())
+    ui.add_screen(noppPopupScreen())
+    ui.add_screen(ppListScreen())
+    ui.add_screen(delOnePopupScreen())
+    ui.add_screen(allppPopupScreen())
+
     ui.add_screen(NewWechatPopupScreen())
-    ui.add_screen(HealthScreen())
+    # ui.add_screen(HealthScreen())
     # ui.add_screen(_ui.Setting3Screen())  
     print("init6:{}".format(utime.localtime()))
     
-    from protocol import SILENCETIMEFS_ProtoCol,WLKEY_ProtoCol,SILENCETIME2_ProtoCol,KEYBRD_ProtoCol,LK_ProtoCol,PING_ProtoCol,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol,HRSTART_ProtoCol,CENTER_ProtoCol,UPLOAD_ProtoCol,\
+    from protocol import restart_ProtoCol,factory_ProtoCol,SILENCETIMEFS_ProtoCol,WLKEY_ProtoCol,SILENCETIME2_ProtoCol,KEYBRD_ProtoCol,LK_ProtoCol,PING_ProtoCol,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol,HRSTART_ProtoCol,CENTER_ProtoCol,UPLOAD_ProtoCol,\
         TEMP_ProtoCol,DLT_ProtoCol,WT_ProtoCol,UD_ProtoCol,REMIND_ProtoCol, CR_ProtoCol,KA_ProtoCol,FIND_ProtoCol,POWEROFF_ProtoCol,Time_ProtoCol,\
-        pp_ProtoCol,ppinfo_ProtoCol, ProtoColResolver,PHL_ProtoCol,MONITOR_ProtoCol,bootoff_ProtoCol,WDSTART_ProtoCol,LOWBAT_ProtoCol,sosHome_dial_ProtoCol,SockManager,NetManager
+        pp_ProtoCol,revpp_ProtoCol,reqpp_ProtoCol,delpp_ProtoCol,ProtoColResolver,PHL_ProtoCol,MONITOR_ProtoCol,bootoff_ProtoCol,WDSTART_ProtoCol,LOWBAT_ProtoCol,sosHome_dial_ProtoCol,SockManager,NetManager
     
     import mgr as mgr
     print("init7:{}".format(utime.localtime()))
@@ -225,6 +236,7 @@ def main_init():
     app.append_manager(testSmsSetIPManager())
     app.append_manager(setclassTimeManager())
     app.append_manager(cameraAlbumManager())
+    app.append_manager(AddPPManager())
 
     print("init21:{}".format(utime.localtime()))    
     
@@ -262,7 +274,11 @@ def main_init():
     pcr.add_support(WLKEY_ProtoCol())
     pcr.add_support(SILENCETIMEFS_ProtoCol())
     pcr.add_support(pp_ProtoCol())
-    pcr.add_support(ppinfo_ProtoCol())
+    pcr.add_support(delpp_ProtoCol())
+    pcr.add_support(reqpp_ProtoCol())
+    pcr.add_support(revpp_ProtoCol())
+    pcr.add_support(factory_ProtoCol())
+    pcr.add_support(restart_ProtoCol())
     EventMesh.publish("load_screen", {"screen": "poweron"})
     sm = SockManager()
     sm.add_support_resolver(pcr)
index a5971d5..e396d5d 100644 (file)
@@ -609,7 +609,8 @@ def voice_callback(args):
         screen_NAME = EventMesh.publish("get_screen_NAME")
         if screen_NAME != None:
             if screen_NAME != "dialing_noplay_popup":
-                EventMesh.publish("load_screen", {"screen": "main_menu"})  
+                EventMesh.publish("return_prev_screen")
+                # EventMesh.publish("load_screen", {"screen": "main_menu"})  
         
         EventMesh.publish("set_sos_info_call")  
         print('voicecall disconnect end')
@@ -710,7 +711,7 @@ class DeviceInfoManager(Abstract):
         print("DeviceInfoManager:2")
         self.gsensor.set_callback(self.gsensor_cb)
       
-
+        self.class_count = 0
         self.old_temp_time = 0
         # #print("hsensor.open_heart:%d\r\n"%(self.hsensor.open_heart()))
         print("DeviceInfoManager:3")
@@ -1470,8 +1471,12 @@ class DeviceInfoManager(Abstract):
             self.HR_state = 0
             self.old_time = 0    
             self.set_hsenor_crt = 0
-
-        EventMesh.publish("get_class_in_time_page")
+        
+        if self.class_count < 60:
+            self.class_count+=10
+        else:
+            # print("self.class_count",self.class_count)
+            EventMesh.publish("get_class_in_time_page")
         #quecgnss.gnssEnable(0)  
     
       
@@ -2057,7 +2062,7 @@ class LocationManager(Abstract):
             self.lpm_fd = pm.create_wakelock("test_lock", len("test_lock"))
         pm.wakelock_lock(self.lpm_fd)
         print("location_thread:1")
-        EventMesh.publish(constants.EVENT.GPSOPEN)
+        # EventMesh.publish(constants.EVENT.GPSOPEN)
         print("location_thread:2")
         #self.timer_read_GPS_info.start(1000, 1, self.location_timer)
         print("location_thread:3")
@@ -2082,89 +2087,89 @@ class LocationManager(Abstract):
                     #print(self.location_timer_count)
                     GSV_dict= {}
                     
-                    #检查GNSS数据
-                    if ( self.gps_data == {} or self.location_type == 1) and quecgnss.get_state() == 2:
-
-                        pass
-                        tmp_ok_count = 0
-                        tmp_very_ok_count = 0
-                        gsv_data = quecgnss.get_gsv()
-                        rmc_data = quecgnss.get_rmc()
-                        gga_data = quecgnss.get_gga()
-                        vtg_data = quecgnss.get_vtg()
-                        # print("gsv:{}".format(quecgnss.get_gsv()))
-                        # print("gga:{}".format(quecgnss.get_gga()))
-                        # print("rmc:{}".format(quecgnss.get_rmc()))
-                        # print("vtg:{}".format(quecgnss.get_vtg())) 
-                        for i in range(len(gsv_data)) :
+                    # #检查GNSS数据
+                    # if ( self.gps_data == {} or self.location_type == 1) and quecgnss.get_state() == 2:
+
+                    #     pass
+                    #     tmp_ok_count = 0
+                    #     tmp_very_ok_count = 0
+                    #     gsv_data = quecgnss.get_gsv()
+                    #     rmc_data = quecgnss.get_rmc()
+                    #     gga_data = quecgnss.get_gga()
+                    #     vtg_data = quecgnss.get_vtg()
+                    #     # print("gsv:{}".format(quecgnss.get_gsv()))
+                    #     # print("gga:{}".format(quecgnss.get_gga()))
+                    #     # print("rmc:{}".format(quecgnss.get_rmc()))
+                    #     # print("vtg:{}".format(quecgnss.get_vtg())) 
+                    #     for i in range(len(gsv_data)) :
                             
-                            if i % 2 == 0:
-                                if i+1 >= len(gsv_data) :
-                                    print("gsv_data num error!!")
-                                    break
-                                GSV_dict[gsv_data[i]] = gsv_data[i+1]
-                                #print("type:gsv_data{}".format(type(gsv_data[i+1])))
-                                try:
-                                    #print("gsv_tmp[i+3]:{}".format(gsv_tmp[i+3]))
-                                    if gsv_data[i+1] :
-                                        if (gsv_data[i+1])>=20:
-                                            tmp_ok_count +=1   
-                                        if (gsv_data[i+1])>=30:
-                                            tmp_very_ok_count +=1  
+                    #         if i % 2 == 0:
+                    #             if i+1 >= len(gsv_data) :
+                    #                 print("gsv_data num error!!")
+                    #                 break
+                    #             GSV_dict[gsv_data[i]] = gsv_data[i+1]
+                    #             #print("type:gsv_data{}".format(type(gsv_data[i+1])))
+                    #             try:
+                    #                 #print("gsv_tmp[i+3]:{}".format(gsv_tmp[i+3]))
+                    #                 if gsv_data[i+1] :
+                    #                     if (gsv_data[i+1])>=20:
+                    #                         tmp_ok_count +=1   
+                    #                     if (gsv_data[i+1])>=30:
+                    #                         tmp_very_ok_count +=1  
                                             
-                                except Exception as e:
-                                    usys.print_exception(e)
+                    #             except Exception as e:
+                    #                 usys.print_exception(e)
                                 
-                        if(tmp_ok_count > self.GSV_sig_ok_count ):
-                            self.GSV_sig_ok_count = tmp_ok_count
-                        if(tmp_very_ok_count > self.GSV_sig_very_ok_count ):
-                            self.GSV_sig_very_ok_count = tmp_very_ok_count
-                        match_rmc_data = rmc_data.split(",")
-                        if len (match_rmc_data)>3: #有rmc数据
-                                 if match_rmc_data[2] == 'A':    
-                                    match_gga_data = gga_data.split(",")
-                                    if len(match_gga_data) >4: #数据全
-                                        match_vtg_data = vtg_data.split(",")
-                                        gps_date = "%s,%s"%(match_rmc_data[9],match_rmc_data[1][:6])#日期
-                                        #gps_data_tmp = self.gps.read_coordinates(gnss_r_data[1])
-                                        latitude = "0,N" #纬度
-                                        latitude_tmp = str(self.GxGGA_latitude(gga_data)).split(".")
-                                        if len(latitude_tmp) >= 2 and len(latitude_tmp[1])>=5:
-                                            latitude = "%s.%s"%(latitude_tmp[0],latitude_tmp[1][:6])
-                                            latitude = "%s,%s"%(latitude,match_rmc_data[4] )
-
-                                        longitude = "0,E"#经度
-                                        longitude_tmp = str(self.GxGGA_longitude(gga_data)).split(".")
-                                        if len(longitude_tmp) >= 2 and len(longitude_tmp[1])>=5:
-                                            longitude = "%s.%s"%(longitude_tmp[0],longitude_tmp[1][:6])
-                                            longitude = "%s,%s"%(longitude,match_rmc_data[6] ) #match_rmc_data[6] + str(gnss_r_data[1])
+                    #     if(tmp_ok_count > self.GSV_sig_ok_count ):
+                    #         self.GSV_sig_ok_count = tmp_ok_count
+                    #     if(tmp_very_ok_count > self.GSV_sig_very_ok_count ):
+                    #         self.GSV_sig_very_ok_count = tmp_very_ok_count
+                    #     match_rmc_data = rmc_data.split(",")
+                    #     if len (match_rmc_data)>3: #有rmc数据
+                    #              if match_rmc_data[2] == 'A':    
+                    #                 match_gga_data = gga_data.split(",")
+                    #                 if len(match_gga_data) >4: #数据全
+                    #                     match_vtg_data = vtg_data.split(",")
+                    #                     gps_date = "%s,%s"%(match_rmc_data[9],match_rmc_data[1][:6])#日期
+                    #                     #gps_data_tmp = self.gps.read_coordinates(gnss_r_data[1])
+                    #                     latitude = "0,N" #纬度
+                    #                     latitude_tmp = str(self.GxGGA_latitude(gga_data)).split(".")
+                    #                     if len(latitude_tmp) >= 2 and len(latitude_tmp[1])>=5:
+                    #                         latitude = "%s.%s"%(latitude_tmp[0],latitude_tmp[1][:6])
+                    #                         latitude = "%s,%s"%(latitude,match_rmc_data[4] )
+
+                    #                     longitude = "0,E"#经度
+                    #                     longitude_tmp = str(self.GxGGA_longitude(gga_data)).split(".")
+                    #                     if len(longitude_tmp) >= 2 and len(longitude_tmp[1])>=5:
+                    #                         longitude = "%s.%s"%(longitude_tmp[0],longitude_tmp[1][:6])
+                    #                         longitude = "%s,%s"%(longitude,match_rmc_data[6] ) #match_rmc_data[6] + str(gnss_r_data[1])
                                         
-                                        high = "0"#高度
-                                        high = str(self.GxGGA_altitude(gga_data))
-                                        number = "0"#可用卫星
-                                        precision = "5.8"#精度
-                                        if len(match_gga_data)>5 :
-                                            if match_gga_data[7]:
-                                                number = match_gga_data[7]
-                                            if match_gga_data[8]:
-                                                precision = match_gga_data[8]
-                                        direction = "249.5" #方向
-                                        speed = '0.00'    #速度    
-                                        if(len(match_vtg_data)>5 ):
-                                            if match_vtg_data[1]:
-                                                direction =  match_vtg_data[1]
-                                            if match_vtg_data[7]:    
-                                                speed =  match_vtg_data[7]
-                                        self.gps_data = {
-                                            "latitude": latitude,
-                                            "longitude": longitude,
-                                            "high": high,
-                                            "direction": direction,
-                                            "speed": speed,
-                                            "number": number, 
-                                            "date":  gps_date,
-                                            "precision":  precision
-                                        }
+                    #                     high = "0"#高度
+                    #                     high = str(self.GxGGA_altitude(gga_data))
+                    #                     number = "0"#可用卫星
+                    #                     precision = "5.8"#精度
+                    #                     if len(match_gga_data)>5 :
+                    #                         if match_gga_data[7]:
+                    #                             number = match_gga_data[7]
+                    #                         if match_gga_data[8]:
+                    #                             precision = match_gga_data[8]
+                    #                     direction = "249.5" #方向
+                    #                     speed = '0.00'    #速度    
+                    #                     if(len(match_vtg_data)>5 ):
+                    #                         if match_vtg_data[1]:
+                    #                             direction =  match_vtg_data[1]
+                    #                         if match_vtg_data[7]:    
+                    #                             speed =  match_vtg_data[7]
+                    #                     self.gps_data = {
+                    #                         "latitude": latitude,
+                    #                         "longitude": longitude,
+                    #                         "high": high,
+                    #                         "direction": direction,
+                    #                         "speed": speed,
+                    #                         "number": number, 
+                    #                         "date":  gps_date,
+                    #                         "precision":  precision
+                    #                     }
 # ***********************************************************************************
 
 
@@ -2208,16 +2213,15 @@ class LocationManager(Abstract):
                         #     self.location_timer_count = 0
                         #     self.GSV_sig_ok_count = 0
                             
-                        
-                    # if  (self.GGA_count < 3 and self.GSV_sig_ok_count < 2) and self.wifi_data  and self.cell_data  and self.location_timer_count > 30 and self.location_timer_count < 40: #超过20秒且有效卫星个数少于3
-                    #     EventMesh.publish(constants.EVENT.CLOSE_LOCATION)#关闭定位    
-                    #     EventMesh.txt_log("GGA_count<3:timer:{} ok_count:{} count:{}".format(self.location_timer_count,self.GSV_sig_ok_count,self.GGA_count))
-                    #     self.Location_send([self.gps_data,self.wifi_data,self.cell_data])
-                        
-                    if self.GSV_sig_ok_count <= 1 and self.wifi_data != [] and self.cell_data != [] and self.location_timer_count > 20: #超过40秒且信号大于30的不足3个
+
+                    if  self.wifi_data != [] and self.cell_data != [] : #
                         EventMesh.publish(constants.EVENT.CLOSE_LOCATION)#关闭定位   
                         EventMesh.txt_log("GSV_sig_ok_count<3:timer:{} ok_count:{} ".format(self.location_timer_count,self.GSV_sig_ok_count))
-                        self.Location_send([self.gps_data,self.wifi_data,self.cell_data])
+                        self.Location_send([self.gps_data,self.wifi_data,self.cell_data])    
+                    # if self.GSV_sig_ok_count <= 1 and self.wifi_data != [] and self.cell_data != [] and self.location_timer_count > 20: #超过40秒且信号大于30的不足3个
+                    #     EventMesh.publish(constants.EVENT.CLOSE_LOCATION)#关闭定位   
+                    #     EventMesh.txt_log("GSV_sig_ok_count<3:timer:{} ok_count:{} ".format(self.location_timer_count,self.GSV_sig_ok_count))
+                    #     self.Location_send([self.gps_data,self.wifi_data,self.cell_data])
                         #break
                 # if self.location_type != 1 and self.location_timer_count >= 60*4 : #4分钟关闭
                 #     EventMesh.publish(constants.EVENT.CLOSE_LOCATION)#关闭定位
@@ -2275,6 +2279,24 @@ class AddrBookManager(Abstract):
         self.check_json = msg[0]
         self.read_phonebook = msg[1]
 
+class AddPPManager(Abstract):
+    # 添加碰碰好友
+    def __init__(self):
+        self.read_pplist = {}
+
+    def post_processor_after_instantiation(self):
+        EventMesh.subscribe("get_pplist", self.get)
+        EventMesh.subscribe("set_pplist", self.set)
+
+    def get(self, event, msg):
+        
+        return self.read_pplist
+    
+    def set(self, event, msg):
+        self.read_pplist = msg
+        print("self.read_pplist",self.read_pplist)
+        
+
 import sms
 class MsgManager(Abstract):
     # 短信
@@ -2809,6 +2831,7 @@ class getUpLoadDataManager(Abstract):#
         self.upload_time = msg
 
     def get_upload_data(self, event, msg): 
+        self.upload_time = EventMesh.publish("get_storage_config","upload_time")
         return self.upload_time 
 
 class getplayAudiodStateManager(Abstract):#获取设置播放音频状态
@@ -2900,7 +2923,7 @@ class getSosFlagManager(Abstract):#设置sos
 
     def set_callnumer_cb(self, event, msg):
         self.callnumer = msg
-        self.call_timer.start(10000, 0, self.call_timer_cb)#延迟10S 继续拨打
+        self.call_timer.start(5*1000, 0, self.call_timer_cb)#延迟10S 继续拨打
 
     def call_timer_cb(self, *args, **kwargs):
         if self.sos_flag == 1:
@@ -3243,13 +3266,35 @@ class setclassTimeManager(Abstract):#设置上课禁用时间
                     if ((cur_week in week1) and enable1 == 1 and week1 != []) or ((cur_week in week2) and enable2 == 1 and week2 != []) or\
                         ((cur_week in week3) and enable3 == 1 and week3 != []) or ((cur_week in week4) and enable4 == 1 and week4 != []):
                         if  enable1 == 1 or enable2 == 1 or enable3 == 1 or enable4 == 1:
-                            if (end_time1 > start_time1  and  enable1 == 1 and week1_state == 1) or (end_time2 > start_time2 and  enable2 == 1 and week2_state == 1) or\
-                            (end_time3 > start_time3 and  enable3 == 1 and week3_state == 1) or (end_time4 > start_time4 and  enable4 == 1 and week4_state == 1):
-                                if (cur_total_min <= end_time1 and cur_total_min >= start_time1 and enable1 == 1) or (cur_total_min <= end_time2 and cur_total_min >= start_time2 and enable2 == 1) or\
-                                    (cur_total_min <= end_time3 and cur_total_min >= start_time3 and enable3 == 1) or (cur_total_min <= end_time4 and cur_total_min >= start_time4 and enable4 == 1):
+                            if (end_time1 > start_time1):#结束时间大于开始时间否则不通过
+                                if (cur_total_min <= end_time1 and cur_total_min >= start_time1 and enable1 == 1 and week1_state == 1):#当前时间大于开始小于结束时间而且星期在内,且使能1了
                                     self.class_state = 1
                                     print("class_in1")
                                     break
+                            if (end_time2 > start_time2):#结束时间大于开始时间否则不通过
+                                if (cur_total_min <= end_time2 and cur_total_min >= start_time2 and enable2 == 1 and week2_state == 1):#当前时间大于开始小于结束时间而且星期在内,且使能1了
+                                    self.class_state = 1
+                                    print("class_in2")
+                                    break
+                            if (end_time3 > start_time3):#结束时间大于开始时间否则不通过
+                                if (cur_total_min <= end_time3 and cur_total_min >= start_time3 and enable3 == 1 and week3_state == 1):#当前时间大于开始小于结束时间而且星期在内,且使能1了
+                                    self.class_state = 1
+                                    print("class_in3")
+                                    break
+                            if (end_time4 > start_time4):#结束时间大于开始时间否则不通过
+                                if (cur_total_min <= end_time4 and cur_total_min >= start_time4 and enable4 == 1 and week4_state == 1):#当前时间大于开始小于结束时间而且星期在内,且使能1了
+                                    self.class_state = 1
+                                    print("class_in4")
+                                    break
+
+
+                            # if (end_time1 > start_time1  and  enable1 == 1 and week1_state == 1) or (end_time2 > start_time2 and  enable2 == 1 and week2_state == 1) or\
+                            # (end_time3 > start_time3 and  enable3 == 1 and week3_state == 1) or (end_time4 > start_time4 and  enable4 == 1 and week4_state == 1):
+                            #     if (cur_total_min <= end_time1 and cur_total_min >= start_time1 and enable1 == 1 and week1_state == 1) or (cur_total_min <= end_time2 and cur_total_min >= start_time2 and enable2 == 1 and week2_state == 1) or\
+                            #         (cur_total_min <= end_time3 and cur_total_min >= start_time3 and enable3 == 1 and week3_state == 1) or (cur_total_min <= end_time4 and cur_total_min >= start_time4 and enable4 == 1 and week4_state == 1):
+                            #         self.class_state = 1
+                            #         print("class_in1")
+                            #         break
         return self.class_state
     
     def get_class_in_time_page(self, event, msg):
index 46f8bc3..228b7c4 100644 (file)
@@ -24,7 +24,7 @@ import gc
 import _thread
 from queue import Queue
 import camera
-from ui import style_screen,Screen,style_font_youyuan_20,style_img
+from ui import style_screen,Screen,style_font_youyuan_20,style_font_youyuan_20_default,style_img
 LCD_X = 128
 LCD_Y = 128
 ppmain_screen = None
@@ -32,30 +32,28 @@ ppmain_img = None
 ppmain_name = None
 ppmain_call_label = None
 ppmain_imgbtn = None
+delpp_img = None
+delppmain_name = None
+delppmain_call_label = None
 class ppMainScreen(Screen):
     NAME = "pp_main"
     
     def __init__(self):
         super().__init__()
+        self.check_json = False
+        self.ppbook = {}
         self.meta = None
     def initialization(self):
         
-        global ppmain_screen,ppmain_img,ppmain_name ,ppmain_imgbtn 
+        global ppmain_screen,ppmain_img,ppmain_name ,ppmain_imgbtn,delpp_img
         if ppmain_screen == None:
             ppmain_screen = lv.obj()
             print("ppMainScreen")
             ppmain_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
 
-            # dialing_img = lv.img(ppmain_screen)
-            # dialing_img.set_pos(80, 20)
-            # dialing_img.set_size(64, 64)
-            # dialing_img.set_src("U:/static/IMAGE_NOTICE_CALL.png")
-            # dialing_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-            
             ppmain_call_label = lv.label(ppmain_screen)
-            ppmain_call_label.set_pos(35, 24)
-            ppmain_call_label.set_size(LCD_X-35, 40)
+            ppmain_call_label.set_pos(25, 24)
+            ppmain_call_label.set_size(LCD_X-25, 40)
             ppmain_call_label.set_text("碰碰好友")
             ppmain_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
             ppmain_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
@@ -66,7 +64,6 @@ class ppMainScreen(Screen):
             ppmain_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
             ppmain_imgbtn.set_pos(10, 20)
            
-            
             ppmain_name = lv.label(ppmain_screen)
             ppmain_name.set_pos(0, 0)
             ppmain_name.set_size(LCD_X, 60)
@@ -75,16 +72,483 @@ class ppMainScreen(Screen):
             ppmain_name.set_long_mode(lv.label.LONG.DOT)
             ppmain_name.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
             ppmain_name.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-            ppmain_name.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)),
+            ppmain_name.add_event_cb(lambda e: EventMesh.callback_wrapper(self.addpp(e)),
+                                    lv.EVENT.CLICKED, None)
+            
+            delpp_img = lv.img(ppmain_screen)
+            delpp_img.set_pos(5, 60)
+            delpp_img.set_size(20, 20)
+            delpp_img.set_src("U:/static/pp_friend04.png")
+            delpp_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            delppmain_call_label = lv.label(ppmain_screen)
+            delppmain_call_label.set_pos(35, 64)
+            delppmain_call_label.set_size(LCD_X-35, 40)
+            delppmain_call_label.set_text("设备号交友")
+            delppmain_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            delppmain_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            delppmain_name = lv.label(ppmain_screen)
+            delppmain_name.set_pos(0, 60)
+            delppmain_name.set_size(LCD_X, 60)
+            delppmain_name.set_text(" ")
+            delppmain_name.add_flag(lv.obj.FLAG.CLICKABLE)
+            delppmain_name.set_long_mode(lv.label.LONG.DOT)
+            delppmain_name.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            delppmain_name.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+            delppmain_name.add_event_cb(lambda e: EventMesh.callback_wrapper(self.delpp_cb(e)),
                                     lv.EVENT.CLICKED, None)
+            
 
             self.meta = ppmain_screen
-    def hangup(self,*argc):
-        EventMesh.publish("load_screen", {"screen": "pp_popup"})
-        EventMesh.publish(constants.EVENT.START_LOCATION,constants.PROTOCOL.PP_SEND) #开始WT定位
+    def addpp(self,*argc):
+        if EventMesh.publish(constants.EVENT.GET_CONNECT) == 0:#未联网提示关机
+            EventMesh.publish("load_screen", {"screen": "no_sim_popup_screen"})
+        else:
+            data = EventMesh.publish("get_pplist")
+            if data != None:
+                self.ppbook = data
+            if self.ppbook != None:
+                # print(self.ppbook)
+                if len(self.ppbook) >= 5:
+                    # print("del self.ppbook new1",self.ppbook)
+                    # phonebook_keys = sorted(self.ppbook.keys())#排序,将升序排序
+                    # value = phonebook_keys[len(self.ppbook)-1]
+
+                    # value_tmp = ''
+                    # if value.find("05:") != -1:
+                    #     value_tmp = value.split(":")[1]
+                    # if len(value_tmp) > 0:
+                    #     EventMesh.publish(constants.PROTOCOL.MFCODE_FRIEND_DEL_REQ_SEND,value_tmp)
+                    # print("del self.ppbook new2",self.ppbook,value_tmp,value)
+                    EventMesh.publish("load_screen", {"screen": "allpp_popup"})
+                    return
+                else:
+                    EventMesh.publish("load_screen", {"screen": "pp_popup"})
+                    return
+            
+            EventMesh.publish("load_screen", {"screen": "pp_popup"})
+
+    def delpp_cb(self,*argc):
+        if EventMesh.publish(constants.EVENT.GET_CONNECT) == 0:#未联网提示关机
+            EventMesh.publish("load_screen", {"screen": "no_sim_popup_screen"})
+            return
+        else:
+            EventMesh.publish("load_screen", {"screen": "pp_list"})
+
+    def done_return(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+    def btn1_release(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+    def btn8_press(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+
+pp_main_default = lv.style_t()
+pp_main_default.init()
+pp_main_default.set_radius(5)
+pp_main_default.set_bg_color(lv.color_make(0x64,0x64,0x64))
+pp_main_default.set_bg_grad_color(lv.color_make(0x64,0x64,0x64))
+pp_main_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
+pp_main_default.set_bg_opa(255)
+pp_main_default.set_border_color(lv.color_make(0x64,0x64,0x64))
+pp_main_default.set_border_width(0)
+pp_main_default.set_border_opa(255)
+pp_main_default.set_pad_left(0)
+pp_main_default.set_pad_right(0)
+pp_main_default.set_pad_top(0)
+pp_main_default.set_pad_bottom(0)
+
+
+pp_style_font_youyuan_20_gray = lv.style_t()
+pp_style_font_youyuan_20_gray.init()
+pp_style_font_youyuan_20_gray.set_text_color(lv.color_make(200, 200, 200))
+pp_style_font_youyuan_20_gray.set_text_font(lv.K01_font_16_ALL)
+
+style_alarm_screen_default = lv.style_t()
+style_alarm_screen_default.init()
+style_alarm_screen_default.set_bg_color(lv.color_make(0x00, 0x00, 0x00))
+style_alarm_screen_default.set_border_width(0)
+style_alarm_screen_default.set_pad_left(0)
+style_alarm_screen_default.set_pad_right(0)
+style_alarm_screen_default.set_pad_top(0)
+style_alarm_screen_default.set_pad_bottom(0)
+
+pp_list_screen = None
+pp_list_title = None
+pp_list_screen1_1 = None
+no_add_pp = None
+
+class ppListScreen(Screen):
+    NAME = "pp_list"
+    def __init__(self):
+        super().__init__()
+        self.meta = None
+        self.clock_list = []
+        self.ppbook = {}
+        self.MXA_clk_num = 10
+        self.timer = osTimer()
+        self.timer1 = osTimer()
+        self.timer2 = osTimer()
+        self.check_json = False
+        self.count = 0
+        self.pp_detail_listt_dict = []
+        self.ppcontact_detail_list = None
+        self.is_sliding = 0
+        EventMesh.subscribe("pp_update_data",self.pp_update_data)
+
+    def initialization(self): 
+        self.is_sliding =0
+        global pp_list_screen,pp_list_title,pp_list_screen1_1,no_add_pp
+        if pp_list_screen == None:
+            pp_list_screen = lv.obj()
+            print("pp_list_screen")
+            pp_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+            pp_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+
+            # clk_list_title_bg= lv.btn(pp_list_screen)
+            # clk_list_title_bg.set_size(112,25)
+            # clk_list_title_bg.set_pos(8,5)
+            # clk_list_title_bg.add_style(style_screen_btn_1_main_main_default, lv.PART.MAIN | lv.STATE.DEFAULT)
+            # clk_list_title_bg.set_ext_click_area(25)
+
+            pp_list_title = lv.label(pp_list_screen)
+            pp_list_title.set_pos(4, 5)
+            pp_list_title.set_size(112, 20)
+            pp_list_title.set_text("好友列表")
+            pp_list_title.set_long_mode(lv.label.LONG.WRAP)
+            pp_list_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            pp_list_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+        
+
+            pp_list_screen1_1 = lv.obj(pp_list_screen)
+            pp_list_screen1_1.set_pos(0, 35)
+            pp_list_screen1_1.set_size(128, 128-35)
+            pp_list_screen1_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+            pp_list_screen1_1.add_style(style_alarm_screen_default, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            #暂未添加闹钟
+            no_add_pp= lv.label(pp_list_screen1_1)
+            no_add_pp.set_pos(0, 20)
+            no_add_pp.set_size(128, 50)
+            no_add_pp.set_text("未添加好友")
+            no_add_pp.set_long_mode(lv.label.LONG.WRAP)
+            no_add_pp.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            no_add_pp.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            self.ppcontact_detail_list = lv.obj(pp_list_screen)
+            self.ppcontact_detail_list.set_pos(0, 25)
+            self.ppcontact_detail_list.set_size(128, 128-25)
+            self.ppcontact_detail_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+            self.ppcontact_detail_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+            
+            for i in range(self.MXA_clk_num):
+            
+                _btn = lv.btn(self.ppcontact_detail_list)
+                _btn.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+                _btn.add_style(pp_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
+                _btn.add_flag(lv.obj.FLAG.CLICKABLE)
+                _btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.edit_pp(e)),
+                                        lv.EVENT.CLICKED, None)
+                _btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.edit_pp(e)),
+                                        lv.EVENT.PRESSING, None)
+                
+                _btn_label1 = lv.label(_btn)
+                _btn_label2 = lv.label(_btn)
+                _btn_label2.set_long_mode(lv.label.LONG.SCROLL_CIRCULAR)
+                _btn_label2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+                _btn_label3 = lv.label(_btn)
+                _btn_label3.set_long_mode(lv.label.LONG.SCROLL_CIRCULAR)
+                _btn_label3.add_style(pp_style_font_youyuan_20_gray, lv.PART.MAIN | lv.STATE.DEFAULT)
+                self.pp_detail_listt_dict.append({"_btn":_btn,"_btn_label1":_btn_label1,"_btn_label2":_btn_label2,"_btn_label3":_btn_label3})
+            self.meta = pp_list_screen
+        if self.ppbook != None:
+            if  len(self.ppbook) > 0:
+                self.btn_create_list_show(1)
+            else:
+                self.btn_create_list_show(0)
+        else:
+            self.btn_create_list_show(0)
+        self.count = 0
+        self.timer2.start(1 * 1000, 1, self.time_fun)
+
+    def pp_update_data(self,event,msg):
+        self.timer.start(1 * 1000, 0, self.OutTime_s)
+
+    def OutTime_s(self,e):
+        data = EventMesh.publish("get_pplist")
+        if data != None:
+            self.ppbook = data
+        self.btn_create_list_show(1)
+    def time_fun(self,e):
+        self.count+=1
+        EventMesh.publish("system_sleep_rest")#防止黑屏
+        if self.count > 20:
+            self.count = 0
+            self.timer2.stop()
+
+    def post_processor_before_initialization(self):
+        data = EventMesh.publish("get_pplist")
+        if data != None:
+            self.ppbook = data
+        if self.ppbook != None:
+            if len(self.ppbook) == 0:
+                EventMesh.publish(constants.PROTOCOL.MFCODE_FRIEND_REQ_SEND)  
+        self.timer1.start(20* 1000, 0, self.NetOutTime_s)
        
         pass
 
+    def NetOutTime_s(self,e):#网络异常
+        data = EventMesh.publish("get_pplist")
+        if data != None:
+            self.ppbook = data
+        if self.ppbook != None:
+            if len(self.ppbook) == 0:
+                self.btn_create_list_show(2)
+            else:
+               self.btn_create_list_show(1) 
+        else:
+            self.btn_create_list_show(1)
+
+    def btn_create_list_show(self,state):
+        EventMesh.publish("publish_message_event_ui",{"func":self.addpp_draw_btn,"data":state})
+        
+
+    def addpp_draw_btn(self,state):
+        if state == 0:
+            no_add_pp.clear_flag(lv.obj.FLAG.HIDDEN)
+            no_add_pp.set_text("正在加载好友中,请稍候...")
+            self.ppcontact_detail_list.add_flag(lv.obj.FLAG.HIDDEN)
+            pass
+        elif state == 2:
+            no_add_pp.clear_flag(lv.obj.FLAG.HIDDEN)
+            no_add_pp.set_text("网络异常或未添加好友,请重试")
+            self.ppcontact_detail_list.add_flag(lv.obj.FLAG.HIDDEN)
+            pass
+        elif state == 1:
+            if len(self.ppbook) > 0:
+                self.ppcontact_detail_list.clear_flag(lv.obj.FLAG.HIDDEN)
+                no_add_pp.add_flag(lv.obj.FLAG.HIDDEN)
+                j = 0
+                num = 0
+                phonebook_keys = sorted(self.ppbook.keys())
+                print("self.ppbook",self.ppbook)
+                if len(self.ppbook) > self.MXA_clk_num:
+                    j = len(self.ppbook) - self.MXA_clk_num
+                for i in range(0,self.MXA_clk_num):
+                    if(j >= len(self.ppbook)):
+                        self.pp_detail_listt_dict[i]["_btn"].add_flag(lv.obj.FLAG.HIDDEN)
+                        continue
+                    name = self.ppbook[phonebook_keys[j]]
+                    key_tmp = phonebook_keys[j]
+
+                    #_btn = lv.btn(self.ppcontact_detail_list)
+                    self.pp_detail_listt_dict[i]["_btn"].set_size(120,45)
+                    self.pp_detail_listt_dict[i]["_btn"].set_pos(0,47*i)
+
+                    #_btn_label1 = lv.label(_btn)
+                    self.pp_detail_listt_dict[i]["_btn_label1"].set_pos(20, 0)
+                    self.pp_detail_listt_dict[i]["_btn_label1"].set_size(0, 0)
+                    self.pp_detail_listt_dict[i]["_btn_label1"].set_text(key_tmp[4:])
+
+                    #_btn_label2 = lv.label(_btn)
+                    self.pp_detail_listt_dict[i]["_btn_label2"].set_pos(10, 0)
+                    self.pp_detail_listt_dict[i]["_btn_label2"].set_size(97, 20)
+                    self.pp_detail_listt_dict[i]["_btn_label2"].set_text(name)
+                    self.pp_detail_listt_dict[i]["_btn_label2"].set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
+
+                    #_btn_label3 = lv.label(_btn)
+                    self.pp_detail_listt_dict[i]["_btn_label3"].set_pos(10, 25)
+                    self.pp_detail_listt_dict[i]["_btn_label3"].set_size(128-8, 20)
+                    self.pp_detail_listt_dict[i]["_btn_label3"].set_text(key_tmp[4:])
+
+                    self.pp_detail_listt_dict[i]["_btn_label3"].set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
+                    self.pp_detail_listt_dict[i]["_btn"].clear_flag(lv.obj.FLAG.HIDDEN)
+                    j+=1
+
+            else:
+                # no_add_alarm_img.clear_flag(lv.obj.FLAG.HIDDEN)
+                no_add_pp.clear_flag(lv.obj.FLAG.HIDDEN) 
+                no_add_pp.set_text("未添加好友")
+                self.ppcontact_detail_list.add_flag(lv.obj.FLAG.HIDDEN)
+        else:
+            # no_add_alarm_img.clear_flag(lv.obj.FLAG.HIDDEN)
+            no_add_pp.clear_flag(lv.obj.FLAG.HIDDEN) 
+            self.ppcontact_detail_list.add_flag(lv.obj.FLAG.HIDDEN)
+            
+    def edit_pp(self, e):#
+        code = e.get_code()
+        if code == lv.EVENT.PRESSING:
+            #print("PRESSING")
+            self.is_sliding += 1
+
+        elif  code == lv.EVENT.CLICKED:
+            #utime.sleep_ms(10)
+            print("1self.is_sliding",self.is_sliding)
+            if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件
+                self.is_sliding = 0
+                imei = e.get_target().get_child(0).get_text()
+                print("pp imei".format(imei))
+                if EventMesh.publish(constants.EVENT.GET_CONNECT) == 0:#未联网提示关机
+                     EventMesh.publish("load_screen", {"screen": "no_sim_popup_screen"})
+                else:
+                    EventMesh.publish("load_screen", {"screen": "delOnepp_popup","meta":str(imei)})
+                
+            self.is_sliding = 0
+    def Close(self):
+        self.timer2.stop()
+        self.timer1.stop()
+
+
+    def done_return(self):
+        EventMesh.publish("load_screen", {"screen": "pp_main"})
+               
+    def btn1_release(self):
+        EventMesh.publish("load_screen", {"screen": "pp_main"})
+
+    def btn8_press(self):
+        EventMesh.publish("watch_top_show")
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+
+delNotPopup_screen = None
+delNotPopup_call_label = None
+delNotPopup_imgbtn = None
+delconcelPopup_call_label = None
+delNotPopup_call_label = None
+delComfriPopup_call_label = None
+delComfriPopup_ID = None
+delComfriPopup_call_label1= None
+delComfriPopup_call_label2 = None
+class delOnePopupScreen(Screen):#删除单个好友
+    NAME = "delOnepp_popup"
+    
+    def __init__(self):
+        super().__init__()
+        self.meta = None
+        self.timer=osTimer()
+        self.timer_out=osTimer()
+        self.count = 0
+        self.is_sliding = 0
+
+    def initialization(self):
+        self.is_sliding = 0
+        self.count = 0
+        global delNotPopup_screen,delNotPopup_call_label,delComfriPopup_call_label2 ,delComfriPopup_call_label1,delComfriPopup_call_label,delconcelPopup_call_label,delComfriPopup_ID
+        if delNotPopup_screen == None:
+            delNotPopup_screen = lv.obj()
+            print("delNotPopup_screen")
+            delNotPopup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            delNotPopup_call_label = lv.label(delNotPopup_screen)
+            delNotPopup_call_label.set_pos(0, 10)
+            delNotPopup_call_label.set_size(LCD_X-0, 39)
+            delNotPopup_call_label.set_text("是否删除该好友?")
+            delNotPopup_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            delNotPopup_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            delComfriPopup_ID = lv.label(delNotPopup_screen)
+            delComfriPopup_ID.set_pos(0, 40)
+            delComfriPopup_ID.set_size(128, 48)
+            delComfriPopup_ID.set_text(" ")
+            delComfriPopup_ID.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            delComfriPopup_ID.add_style(style_font_youyuan_20_default, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            delComfriPopup_call_label1 = lv.label(delNotPopup_screen)
+            delComfriPopup_call_label1.set_pos(0, 70)
+            delComfriPopup_call_label1.set_size(64, 50)
+            delComfriPopup_call_label1.set_text(" ")
+            delComfriPopup_call_label1.add_flag(lv.obj.FLAG.CLICKABLE)
+            delComfriPopup_call_label1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),
+                                        lv.EVENT.CLICKED, None)
+            delComfriPopup_call_label1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),
+                                        lv.EVENT.PRESSING, None)
+
+            delComfriPopup_call_label2 = lv.label(delNotPopup_screen)
+            delComfriPopup_call_label2.set_pos(64, 70)
+            delComfriPopup_call_label2.set_size(64, 50)
+            delComfriPopup_call_label2.set_text(" ")
+            delComfriPopup_call_label2.add_flag(lv.obj.FLAG.CLICKABLE)
+            delComfriPopup_call_label2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),
+                                        lv.EVENT.CLICKED, None)
+            delComfriPopup_call_label2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),
+                                        lv.EVENT.PRESSING, None)
+            
+            delComfriPopup_call_label = lv.label(delNotPopup_screen)
+            delComfriPopup_call_label.set_pos(0, 80)
+            delComfriPopup_call_label.set_size(64, 48)
+            delComfriPopup_call_label.set_text("确定")
+            delComfriPopup_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            delComfriPopup_call_label.add_flag(lv.obj.FLAG.CLICKABLE)
+            delComfriPopup_call_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),
+                                        lv.EVENT.CLICKED, None)
+            delComfriPopup_call_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),
+                                        lv.EVENT.PRESSING, None)
+            delComfriPopup_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+
+            delconcelPopup_call_label = lv.label(delNotPopup_screen)
+            delconcelPopup_call_label.set_pos(64, 80)
+            delconcelPopup_call_label.set_size(64, 48)
+            delconcelPopup_call_label.set_text("取消")
+            delconcelPopup_call_label.add_flag(lv.obj.FLAG.CLICKABLE)
+            delconcelPopup_call_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),
+                                        lv.EVENT.CLICKED, None)
+            delconcelPopup_call_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),
+                                        lv.EVENT.PRESSING, None)
+            delconcelPopup_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            delconcelPopup_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            self.meta = delNotPopup_screen
+        self.timer.start(1*1000,1,self.fun)
+        delComfriPopup_ID.set_text(str(self.meta_info))
+    def confirm(self, e):
+        code = e.get_code()
+        if code == lv.EVENT.PRESSING:
+            #print("PRESSING")
+            self.is_sliding += 1
+
+        elif  code == lv.EVENT.CLICKED:
+            #utime.sleep_ms(10)
+            print("1self.is_sliding",self.is_sliding)
+            if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件
+                self.is_sliding =0
+                EventMesh.publish(constants.PROTOCOL.MFCODE_FRIEND_DEL_REQ_SEND,self.meta_info)
+                
+                EventMesh.publish("load_screen", {"screen": "delppok_popup"})
+            self.is_sliding =0
+        
+        pass
+    def concel(self, e):
+        code = e.get_code()
+        if code == lv.EVENT.PRESSING:
+            #print("PRESSING")
+            self.is_sliding += 1
+
+        elif  code == lv.EVENT.CLICKED:
+            #utime.sleep_ms(10)
+            print("1self.is_sliding",self.is_sliding)
+            if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件
+                self.is_sliding =0
+                EventMesh.publish("load_screen", {"screen": "pp_list"})
+            self.is_sliding =0
+        
+        pass
+
+    def fun(self,*argc):
+        EventMesh.publish("system_sleep_rest")#防止黑屏
+        self.count+=1
+        if self.count > 10:
+            self.count = 0
+            self.timer.stop()
+            EventMesh.publish("load_screen", {"screen": "pp_list"})
+
+    def Close(self):
+        self.timer.stop()
+
     def done_return(self):
         EventMesh.publish("load_screen", {"screen": "main_menu"})
 
@@ -94,6 +558,163 @@ class ppMainScreen(Screen):
     def btn8_press(self):
         EventMesh.publish("load_screen", {"screen": "main_menu"})
 
+allppPopup_screen = None
+allppPopup_call_label = None
+allppPopup_imgbtn = None
+allppPopup_call_label = None
+class allppPopupScreen(Screen):#没有加好友弹窗提示
+    NAME = "allpp_popup"
+    
+    def __init__(self):
+        super().__init__()
+        self.meta = None
+        self.timer=osTimer()
+        self.meta_type = "popup"
+        self.count = 0
+
+    def initialization(self):
+        self.count = 0
+        global allppPopup_screen,allppPopup_call_label ,allppPopup_imgbtn 
+        if allppPopup_screen == None:
+            allppPopup_screen = lv.obj()
+            print("allppPopup_screen")
+            allppPopup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            allppPopup_call_label = lv.label(allppPopup_screen)
+            allppPopup_call_label.set_pos(0, 40)
+            allppPopup_call_label.set_size(LCD_X-0, 60)
+            allppPopup_call_label.set_text("好友个数已达5个,请删除后再添加")
+            allppPopup_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            allppPopup_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+
+            self.meta = allppPopup_screen
+        self.timer.start(1*1000,1,self.fun)
+        
+    def fun(self,*argc):
+        self.count+=1
+        EventMesh.publish("system_sleep_rest")#防止黑屏
+        if self.count > 10:
+            self.count = 0
+            self.timer.stop()
+            EventMesh.publish("load_screen", {"screen": "pp_main"})
+
+    def Close(self):
+        self.timer.stop()
+
+    def done_return(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+    def btn1_release(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+    def btn8_press(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+noppPopup_screen = None
+noppPopup_call_label = None
+noppPopup_imgbtn = None
+noppPopup_call_label = None
+class noppPopupScreen(Screen):#没有加好友弹窗提示
+    NAME = "nopp_popup"
+    
+    def __init__(self):
+        super().__init__()
+        self.meta = None
+        self.timer=osTimer()
+        self.timer_out=osTimer()
+        self.meta_type = "popup"
+        self.count = 0
+    def initialization(self):
+        self.count = 0
+        global noppPopup_screen,noppPopup_call_label ,noppPopup_imgbtn 
+        if noppPopup_screen == None:
+            noppPopup_screen = lv.obj()
+            print("noppPopup_screen")
+            noppPopup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            noppPopup_call_label = lv.label(noppPopup_screen)
+            noppPopup_call_label.set_pos(0, 54)
+            noppPopup_call_label.set_size(LCD_X-0, 39)
+            noppPopup_call_label.set_text("未加好友")
+            noppPopup_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            noppPopup_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+
+            self.meta = noppPopup_screen
+        self.timer.start(1*1000,1,self.fun)
+        
+    def fun(self,*argc):
+        self.count+=1
+        EventMesh.publish("system_sleep_rest")#防止黑屏
+        if self.count > 10:
+            self.count = 0
+            self.timer.stop()
+            EventMesh.publish("load_screen", {"screen": "pp_main"})
+
+    def Close(self):
+        self.timer.stop()
+
+    def done_return(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+    def btn1_release(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+    def btn8_press(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+delppokPopup_screen = None
+delppokPopup_call_label = None
+class delppsucessPopupScreen(Screen):#没有加好友弹窗提示
+    NAME = "delppok_popup"
+    
+    def __init__(self):
+        super().__init__()
+        self.meta = None
+        self.timer=osTimer()
+        self.timer_out=osTimer()
+        self.meta_type = "popup"
+        self.count = 0
+
+    def initialization(self):
+        self.count = 0
+        global delppokPopup_screen,delppokPopup_call_label 
+        if delppokPopup_screen == None:
+            delppokPopup_screen = lv.obj()
+            print("delppok_popup")
+            delppokPopup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            delppokPopup_call_label = lv.label(delppokPopup_screen)
+            delppokPopup_call_label.set_pos(0, 54)
+            delppokPopup_call_label.set_size(LCD_X-0, 39)
+            delppokPopup_call_label.set_text("好友删除成功")
+            delppokPopup_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            delppokPopup_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+
+            self.meta = delppokPopup_screen
+        self.timer.start(1*1000,1,self.fun)
+        
+    def fun(self,*argc):
+        self.count+=1
+        EventMesh.publish("system_sleep_rest")#防止黑屏
+        if self.count > 5:
+            self.count = 0
+            self.timer.stop()
+            EventMesh.publish("load_screen", {"screen": "pp_main"})
+
+    def Close(self):
+        self.timer.stop()
+
+    def done_return(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+    def btn1_release(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+    def btn8_press(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
 
 
 ppPopup_screen = None
@@ -109,6 +730,7 @@ class ppMainPopupScreen(Screen):#弹窗提示
         self.timer_out=osTimer()
         self.meta_type = "popup"
         self.count = 0
+        EventMesh.subscribe("close_pp_timer",self.close_pp_timer)
 
     def initialization(self):
         self.count = 0
@@ -132,16 +754,20 @@ class ppMainPopupScreen(Screen):#弹窗提示
             ppPopup_imgbtn.set_pos(14, 5)
 
             self.meta = ppPopup_screen
+        EventMesh.publish(constants.EVENT.START_LOCATION,constants.PROTOCOL.PP_SEND) #开始WT定位
         self.timer.start(1*1000,1,self.fun)
-        self.timer_out.start(40*1000,0,self.timeout_fun)
+        self.timer_out.start(30*1000,0,self.timeout_fun)
     def fun(self,*argc):
         EventMesh.publish("system_sleep_rest")#防止黑屏
+    
+    def close_pp_timer(self, event, msg):
+        self.timer_out.stop()
 
     def timeout_fun(self,*argc):
         screen_NAME = EventMesh.publish("get_screen_NAME")
         if screen_NAME != None:
             if screen_NAME == "pp_popup":
-                EventMesh.publish("load_screen", {"screen": "main_menu"})
+                EventMesh.publish("load_screen", {"screen": "addfailepp_popup"})
     def Close(self):
         self.timer.stop()
 
@@ -158,6 +784,7 @@ class ppMainPopupScreen(Screen):#弹窗提示
 addppPopup_screen = None
 addppPopup_call_label = None
 addppPopup_imgbtn = None
+addppPopup_ok_label = None
 class addppPopupScreen(Screen):#弹窗提示
     NAME = "addpp_popup"
     
@@ -168,32 +795,199 @@ class addppPopupScreen(Screen):#弹窗提示
         self.meta_type = "popup"
         self.count = 0
     def initialization(self):
+        EventMesh.publish("close_pp_timer")
         self.count = 0
-        global addppPopup_screen,addppPopup_imgbtn 
+        global addppPopup_screen,addppPopup_imgbtn,addppPopup_call_label,addppPopup_ok_label
         if addppPopup_screen == None:
             addppPopup_screen = lv.obj()
             print("addpp_popup")
             addppPopup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
 
             addppPopup_call_label = lv.label(addppPopup_screen)
-            addppPopup_call_label.set_pos(0, 94)
-            addppPopup_call_label.set_size(LCD_X-0, 34)
+            addppPopup_call_label.set_pos(0, 89)
+            addppPopup_call_label.set_size(LCD_X-0, 19)
             addppPopup_call_label.set_text(" ")
             addppPopup_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-            addppPopup_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+            addppPopup_call_label.add_style(style_font_youyuan_20_default, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            addppPopup_ok_label = lv.label(addppPopup_screen)
+            addppPopup_ok_label.set_pos(0, 109)
+            addppPopup_ok_label.set_size(LCD_X-0, 19)
+            addppPopup_ok_label.set_text("成功加好友")
+            addppPopup_ok_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            addppPopup_ok_label.add_style(style_font_youyuan_20_default, lv.PART.MAIN | lv.STATE.DEFAULT)
+
 
             addppPopup_imgbtn = lv.img(addppPopup_screen) #64 
             addppPopup_imgbtn.set_size(73, 78)
             addppPopup_imgbtn.set_src("U:/static/pp_friend03.png")
             addppPopup_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-            addppPopup_imgbtn.set_pos(27, 10)
+            addppPopup_imgbtn.set_pos(27, 5)
 
             self.meta = addppPopup_screen
+        print("self.meta_info",self.meta_info)
         self.timer.start(1*1000,1,self.fun)
         addppPopup_call_label.set_text(str(self.meta_info))
 
     def fun(self,*argc):
         self.count+=1
+        EventMesh.publish("system_sleep_rest")#防止黑屏
+        if self.count > 5:
+            self.count = 0
+            self.timer.stop()
+            EventMesh.publish("return_prev_screen")
+    
+    def Close(self):
+        self.count = 0
+        self.timer.stop()
+        
+    def done_return(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+    def btn1_release(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+    def btn8_press(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+
+addedppPopup_screen = None
+addedppPopup_call_label = None
+class addedppPopupScreen(Screen):#已加过好友弹窗提示
+    NAME = "addedpp_popup"
+    
+    def __init__(self):
+        super().__init__()
+        self.timer=osTimer()
+        self.meta = None
+        self.meta_type = "popup"
+        self.count = 0
+    def initialization(self):
+        EventMesh.publish("close_pp_timer")
+        self.count = 0
+        global addedppPopup_screen,addedppPopup_call_label
+        if addedppPopup_screen == None:
+            addedppPopup_screen = lv.obj()
+            print("addedpp_popup")
+            addedppPopup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            addedppPopup_call_label = lv.label(addedppPopup_screen)
+            addedppPopup_call_label.set_pos(0, 54)
+            addedppPopup_call_label.set_size(LCD_X-0, 50)
+            addedppPopup_call_label.set_text("对方已加过好友了")
+            addedppPopup_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            addedppPopup_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            self.meta = addedppPopup_screen
+        self.timer.start(1*1000,1,self.fun)
+
+    def fun(self,*argc):
+        self.count+=1
+        EventMesh.publish("system_sleep_rest")#防止黑屏
+        if self.count > 5:
+            self.count = 0
+            self.timer.stop()
+            EventMesh.publish("return_prev_screen")
+    
+    def Close(self):
+        self.count = 0
+        self.timer.stop()
+        
+    def done_return(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+    def btn1_release(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+    def btn8_press(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+ownaddppPopup_screen = None
+ownaddedppPopup_call_label = None
+class ownaddppPopupScreen(Screen):#自己已过好友弹窗提示
+    NAME = "ownaddedpp_popup"
+    
+    def __init__(self):
+        super().__init__()
+        self.timer=osTimer()
+        self.meta = None
+        self.meta_type = "popup"
+        self.count = 0
+    def initialization(self):
+        self.count = 0
+        EventMesh.publish("close_pp_timer")
+        global ownaddppPopup_screen ,ownaddedppPopup_call_label
+        if ownaddppPopup_screen == None:
+            ownaddppPopup_screen = lv.obj()
+            print("ownaddedpp_popup")
+            ownaddppPopup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            ownaddedppPopup_call_label = lv.label(ownaddppPopup_screen)
+            ownaddedppPopup_call_label.set_pos(0, 54)
+            ownaddedppPopup_call_label.set_size(LCD_X-0, 50)
+            ownaddedppPopup_call_label.set_text("自己已加过好友了")
+            ownaddedppPopup_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            ownaddedppPopup_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            self.meta = ownaddppPopup_screen
+        self.timer.start(1*1000,1,self.fun)
+
+    def fun(self,*argc):
+        self.count+=1
+        EventMesh.publish("system_sleep_rest")#防止黑屏
+        if self.count > 5:
+            self.count = 0
+            self.timer.stop()
+            EventMesh.publish("return_prev_screen")
+    
+    def Close(self):
+        self.count = 0
+        self.timer.stop()
+        
+    def done_return(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+    def btn1_release(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+    def btn8_press(self):
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+
+
+addfaileppPopup_screen = None
+addfaileppPopup_call_label = None
+class addfaileppPopupScreen(Screen):#交友失败
+    NAME = "addfailepp_popup"
+    
+    def __init__(self):
+        super().__init__()
+        self.timer=osTimer()
+        self.meta = None
+        self.meta_type = "popup"
+        self.count = 0
+    def initialization(self):
+        self.count = 0
+        EventMesh.publish("close_pp_timer")
+        global addfaileppPopup_screen ,addfaileppPopup_call_label
+        if addfaileppPopup_screen == None:
+            addfaileppPopup_screen = lv.obj()
+            print("addfailepp_popup")
+            addfaileppPopup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            addfaileppPopup_call_label = lv.label(addfaileppPopup_screen)
+            addfaileppPopup_call_label.set_pos(0, 54)
+            addfaileppPopup_call_label.set_size(LCD_X-0, 50)
+            addfaileppPopup_call_label.set_text("交友失败,请重试")
+            addfaileppPopup_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+            addfaileppPopup_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+            self.meta = addfaileppPopup_screen
+        self.timer.start(1*1000,1,self.fun)
+
+    def fun(self,*argc):
+        self.count+=1
+        EventMesh.publish("system_sleep_rest")#防止黑屏
         if self.count > 5:
             self.count = 0
             self.timer.stop()
index 9fc1175..361f9b5 100644 (file)
@@ -1392,39 +1392,20 @@ class SILENCETIMEFS_ProtoCol(ProtoCol):#云米
         for i in range(len(str(msg_tmp_d))):
             if msg_tmp_d[i] == ',':
                 count+=1
-
-        for x in range(count):#21:10-7:30@0111110,21:10-7:30@0111110,21:10-7:30@0111110,21:10-7:30@0111110
-            week = []
-            if x >= 4:
-                break
-            if count > 1:
-                # 0100001
-                msg_data = msg_tmp_d.split(',')[x]
-                print("SILENCETIMEFS count",msg_data)
-                b = msg_data.find('-')
-                if b != -1:
-                    data = msg_data.split('-')#-作为分隔符
-                    time = data[1].split('@')#@作为分隔符
-                    print("data",data,time,data[0],time[0])
-                    start_time = data[0]#开始时间
-                    end_time = time[0]#结束时间
-                    enable = 1
-                    week_day = time[1]
-                    for i in range(0,7):
-                        if week_day[i] != '0':
-                            week.append(i)
-                    tmp={}
-                    tmp["start_time"] = start_time
-                    tmp["end_time"] = end_time
-                    tmp["week"] = week
-                    tmp["enable"] = enable
-                    class_in_buf["{}".format(x)] = tmp
-            else:
-                if len(msg_tmp_d) != 0:
-                    b = msg_tmp_d.find('-')
+        if count > 4:
+            count = 4
+        if len(msg_tmp_d) > 0:
+            for x in range(count):#21:10-7:30@0111110,21:10-7:30@0111110,21:10-7:30@0111110,21:10-7:30@0111110
+                week = []
+                if x >= 4:
+                    break
+                if count > 1:
+                    # 0100001
+                    msg_data = msg_tmp_d.split(',')[x]
+                    print("SILENCETIMEFS count",msg_data)
+                    b = msg_data.find('-')
                     if b != -1:
-                        
-                        data = msg_tmp_d.split('-')#-作为分隔符
+                        data = msg_data.split('-')#-作为分隔符
                         time = data[1].split('@')#@作为分隔符
                         print("data",data,time,data[0],time[0])
                         start_time = data[0]#开始时间
@@ -1440,6 +1421,27 @@ class SILENCETIMEFS_ProtoCol(ProtoCol):#云米
                         tmp["week"] = week
                         tmp["enable"] = enable
                         class_in_buf["{}".format(x)] = tmp
+                else:
+                    if len(msg_tmp_d) != 0:
+                        b = msg_tmp_d.find('-')
+                        if b != -1:
+                            
+                            data = msg_tmp_d.split('-')#-作为分隔符
+                            time = data[1].split('@')#@作为分隔符
+                            print("data",data,time,data[0],time[0])
+                            start_time = data[0]#开始时间
+                            end_time = time[0]#结束时间
+                            enable = 1
+                            week_day = time[1]
+                            for i in range(0,7):
+                                if week_day[i] != '0':
+                                    week.append(i)
+                            tmp={}
+                            tmp["start_time"] = start_time
+                            tmp["end_time"] = end_time
+                            tmp["week"] = week
+                            tmp["enable"] = enable
+                            class_in_buf["{}".format(x)] = tmp
 
         with open("/usr/static/storage_file/class_msg.json", 'w+',encoding='utf-8') as fd:
             ujson.dump(class_in_buf,fd)
@@ -1485,7 +1487,8 @@ class SILENCETIME2_ProtoCol(ProtoCol):
         for i in range(len(str(msg_tmp_d))):
             if msg_tmp_d[i] == ',':
                 count+=1
-
+        if count > 4:
+            count = 4
         for x in range(count):#08:00-17:00-1-0111110,08:00-17:00-1-0111110
             week = []
             if count > 1:
@@ -1597,28 +1600,65 @@ class pp_ProtoCol(ProtoCol):
 
         msg = msg[1:-1]
         msg_tmp = msg.decode('ascii')
-        msg_tmp_d = str(msg_tmp.split('pp,')[1])
-
-        len_data = len(str(msg_tmp_d))
+        msg_tmp_d = msg_tmp.split(',')
+        msg_tmp_data = msg_tmp_d[1]
+        len_data = len(str(msg_tmp_data))
+        print(msg_tmp_data,len_data,type(msg_tmp_data))
+    
         if len_data > 1:
-            EventMesh.publish("load_screen", {"screen": "addpp_popup","meta":msg_tmp_d})
+            EventMesh.publish("load_screen", {"screen": "addpp_popup","meta":msg_tmp_data})
             pass
-        elif msg_tmp_d == "1":#对方已加过好友
+        elif msg_tmp_data == "1":#对方已加过好友
+            screen_NAME = EventMesh.publish("get_screen_NAME")
+            # if screen_NAME != None:
+                # if screen_NAME == "pp_popup":
+            EventMesh.publish("load_screen", {"screen": "addedpp_popup"})
             pass
-        elif msg_tmp_d == "2":#自己已加过好友
+        elif msg_tmp_data == "2":#自己已加过好友
+            screen_NAME = EventMesh.publish("get_screen_NAME")
+            # if screen_NAME != None:
+                # if screen_NAME == "pp_popup":
+            EventMesh.publish("load_screen", {"screen": "ownaddedpp_popup"})
             pass
         # EventMesh.publish(constants.PROTOCOL.PP_SEND)  
-#碰碰交友
-class ppinfo_ProtoCol(ProtoCol):
-    """碰碰交友"""
-    TYPE = "pp"
+#删除碰碰交友
+class delpp_ProtoCol(ProtoCol):
+    """删除碰碰交友"""
+    TYPE = "MFCODE_FRIEND_DEL_REQ"
     def send(self, event, msg):
-        # [XT*334588000000156*0006*SILENCETIME2]
-        send_data = self.PID+"*%s*0002*pp"%(self.imei)
+        print("MFCODE_FRIEND_DEL_REQ_ProtoCol:send:")
+         # [SZKW*867387060319491*0008*MFCODE_FRIEND_DEL_REQ]
+        if(msg != ""):
+            
+            msg_tmp = "MFCODE_FRIEND_DEL_REQ,"+ msg
+            
+            data_len = len(msg_tmp)
+            MD5_head_data = self.PID+"*%s*%04X*MFCODE_FRIEND_DEL_REQ"%(self.imei,data_len)
+            MD5_SIGN = self.pack_MD5_head(MD5_head_data)
+            send_data = self.PID+"*%s*%04X*%s"%(self.imei,data_len,msg_tmp)
+            data = "[%s%s]"%(str(MD5_SIGN),send_data)
+
+            print("MFCODE_FRIEND_DEL_REQ_ProtoCol:msg_tmp:%s"%(data))
+            # 通过socket发送到服务器端
+            EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND, data)
+            EventMesh.publish(constants.PROTOCOL.MFCODE_FRIEND_REQ_SEND)
+    def recv(self, event, msg):
+        """
+        @param event:
+        @param msg: 接收到的下行数据
+        """
+        # b'[SZKW*867387060319166*000A*MFCODE_FRIEND_DEL_REQ]'
+
+#
+class reqpp_ProtoCol(ProtoCol):
+    """同步碰碰交友"""
+    TYPE = "MFCODE_FRIEND_REQ"
+    def send(self, event, msg):
+        send_data = self.PID+"*%s*0011*MFCODE_FRIEND_REQ"%(self.imei)
         MD5_SIGN = self.pack_MD5_head(send_data)
         data = "[%s%s]"%(str(MD5_SIGN),send_data)
-        # print("KEYBRD:data:%s"%(data))
-        # print("KEYBRD!!!!!!!!!!!!!",msg)
+        print("MFCODE_FRIEND_REQ:data:%s"%(data))
+        # print("WLKEY!!!!!!!!!!!!!")
         # 通过socket发送到服务器端
         EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data)
 
@@ -1627,22 +1667,103 @@ class ppinfo_ProtoCol(ProtoCol):
         @param event:
         @param msg: 接收到的下行数据
         """
-        # b'[SZKW*867387060319166*000A*KEYBRD]'
-        print("PP recv!!!!!!!!!!!!!",msg)
+        # b'[SZKW*867387060319166*000A*MFCODE_FRIEND_DEL_REQ]'
+#MFCODE_FRIEND
+class revpp_ProtoCol(ProtoCol):
+    """服务器同步下发碰碰交友"""
+    TYPE = "MFCODE_FRIEND"
+    def send(self, event, msg):
+        send_data = self.PID+"*%s*000d*MFCODE_FRIEND"%(self.imei)
+        MD5_SIGN = self.pack_MD5_head(send_data)
+        data = "[%s%s]"%(str(MD5_SIGN),send_data)
+        print("MFCODE_FRIEND:data:%s"%(data))
+        # print("WLKEY!!!!!!!!!!!!!")
+        # 通过socket发送到服务器端
+        EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data)
 
+    def recv(self, event, msg):
+        """
+        @param event:
+        @param msg: 接收到的下行数据
+        """
+        
         msg = msg[1:-1]
+        # print("phonebook:msg:%s\r\n"%msg)
         msg_tmp = msg.decode('ascii')
-        msg_tmp_d = str(msg_tmp.split('pp,')[1])
+        msg_tmp = msg_tmp.split(',')
+        # print("phonebook:len:{}\r\n data:{}".format(len(msg_tmp),msg_tmp))
+        
+        phonebook = {}
+        msg_tmp = msg_tmp[1:]
+        # print("msg_tmp:{} len:{}".format(msg_tmp,len(msg_tmp)))
+        # msg_tmp = ["00310034003500360038","860132060129120",'',"00310034003500360037","860132060129121",'',"00310034003500360036","860132060129122",'',"00310034003500360034","860132060129125",'']
+        j = 0
+        i = 0
+        phonebook_oldtmp = {}
+        # 0 1 2 3
+        for phonebook_tmp in msg_tmp: 
+            
+            # print("phonebook_tmp:{} len:{} j:{}".format(phonebook_tmp,len(phonebook_tmp),j))#名字 号码 PIC 名字 号码 PIC 
+            
+            if (j%3) == 1:#1 
+                i+=1
+                # print("i:{} j:{} phonebook_tmp:{}".format(i,j,phonebook_tmp))
+                if len(phonebook_tmp) != 0:
+                    phonebook_name = UnicodeHexStr_To_Utf8Str(phonebook_oldtmp)
+                    phonebook_name_cont= "{}:{}".format("%02d"%(i),phonebook_tmp)                                      
+                    phonebook[phonebook_name_cont] = phonebook_name
+            j+=1
+            phonebook_oldtmp = phonebook_tmp
+            # print("pppbook_oldtmp!!!:{}".format(str(phonebook_oldtmp)))
+        # print("phonebook!!!:{}".format(str(phonebook)))
+        # with open("/usr/static/storage_file/pplist.json","w",encoding="utf-8") as fd:
+        #     ujson.dump(phonebook,fd)
+            # print("创建好友列表")
+        
+        EventMesh.publish(constants.PROTOCOL.MFCODE_FRIEND_SEND)
+        EventMesh.publish("set_pplist",phonebook)
+        EventMesh.publish("pp_update_data")
+        print("MFCODE_FRIEND:{}".format(phonebook))
+        
+class factory_ProtoCol(ProtoCol):
+    """恢复出厂设置"""
+    TYPE = "FACTORY"
+    def send(self, event, msg):
+        send_data = self.PID+"*%s*0007*FACTORY"%(self.imei)
+        MD5_SIGN = self.pack_MD5_head(send_data)
+        data = "[%s%s]"%(str(MD5_SIGN),send_data)
+        print("FACTORY:data:%s"%(data))
+        # print("WLKEY!!!!!!!!!!!!!")
+        # 通过socket发送到服务器端
+        EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data)
 
-        len_data = len(str(msg_tmp_d))
-        if len_data > 1:
-            EventMesh.publish("load_screen", {"screen": "addpp_popup","meta":msg_tmp_d})
-            pass
-        elif msg_tmp_d == "1":#对方已加过好友
-            pass
-        elif msg_tmp_d == "2":#自己已加过好友
-            pass
-        # EventMesh.publish(constants.PROTOCOL.PP_SEND)  
+    def recv(self, event, msg):
+        """
+        @param event:
+        @param msg: 接收到的下行数据
+        """
+        EventMesh.publish(constants.PROTOCOL.FACTORY_SEND)
+        EventMesh.publish("load_screen", {"screen":"restore"})
+
+class restart_ProtoCol(ProtoCol):
+    """重启"""
+    TYPE = "RESET"
+    def send(self, event, msg):
+        send_data = self.PID+"*%s*0005*RESET"%(self.imei)
+        MD5_SIGN = self.pack_MD5_head(send_data)
+        data = "[%s%s]"%(str(MD5_SIGN),send_data)
+        print("FACTORY:data:%s"%(data))
+        # print("WLKEY!!!!!!!!!!!!!")
+        # 通过socket发送到服务器端
+        EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data)
+
+    def recv(self, event, msg):
+        """
+        @param event:
+        @param msg: 接收到的下行数据
+        """
+        EventMesh.publish(constants.PROTOCOL.RESET_SEND)
+        Power.powerRestart()
 
 class ProtoColResolver(object):
     def __init__(self):
index c4793c3..341c335 100644 (file)
@@ -47,6 +47,17 @@ style_screen.set_pad_right(0)
 style_screen.set_pad_top(0)
 style_screen.set_pad_bottom(0)
 
+style_white_screen = lv.style_t()
+style_white_screen.init()
+style_white_screen.set_radius(0)
+style_white_screen.set_bg_color(lv.color_make(0xff, 0xff, 0xff))
+style_white_screen.set_bg_opa(255)
+style_white_screen.set_border_width(0)
+style_white_screen.set_pad_left(0)
+style_white_screen.set_pad_right(0)
+style_white_screen.set_pad_top(0)
+style_white_screen.set_pad_bottom(0)
+
 style_bar = lv.style_t() 
 style_bar.init()
 style_bar.set_radius(10)
@@ -59,6 +70,9 @@ style_bar.set_pad_right(0)
 style_bar.set_pad_top(0)
 style_bar.set_pad_bottom(0)
 
+style_font_youyuan_20_default = lv.style_t()
+style_font_youyuan_20_default.init()
+style_font_youyuan_20_default.set_text_color(lv.color_make(0xff, 0xff, 0xff))
 
 style_bar_indic = lv.style_t()
 style_bar_indic.init()
@@ -108,6 +122,13 @@ style_font_youyuan_20_gray = lv.style_t()
 style_font_youyuan_20_gray.init()
 style_font_youyuan_20_gray.set_text_color(lv.color_make(128, 128, 128))
 style_font_youyuan_20_gray.set_text_font(lv.K01_font_16_ALL)
+
+
+style_font_youyuan_20_yellow = lv.style_t()
+style_font_youyuan_20_yellow.init()
+style_font_youyuan_20_yellow.set_text_color(lv.color_make(242, 246, 35))
+style_font_youyuan_20_yellow.set_text_font(lv.K01_font_16_ALL)
+
 style_img = lv.style_t()
 style_img.init()
 style_img.set_img_opa(255)
@@ -1070,7 +1091,8 @@ class DialingScreen(Screen):
         screen_NAME = EventMesh.publish("get_screen_NAME")
         if screen_NAME != None:
             if screen_NAME != "dialing_noplay_popup":
-                EventMesh.publish("load_screen", {"screen": "main_menu"})  
+                EventMesh.publish("return_prev_screen")
+                # EventMesh.publish("load_screen", {"screen": "main_menu"})  
 
     def Close(self):
         self.timer.stop()
@@ -1552,7 +1574,8 @@ class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出
             EventMesh.publish("set_hangup_mode",0)
         EventMesh.publish("set_interrup_incall",0)
         EventMesh.publish("set_UI_high_priority",0)
-        EventMesh.publish("load_screen", {"screen": "main_menu"})  
+        EventMesh.publish("return_prev_screen")
+        # EventMesh.publish("load_screen", {"screen": "main_menu"})  
 
     def Close(self):
         self.timer1.stop()
@@ -3179,7 +3202,8 @@ class IncomingCallScreen(Screen):
         screen_NAME = EventMesh.publish("get_screen_NAME")
         if screen_NAME != None:
             if screen_NAME != "dialing_noplay_popup":
-                EventMesh.publish("load_screen", {"screen": "main_menu"})  
+                EventMesh.publish("return_prev_screen")
+                # EventMesh.publish("load_screen", {"screen": "main_menu"})  
 
 
     def btn1_release(self):
@@ -3833,7 +3857,8 @@ class OnCallScreen(Screen):
         screen_NAME = EventMesh.publish("get_screen_NAME")
         if screen_NAME != None:
             if screen_NAME != "dialing_noplay_popup":
-                EventMesh.publish("load_screen", {"screen": "main_menu"})  
+                EventMesh.publish("return_prev_screen")
+                # EventMesh.publish("load_screen", {"screen": "main_menu"})  
         
     def Close(self):
         self.timer.stop()
@@ -4289,8 +4314,7 @@ class ContactsScreen(Screen):
         EventMesh.publish("save_phonenum", phone_num)  
 
         # phone_num_tmp = int(phone_num)
-        
-        "dialing_noplay_popup"
+    
         EventMesh.publish("load_screen", {"screen": "dialing_noplay_popup"})
 
 
@@ -4734,146 +4758,6 @@ class TemperatureScreen(Screen):
         EventMesh.publish("load_screen", {"screen": "main_menu"})
 
   
-# class TemperatureScreen(Screen):
-#     NAME = "temperature"
-
-#     def __init__(self):
-#         super().__init__()
-#         self.meta = None
-#         self.temp_timer = osTimer()
-#         self.count = 0
-#     def initialization(self):
-#         global temperature_screen,temperature_bg_img ,temperature_body_label ,temperature_degree_img ,temperature_value_label,\
-#             temperature_wrist_label,temperature_wrist_degree_img ,temperature_wrist_value_label,temperature_measure_end_label,temperature_measure_countdown_label
-#         if temperature_screen == None:
-#             temperature_screen = lv.obj()
-#             print("temperature_screen")
-#             temperature_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-#             temperature_bg_img = lv.img(temperature_screen)
-#             temperature_bg_img.set_pos(30, 50)
-#             temperature_bg_img.set_size(31, 32)
-#             temperature_bg_img.set_src("U:/static/temp_hand.png")
-#             temperature_bg_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-#             temperature_body_label = lv.label(temperature_screen)
-#             temperature_body_label.set_pos(80, 40)
-#             temperature_body_label.set_size(160, 20)
-#             temperature_body_label.set_text("当前腕温")
-#             temperature_body_label.set_long_mode(lv.label.LONG.WRAP)
-#             temperature_body_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
-#             temperature_body_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-#             temperature_degree_img = lv.img(temperature_screen)
-#             temperature_degree_img.set_pos(146, 70)
-#             temperature_degree_img.set_size(22, 22)
-#             temperature_degree_img.set_src("U:/static/degree.png")
-#             temperature_degree_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-#             temperature_value_label = lv.label(temperature_screen)
-#             temperature_value_label.set_pos(90,73)
-#             temperature_value_label.set_size(50, 30)
-#             temperature_value_label.set_text("--")
-#             temperature_value_label.set_long_mode(lv.label.LONG.WRAP)
-#             temperature_value_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-#             temperature_value_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-#             # temperature_wrist_label = lv.label(temperature_screen)
-#             # temperature_wrist_label.set_pos(80,120)
-#             # temperature_wrist_label.set_size(100, 20)
-#             # temperature_wrist_label.set_text("当前腕温")
-#             # temperature_wrist_label.set_long_mode(lv.label.LONG.WRAP)
-#             # temperature_wrist_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-#             # temperature_wrist_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-#             # temperature_wrist_degree_img = lv.img(temperature_screen)
-#             # temperature_wrist_degree_img.set_pos(150, 150)
-#             # temperature_wrist_degree_img.set_size(22, 22)
-#             # temperature_wrist_degree_img.set_src("U:/static/degree.png")
-#             # temperature_wrist_degree_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-#             # temperature_wrist_value_label = lv.label(temperature_screen)
-#             # temperature_wrist_value_label.set_pos(96,155)
-#             # temperature_wrist_value_label.set_size(50, 30)
-#             # temperature_wrist_value_label.set_text("--")
-#             # temperature_wrist_value_label.set_long_mode(lv.label.LONG.WRAP)
-#             # temperature_wrist_value_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-#             # temperature_wrist_value_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-#             temperature_measure_countdown_label = lv.label(temperature_screen)
-#             temperature_measure_countdown_label.set_pos(0,160)
-#             temperature_measure_countdown_label.set_size(240, 30)
-#             temperature_measure_countdown_label.set_text("03:00")
-#             temperature_measure_countdown_label.set_long_mode(lv.label.LONG.WRAP)
-#             temperature_measure_countdown_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-#             temperature_measure_countdown_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-#             temperature_measure_end_label = lv.label(temperature_screen)
-#             temperature_measure_end_label.set_pos(0,220)
-#             temperature_measure_end_label.set_size(240, 30)
-#             temperature_measure_end_label.set_text(" ")
-#             temperature_measure_end_label.set_long_mode(lv.label.LONG.WRAP)
-#             temperature_measure_end_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-#             temperature_measure_end_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-#             self.meta = temperature_screen
-#         if temperature_value_label != None:
-#             temperature_value_label.set_text("--")
-#         if temperature_measure_end_label != None:
-#             temperature_measure_end_label.set_text(" ")
-#         if temperature_measure_countdown_label != None:
-#             temperature_measure_countdown_label.set_text("03:00")
-#         EventMesh.publish("set_temp_state",1)
-#         EventMesh.publish(constants.EVENT.START_TEMP)
-#         self.count = 0
-#         self.countdown = 3*60
-#         self.temp_timer.start(1*1000, 1, self.temp_timerout)
-#     def temp_timerout(self,*args):
-#         global temperature_value_label,temperature_measure_countdown_label,temperature_measure_end_label
-#         self.count += 1
-#         EventMesh.publish("system_sleep_rest")#防止黑屏
-#         temp = EventMesh.publish(constants.EVENT.GET_TEMP) 
-#         tmp = str(temp).split('.')[0] + '.' + str(temp).split('.')[1][:1]#获取小数点后一位 舍去小数点最后一位
-#         if temperature_measure_end_label != None:
-#             temperature_value_label.set_text("{}".format(tmp))
-
-#         tmp_f = str(temp).split('.')[0] 
-#         tmp_f_tmp = int(tmp_f)
-
-#         tmp_d = str(temp).split('.')[1][:1]
-#         tmp_d_tmp = int(tmp_d)
-        
-#         if self.countdown > 0:
-#             self.countdown-=1
-#         min = self.countdown / 60
-#         sec = self.countdown % 60
-#         if temperature_measure_countdown_label != None:
-#             temperature_measure_countdown_label.set_text("{}:{}".format("%02d"%(min),"%02d"%(sec)))
-
-#         # print("temp:{} tmp_f:{} tmp_f_tmp:{} tmp_d:{} tmp_d_tmp:{} self.count:{}".format(temp,tmp_f,tmp_f_tmp,tmp_d,tmp_d_tmp,self.count)) 
-#         if self.count >= 3*60:
-#             self.count = 0
-#             EventMesh.publish("set_temp_state",0)
-#             if temperature_measure_end_label != None:
-#                 temperature_measure_end_label.set_text("测量完成")
-#             self.temp_timer.stop()
-#             EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp])
-#             EventMesh.publish(constants.EVENT.STOP_TEMP)
-#     def Close(self):
-#         self.count = 0
-#         self.temp_timer.stop()
-#         EventMesh.publish("set_temp_state",0)
-#         EventMesh.publish(constants.EVENT.STOP_TEMP)
-        
-#     def done_return(self):
-#         EventMesh.publish("load_screen", {"screen": "health"})
-
-#     def btn1_release(self):
-#         EventMesh.publish("load_screen", {"screen": "health"})
-        
-#     def btn8_press(self):
-#         EventMesh.publish("watch_top_show")
-#         EventMesh.publish("load_screen", {"screen": "main_menu"})
-
 
 
 line_points = [{"x":0,"y":0},{"x":240,"y":0}]
@@ -5230,160 +5114,6 @@ class Spo2Screen(Screen):
         EventMesh.publish("load_screen", {"screen": "main_menu"})
 
 
-
-
-# class Spo2Screen(Screen):
-#     NAME = "spo2"
-
-#     def __init__(self):
-#         super().__init__()
-#         self.meta = None
-#         self.timer = osTimer()
-#         self.point = 0
-#         self.spo2_value = 0
-#         self.last_spo2_value = 0
-#         self.rtc = RTC()
-
-#     def initialization(self):
-#         global spo2_screen ,spo2_label_0 ,spo2_done_img ,spo2_label ,spo2_label_1 ,spo2_line ,spo2_last_time,spo2_last_value 
-#         if spo2_screen == None:
-#             spo2_screen = lv.obj()
-#             print("spo2_screen")
-#             spo2_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-#             spo2_label_0 = lv.label(spo2_screen)
-#             spo2_label_0.set_pos(0, 10)
-#             spo2_label_0.set_size(240, 40)
-#             spo2_label_0.set_text("血氧")
-#             spo2_label_0.set_long_mode(lv.label.LONG.WRAP)
-#             spo2_label_0.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-#             spo2_label_0.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-#             spo2_done_img = lv.img(spo2_screen)
-#             spo2_done_img.set_pos(89, 50)
-#             spo2_done_img.set_size(62, 84)
-#             spo2_done_img.set_src("U:/static/IMAGE_SPO2_ONLY_TEST_DONE.png")
-
-#             spo2_label = lv.label(spo2_screen)
-#             spo2_label.set_size(240,30)
-#             spo2_label.set_pos(0,160)
-#             spo2_label.set_text(" ")
-#             spo2_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-#             spo2_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-#             spo2_label_1 = lv.label(spo2_screen)
-#             spo2_label_1.set_size(240,40)
-#             spo2_label_1.set_pos(0,200)
-#             spo2_label_1.set_text("测量中.")
-#             spo2_label_1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-#             spo2_label_1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-            
-#             spo2_line = lv.line(spo2_screen)
-#             spo2_line.set_points(line_points,2)
-#             spo2_line.set_pos(0,240)
-#             spo2_line.set_size(240,10)
-#             spo2_line.add_style(style_line,0)
-
-#             spo2_last_time = lv.label(spo2_screen)
-#             spo2_last_time.set_size(240, 15)
-#             spo2_last_time.set_pos(0, 250)
-#             spo2_last_time.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-#             spo2_last_time.set_text(" ")
-#             spo2_last_time.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-
-#             spo2_last_value = lv.label(spo2_screen)
-#             spo2_last_value.set_size(240, 15)
-#             spo2_last_value.set_pos(0, 280)
-#             spo2_last_value.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-#             spo2_last_value.set_text(" ")
-#             spo2_last_value.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-#             self.meta = spo2_screen
-
-#         self.point = 0
-#         self.spo2_value = 0
-#         self.timer.start(1*1000, 1, self.start_measure)
-#         EventMesh.publish("set_spo2_state",1)#2代表后台进入血氧测试
-#         EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)
-#         self.last_spo2_value = EventMesh.publish("get_old_spo2_data")
-#         spo2_label.set_text("--%")
-#         if self.last_spo2_value == 0:
-#             spo2_last_value.set_text(" ")
-#         else:
-#             spo2_last_value.set_text("{}%".format(self.last_spo2_value))
-
-#     def start_measure(self,*args):
-#         global spo2_screen ,spo2_label_0 ,spo2_done_img ,spo2_label ,spo2_label_1 ,spo2_line ,spo2_last_time,spo2_last_value 
-#         self.point = self.point + 1
-#         EventMesh.publish("system_sleep_rest")#防止黑屏
-#         self.spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
-#         if self.spo2_value == 0:
-#             spo2_label.set_text("--%")
-#         else:
-#             spo2_label.set_text("{} %".format(self.spo2_value))
-#         if self.point%4 == 0 :
-#             spo2_label_1.set_text("测量中..")
-#         if self.point%4 == 1 :
-#             spo2_label_1.set_text("测量中...")
-#         if self.point%4 == 2 :
-#             spo2_label_1.set_text("测量中....")
-#         if self.point%4 == 3 :
-#             spo2_label_1.set_text("测量中.")
-
-#         if self.point > 60: #测20s
-#             self.spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
-#             # print("ui self.spo2_value :{}".format(self.spo2_value))
-#             if self.spo2_value > 85 and self.spo2_value != None:
-#                 EventMesh.publish("set_old_spo2_data",self.spo2_value)
-#                 EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,self.spo2_value)
-#             spo2_label.set_text("{} %".format(self.spo2_value))
-#             if self.spo2_value == 0:
-#                 spo2_label.set_text(" ")
-#                 spo2_label_1.set_text("退出,请重新测量")
-#                 self.last_spo2_value = EventMesh.publish("get_old_spo2_data")
-#                 spo2_last_value.set_text(" ")
-#             else:
-#                 self.last_spo2_value = self.spo2_value
-#                 spo2_last_value.set_text("{}%".format(self.last_spo2_value))
-#                 spo2_label_1.set_text("测量完成")
-#                 time = EventMesh.publish("screen_get_time")
-#                 #print("time ",time)
-#                 rtc_time = self.rtc.datetime()
-#                 time_time ="  {}:{}".format("%02d"%(time[0][0]),"%02d"%(time[0][1]))#测量时间
-#                 spo2_last_time.set_text(str(rtc_time[0])+'/'+str(rtc_time[1])+'/'+str(rtc_time[2])+str(time_time))
-            
-            
-
-#             self.timer.stop()
-#             self.point = 0
-#             EventMesh.publish("set_spo2_state",0)#0代表关闭测试
-#             EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
-#             # spo2_last_time.set_text()
-
-#     def Close(self):
-#         self.timer.stop()
-#         get_hr_state = EventMesh.publish("get_hr_state")
-#         get_spo2_state = EventMesh.publish("get_spo2_state")
-#         if get_hr_state == 1 or get_spo2_state == 1:
-#             EventMesh.publish("set_spo2_state",0)#0代表关闭测试
-#             EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
-
-#     def done_return(self):
-#         EventMesh.publish("load_screen", {"screen": "health"})
-
-#     def btn1_release(self):
-#         EventMesh.publish("load_screen", {"screen": "health"})
-        
-#     def btn8_press(self):
-#         EventMesh.publish("watch_top_show")
-#         EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-
-
-
-
-
-
 # -------------------------------------------countdown screen----------------------------------------------------------
 countdown_screen = None 
 countdown_title = None
@@ -7260,7 +6990,7 @@ down_showt_battery_img.set_src("U:/static/vbat_0.png")
 down_showt_battery_img.add_style(style_img, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 
-power_line_points = [{"x":0,"y":0},{"x":0,"y":10}]
+power_line_points = [{"x":0,"y":0},{"x":0,"y":0}]
 power_line_red = lv.style_t()
 power_line_red.init()
 power_line_red.set_line_width(0)#23 宽度
@@ -7310,6 +7040,133 @@ down_show_date_span.set_size(128, 20)
 down_show_date_span.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
 down_show_date_span.set_text("%02d/%02d 星期%s"%(date1,date2,get_week(week)))
 down_show_date_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+# volum_bar_1 = lv.bar(down_show_screen)
+# volum_bar_1.set_pos(int(10),int(65))
+# volum_bar_1.set_size(108,15)
+# volum_bar_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+# volum_bar_1.set_style_anim_time(1000, 0)
+# volum_bar_1.set_mode(lv.bar.MODE.NORMAL)
+# volum_bar_1.set_value(100, lv.ANIM.OFF)
+# volum_bar_1.add_flag(lv.obj.FLAG.HIDDEN)
+# # create style style_screen_bar_1_main_main_default
+# style_screen_bar_1_main_main_default = lv.style_t()
+# style_screen_bar_1_main_main_default.init()
+# style_screen_bar_1_main_main_default.set_radius(10)
+# style_screen_bar_1_main_main_default.set_bg_color(lv.color_make(0x00,0x00,0x00))
+# style_screen_bar_1_main_main_default.set_bg_grad_color(lv.color_make(0x21,0x95,0xf6))
+# style_screen_bar_1_main_main_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
+# style_screen_bar_1_main_main_default.set_bg_opa(60)
+
+# # add style for screen_bar_1
+# volum_bar_1.add_style(style_screen_bar_1_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+# # create style style_screen_bar_1_main_indicator_default
+# style_screen_bar_1_main_indicator_default = lv.style_t()
+# style_screen_bar_1_main_indicator_default.init()
+# style_screen_bar_1_main_indicator_default.set_radius(10)
+# style_screen_bar_1_main_indicator_default.set_bg_color(lv.color_make(0x80,0x80,0x80))
+# style_screen_bar_1_main_indicator_default.set_bg_grad_color(lv.color_make(0x21,0x95,0xf6))
+# style_screen_bar_1_main_indicator_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
+# style_screen_bar_1_main_indicator_default.set_bg_opa(255)
+
+# # add style for screen_bar_1
+# volum_bar_1.add_style(style_screen_bar_1_main_indicator_default, lv.PART.INDICATOR|lv.STATE.DEFAULT)
+
+# volum_slider_1 = lv.slider(down_show_screen)
+# volum_slider_1.set_pos(int(19),int(70))
+# volum_slider_1.set_size(90,5)
+# volum_slider_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+# volum_slider_1.set_range(0, 100)
+# volum_slider_1.set_value(0, False)
+# volum_slider_1.add_flag(lv.obj.FLAG.HIDDEN)
+# create style style_screen_slider_1_main_main_default
+# style_screen_slider_1_main_main_default = lv.style_t()
+# style_screen_slider_1_main_main_default.init()
+# style_screen_slider_1_main_main_default.set_radius(30)
+# style_screen_slider_1_main_main_default.set_bg_color(lv.color_make(237,30,121))
+# style_screen_slider_1_main_main_default.set_bg_grad_color(lv.color_make(237,30,121))
+# style_screen_slider_1_main_main_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
+# style_screen_slider_1_main_main_default.set_bg_opa(0)
+# style_screen_slider_1_main_main_default.set_outline_color(lv.color_make(237,30,121))
+# style_screen_slider_1_main_main_default.set_outline_width(0)
+# style_screen_slider_1_main_main_default.set_outline_opa(0)
+
+# # add style for screen_slider_1
+# volum_slider_1.add_style(style_screen_slider_1_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+# create style style_screen_slider_1_main_indicator_default
+# style_screen_volum_slider_1_main_indicator_default = lv.style_t()
+# style_screen_volum_slider_1_main_indicator_default.init()
+# style_screen_volum_slider_1_main_indicator_default.set_radius(30)
+# style_screen_volum_slider_1_main_indicator_default.set_bg_color(lv.color_make(237,30,121))
+# style_screen_volum_slider_1_main_indicator_default.set_bg_grad_color(lv.color_make(237,30,121))
+# style_screen_volum_slider_1_main_indicator_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
+# style_screen_volum_slider_1_main_indicator_default.set_bg_opa(255)
+
+# # add style for screen_slider_1
+# volum_slider_1.add_style(style_screen_volum_slider_1_main_indicator_default, lv.PART.INDICATOR|lv.STATE.DEFAULT)
+
+# # create style style_screen_slider_1_main_knob_default
+# style_screen_volum_slider_1_main_knob_default = lv.style_t()
+# style_screen_volum_slider_1_main_knob_default.init()
+# style_screen_volum_slider_1_main_knob_default.set_radius(30)
+# style_screen_volum_slider_1_main_knob_default.set_bg_color(lv.color_make(237,30,121))
+# style_screen_volum_slider_1_main_knob_default.set_bg_grad_color(lv.color_make(237,30,121))
+# style_screen_volum_slider_1_main_knob_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
+# style_screen_volum_slider_1_main_knob_default.set_bg_opa(255)
+
+# # add style for screen_slider_1
+# volum_slider_1.add_style(style_screen_volum_slider_1_main_knob_default, lv.PART.KNOB|lv.STATE.DEFAULT)
+
+
+
+# brightress_slider_1 = lv.slider(down_show_screen)
+# brightress_slider_1.set_pos(int(19),int(70))
+# brightress_slider_1.set_size(90,5)
+# brightress_slider_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+# brightress_slider_1.set_range(0, 100)
+# brightress_slider_1.set_value(0, False)
+# brightress_slider_1.add_flag(lv.obj.FLAG.HIDDEN)
+# create style style_screen_slider_1_main_main_default
+# style_screen_slider_1_main_main_default = lv.style_t()
+# style_screen_slider_1_main_main_default.init()
+# style_screen_slider_1_main_main_default.set_radius(30)
+# style_screen_slider_1_main_main_default.set_bg_color(lv.color_make(247,147,30))
+# style_screen_slider_1_main_main_default.set_bg_grad_color(lv.color_make(247,147,30))
+# style_screen_slider_1_main_main_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
+# style_screen_slider_1_main_main_default.set_bg_opa(0)
+# style_screen_slider_1_main_main_default.set_outline_color(lv.color_make(247,147,30))
+# style_screen_slider_1_main_main_default.set_outline_width(0)
+# style_screen_slider_1_main_main_default.set_outline_opa(0)
+
+# # add style for screen_slider_1
+# brightress_slider_1.add_style(style_screen_slider_1_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+# # create style style_screen_slider_1_main_indicator_default
+# style_screen_slider_1_main_indicator_default = lv.style_t()
+# style_screen_slider_1_main_indicator_default.init()
+# style_screen_slider_1_main_indicator_default.set_radius(30)
+# style_screen_slider_1_main_indicator_default.set_bg_color(lv.color_make(247,147,30))
+# style_screen_slider_1_main_indicator_default.set_bg_grad_color(lv.color_make(247,147,30))
+# style_screen_slider_1_main_indicator_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
+# style_screen_slider_1_main_indicator_default.set_bg_opa(255)
+
+# # add style for screen_slider_1
+# brightress_slider_1.add_style(style_screen_slider_1_main_indicator_default, lv.PART.INDICATOR|lv.STATE.DEFAULT)
+
+# # create style style_screen_slider_1_main_knob_default
+# style_screen_slider_1_main_knob_default = lv.style_t()
+# style_screen_slider_1_main_knob_default.init()
+# style_screen_slider_1_main_knob_default.set_radius(30)
+# style_screen_slider_1_main_knob_default.set_bg_color(lv.color_make(247,147,30))
+# style_screen_slider_1_main_knob_default.set_bg_grad_color(lv.color_make(247,147,30))
+# style_screen_slider_1_main_knob_default.set_bg_grad_dir(lv.GRAD_DIR.NONE)
+# style_screen_slider_1_main_knob_default.set_bg_opa(255)
+
+# # add style for screen_slider_1
+# brightress_slider_1.add_style(style_screen_slider_1_main_knob_default, lv.PART.KNOB|lv.STATE.DEFAULT)
+
 class down_Screen(Screen):#下滑界面
     NAME = "down_screen"
 
@@ -7318,9 +7175,49 @@ class down_Screen(Screen):#下滑界面
         self.rtc = RTC()
         self.timer = osTimer()
         self.meta = down_show_screen
+
+        # brightress_slider_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.change_bright(e)), lv.EVENT.VALUE_CHANGED, None)
+        # brightress_slider_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.change_bright(e)), lv.EVENT.RELEASED, None)
+        # volum_slider_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e)), lv.EVENT.VALUE_CHANGED, None)
+        # volum_slider_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.save_choice(e)), lv.EVENT.RELEASED, None)
+
         down_show_bright_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e,"brightness")), lv.EVENT.CLICKED, None)
         down_show_volume_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e,"totalvolume")), lv.EVENT.CLICKED, None)
         down_show_setting_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e,"setting")), lv.EVENT.CLICKED, None)
+
+    def img_cb(self,e,msg):
+        if msg == "brightness":
+            # volum_slider_1.add_flag(lv.obj.FLAG.HIDDEN)
+            # brightress_slider_1.clear_flag(lv.obj.FLAG.HIDDEN)
+            EventMesh.publish("load_screen", {"screen": "brightness"})
+        elif msg == "totalvolume":
+            # brightress_slider_1.add_flag(lv.obj.FLAG.HIDDEN)
+            # volum_slider_1.clear_flag(lv.obj.FLAG.HIDDEN)
+            EventMesh.publish("load_screen", {"screen": "totalvolume"})
+        else:
+            if msg == 'setting':
+                EventMesh.publish("load_screen", {"screen": "setting"})
+                pass
+
+
+    # def change_bright(self,e):#调节亮度
+    #     code = e.get_code()
+    #     value_slider = brightress_slider_1.get_value()
+    #     if code == lv.EVENT.RELEASED:
+    #         value_slider = brightress_slider_1.get_value()
+    #         print("bright value_slider",value_slider)
+            
+
+    # def change_volum(self,e):#调节音量
+    #     code = e.get_code()
+    #     value_slider = volum_slider_1.get_value()
+    #     if code == lv.EVENT.RELEASED:
+    #         value_slider = volum_slider_1.get_value()
+    #         print("volum value_slider",value_slider)
+        
+        
+
+       
     
     def initialization(self):   
         print("down_screen") 
@@ -7388,21 +7285,23 @@ class down_Screen(Screen):#下滑界面
             level = msg[1]
             if level >= 99:
                 level = 100
-            line_len = int(level*(21/100))
-            # print("__battery_cb:",level,line_len,30/100)
-            if line_len >= 21:
-                line_len = 21
-            if line_len <= 5:
-                line_len = 5
-
-            set_x = int(103+line_len//2)
-            down_showt_battery_line.set_pos(int(set_x),int(6))
-            down_showt_battery_line.set_size(line_len,10)
-            down_showt_battery_line.set_style_line_width(line_len,lv.PART.MAIN)
-            if line_len <= 5:
+            line_len = int(level*(20/100))
+            if level <= 5:
+                level = 5
+
+            line_points = [
+                   {"x":0, "y":0}, 
+                   {"x":line_len, "y":0}, 
+                         ]
+            down_showt_battery_line.set_size(int(line_len),int(2))
+            down_showt_battery_line.set_pos(int(103),int(11))
+            down_showt_battery_line.set_points(line_points, 2)
+            down_showt_battery_line.set_style_line_width(10,lv.PART.MAIN)
+
+            if line_len <= 3:
                 down_showt_battery_line.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
             else:
-                down_showt_battery_line.set_style_line_color(lv.color_make(0x00,0xff,0x00),0) 
+                down_showt_battery_line.set_style_line_color(lv.color_make(0xff,0xff,0xff),0) 
         pass
 
     def Close(self):
@@ -7450,6 +7349,9 @@ up_show_bg_img_label1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
 up_show_bg_img_label1.set_text("0")
 up_show_bg_img_label1.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
+
+
+
 class up_Screen(Screen):#上滑界面
     NAME = "up_screen"
 
@@ -7471,60 +7373,7 @@ class up_Screen(Screen):#上滑界面
         self.__stepValue(None, step)
         pass
 
-    def __time(self, event, msg):
-    #时间
-        rtc_time = self.rtc.datetime()
-        month = rtc_time[1]
-        day = rtc_time[2]
-        year = rtc_time[0]
-        # week = ("星期%s"%(self.get_week(rtc_time[3])))
-        week_data = rtc_time[3]
-        # time = [rtc_time[4], rtc_time[5]]
 
-        down_showt_time1_text.set_text("{}:{}".format("%02d"%(rtc_time[4]),"%02d"%(rtc_time[5])))
-        down_show_date_span.set_text("%02d/%02d  星期%s"%(month,day,get_week(week)))
-       
-    def __signal(self, event, msg):
-        #print("__signal_cb:",str(msg))
-        # 信号强度值范围0 ~ 31,值越大表示信号强度越好
-        #print("__signal_cb:{}".format(msg//8))
-        if msg:
-            if msg >= 0 and msg<=31 :
-                down_show_mpsignal_img.set_src("U:/static/mpsignal{}.png".format(msg//8+1))
-            else :
-                down_show_mpsignal_img.set_src("U:/static/mpsignal5.png") 
-
-    def __battery(self, event, msg):
-        #print("__battery_cb:",str(msg))
-        #print(msg)
-        if msg[0] == '1':
-            down_showt_battery_line.set_pos(int(0),int(0))
-            down_showt_battery_line.set_size(0,0)
-            down_showt_battery_line.set_style_line_width(0,lv.PART.MAIN)
-            down_showt_battery_img.set_src("U:/static/charge_ing.png")
-            # watchface1_res_stat_charge_in_img.set_src("U:/static/charge_in.png")
-        else:
-            down_showt_battery_img.set_src("U:/static/vbat_0.png")
-            level = msg[1]
-            if level >= 99:
-                level = 100
-            line_len = int(level*(21/100))
-            # print("__battery_cb:",level,line_len,30/100)
-            if line_len >= 21:
-                line_len = 21
-            if line_len <= 5:
-                line_len = 5
-
-            set_x = int(103+line_len//2)
-            down_showt_battery_line.set_pos(int(set_x),int(6))
-            down_showt_battery_line.set_size(line_len,10)
-            down_showt_battery_line.set_style_line_width(line_len,lv.PART.MAIN)
-            if line_len <= 5:
-                down_showt_battery_line.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
-            else:
-                down_showt_battery_line.set_style_line_color(lv.color_make(0x00,0xff,0x00),0) 
-        pass
-    
     def __stepValue(self, event, msg):
         if msg == None:    
             up_show_bg_img_label1.set_text("0")
@@ -8051,221 +7900,10 @@ style_screen_calendar_1_main_main_default.set_border_opa(255)
 
 
 
-
-calendar_screen = None
-calendar_label_screen = None
-screen_calendar_1 = None
-class calendar_Screen(Screen):#日历
-    #上课禁用
-    NAME = "calendar_screen"
-    
-    def __init__(self):
-        super().__init__()
-        self.meta = None
-        self.preview1 = None
-        self.timer = osTimer()
-        self.open_preview1 = 0
-
-    def initialization(self):
-        global calendar_screen,calendar_label_screen,screen_calendar_1
-        data = RTC().datetime()
-        hour = data[4]
-        min = data[5]
-
-        week = data[3]
-
-        date1 = data[0]
-        date2 = data[1]
-        date3 = data[2]
-        highlighted_days=[lv.calendar_date_t({'year':date1, 'month':date2, 'day':date3})]
-        if calendar_screen == None:
-            calendar_screen = lv.obj()
-            print("calendar_screen")
-            calendar_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-            screen_calendar_1 = lv.calendar(calendar_screen)
-            screen_calendar_1.set_pos(int(0),int(30))
-            screen_calendar_1.set_size(240,260)
-            screen_calendar_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-            screen_calendar_1.set_today_date(date1,date2,date3)
-            screen_calendar_1.set_showed_date(date1,date2)
-            screen_calendar_1.set_highlighted_dates(highlighted_days, len(highlighted_days))
-            screen_calendar_1.add_style(style_screen_calendar_1_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-            screen_calendar_1_header = lv.calendar_header_arrow(screen_calendar_1)
-            screen_calendar_1_header.add_style(style_screen_calendar_1_extra_header_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-            screen_calendar_1.get_btnmatrix().add_event_cb(lambda e: EventMesh.callback_wrapper(self.style_screen_calendar_1_extra_ctrl_day_names_items_default_event_cb(e)), lv.EVENT.DRAW_PART_BEGIN, None)
-            # screen_calendar_1.get_btnmatrix().add_event_cb(style_screen_calendar_1_extra_ctrl_day_names_items_default_event_cb, lv.EVENT.DRAW_PART_BEGIN, None)
-            screen_calendar_1.get_btnmatrix().add_event_cb(lambda e: EventMesh.callback_wrapper(self.style_screen_calendar_1_extra_ctrl_days_of_current_month_items_default_event_cb(e)),lv.EVENT.DRAW_PART_BEGIN,None)
-
-            screen_calendar_1.get_btnmatrix().add_event_cb(lambda e: EventMesh.callback_wrapper(self.style_screen_calendar_1_extra_ctrl_highlight_items_default_event_cb(e)),lv.EVENT.DRAW_PART_BEGIN,None)
-
-            screen_calendar_1.get_btnmatrix().add_event_cb(lambda e: EventMesh.callback_wrapper(self.style_screen_calendar_1_extra_ctrl_today_items_default_event_cb(e)),lv.EVENT.DRAW_PART_BEGIN,None)
-
-            screen_calendar_1.get_btnmatrix().add_event_cb(lambda e: EventMesh.callback_wrapper(self.style_screen_calendar_1_extra_ctrl_other_month_items_default_event_cb(e)),lv.EVENT.DRAW_PART_BEGIN,None)
-
-            self.meta = calendar_screen
-
-
-        screen_calendar_1.set_today_date(date1,date2,date3)
-        screen_calendar_1.set_showed_date(date1,date2)
-        screen_calendar_1.set_highlighted_dates(highlighted_days, len(highlighted_days))
-        
-        if EventMesh.publish(constants.EVENT.GET_CONNECT) != 0:#未联网提示关机
-            self.preview1 = camera.camPreview(0,240,320,128,128,1)
-            state = self.preview1.open()
-            self.timer.start(1*1000,1,self.fun)
-            camera_video_label_screen.set_text(" ")
-            self.open_preview1 = 1
-        else:
-            self.open_preview1 = 0
-
-            camera_video_label_screen.set_text("无SIM卡或无网络")
-
-
-
-    def style_screen_calendar_1_extra_ctrl_days_of_current_month_items_default_event_cb(self,e):
-        obj = lv.btnmatrix.__cast__(e.get_target())
-        dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
-        if (dsc.id >= 7
-            and not obj.has_btn_ctrl(dsc.id, lv.btnmatrix.CTRL.CUSTOM_1)
-            and not obj.has_btn_ctrl(dsc.id, lv.btnmatrix.CTRL.CUSTOM_2)
-            and not obj.has_btn_ctrl(dsc.id, lv.btnmatrix.CTRL.DISABLED)):
-            dsc.rect_dsc.bg_color = lv.color_make(0x01,0xa2,0xb1)
-
-            dsc.rect_dsc.bg_opa = 0
-            dsc.rect_dsc.border_color = lv.color_make(0xc0,0xc0,0xc0)
-            dsc.rect_dsc.border_width = 1
-            dsc.rect_dsc.border_opa = 255
-            if dsc.label_dsc:
-                dsc.label_dsc.color = lv.color_make(0x0D,0x30,0x55)
-                try:
-                    lv.K01_font_16_ALL
-                    dsc.label_dsc.font = lv.K01_font_16_ALL
-                except AttributeError:
-                    try:
-                        lv.K01_font_16_ALL
-                        dsc.label_dsc.font = lv.K01_font_16_ALL
-                    except AttributeError:
-                        dsc.label_dsc.font = lv.K01_font_16_ALL
-
-
-
-    def style_screen_calendar_1_extra_ctrl_day_names_items_default_event_cb(self,e):
-        obj = lv.btnmatrix.__cast__(e.get_target())
-        dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
-        if dsc.id < 7:
-
-            if dsc.label_dsc:
-                dsc.label_dsc.color = lv.color_make(0x0D,0x30,0x55)
-                try:
-                    lv.K01_font_16_ALL
-                    dsc.label_dsc.font = lv.K01_font_16_ALL
-                except AttributeError:
-                    try:
-                        lv.K01_font_16_ALL
-                        dsc.label_dsc.font = lv.K01_font_16_ALL
-                    except AttributeError:
-                        dsc.label_dsc.font = lv.K01_font_16_ALL
-
-       
-    def style_screen_calendar_1_extra_ctrl_highlight_items_default_event_cb(self,e):
-        obj = lv.btnmatrix.__cast__(e.get_target())
-        dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
-        if dsc.id >= 7 and obj.has_btn_ctrl(dsc.id, lv.btnmatrix.CTRL.CUSTOM_2):
-            dsc.rect_dsc.bg_color = lv.color_make(0x21,0x95,0xf6)
-
-            dsc.rect_dsc.bg_opa = 255
-            if dsc.label_dsc:
-                dsc.label_dsc.color = lv.color_make(0x0D,0x30,0x55)
-                try:
-                    lv.K01_font_16_ALL
-                    dsc.label_dsc.font = lv.K01_font_16_ALL
-                except AttributeError:
-                    try:
-                        lv.K01_font_16_ALL
-                        dsc.label_dsc.font = lv.K01_font_16_ALL
-                    except AttributeError:
-                        dsc.label_dsc.font = lv.K01_font_16_ALL
-
-
-    def style_screen_calendar_1_extra_ctrl_today_items_default_event_cb(self,e):
-        obj = lv.btnmatrix.__cast__(e.get_target())
-        dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
-        if dsc.id >= 7 and obj.has_btn_ctrl(dsc.id, lv.btnmatrix.CTRL.CUSTOM_1):
-            dsc.rect_dsc.bg_color = lv.color_make(0x01,0xa2,0xb1)
-
-            dsc.rect_dsc.bg_opa = 255
-            dsc.rect_dsc.border_color = lv.color_make(0xc0,0xc0,0xc0)
-            dsc.rect_dsc.border_width = 1
-            dsc.rect_dsc.border_opa = 255
-            if dsc.label_dsc:
-                dsc.label_dsc.color = lv.color_make(0x0D,0x30,0x55)
-                try:
-                    lv.K01_font_16_ALL
-                    dsc.label_dsc.font = lv.K01_font_16_ALL
-                except AttributeError:
-                    try:
-                        lv.K01_font_16_ALL
-                        dsc.label_dsc.font = lv.K01_font_16_ALL
-                    except AttributeError:
-                        dsc.label_dsc.font = lv.K01_font_16_ALL
-
-
-    def style_screen_calendar_1_extra_ctrl_other_month_items_default_event_cb(self,e):
-        obj = lv.btnmatrix.__cast__(e.get_target())
-        dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param())
-        if dsc.id >= 7 and obj.has_btn_ctrl(dsc.id, lv.btnmatrix.CTRL.DISABLED):
-            dsc.rect_dsc.bg_color = lv.color_make(0x01,0xa2,0xb1)
-
-            dsc.rect_dsc.bg_opa = 0
-            if dsc.label_dsc:
-                dsc.label_dsc.color = lv.color_make(0xA9,0xA2,0xA2)
-                try:
-                    lv.K01_font_16_ALL
-                    dsc.label_dsc.font = lv.K01_font_16_ALL
-                except AttributeError:
-                    try:
-                        lv.font_montserrat_13
-                        dsc.label_dsc.font = lv.K01_font_16_ALL
-                    except AttributeError:
-                        dsc.label_dsc.font = lv.K01_font_16_ALL     
-
-    def fun(self,*argc):
-        EventMesh.publish("system_sleep_rest")#防止黑屏
-
-
-    def Close(self):
-        if self.open_preview1 == 1:
-            self.timer.stop()
-            self.preview1.close()
-
-    def done_click(self):
-        pass
-
-
-
-
-    def done_return(self):
-        EventMesh.publish("load_screen", {"screen": "main_menu"})
-        
-
-    def btn1_release(self):
-        EventMesh.publish("load_screen", {"screen": "main_menu"})
-        pass
-
-    def btn8_press(self):
-        EventMesh.publish("load_screen", {"screen": "main_menu"})
-        pass
-
-
-
-       
-
 rrestor_confirm_n_screen = None
 rrestor_confirm_n_screen_label = None
 
-#正在充电
+#
 class restore_confirmScreen(Screen):
     NAME = "restore_confirm"
     def __init__(self):
index 753f19f..20b1634 100644 (file)
@@ -4,7 +4,7 @@ import lvgl as lv
 import EventMesh
 import osTimer
 import constants
-from ui import Screen,style_screen,style_font_youyuan_70_black,style_font_youyuan_28
+from ui import Screen,style_img,style_screen,style_font_youyuan_70_black,style_font_youyuan_28
 import ql_fs
 import ujson
 from machine import RTC
@@ -80,22 +80,7 @@ watchface1_res_stat_battery_line.set_pos(int(110),int(6))
 watchface1_res_stat_battery_line.set_size(0,10)#高度12
 watchface1_res_stat_battery_line.add_style(power_line_red,0)
 
-# watchface1_res_stat_charge_in_img = lv.img(Watchface1)
-# watchface1_res_stat_charge_in_img.set_pos(int(80),int(0))
-# watchface1_res_stat_charge_in_img.set_size(10,18)
-# watchface1_res_stat_charge_in_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# watchface1_res_stat_charge_in_img.add_flag(lv.obj.FLAG.CLICKABLE)
-# watchface1_res_stat_charge_in_img.set_src("U:/static/charge_in.png")
-# # add style for watchface1_res_stat_charge_in_img
-# watchface1_res_stat_charge_in_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
 
-
-#时间
-
-
-
-#style_font_youyuan_70_black.set_text_font(lv.font_70_bold)
-#init3:(2106, 2, 7, 6, 29, 38, 6, 38)
 data = RTC().datetime()
 hour = data[4]
 min = data[5]
@@ -123,61 +108,57 @@ def get_week(msg):
         return '日'
 
 
-watchface1_time1_text = lv.label(Watchface1)
-watchface1_time1_text.set_pos(4, 25)
-watchface1_time1_text.set_size(100, 71)
-watchface1_time1_text.set_align(lv.TEXT_ALIGN.LEFT)
-watchface1_time1_text.set_text("{}:{}".format("%02d"%(hour),"%02d"%(min)))
+watchface1_time1_hour = lv.label(Watchface1)
+watchface1_time1_hour.set_pos(4, 72)
+watchface1_time1_hour.set_size(100, 32)
+watchface1_time1_hour.set_align(lv.TEXT_ALIGN.LEFT)
+watchface1_time1_hour.set_text("{}".format("%02d"%(hour)))
 # watchface1_time1_text.set_text("%02d:%02d"%(hour,min))
-watchface1_time1_text.add_style(style_font_youyuan_70_black, lv.PART.MAIN|lv.STATE.DEFAULT)
+watchface1_time1_hour.add_style(style_font_youyuan_70_black, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+watchface1_time1_min = lv.label(Watchface1)
+watchface1_time1_min.set_pos(4, 98)
+watchface1_time1_min.set_size(100, 30)
+watchface1_time1_min.set_align(lv.TEXT_ALIGN.LEFT)
+watchface1_time1_min.set_text("{}".format("%02d"%(min)))
+# watchface1_time1_text.set_text("%02d:%02d"%(hour,min))
+watchface1_time1_min.add_style(style_font_youyuan_70_black, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 #日期
 watchface1_date_span = lv.label(Watchface1)
-watchface1_date_span.set_pos(4, 52)
-watchface1_date_span.set_size(124, 20)
+watchface1_date_span.set_pos(56, 20)
+watchface1_date_span.set_size(68, 20)
 watchface1_date_span.set_align(lv.TEXT_ALIGN.LEFT)
-watchface1_date_span.set_text("%d月%d日"%(date1,date2))
+watchface1_date_span.set_text("%02d月%02d日"%(date1,date2))
 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(4, 72)
-watchface1_week_span.set_size(64, 20)
+watchface1_week_span.set_pos(76, 38)
+watchface1_week_span.set_size(48, 20)
 watchface1_week_span.set_align(lv.TEXT_ALIGN.LEFT)
 watchface1_week_span.set_text("星期%s"%(get_week(week)))
 watchface1_week_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
+#天气
+watchface1_weather_span = lv.label(Watchface1)
+watchface1_weather_span.set_pos(70, 100)
+watchface1_weather_span.set_size(58, 24)
+watchface1_weather_span.set_align(lv.TEXT_ALIGN.LEFT)
+watchface1_weather_span.set_text("_ _")
+watchface1_weather_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
+watchface1_weather_img = lv.img(Watchface1)
+watchface1_weather_img.set_pos(110, 5)
+watchface1_weather_img.set_size(0, 0)
+watchface1_weather_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
 
-# watchface1_step_span = lv.label(Watchface1)
-# watchface1_step_span.set_pos(80, 70)
-# watchface1_step_span.set_size(48, 20)
-# watchface1_step_span.set_align(lv.TEXT_ALIGN.LEFT)
-# watchface1_step_span.set_text("0")
-# watchface1_step_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
+watchface1_weather_unit_img = lv.img(Watchface1)
+watchface1_weather_unit_img.set_pos(99, 5)
+watchface1_weather_unit_img.set_size(11, 11)
+watchface1_weather_unit_img.set_src("U:/static/degree.png")
+watchface1_weather_unit_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
 
-# watchface1_HB_span = lv.label(Watchface1)
-# watchface1_HB_span.set_pos(52, 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_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
-# watchface1_HB_span = lv.label(Watchface1)
-# watchface1_HB_span.set_pos(5, 100)
-# watchface1_HB_span.set_size(60, 20)
-# watchface1_HB_span.set_text("0")
-# watchface1_HB_span.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-# watchface1_HB_span.add_style(style_font_youyuan_28, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-# watchface1_SPO2_span = lv.label(Watchface1)
-# watchface1_SPO2_span.set_pos(68, 100)
-# watchface1_SPO2_span.set_size(60, 20)
-# watchface1_SPO2_span.set_text("0")
-# watchface1_SPO2_span.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-# watchface1_SPO2_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 
 class WatchFace1():
@@ -211,7 +192,8 @@ class WatchFace1():
         if spo2Value :
             self.__oldSpo2Value(None, spo2Value)
         # print("main get_step msg:{}".format(msg))
-
+        weather_data = EventMesh.publish("get_weather_data")
+        self.__weather(None,weather_data)
         # step = EventMesh.publish(constants.EVENT.GET_STEP)
         step = EventMesh.publish("get_old_step_value")
         self.__stepValue(None, step)
@@ -244,12 +226,76 @@ class WatchFace1():
         step = EventMesh.publish("get_old_step_value")
         self.__stepValue(None, step)
 
+        weather_data = EventMesh.publish("get_weather_data")
+        self.__weather(None,weather_data)
+
+    def __weather(self, event, msg):
+        # print("weather_data",msg)
+        #时间
+        if msg != None:
+            #3 4
+            weather_type = msg[3]#天气类型
+            weather_temp = msg[4]#天气温度
+            # print("weather_type weather_temp",type(weather_type),type(weather_temp),weather_type,weather_temp)
+            if weather_type != None and weather_temp != None:
+                if int(weather_type) > 3:
+                    watchface1_weather_unit_img.set_pos(70+12+10, 102)
+
+                    watchface1_weather_span.set_pos(70,92)
+                    watchface1_weather_span.set_text(str("_ _"))
+                    
+                    watchface1_weather_img.set_pos(70+12+8+20, 102)
+                    watchface1_weather_img.set_size(11, 10)
+                    watchface1_weather_img.set_src("U:/static/04_WM.png")
+
+
+                else:
+                    
+                    len_data = len(str(weather_temp))*8
+                    watchface1_weather_unit_img.set_pos(70+len_data+5, 102)
+                    watchface1_weather_span.set_pos(70,100)
+                    watchface1_weather_span.set_text(str(weather_temp))
+
+                    watchface1_weather_img.set_pos(70+len_data+6+15, 103)
+                    watchface1_weather_img.set_size(11, 10)
+                    watchface1_weather_img.set_src("U:/static/%02d_WM.png"%(int(weather_type)))
+
+            else:
+                watchface1_weather_unit_img.set_pos(70+12+10, 102)
+
+                watchface1_weather_span.set_pos(70,92)
+                watchface1_weather_span.set_text(str("_ _"))
+                
+                watchface1_weather_img.set_pos(70+12+8+20, 102)
+                watchface1_weather_img.set_size(11, 10)
+                watchface1_weather_img.set_src("U:/static/04_WM.png")
+
+
+        else:
+            watchface1_weather_unit_img.set_pos(70+12+10, 102)
+
+            watchface1_weather_span.set_pos(70,92)
+            watchface1_weather_span.set_text(str("_ _"))
+            
+            watchface1_weather_img.set_pos(70+12+8+20, 102)
+            watchface1_weather_img.set_size(11, 10)
+            watchface1_weather_img.set_src("U:/static/04_WM.png")
+
+
     def __time(self, event, msg):
         #时间
-        watchface1_time1_text.set_text("{}:{}".format("%02d"%(msg[0][0]),"%02d"%(msg[0][1])))
+        data = RTC().datetime()
+        hour = data[4]
+        min = data[5]
 
-        watchface1_date_span.set_text(msg[2])#日期
-        watchface1_week_span.set_text(msg[3])   #星期
+        week = data[3]
+
+        date1 = data[1]
+        date2 = data[2]
+        watchface1_time1_hour.set_text("{}".format("%02d"%(hour)))
+        watchface1_time1_min.set_text("{}".format("%02d"%(min)))
+        watchface1_date_span.set_text("%02d月%02d日"%(date1,date2))#日期
+        watchface1_week_span.set_text("星期%s"%(get_week(week)))   #星期
 
     def __signal(self, event, msg):
         #print("__signal_cb:",str(msg))
@@ -275,23 +321,23 @@ class WatchFace1():
             level = msg[1]
             if level >= 99:
                 level = 100
-            line_len = int(level*(21/100))
-            # print("__battery_cb:",level,line_len,30/100)
-            if line_len >= 21:
-                line_len = 21
-            if line_len <= 5:
-                line_len = 5
-
-            set_x = int(103+line_len//2)
-            watchface1_res_stat_battery_line.set_pos(int(set_x),int(6))
-            watchface1_res_stat_battery_line.set_size(line_len,10)
-            watchface1_res_stat_battery_line.set_style_line_width(line_len,lv.PART.MAIN)
-            if line_len <= 5:
+            line_len = int(level*(20/100))
+            if level <= 5:
+                level = 5
+
+            line_points = [
+                   {"x":0, "y":0}, 
+                   {"x":line_len, "y":0}, 
+                         ]
+            watchface1_res_stat_battery_line.set_size(int(line_len),int(2))
+            watchface1_res_stat_battery_line.set_pos(int(103),int(11))
+            watchface1_res_stat_battery_line.set_points(line_points, 2)
+            watchface1_res_stat_battery_line.set_style_line_width(10,lv.PART.MAIN)
+
+            if line_len <= 3:
                 watchface1_res_stat_battery_line.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
             else:
-                watchface1_res_stat_battery_line.set_style_line_color(lv.color_make(0x00,0xff,0x00),0) 
-            # watchface2_res_stat_battery_img.set_src("E:/static/vbat_%d.png"%(msg[1]))#"E:/vbat_60.png"
-        pass
+                watchface1_res_stat_battery_line.set_style_line_color(lv.color_make(0xff,0xff,0xff),0) 
 
     def __oldHrValue(self, event, msg):
         pass
@@ -324,133 +370,104 @@ class WatchFace1():
     def done_bottom_to_top(self):
         EventMesh.publish("load_screen", {"screen": "call_log"})
 
-# create style style_watchface_img_default
-style_watchface_img_default = lv.style_t()
-style_watchface_img_default.init()
-style_watchface_img_default.set_img_recolor(lv.color_make(0xff,0xff,0xff))
-style_watchface_img_default.set_img_recolor_opa(0)
-style_watchface_img_default.set_img_opa(255)
+
 
 Watchface2 = lv.obj(Watchface)
+
 Watchface2.set_size(128,128)
 #Watchface2.set_pos(0,0)
 Watchface2.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
 Watchface2.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT)
 
-#表盘
-
+#主图片
+watchface2_bg_img = lv.img(Watchface2)
+watchface2_bg_img.set_pos(int(0),int(0))
+watchface2_bg_img.set_size(128,128)
+watchface2_bg_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+watchface2_bg_img.add_flag(lv.obj.FLAG.CLICKABLE)
+watchface2_bg_img.set_src("U:/static/bg2.png")
+watchface2_bg_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
 #状态栏
+
+
+
 watchface2_mpsignal_img = lv.img(Watchface2)
-watchface2_mpsignal_img.set_pos(int(20),int(5))
-watchface2_mpsignal_img.set_size(14,8)
+watchface2_mpsignal_img.set_pos(int(10),int(5))
+watchface2_mpsignal_img.set_size(22,12)
 watchface2_mpsignal_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface2_mpsignal_img.add_flag(lv.obj.FLAG.CLICKABLE)
 watchface2_mpsignal_img.set_src("U:/static/mpsignal5.png")
 watchface2_mpsignal_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 watchface2_res_stat_battery_img = lv.img(Watchface2)
-watchface2_res_stat_battery_img.set_pos(int(100),int(5))
-watchface2_res_stat_battery_img.set_size(16,8)
+watchface2_res_stat_battery_img.set_pos(int(102),int(5))
+watchface2_res_stat_battery_img.set_size(24,12)#16 8
 watchface2_res_stat_battery_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface2_res_stat_battery_img.add_flag(lv.obj.FLAG.CLICKABLE)
 watchface2_res_stat_battery_img.set_src("U:/static/vbat_0.png")
 watchface2_res_stat_battery_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
 
+watchface2_res_stat_battery_line = lv.line(Watchface2)
+watchface2_res_stat_battery_line.set_points(power_line_points,2)
+watchface2_res_stat_battery_line.set_pos(int(110),int(6))
+watchface2_res_stat_battery_line.set_size(0,10)#高度12
+watchface2_res_stat_battery_line.add_style(power_line_red,0)
 
 
-# watchface2_res_stat_charge_in_img = lv.img(Watchface2)
-# watchface2_res_stat_charge_in_img.set_pos(int(80),int(0))
-# watchface2_res_stat_charge_in_img.set_size(10,18)
-# watchface2_res_stat_charge_in_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# watchface2_res_stat_charge_in_img.add_flag(lv.obj.FLAG.CLICKABLE)
-# watchface2_res_stat_charge_in_img.set_src("U:/static/charge_in.png")
-# # add style for watchface_res_stat_charge_in_img
-# watchface2_res_stat_charge_in_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-style_font_youyuan_70_red = lv.style_t()
-style_font_youyuan_70_red.init()
-style_font_youyuan_70_red.set_text_color(lv.color_make(0xff, 0xff, 0xff))
-style_font_youyuan_70_red.set_text_font(lv.K01_font_16_ALL)
-#style_font_youyuan_70_red.set_text_font(lv.font_70_bold)
-#时间
-x = 30
-y = 80
-watchface2_time1_hour_text = lv.label(Watchface2)
-watchface2_time1_hour_text.set_pos(20, 20)
-watchface2_time1_hour_text.set_size(40, 35)
-watchface2_time1_hour_text.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_time1_hour_text.set_text("{}".format("%02d"%(hour)))
-watchface2_time1_hour_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface2_time1_mao_text = lv.label(Watchface2)
-watchface2_time1_mao_text.set_pos(60, 22)
-watchface2_time1_mao_text.set_size(20, 70)
-watchface2_time1_mao_text.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_time1_mao_text.set_text(":")
-watchface2_time1_mao_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface2_time1_hour1_text = lv.label(Watchface2)
-watchface2_time1_hour1_text.set_pos(80, 20)
-watchface2_time1_hour1_text.set_size(40, 35)
-watchface2_time1_hour1_text.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_time1_hour1_text.set_text("{}".format("%02d"%(min)))
-watchface2_time1_hour1_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT)
-
 
+watchface2_time1_text = lv.label(Watchface2)
+watchface2_time1_text.set_pos(0, 20)
+watchface2_time1_text.set_size(128, 50)
+watchface2_time1_text.set_style_text_align(lv.TEXT_ALIGN.CENTER,0)
+watchface2_time1_text.set_text("{}:{}".format("%02d"%(hour),"%02d"%(min)))
+# watchface1_time1_text.set_text("%02d:%02d"%(hour,min))
+watchface2_time1_text.add_style(style_font_youyuan_70_black, lv.PART.MAIN|lv.STATE.DEFAULT)
 
 
 #日期
 watchface2_date_span = lv.label(Watchface2)
-watchface2_date_span.set_pos(9, 55)
-watchface2_date_span.set_size(60, 25)
+watchface2_date_span.set_pos(5, 40)
+watchface2_date_span.set_size(50, 20)
 watchface2_date_span.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_date_span.set_text("%d月%d日"%(date1,date2))
+watchface2_date_span.set_text("%02d-%02d"%(date1,date2))
 watchface2_date_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#日期
-watchface2_week = lv.label(Watchface2)
-watchface2_week.set_pos(70, 55)
-watchface2_week.set_size(60, 25)
-watchface2_week.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_week.set_text("星期%s"%(get_week(week)))
-watchface2_week.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
 #星期
+watchface2_week_span = lv.label(Watchface2)
+watchface2_week_span.set_pos(60, 40)
+watchface2_week_span.set_size(20, 20)
+watchface2_week_span.set_align(lv.TEXT_ALIGN.LEFT)
+watchface2_week_span.set_text("周%s"%(get_week(week)))
+watchface2_week_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+#天气
+watchface2_weather_span = lv.label(Watchface2)
+watchface2_weather_span.set_pos(71, 80)
+watchface2_weather_span.set_size(30, 24)
+watchface2_weather_span.set_align(lv.TEXT_ALIGN.LEFT)
+watchface2_weather_span.set_text("_ _")
+watchface2_weather_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+watchface2_weather_img = lv.img(Watchface2)
+watchface2_weather_img.set_pos(110, 80)
+watchface2_weather_img.set_size(0, 0)
+watchface2_weather_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+watchface2_weather_unit_img = lv.img(Watchface2)
+watchface2_weather_unit_img.set_pos(116, 80)
+watchface2_weather_unit_img.set_size(11, 11)
+watchface2_weather_unit_img.set_src("U:/static/degree.png")
+watchface2_weather_unit_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 
-# watchface2_week = lv.img(Watchface2)
-# 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("U:/static/watch_plate/style_2/week/0_week.png")
-# watchface2_week.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
-
-watchface2_step_img = lv.img(Watchface2)
-watchface2_step_img.set_pos(int(40),int(85))
-watchface2_step_img.set_size(26,21)
-watchface2_step_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface2_step_img.set_src("U:/static/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(70, 85)
-watchface2_step_txt.set_size(50, 25)
-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"
-    # # #表盘2
+    # # #表盘1
     def __init__(self,main_menu): 
-        print("Watchface2:__init__")
+        print("Watchface1:__init__")
         self.meta = Watchface2
-        Watchface2.set_parent(main_menu)#设置父控件 
-
-    def initialization(self,main_menu):  
-        print("Watchface2:initialization")
-         
+        Watchface2.set_parent(main_menu)#设置父控件
+        
+    def initialization(self,main_menu):   
+        print("Watchface1:initialization") 
+        
         #获取信号
         signal = EventMesh.publish("screen_get_sig")
         if signal:
@@ -463,11 +480,21 @@ class WatchFace2():
         #print("publish_time:"+time)
         if time:
             self.__time(None, time)
+        hrValue = EventMesh.publish("get_old_hr_data")
+        if hrValue:
+            self.__oldHrValue(None, hrValue)
 
+        spo2Value = EventMesh.publish("get_old_spo2_data")
+        if spo2Value :
+            self.__oldSpo2Value(None, spo2Value)
+        # print("main get_step msg:{}".format(msg))
+        weather_data = EventMesh.publish("get_weather_data")
+        self.__weather(None,weather_data)
+        # step = EventMesh.publish(constants.EVENT.GET_STEP)
         step = EventMesh.publish("get_old_step_value")
         self.__stepValue(None, step)
 
-
+        
     def timerout_update(self):
         #获取信号
         signal = EventMesh.publish("screen_get_sig")
@@ -482,25 +509,89 @@ class WatchFace2():
         #print("publish_time:"+time)
         if time:
             self.__time(None, time)
-        
+
+        hrValue = EventMesh.publish("get_old_hr_data")
+        if hrValue:
+            self.__oldHrValue(None, hrValue)
+
+        spo2Value = EventMesh.publish("get_old_spo2_data")
+        if spo2Value :
+            self.__oldSpo2Value(None, spo2Value)
+        # print("main get_step msg:{}".format(msg))
+        # step = EventMesh.publish(constants.EVENT.GET_STEP)
         step = EventMesh.publish("get_old_step_value")
         self.__stepValue(None, step)
 
+        weather_data = EventMesh.publish("get_weather_data")
+        self.__weather(None,weather_data)
+
+    def __weather(self, event, msg):
+        print("weather_data",msg)
+        #时间
+        if msg != None:
+            #3 4
+            weather_type = msg[3]#天气类型
+            weather_temp = msg[4]#天气温度
+            print("weather_type weather_temp",type(weather_type),type(weather_temp),weather_type,weather_temp)
+            if weather_type != None and weather_temp != None:
+                if int(weather_type) > 3:
+                    watchface2_weather_unit_img.set_pos(70+12+10, 80)
+
+                    watchface2_weather_span.set_pos(70,70)
+                    watchface2_weather_span.set_text(str("_ _"))
+                    
+                    watchface2_weather_img.set_pos(70+12+8+20, 80)
+                    watchface2_weather_img.set_size(11, 10)
+                    watchface2_weather_img.set_src("U:/static/04_WM.png")
+
+
+                else:
+                    
+                    len_data = len(str(100))*8
+                    watchface2_weather_unit_img.set_pos(70+len_data+5, 80)
+                    watchface2_weather_span.set_pos(70,78)
+                    watchface2_weather_span.set_text(str(100))
+
+                    watchface2_weather_img.set_pos(70+len_data+6+15, 41)
+                    watchface2_weather_img.set_size(11, 10)
+                    watchface2_weather_img.set_src("U:/static/%02d_WM.png"%(int(weather_type)))
+
+            else:
+                watchface2_weather_unit_img.set_pos(70+12+10, 80)
+
+                watchface2_weather_span.set_pos(70,70)
+                watchface2_weather_span.set_text(str("_ _"))
+                
+                watchface2_weather_img.set_pos(70+12+8+20, 80)
+                watchface2_weather_img.set_size(11, 10)
+                watchface2_weather_img.set_src("U:/static/04_WM.png")
+
+
+        else:
+            watchface2_weather_unit_img.set_pos(70+12+10, 80)
+
+            watchface2_weather_span.set_pos(70,70)
+            watchface2_weather_span.set_text(str("_ _"))
+            
+            watchface2_weather_img.set_pos(70+12+8+20, 80)
+            watchface2_weather_img.set_size(11, 10)
+            watchface2_weather_img.set_src("U:/static/04_WM.png")
+
+
     def __time(self, event, msg):
         #时间
-        hour1_chose = (msg[0][0])//10%10
-        hour2_chose = (msg[0][0])%10
-        min1_chose = (msg[0][1])//10%10
-        min2_chose = (msg[0][1])%10
-        watchface2_time1_hour_text.set_text("{}".format("%02d"%(msg[0][0])))
-        watchface2_time1_hour1_text.set_text("{}".format("%02d"%(msg[0][1])))
-        # watchface2_time1_hour_text.set_text("{}".format("%d"%(hour1_chose)))
-        # watchface2_time1_hour2_text.set_text("{}".format("%d"%(hour2_chose)))
-        # watchface2_time2_min1_text.set_text("{}".format("%d"%(min1_chose)))
-        # watchface2_time2_min2_text.set_text("{}".format("%d"%(min2_chose)))
-        watchface2_date_span.set_text(msg[2])#日期
-        watchface2_week.set_text(msg[3])#星期
-        # watchface2_week.set_src("U:/static/watch_plate/style_2/week/%d_week.png"%(msg[5]))   #星期
+        data = RTC().datetime()
+        hour = data[4]
+        min = data[5]
+
+        week = data[3]
+
+        date1 = data[1]
+        date2 = data[2]
+        watchface2_time1_text.set_text("{}:{}".format("%02d"%(hour),"%02d"%(min)))
+        # watchface1_time1_min.set_text("{}".format("%02d"%(min)))
+        watchface2_date_span.set_text("%02d-%02d"%(date1,date2))#日期
+        watchface2_week_span.set_text("周%s"%(get_week(week)))   #星期
 
     def __signal(self, event, msg):
         #print("__signal_cb:",str(msg))
@@ -516,55 +607,66 @@ class WatchFace2():
         #print("__battery_cb:",str(msg))
         #print(msg)
         if msg[0] == '1':
-            pass
-            # watchface2_res_stat_charge_in_img.set_src("U:/static/charge_in.png")
+            watchface2_res_stat_battery_line.set_pos(int(0),int(0))
+            watchface2_res_stat_battery_line.set_size(0,0)
+            watchface2_res_stat_battery_line.set_style_line_width(0,lv.PART.MAIN)
+            watchface2_res_stat_battery_img.set_src("U:/static/charge_ing.png")
+            # watchface1_res_stat_charge_in_img.set_src("U:/static/charge_in.png")
         else:
-            # watchface2_res_stat_charge_in_img.set_src("U:/static/charge_in1.png")
-            pass
-        watchface2_res_stat_battery_img.set_src("U:/static/vbat_%d.png"%(msg[1]))#"U:/vbat_60.png"
+            watchface2_res_stat_battery_img.set_src("U:/static/vbat_0.png")
+            level = msg[1]
+            if level >= 99:
+                level = 100
+            line_len = int(level*(20/100))
+            if level <= 5:
+                level = 5
+
+            line_points = [
+                   {"x":0, "y":0}, 
+                   {"x":line_len, "y":0}, 
+                         ]
+            watchface2_res_stat_battery_line.set_size(int(line_len),int(2))
+            watchface2_res_stat_battery_line.set_pos(int(103),int(11))
+            watchface2_res_stat_battery_line.set_points(line_points, 2)
+            watchface2_res_stat_battery_line.set_style_line_width(10,lv.PART.MAIN)
+
+            if line_len <= 3:
+                watchface2_res_stat_battery_line.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
+            else:
+                watchface2_res_stat_battery_line.set_style_line_color(lv.color_make(0xff,0xff,0xff),0) 
+
+    def __oldHrValue(self, event, msg):
+        pass
+        # watchface1_HB_span.set_text("120")
+    
+    def __oldSpo2Value(self, event, msg):
         pass
+        # watchface1_SPO2_span.set_text(str(msg))
+
     def __stepValue(self, event, msg):
         if msg == None:    
-            watchface2_step_txt.set_text("0")
+            pass
+            # watchface1_step_span.set_text("0")
         else:
-            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("U:/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))
+            pass
+            # watchface1_step_span.set_text(str(msg))
 
     def Close(self):
-        pass  
+        pass
 
     def done_left_to_right(self):
         EventMesh.publish("load_screen", {"screen": "main_menu"})
 
     def done_right_to_left(self):
         EventMesh.publish("load_screen", {"screen": "main_menu"})
+
     def done_top_to_bottom(self):
         EventMesh.publish("load_screen", {"screen": "popup"})
 
     def done_bottom_to_top(self):
         EventMesh.publish("load_screen", {"screen": "call_log"})
 
+
 class WatchFace():
     #NAME = "Watchface"
 
@@ -601,28 +703,7 @@ class WatchFace():
     def change_face(self, event=None, msg=None):
         print("change_face :",msg)
         self.watchface_style_num = str(msg)
-
         EventMesh.publish("load_screen", {"screen": "main_menu"})
-        
-    
-    # def done_left_to_right(self):
-    #     EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-    # def done_right_to_left(self):
-    #     EventMesh.publish("load_screen", {"screen": "main_menu"})
-    # def done_top_to_bottom(self):
-    #     EventMesh.publish("load_screen", {"screen": "popup"})
-
-    # def done_bottom_to_top(self):
-    #     EventMesh.publish("load_screen", {"screen": "call_log"})
-    # def done_return(self):
-    #     EventMesh.publish("load_screen", {"screen": "Watchface"})
-       
-    # def btn1_release(self):
-    #     EventMesh.publish("load_screen", {"screen": "Watchface"})
-        
-    # def btn8_press(self):
-    #     EventMesh.publish("load_screen", {"screen": "Watchface"})
 
     def Close(self):
         print("watchface Close !!!!!!!!")
diff --git a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_health.py b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_health.py
deleted file mode 100644 (file)
index 736822d..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-
-import lvgl as lv
-import ql_fs
-import EventMesh
-from misc import Power
-from ui import style_screen,style_font_youyuan_20,style_btn,style_img,Screen,style_contact_btn
-import constants
-import osTimer
-import audio
-from machine import Pin
-import ujson
-
-# -------------------------------------------setting screen----------------------------------------------------------
-
-style_bar = lv.style_t() 
-style_bar.init()
-style_bar.set_radius(10)
-style_bar.set_bg_color(lv.color_make(0xA0, 0xA0, 0xA0))
-style_bar.set_bg_grad_color(lv.color_make(0xA0, 0xA0, 0xA0))
-style_bar.set_bg_grad_dir(lv.GRAD_DIR.VER)
-style_bar.set_bg_opa(60)
-style_bar.set_pad_left(0)
-style_bar.set_pad_right(0)
-style_bar.set_pad_top(0)
-style_bar.set_pad_bottom(0)
-
-style_volume_btn =  lv.style_t()
-style_volume_btn.init()
-style_volume_btn.set_shadow_opa(0)
-style_volume_btn.set_border_width(0)
-style_volume_btn.set_bg_color(lv.color_make(0x80, 0x80, 0x80))
-
-style_bar_indic = lv.style_t()
-style_bar_indic.init()
-style_bar_indic.set_radius(10)
-style_bar_indic.set_bg_color(lv.color_make(0xff, 0x61, 0x3a))
-style_bar_indic.set_bg_grad_color(lv.color_make(0xff, 0x61, 0x3a))
-style_bar_indic.set_bg_grad_dir(lv.GRAD_DIR.VER)
-style_bar_indic.set_bg_opa(255)
-
-health_cont_y = 0
-health_screen = lv.obj()
-print("health_screen")
-health_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-health_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-health_title_img = lv.img(health_screen)
-health_title_img.set_pos(58, 10)
-health_title_img.set_size(124, 30)
-health_title_img.set_src("U:/static/health/health_text.png")
-health_title_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-
-setting_cont_style = lv.style_t()
-setting_cont_style.init()
-setting_cont_style.set_radius(0)
-setting_cont_style.set_bg_color(lv.color_make(0x00, 0x00, 0x00))
-setting_cont_style.set_bg_grad_color(lv.color_make(0x00, 0x00, 0x00))
-setting_cont_style.set_bg_grad_dir(lv.GRAD_DIR.VER)
-setting_cont_style.set_bg_opa(255)
-setting_cont_style.set_border_width(0)
-setting_cont_style.set_pad_left(0)
-setting_cont_style.set_pad_right(0)
-setting_cont_style.set_pad_top(0)
-setting_cont_style.set_pad_bottom(0)
-
-health_list_screen = lv.obj(health_screen)
-health_list_screen.set_pos(0, 50)
-health_list_screen.set_size(240, 270)
-health_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-health_list_screen.add_style(setting_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT)
-
-setting_cont = lv.obj(health_list_screen)
-setting_cont.set_pos(0, 0)
-setting_cont.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-setting_cont.set_size(240, 271)
-setting_cont.add_style(setting_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-health_hr = lv.btn(setting_cont)
-health_hr.set_pos(0, health_cont_y)
-health_hr.set_size(0, 0)
-health_hr_label = lv.label(health_hr)
-health_hr_label.set_text("心率")
-health_hr.set_style_pad_all(0, lv.STATE.DEFAULT)
-health_hr_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-health_hr_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-health_hr_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_hr.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_hr_img = lv.img(setting_cont)
-health_hr_img.set_pos(0, health_cont_y)
-health_hr_img.set_size(232, 80)
-health_hr_img.add_flag(lv.obj.FLAG.CLICKABLE)
-health_hr_img.set_src("U:/static/health/health_hr.png")
-health_hr_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_cont_y+=90
-
-
-
-health_spo2 = lv.btn(setting_cont)
-health_spo2.set_pos(0, health_cont_y)
-health_spo2.set_size(0, 0)
-health_spo2_label = lv.label(health_spo2)
-health_spo2_label.set_text("血氧")
-health_spo2.set_style_pad_all(0, lv.STATE.DEFAULT)
-health_spo2_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-health_spo2_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-health_spo2_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_spo2.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_spo2_img = lv.img(setting_cont)
-health_spo2_img.set_pos(0, health_cont_y)
-health_spo2_img.set_size(232, 80)
-health_spo2_img.add_flag(lv.obj.FLAG.CLICKABLE)
-health_spo2_img.set_src("U:/static/health/health_spo2.png")
-health_spo2_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_cont_y+=90
-
-health_temp = lv.btn(setting_cont)
-health_temp.set_pos(0, health_cont_y)
-health_temp.set_size(0, 0)
-health_temp_label = lv.label(health_temp)
-health_temp_label.set_text("体温")
-health_temp.set_style_pad_all(0, lv.STATE.DEFAULT)
-health_temp_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-health_temp_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-health_temp_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_temp.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_temp_img = lv.img(setting_cont)
-health_temp_img.set_pos(0, health_cont_y)
-health_temp_img.set_size(232, 80)
-health_temp_img.add_flag(lv.obj.FLAG.CLICKABLE)
-health_temp_img.set_src("U:/static/health/health_temp.png")
-health_temp_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_cont_y+=90
-
-
-
-
-class HealthScreen(Screen):#健康测量
-    NAME = "health"
-
-    def __init__(self):
-        super().__init__()
-        self.meta = health_screen
-        # setting_language.add_event_cb(lambda e: self.load_screen(e, {"screen": "language"}), lv.EVENT.CLICKED, None)
-        health_hr_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "heartrate"})), lv.EVENT.CLICKED, None)
-        # setting_themeswitch.add_event_cb(lambda e: self.load_screen(e, {"screen": "themeswitch"}), lv.EVENT.CLICKED, None)
-        health_spo2_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "spo2"})), lv.EVENT.CLICKED, None)
-        health_temp_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "temperature"})), lv.EVENT.CLICKED, None)
-
-    def done_return(self):
-        EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-    def btn1_release(self):
-        EventMesh.publish("load_screen", {"screen": "main_menu"})
-        
-    def btn8_press(self):
-        EventMesh.publish("watch_top_show")
-        EventMesh.publish("load_screen", {"screen": "main_menu"})
-##################################################################
-# -------------------------------------------language screen----------------------------------------------------------
index 017ead1..1e8f966 100644 (file)
@@ -168,7 +168,7 @@ label_text.set_text("{}".format(MainMenu2_num))
 MainMenu2_img_health = lv.img(MainMenu2_heartrate)
 MainMenu2_img_health.set_size(80,80)
 MainMenu2_img_health.set_pos(24,10)
-MainMenu2_img_health.set_src("U:/static/IMAGE_ONE_PAGE_HEALTH.png")
+MainMenu2_img_health.set_src("U:/static/IMAGE_ONE_PAGE_VIDEOCALL.png")
 MainMenu2_img_health.add_flag(lv.obj.FLAG.CLICKABLE)
 MainMenu2_img_health.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
 
@@ -400,7 +400,7 @@ class MainMenuScreen(Screen):
         
     def img_cb(self, e, msg):
         state = EventMesh.publish("get_key_board", "key_board")
-        # print("state",state)
+        print("msg",type(msg),msg)
         if state == 1:
             # print("state11",state)
             if msg == 'Phone':
@@ -408,9 +408,24 @@ class MainMenuScreen(Screen):
                 EventMesh.publish("load_screen", {"screen": "keyboard_popup"})
                 pass
             else:
-                EventMesh.publish("load_screen", {"screen": "{}".format(msg)})
+                if msg == "pp_main":
+                    if EventMesh.publish(constants.EVENT.GET_CONNECT) == 0:#未联网提示关机
+                        EventMesh.publish("load_screen", {"screen": "no_sim_popup_screen"})
+                        return
+                    else:
+                        EventMesh.publish("load_screen", {"screen": "{}".format(msg)})
+                else:
+                    EventMesh.publish("load_screen", {"screen": "{}".format(msg)})
+                
         else:
-            EventMesh.publish("load_screen", {"screen": "{}".format(msg)})
+            if msg == "pp_main":
+                if EventMesh.publish(constants.EVENT.GET_CONNECT) == 0:#未联网提示关机
+                    EventMesh.publish("load_screen", {"screen": "no_sim_popup_screen"})
+                    return
+                else:
+                    EventMesh.publish("load_screen", {"screen": "{}".format(msg)})
+            else:
+                EventMesh.publish("load_screen", {"screen": "{}".format(msg)})
         print("MainMenu2:img_cb:{} {}".format(msg,type(msg)))
         
         
index 0be8c84..13cd22b 100644 (file)
@@ -3,7 +3,7 @@ import lvgl as lv
 import ql_fs
 import EventMesh
 from misc import Power
-from ui import style_screen,style_font_youyuan_20_black,style_font_youyuan_20_gray,style_screen_btn_1_main_main_default,style_font_youyuan_20,style_btn,style_img,Screen,style_contact_btn,style_bar,style_bar_indic
+from ui import style_screen,style_font_youyuan_20_default,style_font_youyuan_20_black,style_font_youyuan_20_gray,style_screen_btn_1_main_main_default,style_font_youyuan_20,style_btn,style_img,Screen,style_contact_btn,style_bar,style_bar_indic
 import constants
 import osTimer
 import audio
@@ -450,7 +450,7 @@ class SettingScreen(Screen):
             self.is_sliding =0
             
     def done_return(self):
-        EventMesh.publish("return_prev_screen")
+        EventMesh.publish("load_screen", {"screen": "main_menu"})
 
     def btn1_release(self):
         EventMesh.publish("return_setiing")
@@ -520,15 +520,15 @@ dialswitch_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 dialswitch_title = lv.label(dialswitch_screen)
 dialswitch_title.set_pos(0, 5)
-dialswitch_title.set_size(120, 20)
-dialswitch_title.set_text("表盘切换")
+dialswitch_title.set_size(0, 0)
+dialswitch_title.set_text(" ")
 dialswitch_title.set_long_mode(lv.label.LONG.WRAP)
 dialswitch_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
 dialswitch_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 dialswitch_img1 = lv.img(dialswitch_screen)#表盘预览图
-dialswitch_img1.set_pos(27, 30)
-dialswitch_img1.set_size(70, 70)
+dialswitch_img1.set_pos(19, 5)
+dialswitch_img1.set_size(90, 90)
 dialswitch_img1.set_src("U:/static/DIAL_PREV01.png")
 dialswitch_img1.add_flag(lv.obj.FLAG.CLICKABLE)
 dialswitch_img1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
@@ -540,102 +540,15 @@ dialswitch_btn1_label.set_text(" ")
 dialswitch_btn1_label.align(lv.ALIGN.TOP_MID, 0, 104)
 dialswitch_btn1_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
-
-# dialswitch_butoom_crcile1 = lv.img(dialswitch_screen)#底部显示圆点
-# dialswitch_butoom_crcile1.set_pos(95, 300)
-# dialswitch_butoom_crcile1.set_size(10, 10)
-# dialswitch_butoom_crcile1.set_src("U:/static/point_white.png")
-# dialswitch_butoom_crcile1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-# dialswitch_butoom_crcile2 = lv.img(dialswitch_screen)#底部显示圆点
-# dialswitch_butoom_crcile2.set_pos(140, 300)
-# dialswitch_butoom_crcile2.set_size(10, 10)
-# dialswitch_butoom_crcile2.set_src("U:/static/point_black.png")
-# dialswitch_butoom_crcile2.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-# dialswitch_btn2 = lv.btn(dialswitch_screen)
-# dialswitch_btn2.set_size(240,54)
-# dialswitch_btn2.set_pos(0, 104)
-# dialswitch_btn2.add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.PRESSED)
-# dialswitch_btn2.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-# dialswitch_btn2_label = lv.label(dialswitch_btn2)
-# dialswitch_btn2_label.set_text("表盘2")
-# dialswitch_btn2_label.align(lv.ALIGN.LEFT_MID, 10, 0)
-# dialswitch_btn2_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-# btn1_switch = lv.switch(dialswitch_btn1)
-# btn1_switch.set_pos(185, 3)
-# btn1_switch.set_size(10, 10)
-# btn1_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.MAIN | lv.PART.INDICATOR)
-# btn1_switch.set_style_bg_color(lv.color_make(0xff, 0x00, 0x00),lv.PART.KNOB | lv.STATE.CHECKED)
-# btn1_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.KNOB)
-
-# btn2_switch = lv.switch(dialswitch_btn2)
-# btn2_switch.set_pos(185, 3)
-# btn2_switch.set_size(10, 10)
-# btn2_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.MAIN | lv.PART.INDICATOR)
-# btn2_switch.set_style_bg_color(lv.color_make(0xff, 0x00, 0x00),lv.PART.KNOB | lv.STATE.CHECKED)
-# btn2_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.KNOB)
-
 # -------------------------------------------menustyle screen----------------------------------------------------------
-menustyle_screen = lv.obj()
-print("menustyle_screen")
-menustyle_screen.center()
-menustyle_screen.set_size(240, 320)
-menustyle_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-menustyle_title = lv.label(menustyle_screen)
-menustyle_title.set_pos(0, 10)
-menustyle_title.set_size(240, 40)
-menustyle_title.set_text("主菜单风格")
-menustyle_title.set_long_mode(lv.label.LONG.WRAP)
-menustyle_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-menustyle_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-menustyle_btn1 = lv.btn(menustyle_screen)
-menustyle_btn1.set_size(240,54)
-menustyle_btn1.set_pos(0, 50)
-menustyle_btn1.add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.PRESSED)
-menustyle_btn1.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-menustyle_btn1_label = lv.label(menustyle_btn1)
-menustyle_btn1_label.set_text("四宫格")
-menustyle_btn1_label.align(lv.ALIGN.LEFT_MID, 10, 0)
-menustyle_btn1_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-menu_btn1_switch = lv.switch(menustyle_btn1)
-menu_btn1_switch.set_pos(185, 3)
-menu_btn1_switch.set_size(10, 10)
-menu_btn1_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.MAIN | lv.PART.INDICATOR)
-menu_btn1_switch.set_style_bg_color(lv.color_make(0xff, 0x00, 0x00),lv.PART.KNOB | lv.STATE.CHECKED)
-menu_btn1_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.KNOB)
-
-menustyle_btn2 = lv.btn(menustyle_screen)
-menustyle_btn2.set_size(240,54)
-menustyle_btn2.set_pos(0, 104)
-menustyle_btn2.add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.PRESSED)
-menustyle_btn2.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-menustyle_btn2_label = lv.label(menustyle_btn2)
-menustyle_btn2_label.set_text("单页")
-menustyle_btn2_label.align(lv.ALIGN.LEFT_MID, 10, 0)
-menustyle_btn2_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-menu_btn2_switch = lv.switch(menustyle_btn2)
-menu_btn2_switch.set_pos(185, 3)
-menu_btn2_switch.set_size(10, 10)
-menu_btn2_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.MAIN | lv.PART.INDICATOR)
-menu_btn2_switch.set_style_bg_color(lv.color_make(0xff, 0x00, 0x00),lv.PART.KNOB | lv.STATE.CHECKED)
-menu_btn2_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.KNOB)
+
 
 
 
 
 
 # -------------------------------------------app screen----------------------------------------------------------
-style_font_youyuan_20_default = lv.style_t()
-style_font_youyuan_20_default.init()
-style_font_youyuan_20_default.set_text_color(lv.color_make(0xff, 0xff, 0xff))
+
 # style_font_youyuan_20_black.set_text_font(lv.K01_font_16_ALL)
 
 #app_screen = lv.obj()
@@ -853,45 +766,6 @@ msgvolume_add_imgbtn.set_src("U:/static/add_btn.png")
 msgvolume_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 
-# -------------------------------------------restore screen----------------------------------------------------------
-restore_screen = lv.obj()
-print("restore_screen")
-restore_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-restore_label = lv.label(restore_screen)
-restore_label.set_pos(0, 20)
-restore_label.set_size(128, 40)
-restore_label.set_text("设备所有的数据将被清除,是否继续?")
-restore_label.set_long_mode(lv.label.LONG.WRAP)
-restore_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-restore_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-restore_confirm_label = lv.label(restore_screen)
-restore_confirm_label.set_text("确认")
-restore_confirm_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-restore_confirm_label.set_size(64, 20)
-restore_confirm_label.set_pos(0,80)
-restore_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-restore_confirm = lv.label(restore_screen)
-restore_confirm.set_text(" ")
-restore_confirm.set_size(64, 48)
-restore_confirm.set_pos(0,80)
-restore_confirm.add_flag(lv.obj.FLAG.CLICKABLE)
-
-restore_cancel_label = lv.label(restore_screen)
-restore_cancel_label.set_text("返回")
-restore_cancel_label.set_size(64, 20)
-restore_cancel_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-restore_cancel_label.set_pos(64,80)
-restore_cancel_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-restore_cancel = lv.label(restore_screen)
-restore_cancel.set_text(" ")
-restore_cancel.set_size(64, 48)
-restore_cancel.set_pos(64,80)
-restore_cancel.add_flag(lv.obj.FLAG.CLICKABLE)
 
 
 
@@ -1024,6 +898,48 @@ update_return.set_pos(0,70)
 update_return.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 update_return.add_flag(lv.obj.FLAG.CLICKABLE)
 
+
+
+# -------------------------------------------restore screen----------------------------------------------------------
+restore_screen = lv.obj()
+print("restore_screen")
+restore_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+restore_label = lv.label(restore_screen)
+restore_label.set_pos(0, 20)
+restore_label.set_size(128, 40)
+restore_label.set_text("设备所有的数据将被清除,是否继续?")
+restore_label.set_long_mode(lv.label.LONG.WRAP)
+restore_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+restore_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+restore_confirm_label = lv.label(restore_screen)
+restore_confirm_label.set_text("确认")
+restore_confirm_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+restore_confirm_label.set_size(64, 20)
+restore_confirm_label.set_pos(0,80)
+restore_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+
+restore_confirm = lv.label(restore_screen)
+restore_confirm.set_text(" ")
+restore_confirm.set_size(64, 48)
+restore_confirm.set_pos(0,80)
+restore_confirm.add_flag(lv.obj.FLAG.CLICKABLE)
+
+restore_cancel_label = lv.label(restore_screen)
+restore_cancel_label.set_text("返回")
+restore_cancel_label.set_size(64, 20)
+restore_cancel_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+restore_cancel_label.set_pos(64,80)
+restore_cancel_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+restore_cancel = lv.label(restore_screen)
+restore_cancel.set_text(" ")
+restore_cancel.set_size(64, 48)
+restore_cancel.set_pos(64,80)
+restore_cancel.add_flag(lv.obj.FLAG.CLICKABLE)
+
 class RestoreScreen(Screen):
     NAME = "restore"
 
@@ -1757,38 +1673,7 @@ class DialswitchScreen(Screen):
         EventMesh.publish("load_screen", {"screen": "main_menu"})
 
 
-class ThemeswitchScreen(Screen):
-    NAME = "themeswitch"
-
-    def __init__(self):
-        super().__init__()
-        self.meta = menustyle_screen
-        menustyle_btn1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.fun1(e)),
-                                     lv.EVENT.PRESSED, None)
-
-        menustyle_btn2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.fun2(e)),
-                                     lv.EVENT.PRESSED, None)
 
-    def fun1(self,e):
-        menu_btn1_switch.add_state(lv.STATE.CHECKED)
-        menu_btn2_switch.clear_state(lv.STATE.CHECKED)
-        EventMesh.publish("change_style", "MainMenu1")
-        EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-    def fun2(self,e):
-        menu_btn1_switch.clear_state(lv.STATE.CHECKED)
-        menu_btn2_switch.add_state(lv.STATE.CHECKED)
-        EventMesh.publish("change_style", "MainMenu2")
-        EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-    def done_return(self):
-        EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-    def btn1_release(self):
-        EventMesh.publish("load_screen", {"screen": "main_menu"})
-        
-    def btn8_press(self):
-        EventMesh.publish("load_screen", {"screen": "setting"})
 
 # -------------------------------------------imei screen----------------------------------------------------------
 imei_screen = lv.obj()
diff --git a/2.sdk/project/K01/usr/static/00_WM.png b/2.sdk/project/K01/usr/static/00_WM.png
new file mode 100644 (file)
index 0000000..c94afbb
Binary files /dev/null and b/2.sdk/project/K01/usr/static/00_WM.png differ
diff --git a/2.sdk/project/K01/usr/static/01_WM.png b/2.sdk/project/K01/usr/static/01_WM.png
new file mode 100644 (file)
index 0000000..e4b4c54
Binary files /dev/null and b/2.sdk/project/K01/usr/static/01_WM.png differ
diff --git a/2.sdk/project/K01/usr/static/02_WM.png b/2.sdk/project/K01/usr/static/02_WM.png
new file mode 100644 (file)
index 0000000..6b025ac
Binary files /dev/null and b/2.sdk/project/K01/usr/static/02_WM.png differ
diff --git a/2.sdk/project/K01/usr/static/03_WM.png b/2.sdk/project/K01/usr/static/03_WM.png
new file mode 100644 (file)
index 0000000..c3c40ae
Binary files /dev/null and b/2.sdk/project/K01/usr/static/03_WM.png differ
diff --git a/2.sdk/project/K01/usr/static/04_WM.png b/2.sdk/project/K01/usr/static/04_WM.png
new file mode 100644 (file)
index 0000000..d9a1c58
Binary files /dev/null and b/2.sdk/project/K01/usr/static/04_WM.png differ
index 97e7ec5..1f6cd62 100644 (file)
Binary files a/2.sdk/project/K01/usr/static/DIAL_PREV01.png and b/2.sdk/project/K01/usr/static/DIAL_PREV01.png differ
index 6a770c5..0c3c52e 100644 (file)
Binary files a/2.sdk/project/K01/usr/static/bg.png and b/2.sdk/project/K01/usr/static/bg.png differ
index 8738d7b..3aa8d13 100644 (file)
Binary files a/2.sdk/project/K01/usr/static/degree.png and b/2.sdk/project/K01/usr/static/degree.png differ
diff --git a/2.sdk/project/K01/usr/static/pause.png b/2.sdk/project/K01/usr/static/pause.png
deleted file mode 100644 (file)
index 48f11ac..0000000
Binary files a/2.sdk/project/K01/usr/static/pause.png and /dev/null differ
diff --git a/2.sdk/project/K01/usr/static/pp_friend04.png b/2.sdk/project/K01/usr/static/pp_friend04.png
new file mode 100644 (file)
index 0000000..c43c4aa
Binary files /dev/null and b/2.sdk/project/K01/usr/static/pp_friend04.png differ