K5:
authordxy15521469561 <1731678236@qq.com>
Fri, 28 Jul 2023 03:26:34 +0000 (11:26 +0800)
committerdxy15521469561 <1731678236@qq.com>
Fri, 28 Jul 2023 03:26:34 +0000 (11:26 +0800)
1.增加开关机音频
2.修复个别bug

30 files changed:
2.sdk/Helios_SDK/config/autoconf.h
2.sdk/Helios_SDK/config/config.mk
2.sdk/project/D10/usr/static/R_CALL_mp3.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_STEP_0.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_STEP_1.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_STEP_2.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_STEP_3.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_STEP_4.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_TIME_0.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_TIME_1.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_TIME_2.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_TIME_3.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_TIME_4.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_TIME_5.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_TIME_6.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_TIME_7.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_TIME_8.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/R_READ_TIME_9.mp3 [new file with mode: 0644]
2.sdk/project/D10/usr/static/audio_audio_haixiu.mp3 [new file with mode: 0644]
2.sdk/project/K5/ext/static/R_POWER_1.mp3 [new file with mode: 0644]
2.sdk/project/K5/ext/static/R_POWER_OFF_1.mp3 [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/appAlipay.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/code.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/lcd.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/main_init.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/protocol.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui_setting.py

index 384631a..f63e5ee 100644 (file)
@@ -4,6 +4,7 @@
  * Helios SDK Configuration
  *
  */
+#define PROJECT_NAME_G5_K5  1
 #define CONFIG_LVGL_SPAN 1
 #define CONFIG_LVGL_FS_HELIOS 1
 #define CONFIG_LVGL_GIF_DECODE 1
index aa98ec6..2b217f2 100644 (file)
@@ -2,7 +2,7 @@
 # Automatically generated file; DO NOT EDIT.
 # Helios SDK Configuration
 #
-
+PROJECT_NAME_G5_K5=y
 #
 # System Configuration
 #
diff --git a/2.sdk/project/D10/usr/static/R_CALL_mp3.mp3 b/2.sdk/project/D10/usr/static/R_CALL_mp3.mp3
new file mode 100644 (file)
index 0000000..7c892e1
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_CALL_mp3.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_STEP_0.mp3 b/2.sdk/project/D10/usr/static/R_READ_STEP_0.mp3
new file mode 100644 (file)
index 0000000..26bec13
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_STEP_0.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_STEP_1.mp3 b/2.sdk/project/D10/usr/static/R_READ_STEP_1.mp3
new file mode 100644 (file)
index 0000000..18f232e
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_STEP_1.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_STEP_2.mp3 b/2.sdk/project/D10/usr/static/R_READ_STEP_2.mp3
new file mode 100644 (file)
index 0000000..5bfa86c
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_STEP_2.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_STEP_3.mp3 b/2.sdk/project/D10/usr/static/R_READ_STEP_3.mp3
new file mode 100644 (file)
index 0000000..d714f55
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_STEP_3.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_STEP_4.mp3 b/2.sdk/project/D10/usr/static/R_READ_STEP_4.mp3
new file mode 100644 (file)
index 0000000..1f757ba
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_STEP_4.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_TIME_0.mp3 b/2.sdk/project/D10/usr/static/R_READ_TIME_0.mp3
new file mode 100644 (file)
index 0000000..9599d92
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_TIME_0.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_TIME_1.mp3 b/2.sdk/project/D10/usr/static/R_READ_TIME_1.mp3
new file mode 100644 (file)
index 0000000..6b155e7
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_TIME_1.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_TIME_2.mp3 b/2.sdk/project/D10/usr/static/R_READ_TIME_2.mp3
new file mode 100644 (file)
index 0000000..84509a3
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_TIME_2.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_TIME_3.mp3 b/2.sdk/project/D10/usr/static/R_READ_TIME_3.mp3
new file mode 100644 (file)
index 0000000..6ef9f09
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_TIME_3.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_TIME_4.mp3 b/2.sdk/project/D10/usr/static/R_READ_TIME_4.mp3
new file mode 100644 (file)
index 0000000..5077dde
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_TIME_4.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_TIME_5.mp3 b/2.sdk/project/D10/usr/static/R_READ_TIME_5.mp3
new file mode 100644 (file)
index 0000000..68f4d79
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_TIME_5.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_TIME_6.mp3 b/2.sdk/project/D10/usr/static/R_READ_TIME_6.mp3
new file mode 100644 (file)
index 0000000..dbba5e0
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_TIME_6.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_TIME_7.mp3 b/2.sdk/project/D10/usr/static/R_READ_TIME_7.mp3
new file mode 100644 (file)
index 0000000..de2c1d0
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_TIME_7.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_TIME_8.mp3 b/2.sdk/project/D10/usr/static/R_READ_TIME_8.mp3
new file mode 100644 (file)
index 0000000..07caa50
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_TIME_8.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/R_READ_TIME_9.mp3 b/2.sdk/project/D10/usr/static/R_READ_TIME_9.mp3
new file mode 100644 (file)
index 0000000..d2554a3
Binary files /dev/null and b/2.sdk/project/D10/usr/static/R_READ_TIME_9.mp3 differ
diff --git a/2.sdk/project/D10/usr/static/audio_audio_haixiu.mp3 b/2.sdk/project/D10/usr/static/audio_audio_haixiu.mp3
new file mode 100644 (file)
index 0000000..5ef7a93
Binary files /dev/null and b/2.sdk/project/D10/usr/static/audio_audio_haixiu.mp3 differ
diff --git a/2.sdk/project/K5/ext/static/R_POWER_1.mp3 b/2.sdk/project/K5/ext/static/R_POWER_1.mp3
new file mode 100644 (file)
index 0000000..aaff01c
Binary files /dev/null and b/2.sdk/project/K5/ext/static/R_POWER_1.mp3 differ
diff --git a/2.sdk/project/K5/ext/static/R_POWER_OFF_1.mp3 b/2.sdk/project/K5/ext/static/R_POWER_OFF_1.mp3
new file mode 100644 (file)
index 0000000..3ff519d
Binary files /dev/null and b/2.sdk/project/K5/ext/static/R_POWER_OFF_1.mp3 differ
index 81a8f15..2eb91c5 100644 (file)
@@ -398,9 +398,9 @@ label_ok.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
 #闹钟信息
 alarm_list = [{'hour': 16, 'repeart': 10, 'idx': 0, 'enabled': 0, 'days': [], 'minute': 39},
                {'hour': 16, 'repeart': 10, 'idx': 1, 'enabled': 0, 'days': [], 'minute': 39}, 
-               {'hour': 15, 'repeart': 1, 'idx': 2, 'enabled': 0, 'days': [], 'minute': 13}, 
-               {'hour': 16, 'repeart': 1, 'idx': 3, 'enabled': 0, 'days': [], 'minute': 39}, 
-               {'hour': 15, 'repeart': 1, 'idx': 4, 'enabled': 0, 'days': [], 'minute': 13}]
+               {'hour': 15, 'repeart': 15, 'idx': 2, 'enabled': 0, 'days': [], 'minute': 13}, 
+               {'hour': 16, 'repeart': 15, 'idx': 3, 'enabled': 0, 'days': [], 'minute': 39}, 
+               {'hour': 15, 'repeart': 15, 'idx': 4, 'enabled': 0, 'days': [], 'minute': 13}]
 #用于显示闹钟列表不包含开关机信息
 
 class ClockManager(Abstract):
@@ -812,7 +812,7 @@ class PopupAlarmScreen(Screen):
 
     def initialization(self):
         self.alarm_count = 0
-        self.timer.start(3*1000,1,self.exit_alarm_page)
+        self.timer.start(1000,1,self.exit_alarm_page)
         time = EventMesh.publish("screen_get_time")#获取系统时间
         popup_alarm_time.set_text("{}:{}".format("%02d"%(time[0][0]),"%02d"%(time[0][1])))
 
@@ -823,14 +823,19 @@ class PopupAlarmScreen(Screen):
         self.aud.stop()
 
     def exit_alarm_page(self,*arges):
+        EventMesh.publish("system_sleep_rest")#防止黑屏
         self.alarm_count+=1
-        if self.alarm_count > 10:
+        if self.alarm_count > 60:
             self.alarm_count = 0
             self.aud.stop()
             self.timer.stop()
             EventMesh.publish("load_screen", {"screen": "main_menu"})
             return
-        self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3')  #播放声音
+        play_state = EventMesh.publish("get_audio_state")#音频播放状态
+        if play_state != None:
+            if play_state == 0:#在上一个界面在播放音频时切换界面则关闭 以免一直播放
+                self.aud.stop()
+                self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3')  #播放声音
     
     def close_timer(self):
         self.alarm_count=0
@@ -921,7 +926,7 @@ class ClkListScreen(Screen):
                     if count >= 3:
                         break
                     repeart = each["repeart"]
-                    if repeart == 10:
+                    if repeart >= 10:
                         continue
                     _btn = lv.btn(self.alarm_show_list)
                     _btn.set_size(230,75)
index 5b0479b..f8424d5 100644 (file)
@@ -12,6 +12,7 @@ from misc import Power
 import pm
 from ui import Screen
 from code import code_128_generate_barcode
+import code128
 style_font_youyuan_20 = lv.style_t()
 style_font_youyuan_20.init()
 style_font_youyuan_20.set_text_color(lv.color_make(0xff, 0xff, 0xff))
@@ -159,7 +160,7 @@ class Alipay(Abstract):
             #获取付款码回调 
             print("upay_display_notify_cb: paycode[%d]: %s\n"%( result_len, result))
             EventMesh.publish("load_screen", {"screen": "alipay_paycode","meta":str(result)})
-
+            EventMesh.publish("set_alipay_code",str(result))
             # 查询付款结果 
             print("upay_display_notify_cb:  get payment result\n")
             utime.sleep_ms(500)
@@ -559,30 +560,35 @@ class Alipay_invite(Screen):
     def __init__(self):
         super().__init__()
         self.meta = alipay_invite_screen
-        self.alipay_invite = osTimer()
+        self.alipay_invite_time = osTimer()
 
 
     def initialization(self):
-        self.alipay_invite.start(1000, 1, self.alipay_invite)
         EventMesh.publish("set_Alipay_Ui_isOpen",1)
 
