D10:
authordxy15521469561 <1731678236@qq.com>
Mon, 11 Dec 2023 03:29:53 +0000 (11:29 +0800)
committerdxy15521469561 <1731678236@qq.com>
Mon, 11 Dec 2023 03:29:53 +0000 (11:29 +0800)
bug优化

2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py
2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/led.py
2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py

index bafb013..6d1df0a 100644 (file)
@@ -203,7 +203,9 @@ class intervManager(Abstract):
 
         EventMesh.subscribe("sos_short_press", self.sos_short_press)#sos短按事件
 
-        EventMesh.subscribe("falldown_alarm_event", self.falldown_alarm_event)#休息结束了
+        EventMesh.subscribe("falldown_alarm_event", self.falldown_alarm_event)#跌倒报警
+
+        EventMesh.subscribe("close_falldown_alarm_event", self.close_falldown_alarm_event)#关闭跌倒报警
 
         EventMesh.subscribe("drink_alarm_event", self.drink_alarm_event)#该喝水了
 
@@ -459,6 +461,22 @@ class intervManager(Abstract):
         else:
             self.time_count = 0
             self.fall_timer1.stop()
+    
+    def close_falldown_alarm_event(self,event,msg):#跌倒挂断挂断
+        if self.fall_flag == 1:#跌倒标志
+            self.fall_flag = 0
+            self.fall_timer1.stop()
+            self.sos_timer1.stop()
+            self.sos_timer2.stop()
+            if self.call_state != 0:
+                self.call_state = 0
+                voiceCall.callEnd()
+            sos_flag = EventMesh.publish("get_sos_flag")
+            if sos_flag == 1:
+                self.call_state = 0
+                EventMesh.publish("set_sos_flag",0)
+                EventMesh.publish("set_sos_num",0)
+                EventMesh.publish("set_hangup_mode",0)
 
     
 
@@ -558,21 +576,6 @@ class intervManager(Abstract):
         return self.fall_flag
 
     def sos_short_press(self,args,msg):
-        self.fall_timer1.stop()
-        if self.fall_flag == 1:#跌倒标志
-            self.fall_flag = 0
-            self.sos_timer1.stop()
-            self.sos_timer2.stop()
-            if self.call_state != 0:
-                self.call_state = 0
-                voiceCall.callEnd()
-            sos_flag = EventMesh.publish("get_sos_flag")
-            if sos_flag == 1:
-                self.call_state = 0
-                EventMesh.publish("set_sos_flag",0)
-                EventMesh.publish("set_sos_num",0)
-                EventMesh.publish("set_hangup_mode",0)
-        
         EventMesh.publish("interup_call_event")#如果在电话中强制挂断电话
         EventMesh.publish("close_audio_play")#强制关闭音频文件播放
         EventMesh.publish("STOP_FIND_WATCH")#停止查找设备
@@ -661,8 +664,8 @@ class intervManager(Abstract):
         self.timer.stop()
         self.sos_timer2.stop()
         self.sos_timer1.stop()
-        self.fall_timer1.stop()
         self.fall_flag = 0
+        self.fall_timer1.stop()
         self.alarm_timer1.stop()
        
 
@@ -680,7 +683,7 @@ class intervManager(Abstract):
     def set_call_state(self, event, msg): #
         self.call_state = msg
 
-    def dialin_call_event(self, event, msg):#电话打进来
+    def dialin_call_event(self, event, msg):
         open_power = EventMesh.publish("get_power_on_state")#获取开机标识
         if open_power != None:
             if open_power == 0:
@@ -794,8 +797,9 @@ class intervManager(Abstract):
 
     def play_cur_step_event(self, event, msg): #msg 1 播放当前步数
         flag = EventMesh.publish("get_call_state") 
-        if flag == 0 and self.fall_flag == 0:#电话通话中 或者呼叫中挂断中断
-            EventMesh.publish("close_timer_all")#
+        if flag == 0:#电话通话中 或者呼叫中挂断中断
+            if self.fall_flag == 0:
+                EventMesh.publish("close_timer_all")#
             step = EventMesh.publish("get_old_step_value")
             EventMesh.debug_log("step",step)
             self.setp_old = step
