表盘预览界面优化
authordxy15521469561 <1731678236@qq.com>
Wed, 5 Jul 2023 09:43:53 +0000 (17:43 +0800)
committerdxy15521469561 <1731678236@qq.com>
Wed, 5 Jul 2023 09:43:53 +0000 (17:43 +0800)
13 files changed:
2.sdk/project/K5/ext/static/mpsignal5.png
2.sdk/project/K5/ext/static/point_black.png [new file with mode: 0644]
2.sdk/project/K5/ext/static/point_white.png [new file with mode: 0644]
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/alarm.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/lcd.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui_main_menu.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui_setting.py
2.sdk/project/K5/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/images/firmware_base_release_pack.zip
2.sdk/project/K5/usr/main.py
2.sdk/project/K5/usr/static/DIAL_PREV01.png [new file with mode: 0644]
2.sdk/project/K5/usr/static/DIAL_PREV02.png [new file with mode: 0644]

index b5543c1..6d14ff2 100644 (file)
Binary files a/2.sdk/project/K5/ext/static/mpsignal5.png and b/2.sdk/project/K5/ext/static/mpsignal5.png differ
diff --git a/2.sdk/project/K5/ext/static/point_black.png b/2.sdk/project/K5/ext/static/point_black.png
new file mode 100644 (file)
index 0000000..a64e8cb
Binary files /dev/null and b/2.sdk/project/K5/ext/static/point_black.png differ
diff --git a/2.sdk/project/K5/ext/static/point_white.png b/2.sdk/project/K5/ext/static/point_white.png
new file mode 100644 (file)
index 0000000..318e3c2
Binary files /dev/null and b/2.sdk/project/K5/ext/static/point_white.png differ
index a86baf3..786b10e 100644 (file)
@@ -13,7 +13,8 @@ from misc import Power
 import audio
 from ui import style_img,style_screen,style_font_youyuan_20
 import ntptime