-    def alipay_invite(self, *args):
-        print("alipay_invite:")
-        EventMesh.publish("system_sleep_rest")#防止黑屏
-        
+    
 
     def post_processor_after_initialization(self):
         # 二维码数据
+        self.alipay_invite_time.start(1000, 1, self.alipay_invite)
         self.alipay_qr_data = str(self.meta_info)
         print("alipay_invite:",str(self.meta_info))
         alipay_invite_alipay_qr.update(self.alipay_qr_data,len(self.alipay_qr_data))
 
-
+    def alipay_invite(self, *args):
+        print("alipay_invite:")
+        EventMesh.publish("system_sleep_rest")#防止黑屏
+        
     def Close(self):
         print("alipay_exit:")
-        self.alipay_invite.stop()
+        self.alipay_invite_time.stop()
         EventMesh.publish("set_Alipay_Ui_isOpen",0)
         pass
+    def lcd_off(self):
+        self.alipay_invite_time.stop()
+    
+    def lcd_on(self):
+        self.alipay_invite_time.start(1000, 1, self.alipay_invite)
 
     def done_return(self):
         EventMesh.publish("load_screen", {"screen": "main_menu"}) 
@@ -756,7 +762,7 @@ alipay_paycode_label = lv.label(alipay_paycode_screen)
 alipay_paycode_label.set_pos(0, 3)
 alipay_paycode_label.set_size(240, 25)
 alipay_paycode_label.set_long_mode(lv.label.LONG.WRAP)
-alipay_paycode_label.set_text("收银员扫一扫完成付款")
+alipay_paycode_label.set_text("向商家付款")
 alipay_paycode_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
 alipay_paycode_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
@@ -788,6 +794,60 @@ alipay_paycode_alipay_qr.set_pos(45,150)
 alipay_paycode_alipay_qr.set_style_border_color(alipay_paycode_bg_color, 0)
 alipay_paycode_alipay_qr.set_style_border_width(5, 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)
+
+container = lv.obj(alipay_paycode_screen)
+container.set_size(240, 100)
+container.set_pos(0, 33)
+container.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+container.add_style(style_bar,lv.PART.MAIN | lv.STATE.DEFAULT)
+
+line_bar = []
+def code_128_generate_barcode1(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)
+
+
+
+    # 计算每个条的宽度
+    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)):
+        if(len(line_bar) == i):
+            line_tmp = lv.obj(container)
+            line_tmp.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT)
+            line_bar.append(line_tmp)
+
+        real_width = bar_width * 1
+        line_bar[i].set_size(1,90)
+        left = (width - len(binary_data))//2#240-152 = 88 //2 ==44
+        line_bar[i].set_pos(left+left_curr_line,0)
+        if binary_data[i] == 0xff:
+            line_bar[i].set_style_bg_color(lv.color_make(0xff, 0xff, 0xff), lv.PART.MAIN | lv.STATE.DEFAULT)
+        else:
+            line_bar[i].set_style_bg_color(lv.color_make(0x00, 0x00, 0x00), lv.PART.MAIN | lv.STATE.DEFAULT)
+        left_curr_line += real_width
 
 class Alipay_paycode(Screen):
     NAME = "alipay_paycode"
@@ -795,61 +855,37 @@ class Alipay_paycode(Screen):
     def __init__(self):
         super().__init__()
         self.meta = alipay_paycode_screen