@@ -1051,22 +1055,26 @@ class intervManager(Abstract):
                 if get_hr_state == 2 or get_hr_state == 3:
                     
                     EventMesh.publish("set_hr_state",0)#2代表后台进入测试,定时测心率 1ui界面测试洗心率 
-                    EventMesh.publish("stop_led_timer")#设置参数
+                    if get_hr_state == 3:
+                        EventMesh.publish("stop_led_timer")#设置参数
                     EventMesh.debug_log("stop debug8")
                     EventMesh.publish(constants.EVENT.STOP_HEART) 
                 elif get_spo2_state == 2 or get_spo2_state == 3:
                     EventMesh.publish("set_spo2_state",0)#2代表后台进入测试
-                    EventMesh.publish("stop_led_timer")#设置参数
+                    if get_spo2_state == 3:
+                        EventMesh.publish("stop_led_timer")#设置参数
                     EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
                     EventMesh.debug_log("stop debug13")
                 elif get_bp_state == 2 or get_bp_state == 3:
                     EventMesh.publish("set_bp_state",0)#2代表后台进入测试
-                    EventMesh.publish("stop_led_timer")#设置参数
+                    if get_bp_state == 3:
+                        EventMesh.publish("stop_led_timer")#设置参数
                     EventMesh.publish(constants.EVENT.STOP_HEART)
                     EventMesh.debug_log("stop bp debug1")
                 elif get_bg_state == 2 or get_bg_state == 3:
                     EventMesh.publish("set_bg_state",0)#2代表后台进入测试
-                    EventMesh.publish("stop_led_timer")#设置参数
+                    if get_bg_state == 3:
+                        EventMesh.publish("stop_led_timer")#设置参数
                     EventMesh.publish(constants.EVENT.STOP_HEART)
                     EventMesh.debug_log("stop BG  debug14")
         if msg == 1:
@@ -1231,24 +1239,24 @@ class intervManager(Abstract):
         get_bg_state = EventMesh.publish("get_bg_state")
         get_bp_state = EventMesh.publish("get_bp_state")
         if get_hr_state != None and get_spo2_state != None and get_temp_state != None and get_bg_state != None and get_bp_state != None:
-            if get_hr_state != 0:
+            if get_hr_state == 1 or get_hr_state == 3:
                 EventMesh.publish("set_hr_state",0)#2代表后台进入测试,定时测心率 1ui界面测试洗心率 
                 EventMesh.debug_log("sstop hr")
                 EventMesh.publish(constants.EVENT.STOP_HEART) 
-            elif get_spo2_state != 0:
+            if get_spo2_state == 1 or get_spo2_state == 3:
                 EventMesh.debug_log("stop spo2")
                 EventMesh.publish("set_spo2_state",0)#2代表后台进入测试
                 EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
-            if get_temp_state != 0:
+            if get_temp_state == 1 or get_temp_state == 3:
                 EventMesh.debug_log("stop temp")
                 EventMesh.publish("set_temp_state",0)
                 EventMesh.publish(constants.EVENT.STOP_TEMP)#手动体温测试
-            if  get_bg_state != 0:
+            if  get_bg_state == 1 or get_bg_state == 3:
                 EventMesh.publish("set_bg_state",0)#2代表后台进入测试,定时测心率 1ui界面测试洗心率 
                 EventMesh.debug_log("sstop bg")
                 EventMesh.publish(constants.EVENT.STOP_HEART) 
 
-            if  get_bp_state != 0:
+            if  get_bp_state  == 1 or get_bp_state  == 3:
                 EventMesh.publish("set_bp_state",0)#2代表后台进入测试,定时测心率 1ui界面测试洗心率 
                 EventMesh.debug_log("sstop bp")
                 EventMesh.publish(constants.EVENT.STOP_HEART) 
@@ -2223,6 +2231,7 @@ class BtnDevice(Abstract):
         # EventMesh.debug_log('### key22_extint_cb  {} self.GPIO22_status:{}'.format(args,self.sosKey_status)) # args[0]:gpio号 args[1]:上升沿或下降沿
         if self.WeChatKey_status != 0 and self.GPIO26_status != 0:
             if self.sosKey_status == 0:#按下
