self.temp_state = 0
self.temp_one_state = 0
+ self.vbat_count = 0
+
self.usb = USB()
self.usb.setCallback(self.usb_event_cb)
self.log = LogAdapter(self.__class__.__name__)
EventMesh.publish(constants.EVENT.PUSH_STEP, self.get_step_count())
+ bat_tmp = EventMesh.publish("screen_get_battery")
+ self.vbat_count+=10
+ if self.vbat_count >= 50:
+ self.vbat_count = 0
+ if bat_tmp != None:
+ bat_value = bat_tmp[1]
+ bat_value = 0
+ if bat_value <= 0:
+ bat_value = 10
+ #EventMesh.publish("load_screen", {"screen": "LOW_ONE_POWER"})
self.get_hr_state = EventMesh.publish("get_hr_state")
self.get_spo2_state = EventMesh.publish("get_spo2_state")
tmp_d = str(temp).split('.')[1][:1]
tmp_d_tmp = int(tmp_d)
+ EventMesh.publish("set_history_temp_value",temp)
EventMesh.publish(constants.EVENT.STOP_TEMP)
print("AUTO 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)
tmp_d = str(temp).split('.')[1][:1]
tmp_d_tmp = int(tmp_d)
+ if temp != None:
+ if temp != 0:
+ EventMesh.publish("set_history_temp_value",temp)
+ EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp])
+ EventMesh.publish("set_history_temp_value",temp)
EventMesh.publish(constants.EVENT.STOP_TEMP)
print("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)
- EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp])
else:
self.temp_one_state = 0
self.temp_state = 0
tmp_d = str(temp).split('.')[1][:1]
tmp_d_tmp = int(tmp_d)
+ if temp != None:
+ if temp != 0:
+ EventMesh.publish("set_history_temp_value",temp)
+ EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp])
EventMesh.publish(constants.EVENT.STOP_TEMP)
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)
- EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp])
+
if hr_time != None:
# print("hr......01....{}\r\n".format(hr_time))
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)
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
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)
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:")
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:
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 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)
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(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
print("stop_heart heart_value:{}".format(heart_value))
if heart_value > 50 and heart_value != None:
EventMesh.publish("set_old_hr_data",heart_value)
+ EventMesh.publish("set_history_hr_value",heart_value)
EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据
if self.Spo2_Need_Open == 0 and self.get_spo2_state == 3:
EventMesh.publish("set_spo2_state",3)#2代表后台进入血氧测试
print("spo2_value:{}.......01..".format(spo2_value))
if spo2_value > 85 and spo2_value != None:
EventMesh.publish("set_old_spo2_data",spo2_value)
+ EventMesh.publish("set_history_spo2_value",spo2_value)
EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
if self.Hr_Need_Open == 0 and self.get_hr_state == 3:
EventMesh.publish("set_hr_state",3)#2代表后台进入测试
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)
elif self.set_hsenor_crt == 1:
EventMesh.publish("set_hr_state",0)#0代表g关闭测试
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)#上传心率数据
self.HR_Onestate = 0
else:
tmp_d = str(temp).split('.')[1][:1]
tmp_d_tmp = int(tmp_d)
EventMesh.publish("set_temp_state",0)
- EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp])
+ if temp != None:
+ if temp != 0:
+ EventMesh.publish("set_history_temp_value",temp)
+ EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp])
EventMesh.publish(constants.EVENT.STOP_TEMP)
self.SENSOR_time = time_tmp
self.HR_Onestate = 0
def btn8_press(self):
EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+LowOnePower_screen = None
+LowOnePower_screen_img = None
+LowOnePower_screen_label2 = None
+LowOnePower_screen_label1 = None
+class LowOnePowerScreen(Screen): #0%的电池电量
+ NAME = "LOW_ONE_POWER"
+ def __init__(self):
+ super().__init__()
+ self.meta = None
+ self.timer = osTimer()
+
+ def initialization(self):
+ global LowOnePower_screen ,LowOnePower_screen_img ,LowOnePower_screen_label2,LowOnePower_screen_label1
+ if LowOnePower_screen == None :
+ LowOnePower_screen = lv.obj()
+ print("LowOnePower_screen")
+ LowOnePower_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+ # add style for watchface
+ LowOnePower_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT)
+ #进入图片
+ LowOnePower_screen_img = lv.img(LowOnePower_screen)
+ LowOnePower_screen_img.set_pos(int(86),int(30))
+ LowOnePower_screen_img.set_size(68,110)
+ LowOnePower_screen_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+ LowOnePower_screen_img.add_flag(lv.obj.FLAG.CLICKABLE)
+ LowOnePower_screen_img.set_src("E:/static/0_BAT.png")
+ LowOnePower_screen_img.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+ LowOnePower_screen_label1 = lv.label(LowOnePower_screen)
+ LowOnePower_screen_label1.set_pos(0, 180)
+ LowOnePower_screen_label1.set_size(240, 30)
+ LowOnePower_screen_label1.set_text("电池电量过低,请及时充电")
+ LowOnePower_screen_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+ LowOnePower_screen_label1.set_long_mode(lv.label.LONG.WRAP)
+ LowOnePower_screen_label1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+
+ LowOnePower_screen_label2 = lv.label(LowOnePower_screen)
+ LowOnePower_screen_label2.set_pos(0, 240)
+ LowOnePower_screen_label2.set_size(240, 30)
+ LowOnePower_screen_label2.set_text("继续使用,5s过后强制关机")
+ LowOnePower_screen_label2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+ LowOnePower_screen_label2.set_long_mode(lv.label.LONG.WRAP)
+ LowOnePower_screen_label2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+
+ self.meta = LowOnePower_screen
+
+ def post_processor_after_initialization(self):
+ self.timer.start(5000,0,self.fun)
+
+ def fun(self,e):
+ EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"})
+
+ def done_left_to_right(self):
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+ def done_right_to_left(self):
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+ def done_bottom_to_top(self):
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+ def done_top_to_bottom(self):
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+ def done_return(self):
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+ def done_click(self):
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+ def btn1_release(self):
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+ def btn8_press(self):
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+
+
sos_screen = None
sos_screen_label = None
sos_screen_label_p = None