-        self.container = lv.obj(alipay_paycode_screen)
-        self.container.set_pos(0, 33)
-        self.container.set_size(240, 100)
-        self.container.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-        self.container.add_style(style_alipay_screen_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
         self.timer = osTimer()
+        EventMesh.subscribe("set_alipay_code",self.set_alipay_code)
+        EventMesh.subscribe("get_alipay_code",self.get_alipay_code)
+        self.alipay_qr_data = {}
 
     def post_processor_after_initialization(self):
         self.alipay_qr_data = str(self.meta_info)
         print("alipay_paycode:",str(self.meta_info))
         alipay_paycode_alipay_qr.update(self.alipay_qr_data,len(self.alipay_qr_data))
-        # alipay_bar.update(self.alipay_qr_data,len(self.alipay_qr_data))
-        # alipay_barcode_num.set_text(self.alipay_qr_data)
-        # left_curr_line = 0
-
-        # # 删除上次的container
-        # # 生成二进制码
-        # binary_data = code128.encode(self.alipay_qr_data)
-        # if not binary_data:
-        #     return
-        # # print("binary_data is ",binary_data)
-
-        # # 在LVGL中创建一个容器对象
-        # self.container.delete()#先删除一次控件
-        # self.container = lv.obj(alipay_paycode_screen)
-        # self.container.set_pos(0, 30)
-        # self.container.set_size(240, 100)
-        # self.container.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-        # self.container.add_style(style_alipay_screen_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-        # # 计算每个条的宽度
-        # bar_width = 240 // (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(self.container)
-        #     bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT)
-        #     real_width = bar_width * 1
-        #     bar.set_size(1,90)
-        #     left = (240 - 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
-        
-        code_128_generate_barcode(alipay_paycode_screen,self.alipay_qr_data,240,100)
+        code_128_generate_barcode1(alipay_paycode_screen,self.alipay_qr_data,240,100)
+
     def initialization(self):
+        print("alipay_paycode:initialization")
         self.timer.start(10*1000,1,self.update_alipy)
         EventMesh.publish("set_Alipay_Ui_isOpen",1)
     def update_alipy(self,e):
         EventMesh.publish("get_payment_code")
+        EventMesh.publish("publish_message_event_ui",{"func":self.update_show,"data":0})
+
+
+    def update_show(self,data):
+        if self.alipay_qr_data != {}:
+            print("alipay_paycode:update_show")
+            alipay_paycode_alipay_qr.update(self.alipay_qr_data,len(self.alipay_qr_data))
+            code_128_generate_barcode1(alipay_paycode_screen,self.alipay_qr_data,240,100)
+
+    def get_alipay_code(self, event, msg):#获取
+        return self.alipay_qr_data
+
+    def set_alipay_code(self, event, msg):#获取
+        self.alipay_qr_data = msg
 
     def lcd_on(self):
         self.timer.start(10*1000,1,self.update_alipy)
@@ -863,6 +899,8 @@ class Alipay_paycode(Screen):
         pass
     def done_click(self):
         EventMesh.publish("get_payment_code")
+        EventMesh.publish("publish_message_event_ui",{"func":self.update_show,"data":0})
+
 
     def done_return(self):
         EventMesh.publish("load_screen", {"screen": "alipay_1_1"})
@@ -1004,27 +1042,27 @@ alipay_parent_bg.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAU
 
 #提示词
 alipay_parent_label = lv.label(alipay_parent_screen)
-alipay_parent_label.set_pos(104, 12)
-alipay_parent_label.set_size(96, 29)
+alipay_parent_label.set_pos(96, 12)
+alipay_parent_label.set_size(240-96, 29)
 alipay_parent_label.set_long_mode(lv.label.LONG.WRAP)
 alipay_parent_label.set_text("家长设置")
-alipay_parent_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+alipay_parent_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
 alipay_parent_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 alipay_parent_label1 = lv.label(alipay_parent_screen)
-alipay_parent_label1.set_pos(100, 43)
-alipay_parent_label1.set_size(120, 29)
+alipay_parent_label1.set_pos(96, 43)
+alipay_parent_label1.set_size(240-96, 29)
 alipay_parent_label1.set_long_mode(lv.label.LONG.WRAP)
 alipay_parent_label1.set_text("零花钱管理")
-alipay_parent_label1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+alipay_parent_label1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
 alipay_parent_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 alipay_parent_label2 = lv.label(alipay_parent_screen)
-alipay_parent_label2.set_pos(100, 71)
-alipay_parent_label2.set_size(120, 29)
+alipay_parent_label2.set_pos(96, 71)
+alipay_parent_label2.set_size(240-96, 29)
 alipay_parent_label2.set_long_mode(lv.label.LONG.WRAP)
 alipay_parent_label2.set_text("解绑退钱")
-alipay_parent_label2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+alipay_parent_label2.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
 alipay_parent_label2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 #家长码
index 3f9b53c..c6e3a2a 100644 (file)
@@ -29,8 +29,7 @@ def code_128_generate_barcode(screen, data, width=180, height=80):
 
     # 删除上次的container
     old_container = screen.get_child(-1)
-    if old_container:
-        old_container.delete()
+    old_container.add_flag(lv.obj.FLAG.HIDDEN)
 
     # 生成二进制码
     binary_data = code128.encode(data)
@@ -44,7 +43,7 @@ def code_128_generate_barcode(screen, data, width=180, height=80):
     container.set_pos(0, 33)
     container.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
     container.add_style(style_bar,lv.PART.MAIN | lv.STATE.DEFAULT)
-
+    container.add_flag(lv.obj.FLAG.HIDDEN)
     # 计算每个条的宽度
     bar_width = width // (len(binary_data))
     # print("bar_width is :{} len(binary_data):{}".format(bar_width,len(binary_data)))
@@ -62,6 +61,10 @@ def code_128_generate_barcode(screen, data, width=180, height=80):
         else:
             bar.set_style_bg_color(lv.color_make(0x00, 0x00, 0x00), lv.PART.MAIN | lv.STATE.DEFAULT)
         left_curr_line += real_width
+    container.clear_flag(lv.obj.FLAG.HIDDEN)
+    old_container.clear_flag(lv.obj.FLAG.HIDDEN)
+    if old_container:
+        old_container.delete()
 
 
 # if __name__ == "__main__":
index e793798..8c6d792 100644 (file)
@@ -221,14 +221,19 @@ style_font_youyuan_40.init()
 style_font_youyuan_40.set_text_color(lv.color_make(0xff, 0xff, 0xff))
 style_font_youyuan_40.set_text_font_v2("font_40.bin",40,0)
 
+style_font_youyuan_black_40 = lv.style_t()
+style_font_youyuan_black_40.init()
+style_font_youyuan_black_40.set_text_color(lv.color_make(0x00, 0x00, 0x00))
+style_font_youyuan_black_40.set_text_font_v2("font_40.bin",40,0)
+
 power_on_screen = lv.obj()
 print("power_on_screen")
 power_on_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 power_on_label = lv.label(power_on_screen)
-power_on_label.set_text("WELCOME")
+power_on_label.set_text(" ")
 power_on_label.align(lv.ALIGN.CENTER, 0, 0)
-power_on_label.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
+power_on_label.add_style(style_font_youyuan_black_40, lv.PART.MAIN | lv.STATE.DEFAULT)
 print("power_on_screen init...")
 lv.scr_load(power_on_screen)
 utime.sleep_ms(200)
index aad2f01..fbcf22a 100644 (file)
@@ -107,6 +107,7 @@ def main_init():
     ui.add_screen(_ui_setting.PhoneringScreen()) 
     ui.add_screen(_ui_setting.totalvolumeScreen()) 
     ui.add_screen(_ui_setting.PoweroffConfirmScreen()) 
+    ui.add_screen(_ui_setting.PowerOnScreen())
     ui.add_screen(_ui.DialingScreen()) 
     ui.add_screen(_ui.CallLogScreen()) 
     from appAlipay import Alipay ,AlipayOpenScreen,Alipay_1_1,Alipay_invite,Alipay_inviting,\
@@ -153,7 +154,7 @@ def main_init():
     import mgr as mgr
     print("init7:{}".format(utime.localtime()))
     
-    from mgr import ConfigStoreManager,sosInfoCallManager,getBootOffManager,getSosFlagManager,CountdownManager, LocationManager, getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\
+    from mgr import ConfigStoreManager,playPowerAudioManager,sosInfoCallManager,getBootOffManager,getSosFlagManager,CountdownManager, LocationManager, getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\
     AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldTimeManager,getStorageDataManager,getBrightnessManager,getHrTimeManager,getTempTimeManager,getLowBatManager
     print("init8:{}".format(utime.localtime()))
     
@@ -179,7 +180,7 @@ def main_init():
            
         # .append_manager(mgr.StopwatchManager()) \
         # .append_manager(mgr.CountdownManager()) \
-
+    app.append_manager(playPowerAudioManager())
     app.append_manager(Alipay()) 
     app.append_manager(ConfigStoreManager())
     app.append_manager(NetManager())
@@ -257,7 +258,6 @@ def main_init():
             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": "poweron"})
    
-    EventMesh.publish("load_screen", {"screen": "main_menu"})
-
 
index 9e655cc..55b6dc9 100644 (file)
@@ -204,6 +204,7 @@ class CountdownManager(Abstract):
                 self.sec = 0
                 self.min = 0
                 self.hour = 0
+                
                 EventMesh.publish("load_screen", {"screen": "countdown_end"})
                 return
             self.total_sec = time_tmp
@@ -656,6 +657,9 @@ class DeviceInfoManager(Abstract):
         self.curr_battery_level = 4200
         self.bat_count = 0
 
+        self.mearsure_btn = 0
+        self.mearsure_timer = 0
+        
         self.usb = USB()
         self.usb.setCallback(self.usb_event_cb)
         self.log = LogAdapter(self.__class__.__name__)
@@ -910,8 +914,9 @@ class DeviceInfoManager(Abstract):
 
         get_temp_time  = EventMesh.publish("get_temp_time")
         get_temp_state  = EventMesh.publish("get_temp_state")
+        hr_time = {}
         hr_time = EventMesh.publish("get_time_hr_spo2")#获取时间是否大于0
-        if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1 and battery[0] != "1":
+        if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1 and battery[0] != "0":
             # print("get_temp_time:{} self.temp_one_state:{}".format(get_temp_time,self.temp_one_state))
             if get_temp_time != None:#定时测量体温
                 if get_temp_time > 0:
@@ -1010,191 +1015,194 @@ class DeviceInfoManager(Abstract):
                             print("AUTO once temp:{} tmp_f:{} tmp_f_tmp:{} tmp_d:{} tmp_d_tmp:{}".format(temp,tmp_f,tmp_f_tmp,tmp_d,tmp_d_tmp)) 
                             EventMesh.publish("set_temp_state",0)
                             
-
-            if hr_time != None:
-                # print("hr......01....{}\r\n".format(hr_time))
-                if hr_time > 0:
-                    #print("get_hr_state:{} get_spo2_state:{} self.old_time:{} hr_time:{}".format(self.get_hr_state,self.get_spo2_state,self.old_time,hr_time))
-                    if self.get_hr_state != 1 and self.get_spo2_state != 1:
-                        if self.get_hr_state == 0 and self.get_spo2_state == 0:
-                            if self.HR_state == 0 or self.HR_state == 3:
+            self.mearsure_btn = int(hr_time[0])
+            self.mearsure_timer = int(hr_time[1])
+            if self.mearsure_btn != None and self.mearsure_timer != None:
+                print("hr......01....{} {}\r\n".format(hr_time[0],hr_time[1]))
+                if self.mearsure_btn > 0:
+                    if self.mearsure_timer > 0:
+                        #print("get_hr_state:{} get_spo2_state:{} self.old_time:{} mearsure_timer:{}".format(self.get_hr_state,self.get_spo2_state,self.old_time,mearsure_timer))
+                        if self.get_hr_state != 1 and self.get_spo2_state != 1:
+                            if self.get_hr_state == 0 and self.get_spo2_state == 0:
+                                if self.HR_state == 0 or self.HR_state == 3:
+                                    self.HR_Onestate = 0
+                                    self.HR_OneTime = 0
+                            
+                            if self.old_time != self.mearsure_timer:#重复修改测量间隔时间
+                                self.SENSOR_time = time_tmp#防止改变时间的时候正在开启测量突然10s就停止测量
+                                if self.get_hr_state == 2 and self.HR_state == 1:#自动检测的心率还在测量立马关了测试
+                                    heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
+                                    if heart_value > 50 and heart_value != None:
+                                        EventMesh.publish("set_old_hr_data",heart_value)
+                                        EventMesh.publish("set_history_hr_value",heart_value)
+                                        EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)
+                                    print("stop debug1")
+                                    EventMesh.publish(constants.EVENT.STOP_HEART)
+                                    self.HR_state = 0
+                                elif self.get_spo2_state == 2 and self.HR_state == 2:
+                                    self.HR_state = 0
+                                    spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
+                                    if spo2_value > 85 and spo2_value != None:
+                                        EventMesh.publish("set_old_spo2_data",spo2_value)
+                                        EventMesh.publish("set_history_spo2_value",spo2_value)
+                                        EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
+                                    EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
+                            self.old_time = self.mearsure_timer
+
+                            if self.HR_state == 3 or self.HR_state == 0:#
+                                if (time_tmp - self.SENSOR_time) >= self.mearsure_timer:
+                                    if self.get_spo2_state == 3 or self.get_hr_state == 3:#单次测量没有完毕优先测量间隔时间测量的
+                                        if self.get_hr_state == 3:
+                                            print("stop debug2")
+                                            EventMesh.publish(constants.EVENT.STOP_HEART)
+                                            heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
+                                            if heart_value > 50 and heart_value != None:
+                                                EventMesh.publish("set_old_hr_data",heart_value)
+                                                EventMesh.publish("set_history_hr_value",heart_value)
+                                                EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)
+                                            
+                                        elif self.get_spo2_state == 3:
+                                            EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
+                                            spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
+                                            if spo2_value > 85 and spo2_value != None:
+                                                EventMesh.publish("set_history_spo2_value",spo2_value)
+                                                EventMesh.publish("set_old_spo2_data",spo2_value)
+                                                EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
+
+                                        self.HR_state = 0
+                                        self.SENSOR_time = time_tmp
+                                    self.SENSOR_time = time_tmp
+                                    self.HR_state = 0
+                                
+                            #print("time_tmp :{} self.SENSOR_time :{} time_tmp - self.SENSOR_time:{} self.HR_state:{}".format(time_tmp,self.SENSOR_time,time_tmp - self.SENSOR_time,self.HR_state))
+                            if (time_tmp - self.SENSOR_time) == 0 and self.HR_state == 0:
+                                print("START_HEART:1")
+                                EventMesh.publish("set_hr_state",2)#2代表后台进入测试
+                                EventMesh.publish(constants.EVENT.START_HEART)
+                                self.HR_state = 1
                                 self.HR_Onestate = 0
                                 self.HR_OneTime = 0
-                        
-                        if self.old_time != hr_time:#重复修改测量间隔时间
-                            self.SENSOR_time = time_tmp#防止改变时间的时候正在开启测量突然10s就停止测量
-                            if self.get_hr_state == 2 and self.HR_state == 1:#自动检测的心率还在测量立马关了测试
+                            elif (time_tmp - self.SENSOR_time) >= 60 and self.HR_state == 1:
+                                EventMesh.publish("set_hr_state",0)#2代表后台进入测试
+                                print("stop debug3")
+                                EventMesh.publish(constants.EVENT.STOP_HEART)
                                 heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
+                                print("heart_value:{}".format(heart_value))
                                 if heart_value > 50 and heart_value != None:
                                     EventMesh.publish("set_old_hr_data",heart_value)
                                     EventMesh.publish("set_history_hr_value",heart_value)
-                                    EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)
-                                print("stop debug1")
-                                EventMesh.publish(constants.EVENT.STOP_HEART)
-                                self.HR_state = 0
-                            elif self.get_spo2_state == 2 and self.HR_state == 2:
+                                    EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据
+                                #获取心率数据上传数据app
+                                print("STOP_HEART:")
+                            
+                                self.HR_state = 3
+                                # EventMesh.publish("set_spo2_state",2)#2代表后台进入血氧测试
+                                # EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)#K开血氧
+                                # print("START_BLOOD_OXYGEN:")
+                            # elif (time_tmp - self.SENSOR_time) >= 120 and self.HR_state == 2:#有需要再打开
+                            #     print("STOP_BLOOD_OXYGEN:")
+                            #     EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试
+                            #     EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#停止血氧测试
+                            #     spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
+                            #     print("spo2_value:{}".format(spo2_value))
+                            #     if spo2_value > 85 and spo2_value != None:
+                            #         EventMesh.publish("set_old_spo2_data",spo2_value)
+                            #         EventMesh.publish("set_history_spo2_value",spo2_value)
+                            #         EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
+                            #     self.HR_state = 3
+                        else:
+                            self.HR_state = 0
+                            self.old_time = self.mearsure_timer
+
+                        if self.HR_state == 3 or self.HR_state == 0:#只有不在测量的时候才测单次的
+                            if self.get_spo2_state == 3 or self.get_hr_state == 3:#单次测量
                                 self.HR_state = 0