+                EventMesh.publish("close_falldown_alarm_event")#sos短按事件
                 if self.sosKey_press == 0 :
                     self.led_state = 0
                     # self.wechatKey_timeout_cb(0)
@@ -2270,7 +2279,6 @@ class BtnDevice(Abstract):
     def sosKey_timeout_cb(self, data):#
         # EventMesh.debug_log("sosKey_press_count!!!!!!!!!!!!!! ",self.sosKey_press_count)
         
-        fall_down = EventMesh.publish("get_fall_down_state")#跌倒报警标识
         if self.sosKey_press_count == 10:#
             self.sosKey_press_count = 0
             pass
@@ -2291,9 +2299,8 @@ class BtnDevice(Abstract):
             pass
         elif self.sosKey_press_count == 4:#拨打app快捷号码
             self.sosKey_press_count = 0
-            if fall_down == 0:
-                EventMesh.publish("stop_led_timer")#设置参数
-                EventMesh.publish("play_center_phone")#拨打快捷号码
+            EventMesh.publish("stop_led_timer")#设置参数
+            EventMesh.publish("play_center_phone")#拨打快捷号码
             # EventMesh.publish("call_phonebook_three_call")
             pass
         elif self.sosKey_press_count == 3:#测试心率
@@ -2311,15 +2318,15 @@ class BtnDevice(Abstract):
             pass
         elif self.sosKey_press_count == 2:#播报当前步数
             self.sosKey_press_count = 0
-            if fall_down == 0:
-                EventMesh.publish("stop_led_timer")#设置参数
-                EventMesh.publish("play_cur_step_event")#
+            EventMesh.publish("stop_led_timer")#设置参数
+            EventMesh.publish("play_cur_step_event")#
             pass
         elif self.sosKey_press_count == 1:#挂断来电 短语音播报
             self.sosKey_press_count = 0
             EventMesh.publish("stop_led_timer")#设置参数
             # EventMesh.publish("call_test_event")
             EventMesh.publish("sos_short_press")#sos短按事件
+            
             pass
         self.sosKey_press_count = 0
 
index 0f835bd..1ccaf0f 100644 (file)
@@ -285,10 +285,11 @@ class ledEventManager(Abstract):#灯事件
                                     return
                                 else:
                                     return
-                                    
                             else:
                                 self.wechat_btn = 0
-                                if get_hr_state != 0 or get_spo2_state != 0 or temp_state != 0 or bp_state != 0 or bg_state != 0 :#心率血氧优先级高
+                                # if get_hr_state != 0 or get_spo2_state != 0 or temp_state != 0 or bp_state != 0 or bg_state != 0 :#心率血氧优先级高
+                                if get_hr_state == 1 or get_hr_state == 3 or get_spo2_state == 1 or get_spo2_state == 3 or temp_state == 1 or temp_state == 3 \
+                                or bp_state == 1 or bp_state == 3 or bg_state == 1 or bg_state == 3:
                                     if self.working_led_mode != led_mode.HEALTH_LED_MODE:#如果不在亮微聊模式需要亮微聊模式
                                         # EventMesh.debug_log("set_hr_blood_led!!!!!!!!!!")
                                         str_buf = [1,2,10*70*2,led_mode.FLASH_LIGHT_RED_GREEN,10,5,led_mode.HEALTH_LED_MODE]#測量成功
@@ -300,7 +301,8 @@ class ledEventManager(Abstract):#灯事件
                                     else:
                                         # EventMesh.debug_log("set_hr_blood_led stop!!!!!!!!!!")
                                         return
-                                if  get_hr_state == 0 and get_spo2_state == 0 and temp_state == 0 and bp_state == 0 and bg_state == 0:
+                                if  get_hr_state == 0 and get_spo2_state == 0 and temp_state == 0 and bp_state == 0 and bg_state == 0\
+                                    and get_hr_state == 2 and get_spo2_state == 2 and temp_state == 2 and bp_state == 2 and bg_state == 2:
                                     self.working_led_mode = led_mode.OTHER_MEASURE_MODE
                         
         self.open_timer(msg)
