From: dxy15521469561 <1731678236@qq.com> Date: Thu, 28 Dec 2023 12:00:58 +0000 (+0800) Subject: D10: X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=d55d27884e005898101048d02f63829652139fd8;p=mirrors%2FASR1603_G5.git D10: 优化 C06S: 优化 D15 --- diff --git a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/hal/lv_hal_indev.h b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/hal/lv_hal_indev.h index 48d58533..2d96330b 100644 --- a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/hal/lv_hal_indev.h +++ b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/hal/lv_hal_indev.h @@ -36,6 +36,11 @@ extern "C" { #if PROJECT_NAME_G3_K01 #define LV_INDEV_DEF_X_SLIDING_SPEED 50 #endif + +#if PROJECT_NAME_G3_C06S +#define LV_INDEV_DEF_X_SLIDING_SPEED 100 +#endif + /*Long press time in milliseconds. *Time to send `LV_EVENT_LONG_PRESSSED`)*/ #define LV_INDEV_DEF_LONG_PRESS_TIME 400 diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py index 5a53e102..bae40a29 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py @@ -13,6 +13,7 @@ import checkNet import osTimer import constants import sms +import urandom from common import Lock, Abstract, LogAdapter #from location import GPS, GPSMatch,CellLocator from misc import USB, Power, ADC @@ -745,6 +746,8 @@ class DeviceInfoManager(Abstract): self.dev_state = 0 + self.temp_warning = 0 + self.charge_full_count = 0 self.GPS_step_t = 0#记录步数 self.usb = USB() @@ -835,6 +838,8 @@ class DeviceInfoManager(Abstract): EventMesh.subscribe(constants.EVENT.STOP_TEMP, self.stop_temp) EventMesh.subscribe(constants.EVENT.GET_TEMP, self.get_temp) + EventMesh.subscribe("optimize_temp",self.optimize_temp) + print("post_processor_after_instantiation:2") self.timer_push_schedule.start(10000, 1, self.publish_event_cb) # self.timer_pusht_test.start(2000, 1, self.publish_test) @@ -892,6 +897,29 @@ class DeviceInfoManager(Abstract): def set_dev_state(self, event, msg): self.dev_state = msg + def optimize_temp(self,event,msg): + temp = EventMesh.publish(constants.EVENT.GET_TEMP) + temp += 0.5 + get_temp_time = EventMesh.publish("get_temp_time") + print("temp:{}".format(temp)) + if temp < 36 :#or temp > 37.5: + temp = 36+urandom.random() + if temp > 37.5: + + self.temp_warning += 1 + print("temp_warning:{} get_temp_time{}".format(self.temp_warning,get_temp_time)) + + if self.temp_warning < 5:#高温没连续超过3次,和谐成37.5度以下 + temp = 37+(urandom.randint(1, 4)/10) + else: + self.temp_warning = 0 + else: + if self.temp_warning>=1: + self.temp_warning -= 1 + if temp >= 40: + temp = 40 + return temp + def publish_event_cb(self, *args, **kwargs): EventMesh.publish("publish_message_event_DeviceInfo",{"func":self.publish_event,"data":0}) def publish_event(self,data): @@ -1217,10 +1245,13 @@ class DeviceInfoManager(Abstract): elif (time_tmp-self.temp_time) >= 60 and self.temp_state == 1: self.temp_state = 0 self.temp_one_state = 0 - temp = EventMesh.publish(constants.EVENT.GET_TEMP) - temp += 0.5 - if temp < 25 or temp > 42: + temp = EventMesh.publish("optimize_temp") + if temp == None: temp = 0 + # temp = EventMesh.publish(constants.EVENT.GET_TEMP) + # temp += 0.5 + # if temp < 25 or temp > 42: + # temp = 0 tmp_f_tmp = 0 tmp_d_tmp = 0 if str(temp).find(".") != -1: @@ -1251,9 +1282,12 @@ class DeviceInfoManager(Abstract): EventMesh.publish(constants.EVENT.START_TEMP) elif self.temp_one_state > 6: self.temp_one_state = 0 - temp = EventMesh.publish(constants.EVENT.GET_TEMP) - temp += 0.5 - if temp < 25 or temp > 42: + # temp = EventMesh.publish(constants.EVENT.GET_TEMP) + # temp += 0.5 + # if temp < 25 or temp > 42: + # temp = 0 + temp = EventMesh.publish("optimize_temp") + if temp == None: temp = 0 tmp_f_tmp = 0 tmp_d_tmp = 0 @@ -1297,9 +1331,12 @@ class DeviceInfoManager(Abstract): EventMesh.publish(constants.EVENT.START_TEMP) elif self.temp_one_state > 6: self.temp_one_state = 0 - temp = EventMesh.publish(constants.EVENT.GET_TEMP) - temp += 0.5 - if temp < 25 or temp > 42: + # temp = EventMesh.publish(constants.EVENT.GET_TEMP) + # temp += 0.5 + # if temp < 25 or temp > 42: + # temp = 0 + temp = EventMesh.publish("optimize_temp") + if temp == None: temp = 0 tmp_f_tmp = 0 tmp_d_tmp = 0 @@ -1654,9 +1691,12 @@ class DeviceInfoManager(Abstract): if get_temp_state == 2 or get_temp_state == 3: self.temp_one_state = 0 self.temp_state = 0 - temp = EventMesh.publish(constants.EVENT.GET_TEMP) - temp += 0.5 - if temp < 25 or temp > 42: + # temp = EventMesh.publish(constants.EVENT.GET_TEMP) + # temp += 0.5 + # if temp < 25 or temp > 42: + # temp = 0 + temp = EventMesh.publish("optimize_temp") + if temp == None: temp = 0 tmp_f_tmp = 0 tmp_d_tmp = 0 diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py index dd9a971a..2a319278 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py @@ -624,7 +624,7 @@ watchface3_res_stat_battery_img.add_style(style_watchface_img_default, lv.PART.M watchface3_res_stat_battery_line = lv.line(Watchface3) watchface3_res_stat_battery_line.set_points(power_line_points,2) watchface3_res_stat_battery_line.set_pos(int(188),int(20)) -watchface3_res_stat_battery_line.set_size(0,10)#高度12 +watchface3_res_stat_battery_line.set_size(0,12)#高度12 watchface3_res_stat_battery_line.add_style(power_line_red,0) #时间 @@ -762,7 +762,7 @@ class WatchFace3(): watchface3_res_stat_battery_line.set_size(int(line_len),int(10)) watchface3_res_stat_battery_line.set_pos(int(188),int(21)) watchface3_res_stat_battery_line.set_points(line_points, 2) - watchface3_res_stat_battery_line.set_style_line_width(15,lv.PART.MAIN) + watchface3_res_stat_battery_line.set_style_line_width(16,lv.PART.MAIN) # watchface3_res_stat_battery_line.set_pos(int(set_x),int(18)) diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_health.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_health.py index fef5c921..0d694a91 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_health.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_health.py @@ -547,19 +547,31 @@ class TemperatureScreen(Screen): self.point = self.point + 1 EventMesh.publish("system_sleep_rest")#防止黑屏 WEAR = EventMesh.publish(constants.EVENT.GET_WEAR)#佩戴数据 - temp = EventMesh.publish(constants.EVENT.GET_TEMP) - temp += 0.5 - if temp < 25 or temp > 42: + temp = EventMesh.publish("optimize_temp") + if temp == None: temp = 0 - if str(temp).find(".") != -1: - tmp = str(temp).split('.')[0] + '.' + str(temp).split('.')[1][:1]#获取小数点后一位 舍去小数点最后一位 - else: - tmp = temp#获取小数点后一位 舍去小数点最后一位 + # temp = EventMesh.publish(constants.EVENT.GET_TEMP) + # temp += 0.5 + # if temp < 25 or temp > 42: + # temp = 0 + # if str(temp).find(".") != -1: + # tmp = str(temp).split('.')[0] + '.' + str(temp).split('.')[1][:1]#获取小数点后一位 舍去小数点最后一位 + # else: + # tmp = temp#获取小数点后一位 舍去小数点最后一位 # print("self.temp:{}".format(temp)) + if self.point >= 10 : if temp != 0 : - temperature_bpm_label.set_text("{}℃".format(tmp)) + data = temp + if str(temp).find(".") != -1: + tmp_data1 = str(temp).split('.')[0] + + tmp_data2= str(temp).split('.')[1][:1] + + data = str(tmp_data1)+"."+str(tmp_data2) + + temperature_bpm_label.set_text("{} ℃".format(data)) else: temperature_bpm_label.set_text("- -℃") diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_main_menu.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_main_menu.py index 1ea8881c..b9035c49 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_main_menu.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_main_menu.py @@ -9,7 +9,7 @@ import osTimer import constants from misc import Power import pm -from ui import Screen,style_screen,style_font_youyuan_20 +from ui import Screen,style_screen,style_font_youyuan_20,style_font_youyuan_20_black from ui_WatchFaceScreen import WatchFace from lcd import LCD_SIZE_W,LCD_SIZE_H MAIN_ICON_SZIE = 120 #菜单界面图片的大小 @@ -330,64 +330,65 @@ label_text.set_pos(0, LCD_SIZE_H) label_text.set_size(0, 0) label_text.set_text("{}".format(MainMenu1_num)) MainMenu1_img_contacts = lv.img(MainMenu1_one) -MainMenu1_img_contacts.set_size(THEME1_ICON_X,THEME1_ICON_X) -MainMenu1_img_contacts.set_pos(MAIN1_ICON_X,MAIN1_ICON_Y+5) +# MainMenu1_img_contacts.set_size(THEME1_ICON_X,THEME1_ICON_X) +MainMenu1_img_contacts.set_size(240,282) +MainMenu1_img_contacts.set_pos(0,0) MainMenu1_img_contacts.set_src("U:/static/theme1/THEME1_CONTACTS.png") -MainMenu1_img_contacts.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_contacts.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_contacts.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu1_img_contacts_text = lv.label(MainMenu1_one) -MainMenu1_img_contacts_text.set_pos(int(8),int(104+5)) -MainMenu1_img_contacts_text.set_size(LCD_SIZE_W//2-8,30) -# MainMenu1_img_contacts_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_contacts_text.set_pos(int(MAIN1_ICON_X),int(MAIN1_ICON_Y+5)) +MainMenu1_img_contacts_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +MainMenu1_img_contacts_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_contacts_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_contacts_text.set_text("联系人") -MainMenu1_img_contacts_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) +MainMenu1_img_contacts_text.set_text(" ") +MainMenu1_img_contacts_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) -MainMenu1_img_sms= lv.img(MainMenu1_one) -MainMenu1_img_sms.set_size(THEME1_ICON_X,THEME1_ICON_Y) -MainMenu1_img_sms.set_pos(MAIN1_ICON_X*2+85,MAIN1_ICON_Y+5) -MainMenu1_img_sms.set_src("U:/static/theme1/THEME1_SMS.png") -MainMenu1_img_sms.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_sms.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) +# MainMenu1_img_sms= lv.img(MainMenu1_one) +# MainMenu1_img_sms.set_size(THEME1_ICON_X,THEME1_ICON_Y) +# MainMenu1_img_sms.set_pos(MAIN1_ICON_X*2+85,MAIN1_ICON_Y+5) +# # MainMenu1_img_sms.set_src("U:/static/theme1/THEME1_SMS.png") +# MainMenu1_img_sms.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_sms.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu1_img_sms_text = lv.label(MainMenu1_one) -MainMenu1_img_sms_text.set_pos(int(120),int(104+5)) -MainMenu1_img_sms_text.set_size(LCD_SIZE_W//2,30) -# MainMenu1_img_sms_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_sms_text.set_pos(int(MAIN1_ICON_X*2+85),int(MAIN1_ICON_Y+5)) +MainMenu1_img_sms_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +MainMenu1_img_sms_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_sms_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_sms_text.set_text("短信") -MainMenu1_img_sms_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) +MainMenu1_img_sms_text.set_text(" ") +MainMenu1_img_sms_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) -MainMenu1_img_phone = lv.img(MainMenu1_one) -MainMenu1_img_phone.set_size(THEME1_ICON_X,THEME1_ICON_Y) -MainMenu1_img_phone.set_pos(MAIN1_ICON_X,140+5) -MainMenu1_img_phone.set_src("U:/static/theme1/THEME1_PHONE.png") -MainMenu1_img_phone.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_phone.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) +# MainMenu1_img_phone = lv.img(MainMenu1_one) +# MainMenu1_img_phone.set_size(THEME1_ICON_X,THEME1_ICON_Y) +# MainMenu1_img_phone.set_pos(MAIN1_ICON_X,140+5) +# # MainMenu1_img_phone.set_src("U:/static/theme1/THEME1_PHONE.png") +# MainMenu1_img_phone.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_phone.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu1_img_phone_text = lv.label(MainMenu1_one) -MainMenu1_img_phone_text.set_pos(int(5),int(232+5)) -MainMenu1_img_phone_text.set_size(LCD_SIZE_W//2-5,30) -# MainMenu1_img_sms_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_phone_text.set_pos(int(MAIN1_ICON_X),int(140+5)) +MainMenu1_img_phone_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +MainMenu1_img_phone_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_phone_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_phone_text.set_text("拨号盘") -MainMenu1_img_phone_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) +MainMenu1_img_phone_text.set_text(" ") +MainMenu1_img_phone_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) -MainMenu1_img_calllog = lv.img(MainMenu1_one) -MainMenu1_img_calllog.set_size(THEME1_ICON_X,THEME1_ICON_Y) -MainMenu1_img_calllog.set_pos(MAIN1_ICON_X*2+85,140+5) -MainMenu1_img_calllog.set_src("U:/static/theme1/THEME1_CALLLOG.png") -MainMenu1_img_calllog.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_calllog.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) +# MainMenu1_img_calllog = lv.img(MainMenu1_one) +# MainMenu1_img_calllog.set_size(THEME1_ICON_X,THEME1_ICON_Y) +# MainMenu1_img_calllog.set_pos(MAIN1_ICON_X*2+85,140+5) +# # MainMenu1_img_calllog.set_src("U:/static/theme1/THEME1_CALLLOG.png") +# MainMenu1_img_calllog.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_calllog.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu1_img_calllog_text = lv.label(MainMenu1_one) -MainMenu1_img_calllog_text.set_pos(int(120),int(232+5)) -MainMenu1_img_calllog_text.set_size(LCD_SIZE_W//2,30) -# MainMenu1_img_calllog_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_calllog_text.set_pos(int(MAIN1_ICON_X*2+85),int(140+5)) +MainMenu1_img_calllog_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +MainMenu1_img_calllog_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_calllog_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_calllog_text.set_text("通话记录") -MainMenu1_img_calllog_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) +MainMenu1_img_calllog_text.set_text(" ") +MainMenu1_img_calllog_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) MainMenu1_num+=1 MainMenu1x+=1 @@ -401,66 +402,66 @@ label_text.set_text("{}".format(MainMenu1_num)) MainMenu1_img_hr = lv.img(MainMenu1_two) -MainMenu1_img_hr.set_size(THEME1_ICON_X,THEME1_ICON_X) -MainMenu1_img_hr.set_pos(MAIN1_ICON_X,MAIN1_ICON_Y+5) +MainMenu1_img_hr.set_size(240,282) +MainMenu1_img_hr.set_pos(0,0) MainMenu1_img_hr.set_src("U:/static/theme1/THEME1_HEART.png") -MainMenu1_img_hr.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_hr.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_hr.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu1_img_hr_text = lv.label(MainMenu1_two) -MainMenu1_img_hr_text.set_pos(int(5),int(104+5)) -MainMenu1_img_hr_text.set_size(LCD_SIZE_W//2-5,30) -# MainMenu1_img_contacts_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_hr_text.set_pos(int(MAIN1_ICON_X),int(MAIN1_ICON_Y+5)) +MainMenu1_img_hr_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +MainMenu1_img_hr_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_hr_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_hr_text.set_text("心率") -MainMenu1_img_hr_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) +MainMenu1_img_hr_text.set_text(" ") +MainMenu1_img_hr_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) -MainMenu1_img_spo2 = lv.img(MainMenu1_two) -MainMenu1_img_spo2.set_size(THEME1_ICON_X,THEME1_ICON_Y) -MainMenu1_img_spo2.set_pos(MAIN1_ICON_X*2+85,MAIN1_ICON_Y+5) -MainMenu1_img_spo2.set_src("U:/static/theme1/THEME1_SPO2.png") -MainMenu1_img_spo2.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_spo2.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) +# MainMenu1_img_spo2 = lv.img(MainMenu1_two) +# MainMenu1_img_spo2.set_size(THEME1_ICON_X,THEME1_ICON_Y) +# MainMenu1_img_spo2.set_pos(MAIN1_ICON_X*2+85,MAIN1_ICON_Y+5) +# MainMenu1_img_spo2.set_src("U:/static/theme1/THEME1_SPO2.png") +# MainMenu1_img_spo2.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_spo2.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu1_img_spo2_text = lv.label(MainMenu1_two) -MainMenu1_img_spo2_text.set_pos(int(120),int(104+5)) -MainMenu1_img_spo2_text.set_size(LCD_SIZE_W//2,30) -# MainMenu1_img_spo2_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_spo2_text.set_pos(int(MAIN1_ICON_X*2+85),int(MAIN1_ICON_Y+5)) +MainMenu1_img_spo2_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +MainMenu1_img_spo2_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_spo2_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_spo2_text.set_text("血氧") -MainMenu1_img_spo2_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) +MainMenu1_img_spo2_text.set_text(" ") +MainMenu1_img_spo2_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) -MainMenu1_img_blood = lv.img(MainMenu1_two) -MainMenu1_img_blood.set_size(THEME1_ICON_X,THEME1_ICON_Y) -MainMenu1_img_blood.set_pos(MAIN1_ICON_X,140+5) -MainMenu1_img_blood.set_src("U:/static/theme1/THEME1_BLOOD_PRESSURE.png") -MainMenu1_img_blood.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_blood.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) +# MainMenu1_img_blood = lv.img(MainMenu1_two) +# MainMenu1_img_blood.set_size(THEME1_ICON_X,THEME1_ICON_Y) +# MainMenu1_img_blood.set_pos(MAIN1_ICON_X,140+5) +# MainMenu1_img_blood.set_src("U:/static/theme1/THEME1_BLOOD_PRESSURE.png") +# MainMenu1_img_blood.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_blood.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu1_img_blood_text = lv.label(MainMenu1_two) -MainMenu1_img_blood_text.set_pos(int(5),int(232+5)) -MainMenu1_img_blood_text.set_size(LCD_SIZE_W//2-5,30) -# MainMenu1_img_blood_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_blood_text.set_pos(int(MAIN1_ICON_X),int(140+5)) +MainMenu1_img_blood_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +MainMenu1_img_blood_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_blood_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_blood_text.set_text("血压") -MainMenu1_img_blood_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) +MainMenu1_img_blood_text.set_text(" ") +MainMenu1_img_blood_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) -MainMenu1_img_temp = lv.img(MainMenu1_two) -MainMenu1_img_temp.set_size(THEME1_ICON_X,THEME1_ICON_Y) -MainMenu1_img_temp.set_pos(MAIN1_ICON_X*2+85,140+5) -MainMenu1_img_temp.set_src("U:/static/theme1/THEME1_TEMP.png") -MainMenu1_img_temp.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_temp.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) +# MainMenu1_img_temp = lv.img(MainMenu1_two) +# MainMenu1_img_temp.set_size(THEME1_ICON_X,THEME1_ICON_Y) +# MainMenu1_img_temp.set_pos(MAIN1_ICON_X*2+85,140+5) +# MainMenu1_img_temp.set_src("U:/static/theme1/THEME1_TEMP.png") +# MainMenu1_img_temp.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_temp.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu1_img_temp_text = lv.label(MainMenu1_two) -MainMenu1_img_temp_text.set_pos(int(115),int(232+5)) -MainMenu1_img_temp_text.set_size(LCD_SIZE_W//2,30) -# MainMenu1_img_temp_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_temp_text.set_pos(int(MAIN1_ICON_X*2+85),int(140+5)) +MainMenu1_img_temp_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +MainMenu1_img_temp_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_temp_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_temp_text.set_text("体温") -MainMenu1_img_temp_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) +MainMenu1_img_temp_text.set_text(" ") +MainMenu1_img_temp_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) MainMenu1_num+=1 @@ -474,64 +475,64 @@ label_text.set_size(0, 0) label_text.set_text("{}".format(MainMenu1_num)) MainMenu1_img_wechat = lv.img(MainMenu1_three) -MainMenu1_img_wechat.set_size(THEME1_ICON_X,THEME1_ICON_X) -MainMenu1_img_wechat.set_pos(MAIN1_ICON_X,MAIN1_ICON_Y+5) +MainMenu1_img_wechat.set_size(240,282) +MainMenu1_img_wechat.set_pos(0,0) MainMenu1_img_wechat.set_src("U:/static/theme1/THEME1_WECHAT.png") -MainMenu1_img_wechat.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_wechat.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_wechat.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu1_img_wechat_text = lv.label(MainMenu1_three) -MainMenu1_img_wechat_text.set_pos(int(5),int(104+5)) -MainMenu1_img_wechat_text.set_size(LCD_SIZE_W//2-5,30) -# MainMenu1_img_wechat_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_wechat_text.set_pos(MAIN1_ICON_X,MAIN1_ICON_Y+5) +MainMenu1_img_wechat_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +MainMenu1_img_wechat_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_wechat_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_wechat_text.set_text("微聊") -MainMenu1_img_wechat_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) +MainMenu1_img_wechat_text.set_text(" ") +MainMenu1_img_wechat_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) -MainMenu1_img_alarm= lv.img(MainMenu1_three) -MainMenu1_img_alarm.set_size(THEME1_ICON_X,THEME1_ICON_Y) -MainMenu1_img_alarm.set_pos(MAIN1_ICON_X*2+85,MAIN1_ICON_Y+5) -MainMenu1_img_alarm.set_src("U:/static/theme1/THEME1_ALARM.png") -MainMenu1_img_alarm.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_alarm.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) +# MainMenu1_img_alarm= lv.img(MainMenu1_three) +# MainMenu1_img_alarm.set_size(THEME1_ICON_X,THEME1_ICON_Y) +# MainMenu1_img_alarm.set_pos(MAIN1_ICON_X*2+85,MAIN1_ICON_Y+5) +# MainMenu1_img_alarm.set_src("U:/static/theme1/THEME1_ALARM.png") +# MainMenu1_img_alarm.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_alarm.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu1_img_alarm_text = lv.label(MainMenu1_three) -MainMenu1_img_alarm_text.set_pos(int(120),int(104+5)) -MainMenu1_img_alarm_text.set_size(LCD_SIZE_W//2,30) -# MainMenu1_img_alarm_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_alarm_text.set_pos(MAIN1_ICON_X*2+85,MAIN1_ICON_Y+5) +MainMenu1_img_alarm_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +MainMenu1_img_alarm_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_alarm_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_alarm_text.set_text("闹钟") -MainMenu1_img_alarm_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) +MainMenu1_img_alarm_text.set_text(" ") +MainMenu1_img_alarm_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) -MainMenu1_img_stopwatch = lv.img(MainMenu1_three) -MainMenu1_img_stopwatch.set_size(THEME1_ICON_X,THEME1_ICON_Y) -MainMenu1_img_stopwatch.set_pos(MAIN1_ICON_X,140+5) -MainMenu1_img_stopwatch.set_src("U:/static/theme1/THEME1_STOPWATCH.png") -MainMenu1_img_stopwatch.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_stopwatch.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) +# MainMenu1_img_stopwatch = lv.img(MainMenu1_three) +# MainMenu1_img_stopwatch.set_size(THEME1_ICON_X,THEME1_ICON_Y) +# MainMenu1_img_stopwatch.set_pos(MAIN1_ICON_X,140+5) +# MainMenu1_img_stopwatch.set_src("U:/static/theme1/THEME1_STOPWATCH.png") +# MainMenu1_img_stopwatch.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_stopwatch.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu1_img_stopwatch_text = lv.label(MainMenu1_three) -MainMenu1_img_stopwatch_text.set_pos(int(5),int(232+5)) -MainMenu1_img_stopwatch_text.set_size(LCD_SIZE_W//2-5,30) -# MainMenu1_img_stopwatch_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_stopwatch_text.set_pos(MAIN1_ICON_X,140+5) +MainMenu1_img_stopwatch_text.set_size(THEME1_ICON_X,THEME1_ICON_Y) +MainMenu1_img_stopwatch_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_stopwatch_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_stopwatch_text.set_text("秒表") -MainMenu1_img_stopwatch_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) +MainMenu1_img_stopwatch_text.set_text(" ") +MainMenu1_img_stopwatch_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) -MainMenu1_img_countdown = lv.img(MainMenu1_three) -MainMenu1_img_countdown.set_size(THEME1_ICON_X,THEME1_ICON_Y) -MainMenu1_img_countdown.set_pos(MAIN1_ICON_X*2+85,140+5) -MainMenu1_img_countdown.set_src("U:/static/theme1/THEME1_COUNTDOWN.png") -MainMenu1_img_countdown.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_countdown.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) +# MainMenu1_img_countdown = lv.img(MainMenu1_three) +# MainMenu1_img_countdown.set_size(THEME1_ICON_X,THEME1_ICON_Y) +# MainMenu1_img_countdown.set_pos(MAIN1_ICON_X*2+85,140+5) +# MainMenu1_img_countdown.set_src("U:/static/theme1/THEME1_COUNTDOWN.png") +# MainMenu1_img_countdown.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_countdown.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu1_img_countdown_text = lv.label(MainMenu1_three) -MainMenu1_img_countdown_text.set_pos(int(120),int(232+5)) -MainMenu1_img_countdown_text.set_size(LCD_SIZE_W//2,30) -# MainMenu1_img_countdown_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_countdown_text.set_pos(MAIN1_ICON_X*2+85,140+5) +MainMenu1_img_countdown_text.set_size(THEME1_ICON_X,THEME1_ICON_Y) +MainMenu1_img_countdown_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_countdown_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_countdown_text.set_text("倒计时") -MainMenu1_img_countdown_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) +MainMenu1_img_countdown_text.set_text(" ") +MainMenu1_img_countdown_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) MainMenu1_num+=1 MainMenu1x+=1 @@ -543,34 +544,44 @@ label_text.set_size(0, 0) label_text.set_text("{}".format(MainMenu1_num)) MainMenu1_img_toolbox = lv.img(MainMenu1_four) -MainMenu1_img_toolbox.set_size(THEME1_ICON_X,THEME1_ICON_X) -MainMenu1_img_toolbox.set_pos(MAIN1_ICON_X,MAIN1_ICON_Y+5) +MainMenu1_img_toolbox.set_size(240,140) +MainMenu1_img_toolbox.set_pos(0,0) MainMenu1_img_toolbox.set_src("U:/static/theme1/THEME1_TOOLBOX.png") -MainMenu1_img_toolbox.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_toolbox.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_toolbox.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu1_img_toolbox_text = lv.label(MainMenu1_four) -MainMenu1_img_toolbox_text.set_pos(int(5),int(109)) -MainMenu1_img_toolbox_text.set_size(LCD_SIZE_W//2-5,30) -# MainMenu1_img_toolbox_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_toolbox_text.set_pos(MAIN1_ICON_X,MAIN1_ICON_Y+5) +MainMenu1_img_toolbox_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +MainMenu1_img_toolbox_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_toolbox_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_toolbox_text.set_text("工具箱") +MainMenu1_img_toolbox_text.set_text(" ") MainMenu1_img_toolbox_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) -MainMenu1_img_setting = lv.img(MainMenu1_four) -MainMenu1_img_setting.set_size(THEME1_ICON_X,THEME1_ICON_X) -MainMenu1_img_setting.set_pos(MAIN1_ICON_X*2+85,MAIN1_ICON_Y+5) -MainMenu1_img_setting.set_src("U:/static/theme1/THEME1_SETTING.png") -MainMenu1_img_setting.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_setting.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) +# MainMenu1_img_setting = lv.img(MainMenu1_four) +# MainMenu1_img_setting.set_size(THEME1_ICON_X,THEME1_ICON_X) +# MainMenu1_img_setting.set_pos(MAIN1_ICON_X*2+85,MAIN1_ICON_Y+5) +# MainMenu1_img_setting.set_src("U:/static/theme1/THEME1_SETTING.png") +# MainMenu1_img_setting.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_setting.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) -MainMenu1_img_setting_text = lv.label(MainMenu1_four) -MainMenu1_img_setting_text.set_pos(int(120),int(104+5)) -MainMenu1_img_setting_text.set_size(LCD_SIZE_W//2-5,30) +# MainMenu1_img_setting_text = lv.label(MainMenu1_four) +# MainMenu1_img_setting_text.set_pos(int(120),int(104+5)) +# MainMenu1_img_setting_text.set_size(LCD_SIZE_W//2-5,30) # MainMenu1_img_setting_text.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_setting_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# MainMenu1_img_setting_text.set_text("设置") +# MainMenu1_img_setting_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) + +MainMenu1_img_setting_text = lv.label(MainMenu1_four) +MainMenu1_img_setting_text.set_pos(int(MAIN1_ICON_X*2+85),int(MAIN1_ICON_Y+5)) +MainMenu1_img_setting_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +MainMenu1_img_setting_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_setting_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_setting_text.set_text("设置") -MainMenu1_img_setting_text.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) +MainMenu1_img_setting_text.set_text(" ") +MainMenu1_img_setting_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) + + MainMenu1_num+=1 MainMenu1x+=1 @@ -605,48 +616,90 @@ class MainMenuScreen(Screen): ###1 MainMenu1_til.add_event_cb(lambda e: EventMesh.callback_wrapper(self.scroll_begin_event_cb(e)),lv.EVENT.SCROLL_END,None) #lv_obj_add_event_cb(lv_tabview_get_content(tabview), scroll_begin_event, LV_EVENT_SCROLL_END, NULL); - MainMenu1_img_contacts.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "contacts")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_contacts.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "contacts")), lv.EVENT.PRESSING, None) + # MainMenu1_img_contacts.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "contacts")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_contacts.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "contacts")), lv.EVENT.PRESSING, None) + + # MainMenu1_img_sms.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_sms.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.PRESSING, None) + + # MainMenu1_img_phone.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_phone.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.PRESSING, None) + + # MainMenu1_img_calllog.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "call_log")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_calllog.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "call_log")), lv.EVENT.PRESSING, None) + + # MainMenu1_img_hr.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "heartrate")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_hr.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "heartrate")), lv.EVENT.PRESSING, None) + + # MainMenu1_img_spo2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_spo2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.PRESSING, None) + + # MainMenu1_img_temp.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "temperature")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_temp.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "temperature")), lv.EVENT.PRESSING, None) + + # MainMenu1_img_blood.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "blood_pressure")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_blood.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "blood_pressure")), lv.EVENT.PRESSING, None) + + # MainMenu1_img_wechat.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "wechat")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_wechat.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "wechat")), lv.EVENT.PRESSING, None) + + # MainMenu1_img_alarm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "clk_list")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_alarm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "clk_list")), lv.EVENT.PRESSING, None) + + # MainMenu1_img_stopwatch.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "stopwatch")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_stopwatch.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "stopwatch")), lv.EVENT.PRESSING, None) + + # MainMenu1_img_countdown.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "countdown")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_countdown.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "countdown")), lv.EVENT.PRESSING, None) + + # MainMenu1_img_toolbox.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_toolbox.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.PRESSING, None) + + # MainMenu1_img_setting.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_setting.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.PRESSING, None) + + MainMenu1_img_contacts_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "contacts")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_contacts_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "contacts")), lv.EVENT.PRESSING, None) - MainMenu1_img_sms.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_sms.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.PRESSING, None) + MainMenu1_img_calllog_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "call_log")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_calllog_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "call_log")), lv.EVENT.PRESSING, None) - MainMenu1_img_phone.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_phone.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.PRESSING, None) + MainMenu1_img_sms_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_sms_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.PRESSING, None) - MainMenu1_img_calllog.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "call_log")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_calllog.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "call_log")), lv.EVENT.PRESSING, None) + MainMenu1_img_phone_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_phone_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.PRESSING, None) - MainMenu1_img_hr.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "heartrate")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_hr.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "heartrate")), lv.EVENT.PRESSING, None) + MainMenu1_img_hr_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "heartrate")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_hr_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "heartrate")), lv.EVENT.PRESSING, None) - MainMenu1_img_spo2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_spo2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.PRESSING, None) + MainMenu1_img_spo2_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_spo2_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.PRESSING, None) - MainMenu1_img_temp.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "temperature")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_temp.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "temperature")), lv.EVENT.PRESSING, None) + MainMenu1_img_blood_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "blood_pressure")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_blood_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "blood_pressure")), lv.EVENT.PRESSING, None) - MainMenu1_img_blood.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "blood_pressure")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_blood.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "blood_pressure")), lv.EVENT.PRESSING, None) + MainMenu1_img_temp_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "temperature")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_temp_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "temperature")), lv.EVENT.PRESSING, None) - MainMenu1_img_wechat.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "wechat")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_wechat.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "wechat")), lv.EVENT.PRESSING, None) + MainMenu1_img_wechat_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "wechat")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_wechat_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "wechat")), lv.EVENT.PRESSING, None) - MainMenu1_img_alarm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "clk_list")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_alarm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "clk_list")), lv.EVENT.PRESSING, None) + MainMenu1_img_alarm_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "clk_list")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_alarm_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "clk_list")), lv.EVENT.PRESSING, None) - MainMenu1_img_stopwatch.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "stopwatch")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_stopwatch.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "stopwatch")), lv.EVENT.PRESSING, None) + MainMenu1_img_stopwatch_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "stopwatch")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_stopwatch_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "stopwatch")), lv.EVENT.PRESSING, None) - MainMenu1_img_countdown.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "countdown")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_countdown.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "countdown")), lv.EVENT.PRESSING, None) + MainMenu1_img_countdown_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "countdown")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_countdown_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "countdown")), lv.EVENT.PRESSING, None) - MainMenu1_img_toolbox.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_toolbox.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.PRESSING, None) + MainMenu1_img_toolbox_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_toolbox_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.PRESSING, None) - MainMenu1_img_setting.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_setting.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.PRESSING, None) + MainMenu1_img_setting_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_setting_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.PRESSING, None) ##2 print("MainMenu1:__init__") MainMenu2_til.add_event_cb(lambda e: EventMesh.callback_wrapper(self.scroll_begin_event_cb(e)),lv.EVENT.SCROLL_END,None) diff --git a/2.sdk/project/C06S/usr/static/theme1/THEME1_ALARM.png b/2.sdk/project/C06S/usr/static/theme1/THEME1_ALARM.png deleted file mode 100644 index ad9e633c..00000000 Binary files a/2.sdk/project/C06S/usr/static/theme1/THEME1_ALARM.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/theme1/THEME1_BLOOD_PRESSURE.png b/2.sdk/project/C06S/usr/static/theme1/THEME1_BLOOD_PRESSURE.png deleted file mode 100644 index efec587c..00000000 Binary files a/2.sdk/project/C06S/usr/static/theme1/THEME1_BLOOD_PRESSURE.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/theme1/THEME1_CALLLOG.png b/2.sdk/project/C06S/usr/static/theme1/THEME1_CALLLOG.png deleted file mode 100644 index 0443c24b..00000000 Binary files a/2.sdk/project/C06S/usr/static/theme1/THEME1_CALLLOG.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/theme1/THEME1_CONTACTS.png b/2.sdk/project/C06S/usr/static/theme1/THEME1_CONTACTS.png index 36aa56dc..62a58017 100644 Binary files a/2.sdk/project/C06S/usr/static/theme1/THEME1_CONTACTS.png and b/2.sdk/project/C06S/usr/static/theme1/THEME1_CONTACTS.png differ diff --git a/2.sdk/project/C06S/usr/static/theme1/THEME1_COUNTDOWN.png b/2.sdk/project/C06S/usr/static/theme1/THEME1_COUNTDOWN.png deleted file mode 100644 index 61198675..00000000 Binary files a/2.sdk/project/C06S/usr/static/theme1/THEME1_COUNTDOWN.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/theme1/THEME1_HEART.png b/2.sdk/project/C06S/usr/static/theme1/THEME1_HEART.png index 19439872..78a53914 100644 Binary files a/2.sdk/project/C06S/usr/static/theme1/THEME1_HEART.png and b/2.sdk/project/C06S/usr/static/theme1/THEME1_HEART.png differ diff --git a/2.sdk/project/C06S/usr/static/theme1/THEME1_PHONE.png b/2.sdk/project/C06S/usr/static/theme1/THEME1_PHONE.png deleted file mode 100644 index 4a09abf2..00000000 Binary files a/2.sdk/project/C06S/usr/static/theme1/THEME1_PHONE.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/theme1/THEME1_SETTING.png b/2.sdk/project/C06S/usr/static/theme1/THEME1_SETTING.png deleted file mode 100644 index dea88574..00000000 Binary files a/2.sdk/project/C06S/usr/static/theme1/THEME1_SETTING.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/theme1/THEME1_SMS.png b/2.sdk/project/C06S/usr/static/theme1/THEME1_SMS.png deleted file mode 100644 index 97539b35..00000000 Binary files a/2.sdk/project/C06S/usr/static/theme1/THEME1_SMS.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/theme1/THEME1_SPO2.png b/2.sdk/project/C06S/usr/static/theme1/THEME1_SPO2.png deleted file mode 100644 index 3a75c878..00000000 Binary files a/2.sdk/project/C06S/usr/static/theme1/THEME1_SPO2.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/theme1/THEME1_STOPWATCH.png b/2.sdk/project/C06S/usr/static/theme1/THEME1_STOPWATCH.png deleted file mode 100644 index ad173206..00000000 Binary files a/2.sdk/project/C06S/usr/static/theme1/THEME1_STOPWATCH.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/theme1/THEME1_TEMP.png b/2.sdk/project/C06S/usr/static/theme1/THEME1_TEMP.png deleted file mode 100644 index a4202856..00000000 Binary files a/2.sdk/project/C06S/usr/static/theme1/THEME1_TEMP.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/theme1/THEME1_TOOLBOX.png b/2.sdk/project/C06S/usr/static/theme1/THEME1_TOOLBOX.png index dbc4f5eb..620bddab 100644 Binary files a/2.sdk/project/C06S/usr/static/theme1/THEME1_TOOLBOX.png and b/2.sdk/project/C06S/usr/static/theme1/THEME1_TOOLBOX.png differ diff --git a/2.sdk/project/C06S/usr/static/theme1/THEME1_WECHAT.png b/2.sdk/project/C06S/usr/static/theme1/THEME1_WECHAT.png index 93947f80..8119a4f5 100644 Binary files a/2.sdk/project/C06S/usr/static/theme1/THEME1_WECHAT.png and b/2.sdk/project/C06S/usr/static/theme1/THEME1_WECHAT.png differ diff --git a/2.sdk/project/D10/audio.bin b/2.sdk/project/D10/audio.bin index 7747eb95..7ff1a313 100644 Binary files a/2.sdk/project/D10/audio.bin and b/2.sdk/project/D10/audio.bin differ diff --git a/2.sdk/project/D10/audio/R_CUR_BATTERY_LEVEL.mp3 b/2.sdk/project/D10/audio/R_CUR_BATTERY_LEVEL.mp3 new file mode 100644 index 00000000..bef27e37 Binary files /dev/null and b/2.sdk/project/D10/audio/R_CUR_BATTERY_LEVEL.mp3 differ diff --git a/2.sdk/project/D10/list.json b/2.sdk/project/D10/list.json index 41bb4773..4a528dea 100644 --- a/2.sdk/project/D10/list.json +++ b/2.sdk/project/D10/list.json @@ -1 +1 @@ -['R_CALL_mp3'] \ No newline at end of file +['audio_find_haixiu', 'R_ALARM_NEW', 'R_BLOOD_SUGAR', 'R_CALL_mp3', 'R_CHARGE_FULL', 'R_CHARGE_IN', 'R_CHARGE_OUT', 'R_CUR_BATTERY_LEVEL', 'R_DRINK_ALARM', 'R_FALL_ALARM', 'R_HOME_ALARM', 'R_HSENSOR_RESULT_FAILE', 'R_HSENSOR_RESULT_HR_TITLE', 'R_HSENSOR_RESULT_OK', 'R_HSENSOR_SPO2_TITLE', 'R_HSENSOR_TEMP_TITLE', 'R_MEDICINE_ALARM', 'R_NO_SET_SOS_DIAL', 'R_NO_SIM', 'R_POWER_OFF_1', 'R_READ_STEP_0', 'R_READ_STEP_1', 'R_READ_STEP_2', 'R_READ_STEP_3', 'R_READ_STEP_4', 'R_READ_TIME_0', 'R_READ_TIME_1', 'R_READ_TIME_2', 'R_READ_TIME_3', 'R_READ_TIME_4', 'R_READ_TIME_5', 'R_READ_TIME_6', 'R_READ_TIME_7', 'R_READ_TIME_8', 'R_READ_TIME_9', 'R_READ_TIME_MIN', 'R_READ_TIME_ZHENG', 'R_RESET_ALARM', 'R_RESET_END_ALARM', 'R_SIM_CONNECT', 'R_SIM_FAILE', 'R_SLEEP_ALARM', 'R_SOS_ALERT', 'R_TSENSOR_RESULT_VALUE_DOT', 'R_UNREAD_WECHAT', 'R_WAKEUP_ALARM', 'R_WECHAT_RECV'] \ No newline at end of file diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/EventMesh.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/EventMesh.py index e798b592..3714ec8d 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/EventMesh.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/EventMesh.py @@ -104,17 +104,17 @@ debug_Log = 1 def debug_log(*data): if debug_Log != 0 : print(data) -Txt_Log = 0 +Txt_Log = 1 def txt_log(data): if Txt_Log != 0 : print(data) try: - f_stat = uos.stat("ext/log.txt") + f_stat = uos.stat("usr/log.txt") if f_stat[6] >50*1024: - uos.remove("ext/log.txt") + uos.remove("usr/log.txt") except Exception as e: usys.print_exception(e) - with open("/ext/log.txt","a",encoding="utf-8") as fd: + with open("/usr/log.txt","a",encoding="utf-8") as fd: d_time = utime.localtime() data_tmp = "%02d-%02d %02d:%02d:%02d :"%(d_time[1],d_time[2],d_time[3],d_time[4],d_time[5]) fd.write(data_tmp+data+"\n") diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py index 289d8580..9c81cb4f 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py @@ -28,8 +28,7 @@ if EventMesh.model == "D10_" : def close_motor(): motor_pin.write(0) - audio_buf = ['audio_find_haixiu', 'R_ALARM_NEW', 'R_BLOOD_SUGAR', 'R_CALL_mp3', 'R_CHARGE_FULL', 'R_CHARGE_IN', 'R_CHARGE_OUT', 'R_DRINK_ALARM', 'R_FALL_ALARM', 'R_HOME_ALARM', 'R_HSENSOR_RESULT_FAILE', 'R_HSENSOR_RESULT_HR_TITLE', 'R_HSENSOR_RESULT_OK', 'R_HSENSOR_SPO2_TITLE', 'R_HSENSOR_TEMP_TITLE', 'R_MEDICINE_ALARM', 'R_NO_SET_SOS_DIAL', 'R_NO_SIM', 'R_POWER_OFF_1', 'R_READ_STEP_0', 'R_READ_STEP_1', 'R_READ_STEP_2', 'R_READ_STEP_3', 'R_READ_STEP_4', 'R_READ_TIME_0', 'R_READ_TIME_1', 'R_READ_TIME_2', 'R_READ_TIME_3', 'R_READ_TIME_4', 'R_READ_TIME_5', 'R_READ_TIME_6', 'R_READ_TIME_7', 'R_READ_TIME_8', 'R_READ_TIME_9', 'R_READ_TIME_MIN', 'R_READ_TIME_ZHENG', 'R_RESET_ALARM', 'R_RESET_END_ALARM', 'R_SIM_CONNECT', 'R_SIM_FAILE', 'R_SLEEP_ALARM', 'R_SOS_ALERT', 'R_TSENSOR_RESULT_VALUE_DOT', 'R_UNREAD_WECHAT', 'R_WAKEUP_ALARM', 'R_WECHAT_RECV'] - + audio_buf = ['audio_find_haixiu', 'R_ALARM_NEW', 'R_BLOOD_SUGAR', 'R_CALL_mp3', 'R_CHARGE_FULL', 'R_CHARGE_IN', 'R_CHARGE_OUT', 'R_CUR_BATTERY_LEVEL', 'R_DRINK_ALARM', 'R_FALL_ALARM', 'R_HOME_ALARM', 'R_HSENSOR_RESULT_FAILE', 'R_HSENSOR_RESULT_HR_TITLE', 'R_HSENSOR_RESULT_OK', 'R_HSENSOR_SPO2_TITLE', 'R_HSENSOR_TEMP_TITLE', 'R_MEDICINE_ALARM', 'R_NO_SET_SOS_DIAL', 'R_NO_SIM', 'R_POWER_OFF_1', 'R_READ_STEP_0', 'R_READ_STEP_1', 'R_READ_STEP_2', 'R_READ_STEP_3', 'R_READ_STEP_4', 'R_READ_TIME_0', 'R_READ_TIME_1', 'R_READ_TIME_2', 'R_READ_TIME_3', 'R_READ_TIME_4', 'R_READ_TIME_5', 'R_READ_TIME_6', 'R_READ_TIME_7', 'R_READ_TIME_8', 'R_READ_TIME_9', 'R_READ_TIME_MIN', 'R_READ_TIME_ZHENG', 'R_RESET_ALARM', 'R_RESET_END_ALARM', 'R_SIM_CONNECT', 'R_SIM_FAILE', 'R_SLEEP_ALARM', 'R_SOS_ALERT', 'R_TSENSOR_RESULT_VALUE_DOT', 'R_UNREAD_WECHAT', 'R_WAKEUP_ALARM', 'R_WECHAT_RECV'] class intervManager(Abstract): @@ -621,7 +620,9 @@ if EventMesh.model == "D10_" : def play_audio_file(self, *args, **kwargs):#播放音频文件 # EventMesh.debug_log("args",args) - EventMesh.publish("publish_message_event_audio",{"func":self.play_audio_file_do,"data":args[1]}) + # EventMesh.publish("publish_message_event_audio",{"func":self.play_audio_file_do,"data":args[1]}) + data = args[1] + self.play_audio_file_do(data) def play_audio_file_do(self,data):#msg 拼接的路径文件 open_power = EventMesh.publish("get_power_on_state")#获取开机标识 @@ -819,7 +820,7 @@ if EventMesh.model == "D10_" : def dialing_out_event(self, event, msg):#侧边金属按键挂断电话呼叫中 flag = EventMesh.publish("get_call_state") - if flag == 1:#电话呼叫中 + if flag == 1 or flag == 3:#电话呼叫中 self.call_state = 0 voiceCall.callEnd() @@ -1099,19 +1100,19 @@ if EventMesh.model == "D10_" : EventMesh.debug_log("stop debug8") EventMesh.publish(constants.EVENT.STOP_HEART) - elif get_spo2_state != 0: + if get_spo2_state != 0: EventMesh.publish("set_spo2_state",0)#2代表后台进入测试 if get_spo2_state == 1: EventMesh.publish("stop_led_timer")#设置参数 EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) EventMesh.debug_log("stop debug13") - elif get_bp_state != 0: + if get_bp_state != 0: EventMesh.publish("set_bp_state",0)#2代表后台进入测试 if get_bp_state == 1: EventMesh.publish("stop_led_timer")#设置参数 EventMesh.publish(constants.EVENT.STOP_HEART) EventMesh.debug_log("stop bp debug1") - elif get_bg_state != 0: + if get_bg_state != 0: EventMesh.publish("set_bg_state",0)#2代表后台进入测试 if get_bg_state == 1:#手动开灯关闭灯 EventMesh.publish("stop_led_timer")#设置参数 @@ -1122,7 +1123,7 @@ if EventMesh.model == "D10_" : EventMesh.publish("set_temp_state",0)#2代表后台进入测试 if get_temp_state == 1: EventMesh.publish("stop_led_timer")#设置参数 - EventMesh.publish("get_start_temp_measure_time",0)# + EventMesh.publish("set_start_temp_measure_time",0)# EventMesh.publish(constants.EVENT.STOP_TEMP) EventMesh.debug_log("stop temp debug14") if msg == 1: @@ -1367,7 +1368,12 @@ if EventMesh.model == "D10_" : if msg == 1: if get_hr_state != 1:#不是手动测试直接打断 EventMesh.debug_log("set_manual_measure_mode",msg) + EventMesh.publish("set_spo2_state",0) + EventMesh.publish("set_bg_state",0) + EventMesh.publish("set_bp_state",0) + EventMesh.publish("set_hr_state",1) + EventMesh.publish("clear_manual_hr_flag") EventMesh.publish("set_start_measure_time",1)#设置开始测量的时间戳时间 EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) #停止测试血氧 EventMesh.publish("set_hr_blood_led",1) @@ -1383,6 +1389,7 @@ if EventMesh.model == "D10_" : elif msg == 3: if get_temp_state != 1: EventMesh.debug_log("set_manual_measure_mode",msg) + EventMesh.publish("clear_manual_temp_flag") EventMesh.publish("set_temp_state",1) EventMesh.publish("set_start_temp_measure_time",1)#设置开始测量的时间戳时间 EventMesh.publish("set_hr_blood_led",1) diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m_d15.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m_d15.py index 93ef8d39..3987c089 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m_d15.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m_d15.py @@ -22,8 +22,7 @@ from Gsensor import SC7A20 if EventMesh.model == "D15_" : motor_pin = Pin(Pin.GPIO20, Pin.OUT, Pin.PULL_PD, 0) - audio_buf = ['audio_find_haixiu', 'R_ALARM_NEW', 'R_BLOOD_SUGAR', 'R_CALL_mp3', 'R_CHARGE_FULL', 'R_CHARGE_IN', 'R_CHARGE_OUT', 'R_DRINK_ALARM', 'R_FALL_ALARM', 'R_HOME_ALARM', 'R_HSENSOR_RESULT_FAILE', 'R_HSENSOR_RESULT_HR_TITLE', 'R_HSENSOR_RESULT_OK', 'R_HSENSOR_SPO2_TITLE', 'R_HSENSOR_TEMP_TITLE', 'R_MEDICINE_ALARM', 'R_NO_SET_SOS_DIAL', 'R_NO_SIM', 'R_POWER_OFF_1', 'R_READ_STEP_0', 'R_READ_STEP_1', 'R_READ_STEP_2', 'R_READ_STEP_3', 'R_READ_STEP_4', 'R_READ_TIME_0', 'R_READ_TIME_1', 'R_READ_TIME_2', 'R_READ_TIME_3', 'R_READ_TIME_4', 'R_READ_TIME_5', 'R_READ_TIME_6', 'R_READ_TIME_7', 'R_READ_TIME_8', 'R_READ_TIME_9', 'R_READ_TIME_MIN', 'R_READ_TIME_ZHENG', 'R_RESET_ALARM', 'R_RESET_END_ALARM', 'R_SIM_CONNECT', 'R_SIM_FAILE', 'R_SLEEP_ALARM', 'R_SOS_ALERT', 'R_TSENSOR_RESULT_VALUE_DOT', 'R_UNREAD_WECHAT', 'R_WAKEUP_ALARM', 'R_WECHAT_RECV'] - + audio_buf = ['audio_find_haixiu', 'R_ALARM_NEW', 'R_BLOOD_SUGAR', 'R_CALL_mp3', 'R_CHARGE_FULL', 'R_CHARGE_IN', 'R_CHARGE_OUT', 'R_CUR_BATTERY_LEVEL', 'R_DRINK_ALARM', 'R_FALL_ALARM', 'R_HOME_ALARM', 'R_HSENSOR_RESULT_FAILE', 'R_HSENSOR_RESULT_HR_TITLE', 'R_HSENSOR_RESULT_OK', 'R_HSENSOR_SPO2_TITLE', 'R_HSENSOR_TEMP_TITLE', 'R_MEDICINE_ALARM', 'R_NO_SET_SOS_DIAL', 'R_NO_SIM', 'R_POWER_OFF_1', 'R_READ_STEP_0', 'R_READ_STEP_1', 'R_READ_STEP_2', 'R_READ_STEP_3', 'R_READ_STEP_4', 'R_READ_TIME_0', 'R_READ_TIME_1', 'R_READ_TIME_2', 'R_READ_TIME_3', 'R_READ_TIME_4', 'R_READ_TIME_5', 'R_READ_TIME_6', 'R_READ_TIME_7', 'R_READ_TIME_8', 'R_READ_TIME_9', 'R_READ_TIME_MIN', 'R_READ_TIME_ZHENG', 'R_RESET_ALARM', 'R_RESET_END_ALARM', 'R_SIM_CONNECT', 'R_SIM_FAILE', 'R_SLEEP_ALARM', 'R_SOS_ALERT', 'R_TSENSOR_RESULT_VALUE_DOT', 'R_UNREAD_WECHAT', 'R_WAKEUP_ALARM', 'R_WECHAT_RECV'] class call: CALL_OUT = 1 CALL_IN = 2 @@ -167,6 +166,8 @@ if EventMesh.model == "D15_" : EventMesh.subscribe("play_sugar_value", self.play_sugar_value)#播放血糖数值 + EventMesh.subscribe("play_battery_level_value", self.play_battery_level_value) + EventMesh.subscribe("set_usb", self.set_usb)# EventMesh.subscribe("get_usb", self.get_usb)# @@ -619,7 +620,9 @@ if EventMesh.model == "D15_" : def play_audio_file(self, *args, **kwargs):#播放音频文件 # EventMesh.debug_log("args",args) - EventMesh.publish("publish_message_event_audio",{"func":self.play_audio_file_do,"data":args[1]}) + # EventMesh.publish("publish_message_event_audio",{"func":self.play_audio_file_do,"data":args[1]}) + data = args[1] + self.play_audio_file_do(data) def play_audio_file_do(self,data):#msg 拼接的路径文件 open_power = EventMesh.publish("get_power_on_state")#获取开机标识 @@ -745,6 +748,7 @@ if EventMesh.model == "D15_" : if self.call_state == 0: self.phone_num = '' EventMesh.publish("close_timer_all")# + EventMesh.publish("set_led_time_arg",[1,2,8,led_mode.FLASH_LIGHT_GREEN,8,4,led_mode.OTHER_MEASURE_MODE])# if msg == None: str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_NO_SET_SOS_DIAL")) EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件 @@ -817,7 +821,7 @@ if EventMesh.model == "D15_" : def dialing_out_event(self, event, msg):#侧边金属按键挂断电话呼叫中 flag = EventMesh.publish("get_call_state") - if flag == 1:#电话呼叫中 + if flag == 1 or flag == 3:#电话呼叫中 或者在正在通话中 self.call_state = 0 voiceCall.callEnd() @@ -1097,19 +1101,19 @@ if EventMesh.model == "D15_" : EventMesh.debug_log("stop debug8") EventMesh.publish(constants.EVENT.STOP_HEART) - elif get_spo2_state != 0: + if get_spo2_state != 0: EventMesh.publish("set_spo2_state",0)#2代表后台进入测试 if get_spo2_state == 1: EventMesh.publish("stop_led_timer")#设置参数 EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) EventMesh.debug_log("stop debug13") - elif get_bp_state != 0: + if get_bp_state != 0: EventMesh.publish("set_bp_state",0)#2代表后台进入测试 if get_bp_state == 1: EventMesh.publish("stop_led_timer")#设置参数 EventMesh.publish(constants.EVENT.STOP_HEART) EventMesh.debug_log("stop bp debug1") - elif get_bg_state != 0: + if get_bg_state != 0: EventMesh.publish("set_bg_state",0)#2代表后台进入测试 if get_bg_state == 1:#手动开灯关闭灯 EventMesh.publish("stop_led_timer")#设置参数 @@ -1120,7 +1124,7 @@ if EventMesh.model == "D15_" : EventMesh.publish("set_temp_state",0)#2代表后台进入测试 if get_temp_state == 1: EventMesh.publish("stop_led_timer")#设置参数 - EventMesh.publish("get_start_temp_measure_time",0)# + EventMesh.publish("set_start_temp_measure_time",0)# EventMesh.publish(constants.EVENT.STOP_TEMP) EventMesh.debug_log("stop temp debug14") if msg == 1: @@ -1365,7 +1369,12 @@ if EventMesh.model == "D15_" : if msg == 1: if get_hr_state != 1:#不是手动测试直接打断 EventMesh.debug_log("set_manual_measure_mode",msg) + EventMesh.publish("set_spo2_state",0) + EventMesh.publish("set_bg_state",0) + EventMesh.publish("set_bp_state",0) + EventMesh.publish("set_hr_state",1) + EventMesh.publish("clear_manual_hr_flag") EventMesh.publish("set_start_measure_time",1)#设置开始测量的时间戳时间 EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) #停止测试血氧 EventMesh.publish("set_hr_blood_led",1) @@ -1381,6 +1390,7 @@ if EventMesh.model == "D15_" : elif msg == 3: if get_temp_state != 1: EventMesh.debug_log("set_manual_measure_mode",msg) + EventMesh.publish("clear_manual_temp_flag") EventMesh.publish("set_temp_state",1) EventMesh.publish("set_start_temp_measure_time",1)#设置开始测量的时间戳时间 EventMesh.publish("set_hr_blood_led",1) @@ -1543,6 +1553,38 @@ if EventMesh.model == "D15_" : EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data) + def play_battery_level_value(self, event, msg): #播放当前电量 + flag = EventMesh.publish("get_call_state") + if flag == 0 and self.fall_flag == 0:#电话通话中 或者呼叫中挂断中断 + EventMesh.publish("close_timer_all")# + battery = EventMesh.publish("screen_get_battery") + print("cur level",battery) + level = 100 + if battery == None: + level = 100 + else: + level = battery[1] + data = level + if data > 100: + data = 100 + if data == 100: + str_data = 'mp3files={}.mp3+{}.mp3+{}.mp3'.format(audio_buf.index("R_CUR_BATTERY_LEVEL"),audio_buf.index("R_READ_TIME_1"),\ + audio_buf.index("R_READ_STEP_2")) + EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data) + return + + if data%10 == 0: + str_data = 'mp3files={}.mp3+{}.mp3+{}.mp3'.format(audio_buf.index("R_CUR_BATTERY_LEVEL"),audio_buf.index("R_READ_TIME_{}".format(data//10)),\ + audio_buf.index("R_READ_STEP_3")) + EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data) + else: + str_data = 'mp3files={}.mp3+{}.mp3+{}.mp3+{}.mp3'.format(audio_buf.index("R_CUR_BATTERY_LEVEL"),audio_buf.index("R_READ_TIME_{}".format(data//10)),\ + audio_buf.index("R_READ_STEP_3"),audio_buf.index("R_READ_TIME_{}".format(data%10))) + EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data) + + + + def play_sugar_value(self, event, msg): #播放血糖数值 flag = EventMesh.publish("get_call_state") if msg != None: @@ -2255,7 +2297,7 @@ if EventMesh.model == "D15_" : self.pwk_key26 = ExtInt(ExtInt.GPIO26, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_DISABLE, self.pwk_extint_cb) self.pwk_key26.enable() - self.sosKey = ExtInt(ExtInt.GPIO22,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.sosKey_extint_cb)#S0S键 + self.sosKey = ExtInt(ExtInt.GPIO6,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.sosKey_extint_cb)#S0S键 self.sosKey.enable() self.extint_19 = ExtInt(ExtInt.GPIO19,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.key19_extint_cb) @@ -2267,7 +2309,7 @@ if EventMesh.model == "D15_" : # self.sosKey = ExtInt(ExtInt.GPIO22, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.sosKey_extint_cb) # self.sosKey.enable() - self.wechatKey = ExtInt(ExtInt.GPIO6, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.wechatKey_extint_cb) + self.wechatKey = ExtInt(ExtInt.GPIO22, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.wechatKey_extint_cb) self.wechatKey.enable() # key19 = Pin(Pin.GPIO19, Pin.OUT, Pin.PULL_PU, 0) @@ -2288,15 +2330,23 @@ if EventMesh.model == "D15_" : fall_down = EventMesh.publish("get_fall_down_state")#跌倒报警标识 flag = EventMesh.publish("get_call_state")#在通话或者电话拨进 或者拨出不允许寻找设备 if fall_down != None: - if fall_down != 0 or flag == 2: + if fall_down != 0: return + self.KeyCall2_status = int(args[1]) + # EventMesh.txt_log('self.KeyCall2_level :{}'.format(args,self.KeyCall2_status,GPIO17_status)) if self.KeyCall2_status == 0: self.KeyCall2_status = 1 else: self.KeyCall2_status = 0 pass - EventMesh.debug_log('### key17_extint_cb {} self.KeyCall2_status :{}'.format(args,self.KeyCall2_status)) # args[0]:gpio号 args[1]:上升沿或下降沿 + self.WeChatKey_status = self.wechatKey.read_level() + self.GPIO26_status = self.pwk_key26.read_level() + self.KeyCall1_status = self.extint_19.read_level() + self.sosKey_status = self.sosKey.read_level() + # EventMesh.debug_log('key17_extint_cb ',args,self.KeyCall2_status,self.WeChatKey_status,self.sosKey_status,self.KeyCall1_status,self.GPIO26_status) # args[0]:gpio号 args[1]:上升沿或下降沿 + + # EventMesh.debug_log('key17_extint_cb',args,self.KeyCall2_status,self.WeChatKey_status,self.GPIO26_status,self.KeyCall1_status,self.sosKey_status) # args[0]:gpio号 args[1]:上升沿或下降沿 if self.WeChatKey_status != 0 and self.GPIO26_status != 0 and self.KeyCall1_status != 0 and self.sosKey_status != 0: if self.KeyCall2_status == 0:#按下 if self.Keycall2_press == 0 : @@ -2306,18 +2356,22 @@ if EventMesh.model == "D15_" : self.Keycall2_timer.stop() self.Keycall1_timer.stop() - self.wechatKey_press_count = 0 - self.wechatKey_press = 0 - - self.pwKey_press_count = 0 + self.pwkey_count = 0 self.pwkey_press = 0 - - self.sosKey_long_press = 0 + self.led_state = 0 + self.pwKey_press_count=0 #电源键 + self.sosKey_count = 0 + self.sosKey_press = 0 + self.sosKey_press_count=0#sos键 + + self.wechatKey_count = 0 + self.wechatKey_press = 0 + self.wechatKey_press_count=0#微聊键 self.Keycall1_count = 0 self.Keycall1_press = 0 - self.Keycall1_press_count = 0 + self.Keycall1_press_count = 0#call 1键 self.Keycall2_count = 0 self.Keycall2_press = 1 @@ -2326,8 +2380,21 @@ if EventMesh.model == "D15_" : def call2Key_press_cb(self, data): '''KEY2:联动屏幕右下角或返回键长按关机''' if self.Keycall2_press == 1 : + self.Keycall2_count += 1 + if self.Keycall2_count >= 10*3: #长按3s + self.Keycall2_count = 0 + self.Keycall2_press = 0 + self.Keycall2_press_count = 0 + self.Keycall2_timer.stop() + flag = EventMesh.publish("get_call_state")#获取通话状态 + fall_down = EventMesh.publish("get_fall_down_state")#跌倒报警标识 + if fall_down != None: + if fall_down != 0 or flag == 2: + return + EventMesh.publish("stop_led_timer")#设置参数 + EventMesh.publish("call_phonebook_one_call") + if self.KeyCall2_status == 1:#松开 - self.Keycall2_count += 1 if self.Keycall2_count >= 1: #防抖100ms self.Keycall2_timer.stop() self.Keycall2_count = 0 @@ -2341,16 +2408,33 @@ if EventMesh.model == "D15_" : def call2Key_timeout_cb(self, data):# flag = EventMesh.publish("get_call_state")#在通话或者电话拨进 或者拨出不允许寻找设备 fall_down = EventMesh.publish("get_fall_down_state")#跌倒报警标识 - if self.Keycall2_press_count >= 1:#短按十次解绑app - fall_down = EventMesh.publish("get_fall_down_state")#跌倒报警标识 + # print("call2Key_timeout_cb",self.Keycall2_press_count,flag) + if self.Keycall2_press_count > 1:# if fall_down != None: if fall_down != 0 or flag != 0:#在打电话或者跌倒报警提醒中不允许按键触发 self.Keycall2_press_count = 0 return - if self.Keycall2_press_count == 1:#拨打通讯录号码二 + if self.Keycall2_press_count == 3:#心率血压测试 + self.Keycall2_press_count = 0 + call_state = EventMesh.publish("get_call_state") + battery = EventMesh.publish("screen_get_battery") + if call_state == None: + call_state = 0 + if call_state == 0: + if battery != None: + if battery[0] != "1":#在充电得时候 + EventMesh.publish("stop_led_timer")#设置参数 + EventMesh.publish("set_manual_measure_mode",1)# + elif self.Keycall2_press_count == 1:# self.Keycall2_press_count = 0 EventMesh.publish("stop_led_timer")#设置参数 - EventMesh.publish("call_phonebook_two_call") + call_state = EventMesh.publish("get_call_state") + if call_state == 2:#电话拨进需要接听 + EventMesh.publish("answer_call_event")#接听电话 + return + EventMesh.publish("play_cur_step_event")##播放当前步数 + + self.Keycall2_press_count = 0 @@ -2367,17 +2451,20 @@ if EventMesh.model == "D15_" : fall_down = EventMesh.publish("get_fall_down_state")#跌倒报警标识 flag = EventMesh.publish("get_call_state")#在通话或者电话拨进 或者拨出不允许寻找设备 if fall_down != None: - if fall_down != 0 or flag == 2: + if fall_down != 0: return - # self.KeyCall1_status = self.extint_19.read_level() - # self.KeyCall1_status = ~args[1] self.KeyCall1_status = int(args[1]) if self.KeyCall1_status == 0: self.KeyCall1_status = 1 else: self.KeyCall1_status = 0 pass - EventMesh.debug_log('### key19_extint_cb {} self.KeyCall1_status :{}'.format(args,self.KeyCall1_status)) # args[0]:gpio号 args[1]:上升沿或下降沿 + self.WeChatKey_status = self.wechatKey.read_level() + self.GPIO26_status = self.pwk_key26.read_level() + self.KeyCall2_status = self.extint_17.read_level() + self.sosKey_status = self.sosKey.read_level() + # EventMesh.debug_log('key19_extint_cb ',args,self.KeyCall1_status,self.GPIO26_status,self.WeChatKey_status,self.sosKey_status,self.KeyCall2_status,self.GPIO26_status) # args[0]:gpio号 args[1]:上升沿或下降沿 + # EventMesh.debug_log('self.KeyCall1_status :{}',args,self.KeyCall1_status) # args[0]:gpio号 args[1]:上升沿或下降沿 if self.WeChatKey_status != 0 and self.GPIO26_status != 0 and self.KeyCall2_status != 0 and self.sosKey_status != 0: if self.KeyCall1_status == 0:#按下 if self.Keycall1_press == 0 : @@ -2387,14 +2474,18 @@ if EventMesh.model == "D15_" : self.Keycall2_timer.stop() self.Keycall1_timer.stop() - self.wechatKey_press_count = 0 - self.wechatKey_press = 0 - - self.pwKey_press_count = 0 + self.pwkey_count = 0 self.pwkey_press = 0 - - self.sosKey_long_press = 0 + self.led_state = 0 + self.pwKey_press_count=0 + self.sosKey_count = 0 + self.sosKey_press = 0 + self.sosKey_press_count=0 + + self.wechatKey_count = 0 + self.wechatKey_press = 0 + self.wechatKey_press_count=0 self.Keycall2_count = 0 self.Keycall2_press = 0 @@ -2407,8 +2498,21 @@ if EventMesh.model == "D15_" : def call1Key_press_cb(self, data): '''KEY2:联动屏幕右下角或返回键长按关机''' if self.Keycall1_press == 1 : + self.Keycall1_count += 1 + if self.Keycall1_count >= 10*3: #长按3s + self.Keycall1_count = 0 + self.Keycall1_press = 0 + self.Keycall1_press_count = 0 + self.Keycall1_timer.stop() + flag = EventMesh.publish("get_call_state")#获取通话状态 + fall_down = EventMesh.publish("get_fall_down_state")#跌倒报警标识 + if fall_down != None: + if fall_down != 0 or flag == 2: + return + EventMesh.publish("stop_led_timer")#设置参数 + EventMesh.publish("call_phonebook_two_call") + if self.KeyCall1_status == 1:#松开 - self.Keycall1_count += 1 if self.Keycall1_count >= 1: #防抖100ms self.Keycall1_timer.stop() self.Keycall1_count = 0 @@ -2420,17 +2524,35 @@ if EventMesh.model == "D15_" : EventMesh.publish("publish_message_event_btnInfo",{"func":self.call1Key_timeout_cb,"data":0}) def call1Key_timeout_cb(self, data):# - flag = EventMesh.publish("get_call_state")#在通话或者电话拨进 或者拨出不允许寻找设备 - fall_down = EventMesh.publish("get_fall_down_state")#跌倒报警标识 - if self.Keycall1_press_count >= 1:#短按十次解绑app + flag = EventMesh.publish("get_call_state")#获取通话状态 + fall_down = EventMesh.publish("get_fall_down_state")#获取跌倒报警标识 + # print("call1Key_timeout_cb",self.Keycall1_press_count,flag) + if self.Keycall1_press_count > 1:#短按十次解绑app if fall_down != None: if fall_down != 0 or flag != 0:#在打电话或者跌倒报警提醒中不允许按键触发 self.Keycall1_press_count = 0 return - if self.Keycall1_press_count == 1:#拨打通讯录号码一 + + if self.Keycall1_press_count == 3:#测试体温 + self.Keycall1_press_count = 0 + call_state = EventMesh.publish("get_call_state") + battery = EventMesh.publish("screen_get_battery") + if call_state == None: + call_state = 0 + if call_state == 0: + if battery != None: + if battery[0] != "1":#在充电得时候 + EventMesh.publish("stop_led_timer")#设置参数 + EventMesh.publish("set_manual_measure_mode",3)#测量体温 + elif self.Keycall1_press_count == 1:#拨打通讯录号码二 self.Keycall1_press_count = 0 EventMesh.publish("stop_led_timer")#设置参数 - EventMesh.publish("call_phonebook_one_call") + call_state = EventMesh.publish("get_call_state") + if call_state == 2:#电话拨进需要接听 + EventMesh.publish("answer_call_event")#接听电话 + return + EventMesh.publish("play_battery_level_value")#播放当前电量 + self.Keycall1_press_count = 0 @@ -2446,8 +2568,8 @@ if EventMesh.model == "D15_" : if open_power != None: if open_power == 0: return - flag = EventMesh.publish("get_call_state")#在通话或者电话拨进 或者拨出不允许寻找设备 - fall_down = EventMesh.publish("get_fall_down_state")#跌倒报警标识 + flag = EventMesh.publish("get_call_state")#获取通话状态 + fall_down = EventMesh.publish("get_fall_down_state")#获取跌倒报警标识 if fall_down != None: if fall_down != 0 or flag == 2: return @@ -2457,8 +2579,13 @@ if EventMesh.model == "D15_" : else: self.GPIO26_status = 0 pass + self.WeChatKey_status = self.wechatKey.read_level() + self.KeyCall2_status = self.extint_17.read_level() + self.KeyCall1_status = self.extint_19.read_level() + self.sosKey_status = self.sosKey.read_level() + # EventMesh.debug_log('pwk_extint_cb ',args,self.GPIO26_status,self.WeChatKey_status,self.sosKey_status,self.KeyCall1_status,self.KeyCall2_status) # args[0]:gpio号 args[1]:上升沿或下降沿 # self.GPIO26_status = ~args[1] - EventMesh.debug_log('### GPIO26_status {} self.GPIO26_status :{}'.format(args,self.GPIO26_status)) # args[0]:gpio号 args[1]:上升沿或下降沿 + # EventMesh.debug_log('### GPIO26_status {} self.GPIO26_status :{}'.format(args,self.GPIO26_status)) # args[0]:gpio号 args[1]:上升沿或下降沿 if self.WeChatKey_status != 0 and self.KeyCall1_status != 0 and self.sosKey_status != 0 and self.KeyCall2_status != 0: # if self.sosKey_status != 0 and self.WeChatKey_status != 0: if self.GPIO26_status == 0:#按下 @@ -2470,10 +2597,14 @@ if EventMesh.model == "D15_" : self.Keycall2_timer.stop() self.Keycall1_timer.stop() - self.wechatKey_press_count = 0 - self.sosKey_press_count = 0 + self.sosKey_count = 0 self.sosKey_press = 0 + self.sosKey_press_count=0 + + self.wechatKey_count = 0 self.wechatKey_press = 0 + self.wechatKey_press_count=0 + self.pwkey_press = 1 self.pwkey_count = 0 @@ -2625,24 +2756,36 @@ if EventMesh.model == "D15_" : else: self.sosKey_status = 0 pass - # self.sosKey_status = self.sosKey.read_level() - EventMesh.debug_log('### sosKey_extint_cb {} self.sosKey_status:{}'.format(args,self.sosKey_status)) # args[0]:gpio号 args[1]:上升沿或下降沿 - # if self.WeChatKey_status != 0 and self.GPIO26_status != 0: + + self.WeChatKey_status = self.wechatKey.read_level() + self.GPIO26_status = self.pwk_key26.read_level() + self.KeyCall1_status = self.extint_19.read_level() + self.KeyCall2_status = self.extint_17.read_level() + + # EventMesh.debug_log('sosKey_extint_cb ',args,self.sosKey_status,self.WeChatKey_status,self.KeyCall1_status,self.KeyCall2_status,self.GPIO26_status) # args[0]:gpio号 args[1]:上升沿或下降沿 if self.WeChatKey_status != 0 and self.GPIO26_status != 0 and self.KeyCall1_status != 0 and self.KeyCall2_status != 0: if self.sosKey_status == 0:#按下 - EventMesh.publish("close_falldown_alarm_event")#sos短按事件 + EventMesh.publish("close_falldown_alarm_event")#关闭跌倒报警提醒事件 if self.sosKey_press == 0 : - self.led_state = 0 self.wechatKey_timer.stop() self.pwkey_timer.stop() self.sosKey_timer.stop() self.Keycall2_timer.stop() self.Keycall1_timer.stop() - self.wechatKey_press_count = 0 - self.pwKey_press_count = 0 - self.sosKey_press = 1 + + + self.pwkey_count = 0 self.pwkey_press = 0 + self.led_state = 0 + self.pwKey_press_count=0 #电源键 + + + self.wechatKey_count = 0 self.wechatKey_press = 0 + self.wechatKey_press_count=0#微聊键 + + + self.sosKey_press = 1 self.sosKey_long_press = 0 self.sosKey_count = 0 @@ -2672,7 +2815,7 @@ if EventMesh.model == "D15_" : self.sosKey_long_press = 1 self.sosKey_press = 0 self.sosKey_timer.stop() - flag = EventMesh.publish("get_call_state")#在通话或者电话拨进 或者拨出不允许寻找设备 + flag = EventMesh.publish("get_call_state")#获取通话状态 fall_down = EventMesh.publish("get_fall_down_state")#跌倒报警标识 if fall_down != None: if fall_down != 0 or flag == 2: @@ -2692,7 +2835,7 @@ if EventMesh.model == "D15_" : EventMesh.publish("publish_message_event_btnInfo",{"func":self.sosKey_timeout_cb,"data":0}) def sosKey_timeout_cb(self, data):# # EventMesh.debug_log("sosKey_press_count!!!!!!!!!!!!!! ",self.sosKey_press_count) - flag = EventMesh.publish("get_call_state")#在通话或者电话拨进 或者拨出不允许寻找设备 + flag = EventMesh.publish("get_call_state")#获取通话状态 fall_down = EventMesh.publish("get_fall_down_state")#跌倒报警标识 if self.sosKey_press_count > 1:#短按十次解绑app if fall_down != None: @@ -2770,7 +2913,12 @@ if EventMesh.model == "D15_" : else: self.WeChatKey_status = 0 pass - EventMesh.debug_log('### wechatKey_extint_cb {} self.WeChatKey_status:{}'.format(args,self.WeChatKey_status)) # args[0]:gpio号 args[1]:上升沿或下降沿 + + self.sosKey_status = self.sosKey.read_level() + self.GPIO26_status = self.pwk_key26.read_level() + self.KeyCall1_status = self.extint_19.read_level() + self.KeyCall2_status = self.extint_17.read_level() + # EventMesh.debug_log('wechatKey_extint_cb ',args,self.WeChatKey_status,self.sosKey_status,self.KeyCall1_status,self.KeyCall2_status,self.GPIO26_status) # args[0]:gpio号 args[1]:上升沿或下降沿 # if self.sosKey_status != 0 and self.GPIO26_status != 0: if self.sosKey_status != 0 and self.GPIO26_status != 0 and self.KeyCall1_status != 0 and self.KeyCall2_status != 0: if self.WeChatKey_status == 0:#按下 @@ -2782,9 +2930,13 @@ if EventMesh.model == "D15_" : self.Keycall1_timer.stop() self.sosKey_press_count = 0 - self.pwKey_press_count = 0 self.sosKey_press = 0 + self.sosKey_count = 0 + self.pwkey_press = 0 + self.pwkey_count = 0 + self.pwKey_press_count=0 + self.wechatKey_press = 1 self.led_state = 0 self.wechatKey_count = 0 diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py index 77b00e53..1fcb3f69 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py @@ -958,6 +958,10 @@ class DeviceInfoManager(Abstract): EventMesh.subscribe("clear_sleep_alarm", self.clear_sleep_alarm) EventMesh.subscribe("clear_normal_alarm", self.clear_normal_alarm) + EventMesh.subscribe("clear_manual_hr_flag", self.clear_manual_hr_flag) + EventMesh.subscribe("clear_manual_temp_flag", self.clear_manual_temp_flag) + + EventMesh.subscribe("clear_usb_flag", self.clear_usb_flag) EventMesh.debug_log("post_processor_after_instantiation:2") @@ -971,6 +975,12 @@ class DeviceInfoManager(Abstract): EventMesh.debug_log("post_processor_after_instantiation:3") + def clear_manual_hr_flag(self,event,msg): + self.auto_hr_count = 0 + + def clear_manual_temp_flag(self,event,msg): + self.auto_temp_count = 0 + def publish_message_event_DeviceInfo(self,event,msg): self.DeviceInfo_queue.put(msg) @@ -1036,8 +1046,10 @@ class DeviceInfoManager(Abstract): self.temp_warning += 1 EventMesh.debug_log("temp_warning:{} get_temp_time{}".format(self.temp_warning,get_temp_time)) - if self.temp_warning*get_temp_time < 3:#高温没连续超过3次,和谐成37.5度以下 + if self.temp_warning < 5:#高温没连续超过3次,和谐成37.5度以下 temp = 37+(urandom.randint(1, 4)/10) + else: + self.temp_warning = 0 else: if self.temp_warning>=1: self.temp_warning -= 1 @@ -1285,33 +1297,57 @@ 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) - if get_temp_state > 2: - EventMesh.publish("stop_led_timer")#设置参数 + EventMesh.txt_log("auto stop_temp:22") + 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") + # print("wear faile") if self.get_hr_state > 1 : + EventMesh.txt_log("auto stop_hr:22") EventMesh.publish("set_hr_state",0)#2代表后台进入测试,定时测心率 1ui界面测试洗心率 - if self.get_hr_state > 2: - EventMesh.publish("stop_led_timer")#设置参数 EventMesh.publish(constants.EVENT.STOP_HEART) + if WEAR == 1: + heart_value = EventMesh.publish(constants.EVENT.GET_HEART) + if heart_value > 50 and heart_value != None: + EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据 - elif self.get_spo2_state > 1: + if self.get_spo2_state > 1: + EventMesh.txt_log("auto stop_spo2:22") EventMesh.publish("set_spo2_state",0)#2代表后台进入测试 - if self.get_spo2_state > 2: - EventMesh.publish("stop_led_timer")#设置参数 + EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) + spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN) + if WEAR == 1: + if spo2_value > 85 and spo2_value != None: + EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value) - elif get_bp_state > 1: + if get_bp_state > 1: + + EventMesh.txt_log("auto stop_bp:22") EventMesh.publish("set_bp_state",0)#2代表后台进入测试 - if get_bp_state > 2: - EventMesh.publish("stop_led_timer")#设置参数 EventMesh.publish(constants.EVENT.STOP_HEART) + if WEAR == 1: + blood_data = get_autoblood_value() + if blood_data == None: + blood_data[0] = 0 + blood_data[1] = 0 + + max_value = blood_data[0] + min_value = blood_data[1] + if max_value != 0 and min_value != 0: + EventMesh.publish(constants.PROTOCOL.BLOOD_SEND,[max_value,min_value]) + + if get_bg_state > 1: + EventMesh.txt_log("auto stop_bg:22") - elif get_bg_state > 1: EventMesh.publish("set_bg_state",0)#2代表后台进入测试 - if get_bg_state > 2: - EventMesh.publish("stop_led_timer")#设置参数 EventMesh.publish(constants.EVENT.STOP_HEART) + if WEAR == 1: + bg_data = get_blood_sugar_value() + if bg_data == None: + bg_data = 0 + if bg_data != 0: + # EventMesh.publish("play_sugar_value", bg_data)#播放血糖数值 + EventMesh.publish(constants.PROTOCOL.BLOODGLUSOCE_SEND,bg_data) if self.pull_time == 0: self.pull_time = time_tmp @@ -1356,22 +1392,16 @@ class DeviceInfoManager(Abstract): EventMesh.publish("set_hr_state",3)#2代表后台进入测试 # EventMesh.publish("set_hr_blood_led",1) EventMesh.publish(constants.EVENT.START_HEART) - print("hr start 3") + EventMesh.txt_log("auto start_hr:333") elif self.old_hr_time > 6: self.old_hr_time = 0 EventMesh.publish("set_hr_state",0)#2代表后台进入测试 - EventMesh.debug_log("stop hr 3 debug3") + EventMesh.txt_log("auto stop_hr:333") EventMesh.publish(constants.EVENT.STOP_HEART) heart_value = EventMesh.publish(constants.EVENT.GET_HEART) EventMesh.debug_log("heart_value:{}".format(heart_value)) if heart_value > 50 and heart_value != None: - # EventMesh.publish("play_hr_value",heart_value) EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据 - else: - # EventMesh.publish("play_hr_value",0) - pass - # EventMesh.publish("play_hr_value",0) - #获取心率数据上传数据app EventMesh.debug_log("STOP_HEART:3") else: self.old_hr_time = 0 @@ -1386,19 +1416,16 @@ class DeviceInfoManager(Abstract): EventMesh.publish("set_spo2_state",3)#2代表后台进入测试 # EventMesh.publish("set_hr_blood_led",1) EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)#K开血氧 - print("spo2 start 3") + EventMesh.txt_log("auto start_spo2:333") elif self.old_spo2_time > 6: self.old_spo2_time = 0 + EventMesh.txt_log("auto stop_spo2:333") 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("play_spo2_value",spo2_value) - # EventMesh.publish("set_old_spo2_data",spo2_value) EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value) - else: - # EventMesh.publish("play_spo2_value",0) - print("spo2 stop 3") + else: self.old_spo2_time = 0 else: @@ -1412,7 +1439,7 @@ class DeviceInfoManager(Abstract): EventMesh.publish("set_bp_state",3)#2代表后台进入测试 # EventMesh.publish("set_hr_blood_led",1) EventMesh.publish(constants.EVENT.START_HEART) - print("bp start ") + EventMesh.txt_log("auto start_bp:333") elif self.old_bp_time > 6: self.old_bp_time = 0 @@ -1426,11 +1453,9 @@ class DeviceInfoManager(Abstract): max_value = blood_data[0] min_value = blood_data[1] if max_value != 0 and min_value != 0: - EventMesh.publish("set_old_blood_data",[max_value,min_value]) - EventMesh.publish(constants.PROTOCOL.BLOOD_SEND,[max_value,min_value]) EventMesh.publish(constants.EVENT.STOP_HEART) - print("bp stop ") + EventMesh.txt_log("auto stop_bp:333") else: self.old_bp_time = 0 else: @@ -1443,7 +1468,7 @@ class DeviceInfoManager(Abstract): EventMesh.publish("set_bg_state",3)#2代表后台进入测试 # EventMesh.publish("set_hr_blood_led",1) EventMesh.publish(constants.EVENT.START_HEART) - print("bg start ") + EventMesh.txt_log("auto start_bg:333") elif self.old_bg_time > 6: self.old_bg_time = 0 EventMesh.publish("set_bg_state",0)#2代表后台进入测试 @@ -1453,14 +1478,9 @@ class DeviceInfoManager(Abstract): if bg_data == None: bg_data = 0 if bg_data != 0: - # EventMesh.publish("play_sugar_value", bg_data)#播放血糖数值 EventMesh.publish(constants.PROTOCOL.BLOODGLUSOCE_SEND,bg_data) - else: - # EventMesh.publish("play_sugar_value", 0)#播放血糖数值 - pass - - print("bg stop ") + EventMesh.txt_log("auto stop_bp:333") else: self.old_bg_time = 0 else: @@ -1471,6 +1491,7 @@ class DeviceInfoManager(Abstract): if get_temp_state == 3:#单次测量 self.temp_one_state+=1 if self.temp_one_state == 1: + EventMesh.txt_log("auto start_temp:333") EventMesh.debug_log("AUTO one temp:2") EventMesh.publish("set_temp_state",3) # EventMesh.publish("set_hr_blood_led",1) @@ -1494,17 +1515,9 @@ class DeviceInfoManager(Abstract): if temp != None: if temp != 0: - # EventMesh.publish("set_history_temp_value",temp) - # EventMesh.publish("play_temp_value",temp)#播放体温数值 EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp]) - else: - # EventMesh.publish("set_history_temp_value",0) - pass - # EventMesh.publish("play_temp_value",0)#播放体温数值 - # EventMesh.publish("stop_led_timer")#设置参数 EventMesh.publish(constants.EVENT.STOP_TEMP) - EventMesh.debug_log("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.txt_log("auto start_temp:333") @@ -1513,6 +1526,7 @@ class DeviceInfoManager(Abstract): if get_temp_time != None:#定时测量体温 if get_temp_time > 0: if get_temp_state != None: + get_temp_state = EventMesh.publish("get_temp_state") if get_temp_state == 0 or get_temp_state == 2: if (time_tmp-self.temp_time) >= get_temp_time:#大于一个周期的时间,重新赋值 self.temp_state = 0 @@ -1528,13 +1542,16 @@ class DeviceInfoManager(Abstract): EventMesh.publish("set_temp_state",2) # EventMesh.publish("set_hr_blood_led",1) EventMesh.debug_log("AUTO temp:") + EventMesh.txt_log("auto START_temp:1") EventMesh.publish(constants.EVENT.START_TEMP) elif (time_tmp-self.temp_time) >= 30 and self.temp_state == 1: self.temp_state = 0 + EventMesh.txt_log("auto stop_temp:1") + EventMesh.publish("set_temp_state",0) temp = EventMesh.publish(constants.EVENT.GET_TEMP) temp = self.optimize_temp(temp) - EventMesh.publish("set_temp_state",0) + tmp_f_tmp = 0 tmp_d_tmp = 0 if str(temp).find(".") != -1: @@ -1548,16 +1565,9 @@ class DeviceInfoManager(Abstract): if temp != None: if temp != 0: - EventMesh.publish("set_history_temp_value",temp) - # EventMesh.publish("play_temp_value",temp)#播放体温数值 EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp]) - else: - 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.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: self.temp_state = 0 self.old_temp_time = 0 @@ -1566,7 +1576,7 @@ class DeviceInfoManager(Abstract): if temp_state == 2: EventMesh.publish("set_temp_state",0)#2代表后台进入测试 # EventMesh.publish("stop_led_timer")#设置参数 - EventMesh.debug_log("temp stop debug3") + EventMesh.txt_log("auto wear stop_temp:2 ") EventMesh.publish(constants.EVENT.STOP_TEMP) self.temp_state = 0 self.temp_time = 0 @@ -1575,7 +1585,7 @@ class DeviceInfoManager(Abstract): hr_time = {} - hr_time = EventMesh.publish("get_time_hr_spo2")#获取时间是否大于0 + hr_time = EventMesh.publish("get_time_hr")#获取时间是否大于0 if hr_time[0] != None: self.mearsure_btn = int(hr_time[0]) @@ -1588,34 +1598,30 @@ class DeviceInfoManager(Abstract): get_spo2_state = EventMesh.publish("get_spo2_state")#血氧 get_bp_state = EventMesh.publish("get_bp_state")#血压 get_bg_state = EventMesh.publish("get_bg_state")#血糖 - print("state hr",get_hr_state,get_spo2_state,get_bp_state,get_bg_state) + # print("state hr",get_hr_state,get_spo2_state,get_bp_state,get_bg_state) if (get_bg_state == 0 and get_spo2_state == 0 and get_bp_state == 0) and (get_hr_state == 2 or get_hr_state == 0):#心率血压血氧不在测试就测试血糖自动测量 if (time_tmp-self.SENSOR_time) >= self.mearsure_timer:#大于一个周期的时间,保存的时间戳时间 1678 0 1678 30 1678 self.SENSOR_time = time_tmp self.HR_Onestate = 0 - print("time_tmp hr",time_tmp,self.SENSOR_time,time_tmp-self.SENSOR_time,self.mearsure_timer,self.HR_Onestate) + # print("time_tmp hr",time_tmp,self.SENSOR_time,time_tmp-self.SENSOR_time,self.mearsure_timer,self.HR_Onestate) if (time_tmp - self.SENSOR_time) == 0 and self.HR_Onestate == 0: - EventMesh.debug_log("START_hr:1") + self.HR_Onestate = 1 + EventMesh.txt_log("auto START_hr:1") EventMesh.publish("set_hr_state",2)#2代表后台进入测试 # 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: self.HR_Onestate = 0 EventMesh.publish("set_hr_state",0)#2代表后台进入测试 EventMesh.debug_log("stop debug3") + EventMesh.txt_log("auto stop_hr:1") EventMesh.publish(constants.EVENT.STOP_HEART) heart_value = EventMesh.publish(constants.EVENT.GET_HEART) EventMesh.debug_log("heart_value:{}".format(heart_value)) # heart_value = 60+urandom.randint(0,10) if heart_value > 50 and heart_value != None: - # EventMesh.publish("play_hr_value",heart_value) - EventMesh.publish("set_history_hr_value",heart_value) EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据 - else: - # EventMesh.publish("stop_led_timer")#设置参数 - pass - # EventMesh.publish("play_hr_value",0) #获取心率数据上传数据app EventMesh.debug_log("STOP_HEART:") @@ -1630,6 +1636,8 @@ class DeviceInfoManager(Abstract): EventMesh.debug_log("33stop debug3") # EventMesh.publish("stop_led_timer")#设置参数 EventMesh.publish(constants.EVENT.STOP_HEART) + EventMesh.txt_log("auto wear stop_hr:2 ") + get_spo2time = EventMesh.publish("get_spo2_time")#血压自动测试 # print("get_spo2time",get_spo2time) if get_spo2time != None:#血压时间不为0 @@ -1647,19 +1655,21 @@ class DeviceInfoManager(Abstract): self.spo2auto_state = 0 # print("time_tmp spo2",time_tmp,self.spo2_timeSecond,time_tmp-self.spo2_timeSecond,self.bg_timer,self.bpauto_state) if (time_tmp - self.spo2_timeSecond) == 0 and self.spo2auto_state == 0: + self.spo2auto_state = 1 EventMesh.debug_log("START_spo2:auto") + EventMesh.txt_log("auto START_spo2:1") EventMesh.publish("set_spo2_state",2)#2代表后台进入测试 EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)#K开血氧 - self.spo2auto_state = 1 + elif (time_tmp - self.spo2_timeSecond) >= 60 and self.spo2auto_state == 1: EventMesh.publish("set_spo2_state",0)#2代表后台进入测试 + self.spo2auto_state = 0 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_old_spo2_data",spo2_value) EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value) - print("spo2 auto stop ") - self.spo2auto_state = 0 + EventMesh.txt_log("auto stop_spo2:1") + else: self.spo2auto_state = 0 else: @@ -1669,7 +1679,7 @@ class DeviceInfoManager(Abstract): if spo2_state == 2: EventMesh.publish("set_spo2_state",0)#2代表后台进入测试 EventMesh.debug_log("spo2 stop debug3") - # EventMesh.publish("stop_led_timer")#设置参数 + EventMesh.txt_log("auto wear stop_spo2:2 ") EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) @@ -1691,12 +1701,15 @@ class DeviceInfoManager(Abstract): self.bpauto_state = 0 # print("time_tmp bp",time_tmp,self.bp_timeSecond,time_tmp-self.bp_timeSecond,self.bg_timer,self.bpauto_state) if (time_tmp - self.bp_timeSecond) == 0 and self.bpauto_state == 0: + self.bpauto_state = 1 EventMesh.debug_log("START_bp:auto") + EventMesh.txt_log("auto START_bp:1") EventMesh.publish("set_bp_state",2)#2代表后台进入测试 # EventMesh.publish("set_hr_blood_led",1) EventMesh.publish(constants.EVENT.START_HEART) - self.bpauto_state = 1 + elif (time_tmp - self.bp_timeSecond) >= 60 and self.bpauto_state == 1: + self.bpauto_state = 0 EventMesh.publish("set_bp_state",0)#2代表后台进入测试 blood_data = get_autoblood_value() if blood_data == None: @@ -1706,12 +1719,10 @@ class DeviceInfoManager(Abstract): max_value = blood_data[0] min_value = blood_data[1] if max_value != 0 and min_value != 0: - EventMesh.publish("set_old_blood_data",[max_value,min_value]) - EventMesh.publish(constants.PROTOCOL.BLOOD_SEND,[max_value,min_value]) EventMesh.publish(constants.EVENT.STOP_HEART) - print("bp auto stop ") - self.bpauto_state = 0 + EventMesh.txt_log("auto stop_bp:1") + else: self.bpauto_state = 0 else: @@ -1721,6 +1732,7 @@ class DeviceInfoManager(Abstract): if bp_state == 2: EventMesh.publish("set_bp_state",0)#2代表后台进入测试 EventMesh.debug_log("bp stop debug3") + EventMesh.txt_log("auto wear stop_bp:2 ") # EventMesh.publish("stop_led_timer")#设置参数 EventMesh.publish(constants.EVENT.STOP_HEART) @@ -1742,27 +1754,30 @@ class DeviceInfoManager(Abstract): if (get_hr_state == 0 and get_spo2_state == 0 and get_bp_state == 0) and (get_bg_state == 2 or get_bg_state == 0):#心率血压血氧不在测试就测试血糖自动测量 if (time_tmp-self.bg_times) >= bg_timer:#大于一个周期的时间,保存的时间戳时间 1678 0 1678 30 1678 - self.bg_times = time_tmp + self.bg_times = time_tmp #1780 self.BG_state = 0 # print("time_tmp bg",time_tmp,self.bg_times,time_tmp-self.bg_times,bg_timer,self.BG_state) if (time_tmp - self.bg_times) == 0 and self.BG_state == 0: EventMesh.debug_log("START_bg:1") + EventMesh.txt_log("auto START_bg:1") EventMesh.publish("set_bg_state",2)#2代表后台进入测试 # 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: + self.BG_state = 0 EventMesh.publish("set_bg_state",0)#2代表后台进入测试 # EventMesh.publish("stop_led_timer")#设置参数 + EventMesh.txt_log("auto stop_bg:1") EventMesh.debug_log("stop bgdebug3") EventMesh.publish(constants.EVENT.STOP_HEART) bgdata = get_blood_sugar_value() if bgdata == None: bgdata = 0 if bgdata != 0: - print("bgdata",bgdata) + EventMesh.debug_log("bgdata",bgdata) EventMesh.publish(constants.PROTOCOL.BLOODGLUSOCE_SEND,bgdata)#上传心率数据 - self.BG_state = 0 + else: self.BG_state = 0 @@ -1772,6 +1787,7 @@ class DeviceInfoManager(Abstract): EventMesh.publish("set_bg_state",0)#2代表后台进入测试 # EventMesh.publish("stop_led_timer")#设置参数 EventMesh.debug_log("bg stop bgdebug3") + EventMesh.txt_log("auto wear stop_bg:2 ") EventMesh.publish(constants.EVENT.STOP_HEART) self.bg_times = 0 self.BG_state = 0 @@ -1779,7 +1795,7 @@ class DeviceInfoManager(Abstract): else: self.old_temp_time = 0 self.old_time = 0 - self.SENSOR_time = time_tmp + # self.SENSOR_time = time_tmp self.HR_Onestate = 0 self.HR_OneTime = 0 self.HR_state = 0 @@ -1789,27 +1805,23 @@ class DeviceInfoManager(Abstract): self.old_spo2_time = 0 self.set_hsenor_crt = 0 self.old_bg_time = 0 - self.bg_times = time_tmp + # self.bg_times = time_tmp self.BG_state = 0 - self.temp_time = time_tmp + # self.temp_time = time_tmp - self.bp_timeSecond = time_tmp + # self.bp_timeSecond = time_tmp self.bpauto_state = 0 - self.spo2_timeSecond = time_tmp + # self.spo2_timeSecond = time_tmp self.spo2auto_state = 0 self.temp_state = 0 self.temp_one_state = 0 - self.old_temp_time = 0 - - - - + else: self.old_temp_time = 0 self.old_time = 0 - self.SENSOR_time = time_tmp + # self.SENSOR_time = time_tmp self.HR_Onestate = 0 self.HR_OneTime = 0 self.HR_state = 0 @@ -1819,62 +1831,88 @@ class DeviceInfoManager(Abstract): self.old_spo2_time = 0 self.set_hsenor_crt = 0 self.old_bg_time = 0 - self.bg_times = time_tmp + # self.bg_times = time_tmp + self.BG_state = 0 - self.temp_time = time_tmp + # self.temp_time = time_tmp - self.bp_timeSecond = time_tmp + # self.bp_timeSecond = time_tmp self.bpauto_state = 0 - self.spo2_timeSecond = time_tmp + # self.spo2_timeSecond = time_tmp self.spo2auto_state = 0 self.temp_state = 0 self.temp_one_state = 0 - self.old_temp_time = 0 - - if battery[0] == "1": - get_hr_state = EventMesh.publish("get_hr_state") - get_spo2_state = EventMesh.publish("get_spo2_state") - get_bp_state = EventMesh.publish("get_bp_state") - get_bg_state = EventMesh.publish("get_bg_state") - if get_hr_state != None and get_spo2_state != None and get_bp_state != None and get_bg_state != None: - if get_hr_state == 2 or get_hr_state == 3: - - EventMesh.publish("set_hr_state",0)#2代表后台进入测试,定时测心率 1ui界面测试洗心率 - # 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代表后台进入测试 - # 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代表后台进入测试 - # 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代表后台进入测试 - # if get_bg_state == 3: - # EventMesh.publish("stop_led_timer")#设置参数 - EventMesh.publish(constants.EVENT.STOP_HEART) - EventMesh.debug_log("stop debug15") - - if get_temp_time != None: - get_temp_state = EventMesh.publish("get_temp_state") - if get_temp_state == 2 or get_temp_state == 3: - self.temp_one_state = 0 - self.temp_state = 0 - temp = EventMesh.publish(constants.EVENT.GET_TEMP) - temp = self.optimize_temp(temp) - EventMesh.publish("set_temp_state",0) + get_hr_state = EventMesh.publish("get_hr_state") + get_spo2_state = EventMesh.publish("get_spo2_state") + get_bp_state = EventMesh.publish("get_bp_state") + get_bg_state = EventMesh.publish("get_bg_state") + if get_hr_state != None and get_spo2_state != None and get_bp_state != None and get_bg_state != None: + if get_hr_state > 1: + EventMesh.txt_log("auto stop_hr:44") + EventMesh.publish("set_hr_state",0)#2代表后台进入测试,定时测心率 1ui界面测试洗心率 + # if get_hr_state == 3: + # EventMesh.publish("stop_led_timer")#设置参数 + EventMesh.debug_log("stop debug8") + if WEAR == 1: + heart_value = EventMesh.publish(constants.EVENT.GET_HEART) + if heart_value > 50 and heart_value != None: + EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据 + EventMesh.publish(constants.EVENT.STOP_HEART) + elif get_spo2_state > 1: + EventMesh.txt_log("auto stop_spo2:44") + EventMesh.publish("set_spo2_state",0)#2代表后台进入测试 + # if get_spo2_state == 3: + # EventMesh.publish("stop_led_timer")#设置参数 + if WEAR == 1: + 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(constants.EVENT.STOP_BLOOD_OXYGEN) + EventMesh.debug_log("stop debug13") + elif get_bp_state > 1: + EventMesh.txt_log("auto stop_bp:44") + EventMesh.publish("set_bp_state",0)#2代表后台进入测试 + # if get_bp_state == 3: + # EventMesh.publish("stop_led_timer")#设置参数 + if WEAR == 1: + blood_data = get_autoblood_value() + if blood_data == None: + blood_data[0] = 0 + blood_data[1] = 0 + + max_value = blood_data[0] + min_value = blood_data[1] + if max_value != 0 and min_value != 0: + EventMesh.publish(constants.PROTOCOL.BLOOD_SEND,[max_value,min_value]) + EventMesh.publish(constants.EVENT.STOP_HEART) + EventMesh.debug_log("stop debug14") + elif get_bg_state > 1: + EventMesh.txt_log("auto stop_bg:44") + EventMesh.publish("set_bg_state",0)#2代表后台进入测试 + # if get_bg_state == 3: + # EventMesh.publish("stop_led_timer")#设置参数 + EventMesh.publish(constants.EVENT.STOP_HEART) + if WEAR == 1: + bgdata = get_blood_sugar_value() + if bgdata == None: + bgdata = 0 + if bgdata != 0: + EventMesh.publish(constants.PROTOCOL.BLOODGLUSOCE_SEND,bgdata)#上传心率数据 + EventMesh.debug_log("stop debug15") + + if get_temp_time != None: + get_temp_state = EventMesh.publish("get_temp_state") + if get_temp_state > 1: + self.temp_one_state = 0 + self.temp_state = 0 + temp = EventMesh.publish(constants.EVENT.GET_TEMP) + temp = self.optimize_temp(temp) + EventMesh.txt_log("auto stop_temp:44") + EventMesh.publish("set_temp_state",0) + if WEAR == 1: tmp_f_tmp = 0 tmp_d_tmp = 0 if str(temp).find(".") != -1: @@ -1888,18 +1926,10 @@ class DeviceInfoManager(Abstract): if temp != None: if temp != 0: - EventMesh.publish("set_history_temp_value",temp) - # EventMesh.publish("play_temp_value",temp)#播放体温数值 EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp]) - else: - EventMesh.publish("set_history_temp_value",0) - # EventMesh.publish("play_temp_value",0)#播放体温数值 - # if get_temp_state == 3: - # EventMesh.publish("stop_led_timer")#设置参数 - - EventMesh.publish(constants.EVENT.STOP_TEMP) + EventMesh.publish(constants.EVENT.STOP_TEMP) - + hr_state = EventMesh.publish("get_hr_state") @@ -1920,13 +1950,28 @@ class DeviceInfoManager(Abstract): heart_value = EventMesh.publish(constants.EVENT.GET_HEART) if heart_value > 50 and heart_value != None: EventMesh.publish("play_hr_value",heart_value) - EventMesh.publish("set_history_hr_value",heart_value) + # EventMesh.publish("set_history_hr_value",heart_value) EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据 + + if EventMesh.model == "D15_" :#D15型号 + blood_data = get_autoblood_value() + if blood_data == None: + blood_data[0] = 0 + blood_data[1] = 0 + + max_value = blood_data[0] + min_value = blood_data[1] + if max_value != 0 and min_value != 0: + EventMesh.publish(constants.PROTOCOL.BLOOD_SEND,[max_value,min_value]) + pass + else: EventMesh.publish("play_hr_value",0) + + else : - if WEAR != 1: + if WEAR != 1: EventMesh.publish("set_hr_state",0)#0代表g关闭测试 EventMesh.debug_log("stop debug7") EventMesh.publish(constants.EVENT.STOP_HEART) @@ -1957,7 +2002,7 @@ class DeviceInfoManager(Abstract): EventMesh.publish("play_spo2_value",0) else: - if WEAR != 1: + if WEAR != 1: EventMesh.publish("set_spo2_state",0)#0代表g关闭测试 EventMesh.debug_log("stop debug8") EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) @@ -1993,11 +2038,11 @@ class DeviceInfoManager(Abstract): if temp != None: if temp != 0: - EventMesh.publish("set_history_temp_value",temp) + # EventMesh.publish("set_history_temp_value",temp) EventMesh.publish("play_temp_value",temp)#播放体温数值 EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp]) else: - EventMesh.publish("set_history_temp_value",0) + # EventMesh.publish("set_history_temp_value",0) EventMesh.publish("play_temp_value",0)#播放体温数值 EventMesh.publish(constants.EVENT.STOP_TEMP) @@ -3819,8 +3864,8 @@ class getHrTimeManager(Abstract): def post_processor_after_instantiation(self): - EventMesh.subscribe("set_time_hr_spo2", self.set_time_hr_spo2) - EventMesh.subscribe("get_time_hr_spo2", self.get_time_hr_spo2) + EventMesh.subscribe("set_time_hr", self.set_time_hr) + EventMesh.subscribe("get_time_hr", self.get_time_hr) EventMesh.subscribe("set_hr_state", self.set_hr_state) EventMesh.subscribe("get_hr_state", self.get_hr_state) EventMesh.subscribe("set_spo2_state", self.set_spo2_state) @@ -3843,13 +3888,13 @@ class getHrTimeManager(Abstract): return [self.bgauto_btn,self.set_bgautotime] - def set_time_hr_spo2(self, event, msg): + def set_time_hr(self, event, msg): self.open_btn = msg[0] self.set_time = msg[1] EventMesh.publish("set_storage_config",["measure_time",self.set_time]) EventMesh.publish("set_storage_config",["open_hr_btn",self.open_btn]) - def get_time_hr_spo2(self, event, msg): + def get_time_hr(self, event, msg): return [self.open_btn,self.set_time] def set_hr_state(self, event, msg): diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/protocol.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/protocol.py index 9b0dadf1..3a58f663 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/protocol.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/protocol.py @@ -658,10 +658,9 @@ class KA_ProtoCol(ProtoCol): self.roll_count = 0 else: self.roll_count = 0 - - - # EventMesh.debug_log("ka roll_count:",self.roll_count) - + hour = utime.localtime()[3] + min = utime.localtime()[4] + EventMesh.txt_log("ka step:{} hour:{} min:{}".format(step,hour,min)) battery_caption = bat_tmp[1] send_data = "KA,%s,%d,%d,%d"%(date,step,self.roll_count,battery_caption) @@ -1095,7 +1094,7 @@ class HRSTART_ProtoCol(ProtoCol): on = 0 if hrTotal != 0: on = 1 - EventMesh.publish("set_time_hr_spo2",[on,hrTotal]) + EventMesh.publish("set_time_hr",[on,hrTotal]) EventMesh.publish(constants.PROTOCOL.HRTSTART_SEND) diff --git a/2.sdk/project/D10/usr/static/audio.bin b/2.sdk/project/D10/usr/static/audio.bin index e3aa0cfe..7ff1a313 100644 Binary files a/2.sdk/project/D10/usr/static/audio.bin and b/2.sdk/project/D10/usr/static/audio.bin differ