-                                spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
-                                if spo2_value > 85 and spo2_value != None:
-                                    EventMesh.publish("set_old_spo2_data",spo2_value)
-                                    EventMesh.publish("set_history_spo2_value",spo2_value)
-                                    EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
-                                EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
-                        self.old_time = hr_time
-
-                        if self.HR_state == 3 or self.HR_state == 0:#
-                            if (time_tmp - self.SENSOR_time) >= hr_time:
-                                if self.get_spo2_state == 3 or self.get_hr_state == 3:#单次测量没有完毕优先测量间隔时间测量的
+                                self.HR_OneTime+=1
+                                if self.HR_OneTime == 1 and self.HR_Onestate == 0:
+                                    print("hr..........\r\n")
                                     if self.get_hr_state == 3:
-                                        print("stop debug2")
+                                        self.Hr_Need_Open = 1
+                                        EventMesh.publish("set_hr_state",3)#2代表后台进入测试
+                                        EventMesh.publish(constants.EVENT.START_HEART)
+                                    else:
+                                        self.Hr_Need_Open = 0
+
+                                    if self.get_spo2_state == 3 and self.Hr_Need_Open == 0:
+                                        self.Spo2_Need_Open = 1
+                                        EventMesh.publish("set_spo2_state",3)#2代表后台进入测试
+                                        EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)#K开血氧
+                                    else:
+                                        self.Spo2_Need_Open = 0
+                                    self.HR_Onestate = 1
+                                    # print("self.HR_Onestate....3..:{} {} {} {} {}".format(self.HR_Onestate,self.get_hr_state,self.get_spo2_state,self.Hr_Need_Open,self.Spo2_Need_Open))
+                                elif self.HR_OneTime > 6 and self.HR_Onestate == 1:
+                                    # print("self.HR_Onestate...4....:{} {} {} {} {}".format(self.HR_Onestate,self.get_hr_state,self.get_spo2_state,self.Hr_Need_Open,self.Spo2_Need_Open))
+                                    if self.Hr_Need_Open == 1:#需要关闭心率测量
+                                        print("stop debug4")
                                         EventMesh.publish(constants.EVENT.STOP_HEART)
                                         heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
                                         if heart_value > 50 and heart_value != None:
-                                            EventMesh.publish("set_old_hr_data",heart_value)
                                             EventMesh.publish("set_history_hr_value",heart_value)
-                                            EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)
-                                        
-                                    elif self.get_spo2_state == 3:
-                                        EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
-                                        spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
-                                        if spo2_value > 85 and spo2_value != None:
-                                            EventMesh.publish("set_history_spo2_value",spo2_value)
-                                            EventMesh.publish("set_old_spo2_data",spo2_value)
-                                            EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
-
-                                    self.HR_state = 0
-                                    self.SENSOR_time = time_tmp
-                                self.SENSOR_time = time_tmp
-                                self.HR_state = 0
-                            
-                        #print("time_tmp :{} self.SENSOR_time :{} time_tmp - self.SENSOR_time:{} self.HR_state:{}".format(time_tmp,self.SENSOR_time,time_tmp - self.SENSOR_time,self.HR_state))
-                        if (time_tmp - self.SENSOR_time) == 0 and self.HR_state == 0:
-                            print("START_HEART:1")
-                            EventMesh.publish("set_hr_state",2)#2代表后台进入测试
-                            EventMesh.publish(constants.EVENT.START_HEART)
-                            self.HR_state = 1
-                            self.HR_Onestate = 0
-                            self.HR_OneTime = 0
-                        elif (time_tmp - self.SENSOR_time) >= 60 and self.HR_state == 1:
-                            EventMesh.publish("set_hr_state",0)#2代表后台进入测试
-                            print("stop debug3")
-                            EventMesh.publish(constants.EVENT.STOP_HEART)
-                            heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
-                            print("heart_value:{}".format(heart_value))
-                            if heart_value > 50 and heart_value != None:
-                                EventMesh.publish("set_old_hr_data",heart_value)
-                                EventMesh.publish("set_history_hr_value",heart_value)
-                                EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据
-                            #获取心率数据上传数据app
-                            print("STOP_HEART:")
-                            EventMesh.publish("set_spo2_state",2)#2代表后台进入血氧测试
-                            EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)#K开血氧
-                            print("START_BLOOD_OXYGEN:")
-                            self.HR_state = 2
-                        elif (time_tmp - self.SENSOR_time) >= 120 and self.HR_state == 2:
-                            print("STOP_BLOOD_OXYGEN:")
-                            EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试
-                            EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#停止血氧测试
-                            spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
-                            print("spo2_value:{}".format(spo2_value))
-                            if spo2_value > 85 and spo2_value != None:
-                                EventMesh.publish("set_old_spo2_data",spo2_value)
-                                EventMesh.publish("set_history_spo2_value",spo2_value)
-                                EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
-                            self.HR_state = 3
-                    else:
-                        self.HR_state = 0
-                        self.old_time = hr_time
-
-                    if self.HR_state == 3 or self.HR_state == 0:#只有不在测量的时候才测单次的
-                        if self.get_spo2_state == 3 or self.get_hr_state == 3:#单次测量
-                            self.HR_state = 0
-                            self.HR_OneTime+=1
-                            if self.HR_OneTime == 1 and self.HR_Onestate == 0:
-                                print("hr..........\r\n")
-                                if self.get_hr_state == 3:
-                                    self.Hr_Need_Open = 1
-                                    EventMesh.publish("set_hr_state",3)#2代表后台进入测试
-                                    EventMesh.publish(constants.EVENT.START_HEART)
-                                else:
-                                    self.Hr_Need_Open = 0
-
-                                if self.get_spo2_state == 3 and self.Hr_Need_Open == 0:
-                                    self.Spo2_Need_Open = 1
-                                    EventMesh.publish("set_spo2_state",3)#2代表后台进入测试
-                                    EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)#K开血氧
-                                else:
-                                    self.Spo2_Need_Open = 0
-                                self.HR_Onestate = 1
-                                # print("self.HR_Onestate....3..:{} {} {} {} {}".format(self.HR_Onestate,self.get_hr_state,self.get_spo2_state,self.Hr_Need_Open,self.Spo2_Need_Open))
-                            elif self.HR_OneTime > 6 and self.HR_Onestate == 1:
-                                # print("self.HR_Onestate...4....:{} {} {} {} {}".format(self.HR_Onestate,self.get_hr_state,self.get_spo2_state,self.Hr_Need_Open,self.Spo2_Need_Open))
-                                if self.Hr_Need_Open == 1:#需要关闭心率测量
-                                    print("stop debug4")
-                                    EventMesh.publish(constants.EVENT.STOP_HEART)
-                                    heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
-                                    if heart_value > 50 and heart_value != None:
-                                        EventMesh.publish("set_history_hr_value",heart_value)
-                                        EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据
-                                        EventMesh.publish("set_old_hr_data",heart_value)
-                            
-                                    if self.Spo2_Need_Open == 0 and self.get_spo2_state == 3:
-                                        EventMesh.publish("set_spo2_state",3)#2代表后台进入血氧测试
-                                        EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)#K开血氧
+                                            EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据
+                                            EventMesh.publish("set_old_hr_data",heart_value)
+                                
+                                        if self.Spo2_Need_Open == 0 and self.get_spo2_state == 3:
+                                            EventMesh.publish("set_spo2_state",3)#2代表后台进入血氧测试
+                                            EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)#K开血氧
+                                            
+                                            self.HR_Onestate = 2
+                                            self.set_hsenor_crt = 2#血氧关闭
+                                        else:
+                                            self.HR_Onestate = 0
+                                            self.HR_OneTime = 0
+                                            self.set_hsenor_crt = 0#
                                         
-                                        self.HR_Onestate = 2
-                                        self.set_hsenor_crt = 2#血氧关闭
+                                            EventMesh.publish("set_hr_state",0)#2代表后台进入血氧测试
+                                            EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试
                                     else:
-                                        self.HR_Onestate = 0
-                                        self.HR_OneTime = 0
-                                        self.set_hsenor_crt = 0#
-                                    
-                                        EventMesh.publish("set_hr_state",0)#2代表后台进入血氧测试
-                                        EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试
-                                else:
-                                    if self.Spo2_Need_Open == 1:#停止测试血氧
+                                        if self.Spo2_Need_Open == 1:#停止测试血氧
+                                            EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试
+                                            EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#K开血氧
+                                            spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
+                                        
+                                            if spo2_value > 85 and spo2_value != None:
+                                                EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
+                                                EventMesh.publish("set_old_spo2_data",spo2_value)
+                                                EventMesh.publish("set_history_spo2_value",spo2_value)
+                                            if self.Hr_Need_Open == 0 and self.get_hr_state == 3:
+                                                EventMesh.publish("set_hr_state",3)#2代表后台进入测试
+                                                EventMesh.publish(constants.EVENT.START_HEART)
+                                                self.HR_Onestate = 2
+                                                self.set_hsenor_crt = 1#心率
+                                            else:
+                                                self.HR_Onestate = 0
+                                                self.HR_OneTime = 0
+                                                self.set_hsenor_crt = 2#血氧关闭
+                                            
+                                            
+                                elif self.HR_OneTime > 6+6 and self.HR_Onestate == 2:
+                                    print("HR_OneTime:....05")
+                                    if self.set_hsenor_crt == 2:
                                         EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试
-                                        EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#K开血氧
+                                        EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#停止血氧测试
                                         spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
-                                    
                                         if spo2_value > 85 and spo2_value != None:
+                                            EventMesh.publish("set_history_spo2_value",spo2_value)
                                             EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
                                             EventMesh.publish("set_old_spo2_data",spo2_value)