@@ -322,10 +324,11 @@ class ledEventManager(Abstract):#灯事件
                     get_spo2_state = EventMesh.publish("get_spo2_state")
                     get_temp_state = EventMesh.publish("get_temp_state")
                     if get_hr_state != None or get_spo2_state != None or get_temp_state != None:
-                        if get_hr_state == 1 or get_spo2_state == 1 or get_temp_state == 1:#手动触发
-                            EventMesh.publish("close_hr_sop2")
-                            EventMesh.publish("close_led_pin")
-                            return
+                        if get_hr_state != 0 or get_spo2_state != 0 or get_temp_state != 0:#手动触发
+                            if get_hr_state != 2 or get_spo2_state != 2 or get_temp_state != 2:
+                                EventMesh.publish("close_hr_sop2")
+                                EventMesh.publish("close_led_pin")
+                                return
         # EventMesh.debug_log("self.long_count",self.long_count)
         if self.led_total_time != 0:
             #红灯闪烁
@@ -559,7 +562,8 @@ class ledEventManager(Abstract):#灯事件
                         bg_state = EventMesh.publish("get_bg_state")
                         # EventMesh.debug_log("get_hr_state",get_hr_state,get_spo2_state,wechat_state,self.working_led_mode)
                         if wechat_state != None: #获取微聊状态
-                            if wechat_state == 1 or get_spo2_state != 0 or get_hr_state != 0 or temp_state != 0 or bp_state != 0 or bg_state != 0:
+                            if wechat_state == 1 or get_spo2_state == 1 or get_spo2_state == 3 or get_hr_state == 1 or get_hr_state == 3 or temp_state == 1 or bp_state == 1 \
+                                or bg_state == 1 or bg_state == 3 or temp_state == 3 or bp_state == 3:
                                 return
         if self.timer_state == 1:
             self.timer.stop()
index ccd555d..dd139d5 100644 (file)
@@ -1102,45 +1102,55 @@ class DeviceInfoManager(Abstract):
         hour = date_tmp[3]
         min = date_tmp[4]
         old_Timesec = EventMesh.publish("get_old_time_data")
+        old_step_state = EventMesh.publish("get_old_step_data")
+        if old_step_state == None:
+            old_step_state = 0
         # EventMesh.debug_log("old_Timesec",old_Timesec)
-        if old_Timesec != None:
+        if old_Timesec != None and old_step_state != None:
             data = RTC().datetime()
             hour = data[4]
             min = data[5]
             next_alarm_time = utime.localtime(int(old_Timesec))
-            # EventMesh.debug_log("data[5]:{} {} next_alarm_time:{} old_Timesec:{}".format(data[1],data[2],next_alarm_time,old_Timesec))
+            EventMesh.debug_log("data[5]:{} {} next_alarm_time:{} old_Timesec:{}".format(data[1],data[2],next_alarm_time,old_Timesec))
             month = next_alarm_time[1]
             day = next_alarm_time[2]
             if month != data[1] or day != data[2]:
-                step = EventMesh.publish("get_old_step_value")
-                if step > 0:
-                    self.gsensor.reset_step()
-                    EventMesh.publish("set_old_step_value",0)
-                
-                hr = EventMesh.publish("get_old_hr_data",)
-                if hr != 0:
-                    EventMesh.publish("set_old_hr_data", 0)
-                
-                spo2 = EventMesh.publish("get_old_spo2_data")
-                if spo2 != 0:
-                    EventMesh.publish("set_old_spo2_data", 0)
-                EventMesh.publish("set_old_time_data",time_tmp)
-        if hour == 0:#清步数
-            if min <= 1:
-                if self.clear_step == 0:
+                if old_step_state == 0:
                     step = EventMesh.publish("get_old_step_value")
-                    EventMesh.publish("set_old_time_data",time_tmp)
                     if step > 0:
-                        EventMesh.publish("set_old_step_value",0)
                         self.gsensor.reset_step()