-ntptime.settime(timezone=8)
+
+#ntptime.settime(timezone=8)
 """
 可以添加/编辑闹钟时间、周期;
 最多添加三个闹钟;
index a4b05a3..8c4059e 100644 (file)
@@ -24,7 +24,7 @@ class BtnDevice(Abstract):
             self.__tp.set_callback(self.__ui_callback)
 
     def __ui_callback(self, para):
-        #print("para = {}".format(para))
+       # print("para = {}".format(para))
         if para == 0:
             EventMesh.publish("done_left_to_right")
             #print("<-")
index 25f2b3f..e793798 100644 (file)
@@ -182,7 +182,7 @@ indev_drv = lv.indev_drv_t()
 indev_drv.init()
 indev_drv.type = lv.INDEV_TYPE.POINTER
 indev_drv.read_cb = tp_cst816.read
-indev_drv.long_press_time = 300
+indev_drv.long_press_time = 400
 indev_drv.register()
 gpio4 = Pin(Pin.GPIO33, Pin.OUT, Pin.PULL_PU, 0)
 
index a047117..2ca3d7f 100644 (file)
@@ -454,6 +454,7 @@ class PhoneScreen(Screen):
         self.count+=1
     def one(self,e):
         if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+            #self.phone_list.pop(0)
             return
         self.phone_list.append("1")                
         self.phone_num = ''.join(self.phone_list)
@@ -461,6 +462,7 @@ class PhoneScreen(Screen):
     
     def two(self,e):
         if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+            #self.phone_list.pop(0)
             return
         self.phone_list.append("2")                
         self.phone_num = ''.join(self.phone_list)
@@ -468,6 +470,7 @@ class PhoneScreen(Screen):
 
     def three(self,e):
         if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+            #self.phone_list.pop(0)
             return
         self.phone_list.append("3")                
         self.phone_num = ''.join(self.phone_list)
@@ -475,6 +478,7 @@ class PhoneScreen(Screen):
 
     def four(self,e):
         if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+            #self.phone_list.pop(0)
             return
         self.phone_list.append("4")                
         self.phone_num = ''.join(self.phone_list)
@@ -482,6 +486,7 @@ class PhoneScreen(Screen):
 
     def five(self,e):
         if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+            #self.phone_list.pop(0)
             return
         self.phone_list.append("5")                
         self.phone_num = ''.join(self.phone_list)
@@ -489,6 +494,7 @@ class PhoneScreen(Screen):
 
     def six(self,e):
         if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+            #self.phone_list.pop(0)
             return
         self.phone_list.append("6")                
         self.phone_num = ''.join(self.phone_list)
@@ -496,6 +502,7 @@ class PhoneScreen(Screen):
 
     def seven(self,e):
         if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+            #self.phone_list.pop(0)
             return
         self.phone_list.append("7")                
         self.phone_num = ''.join(self.phone_list)
@@ -503,6 +510,7 @@ class PhoneScreen(Screen):
 
     def eight(self,e):
         if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+            #self.phone_list.pop(0)
             return
         self.phone_list.append("8")                
         self.phone_num = ''.join(self.phone_list)
@@ -510,6 +518,7 @@ class PhoneScreen(Screen):
 
     def nine(self,e):
         if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+            #self.phone_list.pop(0)
             return
         self.phone_list.append("9")                
         self.phone_num = ''.join(self.phone_list)
@@ -517,6 +526,7 @@ class PhoneScreen(Screen):
 
     def zero(self,e):
         if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字
+            #self.phone_list.pop(0)
             return
         self.phone_list.append("0")                
         self.phone_num = ''.join(self.phone_list)
@@ -533,6 +543,7 @@ class PhoneScreen(Screen):
 
     def endpressed_start(self,e):
         if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字
+            #self.phone_list.pop(0)
             return
   
         if self.button == 1:#长按
@@ -545,6 +556,7 @@ class PhoneScreen(Screen):
     
     def hash(self,e):
         if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字
+            #self.phone_list.pop(0)
             return
         self.phone_list.append("#")                
         self.phone_num = ''.join(self.phone_list)
@@ -598,6 +610,7 @@ class PhoneScreen(Screen):
                 voiceCall.callStart(self.phone_num)
         
     def show_num(self):
+        #print("self.phone_num ",self.phone_num,self.phone_list)
         len_t = len(self.phone_list)*40
         if len_t > 230:
             len_t = 230
@@ -2754,6 +2767,7 @@ class CountdownScreen(Screen):
         self.g_end = 0
         self.total = 0
         self.time_tmp = 0
+        self.timer_cb = 0
 
     def initialization(self):
         global countdown_screen ,countdown_title,countdown_hour ,countdown_mao ,countdown_mao ,countdown_mao1 ,\
index 57bb8b7..10b43f2 100644 (file)
@@ -97,6 +97,7 @@ MainMenu2_til.set_scrollbar_mode(0)
 MainMenu2_til.add_style(style_MainMenu_screen_default, lv.PART.MAIN | lv.STATE.DEFAULT)
 #表盘
 MainMenu2_Watchface = MainMenu2_til.add_tile(0, 1,  lv.DIR.LEFT | lv.DIR.RIGHT)
+
 label_text = lv.label(MainMenu2_Watchface)
 label_text.set_pos(0, 240)
 label_text.set_size(0, 0)
@@ -326,6 +327,7 @@ class MainMenuScreen(Screen):
         # MainMenu2_img_spo2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.CLICKED, None)
         MainMenu2_img_sms.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.CLICKED, None)
         MainMenu2_img_alipay.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "alipay_open")), lv.EVENT.CLICKED, None)
+        
         EventMesh.subscribe("watch_top_show", self.watch_top_show)
         #MainMenu2_img_alipay.add_event_cb(lambda e: img_cb(e, "Watchface_set"), lv.EVENT.CLICKED, None)
         
index 98f5d3a..85c2a2a 100644 (file)
@@ -350,9 +350,12 @@ language_chinese_btn_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.ST
 
 # -------------------------------------------dialswitch screen----------------------------------------------------------
 dialswitch_screen = lv.obj()
+dialswitch_screen.set_pos(0,0)
+dialswitch_screen.set_size(240,320)
 print("dialswitch_screen")
 dialswitch_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
 
+
 dialswitch_title = lv.label(dialswitch_screen)
 dialswitch_title.set_pos(0, 10)
 dialswitch_title.set_size(240, 40)
@@ -361,39 +364,57 @@ 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_btn1 = lv.btn(dialswitch_screen)
-dialswitch_btn1.set_size(240,54)
-dialswitch_btn1.set_pos(0, 50)
-dialswitch_btn1.add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.PRESSED)
-dialswitch_btn1.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-dialswitch_btn1_label = lv.label(dialswitch_btn1)
-dialswitch_btn1_label.set_text("表盘1")
-dialswitch_btn1_label.align(lv.ALIGN.LEFT_MID, 10, 0)
+dialswitch_img1 = lv.img(dialswitch_screen)#表盘预览图
+dialswitch_img1.set_pos(50, 60)
+dialswitch_img1.set_size(140, 172)
+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)
+
+
+
+dialswitch_btn1_label = lv.label(dialswitch_screen)#显示表盘1 表盘2
+dialswitch_btn1_label.set_text(" ")
+dialswitch_btn1_label.align(lv.ALIGN.TOP_MID, 0, 260)
 dialswitch_btn1_label.add_style(style_font_youyuan_20, 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)
+
+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("E:/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("E:/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()
@@ -1115,52 +1136,86 @@ class DialswitchScreen(Screen):
         self.meta = dialswitch_screen
         self.read_data = {}
         self.watchface_style_num = "Watchface1"
-        dialswitch_btn1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.watchface01(e)),
-                                     lv.EVENT.PRESSED, None)
+        dialswitch_img1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.watchface01(e)),
+                                     lv.EVENT.CLICKED, None)
+        self.dial_num = 1
+        self.move = 0
+        self.timer= osTimer()
 
-        dialswitch_btn2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.watchface02(e)),
-                                     lv.EVENT.PRESSED, None)
     def initialization(self):
+        self.dial_num = 1
+        self.move = 0
         self.read_data = EventMesh.publish("get_storage_data")
         if self.read_data != {}:
             b = str("watchface") in self.read_data.keys()
             if b == True:
                 self.watchface_style_num = self.read_data["watchface"]
         if self.watchface_style_num == "Watchface1":
-            btn1_switch.add_state(lv.STATE.CHECKED)
-            btn2_switch.clear_state(lv.STATE.CHECKED)
+            self.dial_num = 1
         else:
-            btn1_switch.clear_state(lv.STATE.CHECKED)
-            btn2_switch.add_state(lv.STATE.CHECKED)
-       
+            self.dial_num = 2
+        self.show_info()
+
+
 
     def watchface01(self,e):
-        btn1_switch.add_state(lv.STATE.CHECKED)
-        btn2_switch.clear_state(lv.STATE.CHECKED)
+        code  = e.get_code()
+        if code == lv.EVENT.CLICKED:
+            self.timer.start(50,0,self.enter_main_show)
+            
+    def enter_main_show(self,e):
         self.read_data = EventMesh.publish("get_storage_data")
-        self.read_data["watchface"] = "Watchface1"
+        self.read_data["watchface"] = "Watchface{}".format(self.dial_num)
         EventMesh.publish("set_storage_data", self.read_data)
         with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
             ujson.dump(self.read_data,fd)
-        EventMesh.publish("set_change_face", "Watchface1")
+        EventMesh.publish("set_change_face", "Watchface{}".format(self.dial_num))
         EventMesh.publish("watch_top_show")
         EventMesh.publish("load_screen", {"screen": "main_menu"})
 
-    def watchface02(self,e):
-        btn1_switch.clear_state(lv.STATE.CHECKED)
-        btn2_switch.add_state(lv.STATE.CHECKED)
-        self.read_data = EventMesh.publish("get_storage_data")
-        self.read_data["watchface"] = "Watchface2"
-        EventMesh.publish("set_storage_data", self.read_data)
-        with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
-            ujson.dump(self.read_data,fd)
-        EventMesh.publish("set_change_face", "Watchface2")
-        EventMesh.publish("watch_top_show")
-        EventMesh.publish("load_screen", {"screen": "main_menu"})
 
     def done_return(self):
         EventMesh.publish("load_screen", {"screen": "setting"})
 
+    def done_left_to_right(self):#右滑
+        #print("done_left_to_right!!!!!!!!!")
+        self.move = 1
+        if self.dial_num > 1:
+            self.dial_num-=1
+        else:
+           self.dial_num = 2 
+        self.timer.stop()
+        self.show_info()
+
+    def done_right_to_left(self):#左滑
+        #print("done_right_to_left!!!!!!!!!")
+        self.move = 2
+        self.dial_num+=1
+        if self.dial_num > 2:
+            self.dial_num = 1
+        self.show_info()
+        self.timer.stop()
+    
+    def done_bottom_to_top(self):
+        self.move = 3
+        self.timer.stop()
+
+    def done_top_to_bottom(self):
+        self.move = 4
+        self.timer.stop()
+
+    def show_info(self):
+        dialswitch_img1.set_src("U:/static/DIAL_PREV0{}.png".format(self.dial_num))
+        dialswitch_btn1_label.set_text("表盘{}".format(self.dial_num))
+        if(self.dial_num == 1):
+            dialswitch_butoom_crcile1.set_src("E:/static/point_white.png")
+            dialswitch_butoom_crcile2.set_src("E:/static/point_black.png")
+        else:
+            dialswitch_butoom_crcile1.set_src("E:/static/point_black.png")
+            dialswitch_butoom_crcile2.set_src("E:/static/point_white.png")
+    def Close(self):
+        self.timer.stop()
+
     def btn1_release(self):
         EventMesh.publish("load_screen", {"screen": "setting"})
         
index 598d4fe..998fb8d 100644 (file)
Binary files a/2.sdk/project/K5/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/images/firmware_base_release_pack.zip and b/2.sdk/project/K5/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/images/firmware_base_release_pack.zip differ
index fdbecaa..3ccfa72 100644 (file)
@@ -1,5 +1,7 @@
 import sms
 import atcmd
+import net
+import machine
 resp=bytearray(50)
 # atcmd.sendSync('AT+log=52,1\r\n',resp,'',200)
 # print("AT+log=52,1:{}".format(resp))
@@ -237,6 +239,13 @@ if __name__ == '__main__':
         if sms_lacv != 'SM':#每次开机设置一下短信的存储位置
             sms.setSaveLoc('SM', 'SM', 'SM')
     print("init12:{}".format(utime.localtime()))
+    timer_t = net.nitzTime()
+    if(timer_t != -1):
+        timeSecond = int(timer_t[1])
+        next_alarm_time = utime.localtime(timeSecond)
+        machine.RTC().datetime((next_alarm_time[0],next_alarm_time[1],next_alarm_time[2],next_alarm_time[6],next_alarm_time[3],next_alarm_time[4],next_alarm_time[5],0))
+
+   
     EventMesh.publish("load_screen", {"screen": "main_menu"})
 
 
diff --git a/2.sdk/project/K5/usr/static/DIAL_PREV01.png b/2.sdk/project/K5/usr/static/DIAL_PREV01.png
new file mode 100644 (file)
index 0000000..ea14d89
Binary files /dev/null and b/2.sdk/project/K5/usr/static/DIAL_PREV01.png differ
diff --git a/2.sdk/project/K5/usr/static/DIAL_PREV02.png b/2.sdk/project/K5/usr/static/DIAL_PREV02.png
new file mode 100644 (file)
index 0000000..62cca41
Binary files /dev/null and b/2.sdk/project/K5/usr/static/DIAL_PREV02.png differ