-                                            EventMesh.publish("set_history_spo2_value",spo2_value)
-                                        if self.Hr_Need_Open == 0 and self.get_hr_state == 3:
-                                            EventMesh.publish("set_hr_state",3)#2代表后台进入测试
-                                            EventMesh.publish(constants.EVENT.START_HEART)
-                                            self.HR_Onestate = 2
-                                            self.set_hsenor_crt = 1#心率
-                                        else:
-                                            self.HR_Onestate = 0
-                                            self.HR_OneTime = 0
-                                            self.set_hsenor_crt = 2#血氧关闭
-                                        
-                                        
-                            elif self.HR_OneTime > 6+6 and self.HR_Onestate == 2:
-                                print("HR_OneTime:....05")
-                                if self.set_hsenor_crt == 2:
-                                    EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试
-                                    EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#停止血氧测试
-                                    spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
-                                    if spo2_value > 85 and spo2_value != None:
-                                        EventMesh.publish("set_history_spo2_value",spo2_value)
-                                        EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
-                                        EventMesh.publish("set_old_spo2_data",spo2_value)
-                                elif self.set_hsenor_crt == 1:
-                                    EventMesh.publish("set_hr_state",0)#0代表g关闭测试
-                                    print("stop debug5")
-                                    EventMesh.publish(constants.EVENT.STOP_HEART)
-                                    heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
-                                    if heart_value > 50 and heart_value != None:
-                                        EventMesh.publish("set_history_hr_value",heart_value)
-                                        EventMesh.publish("set_old_hr_data",heart_value)
-                                        EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据
+                                    elif self.set_hsenor_crt == 1:
+                                        EventMesh.publish("set_hr_state",0)#0代表g关闭测试
+                                        print("stop debug5")
+                                        EventMesh.publish(constants.EVENT.STOP_HEART)
+                                        heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
+                                        if heart_value > 50 and heart_value != None:
+                                            EventMesh.publish("set_history_hr_value",heart_value)
+                                            EventMesh.publish("set_old_hr_data",heart_value)
+                                            EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据
+                                    self.HR_Onestate = 0
+                            else:
                                 self.HR_Onestate = 0
-                        else:
-                            self.HR_Onestate = 0
-                            self.HR_OneTime = 0
+                                self.HR_OneTime = 0
                 else:
                     #print("hr......01....{} {} self.HR_Onestate {} {}".format(self.get_hr_state,self.get_spo2_state,self.HR_OneTime,self.HR_Onestate))
                     self.SENSOR_time = time_tmp#进入最后一次的时间戳
@@ -2201,6 +2209,7 @@ class getHrTimeManager(Abstract):
         self.set_time = 0
         self.set_hr = 0 #0关闭 1手动 2 自动测量按照时间间隔测试心率
         self.set_spo2 = 0
+        self.open_btn = 0
         self.get_temp = 0
         check = ql_fs.path_exists("/ext/static/storage_file/config.json")
         if check == True:
@@ -2210,6 +2219,9 @@ class getHrTimeManager(Abstract):
                     b = str("measure_time") in self.read_data.keys()
                     if b == True:
                         self.set_time = self.read_data["measure_time"]   
+                    btn = str("open_hr_btn") in self.read_data.keys()
+                    if btn == True:
+                        self.open_btn = self.read_data["measure_time"]   
 
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("set_time_hr_spo2", self.set_time_hr_spo2)
@@ -2221,11 +2233,12 @@ class getHrTimeManager(Abstract):
 
 
     def set_time_hr_spo2(self, event, msg): 
-        self.set_time = msg
+        self.open_btn = msg[0]
+        self.set_time = msg[1]
 
     def get_time_hr_spo2(self, event, msg): 
 
-        return self.set_time
+        return [self.open_btn,self.set_time]
 
     def set_hr_state(self, event, msg): 
         self.set_hr = msg
@@ -2558,6 +2571,39 @@ class getCountDownManager(Abstract):#倒计时
     def get_low_bat_btn(self, event, msg): 
         return self.low_btn
 
+class playPowerAudioManager(Abstract):#播放开关机音频文件
+    def __init__(self):
+        self.aud = audio.Audio(0)
+        self.aud.set_pa(Pin.GPIO29)
+        self.read_data = {}
+        self.volum_size = 8
+        check_volum = ql_fs.path_exists("/ext/static/storage_file/config.json")
+        if check_volum == True :
+            with open("/ext/static/storage_file/config.json","r") as fd:#音频文件编号
+                self.read_data = ujson.load(fd)
+                if self.read_data != {}:
+                    b = str("volum") in self.read_data.keys()
+                    if b == True:
+                        self.volum_size = self.read_data["volum"]  
+                    else:
+                        self.volum_size = 8
+                else:
+                    self.volum_size = 8
+        else:
+            self.volum_size = 8
+        self.aud.setVolume(self.volum_size)
+
+    def post_processor_after_instantiation(self):
+        
+        EventMesh.subscribe("play_poewr_on_event", self.play_poewr_on_event)#
+        EventMesh.subscribe("play_poewr_off_event", self.play_poewr_off_event)
+
+    def play_poewr_on_event(self, event, msg): 
+        self.aud.play(1, 1, 'E:/static/R_POWER_1.mp3')  #播放播放开机铃声
+
+    def play_poewr_off_event(self, event, msg): 
+        self.aud.setVolume(11)
+        self.aud.play(1, 1, 'E:/static/R_POWER_OFF_1.mp3')  #播放关机铃声
     
 class getBootOffManager(Abstract):#开关机时间
     def __init__(self):
index b6d7387..68f729b 100644 (file)
@@ -872,27 +872,35 @@ class HRSTART_ProtoCol(ProtoCol):
         msg_tmp = msg.decode('ascii')
         msg_tmp = msg_tmp.split(',')
         msg_tmp = msg_tmp[1]
-        # print("HRSTART_ProtoCol RECV msg:{} msg_:{}".format(msg,msg_tmp))
+        print("HRSTART_ProtoCol RECV msg:{} msg_:{}".format(msg,msg_tmp))
         hrTotal = int(msg_tmp)
-        if hrTotal == 1:#单次测量
-            get_hr_state = EventMesh.publish("get_hr_state")
-            get_spo2_state = EventMesh.publish("get_spo2_state")
-            if (get_spo2_state == 3) or (get_spo2_state == 0 and get_hr_state == 0):#只要两个不在测量 单次优先级最低
-                EventMesh.publish("set_hr_state",3)#3代表单次测量
+        if hrTotal == 0:#关闭自动测量
+            print("HRSTART_ 1")
+            EventMesh.publish("set_time_hr_spo2",[0,0])
         else:
-            if hrTotal > 0 and hrTotal <= 300:
-                hrTotal = 300
-            elif hrTotal >= 65536:
-                hrTotal = 65536
+            if hrTotal == 1:#单次测量
+                print("HRSTART_ 2".format(hrTotal))
+                get_hr_state = EventMesh.publish("get_hr_state")
+                get_spo2_state = EventMesh.publish("get_spo2_state")
+                # if (get_hr_state == 3 ) or (get_spo2_state == 0 and get_hr_state == 0):#只要两个不在测量 单次优先级最低
+                if (get_spo2_state == 0 and get_hr_state == 0):
+                    EventMesh.publish("set_hr_state",3)#3代表单次测量
+                pass
+            else:
+                if hrTotal > 0 and hrTotal <= 300:
+                    hrTotal = 300
+                elif hrTotal >= 65536:
+                    hrTotal = 65536
+                print("HRSTART_ 3".format(hrTotal))
+                storage_tmp = EventMesh.publish("get_storage_data")
+                storage_tmp["measure_time"] = hrTotal
+                storage_tmp["open_hr_btn"] = 1
+
+                EventMesh.publish("set_storage_data", storage_tmp)
+                EventMesh.publish("set_time_hr_spo2",[1,hrTotal])
+                with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+                    ujson.dump(storage_tmp,fd)
 
-            storage_tmp = EventMesh.publish("get_storage_data")
-            storage_tmp["measure_time"] = hrTotal
-            EventMesh.publish("set_storage_data", storage_tmp)
-            with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
-                ujson.dump(storage_tmp,fd)
-                
-            EventMesh.publish("set_time_hr_spo2",hrTotal)
-       
         EventMesh.publish(constants.PROTOCOL.HRTSTART_SEND)
 
 class HEART_ProtoCol(ProtoCol):
@@ -975,7 +983,8 @@ class OXYGEN_One_ProtoCol(ProtoCol):#单次测量
         get_hr_state = EventMesh.publish("get_hr_state")
         get_spo2_state = EventMesh.publish("get_spo2_state")
         if state == 1:
-            if (get_hr_state == 3 ) or (get_spo2_state == 0 and get_hr_state == 0):#只要两个不在测量 单次优先级最低
+            # if (get_hr_state == 3 ) or (get_spo2_state == 0 and get_hr_state == 0):#只要两个不在测量 单次优先级最低
+            if (get_spo2_state == 0 and get_hr_state == 0):
                 EventMesh.publish("set_spo2_state",3)#3代表单次测量
         EventMesh.publish(constants.PROTOCOL.OXSTART_SEND)
 
@@ -1343,7 +1352,7 @@ class ProtoColResolver(object):
     def handler(self, data):
         # 这里接收数据
         
-        #print("handler -> {}".format(data))
+        print("handler -> {}".format(data))
         # if data.startswith('Init;'):
         #     data = data[5:]
         #     EventMesh.publish(constants.EVENT.SET_KEY, {"value": ujson.loads(data)['KEY']})
index 1778216..76e4bc8 100644 (file)
@@ -794,7 +794,7 @@ class CallLogScreen(Screen):
                 sort_tmp = self.read_call_log.values()
                 sort_new = sorted(sort_tmp, key = lambda i: i['timesec'],reverse = True)#按照时间戳进行排序 去掉最旧的一次数据如果满了五十条
                 # print("self.call_log :{} \r\n sort_new:{}\r\n".format(self.read_call_log,sort_new))
- 
+                self.call_log_detail_list.clear_flag(lv.obj.FLAG.HIDDEN)#隐藏空文本
                 for sort_new_tmp in sort_new: #字典 key value
                     num_count = sort_new_tmp["count"]#获取通话次数
                     num_name = sort_new_tmp["name"]#获取名称
@@ -981,62 +981,7 @@ class DialingScreen(Screen):
     def post_processor_after_initialization(self):
        # print("创建通话记录 post_processor_before_initialization\n")
         utime.sleep_ms(200)#不加延时会切屏