-                    hr = EventMesh.publish("get_old_hr_data")
+                        EventMesh.publish("set_old_step_value",0)
+                    
+                    hr = EventMesh.publish("get_old_hr_data",)
                     if hr != 0:
                         EventMesh.publish("set_old_hr_data", 0)
                     
                     spo2 = EventMesh.publish("get_old_spo2_data")
                     if spo2 != 0:
                         EventMesh.publish("set_old_spo2_data", 0)
-                    self.clear_step = 1
+                    EventMesh.publish("set_old_time_data",time_tmp)
+                    EventMesh.publish("set_old_step_data",1)#清一次
+        if hour == 23:#清步数
+            if min <= 59 and min >= 58:#58 59
+                clear_step_state = EventMesh.publish("get_old_step_data")
+                if clear_step_state == None:
+                    clear_step_state = 0
+                if self.clear_step == 0 :
+                    if clear_step_state == 0:
+                        step = EventMesh.publish("get_old_step_value")
+                        EventMesh.publish("set_old_time_data",time_tmp)
+                        EventMesh.publish("set_old_step_data",1)
+                        if step > 0:
+                            EventMesh.publish("set_old_step_value",0)
+                            self.gsensor.reset_step()
+                        hr = EventMesh.publish("get_old_hr_data")
+                        if hr != 0:
+                            EventMesh.publish("set_old_hr_data", 0)
+                        
+                        spo2 = EventMesh.publish("get_old_spo2_data")
+                        if spo2 != 0:
+                            EventMesh.publish("set_old_spo2_data", 0)
+                        self.clear_step = 1
             else:
                 if self.clear_step == 1:
                     self.clear_step = 0
@@ -1250,33 +1260,38 @@ class DeviceInfoManager(Abstract):
                 if get_temp_state > 1  and (WEAR != 1 or call_state != 0):
                     EventMesh.publish(constants.EVENT.STOP_TEMP)
                     EventMesh.publish("set_temp_state",0)       
-                    EventMesh.publish("stop_led_timer")#设置参数
+                    if get_temp_state > 2:
+                        EventMesh.publish("stop_led_timer")#设置参数
                 if (self.get_hr_state > 1 or self.get_spo2_state > 1 or get_bp_state > 1 or get_bg_state > 1) and (WEAR != 1 or call_state != 0):
                     print("wear faile")
                     if self.get_hr_state > 1 :
                         EventMesh.publish("set_hr_state",0)#2代表后台进入测试,定时测心率 1ui界面测试洗心率 
-                        EventMesh.publish("stop_led_timer")#设置参数
+                        if self.get_hr_state > 2:
+                            EventMesh.publish("stop_led_timer")#设置参数
                         EventMesh.publish(constants.EVENT.STOP_HEART) 
                         
                     elif self.get_spo2_state > 1:
                         EventMesh.publish("set_spo2_state",0)#2代表后台进入测试
-                        EventMesh.publish("stop_led_timer")#设置参数
+                        if self.get_spo2_state > 2:
+                            EventMesh.publish("stop_led_timer")#设置参数
                         EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
                         
                     elif get_bp_state > 1:
                         EventMesh.publish("set_bp_state",0)#2代表后台进入测试
-                        EventMesh.publish("stop_led_timer")#设置参数
+                        if get_bp_state > 2:
+                            EventMesh.publish("stop_led_timer")#设置参数
                         EventMesh.publish(constants.EVENT.STOP_HEART)
                         
                     elif get_bg_state > 1:
                         EventMesh.publish("set_bg_state",0)#2代表后台进入测试
-                        EventMesh.publish("stop_led_timer")#设置参数
+                        if get_bg_state > 2:
+                            EventMesh.publish("stop_led_timer")#设置参数
                         EventMesh.publish(constants.EVENT.STOP_HEART)
                         
                     
 
-        # if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#已联网 并且不在充电 佩戴正常 不在通话就给测试心率
-        if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1 and battery[0] != "1" and WEAR == 1 and call_state == 0:
+        if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#已联网 并且不在充电 佩戴正常 不在通话就给测试心率
+        # if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1 and battery[0] != "0" and WEAR == 1 and call_state == 0:
             if self.pull_time == 0:
                 self.pull_time = time_tmp
             if time_tmp - self.pull_time >= 30:
@@ -1480,7 +1495,7 @@ class DeviceInfoManager(Abstract):
                                 if (time_tmp-self.temp_time) == 0 and self.temp_state == 0:#一开始就测量 测量一分钟停止测量体温
                                     self.temp_state = 1
                                     EventMesh.publish("set_temp_state",2)
-                                    EventMesh.publish("set_hr_blood_led",1)
+                                    # EventMesh.publish("set_hr_blood_led",1)
                                     EventMesh.debug_log("AUTO temp:") 
                                     EventMesh.publish(constants.EVENT.START_TEMP)
 
@@ -1509,7 +1524,7 @@ class DeviceInfoManager(Abstract):
                                             EventMesh.publish("set_history_temp_value",0)
                                             # EventMesh.publish("play_temp_value",0)#播放体温数值
                                     EventMesh.publish(constants.EVENT.STOP_TEMP)
-                                    EventMesh.publish("stop_led_timer")#设置参数
+                                    # EventMesh.publish("stop_led_timer")#设置参数
                                     EventMesh.debug_log("AUTO temp:{} tmp_f:{} tmp_f_tmp:{} tmp_d:{} tmp_d_tmp:{}".format(temp,tmp_f,tmp_f_tmp,tmp_d,tmp_d_tmp)) 
                                 
                             else:
@@ -1536,7 +1551,7 @@ class DeviceInfoManager(Abstract):
                                 if (time_tmp - self.SENSOR_time) == 0 and self.HR_Onestate == 0:
                                     EventMesh.debug_log("START_hr:1")
                                     EventMesh.publish("set_hr_state",2)#2代表后台进入测试
-                                    EventMesh.publish("set_hr_blood_led",1)
+                                    # EventMesh.publish("set_hr_blood_led",1)
                                     EventMesh.publish(constants.EVENT.START_HEART)
                                     self.HR_Onestate = 1
                                 elif (time_tmp - self.SENSOR_time) >= 60 and self.HR_Onestate == 1:
@@ -1551,7 +1566,7 @@ class DeviceInfoManager(Abstract):
                                         EventMesh.publish("set_history_hr_value",heart_value)
                                         EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据
                                     else:
-                                        EventMesh.publish("stop_led_timer")#设置参数
+                                        # EventMesh.publish("stop_led_timer")#设置参数
                                         pass
                                         # EventMesh.publish("play_hr_value",0)
                                     #获取心率数据上传数据app
@@ -1566,7 +1581,7 @@ class DeviceInfoManager(Abstract):
                             if hr_state == 2:
                                 EventMesh.publish("set_hr_state",0)#2代表后台进入测试
                                 EventMesh.debug_log("33stop debug3")
-                                EventMesh.publish("stop_led_timer")#设置参数
+                                # EventMesh.publish("stop_led_timer")#设置参数
                                 EventMesh.publish(constants.EVENT.STOP_HEART)
                 
                 if bg_time[0] != None:
@@ -1589,12 +1604,12 @@ class DeviceInfoManager(Abstract):
                             if (time_tmp - self.bg_times) == 0 and self.BG_state == 0:
                                 EventMesh.debug_log("START_bg:1")
                                 EventMesh.publish("set_bg_state",2)#2代表后台进入测试
-                                EventMesh.publish("set_hr_blood_led",1)
+                                # EventMesh.publish("set_hr_blood_led",1)
                                 EventMesh.publish(constants.EVENT.START_HEART)
                                 self.BG_state = 1
                             elif (time_tmp - self.bg_times) >= 60 and self.BG_state == 1:
                                 EventMesh.publish("set_bg_state",0)#2代表后台进入测试
-                                EventMesh.publish("stop_led_timer")#设置参数
+                                # EventMesh.publish("stop_led_timer")#设置参数
                                 EventMesh.debug_log("stop bgdebug3")
                                 EventMesh.publish(constants.EVENT.STOP_HEART)
                                 bgdata = get_blood_sugar_value()