-        #获取字符串
-        name = EventMesh.publish("get_phonename")#获取拨打电话名称
-        content = EventMesh.publish("get_phonenum")#获取电话号码
-        time = EventMesh.publish("screen_get_time")#获取系统时间
-
-        # ["15692025051","2","12:59","哥gdh符合双方和开发商开发好看的思考"],
-        # 格式:{"电话号码":{"timesec":'时间戳',"number":'电话号码',"name":'名字',"time":'时间',"count":'通话次数'}}
-        # dialing_content.set_text(content)#电话号码
-        num = 0
-   
-        date_tmp = utime.localtime()
-        time_tmp = utime.mktime(date_tmp)
-        # print("time_tmp:{}".format(time_tmp))
-        read_call_log = EventMesh.publish("get_call_log_list")
-        check_json = read_call_log[0]
-
-        if check_json == True:
-            self.read_call_log = read_call_log[1]
-            b = content in self.read_call_log.keys()#查找key中是否包含content电话号码 True 包含在里面 False不包含在里面
-            if b == True:#查找是否有相同的电话号码 有就直接读出来的次数上加一 没有则从1开始加起
-                number_tmp = {}
-                number_tmp = self.read_call_log[content] #通话次数加一
-                num_tmp_t = number_tmp["count"]
-                # print("number_tmp:{} self.read_call_log.value:{}".format(number_tmp,self.read_call_log.values()))
-            else :
-                num_tmp_t = 0
-            num = num_tmp_t 
-        else:
-            num = 0 #通话次数
-
-        sort_tmp = {}
-        sort_tmp = self.read_call_log.values()
-        sort_new = {}
-        sort_new = sorted(sort_tmp, key = lambda i: i['timesec'],reverse = True)#按照时间戳进行排序 去掉最旧的一次数据如果满了五十条
 
-        i = 0
-        # 49 50 
-        if len(self.read_call_log) >= self.CALL_LOG_MAX:
-            for sort_new_tmp in sort_new: #字典 key value
-                i+=1 # 1 
-                if i >= self.CALL_LOG_MAX:#大于50条把最后一条删除掉只保留前面50调最新的数据
-                    key_tmp = sort_new_tmp["number"]
-                    del self.read_call_log[key_tmp]
-        tmp = {}
-        tmp["count"]= num+1 #通话次数
-        tmp["time"]= "{}:{}".format("%02d"%(time[0][0]),"%02d"%(time[0][1]))#通湖时间
-        tmp["name"]= name #名称
-        tmp["timesec"]= time_tmp #时间戳
-        tmp["number"] = content
-
-        self.read_call_log[content] = tmp
-        with open("/ext/static/storage_file/Call_log.json","w",encoding="utf-8") as fd:
-            ujson.dump(self.read_call_log,fd)
-        print("创建通话记录")
-        EventMesh.publish("set_call_log_list", [1,self.read_call_log])
-        EventMesh.publish("call_log_update_show_list")
         
     def hangup(self,e):
         EventMesh.publish("set_UI_high_priority", 0)
@@ -1249,7 +1194,7 @@ class NoSimPowerScreen(Screen):#
 
             no_sim_power_screen_cancel = lv.img(no_sim_power_screen)
             no_sim_power_screen_cancel.set_size(176, 46)
-            no_sim_power_screen_cancel.set_pos(32, 250)
+            no_sim_power_screen_cancel.set_pos(32, 270)
             no_sim_power_screen_cancel.set_src("E:/static/cancel_icon.png")
             no_sim_power_screen_cancel.add_flag(lv.obj.FLAG.CLICKABLE)
             no_sim_power_screen_cancel.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
@@ -1305,7 +1250,12 @@ class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出
         self.timer1 = osTimer()
         self.time_count = 0
         self.timer2 = osTimer()
-       
+        self.call_log = {}
+        self.call_log_value = {}
+        self.read_call_log = {}
+        self.number_tmp = {}
+        self.CALL_LOG_MAX = CALL_LOG_MAX
+
     def initialization(self):
         EventMesh.publish("set_UI_high_priority", 1)
         global dialing_popup_screen,dialing_popup_img,dialing_popup_name ,dialing_popup_call,dialing_popup_hangup_imgbtn 
@@ -1349,6 +1299,62 @@ class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出
 
     def post_processor_after_initialization(self):
         self.time_count = 0
+        #获取字符串
+        name = EventMesh.publish("get_phonename")#获取拨打电话名称
+        content = EventMesh.publish("get_phonenum")#获取电话号码
+        time = EventMesh.publish("screen_get_time")#获取系统时间
+
+        # ["15692025051","2","12:59","哥gdh符合双方和开发商开发好看的思考"],
+        # 格式:{"电话号码":{"timesec":'时间戳',"number":'电话号码',"name":'名字',"time":'时间',"count":'通话次数'}}
+        # dialing_content.set_text(content)#电话号码
+        num = 0
+   
+        date_tmp = utime.localtime()
+        time_tmp = utime.mktime(date_tmp)
+        # print("time_tmp:{}".format(time_tmp))
+        read_call_log_tmp = EventMesh.publish("get_call_log_list")
+        check_json = read_call_log_tmp[0]
+
+        if check_json == True:
+            self.read_call_log = read_call_log_tmp[1]
+            b = content in self.read_call_log.keys()#查找key中是否包含content电话号码 True 包含在里面 False不包含在里面
+            if b == True:#查找是否有相同的电话号码 有就直接读出来的次数上加一 没有则从1开始加起
+                number_tmp = {}
+                number_tmp = self.read_call_log[content] #通话次数加一
+                num_tmp_t = number_tmp["count"]
+                # print("number_tmp:{} self.read_call_log.value:{}".format(number_tmp,self.read_call_log.values()))
+            else :
+                num_tmp_t = 0
+            num = num_tmp_t 
+        else:
+            num = 0 #通话次数
+
+        sort_tmp = {}
+        sort_tmp = self.read_call_log.values()
+        sort_new = {}
+        sort_new = sorted(sort_tmp, key = lambda i: i['timesec'],reverse = True)#按照时间戳进行排序 去掉最旧的一次数据如果满了五十条
+
+        i = 0
+        # 49 50 
+        if len(self.read_call_log) >= self.CALL_LOG_MAX:
+            for sort_new_tmp in sort_new: #字典 key value
+                i+=1 # 1 
+                if i >= self.CALL_LOG_MAX:#大于50条把最后一条删除掉只保留前面50调最新的数据
+                    key_tmp = sort_new_tmp["number"]
+                    del self.read_call_log[key_tmp]
+        tmp = {}
+        tmp["count"]= num+1 #通话次数
+        tmp["time"]= "{}:{}".format("%02d"%(time[0][0]),"%02d"%(time[0][1]))#通湖时间
+        tmp["name"]= name #名称
+        tmp["timesec"]= time_tmp #时间戳
+        tmp["number"] = content
+
+        self.read_call_log[content] = tmp
+        with open("/ext/static/storage_file/Call_log.json","w",encoding="utf-8") as fd:
+            ujson.dump(self.read_call_log,fd)
+        print("创建通话记录")
+        EventMesh.publish("set_call_log_list", [1,self.read_call_log])
+        EventMesh.publish("call_log_update_show_list")
         self.timer1.start(1000, 1, self.timeout_hangup)
         self.timer2.start(2000, 0, self.timeout_call)
 
@@ -2038,97 +2044,53 @@ class HeartrateScreen(Screen):
         if read_data != None:
             count = len(read_data)
             if count != 0:
-                if count >= 7:
-                    for i in  range(count):
-                        key = i+1
-                        value = read_data["0{}".format(key)]
-                        if value < 30:
-                            value = 30
-                        if value >= 210:
-                            value = 210
-                        line_value = value - 30 #180-80 = 100 160-100 = 60
-                        line_value = int(line_value*0.58)+1
-                        if line_value >= 100:
-                            line_value = 100
-                        #print("hr hist",line_value)
-                        hr_line_points = [{"x":0,"y":0},{"x":0,"y":line_value}]
-                        if i == 0:
-                            hr_line1.set_points(hr_line_points,2)
-                            hr_line1.set_pos(25,160-line_value)
-                            hr_line1.set_size(10,line_value)
-                        if i == 1:
-                            hr_line2.set_points(hr_line_points,2)
-                            hr_line2.set_pos(53,160-line_value)
-                            hr_line2.set_size(10,line_value)
-
-                        if i == 2:
-                            hr_line3.set_points(hr_line_points,2)
-                            hr_line3.set_pos(80,160-line_value)
-                            hr_line3.set_size(10,line_value)
-
-                        if i == 3:
-                            hr_line4.set_points(hr_line_points,2)
-                            hr_line4.set_pos(109,160-line_value)
-                            hr_line4.set_size(10,line_value)
-
-                        if i == 4:
-                            hr_line5.set_points(hr_line_points,2)
-                            hr_line5.set_pos(136,160-line_value)
-                            hr_line5.set_size(10,line_value)
-
-                        if i == 5:
-                            hr_line6.set_points(hr_line_points,2)
-                            hr_line6.set_pos(164,160-line_value)
-                            hr_line6.set_size(10,line_value)
-
-                        if i == 6:
-                            hr_line7.set_points(hr_line_points,2)
-                            hr_line7.set_pos(192,160-line_value)
-                            hr_line7.set_size(10,line_value)
-                else:
-                    value = read_data["0{}".format(count)]
+                for i in  range(count):
+                    key = i+1
+                    value = read_data["0{}".format(key)]
                     if value < 30:
                         value = 30
-                    if value >= 180:
-                        value = 180
+                    if value >= 210:
+                        value = 210
                     line_value = value - 30 #180-80 = 100 160-100 = 60
                     line_value = int(line_value*0.58)+1
-                   #
+                    if line_value >= 100:
+                        line_value = 100
+                    #print("hr hist",line_value)
                     hr_line_points = [{"x":0,"y":0},{"x":0,"y":line_value}]
-                    if count == 1:
+                    if i == 0:
                         hr_line1.set_points(hr_line_points,2)
                         hr_line1.set_pos(25,160-line_value)
                         hr_line1.set_size(10,line_value)
-                    if count == 2:
+                    if i == 1:
                         hr_line2.set_points(hr_line_points,2)
                         hr_line2.set_pos(53,160-line_value)
                         hr_line2.set_size(10,line_value)
 