@@ -1611,7 +1626,7 @@ class DeviceInfoManager(Abstract):
                         bg_state  = EventMesh.publish("get_bg_state") 
                         if bg_state == 2:
                             EventMesh.publish("set_bg_state",0)#2代表后台进入测试
-                            EventMesh.publish("stop_led_timer")#设置参数
+                            # EventMesh.publish("stop_led_timer")#设置参数
                             EventMesh.debug_log("bg stop bgdebug3")
                             EventMesh.publish(constants.EVENT.STOP_HEART)
                         self.bg_times = 0
@@ -1672,23 +1687,27 @@ class DeviceInfoManager(Abstract):
                     if get_hr_state == 2 or get_hr_state == 3:
                         
                         EventMesh.publish("set_hr_state",0)#2代表后台进入测试,定时测心率 1ui界面测试洗心率 
-                        EventMesh.publish("stop_led_timer")#设置参数
+                        if get_hr_state == 3:
+                            EventMesh.publish("stop_led_timer")#设置参数
                         EventMesh.debug_log("stop debug8")
                         EventMesh.publish(constants.EVENT.STOP_HEART) 
                     elif get_spo2_state == 2 or get_spo2_state == 3:
                         
                         EventMesh.publish("set_spo2_state",0)#2代表后台进入测试
-                        EventMesh.publish("stop_led_timer")#设置参数
+                        if get_spo2_state == 3:
+                            EventMesh.publish("stop_led_timer")#设置参数
                         EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
                         EventMesh.debug_log("stop debug13")
                     elif get_bp_state == 2 or get_bp_state == 3:
                         EventMesh.publish("set_bp_state",0)#2代表后台进入测试
-                        EventMesh.publish("stop_led_timer")#设置参数
+                        if get_bp_state == 3:
+                            EventMesh.publish("stop_led_timer")#设置参数
                         EventMesh.publish(constants.EVENT.STOP_HEART)
                         EventMesh.debug_log("stop debug14")
                     elif get_bg_state == 2 or get_bg_state == 3:
                         EventMesh.publish("set_bg_state",0)#2代表后台进入测试
-                        EventMesh.publish("stop_led_timer")#设置参数
+                        if get_bg_state == 3:
+                            EventMesh.publish("stop_led_timer")#设置参数
                         EventMesh.publish(constants.EVENT.STOP_HEART)
                         EventMesh.debug_log("stop debug15")
 
@@ -1719,7 +1738,9 @@ class DeviceInfoManager(Abstract):
                             else:
                                 EventMesh.publish("set_history_temp_value",0)
                                 # EventMesh.publish("play_temp_value",0)#播放体温数值
-                        EventMesh.publish("stop_led_timer")#设置参数
+                        if get_temp_state == 3:
+                            EventMesh.publish("stop_led_timer")#设置参数
+                        
                         EventMesh.publish(constants.EVENT.STOP_TEMP)
 
             
@@ -3476,21 +3497,35 @@ class getOldTimeManager(Abstract):
     # 获取天气数据
     def __init__(self):
         self.time_sec = 0
+        self.time_step = 0
         tmp_data = EventMesh.publish("get_storage_config","old_time")
         if tmp_data !=None :
             self.time_sec = tmp_data
+        tmp_data = EventMesh.publish("get_storage_config","old_step")
+        if tmp_data !=None :
+            self.time_step = tmp_data
           
     def post_processor_after_instantiation(self):
         EventMesh.subscribe("get_old_time_data", self.get_old_time_data)
         EventMesh.subscribe("set_old_time_data", self.set_old_time_data)
 
+        EventMesh.subscribe("get_old_step_data", self.get_old_step_data)
+        EventMesh.subscribe("set_old_step_data", self.set_old_step_data)
+
     def get_old_time_data(self, event, msg):
         return self.time_sec
+    
+    def get_old_step_data(self, event, msg):
+        return self.time_step
 
     def set_old_time_data(self, event, msg):
         self.time_sec = msg
         EventMesh.publish("set_storage_config",["old_time",msg])
 
+    def set_old_step_data(self, event, msg):
+        self.time_sec = msg
+        EventMesh.publish("set_storage_config",["old_step",msg])
+