-                    if count == 3:
+                    if i == 2:
                         hr_line3.set_points(hr_line_points,2)
                         hr_line3.set_pos(80,160-line_value)
                         hr_line3.set_size(10,line_value)
 
-                    if count == 4:
+                    if i == 3:
                         hr_line4.set_points(hr_line_points,2)
                         hr_line4.set_pos(109,160-line_value)
                         hr_line4.set_size(10,line_value)
 
-                    if count == 5:
+                    if i == 4:
                         hr_line5.set_points(hr_line_points,2)
                         hr_line5.set_pos(136,160-line_value)
                         hr_line5.set_size(10,line_value)
 
-                    if count == 6:
+                    if i == 5:
                         hr_line6.set_points(hr_line_points,2)
                         hr_line6.set_pos(164,160-line_value)
                         hr_line6.set_size(10,line_value)
 
-                    if count == 7:
+                    if i == 6:
                         hr_line7.set_points(hr_line_points,2)
                         hr_line7.set_pos(192,160-line_value)
-                        hr_line7.set_size(10,line_value)      
-
+                        hr_line7.set_size(10,line_value)
+            
 
     def start_measure(self,*args):
         global heartrate_screen,heartrate_label,heartrate_done_img ,heartrate_reset_btn_img,heartrate_start_label,heartrate_bpm_label ,heartrate_done_label
@@ -3723,90 +3685,8 @@ class TemperatureScreen(Screen):
         if read_data != None:
             count = len(read_data)
             if count != 0:
-                if count >= 7:
-                    for i in  range(count):
-                        value = read_data["0{}".format(i+1)]
-                        value_temp = int(value)
-                        if value <= 30:
-                            line_value = int(value_temp)
-                        elif value <= 34:
-                            line_value = int((value_temp-30)*4.25)+30
-                        elif value <= 38:
-                            line_value = int((value_temp-34)*5)+47
-                        elif value <= 42:
-                            line_value = int((value_temp-38)*4)+67
-                        elif value < 46:
-                            line_value = int((value_temp-42)*3.75)+85
-                        else:
-                            value = 46
-                            line_value = 100
-                        
-
-                        if line_value >= 100:
-                            line_value = 100
-                        #print("hr hist",line_value)
-                        temp_line_points = [{"x":0,"y":0},{"x":0,"y":line_value}]
-                        if i == 0:
-                            temp_line1.set_points(temp_line_points,2)
-                            temp_line1.set_pos(29,150-line_value)
-                            temp_line1.set_size(10,line_value)
-                            if value >= 37.3:
-                                temp_line1.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
-                            else:
-                                temp_line1.set_style_line_color(lv.color_make(35,141,255),0)
-                        if i == 1:
-                            temp_line2.set_points(temp_line_points,2)
-                            temp_line2.set_pos(57,150-line_value)
-                            temp_line2.set_size(10,line_value)
-                            if value >= 37.3:
-                                temp_line2.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
-                            else:
-                                temp_line2.set_style_line_color(lv.color_make(35,141,255),0)
-
-                        if i == 2:
-                            temp_line3.set_points(temp_line_points,2)
-                            temp_line3.set_pos(84,150-line_value)
-                            temp_line3.set_size(10,line_value)
-                            if value >= 37.3:
-                                temp_line3.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
-                            else:
-                                temp_line3.set_style_line_color(lv.color_make(35,141,255),0)
-                        if i == 3:
-                            temp_line4.set_points(temp_line_points,2)
-                            temp_line4.set_pos(112,150-line_value)
-                            temp_line4.set_size(10,line_value)
-                            if value >= 37.3:
-                                temp_line4.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
-                            else:
-                                temp_line4.set_style_line_color(lv.color_make(35,141,255),0)
-                        if i == 4:
-                            temp_line5.set_points(temp_line_points,2)
-                            temp_line5.set_pos(140,150-line_value)
-                            temp_line5.set_size(10,line_value)
-                            if value >= 37.3:
-                                temp_line5.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
-                            else:
-                                temp_line5.set_style_line_color(lv.color_make(35,141,255),0)
-
-                        if i == 5:
-                            temp_line6.set_points(temp_line_points,2)
-                            temp_line6.set_pos(167,150-line_value)
-                            temp_line6.set_size(10,line_value)
-                            if value >= 37.3:
-                                temp_line6.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
-                            else:
-                                temp_line6.set_style_line_color(lv.color_make(35,141,255),0)
-
-                        if i == 6:
-                            temp_line7.set_points(temp_line_points,2)
-                            temp_line7.set_pos(195,150-line_value)
-                            temp_line7.set_size(10,line_value)
-                            if value >= 37.3:
-                                temp_line7.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
-                            else:
-                                temp_line7.set_style_line_color(lv.color_make(35,141,255),0)
-                else:
-                    value = read_data["0{}".format(count)]
+                for i in  range(count):
+                    value = read_data["0{}".format(i+1)]
                     value_temp = int(value)
                     if value <= 30:
                         line_value = int(value_temp)
@@ -3825,9 +3705,9 @@ class TemperatureScreen(Screen):
 
                     if line_value >= 100:
                         line_value = 100
-                   #
+                    #print("hr hist",line_value)
                     temp_line_points = [{"x":0,"y":0},{"x":0,"y":line_value}]
-                    if count == 1:
+                    if i == 0:
                         temp_line1.set_points(temp_line_points,2)
                         temp_line1.set_pos(29,150-line_value)
                         temp_line1.set_size(10,line_value)
@@ -3835,8 +3715,7 @@ class TemperatureScreen(Screen):
                             temp_line1.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
                         else:
                             temp_line1.set_style_line_color(lv.color_make(35,141,255),0)
-                    
-                    if count == 2:
+                    if i == 1:
                         temp_line2.set_points(temp_line_points,2)
                         temp_line2.set_pos(57,150-line_value)
                         temp_line2.set_size(10,line_value)
@@ -3845,7 +3724,7 @@ class TemperatureScreen(Screen):
                         else:
                             temp_line2.set_style_line_color(lv.color_make(35,141,255),0)
 
-                    if count == 3:
+                    if i == 2:
                         temp_line3.set_points(temp_line_points,2)
                         temp_line3.set_pos(84,150-line_value)
                         temp_line3.set_size(10,line_value)
@@ -3853,9 +3732,7 @@ class TemperatureScreen(Screen):
                             temp_line3.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
                         else:
                             temp_line3.set_style_line_color(lv.color_make(35,141,255),0)
-
-
-                    if count == 4:
+                    if i == 3:
                         temp_line4.set_points(temp_line_points,2)
                         temp_line4.set_pos(112,150-line_value)
                         temp_line4.set_size(10,line_value)
@@ -3863,8 +3740,7 @@ class TemperatureScreen(Screen):
                             temp_line4.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
                         else:
                             temp_line4.set_style_line_color(lv.color_make(35,141,255),0)
-
-                    if count == 5:
+                    if i == 4:
                         temp_line5.set_points(temp_line_points,2)
                         temp_line5.set_pos(140,150-line_value)
                         temp_line5.set_size(10,line_value)
@@ -3873,7 +3749,7 @@ class TemperatureScreen(Screen):
                         else:
                             temp_line5.set_style_line_color(lv.color_make(35,141,255),0)
 
-                    if count == 6:
+                    if i == 5:
                         temp_line6.set_points(temp_line_points,2)
                         temp_line6.set_pos(167,150-line_value)
                         temp_line6.set_size(10,line_value)
@@ -3882,15 +3758,15 @@ class TemperatureScreen(Screen):
                         else:
                             temp_line6.set_style_line_color(lv.color_make(35,141,255),0)
 
-                    if count == 7:
+                    if i == 6:
                         temp_line7.set_points(temp_line_points,2)
                         temp_line7.set_pos(195,150-line_value)
-                        temp_line7.set_size(10,line_value)      
+                        temp_line7.set_size(10,line_value)
                         if value >= 37.3:
                             temp_line7.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
                         else:
                             temp_line7.set_style_line_color(lv.color_make(35,141,255),0)
-
+            
     def start_measure(self,*args):
         global temperature_label,temperature_keep_label,temperature_done_img ,temp_reset_btn_img,temperature_start_label,temperature_bpm_label ,temperature_done_label
         self.point = self.point + 1
@@ -4271,71 +4147,12 @@ class Spo2Screen(Screen):
         if read_data != None:
             count = len(read_data)
             if count != 0:
-                if count >= 7:
-                    for i in  range(count):
-                        value = read_data["0{}".format(i+1)]
-                        if value < 80:
-                            value = 80
-                        if value >= 100:
-                            value = 100
-                        if value <= 85:
-                            value = value - 80
-                            line_value = int(value*6)
-                        elif value <= 90:
-                            value = value-85
-                            line_value = int((17/5)*value)+30
-                        elif value <= 95:
-                            value = value-90
-                            line_value = int((21/5)*value)+47
-                        elif value <= 100:
-                            value = value-95
-                            line_value = int((16/5)*value)+68
-                        
-                       
-                        if line_value >= 100:
-                            line_value = 100
-                        #print("hr hist",line_value)
-                        hr_line_points = [{"x":0,"y":0},{"x":0,"y":line_value}]
-                        if i == 0:
-                            spo2_line1.set_points(hr_line_points,2)
-                            spo2_line1.set_pos(25,160-line_value)
-                            spo2_line1.set_size(10,line_value)
-                        if i == 1:
-                            spo2_line2.set_points(hr_line_points,2)
-                            spo2_line2.set_pos(53,160-line_value)
-                            spo2_line2.set_size(10,line_value)
-
-                        if i == 2:
-                            spo2_line3.set_points(hr_line_points,2)
-                            spo2_line3.set_pos(80,160-line_value)
-                            spo2_line3.set_size(10,line_value)
-
-                        if i == 3:
-                            spo2_line4.set_points(hr_line_points,2)
-                            spo2_line4.set_pos(109,160-line_value)
-                            spo2_line4.set_size(10,line_value)
-
-                        if i == 4:
-                            spo2_line5.set_points(hr_line_points,2)
-                            spo2_line5.set_pos(136,160-line_value)
-                            spo2_line5.set_size(10,line_value)
-
-                        if i == 5:
-                            spo2_line6.set_points(hr_line_points,2)
-                            spo2_line6.set_pos(164,160-line_value)
-                            spo2_line6.set_size(10,line_value)
-
-                        if i == 6:
-                            spo2_line7.set_points(hr_line_points,2)
-                            spo2_line7.set_pos(192,160-line_value)
-                            spo2_line7.set_size(10,line_value)
-                else:
-                    value = read_data["0{}".format(count)]
+                for i in  range(count):
+                    value = read_data["0{}".format(i+1)]
                     if value < 80:
-                            value = 80
+                        value = 80
                     if value >= 100:
                         value = 100
-
                     if value <= 85:
                         value = value - 80
                         line_value = int(value*6)
@@ -4352,43 +4169,42 @@ class Spo2Screen(Screen):
                     
                     if line_value >= 100:
                         line_value = 100
-                   #
+                    #print("hr hist",line_value)
                     hr_line_points = [{"x":0,"y":0},{"x":0,"y":line_value}]
-                    if count == 1:
+                    if i == 0:
                         spo2_line1.set_points(hr_line_points,2)
                         spo2_line1.set_pos(25,160-line_value)
                         spo2_line1.set_size(10,line_value)
-                    if count == 2:
+                    if i == 1:
                         spo2_line2.set_points(hr_line_points,2)
                         spo2_line2.set_pos(53,160-line_value)
                         spo2_line2.set_size(10,line_value)
 
-                    if count == 3:
+                    if i == 2:
                         spo2_line3.set_points(hr_line_points,2)
                         spo2_line3.set_pos(80,160-line_value)
                         spo2_line3.set_size(10,line_value)
 
-                    if count == 4:
+                    if i == 3:
                         spo2_line4.set_points(hr_line_points,2)
                         spo2_line4.set_pos(109,160-line_value)
                         spo2_line4.set_size(10,line_value)
 
-                    if count == 5:
+                    if i == 4:
                         spo2_line5.set_points(hr_line_points,2)
                         spo2_line5.set_pos(136,160-line_value)
                         spo2_line5.set_size(10,line_value)
 
-                    if count == 6:
+                    if i == 5:
                         spo2_line6.set_points(hr_line_points,2)
                         spo2_line6.set_pos(164,160-line_value)
                         spo2_line6.set_size(10,line_value)
 
-                    if count == 7:
+                    if i == 6:
                         spo2_line7.set_points(hr_line_points,2)
                         spo2_line7.set_pos(192,160-line_value)
-                        spo2_line7.set_size(10,line_value)      
-
-
+                        spo2_line7.set_size(10,line_value)
+               
     def start_measure(self,*args):
         global spo2_screen,spo2_label,spo2_start_label,spo2_value_label,spo2_done_img ,spo2_reset_btn_img 
         self.point = self.point + 1
@@ -4660,6 +4476,7 @@ class CountdownScreen(Screen):
         self.total = 0
         self.time_tmp = 0
         self.timer_cb = 0
+        EventMesh.subscribe("close_count_show_info", self.close_count_show_info)
 
     def initialization(self):
         global countdown_screen ,countdown_title,countdown_hour ,countdown_mao ,countdown_mao ,countdown_mao1 ,\
@@ -5040,6 +4857,8 @@ class CountdownScreen(Screen):
             msg_tmp = EventMesh.publish("get_countdown_off_state")
             self.g_state = msg_tmp[1]
             EventMesh.publish("set_countdown_off_state", [0,self.g_state]) 
+    def close_count_show_info(self, event, msg):
+        self.reset(0)
 
     def reset(self,e):
         global countdown_screen ,countdown_title,countdown_hour ,countdown_mao ,countdown_mao ,countdown_mao1 ,\
@@ -5068,6 +4887,8 @@ class CountdownScreen(Screen):
         countdown_sec_up.clear_flag(lv.obj.FLAG.HIDDEN)
         countdown_sec_down.clear_flag(lv.obj.FLAG.HIDDEN)
         self.show_value()
+    
+
         
 
     def show_value(self):
@@ -5125,6 +4946,10 @@ class CountdownScreen(Screen):
         else:
             EventMesh.publish("set_countdown_off_state", [0,self.g_state])
 
+    def stop_count_down(self,*argc,a):
+        if self.g_state == 0:
+            self.timer.stop()
+
     def done_return(self):
         if self.g_state == 0:
             self.timer.stop()
@@ -5192,11 +5017,12 @@ class CountdownEndScreen(Screen):
         self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3') 
     
     def stop_FIND(self) :
+        EventMesh.publish("close_count_show_info")
         self.FIND_timer.stop()
         self.aud.stopAll()
 
     def Close(self):
-       self.stop_FIND()
+        self.stop_FIND()
 
     def done_left_to_right(self):
         self.stop_FIND()
@@ -5219,6 +5045,7 @@ class CountdownEndScreen(Screen):
         EventMesh.publish("load_screen", {"screen": "countdown"})
 
     def done_click(self):
+        print("count down !!!!!!!!!!")
         self.stop_FIND()
         EventMesh.publish("load_screen", {"screen": "countdown"})
 
index 5f1edb5..c3f74f8 100644 (file)
@@ -858,7 +858,11 @@ class RestoreScreen(Screen):
             ql_fs.rmdirs("/ext/static/storage_file")
             ql_fs.mkdirs("/ext/static/storage_file")
         EventMesh.publish("alipay_unbind")
-        EventMesh.publish(constants.PROTOCOL.DLT_SEND)
+        if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#已连接服务器发指令恢复出厂
+            EventMesh.publish(constants.PROTOCOL.DLT_SEND)
+        else:
+            Power.powerRestart()
+        
 
     def concel(self, e):
         EventMesh.publish("load_screen", {"screen": "setting"})
@@ -950,7 +954,7 @@ poweroff_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 poweroff_confirm_img = lv.img(poweroff_screen)
 poweroff_confirm_img.set_size(176, 46)
-poweroff_confirm_img.set_pos(32, 150)
+poweroff_confirm_img.set_pos(32, 160)
 poweroff_confirm_img.set_src("E:/static/off_icon.png")
 poweroff_confirm_img.add_flag(lv.obj.FLAG.CLICKABLE)
 poweroff_confirm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
@@ -962,7 +966,7 @@ poweroff_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.
 
 poweroff_return = lv.img(poweroff_screen)
 poweroff_return.set_size(176, 46)
-poweroff_return.set_pos(32, 210)
+poweroff_return.set_pos(32, 240)
 poweroff_return.set_src("E:/static/cancel_icon.png")
 poweroff_return.add_flag(lv.obj.FLAG.CLICKABLE)
 poweroff_return.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
@@ -973,6 +977,10 @@ poweroff_return_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.D
 poweroff_return.set_ext_click_area(20)
 
 
+
+
+
+
 class PoweroffScreen(Screen):
     NAME = "poweroff"
 
@@ -990,6 +998,7 @@ class PoweroffScreen(Screen):
         
     def confirm(self, e):
         EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"})
+        #EventMesh.publish("load_screen", {"screen": "no_sim_power_screen"})
         
 
     def concel(self, e):
@@ -1002,7 +1011,75 @@ class PoweroffScreen(Screen):
         EventMesh.publish("watch_top_show")
         EventMesh.publish("load_screen", {"screen": "main_menu"})
 
+poweron_screen = lv.obj()
+print("poweron_screen")
+poweron_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
 
+poweron_label = lv.label(poweron_screen)
+poweron_label.set_text("WELLCOM")
+poweron_label.align(lv.ALIGN.CENTER, 0, 0)
+poweron_label.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
+class PowerOnScreen(Screen):
+    NAME = "poweron"
+
+    def __init__(self):
+        super().__init__()
+        self.meta = poweron_screen
+        self.timer = osTimer()
+        self.aud = audio.Audio(0)
+        self.aud.set_pa(Pin.GPIO29)
+        self.read_data = {}
+        self.volum_size = 8
+        check_volum = ql_fs.path_exists("/ext/static/storage_file/config.json")
+        if check_volum == True :
+            with open("/ext/static/storage_file/config.json","r") as fd:#音频文件编号
+                self.read_data = ujson.load(fd)
+                if self.read_data != {}:
+                    b = str("volum") in self.read_data.keys()
+                    if b == True:
+                        self.volum_size = self.read_data["volum"]  
+                    else:
+                        self.volum_size = 8
+                else:
+                    self.volum_size = 8
+        else:
+            self.volum_size = 8
+        self.aud.setVolume(self.volum_size)
+        self.count = 0
+
+    def initialization(self):
+        self.count = 0
+        self.aud.setVolume(11)
+        self.timer.start(1000,1,self.fun)
+        pass
+
+    def fun(self,*argc):
+        EventMesh.publish("system_sleep_rest")#防止黑屏
+        if self.count == 0:
+            self.aud.play(1, 1, 'E:/static/R_POWER_1.mp3')  #播放来电铃声
+        else:
+            play_state = EventMesh.publish("get_audio_state")#音频播放状态
+            if play_state != None:
+                if play_state == 0 or self.count >= 5:#在上一个界面在播放音频时切换界面则关闭 以免一直播放
+                    self.count = 0
+                    EventMesh.publish("load_screen", {"screen": "main_menu"})
+                    self.timer.stop()
+                    
+                    return
+        self.count+=1
+
+    def Close(self):
+        self.timer.stop()
+        self.aud.setVolume(self.volum_size)
+        pass
+    def done_return(self):
+        pass
+
+    def btn1_release(self):
+        pass
+        
+    def btn8_press(self):
+        pass
 
 poweroff_confirm_screen = lv.obj()
 print("poweroff_confirm_screen")
@@ -1032,11 +1109,18 @@ class PoweroffConfirmScreen(Screen):
         #print("self.read_data:{}".format(self.read_data))
         with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
             ujson.dump(self.read_data,fd)
-        self.timer.start(3*1000,0,self.power_off)
+        EventMesh.publish("play_poewr_off_event")#
+        self.count = 0
+        self.timer.start(1*1000,1,self.power_off)
 
     def power_off(self,*args):
-
-        Power.powerDown()
+        self.count+=1
+        play_state = EventMesh.publish("get_audio_state")#音频播放状态
+        if play_state != None:
+            if play_state == 0 or self.count > 5:#在上一个界面在播放音频时切换界面则关闭 以免一直播放
+                self.count = 0
+                self.timer.stop()
+                Power.powerDown()
     
     def done_return(self):
         pass