From: d15521469561 Date: Fri, 14 Apr 2023 09:11:32 +0000 (+0800) Subject: 优化bug 微聊 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=a6150763c99e5ddd35efde15fc2f53c8e29bd35d;p=mirrors%2FASR1603_G5.git 优化bug 微聊 --- diff --git a/3.code/1.watch/2.code/alarm.py b/3.code/1.watch/2.code/alarm.py index 85017968..28c3967d 100644 --- a/3.code/1.watch/2.code/alarm.py +++ b/3.code/1.watch/2.code/alarm.py @@ -104,7 +104,7 @@ clk_list_screen1_1.add_style(style_alarm_screen_default, lv.PART.MAIN | lv.STATE no_add_alarm_img = lv.img(clk_list_screen1_1) no_add_alarm_img.set_pos(63, 0) no_add_alarm_img.set_size(113, 152) -no_add_alarm_img.set_src("E:/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.jpg") +no_add_alarm_img.set_src("E:/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png") no_add_alarm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) #暂未添加闹钟 @@ -409,7 +409,6 @@ class ClockManager(Abstract): EventMesh.subscribe("add_alarm", self.add_alarm) EventMesh.subscribe("remove_alarm", self.remove_alarm) EventMesh.subscribe("set_rtc_alarm", self.set_rtc_alarm) - print("ClockManager = ........") def set(self, event, msg): global alarm_list @@ -420,7 +419,7 @@ class ClockManager(Abstract): alarm_list[idx]["minute"] = msg["minute"] alarm_list[idx]["days"] = msg["days"] alarm_list[idx]["enabled"] = msg["enabled"] - + alarm_list[idx]["repeart"] = msg["repeart"] with open("/ext/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd: ujson.dump(alarm_list,fd) @@ -439,7 +438,7 @@ class ClockManager(Abstract): global alarm_list idx = len(alarm_list) print("add_here-----idx:",idx) - alarm_list.append({"idx": idx, "hour": 0, "minute": 0, "days": [], "enabled": False}) + alarm_list.append({"idx": idx, "hour": 0, "minute": 0, "days": [], "enabled": False,"repeart":1}) with open("/ext/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd: ujson.dump(alarm_list,fd) @@ -468,6 +467,11 @@ class ClockManager(Abstract): def _rtc_callback(self,args): print("---!!!!!!alarm_ring!!!!!!!---") EventMesh.publish("set_rtc_alarm") + get_hr_state = EventMesh.publish("get_hr_state") + get_spo2_state = EventMesh.publish("get_spo2_state") + if get_hr_state != None or get_spo2_state != None: + if get_hr_state != 1 and get_spo2_state != 1: + EventMesh.publish("load_screen", {"screen": "popup_alarm"}) # def _reset_rtc_alarm_time(self, args): # print("---alarm_ring---") @@ -571,7 +575,60 @@ class ClockManager(Abstract): self.rtc.enable_alarm(1) - +#闹钟弹窗 +popup_alarm_screen = lv.obj() +popup_alarm = lv.obj(popup_alarm_screen) +popup_alarm.center() +popup_alarm.set_size(240, 320) +popup_alarm.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + + +popup_alarm_img = lv.img(popup_alarm) +popup_alarm_img.set_pos(63, 20) +popup_alarm_img.set_size(113, 152) +popup_alarm_img.set_src("E:/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png") +popup_alarm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + +popup_alarm_time = lv.label(popup_alarm) +popup_alarm_time.set_pos(0, 200) +popup_alarm_time.set_size(240, 50) +popup_alarm_time.set_text(" ") +popup_alarm_time.set_long_mode(lv.label.LONG.WRAP) +popup_alarm_time.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +popup_alarm_time.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +#闹钟列表 +class PopupAlarmScreen(Screen): + NAME = "popup_alarm" + def __init__(self): + super().__init__() + self.meta = popup_alarm_screen + self.timer = osTimer() + + def initialization(self): + self.timer.start(10*1000,0,self.exit_alarm_page) + time = EventMesh.publish("screen_get_time")#获取系统时间 + print("time:{}".format(time)) + popup_alarm_time.set_text("{}:{}".format(time[0][0],time[0][1])) + + def exit_alarm_page(self): + EventMesh.publish("load_screen", {"screen": "watchface"}) + + def done_left_to_right(self): + EventMesh.publish("load_screen", {"screen": "watchface"}) + def done_right_to_left(self): + EventMesh.publish("load_screen", {"screen": "watchface"}) + def done_bottom_to_top(self): + EventMesh.publish("load_screen", {"screen": "watchface"}) + def done_top_to_bottom(self): + EventMesh.publish("load_screen", {"screen": "watchface"}) + def done_return(self): + EventMesh.publish("load_screen", {"screen": "watchface"}) + + def btn1_release(self): + EventMesh.publish("load_screen", {"screen": "watchface"}) + + def btn8_press(self): + EventMesh.publish("load_screen", {"screen": "watchface"}) #闹钟列表 class ClkListScreen(Screen): @@ -646,11 +703,15 @@ class ClkListScreen(Screen): _btn_label2.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) _new_list = sorted(each["days"]) + repeart = each["repeart"] _output = [self.weekdays_list[x] for x in _new_list] _btn_label3 = lv.label(_btn) _btn_label3.set_pos(10, 40) _btn_label3.set_size(200, 40) - if len(_new_list) >= 7: + print("_new_list:{} repeart:{}".format(_new_list,repeart)) + if repeart == 1: + _btn_label3.set_text("一次") + elif repeart == 2: _btn_label3.set_text("每天") else: _btn_label3.set_text(",".join(_output)) @@ -723,10 +784,10 @@ class ClkListScreen(Screen): EventMesh.publish("load_screen", {"screen": "toolbox"}) def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "toolbox"}) + EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "toolbox"}) class NewEditClk(Screen): @@ -859,6 +920,15 @@ class ClkPeriod(Screen): self.alarm_info["days"] = self.choice_list print("编辑星期:{}".format(self.alarm_info)) + if self.alarm_info["days"] == []: + self.alarm_info["repeart"] = 1 + else: + num = self.alarm_info["days"] + if len(num) >= 7: + self.alarm_info["repeart"] = 2 + else: + self.alarm_info["repeart"] = 3 + EventMesh.publish("push_clock_info", self.alarm_info) def done_return(self): diff --git a/3.code/1.watch/2.code/appAlipay.py b/3.code/1.watch/2.code/appAlipay.py index 9d0c18dc..9eab2246 100644 --- a/3.code/1.watch/2.code/appAlipay.py +++ b/3.code/1.watch/2.code/appAlipay.py @@ -15,7 +15,7 @@ from ext.ui import Screen style_font_youyuan_20 = lv.style_t() style_font_youyuan_20.init() style_font_youyuan_20.set_text_color(lv.color_make(0xff, 0xff, 0xff)) -style_font_youyuan_20.set_text_font_v2("font_18.bin",18,0) +style_font_youyuan_20.set_text_font_v2("font_20.bin",20,0) style_btn_alipay = lv.style_t() style_btn_alipay.init() @@ -371,7 +371,7 @@ class Alipay_1_1(Screen): self.alipay_imgbtn_3.set_size(224,69) self.alipay_imgbtn_3.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.alipay_imgbtn_3.add_flag(lv.obj.FLAG.CLICKABLE) - self.alipay_imgbtn_3.set_src("E:/static/APP/alipay/1_13.jpg") + self.alipay_imgbtn_3.set_src("E:/static/APP/alipay/1_13.png") self.alipay_imgbtn_3.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.alipay_imgbtn_3.add_event_cb(lambda e: self.alipay_paycode(e), lv.EVENT.PRESSED, None) @@ -383,7 +383,7 @@ class Alipay_1_1(Screen): self.alipay_imgbtn_2.set_size(224,69) self.alipay_imgbtn_2.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.alipay_imgbtn_2.add_flag(lv.obj.FLAG.CLICKABLE) - self.alipay_imgbtn_2.set_src("E:/static/APP/alipay/1_12.jpg") + self.alipay_imgbtn_2.set_src("E:/static/APP/alipay/1_12.png") self.alipay_imgbtn_2.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.alipay_imgbtn_2.add_event_cb(lambda e: self.alipay_collect(e), lv.EVENT.PRESSED, None) @@ -395,7 +395,7 @@ class Alipay_1_1(Screen): self.alipay_imgbtn_1.set_size(224,69) self.alipay_imgbtn_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.alipay_imgbtn_1.add_flag(lv.obj.FLAG.CLICKABLE) - self.alipay_imgbtn_1.set_src("E:/static/APP/alipay/1_11.jpg") + self.alipay_imgbtn_1.set_src("E:/static/APP/alipay/1_11.png") self.alipay_imgbtn_1.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.alipay_imgbtn_1.add_event_cb(lambda e: self.alipay_parent(e), lv.EVENT.PRESSED, None) @@ -499,12 +499,6 @@ class Alipay_inviting(Screen): # add style for watchface self.meta.add_style(style_alipay_screen_default, lv.PART.MAIN|lv.STATE.DEFAULT) - # self.bg = lv.img(self.meta) - # self.bg.set_pos(80,54) - # self.bg.set_size(80,80) - # self.bg.set_src("E:/static/APP/alipay/loading.jpg") - # self.bg.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) - #提示词 self.label = lv.label(self.meta) self.label.set_pos(30, 158) @@ -530,45 +524,6 @@ class Alipay_inviting(Screen): def btn8_press(self): EventMesh.publish("load_screen", {"screen": "watchface"}) -# class Alipay_default(Screen): -# NAME = "alipay_default" - -# def __init__(self): -# super().__init__() -# self.meta = lv.obj() -# self.meta.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) -# # add style for watchface -# self.meta.add_style(style_alipay_screen_default, lv.PART.MAIN|lv.STATE.DEFAULT) - -# #背景 -# self.bg = lv.img(self.meta) -# self.bg.set_pos(56,30) -# self.bg.set_size(240,240) -# self.bg.set_src("E:/static/APP/alipay/1_2_2.jpg") -# self.bg.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) - -# #提示词 -# self.label = lv.label(self.meta) -# self.label.set_pos(68, 168) -# self.label.set_size(104, 29) -# self.label.set_long_mode(lv.label.LONG.WRAP) -# self.label.set_text("绑定失败") -# self.label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# self.label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - -# def initialization(self): -# pass - -# def Close(self): -# pass - -# def btn1_release(self): -# EventMesh.publish("load_screen", {"screen": "main_menu"}) - -# def btn8_press(self): -# EventMesh.publish("load_screen", {"screen": "watchface"}) - class Alipay_success(Screen): NAME = "alipay_success" @@ -583,7 +538,7 @@ class Alipay_success(Screen): self.bg = lv.img(self.meta) self.bg.set_pos(56,30) self.bg.set_size(128,127) - self.bg.set_src("E:/static/APP/alipay/1_2_1.jpg") + self.bg.set_src("E:/static/APP/alipay/1_2_1.png") self.bg.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) #提示词 @@ -711,7 +666,7 @@ class Alipay_pay_success(Screen): self.bg = lv.img(self.meta) self.bg.center() self.bg.set_size(240,240) - self.bg.set_src("E:/static/APP/alipay/1_13_1_1.jpg") + self.bg.set_src("E:/static/APP/alipay/1_13_1_1.png") self.bg.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) #付款金额 @@ -818,7 +773,7 @@ class Alipay_parent(Screen): self.bg = lv.img(self.meta) self.bg.set_pos(8,12) self.bg.set_size(81,81) - self.bg.set_src("E:/static/APP/alipay/1_11_1.jpg") + self.bg.set_src("E:/static/APP/alipay/1_11_1.png") self.bg.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) #提示词 diff --git a/3.code/1.watch/2.code/appWechat.py b/3.code/1.watch/2.code/appWechat.py index 8b0864b7..e3f0c942 100644 --- a/3.code/1.watch/2.code/appWechat.py +++ b/3.code/1.watch/2.code/appWechat.py @@ -125,6 +125,8 @@ class WechatScreen(Screen): self.play_text = None self.play_sec = 0 self.sec_num = 0 + self.countdown_old = 0 + self.press_state = 0 def get_wechat_data(self,event, msg): return [self.MXA_MSG,self.wechat_num ,self.wechat_recode_list] @@ -143,142 +145,121 @@ class WechatScreen(Screen): def wechat_updata_list_show(self, event, msg): if (self.wechat_list.has_flag(lv.obj.FLAG.HIDDEN)) == False: + wechat_label.clear_flag(lv.obj.FLAG.HIDDEN) + wechat_label.set_text("接收中") + self.updata_list_show(2) self.timer.start(1 * 1000, 0, self.reciving) + def updata_list_show(self,index): - - #print("self.wechat_list.get_hidden:{}".format(self.wechat_list.has_flag(lv.obj.FLAG.HIDDEN))) - if index == 0: - #读取json文件中的键作为label文本; - self.startWidth = 0 - self.startY = 0 - # print("self.wechat_recode_list:{}".format(self.wechat_recode_list)) - self.wechat_list.delete()#先删除一次控件 - - self.wechat_list = lv.obj(wechat_screen) - self.wechat_list.set_pos(0, 0) - self.wechat_list.set_size(240, 250) - self.wechat_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.wechat_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - self.play_img_cnt = None - #print("self.wechat_list.self.wechat_num:{}".format(self.wechat_num)) - if self.wechat_num != 0: - j = 1 - if len(self.wechat_recode_list) == self.MXA_MSG: - j = self.wechat_num+1 - for i in range(self.MXA_MSG): - if j > self.MXA_MSG: - j = 1 - key = "%02d"%(j) - if j > len(self.wechat_recode_list) : - break - j+=1 - # print("key :{}".format(key)) - # print("self.wechat_recode_list:{}".format(self.wechat_recode_list[key])) + if self.wechat_num != 0: + if index == 0: + self.wechat_list.clear_flag(lv.obj.FLAG.HIDDEN) + wechat_label.add_flag(lv.obj.FLAG.HIDDEN) + elif index == 2 or index == 1: + #读取json文件中的键作为label文本; + #print("self.wechat_list.self.wechat_num:{}".format(self.wechat_num)) + self.startWidth = 0 + self.startY = 0 + i = 0 + # print("self.wechat_recode_list:{}".format(self.wechat_recode_list)) + self.wechat_list.delete()#先删除一次控件 + self.wechat_list = lv.obj(wechat_screen) + self.wechat_list.set_pos(0, 0) + self.wechat_list.set_size(240, 250) + self.wechat_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.wechat_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + self.play_img_cnt = None + if index == 2: + self.wechat_list.add_flag(lv.obj.FLAG.HIDDEN) + j = 1 + if len(self.wechat_recode_list) == self.MXA_MSG: + j = self.wechat_num+1 + for i in range(self.MXA_MSG): + if j > self.MXA_MSG: + j = 1 + key = "%02d"%(j) + if j > len(self.wechat_recode_list) : + break + j+=1 + + value = self.wechat_recode_list[key] + self.startY = 52*i + if value.find("S:") != -1 or value.find("R:") != -1: + msg_tmp = value[2:] + msg_tmp = int(msg_tmp) + self.startWidth = 55+msg_tmp*10 - value = self.wechat_recode_list[key] - self.startY = 52*i - if value.find("S:") != -1 or value.find("R:") != -1: - msg_tmp = value[2:] - msg_tmp = int(msg_tmp) - self.startWidth = 55+msg_tmp*10 - - elif value.find("T:") != -1:#文字显示 - msg_tmp = value[2:] - size = len(msg_tmp) - self.startWidth = size*20 - # print("self.startWidth :{} size:{}".format(self.startWidth,size)) - if self.startWidth > 200: - self.startWidth = 200 + elif value.find("T:") != -1:#文字显示 + msg_tmp = value[2:] + size = len(msg_tmp) + self.startWidth = size*20 + # print("self.startWidth :{} size:{}".format(self.startWidth,size)) + if self.startWidth > 200: + self.startWidth = 200 + + wechat_btn = lv.btn(self.wechat_list) + # if value.find("R:") != -1: + wechat_btn.set_size(self.startWidth,50) + if value.find("R:") != -1 or value.find("T:") != -1 :#显示文字: + wechat_btn.set_pos(10,self.startY ) + wechat_btn.add_style(style_wechat_s_btn, lv.PART.MAIN | lv.STATE.DEFAULT) + elif value.find("S:") != -1 : + wechat_btn.set_pos(230-self.startWidth,self.startY ) + wechat_btn.add_style(style_wechat_r_btn, lv.PART.MAIN | lv.STATE.DEFAULT) + if value.find("R:") != -1 or value.find("S:") != -1: + wechat_btn.add_event_cb(lambda e: self.play_label(e), + lv.EVENT.CLICKED, None) + + _btn_label1 = lv.label(wechat_btn) + if value.find("R:") != -1: + _btn_label1.set_size(40, 40) + _btn_label1.set_pos(35, 8) + _btn_label1.set_text(str(msg_tmp)+'\"') - contact_btn = lv.btn(self.wechat_list) + elif value.find("S:") != -1: + _btn_label1.set_size(40, 40) + _btn_label1.set_pos(self.startWidth-72, 8) + _btn_label1.set_text(str(msg_tmp)+'\"') + elif value.find("T:") != -1: + _btn_label1.set_size(200, 60) + _btn_label1.set_pos(0, 0) + _btn_label1.set_text(str(msg_tmp)) + _btn_label1.set_long_mode(lv.label.LONG.DOT) + + _btn_label1.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + + _btn_label2 = lv.label(wechat_btn) + _btn_label2.set_size(0, 0) + if value.find("R:") != -1: + _btn_label2.set_text('R:'+key) + elif value.find("S:") != -1: + _btn_label2.set_text('S:'+key) + elif value.find("T:") != -1: + _btn_label2.set_text('T:'+key) + + if value.find("R:") != -1 or value.find("S:") != -1: + _btn_img = lv.img(wechat_btn) + _btn_img.set_size(30, 30) if value.find("R:") != -1: - contact_btn.set_size(self.startWidth,50) - contact_btn.set_pos(10,self.startY ) - contact_btn.add_style(style_wechat_s_btn, lv.PART.MAIN | lv.STATE.DEFAULT) - contact_btn.add_event_cb(lambda e: self.play_label(e), - lv.EVENT.CLICKED, None) - - _btn_label1 = lv.label(contact_btn) - _btn_label1.set_size(40, 40) - _btn_label1.set_pos(35, 8) - _btn_label1.set_text(str(msg_tmp)+'\"') - - _btn_label1.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) - - _btn_label2 = lv.label(contact_btn) - _btn_label2.set_size(0, 0) - _btn_label2.set_text('R:'+key) - - - _btn_img = lv.img(contact_btn) _btn_img.set_pos(5, 0) - _btn_img.set_size(30, 30) _btn_img.set_src("E:/static/APP/wechat/R_3.png") - _btn_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - elif value.find("S:") != -1 : - contact_btn.set_size(self.startWidth,50) - contact_btn.set_pos(230-self.startWidth,self.startY ) - contact_btn.add_style(style_wechat_r_btn, lv.PART.MAIN | lv.STATE.DEFAULT) - contact_btn.add_event_cb(lambda e: self.play_label(e), - lv.EVENT.CLICKED, None) - - _btn_label1 = lv.label(contact_btn) - _btn_label1.set_size(40, 40) - _btn_label1.set_pos(self.startWidth-72, 8) - _btn_label1.set_text(str(msg_tmp)+'\"') - - _btn_label1.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) - - _btn_label2 = lv.label(contact_btn) - _btn_label2.set_size(0, 0) - _btn_label2.set_text('S:'+key) - - - _btn_img = lv.img(contact_btn) + elif value.find("S:") != -1: _btn_img.set_pos(self.startWidth-50, 0) - _btn_img.set_size(30, 30) _btn_img.set_src("E:/static/APP/wechat/S_3.png") - _btn_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - elif value.find("T:") != -1 :#显示文字 - contact_btn.set_size(self.startWidth,50) - contact_btn.set_pos(10,self.startY ) - contact_btn.add_style(style_wechat_s_btn, lv.PART.MAIN | lv.STATE.DEFAULT) - contact_btn.add_event_cb(lambda e: self.play_label(e), - lv.EVENT.CLICKED, None) - - _btn_label1 = lv.label(contact_btn) - _btn_label1.set_size(200, 60) - _btn_label1.set_pos(0, 0) - _btn_label1.set_text(str(msg_tmp)) - _btn_label1.set_long_mode(lv.label.LONG.DOT) - _btn_label1.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) - - _btn_label2 = lv.label(contact_btn) - _btn_label2.set_size(0, 0) - _btn_label2.set_text('T:'+key) - - - # _btn_img = lv.img(contact_btn) - # _btn_img.set_pos(0, 0) - # _btn_img.set_size(0, 0) - # _btn_img.set_src("E:/static/APP/wechat/R_3.png") - # _btn_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - bottom_btn = self.wechat_list.get_child(-1) - bottom_btn.scroll_to_view(lv.ANIM.OFF) + _btn_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + + bottom_btn1 = self.wechat_list.get_child(-1) + bottom_btn1.scroll_to_view(lv.ANIM.OFF) def initialization(self): - wechat_label.add_flag(lv.obj.FLAG.HIDDEN) wechat_press_label_countdown.add_flag(lv.obj.FLAG.HIDDEN) - self.wechat_list.clear_flag(lv.obj.FLAG.HIDDEN)#隐藏列表选项方框 + self.wechat_list.clear_flag(lv.obj.FLAG.HIDDEN) #读取json文件中的字典放到self.phonebook中 #创建btn - self.updata_list_show(0) + self.updata_list_show(1) self.count_img = 0 self.play_sec = 0 @@ -294,49 +275,60 @@ class WechatScreen(Screen): wechat_press_label_countdown.set_text("{}S".format(str(self.countdown))) - self.updata_list_show(1)#不需要显示语音列表 + self.updata_list_show(2)#不需要显示语音列表 #按下说话 if self.wechat_num >= self.MXA_MSG: self.wechat_num = 0 self.wechat_num += 1 # print("talking self.wechat_num ...:{}".format(self.wechat_num)) - #EventMesh.publish("set_wechat_data",[self.MXA_MSG,self.wechat_num,self.wechat_recode_list]) - self.record_test.start("/ext/static/storage_file/{}.amr".format(self.wechat_num),16) self.second_timer.start(1000, 1, self.reduce_second) - + self.press_state = 1 #松开发送 def reciving(self,e): self.updata_list_show(0) #松开发送 def sending(self,e): - wechat_label.clear_flag(lv.obj.FLAG.HIDDEN) - wechat_label.set_text("发送中") - wechat_press_label_countdown.add_flag(lv.obj.FLAG.HIDDEN) - wechat_press_label_countdown.set_text(" ") - - if self.countdown > 15: - self.countdown = 15 - #松开发送数据 - #num.txt为记录的最后编号 - #record.json文件里的json元素为记录编号,json键值:"S:"开头为发送的语音,"R:"为接收的语音,后面跟随语音长度;"T:"为接收的文字信息。 - - #写序号 - self.record_test.stop() #停止錄音 - self.second_timer.stop() #停止计时器 - # print("self.countdown :{} self.wechat_num:{}".format(self.countdown,self.wechat_num)) - self.wechat_recode_list["%02d"%(self.wechat_num)] = "S:{}".format(str(self.countdown)) - - with open("/ext/static/storage_file/wechat_num.txt","w") as fd: - fd.write(str(self.wechat_num)) - self.timer.start(2 * 1000, 0, self.hide_label) - #print("self.countdown :{}".format(self.countdown)) - #修改或添加词典键值 + if self.press_state == 1: + wechat_label.clear_flag(lv.obj.FLAG.HIDDEN) + wechat_label.set_text("发送中") + wechat_press_label_countdown.add_flag(lv.obj.FLAG.HIDDEN) + wechat_press_label_countdown.set_text(" ") + + if self.countdown >= 15: + self.countdown = 15 + #松开发送数据 + #num.txt为记录的最后编号 + #record.json文件里的json元素为记录编号,json键值:"S:"开头为发送的语音,"R:"为接收的语音,后面跟随语音长度;"T:"为接收的文字信息。 + + #写序号 + self.record_test.stop() #停止錄音 + self.second_timer.stop() #停止计时器 + self.countdown_old = self.countdown + # print("self.countdown :{} self.wechat_num:{}".format(self.countdown,self.wechat_num)) + self.wechat_recode_list["%02d"%(self.wechat_num)] = "S:{}".format(str(self.countdown)) + + with open("/ext/static/storage_file/wechat_num.txt","w") as fd: + fd.write(str(self.wechat_num)) + #读音频amr二进制数据 + self.timer.start(2 * 1000, 0, self.hide_label) + #print("self.countdown :{}".format(self.countdown)) + #修改或添加词典键值 - with open("/ext/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd: - ujson.dump(self.wechat_recode_list,fd) - # print("WechatScreen:record:{}".format(self.wechat_recode_list)) + with open("/ext/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd: + ujson.dump(self.wechat_recode_list,fd) + + path = "/ext/static/storage_file/{}.amr".format(self.wechat_num) + with open(path,"rb") as fd: + buf = bytearray(ql_fs.path_getsize(path)) + fd.readinto(buf) + senddata = [self.countdown_old,buf] + EventMesh.publish(constants.PROTOCOL.TK_SEND,senddata) + #隐藏显示文本 显示列表显示框 + + self.updata_list_show(2) + self.press_state = 0 def play_img_cb(self,*args): # print("self.count_img :{} self.play_text:{}".format(self.count_img,self.play_text)) @@ -381,7 +373,11 @@ class WechatScreen(Screen): play_img_s = play_img_s[0]#获取实际显示秒数 '"'前面实际的秒数 if self.play_text == "R:" or self.play_text == "S:": - self.play_sec = int(play_img_s) + if self.play_text == "R:": + self.play_sec = 15 + else: + self.play_sec = int(play_img_s) + self.play_timer.start(500, 1, self.play_img_cb) # print("play_label self.count_img :{} self.play_text:{} play_img_s:{} self.play_sec:{}".format(self.count_img,self.play_text,play_img_s,self.play_sec)) @@ -397,19 +393,11 @@ class WechatScreen(Screen): #松手2秒后发送数据 def hide_label(self,*args): - #读音频amr二进制数据 - path = "/ext/static/storage_file/{}.amr".format(self.wechat_num) - with open(path,"rb") as fd: - buf = bytearray(ql_fs.path_getsize(path)) - fd.readinto(buf) - senddata = [self.countdown,buf] - EventMesh.publish(constants.PROTOCOL.TK_SEND,senddata) - - #隐藏显示文本 显示列表显示框 wechat_label.add_flag(lv.obj.FLAG.HIDDEN) wechat_label.set_text(" ") self.updata_list_show(0) - + + def Close(self): self.play_timer.stop() self.record_test.stop() #停止錄音 @@ -486,7 +474,7 @@ class TK_ProtoCol(ProtoCol): #print("K_ProtoCol:recv:data:{}".format(msg)) msg_tmp = msg.decode('ascii') str = msg_tmp.split('TK,') - print("TK_ProtoCol:recv:len:{} {} {}".format(len(msg),len(str),msg_tmp.find("#!AMR"))) + # print("TK_ProtoCol:recv:len:{} {} {}".format(len(msg),len(str),msg_tmp.find("#!AMR"))) if msg_tmp.find("#!AMR") != -1: #是否是服务器下发音频数据 # print("TK_ProtoCol:recv:datalen{}".format(len(msg))) arm_data = bytearray(str[1])#获取amr输出 @@ -501,6 +489,7 @@ class TK_ProtoCol(ProtoCol): wechat_recode_list["%02d"%(wechat_num)] = "R:{}".format(3) EventMesh.publish("set_wechat_data",[MXA_MSG,wechat_num,wechat_recode_list]) #写语音文件数据 + EventMesh.publish("wechat_updata_list_show") # path = "/ext/static/storage_file/audio_amr/amr/{}.amr".format(wechat_num) path = "/ext/static/storage_file/{}.amr".format(wechat_num) with open(path,"w") as fd: @@ -528,7 +517,7 @@ class TK_ProtoCol(ProtoCol): if j >= len(arm_data): break fd.write(arm) - EventMesh.publish("wechat_updata_list_show") + diff --git a/3.code/1.watch/2.code/code.py b/3.code/1.watch/2.code/code.py new file mode 100644 index 00000000..6b81d641 --- /dev/null +++ b/3.code/1.watch/2.code/code.py @@ -0,0 +1,296 @@ +from machine import LCD, Pin +import lvgl as lv +from tp import cst816 + +test = ( + + 0, 0, 0x11, + 2, 0, 120, + + 0, 1, 0x36, + 1, 1, 0x00, + + 0, 1, 0x35, + 1, 1, 0x01, + + 0, 1, 0x3a, + 1, 1, 0x05, + + 0, 5, 0xB2, + 1, 1, 0x0c, + 1, 1, 0x0c, + 1, 1, 0x00, + 1, 1, 0x33, + 1, 1, 0x33, + + 0, 1, 0xB7, + 1, 1, 0x77, + + 0, 1, 0xBB, + 1, 1, 0x2c, + + 0, 1, 0xC0, + 1, 1, 0x2C, + + 0, 1, 0xC2, + 1, 1, 0x01, + + 0, 1, 0xC3, + 1, 1, 0x21, + + 0, 1, 0xC4, + 1, 1, 0x20, + + 0, 1, 0xC6, + 1, 1, 0x10, + + 0, 2, 0xD0, + 1, 1, 0xA4, + 1, 1, 0xA1, + + 0, 14, 0xE0, + 1, 1, 0xd0, + 1, 1, 0x03, + 1, 1, 0x08, + 1, 1, 0x0e, + 1, 1, 0x12, + 1, 1, 0x2d, + 1, 1, 0x42, + 1, 1, 0x45, + 1, 1, 0x53, + 1, 1, 0x29, + 1, 1, 0x16, + 1, 1, 0x15, + 1, 1, 0x22, + 1, 1, 0x24, + + 0, 14, 0xE1, + 1, 1, 0xd0, + 1, 1, 0x03, + 1, 1, 0x08, + 1, 1, 0x0e, + 1, 1, 0x13, + 1, 1, 0x2c, + 1, 1, 0x42, + 1, 1, 0x54, + 1, 1, 0x50, + 1, 1, 0x2c, + 1, 1, 0x16, + 1, 1, 0x16, + 1, 1, 0x20, + 1, 1, 0x27, + # 0, 0, 0x11, + 0, 0, 0x21, + 0, 0, 0x29, + # 0, 1, 0xe7, + # 1, 1, 0x11, +) + +XSTART_H = 0xf0 +XSTART_L = 0xf1 +YSTART_H = 0xf2 +YSTART_L = 0xf3 +XEND_H = 0xE0 +XEND_L = 0xE1 +YEND_H = 0xE2 +YEND_L = 0xE3 + +XSTART = 0xD0 +XEND = 0xD1 +YSTART = 0xD2 +YEND = 0xD3 + +lcd = LCD() + +test1 = bytearray(test) + +test2 = ( + 0, 4, 0x2a, + 1, 1, XSTART_H, + 1, 1, XSTART_L, + 1, 1, XEND_H, + 1, 1, XEND_L, + 0, 4, 0x2b, + 1, 1, YSTART_H, + 1, 1, YSTART_L, + 1, 1, YEND_H, + 1, 1, YEND_L, + 0, 0, 0x2c, +) +test_invalid = bytearray(test2) + +test3 = ( + 0, 0, 0x28, + 2, 0, 120, + 0, 0, 0x10, +) +test_displayoff = bytearray(test3) + +test4 = ( + 0, 0, 0x11, + 2, 0, 120, + 0, 0, 0x29, +) +test_displayon = bytearray(test4) + +gpio4 = Pin(Pin.GPIO18, Pin.OUT, Pin.PULL_PU, 0) +gpio4.write(1) +lcd.lcd_init(test1, 240, 320, 52000, 1, 4, 0, test_invalid, test_displayon, test_displayoff, None, TESel=True, TEPin=7) +lcd.lcd_clear(0xf800) +gpio5 = Pin(Pin.GPIO17, Pin.OUT, Pin.PULL_PU, 0) +gpio5.write(1) + +LCD_SIZE_W = 240 +LCD_SIZE_H = 320 + +# 初始化lvgl +lv.init() + +# Register SDL display driver. +disp_buf1 = lv.disp_draw_buf_t() +buf1_1 = bytearray(LCD_SIZE_W * LCD_SIZE_H * 2) +buf1_2 = bytearray(LCD_SIZE_W * LCD_SIZE_H * 2) +disp_buf1.init(buf1_1, buf1_2, len(buf1_1)) +disp_drv = lv.disp_drv_t() +disp_drv.init() +disp_drv.draw_buf = disp_buf1 +disp_drv.flush_cb = lcd.lcd_write +disp_drv.hor_res = LCD_SIZE_W +disp_drv.ver_res = LCD_SIZE_H +disp_drv.register() + +# CST816初始化 +tp_cst816 = cst816(i2c_no = 2,irq=33,reset=32) +tp_cst816.activate() +tp_cst816.init() +print("cst816 init...") +# LVGL触摸注册 +indev_drv = lv.indev_drv_t() +indev_drv.init() +indev_drv.type = lv.INDEV_TYPE.POINTER +indev_drv.read_cb = tp_cst816.read +indev_drv.register() +gpio6 = Pin(Pin.GPIO33, Pin.OUT, Pin.PULL_PU, 0) +gpio6.write(0) + + +# 启动lvgv线程 +lv.tick_inc(5) +lv.task_handler() +print("lvgl init complete") + +# 界面风格1 +style_bar = lv.style_t() +style_bar.init() +style_bar.set_border_width(0) +style_bar.set_radius(0) +style_bar.set_pad_top(0) +style_bar.set_pad_bottom(0) +style_bar.set_pad_left(0) +style_bar.set_pad_right(0) + +screen = lv.obj() + +# Code 39字符集和对应的二进制码 +code_39_dict = {'0': '0001101000', '1': '1001000010', '2': '0011000010', '3': '1011000000', '4': '0001100010', + '5': '1001100000', '6': '0011100000', '7': '0001001010', '8': '1001001000', '9': '0011001000', + 'A': '1000010010', 'B': '0010010010', 'C': '1010010000', 'D': '0000110010', 'E': '1000110000', + 'F': '0010110000', 'G': '0000011010', 'H': '1000011000', 'I': '0010011000', 'J': '0000111000', + 'K': '1000000110', 'L': '0010000110', 'M': '1010000100', 'N': '0000100110', 'O': '1000100100', + 'P': '0010100100', 'Q': '0000001110', 'R': '1000001100', 'S': '0010001100', 'T': '0000101100', + 'U': '1100000010', 'V': '0110000010', 'W': '1110000000', 'X': '0100100010', 'Y': '1100100000', + 'Z': '0110100000', '-': '0100001010', '.': '1100001000', ' ': '0110001000', '*': '0100101000', + '$': '0101010000', '/': '0101000100', '+': '0100010100', '%': '0001010100'} + +# Code 39条形码的起始和结束符 +code_39_start = '0100101000' +code_39_end = '010010100' #结束符结尾'0'去掉 + +# Code 39条形码的宽度系数 +code_39_narrow = 1 +code_39_wide = 3 + + +def code_39_encode(data): + """将数据编码为Code 39条形码对应的二进制码""" + result = '' + for char in data: + try: + result += code_39_dict[char] + except Exception as e: + print("your data contains illegal code!") + return None + return result + + +def code_39_generate_binary(data): + """生成Code 39条形码对应的二进制码""" + encoded_data = code_39_encode(data) + if encoded_data: + # 添加起始和结束符 + encoded_data = code_39_start + encoded_data + code_39_end + return encoded_data + else: + return None + + +def code_39_generate_barcode(screen, data, width=180, height=80): + """生成Code 39条形码""" + left_curr_line = 0 + + # 删除上次的container + old_container = screen.get_child(-1) + if old_container: + old_container.delete() + + # 生成二进制码 + binary_data = code_39_generate_binary(data) + if not binary_data: + return + print("binary_data is ",binary_data) + + # 在LVGL中创建一个容器对象 + container = lv.obj(screen) + # container.set_size(width, height) + container.add_style(style_bar,lv.PART.MAIN | lv.STATE.DEFAULT) + container.center() + + # 计算每个条的宽度 + bar_width = width // (len(binary_data)) + + # 按照二进制码中的1和0,分别创建LVGL矩形对象 + for i in range(len(binary_data)): + if i % 2 == 0: + # 创建一个黑色矩形 + bar = lv.obj(container) + bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT) + if binary_data[i] == '1': + real_width = bar_width * code_39_wide + bar.set_size(real_width, height) + else: + real_width = bar_width * code_39_narrow + bar.set_size(real_width, height) + bar.align(lv.ALIGN.TOP_LEFT, left_curr_line, 0) + bar.set_style_bg_color(lv.color_make(0x00, 0x00, 0x00), lv.PART.MAIN | lv.STATE.DEFAULT) + left_curr_line += real_width + else: + # 创建一个白色矩形 + bar = lv.obj(container) + bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT) + if binary_data[i] == '1': + real_width = bar_width * code_39_wide + bar.set_size(real_width, height) + else: + real_width = bar_width * code_39_narrow + bar.set_size(real_width, height) + bar.align(lv.ALIGN.TOP_LEFT, left_curr_line, 0) + bar.set_style_bg_color(lv.color_make(0xFF, 0xFF, 0xFF), lv.PART.MAIN | lv.STATE.DEFAULT) + left_curr_line += real_width + + container.set_size(left_curr_line, height) + + +if __name__ == "__main__": + code_39_generate_barcode(screen,"A123 321") + lv.scr_load(screen) + diff --git a/3.code/1.watch/2.code/main.py b/3.code/1.watch/2.code/main.py index 83c43f66..a3738f60 100644 --- a/3.code/1.watch/2.code/main.py +++ b/3.code/1.watch/2.code/main.py @@ -47,20 +47,21 @@ if __name__ == '__main__': from ext.common import Abstract from ext.lcd import tp_cst816 from ext.btn_device_ec800m import BtnDevice - from ext.protocol import LK_ProtoCol,PING_ProtoCol,WT_ProtoCol,UD_ProtoCol,REMIND_ProtoCol, CR_ProtoCol,KA_ProtoCol,FIND_ProtoCol,POWEROFF_ProtoCol,ProtoColResolver,PHL_ProtoCol + from ext.protocol import LK_ProtoCol,PING_ProtoCol,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol,HRSTART_ProtoCol,WT_ProtoCol,UD_ProtoCol,REMIND_ProtoCol, CR_ProtoCol,KA_ProtoCol,FIND_ProtoCol,POWEROFF_ProtoCol,ProtoColResolver,PHL_ProtoCol import ext.mgr as mgr import ext.ui as _ui from ext.mgr import ConfigStoreManager, LocationManager, SockManager, \ - NetManager,AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldHrDataManager + NetManager,AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldHrDataManager,getStorageDataManager,getBrightnessManager,getHrTimeManager from ext.appAlipay import Alipay ,AlipayOpenScreen,Alipay_1_1,Alipay_invite,Alipay_inviting,\ Alipay_success,Alipay_paycode,Alipay_pay_success,Alipay_collect,Alipay_parent from ext.ui_WatchFaceScreen import WatchFaceScreen - from ext.alarm import ClkListScreen,ClockManager,NewEditClk,CLKTimeScreen,ClkPeriod + from ext.alarm import ClkListScreen,ClockManager,NewEditClk,CLKTimeScreen,ClkPeriod,PopupAlarmScreen from ext.ui_main_menu import MainMenuScreen from ext.appWechat import WechatScreen,TK_ProtoCol,MESSAGE_ProtoCol import ext.ui_setting as _ui_setting from ext.appFactoryMode import FactoryModeLocationScreen,FactoryModeScreen - from usr.test_sms import hrTimeHandlerManager + # from usr.test_sms import HRSTART_ProtoCol,getHrTimeManager,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol,getBrightnessManager,\ + # getStorageDataManager #from usr.ui_wechat import WechatScreen,TK_ProtoCol btn_device = BtnDevice(tp_cst816) @@ -121,14 +122,13 @@ if __name__ == '__main__': # ui.add_screen(_ui.PowerOnScreen()) ui.add_screen(FactoryModeLocationScreen()) ui.add_screen(FactoryModeScreen()) - # ui.add_screen(_ui.Setting2Screen()) + ui.add_screen(PopupAlarmScreen()) # ui.add_screen(_ui.Setting3Screen()) app = watchApp() app.set_ui(ui) - app.append_manager(mgr.BrightNessLevelManager()) \ - .append_manager(mgr.AlarmVolumeLevelManager()) \ + app.append_manager(mgr.AlarmVolumeLevelManager()) \ .append_manager(mgr.MsgVolumeLevelManager()) \ .append_manager(mgr.PhoneVolumeLevelManager()) \ .append_manager(mgr.DeviceInfoManager()) \ @@ -149,7 +149,9 @@ if __name__ == '__main__': app.append_manager(PhoneCallingManager()) app.append_manager(ClockManager()) app.append_manager(getOldHrDataManager()) - app.append_manager(hrTimeHandlerManager()) + app.append_manager(getHrTimeManager()) + app.append_manager(getBrightnessManager()) + app.append_manager(getStorageDataManager()) pcr = ProtoColResolver() pcr.add_support(LK_ProtoCol()) @@ -164,6 +166,10 @@ if __name__ == '__main__': pcr.add_support(MESSAGE_ProtoCol()) pcr.add_support(WT_ProtoCol()) pcr.add_support(REMIND_ProtoCol()) + pcr.add_support(HRSTART_ProtoCol()) + pcr.add_support(HEART_ProtoCol()) + pcr.add_support(OXYGEN_ProtoCol()) + pcr.add_support(OXYGEN_One_ProtoCol()) sm = SockManager() sm.add_support_resolver(pcr) app.append_manager(sm) diff --git a/3.code/1.watch/2.code/main_1.py b/3.code/1.watch/2.code/main_1.py index d6b77881..a3738f60 100644 --- a/3.code/1.watch/2.code/main_1.py +++ b/3.code/1.watch/2.code/main_1.py @@ -47,20 +47,21 @@ if __name__ == '__main__': from ext.common import Abstract from ext.lcd import tp_cst816 from ext.btn_device_ec800m import BtnDevice - from ext.protocol import LK_ProtoCol,PING_ProtoCol,WT_ProtoCol,UD_ProtoCol,REMIND_ProtoCol, CR_ProtoCol,KA_ProtoCol,FIND_ProtoCol,POWEROFF_ProtoCol,ProtoColResolver,PHL_ProtoCol + from ext.protocol import LK_ProtoCol,PING_ProtoCol,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol,HRSTART_ProtoCol,WT_ProtoCol,UD_ProtoCol,REMIND_ProtoCol, CR_ProtoCol,KA_ProtoCol,FIND_ProtoCol,POWEROFF_ProtoCol,ProtoColResolver,PHL_ProtoCol import ext.mgr as mgr import ext.ui as _ui from ext.mgr import ConfigStoreManager, LocationManager, SockManager, \ - NetManager,AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldHrDataManager + NetManager,AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldHrDataManager,getStorageDataManager,getBrightnessManager,getHrTimeManager from ext.appAlipay import Alipay ,AlipayOpenScreen,Alipay_1_1,Alipay_invite,Alipay_inviting,\ Alipay_success,Alipay_paycode,Alipay_pay_success,Alipay_collect,Alipay_parent from ext.ui_WatchFaceScreen import WatchFaceScreen - from ext.alarm import ClkListScreen,ClockManager,NewEditClk,CLKTimeScreen,ClkPeriod + from ext.alarm import ClkListScreen,ClockManager,NewEditClk,CLKTimeScreen,ClkPeriod,PopupAlarmScreen from ext.ui_main_menu import MainMenuScreen from ext.appWechat import WechatScreen,TK_ProtoCol,MESSAGE_ProtoCol import ext.ui_setting as _ui_setting from ext.appFactoryMode import FactoryModeLocationScreen,FactoryModeScreen - from usr.test_sms import hrTimeHandlerManager,HRSTART_ProtoCol,getHrTimeManager,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol + # from usr.test_sms import HRSTART_ProtoCol,getHrTimeManager,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol,getBrightnessManager,\ + # getStorageDataManager #from usr.ui_wechat import WechatScreen,TK_ProtoCol btn_device = BtnDevice(tp_cst816) @@ -121,14 +122,13 @@ if __name__ == '__main__': # ui.add_screen(_ui.PowerOnScreen()) ui.add_screen(FactoryModeLocationScreen()) ui.add_screen(FactoryModeScreen()) - # ui.add_screen(_ui.Setting2Screen()) + ui.add_screen(PopupAlarmScreen()) # ui.add_screen(_ui.Setting3Screen()) app = watchApp() app.set_ui(ui) - app.append_manager(mgr.BrightNessLevelManager()) \ - .append_manager(mgr.AlarmVolumeLevelManager()) \ + app.append_manager(mgr.AlarmVolumeLevelManager()) \ .append_manager(mgr.MsgVolumeLevelManager()) \ .append_manager(mgr.PhoneVolumeLevelManager()) \ .append_manager(mgr.DeviceInfoManager()) \ @@ -149,8 +149,9 @@ if __name__ == '__main__': app.append_manager(PhoneCallingManager()) app.append_manager(ClockManager()) app.append_manager(getOldHrDataManager()) - app.append_manager(hrTimeHandlerManager()) app.append_manager(getHrTimeManager()) + app.append_manager(getBrightnessManager()) + app.append_manager(getStorageDataManager()) pcr = ProtoColResolver() pcr.add_support(LK_ProtoCol()) diff --git a/3.code/1.watch/2.code/main_t.py b/3.code/1.watch/2.code/main_t.py index a4e3eaa7..c0c0cae6 100644 --- a/3.code/1.watch/2.code/main_t.py +++ b/3.code/1.watch/2.code/main_t.py @@ -98,8 +98,7 @@ if __name__ == '__main__': app = watchApp() app.set_ui(ui) - app.append_manager(mgr.BrightNessLevelManager()) \ - .append_manager(mgr.AlarmVolumeLevelManager()) \ + app.append_manager(mgr.AlarmVolumeLevelManager()) \ .append_manager(mgr.MsgVolumeLevelManager()) \ .append_manager(mgr.PhoneVolumeLevelManager()) \ .append_manager(mgr.DeviceInfoManager()) \ diff --git a/3.code/1.watch/2.code/mgr.py b/3.code/1.watch/2.code/mgr.py index bd5ae616..91794cd8 100644 --- a/3.code/1.watch/2.code/mgr.py +++ b/3.code/1.watch/2.code/mgr.py @@ -25,26 +25,7 @@ import quecgnss import wifiScan import math import voiceCall - -class BrightNessLevelManager(Abstract): - def __init__(self): - self.level = 0 - - def post_processor_after_instantiation(self): - EventMesh.subscribe("push_add_brightness_level", self.add) - EventMesh.subscribe("push_reduce_brightness_level", self.reduce) - EventMesh.subscribe("get_brightness_level", self.get) - - def add(self, event, msg): - if self.level < 7: - self.level = self.level + 1 - - def reduce(self, event, msg): - if self.level > 0: - self.level = self.level - 1 - - def get(self, event=None, msg=None): - return self.level +from misc import PWM class PhoneVolumeLevelManager(Abstract): def __init__(self): @@ -529,6 +510,7 @@ class DeviceInfoManager(Abstract): self.HR_Onestate = 0 self.get_hr_state = 0 self.get_spo2_state = 0 + self.set_hsenor_crt = 0 self.HR_OneTime = 0 self.Hr_Need_Open = 0 self.Spo2_Need_Open = 0 @@ -629,19 +611,19 @@ class DeviceInfoManager(Abstract): self.get_hr_state = EventMesh.publish("get_hr_state") self.get_spo2_state = EventMesh.publish("get_spo2_state") - print("hr_time:{} get_hr_state:{} get_spo2_state:{}".format(hr_time,self.get_hr_state,self.get_spo2_state)) + # print("hr_time:{} get_hr_state:{} get_spo2_state:{}".format(hr_time,self.get_hr_state,self.get_spo2_state)) if hr_time != None: - print("hr......01....{}\r\n".format(hr_time)) + # print("hr......01....{}\r\n".format(hr_time)) if hr_time > 0: - - self.HR_Onestate = 0 - self.HR_OneTime = 0 - print("get_hr_state:{} get_spo2_state:{} self.old_time:{} hr_time:{}".format(self.get_hr_state,self.get_spo2_state,self.old_time,hr_time)) + # print("get_hr_state:{} get_spo2_state:{} self.old_time:{} hr_time:{}".format(self.get_hr_state,self.get_spo2_state,self.old_time,hr_time)) if self.get_hr_state != 1 and self.get_spo2_state != 1: - + if self.HR_state == 0: + self.HR_Onestate = 0 + self.HR_OneTime = 0 + if self.old_time != hr_time: self.SENSOR_time = time_tmp#防止改变时间的时候正在开启测量突然10s就停止测量 if self.get_hr_state == 2 and self.HR_state == 1:#自动检测的心率还在测量立马关了测试 @@ -658,8 +640,7 @@ class DeviceInfoManager(Abstract): EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) self.old_time = hr_time - - print("time_tmp :{} self.SENSOR_time :{} time_tmp - self.SENSOR_time:{} self.HR_state:{}".format(time_tmp,self.SENSOR_time,time_tmp - self.SENSOR_time,self.HR_state)) + # print("time_tmp :{} self.SENSOR_time :{} time_tmp - self.SENSOR_time:{} self.HR_state:{}".format(time_tmp,self.SENSOR_time,time_tmp - self.SENSOR_time,self.HR_state)) if math.fabs(time_tmp - self.SENSOR_time) >= hr_time and self.HR_state == 0: print("START_HEART:1") EventMesh.publish("set_hr_state",2)#2代表后台进入测试 @@ -688,22 +669,103 @@ class DeviceInfoManager(Abstract): self.HR_state = 0 self.SENSOR_time = time_tmp else: - print("endtime.........\r\n") + # print("endtime.........\r\n") self.SENSOR_time = time_tmp self.HR_state = 0 - self.old_time = 0 + self.old_time = 0 + if self.HR_state == 0:#只有不在测量的时候才测单次的 + if self.get_spo2_state == 3 or self.get_hr_state == 3:#单次测量 + self.HR_state = 0 + self.HR_OneTime+=1 + if self.HR_OneTime == 1 and self.HR_Onestate == 0: + print("hr..........\r\n") + if self.get_hr_state == 3: + self.Hr_Need_Open = 1 + EventMesh.publish("set_hr_state",3)#2代表后台进入测试 + EventMesh.publish(constants.EVENT.START_HEART) + else: + self.Hr_Need_Open = 0 + + if self.get_spo2_state == 3 and self.Hr_Need_Open == 0: + self.Spo2_Need_Open = 1 + EventMesh.publish("set_spo2_state",3)#2代表后台进入测试 + EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)#K开血氧 + else: + self.Spo2_Need_Open = 0 + self.HR_Onestate = 1 + # print("self.HR_Onestate....3..:{} {} {} {} {}".format(self.HR_Onestate,self.get_hr_state,self.get_spo2_state,self.Hr_Need_Open,self.Spo2_Need_Open)) + elif self.HR_OneTime > 6 and self.HR_Onestate == 1: + # print("self.HR_Onestate...4....:{} {} {} {} {}".format(self.HR_Onestate,self.get_hr_state,self.get_spo2_state,self.Hr_Need_Open,self.Spo2_Need_Open)) + if self.Hr_Need_Open == 1:#需要关闭心率测量 + EventMesh.publish(constants.EVENT.STOP_HEART) + heart_value = EventMesh.publish(constants.EVENT.GET_HEART) + if heart_value > 50 and heart_value != None: + EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据 + print("STOP_HEART.01:") + if self.Spo2_Need_Open == 0 and self.get_spo2_state == 3: + EventMesh.publish("set_spo2_state",3)#2代表后台进入血氧测试 + EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)#K开血氧 + print("START_BLOOD_OXYGEN 02") + self.HR_Onestate = 2 + self.set_hsenor_crt = 2#血氧关闭 + else: + self.HR_Onestate = 0 + self.HR_OneTime = 0 + self.set_hsenor_crt = 0# + print("START_end......") + EventMesh.publish("set_hr_state",0)#2代表后台进入血氧测试 + EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试 + else: + if self.Spo2_Need_Open == 1:#停止测试血氧 + EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试 + EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#K开血氧 + spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN) + print("spo2_value:{}.......01..".format(spo2_value)) + if spo2_value > 85 and spo2_value != None: + EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value) + if self.Hr_Need_Open == 0 and self.get_hr_state == 3: + EventMesh.publish("set_hr_state",3)#2代表后台进入测试 + EventMesh.publish(constants.EVENT.START_HEART) + self.HR_Onestate = 2 + self.set_hsenor_crt = 1#心率 + else: + self.HR_Onestate = 0 + self.HR_OneTime = 0 + self.set_hsenor_crt = 2#血氧关闭 + print("STOP_BLOOD_OXYGEN:....09.....") + + elif self.HR_OneTime > 6+6 and self.HR_Onestate == 2: + print("HR_OneTime:....05") + if self.set_hsenor_crt == 2: + EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试 + EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#停止血氧测试 + spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN) + print("spo2_value:{}......08.....".format(spo2_value)) + if spo2_value > 85 and spo2_value != None: + EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value) + elif self.set_hsenor_crt == 1: + EventMesh.publish("set_hr_state",0)#0代表g关闭测试 + EventMesh.publish(constants.EVENT.STOP_HEART) + heart_value = EventMesh.publish(constants.EVENT.GET_HEART) + if heart_value > 50 and heart_value != None: + EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据 + print("STOP_HEART.03:") + self.HR_Onestate = 0 + else: + self.HR_Onestate = 0 + self.HR_OneTime = 0 + else: - print("hr......01....{} {} self.HR_Onestate {} {}".format(self.get_hr_state,self.get_spo2_state,self.HR_OneTime,self.HR_Onestate)) + # print("hr......01....{} {} self.HR_Onestate {} {}".format(self.get_hr_state,self.get_spo2_state,self.HR_OneTime,self.HR_Onestate)) self.SENSOR_time = time_tmp#进入最后一次的时间戳 self.old_time = 0 - if self.get_hr_state != 1 or self.get_spo2_state != 1: + if self.get_hr_state != 1 and self.get_spo2_state != 1: if self.get_spo2_state == 3 or self.get_hr_state == 3:#单次测量 self.HR_state = 0 - # 心率 self.HR_OneTime+=1 if self.HR_OneTime == 1 and self.HR_Onestate == 0: - print("hr..........\r\n") + print("hr.......01...\r\n") if self.get_hr_state == 3: self.Hr_Need_Open = 1 EventMesh.publish("set_hr_state",3)#2代表后台进入测试 @@ -718,24 +780,26 @@ class DeviceInfoManager(Abstract): else: self.Spo2_Need_Open = 0 self.HR_Onestate = 1 - print("self.HR_Onestate....1..:{} {} {} {} {}".format(self.HR_Onestate,self.get_hr_state,self.get_spo2_state,self.Hr_Need_Open,self.Spo2_Need_Open)) + print("self.HR_Onestate....3") elif self.HR_OneTime > 6 and self.HR_Onestate == 1: - print("self.HR_Onestate...2....:{} {} {} {} {}".format(self.HR_Onestate,self.get_hr_state,self.get_spo2_state,self.Hr_Need_Open,self.Spo2_Need_Open)) + print("self.HR_Onestate...4..") if self.Hr_Need_Open == 1:#需要关闭心率测量 EventMesh.publish(constants.EVENT.STOP_HEART) heart_value = EventMesh.publish(constants.EVENT.GET_HEART) if heart_value > 50 and heart_value != None: EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据 - print("STOP_HEART:") + print("STOP_HEART.06:") if self.Spo2_Need_Open == 0 and self.get_spo2_state == 3: EventMesh.publish("set_spo2_state",3)#2代表后台进入血氧测试 EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN)#K开血氧 - print("START_BLOOD_OXYGEN:") + print("START_BLOOD_OXYGEN 06") self.HR_Onestate = 2 + self.set_hsenor_crt = 2#血氧关闭 else: self.HR_Onestate = 0 self.HR_OneTime = 0 - print("START_end:") + self.set_hsenor_crt = 0# + print("START_end....06..") EventMesh.publish("set_hr_state",0)#2代表后台进入血氧测试 EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试 else: @@ -743,40 +807,40 @@ class DeviceInfoManager(Abstract): EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试 EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#K开血氧 spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN) - print("spo2_value:{}".format(spo2_value)) + print("spo2_value:{}.......01..".format(spo2_value)) if spo2_value > 85 and spo2_value != None: EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value) - self.HR_Onestate = 0 - self.HR_OneTime = 0 - print("STOP_BLOOD_OXYGEN:") + if self.Hr_Need_Open == 0 and self.get_hr_state == 3: + EventMesh.publish("set_hr_state",3)#2代表后台进入测试 + EventMesh.publish(constants.EVENT.START_HEART) + self.HR_Onestate = 2 + self.set_hsenor_crt = 1#心率 + else: + self.HR_Onestate = 0 + self.HR_OneTime = 0 + self.set_hsenor_crt = 2#血氧关闭 + print("STOP_BLOOD_OXYGEN:....06.....") elif self.HR_OneTime > 6+6 and self.HR_Onestate == 2: - print("HR_OneTime:") - EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试 - EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#停止血氧测试 - spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN) - print("spo2_value:{}".format(spo2_value)) - if spo2_value > 85 and spo2_value != None: - EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value) + print("HR_OneTime:....06") + if self.set_hsenor_crt == 2: + EventMesh.publish("set_spo2_state",0)#2代表后台进入血氧测试 + EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)#停止血氧测试 + spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN) + print("spo2_value:{}......06.....".format(spo2_value)) + if spo2_value > 85 and spo2_value != None: + EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value) + elif self.set_hsenor_crt == 1: + EventMesh.publish("set_hr_state",0)#0代表g关闭测试 + EventMesh.publish(constants.EVENT.STOP_HEART) + heart_value = EventMesh.publish(constants.EVENT.GET_HEART) + if heart_value > 50 and heart_value != None: + EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据 + print("STOP_HEART.06:") self.HR_Onestate = 0 else: - if self.get_hr_state == 2 and self.HR_state == 1:#自动检测的心率还在测量立马关了测试 - EventMesh.publish(constants.EVENT.STOP_HEART) - heart_value = EventMesh.publish(constants.EVENT.GET_HEART) - print("endtime....heart_value....{}".format(heart_value)) - if heart_value > 50 and heart_value != None: - EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据 - self.HR_state = 0 - elif self.get_spo2_state == 2 and self.HR_state == 2: - self.HR_state = 0 - spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN) - print("endtime....spo2_value....{}".format(heart_value)) - if spo2_value > 85 and spo2_value != None: - EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value) - EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) - else: - self.HR_state = 0 - + self.HR_Onestate = 0 + self.HR_OneTime = 0 voiceCall.setCallback(voice_callback) @@ -1415,7 +1479,7 @@ class CallLogManager(Abstract): # 通话记录 def __init__(self): self.read_call_log = {} - self.check_json = ql_fs.path_exists("//ext/static/storage_fileCall_log.json") + self.check_json = ql_fs.path_exists("/ext/static/storage_file/Call_log.json") if self.check_json == True: with open("/ext/static/storage_file/Call_log.json","r",encoding="utf-8") as fd: @@ -1521,6 +1585,119 @@ class getWeatherDataManager(Abstract): self.no_data = msg[8] +class getHrTimeManager(Abstract): + def __init__(self): + self.set_time = 0 + self.set_hr = 0 #0关闭 1手动 2 自动测量按照时间间隔测试心率 + self.set_spo2 = 0 + check = ql_fs.path_exists("/ext/static/storage_file/config.json") + if check == True: + with open("/ext/static/storage_file/config.json","r") as fd: + self.read_data = ujson.load(fd) + if self.read_data != {}: + b = str("measure_time") in self.read_data.keys() + if b == True: + self.set_time = self.read_data["measure_time"] + + 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_hr_state", self.set_hr_state) + EventMesh.subscribe("get_hr_state", self.get_hr_state) + EventMesh.subscribe("set_spo2_state", self.set_spo2_state) + EventMesh.subscribe("get_spo2_state", self.get_spo2_state) + + def set_time_hr_spo2(self, event, msg): + self.set_time = msg + + def get_time_hr_spo2(self, event, msg): + + return self.set_time + + def set_hr_state(self, event, msg): + self.set_hr = msg + + def get_hr_state(self, event, msg): + return self.set_hr + + def set_spo2_state(self, event, msg): + self.set_spo2 = msg + + def get_spo2_state(self, event, msg): + return self.set_spo2 + +class getBrightnessManager(Abstract):#获取亮度级别 + def __init__(self): + self.level = 5#默认值5 + self.read_data = {} + self.PWM_backlight = None + check = ql_fs.path_exists("/ext/static/storage_file/config.json") + if check == True: + with open("/ext/static/storage_file/config.json","r") as fd: + self.read_data = ujson.load(fd) + + def post_processor_after_instantiation(self): + EventMesh.subscribe("get_brightness_level", self.get_brightness_level) + EventMesh.subscribe("push_add_brightness_level", self.add) + EventMesh.subscribe("push_reduce_brightness_level", self.reduce) + EventMesh.subscribe("set_brightness_level", self.set_brightness_level) + + def set_brightness_level(self, event, msg): + self.level = msg + + def get_brightness_level(self, event, msg): + if self.read_data != {}: + b = str("brightness_level") in self.read_data.keys() + if b == True: + self.level = self.read_data["brightness_level"] + return self.level + def add(self, event, msg): + if self.level < 10: + self.level = self.level + 1 + self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, self.level, 10) + self.PWM_backlight.open() + + self.read_data = EventMesh.publish("get_storage_data") + self.read_data["brightness_level"] = self.level + + EventMesh.publish("set_storage_data", self.read_data) + with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd: + ujson.dump(self.read_data,fd) + + def reduce(self, event, msg): + if self.level > 0: + self.level = self.level - 1 + if self.level <= 0: + self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, 1, 10) + else: + self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS,self.level, 10) + + self.PWM_backlight.open() + self.read_data = EventMesh.publish("get_storage_data") + self.read_data["brightness_level"] = self.level + EventMesh.publish("set_storage_data", self.read_data) + with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd: + ujson.dump(self.read_data,fd) + +class getStorageDataManager(Abstract):#获取内存数据 + def __init__(self): + self.read_data = {} + check = ql_fs.path_exists("/ext/static/storage_file/config.json") + if check == True: + with open("/ext/static/storage_file/config.json","r") as fd: + self.read_data = ujson.load(fd) + + def post_processor_after_instantiation(self): + EventMesh.subscribe("set_storage_data", self.set_storage_data) + EventMesh.subscribe("get_storage_data", self.get_storage_data) + + def set_storage_data(self, event, msg): + if msg != None: + self.read_data = msg + + def get_storage_data(self, event, msg): + return self.read_data + diff --git a/3.code/1.watch/2.code/protocol.py b/3.code/1.watch/2.code/protocol.py index d9682721..c7abafc9 100644 --- a/3.code/1.watch/2.code/protocol.py +++ b/3.code/1.watch/2.code/protocol.py @@ -87,7 +87,7 @@ class ProtoCol(Abstract): def handler(self, event, msg): self.password = EventMesh.publish(constants.EVENT.GET_PASSWORD) - self.imei = "860132060004322"#EventMesh.publish(constants.EVENT.GET_IMEI) + self.imei = "867387060319166"#"867387060319188"#"867387060319177"#"867387060319166"#"860132060004322"#"867387060319166"#EventMesh.publish(constants.EVENT.GET_IMEI)#"860132060004322"#EventMesh.publish(constants.EVENT.GET_IMEI) self.cid = EventMesh.publish(constants.EVENT.GET_CID) self.imsi = EventMesh.publish(constants.EVENT.GET_IMSI) self.key = EventMesh.publish(constants.EVENT.GET_KEY) @@ -148,7 +148,7 @@ class LK_ProtoCol(ProtoCol): send_data = "SZKW*%s*0002*LK"%(self.imei) MD5_SIGN = self.pack_MD5_head(send_data) data = "[%s%s]"%(str(MD5_SIGN),send_data) - print("LK_ProtoCol:send:%s"%(data)) + # print("LK_ProtoCol:send:%s"%(data)) # 通过socket发送到服务器端 @@ -566,7 +566,7 @@ class REMIND_ProtoCol(ProtoCol): for i in range(0,7): if self.alarm_week[i] != '0': self.alarm_day.append(i) - self.alarm_list.append({"idx": num, "hour": alarm_time_hour, "minute": alarm_time_min, "days": self.alarm_day, "enabled": alarm_switch}) + self.alarm_list.append({"idx": num, "hour": alarm_time_hour, "minute": alarm_time_min, "days": self.alarm_day, "enabled": alarm_switch,"repeart":alarm_day_num}) with open("/ext/static/storage_file/alarm_msg.json", 'w',encoding='utf-8') as fd: ujson.dump(self.alarm_list,fd) num+=1 @@ -575,8 +575,136 @@ class REMIND_ProtoCol(ProtoCol): EventMesh.publish("push_update_alarm_show") EventMesh.publish(constants.PROTOCOL.REMIND_SEND) +class HRSTART_ProtoCol(ProtoCol): + """心率频率数据""" + TYPE = "hrtstart" + def send(self, event, msg): + # [SZKW*867387060319491*0008*hrtstart] + send_data = "SZKW*%s*008*hrtstart"%(self.imei) + MD5_SIGN = self.pack_MD5_head(send_data) + data = "[%s%s]"%(str(MD5_SIGN),send_data) + # print("HRSTART_ProtoCol:send:%s"%(data)) + # 通过socket发送到服务器端 + EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) + + def recv(self, event, msg): + """ + @param event: 心率数据下发 + @param msg: 接收到的下行数据 + """ + # b'SZKW*860132060004322*0035*REMIND,23-04-06,14:41:06,b6e0d4c6,1,27,-1,40,6DF157335E02' + # print("REMIND_ProtoCol RECV msg:%s"%(msg)) + # HRSTART_ProtoCol RECV msg:b'SZKW*860132060004322*000D*hrtstart,7200' msg_:7200 + msg = msg[1:-1] + msg_tmp = msg.decode('ascii') + msg_tmp = msg_tmp.split(',') + msg_tmp = msg_tmp[1] + # print("HRSTART_ProtoCol RECV msg:{} msg_:{}".format(msg,msg_tmp)) + hrTotal = int(msg_tmp) + if hrTotal == 1:#单次测量 + get_hr_state = EventMesh.publish("get_hr_state") + get_spo2_state = EventMesh.publish("get_spo2_state") + if get_hr_state == 0 or get_spo2_state == 3:#只要两个不在测量 单次优先级最低 + EventMesh.publish("set_hr_state",3)#3代表单次测量 + elif hrTotal > 1: + if hrTotal <= 300: + hrTotal = 300 + storage_tmp = EventMesh.publish("get_storage_data") + storage_tmp["measure_time"] = hrTotal + EventMesh.publish("set_storage_data", storage_tmp) + with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd: + ujson.dump(storage_tmp,fd) + + EventMesh.publish("set_time_hr_spo2",hrTotal) + + EventMesh.publish(constants.PROTOCOL.HRTSTART_SEND) + +class HEART_ProtoCol(ProtoCol): + """心率数据""" + TYPE = "heart" + + + def send(self, event, msg): + # [SZKW*334588000000156*len*heart,x] + # print("HEART:send:{}".format(msg)) + len_size = len(str(msg))+6 + send_data = "SZKW*%s*%04X*heart"%(self.imei,len_size) + MD5_SIGN = self.pack_MD5_head(send_data) + data = "[%s%s,%d]"%(str(MD5_SIGN),send_data,msg) + # print("HEART_ProtoCol:data:%s"%(data)) + # 通过socket发送到服务器端 + EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) + + def recv(self, event, msg): + """ + @param event: 心率数据下发 + @param msg: 接收到的下行数据 + """ + # print("HRSTART_ProtoCol RECV msg:") + #EventMesh.publish(constants.PROTOCOL.HEART_SEND) +class OXYGEN_ProtoCol(ProtoCol): + """上传血氧测试数据""" + TYPE = "oxygen" + def send(self, event, msg): + # [SZKW*334588000000156*len*heart,x] + # print("oxstart:send:{}".format(msg)) + len_size = len(str(msg))+6 + send_data = "SZKW*%s*%04X*oxygen"%(self.imei,len_size) + MD5_SIGN = self.pack_MD5_head(send_data) + data = "[%s%s,%d]"%(str(MD5_SIGN),send_data,msg) + # print("HEART_ProtoCol:data:%s"%(data)) + # 通过socket发送到服务器端 + EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) + + def recv(self, event, msg): + """ + @param event: 心率数据下发 + @param msg: 接收到的下行数据 + """ + # print("HRSTART_ProtoCol RECV msg:") + #EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND) + +class OXYGEN_One_ProtoCol(ProtoCol):#单次测量 + """上传血氧测试数据""" + TYPE = "oxstart" + +# 终端发送[XT*YYYYYYYYYYYYYYY*LEN*oxygen,x] +# x 表示血氧饱和度 +# 示例[XT*334588000000156*0009*oxygen,15] +# 平台回复:handler -> b'[SZKW*860132060004322*0009*oxstart,1]' +# [XT*334588000000156*0006*oxygen] + def send(self, event, msg): + # [SZKW*334588000000156*len*heart,x] + print("oxstart:") + send_data = "SZKW*%s*0007*oxstart"%(self.imei) + MD5_SIGN = self.pack_MD5_head(send_data) + data = "[%s%s]"%(str(MD5_SIGN),send_data) + # print("HEART_ProtoCol:data:%s"%(data)) + # 通过socket发送到服务器端 + EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) + + def recv(self, event, msg): + """ + @param event: 血氧单次测量下发 + @param msg: 接收到的下行数据 + """ + print("oxstart:{}".format(msg)) + msg = msg[1:-1] + msg_tmp = msg.decode('ascii') + msg_tmp = msg_tmp.split(',') + msg_tmp = msg_tmp[1] + state = int(msg_tmp) + get_hr_state = EventMesh.publish("get_hr_state") + get_spo2_state = EventMesh.publish("get_spo2_state") + if state == 1: + if get_hr_state == 3 or get_spo2_state == 0:#只要两个不在测量 单次优先级最低 + EventMesh.publish("set_spo2_state",3)#3代表单次测量 + EventMesh.publish(constants.PROTOCOL.OXSTART_SEND) + +#设置和获取心率上传频率时间 + class ProtoColResolver(object): def __init__(self): self.protocol_list = [] @@ -588,7 +716,7 @@ class ProtoColResolver(object): def handler(self, data): # 这里接收数据 - print("handler -> {}".format(data)) + # print("handler -> {}".format(data)) # if data.startswith('Init;'): # data = data[5:] # EventMesh.publish(constants.EVENT.SET_KEY, {"value": ujson.loads(data)['KEY']}) @@ -596,7 +724,7 @@ class ProtoColResolver(object): # elif data.startswith("Update;"): # data = data[7:] # EventMesh.publish(constants.PROTOCOL.H04_RECV, data) - print("handler:{}".format(type(data))) + # print("handler:{}".format(type(data))) data_tmp = data.decode('ascii') data_tmp = data_tmp.split(']')[0] #去掉] ProtoCol_type = data_tmp.split('*')[3] #拿到协议标识 diff --git a/3.code/1.watch/2.code/static/0_weather.jpg b/3.code/1.watch/2.code/static/0_weather.jpg deleted file mode 100644 index 7531acb8..00000000 Binary files a/3.code/1.watch/2.code/static/0_weather.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/0_weather.png b/3.code/1.watch/2.code/static/0_weather.png new file mode 100644 index 00000000..fb1b9cda Binary files /dev/null and b/3.code/1.watch/2.code/static/0_weather.png differ diff --git a/3.code/1.watch/2.code/static/1_weather.jpg b/3.code/1.watch/2.code/static/1_weather.jpg deleted file mode 100644 index aac5b3c8..00000000 Binary files a/3.code/1.watch/2.code/static/1_weather.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/1_weather.png b/3.code/1.watch/2.code/static/1_weather.png new file mode 100644 index 00000000..9a295164 Binary files /dev/null and b/3.code/1.watch/2.code/static/1_weather.png differ diff --git a/3.code/1.watch/2.code/static/2_weather.jpg b/3.code/1.watch/2.code/static/2_weather.jpg deleted file mode 100644 index b23ac858..00000000 Binary files a/3.code/1.watch/2.code/static/2_weather.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/2_weather.png b/3.code/1.watch/2.code/static/2_weather.png new file mode 100644 index 00000000..b77505bf Binary files /dev/null and b/3.code/1.watch/2.code/static/2_weather.png differ diff --git a/3.code/1.watch/2.code/static/3_weather.jpg b/3.code/1.watch/2.code/static/3_weather.jpg deleted file mode 100644 index 15ecdc97..00000000 Binary files a/3.code/1.watch/2.code/static/3_weather.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/3_weather.png b/3.code/1.watch/2.code/static/3_weather.png new file mode 100644 index 00000000..b598f0ff Binary files /dev/null and b/3.code/1.watch/2.code/static/3_weather.png differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_11.jpg b/3.code/1.watch/2.code/static/APP/alipay/1_11.jpg deleted file mode 100644 index 81d42b03..00000000 Binary files a/3.code/1.watch/2.code/static/APP/alipay/1_11.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_11.png b/3.code/1.watch/2.code/static/APP/alipay/1_11.png new file mode 100644 index 00000000..ecf67873 Binary files /dev/null and b/3.code/1.watch/2.code/static/APP/alipay/1_11.png differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_11_1.jpg b/3.code/1.watch/2.code/static/APP/alipay/1_11_1.jpg deleted file mode 100644 index 88c0c4b7..00000000 Binary files a/3.code/1.watch/2.code/static/APP/alipay/1_11_1.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_11_1.png b/3.code/1.watch/2.code/static/APP/alipay/1_11_1.png new file mode 100644 index 00000000..d4873f96 Binary files /dev/null and b/3.code/1.watch/2.code/static/APP/alipay/1_11_1.png differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_12.jpg b/3.code/1.watch/2.code/static/APP/alipay/1_12.jpg deleted file mode 100644 index 284ff431..00000000 Binary files a/3.code/1.watch/2.code/static/APP/alipay/1_12.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_12.png b/3.code/1.watch/2.code/static/APP/alipay/1_12.png new file mode 100644 index 00000000..58d75700 Binary files /dev/null and b/3.code/1.watch/2.code/static/APP/alipay/1_12.png differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_12_1_1.jpg b/3.code/1.watch/2.code/static/APP/alipay/1_12_1_1.jpg deleted file mode 100644 index 3b304a66..00000000 Binary files a/3.code/1.watch/2.code/static/APP/alipay/1_12_1_1.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_12_1_1.png b/3.code/1.watch/2.code/static/APP/alipay/1_12_1_1.png new file mode 100644 index 00000000..3ab2ceb6 Binary files /dev/null and b/3.code/1.watch/2.code/static/APP/alipay/1_12_1_1.png differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_13.jpg b/3.code/1.watch/2.code/static/APP/alipay/1_13.jpg deleted file mode 100644 index 433682da..00000000 Binary files a/3.code/1.watch/2.code/static/APP/alipay/1_13.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_13.png b/3.code/1.watch/2.code/static/APP/alipay/1_13.png new file mode 100644 index 00000000..b8afd22d Binary files /dev/null and b/3.code/1.watch/2.code/static/APP/alipay/1_13.png differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_13_1_1.jpg b/3.code/1.watch/2.code/static/APP/alipay/1_13_1_1.jpg deleted file mode 100644 index 1b43e750..00000000 Binary files a/3.code/1.watch/2.code/static/APP/alipay/1_13_1_1.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_13_1_1.png b/3.code/1.watch/2.code/static/APP/alipay/1_13_1_1.png new file mode 100644 index 00000000..0e1b0b84 Binary files /dev/null and b/3.code/1.watch/2.code/static/APP/alipay/1_13_1_1.png differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_1_1.jpg b/3.code/1.watch/2.code/static/APP/alipay/1_1_1.jpg deleted file mode 100644 index 40fdf420..00000000 Binary files a/3.code/1.watch/2.code/static/APP/alipay/1_1_1.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_1_1.png b/3.code/1.watch/2.code/static/APP/alipay/1_1_1.png new file mode 100644 index 00000000..3ff4400f Binary files /dev/null and b/3.code/1.watch/2.code/static/APP/alipay/1_1_1.png differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_2_1.jpg b/3.code/1.watch/2.code/static/APP/alipay/1_2_1.jpg deleted file mode 100644 index d54e4b17..00000000 Binary files a/3.code/1.watch/2.code/static/APP/alipay/1_2_1.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_2_1.png b/3.code/1.watch/2.code/static/APP/alipay/1_2_1.png new file mode 100644 index 00000000..481a84fc Binary files /dev/null and b/3.code/1.watch/2.code/static/APP/alipay/1_2_1.png differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_2_2.jpg b/3.code/1.watch/2.code/static/APP/alipay/1_2_2.jpg deleted file mode 100644 index ba423662..00000000 Binary files a/3.code/1.watch/2.code/static/APP/alipay/1_2_2.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/APP/alipay/1_2_2.png b/3.code/1.watch/2.code/static/APP/alipay/1_2_2.png new file mode 100644 index 00000000..7fcdf721 Binary files /dev/null and b/3.code/1.watch/2.code/static/APP/alipay/1_2_2.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_APP_QR_CODE.jpg b/3.code/1.watch/2.code/static/IMAGE_APP_QR_CODE.jpg deleted file mode 100644 index ca88cccf..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_APP_QR_CODE.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_APP_QR_CODE.png b/3.code/1.watch/2.code/static/IMAGE_APP_QR_CODE.png new file mode 100644 index 00000000..546c32b9 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_APP_QR_CODE.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_BUTTON_DELKEY.jpg b/3.code/1.watch/2.code/static/IMAGE_BUTTON_DELKEY.jpg deleted file mode 100644 index 92f76063..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_BUTTON_DELKEY.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_BUTTON_DELKEY.png b/3.code/1.watch/2.code/static/IMAGE_BUTTON_DELKEY.png new file mode 100644 index 00000000..bc007d78 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_BUTTON_DELKEY.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL.jpg b/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL.jpg deleted file mode 100644 index 95e0d79a..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL.png b/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL.png new file mode 100644 index 00000000..1bd304a8 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL_CONTACT.jpg b/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL_CONTACT.jpg deleted file mode 100644 index 4f02c402..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL_CONTACT.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL_CONTACT.png b/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL_CONTACT.png new file mode 100644 index 00000000..202af96a Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_BUTTON_DIAL_CONTACT.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.jpg b/3.code/1.watch/2.code/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.jpg deleted file mode 100644 index 8c1aa403..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png b/3.code/1.watch/2.code/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png new file mode 100644 index 00000000..5e181141 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NOTICE_CALL.jpg b/3.code/1.watch/2.code/static/IMAGE_NOTICE_CALL.jpg deleted file mode 100644 index c73bc5d8..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_NOTICE_CALL.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NOTICE_CALL.png b/3.code/1.watch/2.code/static/IMAGE_NOTICE_CALL.png new file mode 100644 index 00000000..9b27fca0 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_NOTICE_CALL.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NOTICE_NONE.jpg b/3.code/1.watch/2.code/static/IMAGE_NOTICE_NONE.jpg deleted file mode 100644 index 2a42a823..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_NOTICE_NONE.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NOTICE_NONE.png b/3.code/1.watch/2.code/static/IMAGE_NOTICE_NONE.png new file mode 100644 index 00000000..30cab58c Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_NOTICE_NONE.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY0_ICON.jpg b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY0_ICON.jpg deleted file mode 100644 index 0a5fbbb4..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY0_ICON.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY0_ICON.png b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY0_ICON.png new file mode 100644 index 00000000..afeec629 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY0_ICON.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY1_ICON.jpg b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY1_ICON.jpg deleted file mode 100644 index 35e08c11..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY1_ICON.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY1_ICON.png b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY1_ICON.png new file mode 100644 index 00000000..64fb0a81 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY1_ICON.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY2_ICON.jpg b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY2_ICON.jpg deleted file mode 100644 index 7500ae70..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY2_ICON.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY2_ICON.png b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY2_ICON.png new file mode 100644 index 00000000..ef5c9170 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY2_ICON.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY3_ICON.jpg b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY3_ICON.jpg deleted file mode 100644 index 8783cfa8..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY3_ICON.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY3_ICON.png b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY3_ICON.png new file mode 100644 index 00000000..2f02325a Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY3_ICON.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY4_ICON.jpg b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY4_ICON.jpg deleted file mode 100644 index 90d2a3ee..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY4_ICON.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY4_ICON.png b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY4_ICON.png new file mode 100644 index 00000000..6922ab2c Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY4_ICON.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY5_ICON.jpg b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY5_ICON.jpg deleted file mode 100644 index c66444d0..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY5_ICON.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY5_ICON.png b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY5_ICON.png new file mode 100644 index 00000000..90acbc7f Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY5_ICON.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY6_ICON.jpg b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY6_ICON.jpg deleted file mode 100644 index 43450ece..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY6_ICON.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY6_ICON.png b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY6_ICON.png new file mode 100644 index 00000000..b2213877 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY6_ICON.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY7_ICON.jpg b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY7_ICON.jpg deleted file mode 100644 index c4087a55..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY7_ICON.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY7_ICON.png b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY7_ICON.png new file mode 100644 index 00000000..db215335 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY7_ICON.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY8_ICON.jpg b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY8_ICON.jpg deleted file mode 100644 index e979dc92..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY8_ICON.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY8_ICON.png b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY8_ICON.png new file mode 100644 index 00000000..9d58122f Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY8_ICON.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY9_ICON.jpg b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY9_ICON.jpg deleted file mode 100644 index 522f3fbc..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY9_ICON.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY9_ICON.png b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY9_ICON.png new file mode 100644 index 00000000..856baa3b Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEY9_ICON.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYHASH_ICON.jpg b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYHASH_ICON.jpg deleted file mode 100644 index 754a1fcc..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYHASH_ICON.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYHASH_ICON.png b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYHASH_ICON.png new file mode 100644 index 00000000..cc524c57 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYHASH_ICON.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYSTAR_ICON.jpg b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYSTAR_ICON.jpg deleted file mode 100644 index ecba5a6e..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYSTAR_ICON.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYSTAR_ICON.png b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYSTAR_ICON.png new file mode 100644 index 00000000..0e847382 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_NUMBER_KEYSTAR_ICON.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_SECMENU_ALARM.jpg b/3.code/1.watch/2.code/static/IMAGE_SECMENU_ALARM.jpg deleted file mode 100644 index 393a5818..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_SECMENU_ALARM.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_SECMENU_ALARM.png b/3.code/1.watch/2.code/static/IMAGE_SECMENU_ALARM.png new file mode 100644 index 00000000..c533f103 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_SECMENU_ALARM.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_SECMENU_COUNTDOWN.jpg b/3.code/1.watch/2.code/static/IMAGE_SECMENU_COUNTDOWN.jpg deleted file mode 100644 index 2a3aafb8..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_SECMENU_COUNTDOWN.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_SECMENU_COUNTDOWN.png b/3.code/1.watch/2.code/static/IMAGE_SECMENU_COUNTDOWN.png new file mode 100644 index 00000000..29707900 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_SECMENU_COUNTDOWN.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_SECMENU_STEP.jpg b/3.code/1.watch/2.code/static/IMAGE_SECMENU_STEP.jpg deleted file mode 100644 index b10a13ac..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_SECMENU_STEP.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_SECMENU_STEP.png b/3.code/1.watch/2.code/static/IMAGE_SECMENU_STEP.png new file mode 100644 index 00000000..847f3418 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_SECMENU_STEP.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_SECMENU_STOPWATCH.jpg b/3.code/1.watch/2.code/static/IMAGE_SECMENU_STOPWATCH.jpg deleted file mode 100644 index 737bcbc8..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_SECMENU_STOPWATCH.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_SECMENU_STOPWATCH.png b/3.code/1.watch/2.code/static/IMAGE_SECMENU_STOPWATCH.png new file mode 100644 index 00000000..b1ff0864 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_SECMENU_STOPWATCH.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_SECMENU_WEATHER.jpg b/3.code/1.watch/2.code/static/IMAGE_SECMENU_WEATHER.jpg deleted file mode 100644 index b5884b2c..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_SECMENU_WEATHER.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_SECMENU_WEATHER.png b/3.code/1.watch/2.code/static/IMAGE_SECMENU_WEATHER.png new file mode 100644 index 00000000..6613eb44 Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_SECMENU_WEATHER.png differ diff --git a/3.code/1.watch/2.code/static/IMAGE_STEP.jpg b/3.code/1.watch/2.code/static/IMAGE_STEP.jpg deleted file mode 100644 index 2f9d654f..00000000 Binary files a/3.code/1.watch/2.code/static/IMAGE_STEP.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMAGE_STEP.png b/3.code/1.watch/2.code/static/IMAGE_STEP.png new file mode 100644 index 00000000..6b4c7bda Binary files /dev/null and b/3.code/1.watch/2.code/static/IMAGE_STEP.png differ diff --git a/3.code/1.watch/2.code/static/IMG_CC_HUNGUP1.jpg b/3.code/1.watch/2.code/static/IMG_CC_HUNGUP1.jpg deleted file mode 100644 index 57acd14a..00000000 Binary files a/3.code/1.watch/2.code/static/IMG_CC_HUNGUP1.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/IMG_CC_HUNGUP1.png b/3.code/1.watch/2.code/static/IMG_CC_HUNGUP1.png new file mode 100644 index 00000000..a725b9dd Binary files /dev/null and b/3.code/1.watch/2.code/static/IMG_CC_HUNGUP1.png differ diff --git a/3.code/1.watch/2.code/static/add_btn.jpg b/3.code/1.watch/2.code/static/add_btn.jpg deleted file mode 100644 index 86b84fc8..00000000 Binary files a/3.code/1.watch/2.code/static/add_btn.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/add_btn.png b/3.code/1.watch/2.code/static/add_btn.png new file mode 100644 index 00000000..4e180873 Binary files /dev/null and b/3.code/1.watch/2.code/static/add_btn.png differ diff --git a/3.code/1.watch/2.code/static/answer.jpg b/3.code/1.watch/2.code/static/answer.jpg deleted file mode 100644 index 7a7072ee..00000000 Binary files a/3.code/1.watch/2.code/static/answer.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/answer.png b/3.code/1.watch/2.code/static/answer.png new file mode 100644 index 00000000..4121841f Binary files /dev/null and b/3.code/1.watch/2.code/static/answer.png differ diff --git a/3.code/1.watch/2.code/static/cancel_icon.jpg b/3.code/1.watch/2.code/static/cancel_icon.jpg deleted file mode 100644 index 36c338ba..00000000 Binary files a/3.code/1.watch/2.code/static/cancel_icon.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/cancel_icon.png b/3.code/1.watch/2.code/static/cancel_icon.png new file mode 100644 index 00000000..5dcc48a6 Binary files /dev/null and b/3.code/1.watch/2.code/static/cancel_icon.png differ diff --git a/3.code/1.watch/2.code/static/charge_in.jpg b/3.code/1.watch/2.code/static/charge_in.jpg deleted file mode 100644 index 79380286..00000000 Binary files a/3.code/1.watch/2.code/static/charge_in.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/charge_in.png b/3.code/1.watch/2.code/static/charge_in.png new file mode 100644 index 00000000..2747b7d6 Binary files /dev/null and b/3.code/1.watch/2.code/static/charge_in.png differ diff --git a/3.code/1.watch/2.code/static/degree.jpg b/3.code/1.watch/2.code/static/degree.jpg deleted file mode 100644 index ba3324bd..00000000 Binary files a/3.code/1.watch/2.code/static/degree.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/degree.png b/3.code/1.watch/2.code/static/degree.png new file mode 100644 index 00000000..62b467f5 Binary files /dev/null and b/3.code/1.watch/2.code/static/degree.png differ diff --git a/3.code/1.watch/2.code/static/hang_up.jpg b/3.code/1.watch/2.code/static/hang_up.jpg deleted file mode 100644 index 9fa5c3b0..00000000 Binary files a/3.code/1.watch/2.code/static/hang_up.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/hang_up.png b/3.code/1.watch/2.code/static/hang_up.png new file mode 100644 index 00000000..ef3e0fbb Binary files /dev/null and b/3.code/1.watch/2.code/static/hang_up.png differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CALL.jpg b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CALL.jpg deleted file mode 100644 index f1da650c..00000000 Binary files a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CALL.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CALL.png b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CALL.png new file mode 100644 index 00000000..0cfd0673 Binary files /dev/null and b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CALL.png differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CONTACTS.jpg b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CONTACTS.jpg deleted file mode 100644 index 545bc8c6..00000000 Binary files a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CONTACTS.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CONTACTS.png b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CONTACTS.png new file mode 100644 index 00000000..8364c04b Binary files /dev/null and b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CONTACTS.png differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_HEART_RATE_HEALTH_DETECT.jpg b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_HEART_RATE_HEALTH_DETECT.jpg deleted file mode 100644 index ee433e32..00000000 Binary files a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_HEART_RATE_HEALTH_DETECT.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_HEART_RATE_HEALTH_DETECT.png b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_HEART_RATE_HEALTH_DETECT.png new file mode 100644 index 00000000..47cd1dd5 Binary files /dev/null and b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_HEART_RATE_HEALTH_DETECT.png differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SETTINGS.jpg b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SETTINGS.jpg deleted file mode 100644 index 5633f784..00000000 Binary files a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SETTINGS.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SETTINGS.png b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SETTINGS.png new file mode 100644 index 00000000..ba6eb680 Binary files /dev/null and b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SETTINGS.png differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SPO2_DETECT.jpg b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SPO2_DETECT.jpg deleted file mode 100644 index 8465acb5..00000000 Binary files a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SPO2_DETECT.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SPO2_DETECT.png b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SPO2_DETECT.png new file mode 100644 index 00000000..dbef69b6 Binary files /dev/null and b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SPO2_DETECT.png differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TEMPERATURE.jpg b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TEMPERATURE.jpg deleted file mode 100644 index 68d6c7d1..00000000 Binary files a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TEMPERATURE.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TEMPERATURE.png b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TEMPERATURE.png new file mode 100644 index 00000000..d9e7fd03 Binary files /dev/null and b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TEMPERATURE.png differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TOOLS.jpg b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TOOLS.jpg deleted file mode 100644 index c3218dcf..00000000 Binary files a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TOOLS.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TOOLS.png b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TOOLS.png new file mode 100644 index 00000000..6055104d Binary files /dev/null and b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TOOLS.png differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_WECHAT.jpg b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_WECHAT.jpg deleted file mode 100644 index dcb63f2c..00000000 Binary files a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_WECHAT.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_WECHAT.png b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_WECHAT.png new file mode 100644 index 00000000..316d84da Binary files /dev/null and b/3.code/1.watch/2.code/static/main_menu/main_menu2/IMAGE_ONE_PAGE_WECHAT.png differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/alipay_.jpg b/3.code/1.watch/2.code/static/main_menu/main_menu2/alipay_.jpg deleted file mode 100644 index 5465043e..00000000 Binary files a/3.code/1.watch/2.code/static/main_menu/main_menu2/alipay_.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/main_menu/main_menu2/alipay_.png b/3.code/1.watch/2.code/static/main_menu/main_menu2/alipay_.png new file mode 100644 index 00000000..78624e86 Binary files /dev/null and b/3.code/1.watch/2.code/static/main_menu/main_menu2/alipay_.png differ diff --git a/3.code/1.watch/2.code/static/menu_app_qrcode.jpg b/3.code/1.watch/2.code/static/menu_app_qrcode.jpg deleted file mode 100644 index e4b9eccd..00000000 Binary files a/3.code/1.watch/2.code/static/menu_app_qrcode.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/menu_app_qrcode.png b/3.code/1.watch/2.code/static/menu_app_qrcode.png new file mode 100644 index 00000000..8f23e127 Binary files /dev/null and b/3.code/1.watch/2.code/static/menu_app_qrcode.png differ diff --git a/3.code/1.watch/2.code/static/menu_bright.jpg b/3.code/1.watch/2.code/static/menu_bright.jpg deleted file mode 100644 index d5072f0b..00000000 Binary files a/3.code/1.watch/2.code/static/menu_bright.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/menu_bright.png b/3.code/1.watch/2.code/static/menu_bright.png new file mode 100644 index 00000000..e8f67d40 Binary files /dev/null and b/3.code/1.watch/2.code/static/menu_bright.png differ diff --git a/3.code/1.watch/2.code/static/menu_connect_device.jpg b/3.code/1.watch/2.code/static/menu_connect_device.jpg deleted file mode 100644 index ba518ada..00000000 Binary files a/3.code/1.watch/2.code/static/menu_connect_device.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/menu_connect_device.png b/3.code/1.watch/2.code/static/menu_connect_device.png new file mode 100644 index 00000000..e9d3b607 Binary files /dev/null and b/3.code/1.watch/2.code/static/menu_connect_device.png differ diff --git a/3.code/1.watch/2.code/static/menu_imei_qrcode.jpg b/3.code/1.watch/2.code/static/menu_imei_qrcode.jpg deleted file mode 100644 index 79ceca49..00000000 Binary files a/3.code/1.watch/2.code/static/menu_imei_qrcode.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/menu_imei_qrcode.png b/3.code/1.watch/2.code/static/menu_imei_qrcode.png new file mode 100644 index 00000000..0b24817b Binary files /dev/null and b/3.code/1.watch/2.code/static/menu_imei_qrcode.png differ diff --git a/3.code/1.watch/2.code/static/menu_language.jpg b/3.code/1.watch/2.code/static/menu_language.jpg deleted file mode 100644 index a156a9b9..00000000 Binary files a/3.code/1.watch/2.code/static/menu_language.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/menu_language.png b/3.code/1.watch/2.code/static/menu_language.png new file mode 100644 index 00000000..bc368af9 Binary files /dev/null and b/3.code/1.watch/2.code/static/menu_language.png differ diff --git a/3.code/1.watch/2.code/static/menu_poweroff.jpg b/3.code/1.watch/2.code/static/menu_poweroff.jpg deleted file mode 100644 index 52a73e2d..00000000 Binary files a/3.code/1.watch/2.code/static/menu_poweroff.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/menu_poweroff.png b/3.code/1.watch/2.code/static/menu_poweroff.png new file mode 100644 index 00000000..09434dc1 Binary files /dev/null and b/3.code/1.watch/2.code/static/menu_poweroff.png differ diff --git a/3.code/1.watch/2.code/static/menu_restore.jpg b/3.code/1.watch/2.code/static/menu_restore.jpg deleted file mode 100644 index 3f3b87df..00000000 Binary files a/3.code/1.watch/2.code/static/menu_restore.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/menu_restore.png b/3.code/1.watch/2.code/static/menu_restore.png new file mode 100644 index 00000000..3fb3bc5d Binary files /dev/null and b/3.code/1.watch/2.code/static/menu_restore.png differ diff --git a/3.code/1.watch/2.code/static/menu_theme_switch.jpg b/3.code/1.watch/2.code/static/menu_theme_switch.jpg deleted file mode 100644 index 55112318..00000000 Binary files a/3.code/1.watch/2.code/static/menu_theme_switch.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/menu_theme_switch.png b/3.code/1.watch/2.code/static/menu_theme_switch.png new file mode 100644 index 00000000..62ce1f9d Binary files /dev/null and b/3.code/1.watch/2.code/static/menu_theme_switch.png differ diff --git a/3.code/1.watch/2.code/static/menu_time.jpg b/3.code/1.watch/2.code/static/menu_time.jpg deleted file mode 100644 index 7d4f722c..00000000 Binary files a/3.code/1.watch/2.code/static/menu_time.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/menu_time.png b/3.code/1.watch/2.code/static/menu_time.png new file mode 100644 index 00000000..8b91c4cc Binary files /dev/null and b/3.code/1.watch/2.code/static/menu_time.png differ diff --git a/3.code/1.watch/2.code/static/menu_upgrade.jpg b/3.code/1.watch/2.code/static/menu_upgrade.jpg deleted file mode 100644 index 8332b8ce..00000000 Binary files a/3.code/1.watch/2.code/static/menu_upgrade.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/menu_upgrade.png b/3.code/1.watch/2.code/static/menu_upgrade.png new file mode 100644 index 00000000..8e18ff68 Binary files /dev/null and b/3.code/1.watch/2.code/static/menu_upgrade.png differ diff --git a/3.code/1.watch/2.code/static/menu_version.jpg b/3.code/1.watch/2.code/static/menu_version.jpg deleted file mode 100644 index f1e9618d..00000000 Binary files a/3.code/1.watch/2.code/static/menu_version.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/menu_version.png b/3.code/1.watch/2.code/static/menu_version.png new file mode 100644 index 00000000..8898c657 Binary files /dev/null and b/3.code/1.watch/2.code/static/menu_version.png differ diff --git a/3.code/1.watch/2.code/static/menu_volume.jpg b/3.code/1.watch/2.code/static/menu_volume.jpg deleted file mode 100644 index 064581d3..00000000 Binary files a/3.code/1.watch/2.code/static/menu_volume.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/menu_volume.png b/3.code/1.watch/2.code/static/menu_volume.png new file mode 100644 index 00000000..e49a0df1 Binary files /dev/null and b/3.code/1.watch/2.code/static/menu_volume.png differ diff --git a/3.code/1.watch/2.code/static/menu_watch_switch.jpg b/3.code/1.watch/2.code/static/menu_watch_switch.jpg deleted file mode 100644 index bdef4412..00000000 Binary files a/3.code/1.watch/2.code/static/menu_watch_switch.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/menu_watch_switch.png b/3.code/1.watch/2.code/static/menu_watch_switch.png new file mode 100644 index 00000000..96319194 Binary files /dev/null and b/3.code/1.watch/2.code/static/menu_watch_switch.png differ diff --git a/3.code/1.watch/2.code/static/mpsignal1.jpg b/3.code/1.watch/2.code/static/mpsignal1.jpg deleted file mode 100644 index 520bd7fb..00000000 Binary files a/3.code/1.watch/2.code/static/mpsignal1.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/mpsignal1.png b/3.code/1.watch/2.code/static/mpsignal1.png new file mode 100644 index 00000000..ba1c2c57 Binary files /dev/null and b/3.code/1.watch/2.code/static/mpsignal1.png differ diff --git a/3.code/1.watch/2.code/static/mpsignal2.jpg b/3.code/1.watch/2.code/static/mpsignal2.jpg deleted file mode 100644 index dd915c88..00000000 Binary files a/3.code/1.watch/2.code/static/mpsignal2.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/mpsignal2.png b/3.code/1.watch/2.code/static/mpsignal2.png new file mode 100644 index 00000000..16d8b5a6 Binary files /dev/null and b/3.code/1.watch/2.code/static/mpsignal2.png differ diff --git a/3.code/1.watch/2.code/static/mpsignal3.jpg b/3.code/1.watch/2.code/static/mpsignal3.jpg deleted file mode 100644 index 05baf08a..00000000 Binary files a/3.code/1.watch/2.code/static/mpsignal3.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/mpsignal3.png b/3.code/1.watch/2.code/static/mpsignal3.png new file mode 100644 index 00000000..16fe72e7 Binary files /dev/null and b/3.code/1.watch/2.code/static/mpsignal3.png differ diff --git a/3.code/1.watch/2.code/static/mpsignal4.jpg b/3.code/1.watch/2.code/static/mpsignal4.jpg deleted file mode 100644 index deeaffa8..00000000 Binary files a/3.code/1.watch/2.code/static/mpsignal4.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/mpsignal4.png b/3.code/1.watch/2.code/static/mpsignal4.png new file mode 100644 index 00000000..30a13b17 Binary files /dev/null and b/3.code/1.watch/2.code/static/mpsignal4.png differ diff --git a/3.code/1.watch/2.code/static/mpsignal5.jpg b/3.code/1.watch/2.code/static/mpsignal5.jpg deleted file mode 100644 index f0bbbfdc..00000000 Binary files a/3.code/1.watch/2.code/static/mpsignal5.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/mpsignal5.png b/3.code/1.watch/2.code/static/mpsignal5.png new file mode 100644 index 00000000..b5543c1f Binary files /dev/null and b/3.code/1.watch/2.code/static/mpsignal5.png differ diff --git a/3.code/1.watch/2.code/static/off_icon.jpg b/3.code/1.watch/2.code/static/off_icon.jpg deleted file mode 100644 index 9f019e31..00000000 Binary files a/3.code/1.watch/2.code/static/off_icon.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/off_icon.png b/3.code/1.watch/2.code/static/off_icon.png new file mode 100644 index 00000000..44f1bbfa Binary files /dev/null and b/3.code/1.watch/2.code/static/off_icon.png differ diff --git a/3.code/1.watch/2.code/static/poweroff_icon.jpg b/3.code/1.watch/2.code/static/poweroff_icon.jpg deleted file mode 100644 index e3aff09a..00000000 Binary files a/3.code/1.watch/2.code/static/poweroff_icon.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/poweroff_icon.png b/3.code/1.watch/2.code/static/poweroff_icon.png new file mode 100644 index 00000000..661295d8 Binary files /dev/null and b/3.code/1.watch/2.code/static/poweroff_icon.png differ diff --git a/3.code/1.watch/2.code/static/reduce_btn.jpg b/3.code/1.watch/2.code/static/reduce_btn.jpg deleted file mode 100644 index 2d76ae23..00000000 Binary files a/3.code/1.watch/2.code/static/reduce_btn.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/reduce_btn.png b/3.code/1.watch/2.code/static/reduce_btn.png new file mode 100644 index 00000000..7c07bd0c Binary files /dev/null and b/3.code/1.watch/2.code/static/reduce_btn.png differ diff --git a/3.code/1.watch/2.code/static/stopwatch_play.jpg b/3.code/1.watch/2.code/static/stopwatch_play.jpg deleted file mode 100644 index 9deda48c..00000000 Binary files a/3.code/1.watch/2.code/static/stopwatch_play.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/stopwatch_play.png b/3.code/1.watch/2.code/static/stopwatch_play.png new file mode 100644 index 00000000..6984f950 Binary files /dev/null and b/3.code/1.watch/2.code/static/stopwatch_play.png differ diff --git a/3.code/1.watch/2.code/static/stopwatch_reset.jpg b/3.code/1.watch/2.code/static/stopwatch_reset.jpg deleted file mode 100644 index 013ff61f..00000000 Binary files a/3.code/1.watch/2.code/static/stopwatch_reset.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/stopwatch_reset.png b/3.code/1.watch/2.code/static/stopwatch_reset.png new file mode 100644 index 00000000..a5f85106 Binary files /dev/null and b/3.code/1.watch/2.code/static/stopwatch_reset.png differ diff --git a/3.code/1.watch/2.code/static/stopwatch_stop.jpg b/3.code/1.watch/2.code/static/stopwatch_stop.jpg deleted file mode 100644 index 4b4a9982..00000000 Binary files a/3.code/1.watch/2.code/static/stopwatch_stop.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/stopwatch_stop.png b/3.code/1.watch/2.code/static/stopwatch_stop.png new file mode 100644 index 00000000..d102e527 Binary files /dev/null and b/3.code/1.watch/2.code/static/stopwatch_stop.png differ diff --git a/3.code/1.watch/2.code/static/sunny.jpg b/3.code/1.watch/2.code/static/sunny.jpg deleted file mode 100644 index f49510e5..00000000 Binary files a/3.code/1.watch/2.code/static/sunny.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/temp_bg.jpg b/3.code/1.watch/2.code/static/temp_bg.jpg deleted file mode 100644 index 59bdff68..00000000 Binary files a/3.code/1.watch/2.code/static/temp_bg.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/temp_bg.png b/3.code/1.watch/2.code/static/temp_bg.png new file mode 100644 index 00000000..52a5ae8d Binary files /dev/null and b/3.code/1.watch/2.code/static/temp_bg.png differ diff --git a/3.code/1.watch/2.code/static/time_down.jpg b/3.code/1.watch/2.code/static/time_down.jpg deleted file mode 100644 index ac9cc05a..00000000 Binary files a/3.code/1.watch/2.code/static/time_down.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/time_down.png b/3.code/1.watch/2.code/static/time_down.png new file mode 100644 index 00000000..6338ed3c Binary files /dev/null and b/3.code/1.watch/2.code/static/time_down.png differ diff --git a/3.code/1.watch/2.code/static/time_finish.jpg b/3.code/1.watch/2.code/static/time_finish.jpg deleted file mode 100644 index 0259ac01..00000000 Binary files a/3.code/1.watch/2.code/static/time_finish.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/time_finish.png b/3.code/1.watch/2.code/static/time_finish.png new file mode 100644 index 00000000..a9826076 Binary files /dev/null and b/3.code/1.watch/2.code/static/time_finish.png differ diff --git a/3.code/1.watch/2.code/static/time_up.jpg b/3.code/1.watch/2.code/static/time_up.jpg deleted file mode 100644 index 441aa09d..00000000 Binary files a/3.code/1.watch/2.code/static/time_up.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/time_up.png b/3.code/1.watch/2.code/static/time_up.png new file mode 100644 index 00000000..b0e189b7 Binary files /dev/null and b/3.code/1.watch/2.code/static/time_up.png differ diff --git a/3.code/1.watch/2.code/static/update.jpg b/3.code/1.watch/2.code/static/update.jpg deleted file mode 100644 index 3ce99f03..00000000 Binary files a/3.code/1.watch/2.code/static/update.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/update.png b/3.code/1.watch/2.code/static/update.png new file mode 100644 index 00000000..7aea5cf9 Binary files /dev/null and b/3.code/1.watch/2.code/static/update.png differ diff --git a/3.code/1.watch/2.code/static/vbat_0.jpg b/3.code/1.watch/2.code/static/vbat_0.jpg deleted file mode 100644 index 511db7c3..00000000 Binary files a/3.code/1.watch/2.code/static/vbat_0.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/vbat_0.png b/3.code/1.watch/2.code/static/vbat_0.png new file mode 100644 index 00000000..eea15437 Binary files /dev/null and b/3.code/1.watch/2.code/static/vbat_0.png differ diff --git a/3.code/1.watch/2.code/static/vbat_100.jpg b/3.code/1.watch/2.code/static/vbat_100.jpg deleted file mode 100644 index c8b4259d..00000000 Binary files a/3.code/1.watch/2.code/static/vbat_100.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/vbat_100.png b/3.code/1.watch/2.code/static/vbat_100.png new file mode 100644 index 00000000..195b82ab Binary files /dev/null and b/3.code/1.watch/2.code/static/vbat_100.png differ diff --git a/3.code/1.watch/2.code/static/vbat_20.jpg b/3.code/1.watch/2.code/static/vbat_20.jpg deleted file mode 100644 index fd0b86e1..00000000 Binary files a/3.code/1.watch/2.code/static/vbat_20.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/vbat_20.png b/3.code/1.watch/2.code/static/vbat_20.png new file mode 100644 index 00000000..20fe2436 Binary files /dev/null and b/3.code/1.watch/2.code/static/vbat_20.png differ diff --git a/3.code/1.watch/2.code/static/vbat_40.jpg b/3.code/1.watch/2.code/static/vbat_40.jpg deleted file mode 100644 index 1f00b2a4..00000000 Binary files a/3.code/1.watch/2.code/static/vbat_40.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/vbat_40.png b/3.code/1.watch/2.code/static/vbat_40.png new file mode 100644 index 00000000..f432c8bd Binary files /dev/null and b/3.code/1.watch/2.code/static/vbat_40.png differ diff --git a/3.code/1.watch/2.code/static/vbat_60.jpg b/3.code/1.watch/2.code/static/vbat_60.jpg deleted file mode 100644 index 047e69bd..00000000 Binary files a/3.code/1.watch/2.code/static/vbat_60.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/vbat_60.png b/3.code/1.watch/2.code/static/vbat_60.png new file mode 100644 index 00000000..d3955e3e Binary files /dev/null and b/3.code/1.watch/2.code/static/vbat_60.png differ diff --git a/3.code/1.watch/2.code/static/vbat_80.jpg b/3.code/1.watch/2.code/static/vbat_80.jpg deleted file mode 100644 index 31bee1df..00000000 Binary files a/3.code/1.watch/2.code/static/vbat_80.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/vbat_80.png b/3.code/1.watch/2.code/static/vbat_80.png new file mode 100644 index 00000000..20a9b812 Binary files /dev/null and b/3.code/1.watch/2.code/static/vbat_80.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/bg.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/bg.jpg deleted file mode 100644 index 750057c1..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/bg.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/bg.png b/3.code/1.watch/2.code/static/watch_plate/style_1/bg.png new file mode 100644 index 00000000..71c43384 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/bg.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/blood.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/blood.jpg deleted file mode 100644 index edc286dc..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/blood.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/blood.png b/3.code/1.watch/2.code/static/watch_plate/style_1/blood.png new file mode 100644 index 00000000..15cb89dc Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/blood.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/heart.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/heart.jpg deleted file mode 100644 index 05f942a8..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/heart.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/heart.png b/3.code/1.watch/2.code/static/watch_plate/style_1/heart.png new file mode 100644 index 00000000..519608b1 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/heart.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/step.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/step.jpg deleted file mode 100644 index f16ef9cc..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/step.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/step.png b/3.code/1.watch/2.code/static/watch_plate/style_1/step.png new file mode 100644 index 00000000..385213b6 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/step.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/0.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/time/0.jpg deleted file mode 100644 index 62e72ad3..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/time/0.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/0.png b/3.code/1.watch/2.code/static/watch_plate/style_1/time/0.png new file mode 100644 index 00000000..def8e2cb Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/time/0.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/1.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/time/1.jpg deleted file mode 100644 index 7f84eca3..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/time/1.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/1.png b/3.code/1.watch/2.code/static/watch_plate/style_1/time/1.png new file mode 100644 index 00000000..5f405173 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/time/1.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/2.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/time/2.jpg deleted file mode 100644 index 137d2098..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/time/2.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/2.png b/3.code/1.watch/2.code/static/watch_plate/style_1/time/2.png new file mode 100644 index 00000000..149e760f Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/time/2.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/3.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/time/3.jpg deleted file mode 100644 index b00537d0..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/time/3.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/3.png b/3.code/1.watch/2.code/static/watch_plate/style_1/time/3.png new file mode 100644 index 00000000..1b66e2bb Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/time/3.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/4.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/time/4.jpg deleted file mode 100644 index 00d38374..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/time/4.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/4.png b/3.code/1.watch/2.code/static/watch_plate/style_1/time/4.png new file mode 100644 index 00000000..143e3c06 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/time/4.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/5.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/time/5.jpg deleted file mode 100644 index 51870ff3..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/time/5.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/5.png b/3.code/1.watch/2.code/static/watch_plate/style_1/time/5.png new file mode 100644 index 00000000..7cee6364 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/time/5.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/6.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/time/6.jpg deleted file mode 100644 index d5bd2f2b..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/time/6.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/6.png b/3.code/1.watch/2.code/static/watch_plate/style_1/time/6.png new file mode 100644 index 00000000..d18b2085 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/time/6.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/7.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/time/7.jpg deleted file mode 100644 index 17a9fbc2..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/time/7.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/7.png b/3.code/1.watch/2.code/static/watch_plate/style_1/time/7.png new file mode 100644 index 00000000..3b620289 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/time/7.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/8.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/time/8.jpg deleted file mode 100644 index e06aff66..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/time/8.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/8.png b/3.code/1.watch/2.code/static/watch_plate/style_1/time/8.png new file mode 100644 index 00000000..6dbd9f3f Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/time/8.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/9.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/time/9.jpg deleted file mode 100644 index a4e2c9d1..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/time/9.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/9.png b/3.code/1.watch/2.code/static/watch_plate/style_1/time/9.png new file mode 100644 index 00000000..e88f1b59 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/time/9.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/colon.jpg b/3.code/1.watch/2.code/static/watch_plate/style_1/time/colon.jpg deleted file mode 100644 index 621c9333..00000000 Binary files a/3.code/1.watch/2.code/static/watch_plate/style_1/time/colon.jpg and /dev/null differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_1/time/colon.png b/3.code/1.watch/2.code/static/watch_plate/style_1/time/colon.png new file mode 100644 index 00000000..21eca502 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_1/time/colon.png differ diff --git a/3.code/1.watch/2.code/test_sms.py b/3.code/1.watch/2.code/test_sms.py index 514b337d..c5135639 100644 --- a/3.code/1.watch/2.code/test_sms.py +++ b/3.code/1.watch/2.code/test_sms.py @@ -14,398 +14,272 @@ from ext import constants import osTimer import utime from machine import RTC -#-------------------------------------weather-----------------# -# weather_screen = lv.obj() -# weather = lv.obj(weather_screen) -# weather.center() -# weather.set_size(240, 320) -# weather.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - -# weather_img = lv.img(weather) -# weather_img.set_pos(10, 10) -# weather_img.set_size(135, 120) - -# weather_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - -# no_weather_img = lv.img(weather) -# no_weather_img.set_pos(10, 10) -# no_weather_img.set_size(135, 120) -# no_weather_img.set_src("E:/static/update.jpg") -# no_weather_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - -# weather_tem_label = lv.label(weather) -# weather_tem_label.set_pos(155, 40) -# weather_tem_label.set_size(85, 50) -# weather_tem_label.set_text("_ _C") -# weather_tem_label.set_long_mode(lv.label.LONG.WRAP) -# weather_tem_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# weather_tem_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -# weather_detail_label = lv.label(weather) -# weather_detail_label.set_pos(155, 80) -# weather_detail_label.set_size(85, 50) -# weather_detail_label.set_text("-/-") -# weather_detail_label.set_long_mode(lv.label.LONG.WRAP) -# weather_detail_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# weather_detail_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -# weather_location_label = lv.label(weather) -# weather_location_label.set_pos(0, 200) -# weather_location_label.set_size(240, 50) -# weather_location_label.set_text("--") -# weather_location_label.set_long_mode(lv.label.LONG.WRAP) -# weather_location_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# weather_location_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -# no_connect_label = lv.label(weather) -# no_connect_label.set_pos(0, 200) -# no_connect_label.set_size(240, 40) -# no_connect_label.set_text("找不到服务器") -# no_connect_label.set_long_mode(lv.label.LONG.WRAP) -# no_connect_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# no_connect_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -# no_connect_label1 = lv.label(weather) -# no_connect_label1.set_pos(0, 250) -# no_connect_label1.set_size(240, 70) -# no_connect_label1.set_text("请联网后重试") -# no_connect_label1.set_long_mode(lv.label.LONG.WRAP) -# no_connect_label1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# no_connect_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -# class WeatherScreen(Screen): -# NAME = "weather" +from misc import PWM +#心率定时测量 +# class hrTimeHandlerManager(Abstract): # def __init__(self): # super().__init__() -# self.meta = weather_screen -# self.weather_data = {} -# EventMesh.subscribe("updata_weather_show", self.update_weather_data) - - -# def post_processor_after_initialization(self): -# EventMesh.publish("updata_weather_show") - - -# def update_weather_data(self, event, msg): - -# connect = EventMesh.publish(constants.EVENT.GET_CONNECT) #获取网络状态 -# self.weather_data = EventMesh.publish("get_weather_data") -# if connect != 0: -# no_data = self.weather_data[8] -# if no_data != 0: -# no_weather_img.add_flag(lv.obj.FLAG.HIDDEN) -# weather_img.clear_flag(lv.obj.FLAG.HIDDEN) -# no_connect_label.set_text(" ") -# no_connect_label1.set_text(" ") -# # print("self.weather_data:{}".format(self.weather_data)) -# type = self.weather_data[3] -# if type == None: -# weather_img.set_src("E:/static/update.jpg")#天气类型 -# else: -# weather_img.set_src("E:/static/{}_weather.jpg".format(type))#天气类型 - -# temp = self.weather_data[4] -# if temp == None: -# weather_tem_label.set_text("_ _C") -# else: -# weather_tem_label.set_text("{}C".format(temp)) - -# date = self.weather_data[0] -# if date != '{}': -# date_month = date.split('-')[1] -# date_day = date.split('-')[2] -# weather_detail_label.set_text("{}/{}".format(date_month,date_day))#天气更新时间 -# else: -# weather_detail_label.set_text("-/-") - -# city = self.weather_data[7] -# if city != '{}': -# weather_location_label.set_text("{}".format(city))#城市 -# else: -# weather_location_label.set_text("--") -# else:#已联网未获取到天气数据 -# weather_location_label.set_text(" ") -# weather_detail_label.set_text("-/-") -# weather_tem_label.set_text("_ _C") -# no_connect_label.set_text("未获取网络数据") -# no_connect_label1.set_text("请稍候重试") +# self.rtc = RTC() +# self.timer = osTimer() +# self.second = 0 -# else: -# weather_location_label.set_text(" ") -# weather_detail_label.set_text("-/-") -# weather_tem_label.set_text("_ _C") - -# no_weather_img.clear_flag(lv.obj.FLAG.HIDDEN) -# weather_img.add_flag(lv.obj.FLAG.HIDDEN) -# no_connect_label.set_text("找不到服务器") -# no_connect_label1.set_text("请联网后重试") - -# def done_return(self): -# EventMesh.publish("load_screen", {"screen": "toolbox"}) - -# def btn1_release(self): -# EventMesh.publish("load_screen", {"screen": "watchface"}) +# def post_processor_after_instantiation(self): + +# date_tmp = utime.localtime() +# time_tmp = utime.mktime(date_tmp) +# self.second = time_tmp +# # self.timer.start(1*1000,1,self._min_callback) + + +# def _min_callback(self,args): +# self.second+=1 +# date_tmp = utime.localtime() +# time_tmp = utime.mktime(date_tmp) +# rtc_now_time = self.rtc.datetime() +# if (self.second % 60) == 0: +# rtc_now_time = self.rtc.datetime() +# print("hrTimeHandlerManager 当前的rtc时间:{}".format(rtc_now_time)) + +# print("---!self.second!!!!---:{} time_tmp:{} rtc_now_time:{}".format(self.second,time_tmp,rtc_now_time)) -# def btn8_press(self): -# EventMesh.publish("load_screen", {"screen": "watchface"}) +# class HRSTART_ProtoCol(ProtoCol): +# """心率频率数据""" +# TYPE = "hrtstart" +# def send(self, event, msg): +# # [SZKW*867387060319491*0008*hrtstart] +# send_data = "SZKW*%s*008*hrtstart"%(self.imei) +# MD5_SIGN = self.pack_MD5_head(send_data) +# data = "[%s%s]"%(str(MD5_SIGN),send_data) +# # print("HRSTART_ProtoCol:send:%s"%(data)) +# # 通过socket发送到服务器端 +# EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) +# def recv(self, event, msg): +# """ +# @param event: 心率数据下发 +# @param msg: 接收到的下行数据 +# """ +# # b'SZKW*860132060004322*0035*REMIND,23-04-06,14:41:06,b6e0d4c6,1,27,-1,40,6DF157335E02' +# # print("REMIND_ProtoCol RECV msg:%s"%(msg)) +# # HRSTART_ProtoCol RECV msg:b'SZKW*860132060004322*000D*hrtstart,7200' msg_:7200 +# msg = msg[1:-1] +# msg_tmp = msg.decode('ascii') +# msg_tmp = msg_tmp.split(',') +# msg_tmp = msg_tmp[1] +# # print("HRSTART_ProtoCol RECV msg:{} msg_:{}".format(msg,msg_tmp)) +# hrTotal = int(msg_tmp) +# if hrTotal == 1:#单次测量 +# get_hr_state = EventMesh.publish("get_hr_state") +# get_spo2_state = EventMesh.publish("get_spo2_state") +# if get_hr_state == 0 or get_spo2_state == 3:#只要两个不在测量 单次优先级最低 +# EventMesh.publish("set_hr_state",3)#3代表单次测量 +# elif hrTotal > 1: +# if hrTotal <= 300: +# hrTotal = 300 +# storage_tmp = EventMesh.publish("get_storage_data") +# storage_tmp["measure_time"] = hrTotal +# EventMesh.publish("set_storage_data", storage_tmp) +# with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd: +# ujson.dump(storage_tmp,fd) + +# EventMesh.publish("set_time_hr_spo2",hrTotal) + +# EventMesh.publish(constants.PROTOCOL.HRTSTART_SEND) +# class HEART_ProtoCol(ProtoCol): +# """心率数据""" +# TYPE = "heart" -# class REMIND_ProtoCol(ProtoCol): -# """闹钟数据""" -# TYPE = "REMIND" +# def send(self, event, msg): +# # [SZKW*334588000000156*len*heart,x] +# # print("HEART:send:{}".format(msg)) +# len_size = len(str(msg))+6 +# send_data = "SZKW*%s*%04X*heart"%(self.imei,len_size) +# MD5_SIGN = self.pack_MD5_head(send_data) +# data = "[%s%s,%d]"%(str(MD5_SIGN),send_data,msg) +# # print("HEART_ProtoCol:data:%s"%(data)) +# # 通过socket发送到服务器端 +# EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) +# def recv(self, event, msg): +# """ +# @param event: 心率数据下发 +# @param msg: 接收到的下行数据 +# """ +# # print("HRSTART_ProtoCol RECV msg:") +# #EventMesh.publish(constants.PROTOCOL.HEART_SEND) +# class OXYGEN_ProtoCol(ProtoCol): +# """上传血氧测试数据""" +# TYPE = "oxygen" # def send(self, event, msg): -# # [SZKW*867387060319491*0008*REMIND] -# send_data = "SZKW*%s*003*REMIND"%(self.imei) +# # [SZKW*334588000000156*len*heart,x] +# # print("oxstart:send:{}".format(msg)) +# len_size = len(str(msg))+6 +# send_data = "SZKW*%s*%04X*oxygen"%(self.imei,len_size) # MD5_SIGN = self.pack_MD5_head(send_data) -# data = "[%s%s]"%(str(MD5_SIGN),send_data) -# # print("REMIND_ProtoCol:send:%s"%(data)) +# data = "[%s%s,%d]"%(str(MD5_SIGN),send_data,msg) +# # print("HEART_ProtoCol:data:%s"%(data)) # # 通过socket发送到服务器端 -# EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND, data) +# EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) # def recv(self, event, msg): # """ -# @param event: 闹钟数据下发 +# @param event: 心率数据下发 # @param msg: 接收到的下行数据 # """ -# # b'SZKW*860132060004322*0035*REMIND,23-04-06,14:41:06,b6e0d4c6,1,27,-1,40,6DF157335E02' -# # print("REMIND_ProtoCol RECV msg:%s"%(msg)) -# self.alarm_list = [] +# # print("HRSTART_ProtoCol RECV msg:") +# #EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND) + +# class OXYGEN_One_ProtoCol(ProtoCol):#单次测量 +# """上传血氧测试数据""" +# TYPE = "oxstart" + +# # 终端发送[XT*YYYYYYYYYYYYYYY*LEN*oxygen,x] +# # x 表示血氧饱和度 +# # 示例[XT*334588000000156*0009*oxygen,15] +# # 平台回复:handler -> b'[SZKW*860132060004322*0009*oxstart,1]' +# # [XT*334588000000156*0006*oxygen] +# def send(self, event, msg): +# # [SZKW*334588000000156*len*heart,x] +# print("oxstart:") +# send_data = "SZKW*%s*0007*oxstart"%(self.imei) +# MD5_SIGN = self.pack_MD5_head(send_data) +# data = "[%s%s]"%(str(MD5_SIGN),send_data) +# # print("HEART_ProtoCol:data:%s"%(data)) +# # 通过socket发送到服务器端 +# EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) +# def recv(self, event, msg): +# """ +# @param event: 血氧单次测量下发 +# @param msg: 接收到的下行数据 +# """ +# print("oxstart:{}".format(msg)) # msg = msg[1:-1] # msg_tmp = msg.decode('ascii') -# msg_tmp = msg_tmp.split('REMIND,') +# msg_tmp = msg_tmp.split(',') # msg_tmp = msg_tmp[1] -# num = 0 -# j=0 -# for j in range(0,3): -# self.alarm_day = [] -# self.alarm_week = [] -# self.alarm_total_data = [] -# self.alarm_total_data = msg_tmp.split(',')[j] - -# b = self.alarm_total_data.find('-') -# if b != -1: -# alarm_data = self.alarm_total_data.split('-')#-作为分隔符 -# alarm_switch = int(alarm_data[1])#开关 -# alarm_day_num = int(alarm_data[2])#天 -# alarm_time = alarm_data[0]#时间 -# alarm_time_tmp = alarm_time.split(':')#冒号分隔时间 时 分 -# alarm_time_hour = int(alarm_time_tmp[0]) -# alarm_time_min = int(alarm_time_tmp[1]) -# if alarm_day_num == 3: -# self.alarm_week = alarm_data[3]#星期 - -# if alarm_day_num == 2:#每一天 -# self.alarm_day = [1,2,3,4,5,6,0] -# elif alarm_day_num == 3:#自定义 -# for i in range(0,7): -# if self.alarm_week[i] != '0': -# self.alarm_day.append(i) -# self.alarm_list.append({"idx": num, "hour": alarm_time_hour, "minute": alarm_time_min, "days": self.alarm_day, "enabled": alarm_switch}) -# with open("/ext/static/storage_file/alarm_msg.json", 'w',encoding='utf-8') as fd: -# ujson.dump(self.alarm_list,fd) -# num+=1 -# if num >= 2: -# num = 2 -# EventMesh.publish("push_update_alarm_show") -# EventMesh.publish(constants.PROTOCOL.REMIND_SEND) +# state = int(msg_tmp) +# get_hr_state = EventMesh.publish("get_hr_state") +# get_spo2_state = EventMesh.publish("get_spo2_state") +# if state == 1: +# if get_hr_state == 3 or get_spo2_state == 0:#只要两个不在测量 单次优先级最低 +# EventMesh.publish("set_spo2_state",3)#3代表单次测量 +# EventMesh.publish(constants.PROTOCOL.OXSTART_SEND) -#心率定时测量 -class hrTimeHandlerManager(Abstract): - def __init__(self): - super().__init__() - self.rtc = RTC() - self.timer = osTimer() - self.second = 0 - - def post_processor_after_instantiation(self): - - date_tmp = utime.localtime() - time_tmp = utime.mktime(date_tmp) - self.second = time_tmp - # self.timer.start(1*1000,1,self._min_callback) - - - def _min_callback(self,args): - self.second+=1 - date_tmp = utime.localtime() - time_tmp = utime.mktime(date_tmp) - rtc_now_time = self.rtc.datetime() - if (self.second % 60) == 0: - rtc_now_time = self.rtc.datetime() - print("hrTimeHandlerManager 当前的rtc时间:{}".format(rtc_now_time)) - - print("---!self.second!!!!---:{} time_tmp:{} rtc_now_time:{}".format(self.second,time_tmp,rtc_now_time)) - -class HRSTART_ProtoCol(ProtoCol): - """心率频率数据""" - TYPE = "hrtstart" - - - def send(self, event, msg): - # [SZKW*867387060319491*0008*hrtstart] - send_data = "SZKW*%s*008*hrtstart"%(self.imei) - MD5_SIGN = self.pack_MD5_head(send_data) - data = "[%s%s]"%(str(MD5_SIGN),send_data) - # print("HRSTART_ProtoCol:send:%s"%(data)) - # 通过socket发送到服务器端 - EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) - - def recv(self, event, msg): - """ - @param event: 心率数据下发 - @param msg: 接收到的下行数据 - """ - # b'SZKW*860132060004322*0035*REMIND,23-04-06,14:41:06,b6e0d4c6,1,27,-1,40,6DF157335E02' - # print("REMIND_ProtoCol RECV msg:%s"%(msg)) - # HRSTART_ProtoCol RECV msg:b'SZKW*860132060004322*000D*hrtstart,7200' msg_:7200 - msg = msg[1:-1] - msg_tmp = msg.decode('ascii') - msg_tmp = msg_tmp.split(',') - msg_tmp = msg_tmp[1] - # print("HRSTART_ProtoCol RECV msg:{} msg_:{}".format(msg,msg_tmp)) - hrTotal = int(msg_tmp) - if hrTotal == 1:#单次测量 - get_hr_state = EventMesh.publish("get_hr_state") - get_spo2_state = EventMesh.publish("get_spo2_state") - print("get_hr_state:{} get_spo2_state:{} hrTotal:{}".format(get_hr_state,get_spo2_state,hrTotal)) - if get_hr_state == 0 and get_spo2_state == 0:#只要两个不在测量 单次优先级最低 - EventMesh.publish("set_hr_state",3)#3代表单次测量 - elif hrTotal < 30 and hrTotal > 1: - hrTotal = 30 - with open("/ext/static/storage_file/setHrTime.txt","w") as fd: - fd.write(str(hrTotal)) - EventMesh.publish("set_time_hr_spo2",hrTotal) - - EventMesh.publish(constants.PROTOCOL.HRTSTART_SEND) - -class HEART_ProtoCol(ProtoCol): - """心率数据""" - TYPE = "heart" - - - def send(self, event, msg): - # [SZKW*334588000000156*len*heart,x] - # print("HEART:send:{}".format(msg)) - len_size = len(str(msg))+6 - send_data = "SZKW*%s*%04X*heart"%(self.imei,len_size) - MD5_SIGN = self.pack_MD5_head(send_data) - data = "[%s%s,%d]"%(str(MD5_SIGN),send_data,msg) - # print("HEART_ProtoCol:data:%s"%(data)) - # 通过socket发送到服务器端 - EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) - - def recv(self, event, msg): - """ - @param event: 心率数据下发 - @param msg: 接收到的下行数据 - """ - # print("HRSTART_ProtoCol RECV msg:") - #EventMesh.publish(constants.PROTOCOL.HEART_SEND) -class OXYGEN_ProtoCol(ProtoCol): - """上传血氧测试数据""" - TYPE = "oxygen" - def send(self, event, msg): - # [SZKW*334588000000156*len*heart,x] - # print("oxstart:send:{}".format(msg)) - len_size = len(str(msg))+6 - send_data = "SZKW*%s*%04X*oxygen"%(self.imei,len_size) - MD5_SIGN = self.pack_MD5_head(send_data) - data = "[%s%s,%d]"%(str(MD5_SIGN),send_data,msg) - # print("HEART_ProtoCol:data:%s"%(data)) - # 通过socket发送到服务器端 - EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) - - def recv(self, event, msg): - """ - @param event: 心率数据下发 - @param msg: 接收到的下行数据 - """ - # print("HRSTART_ProtoCol RECV msg:") - #EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND) - -class OXYGEN_One_ProtoCol(ProtoCol):#单次测量 - """上传血氧测试数据""" - TYPE = "oxstart" - -# 终端发送[XT*YYYYYYYYYYYYYYY*LEN*oxygen,x] -# x 表示血氧饱和度 -# 示例[XT*334588000000156*0009*oxygen,15] -# 平台回复:handler -> b'[SZKW*860132060004322*0009*oxstart,1]' -# [XT*334588000000156*0006*oxygen] - def send(self, event, msg): - # [SZKW*334588000000156*len*heart,x] - print("oxstart:") - send_data = "SZKW*%s*0007*oxstart"%(self.imei) - MD5_SIGN = self.pack_MD5_head(send_data) - data = "[%s%s]"%(str(MD5_SIGN),send_data) - # print("HEART_ProtoCol:data:%s"%(data)) - # 通过socket发送到服务器端 - EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) - - def recv(self, event, msg): - """ - @param event: 血氧单次测量下发 - @param msg: 接收到的下行数据 - """ - print("oxstart:{}".format(msg)) - msg = msg[1:-1] - msg_tmp = msg.decode('ascii') - msg_tmp = msg_tmp.split(',') - print("msg_tmp:{}".format(msg_tmp)) - msg_tmp = msg_tmp[1] - state = int(msg_tmp) - get_hr_state = EventMesh.publish("get_hr_state") - get_spo2_state = EventMesh.publish("get_spo2_state") - print("get_hr_state:{} get_spo2_state:{} state:{}".format(get_hr_state,get_spo2_state,state)) - if state == 1: - if get_hr_state == 0 and get_spo2_state == 0:#只要两个不在测量 单次优先级最低 - EventMesh.publish("set_spo2_state",3)#3代表单次测量 - EventMesh.publish(constants.PROTOCOL.OXSTART_SEND) - -#设置和获取心率上传频率时间 - -class getHrTimeManager(Abstract): - def __init__(self): - self.set_time = 0 - self.set_hr = 0 #0关闭 1手动 2 自动测量按照时间间隔测试心率 - self.set_spo2 = 0 - check = ql_fs.path_exists("/ext/static/storage_file/setHrTime.txt") - if check == True: - with open("/ext/static/storage_file/setHrTime.txt","r") as fd: - time = fd.read() - self.set_time = int(time) - - 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_hr_state", self.set_hr_state) - EventMesh.subscribe("get_hr_state", self.get_hr_state) - EventMesh.subscribe("set_spo2_state", self.set_spo2_state) - EventMesh.subscribe("get_spo2_state", self.get_spo2_state) - - def set_time_hr_spo2(self, event, msg): - self.set_time = msg - - def get_time_hr_spo2(self, event, msg): - return self.set_time - - def set_hr_state(self, event, msg): - self.set_hr = msg - - def get_hr_state(self, event, msg): - return self.set_hr +# #设置和获取心率上传频率时间 + +# class getHrTimeManager(Abstract): +# def __init__(self): +# self.set_time = 0 +# self.set_hr = 0 #0关闭 1手动 2 自动测量按照时间间隔测试心率 +# self.set_spo2 = 0 +# check = ql_fs.path_exists("/ext/static/storage_file/config.json") +# if check == True: +# with open("/ext/static/storage_file/config.json","r") as fd: +# self.read_data = ujson.load(fd) +# if self.read_data != {}: +# b = str("measure_time") in self.read_data.keys() +# if b == True: +# self.set_time = self.read_data["measure_time"] + +# 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_hr_state", self.set_hr_state) +# EventMesh.subscribe("get_hr_state", self.get_hr_state) +# EventMesh.subscribe("set_spo2_state", self.set_spo2_state) +# EventMesh.subscribe("get_spo2_state", self.get_spo2_state) + +# def set_time_hr_spo2(self, event, msg): +# self.set_time = msg + +# def get_time_hr_spo2(self, event, msg): + +# return self.set_time + +# def set_hr_state(self, event, msg): +# self.set_hr = msg + +# def get_hr_state(self, event, msg): +# return self.set_hr - def set_spo2_state(self, event, msg): - self.set_spo2 = msg +# def set_spo2_state(self, event, msg): +# self.set_spo2 = msg - def get_spo2_state(self, event, msg): - return self.set_spo2 - - \ No newline at end of file +# def get_spo2_state(self, event, msg): +# return self.set_spo2 + +# class getBrightnessManager(Abstract):#获取亮度级别 +# def __init__(self): +# self.level = 5#默认值5 +# self.read_data = {} + +# check = ql_fs.path_exists("/ext/static/storage_file/config.json") +# if check == True: +# with open("/ext/static/storage_file/config.json","r") as fd: +# self.read_data = ujson.load(fd) + +# def post_processor_after_instantiation(self): +# EventMesh.subscribe("get_brightness_level", self.get_brightness_level) +# EventMesh.subscribe("push_add_brightness_level", self.add) +# EventMesh.subscribe("push_reduce_brightness_level", self.reduce) + +# def get_brightness_level(self, event, msg): +# if self.read_data != {}: +# b = str("brightness_level") in self.read_data.keys() +# if b == True: +# self.level = self.read_data["brightness_level"] +# return self.level + +# def add(self, event, msg): +# if self.level < 10: +# self.level = self.level + 1 +# self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, self.level, 10) +# self.PWM_backlight.open() + +# self.read_data = EventMesh.publish("get_storage_data") +# self.read_data["brightness_level"] = self.level + +# EventMesh.publish("set_storage_data", self.read_data) +# with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd: +# ujson.dump(self.read_data,fd) + +# def reduce(self, event, msg): +# if self.level > 0: +# self.level = self.level - 1 +# if self.level <= 0: +# self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, 1, 10) +# else: +# self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS,self.level, 10) + +# self.PWM_backlight.open() +# self.read_data = EventMesh.publish("get_storage_data") +# self.read_data["brightness_level"] = self.level +# EventMesh.publish("set_storage_data", self.read_data) +# with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd: +# ujson.dump(self.read_data,fd) + +# class getStorageDataManager(Abstract):#获取内存数据 +# def __init__(self): +# self.read_data = {} +# check = ql_fs.path_exists("/ext/static/storage_file/config.json") +# if check == True: +# with open("/ext/static/storage_file/config.json","r") as fd: +# self.read_data = ujson.load(fd) + +# def post_processor_after_instantiation(self): +# EventMesh.subscribe("set_storage_data", self.set_storage_data) +# EventMesh.subscribe("get_storage_data", self.get_storage_data) + +# def set_storage_data(self, event, msg): +# if msg != None: +# self.read_data = msg + +# def get_storage_data(self, event, msg): +# return self.read_data + \ No newline at end of file diff --git a/3.code/1.watch/2.code/ui.py b/3.code/1.watch/2.code/ui.py index c82c2fc0..a2afc20a 100644 --- a/3.code/1.watch/2.code/ui.py +++ b/3.code/1.watch/2.code/ui.py @@ -35,6 +35,10 @@ style_font_youyuan_20.init() style_font_youyuan_20.set_text_color(lv.color_make(0xff, 0xff, 0xff)) style_font_youyuan_20.set_text_font_v2("font_20.bin",20,0) +style_font_youyuan_40 = lv.style_t() +style_font_youyuan_40.init() +style_font_youyuan_40.set_text_color(lv.color_make(0xff, 0xff, 0xff)) +style_font_youyuan_40.set_text_font_v2("font_40.bin",40,0) #黑色 style_font_youyuan_20_black = lv.style_t() style_font_youyuan_20_black.init() @@ -206,7 +210,7 @@ toolbox_step_img = lv.img(toolbox_cont) toolbox_step_img.set_pos(10, 0) toolbox_step_img.set_size(47, 47) toolbox_step_img.add_flag(lv.obj.FLAG.CLICKABLE) -toolbox_step_img.set_src("E:/static/IMAGE_SECMENU_STEP.jpg") +toolbox_step_img.set_src("E:/static/IMAGE_SECMENU_STEP.png") toolbox_step_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) toolbox_weather = lv.btn(toolbox_cont) @@ -222,7 +226,7 @@ toolbox_weather_img = lv.img(toolbox_cont) toolbox_weather_img.set_pos(10, 60) toolbox_weather_img.set_size(47, 47) toolbox_weather_img.add_flag(lv.obj.FLAG.CLICKABLE) -toolbox_weather_img.set_src("E:/static/IMAGE_SECMENU_WEATHER.jpg") +toolbox_weather_img.set_src("E:/static/IMAGE_SECMENU_WEATHER.png") toolbox_weather_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) toolbox_alarm = lv.btn(toolbox_cont) @@ -238,7 +242,7 @@ toolbox_alarm_img = lv.img(toolbox_cont) toolbox_alarm_img.set_pos(10, 120) toolbox_alarm_img.set_size(47, 47) toolbox_alarm_img.add_flag(lv.obj.FLAG.CLICKABLE) -toolbox_alarm_img.set_src("E:/static/IMAGE_SECMENU_ALARM.jpg") +toolbox_alarm_img.set_src("E:/static/IMAGE_SECMENU_ALARM.png") toolbox_alarm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) toolbox_countdown = lv.btn(toolbox_cont) @@ -254,7 +258,7 @@ toolbox_countdown_img = lv.img(toolbox_cont) toolbox_countdown_img.set_pos(10, 180) toolbox_countdown_img.set_size(47, 47) toolbox_countdown_img.add_flag(lv.obj.FLAG.CLICKABLE) -toolbox_countdown_img.set_src("E:/static/IMAGE_SECMENU_COUNTDOWN.jpg") +toolbox_countdown_img.set_src("E:/static/IMAGE_SECMENU_COUNTDOWN.png") toolbox_countdown_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) toolbox_stopwatch = lv.btn(toolbox_cont) @@ -270,7 +274,7 @@ toolbox_stopwatch_img = lv.img(toolbox_cont) toolbox_stopwatch_img.set_pos(10, 240) toolbox_stopwatch_img.set_size(47, 47) toolbox_stopwatch_img.add_flag(lv.obj.FLAG.CLICKABLE) -toolbox_stopwatch_img.set_src("E:/static/IMAGE_SECMENU_STOPWATCH.jpg") +toolbox_stopwatch_img.set_src("E:/static/IMAGE_SECMENU_STOPWATCH.png") toolbox_stopwatch_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -289,7 +293,7 @@ alarm.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) # alarm_nodata_img = lv.img(alarm) # alarm_nodata_img.center() # alarm_nodata_img.set_size(113, 152) -# alarm_nodata_img.set_src("E:/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.jpg") +# alarm_nodata_img.set_src("E:/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png") # alarm_nodata_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) alarm_title = lv.label(alarm) @@ -322,32 +326,50 @@ countdown_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT countdown_hour = lv.label(countdown) countdown_hour.set_pos(30, 140) -countdown_hour.set_size(30, 30) -countdown_hour.set_text(" 00") -countdown_hour.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +countdown_hour.set_size(60, 30) +countdown_hour.set_text("00") +countdown_hour.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_hour.set_long_mode(lv.label.LONG.WRAP) -countdown_hour.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0) +countdown_hour.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) + +countdown_mao = lv.label(countdown) +countdown_mao.set_pos(82, 138) +countdown_mao.set_size(30, 30) +countdown_mao.set_text(":") +countdown_mao.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) +countdown_mao.set_long_mode(lv.label.LONG.WRAP) +countdown_mao.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) + countdown_min = lv.label(countdown) -countdown_min.set_pos(80, 140) -countdown_min.set_size(30, 30) -countdown_min.set_text("00 ") -countdown_min.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +countdown_min.set_pos(95, 140) +countdown_min.set_size(60, 30) +countdown_min.set_text("00") +countdown_min.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_min.set_long_mode(lv.label.LONG.WRAP) -countdown_min.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0) +countdown_min.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) + +countdown_mao1 = lv.label(countdown) +countdown_mao1.set_pos(146, 138) +countdown_mao1.set_size(30, 30) +countdown_mao1.set_text(":") +countdown_mao1.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) +countdown_mao1.set_long_mode(lv.label.LONG.WRAP) +countdown_mao1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) + countdown_sec = lv.label(countdown) countdown_sec.set_pos(160, 140) -countdown_sec.set_size(30, 30) -countdown_sec.set_text("00 ") -countdown_sec.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +countdown_sec.set_size(60, 30) +countdown_sec.set_text("00") +countdown_sec.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_sec.set_long_mode(lv.label.LONG.WRAP) -countdown_sec.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0) +countdown_sec.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) countdown_hour_up = lv.img(countdown) countdown_hour_up.set_size(34, 30) -countdown_hour_up.set_pos(23, 100) -countdown_hour_up.set_src("E:/static/time_up.jpg") +countdown_hour_up.set_pos(36, 100) +countdown_hour_up.set_src("E:/static/time_up.png") @@ -356,8 +378,8 @@ countdown_hour_up.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_hour_down = lv.img(countdown) countdown_hour_down.set_size(34, 30) -countdown_hour_down.set_pos(23, 180) -countdown_hour_down.set_src("E:/static/time_down.jpg") +countdown_hour_down.set_pos(36, 180) +countdown_hour_down.set_src("E:/static/time_down.png") @@ -366,18 +388,15 @@ countdown_hour_down.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_min_up = lv.img(countdown) countdown_min_up.set_size(34, 30) -countdown_min_up.set_pos(80, 100) -countdown_min_up.set_src("E:/static/time_up.jpg") - - - +countdown_min_up.set_pos(99, 100) +countdown_min_up.set_src("E:/static/time_up.png") countdown_min_up.add_flag(lv.obj.FLAG.CLICKABLE) countdown_min_up.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_min_down = lv.img(countdown) countdown_min_down.set_size(34, 30) -countdown_min_down.set_pos(80, 180) -countdown_min_down.set_src("E:/static/time_down.jpg") +countdown_min_down.set_pos(99, 180) +countdown_min_down.set_src("E:/static/time_down.png") @@ -386,8 +405,8 @@ countdown_min_down.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_sec_up = lv.img(countdown) countdown_sec_up.set_size(34, 30) -countdown_sec_up.set_pos(160, 100) -countdown_sec_up.set_src("E:/static/time_up.jpg") +countdown_sec_up.set_pos(165, 100) +countdown_sec_up.set_src("E:/static/time_up.png") @@ -396,8 +415,8 @@ countdown_sec_up.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_sec_down = lv.img(countdown) countdown_sec_down.set_size(34, 30) -countdown_sec_down.set_pos(160, 180) -countdown_sec_down.set_src("E:/static/time_down.jpg") +countdown_sec_down.set_pos(165, 180) +countdown_sec_down.set_src("E:/static/time_down.png") @@ -406,7 +425,7 @@ countdown_sec_down.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_reset_imgbtn = lv.img(countdown) countdown_reset_imgbtn.set_size(99, 36) -countdown_reset_imgbtn.set_src("E:/static/stopwatch_reset.jpg") +countdown_reset_imgbtn.set_src("E:/static/stopwatch_reset.png") @@ -416,7 +435,7 @@ countdown_reset_imgbtn.set_pos(10, 260) countdown_start_imgbtn = lv.img(countdown) countdown_start_imgbtn.set_size(99, 36) -countdown_start_imgbtn.set_src("E:/static/stopwatch_play.jpg") +countdown_start_imgbtn.set_src("E:/static/stopwatch_play.png") @@ -426,7 +445,7 @@ countdown_start_imgbtn.set_pos(120, 260) countdown_stop_imgbtn = lv.img(countdown) countdown_stop_imgbtn.set_size(99, 36) -countdown_stop_imgbtn.set_src("E:/static/stopwatch_stop.jpg") +countdown_stop_imgbtn.set_src("E:/static/stopwatch_stop.png") @@ -439,7 +458,7 @@ countdown_stop_imgbtn.add_flag(lv.obj.FLAG.HIDDEN) countdown_end_img = lv.img(countdown) countdown_end_img.set_size(140, 140) countdown_end_img.set_pos(50, 20) -countdown_end_img.set_src("E:/static/time_finish.jpg") +countdown_end_img.set_src("E:/static/time_finish.png") countdown_end_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_end_label = lv.label(countdown) @@ -468,38 +487,54 @@ stopwatch_title.set_long_mode(lv.label.LONG.WRAP) stopwatch_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) stopwatch_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - stopwatch_label_min = lv.label(stopwatch) -stopwatch_label_min.set_pos(20, 100) -stopwatch_label_min.set_size(40, 20) -stopwatch_label_min.set_long_mode(lv.label.LONG.WRAP) -stopwatch_label_min.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -stopwatch_label_min.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -#stopwatch_label_min.add_style(style_font_tianbo_12, lv.PART.MAIN | lv.STATE.DEFAULT) +stopwatch_label_min.set_pos(30, 140) +stopwatch_label_min.set_size(60, 30) stopwatch_label_min.set_text("00") +stopwatch_label_min.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) +stopwatch_label_min.set_long_mode(lv.label.LONG.WRAP) +stopwatch_label_min.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) + +stopwatch_mao = lv.label(stopwatch) +stopwatch_mao.set_pos(82, 138) +stopwatch_mao.set_size(30, 30) +stopwatch_mao.set_text(":") +stopwatch_mao.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) +stopwatch_mao.set_long_mode(lv.label.LONG.WRAP) +stopwatch_mao.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) + stopwatch_label_sec = lv.label(stopwatch) -stopwatch_label_sec.set_pos(80, 100) -stopwatch_label_sec.set_size(40, 20) -stopwatch_label_sec.set_long_mode(lv.label.LONG.WRAP) -stopwatch_label_sec.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -stopwatch_label_sec.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -#stopwatch_label_sec.add_style(style_font_tianbo_12, lv.PART.MAIN | lv.STATE.DEFAULT) +stopwatch_label_sec.set_pos(95, 140) +stopwatch_label_sec.set_size(60, 30) stopwatch_label_sec.set_text("00") +stopwatch_label_sec.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) +stopwatch_label_sec.set_long_mode(lv.label.LONG.WRAP) +stopwatch_label_sec.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) + +stopwatch_mao1 = lv.label(stopwatch) +stopwatch_mao1.set_pos(146, 138) +stopwatch_mao1.set_size(30, 30) +stopwatch_mao1.set_text(".") +stopwatch_mao1.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) +stopwatch_mao1.set_long_mode(lv.label.LONG.WRAP) +stopwatch_mao1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) + stopwatch_label_ms = lv.label(stopwatch) -stopwatch_label_ms.set_pos(140, 100) -stopwatch_label_ms.set_size(40, 20) -stopwatch_label_ms.set_text("00") +stopwatch_label_ms.set_pos(160, 140) +stopwatch_label_ms.set_size(60, 30) +stopwatch_label_ms.set_text("0") +stopwatch_label_ms.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) stopwatch_label_ms.set_long_mode(lv.label.LONG.WRAP) -stopwatch_label_ms.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -stopwatch_label_ms.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -#stopwatch_label_ms.add_style(style_font_tianbo_12, lv.PART.MAIN | lv.STATE.DEFAULT) +stopwatch_label_ms.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) + + stopwatch_reset_imgbtn = lv.img(stopwatch) stopwatch_reset_imgbtn.set_size(99, 36) -stopwatch_reset_imgbtn.set_src("E:/static/stopwatch_reset.jpg") +stopwatch_reset_imgbtn.set_src("E:/static/stopwatch_reset.png") stopwatch_reset_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) stopwatch_reset_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) stopwatch_reset_imgbtn.set_pos(10, 210) @@ -507,14 +542,14 @@ stopwatch_reset_imgbtn.set_pos(10, 210) stopwatch_start_imgbtn = lv.img(stopwatch) stopwatch_start_imgbtn.set_size(99, 36) -stopwatch_start_imgbtn.set_src("E:/static/stopwatch_play.jpg") +stopwatch_start_imgbtn.set_src("E:/static/stopwatch_play.png") stopwatch_start_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) stopwatch_start_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) stopwatch_start_imgbtn.set_pos(115, 210) stopwatch_stop_imgbtn = lv.img(stopwatch) stopwatch_stop_imgbtn.set_size(99, 36) -stopwatch_stop_imgbtn.set_src("E:/static/stopwatch_stop.jpg") +stopwatch_stop_imgbtn.set_src("E:/static/stopwatch_stop.png") stopwatch_stop_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) stopwatch_stop_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) stopwatch_stop_imgbtn.set_pos(115, 210) @@ -530,7 +565,7 @@ temperature.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) temperature_bg_img = lv.img(temperature) temperature_bg_img.set_pos(0, 0) temperature_bg_img.set_size(71, 170) -temperature_bg_img.set_src("E:/static/temp_bg.jpg") +temperature_bg_img.set_src("E:/static/temp_bg.png") temperature_bg_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) temperature_body_label = lv.label(temperature) @@ -544,7 +579,7 @@ temperature_body_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE. temperature_degree_img = lv.img(temperature) temperature_degree_img.set_pos(150, 70) temperature_degree_img.set_size(22, 22) -temperature_degree_img.set_src("E:/static/degree.jpg") +temperature_degree_img.set_src("E:/static/degree.png") temperature_degree_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) temperature_value_label = lv.label(temperature) @@ -566,7 +601,7 @@ temperature_wrist_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE temperature_wrist_degree_img = lv.img(temperature) temperature_wrist_degree_img.set_pos(150, 150) temperature_wrist_degree_img.set_size(22, 22) -temperature_wrist_degree_img.set_src("E:/static/degree.jpg") +temperature_wrist_degree_img.set_src("E:/static/degree.png") temperature_wrist_degree_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) temperature_wrist_value_label = lv.label(temperature) @@ -655,7 +690,7 @@ incoming_call.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) incoming_call_img = lv.img(incoming_call) incoming_call_img.set_pos(80, 20) incoming_call_img.set_size(64, 64) -incoming_call_img.set_src("E:/static/IMAGE_NOTICE_CALL.jpg") +incoming_call_img.set_src("E:/static/IMAGE_NOTICE_CALL.png") incoming_call_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) incoming_call_name_label = lv.label(incoming_call) @@ -664,25 +699,25 @@ incoming_call_name_label.set_size(240, 50) incoming_call_name_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) incoming_call_name_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -incoming_call_label = lv.label(incoming_call) -incoming_call_label.set_pos(0, 160) -incoming_call_label.set_size(240, 50) -incoming_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -incoming_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +# incoming_call_label = lv.label(incoming_call) +# incoming_call_label.set_pos(0, 160) +# incoming_call_label.set_size(240, 50) +# incoming_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# incoming_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) incoming_call_answer = lv.img(incoming_call) incoming_call_answer.set_size(64, 64) incoming_call_answer.add_flag(lv.obj.FLAG.CLICKABLE) incoming_call_answer.set_pos(30, 220) incoming_call_answer.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -incoming_call_answer.set_src("E:/static/answer.jpg") +incoming_call_answer.set_src("E:/static/answer.png") incoming_call_hangup = lv.img(incoming_call) incoming_call_hangup.set_size(64, 64) incoming_call_hangup.add_flag(lv.obj.FLAG.CLICKABLE) incoming_call_hangup.set_pos(150, 220) incoming_call_hangup.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -incoming_call_hangup.set_src("E:/static/hang_up.jpg") +incoming_call_hangup.set_src("E:/static/hang_up.png") # -------------------------------------------on_call screen---------------------------------------------------------- on_call_screen = lv.obj() @@ -693,18 +728,18 @@ on_call.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) on_call_label_name = lv.label(on_call) -on_call_label_name.set_pos(0, 40) +on_call_label_name.set_pos(0, 100) on_call_label_name.set_size(240, 50) on_call_label_name.set_text(" ") on_call_label_name.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) on_call_label_name.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -on_call_label = lv.label(on_call) -on_call_label.set_pos(0, 100) -on_call_label.set_size(240, 50) -on_call_label.set_text(" ") -on_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -on_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +# on_call_label = lv.label(on_call) +# on_call_label.set_pos(0, 100) +# on_call_label.set_size(240, 50) +# on_call_label.set_text(" ") +# on_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# on_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) on_call_second_label = lv.label(on_call) @@ -720,7 +755,7 @@ on_call_hangup.set_size(64, 64) on_call_hangup.add_flag(lv.obj.FLAG.CLICKABLE) on_call_hangup.set_pos(85, 220) on_call_hangup.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -on_call_hangup.set_src("E:/static/hang_up.jpg") +on_call_hangup.set_src("E:/static/hang_up.png") # -------------------------------------------sms_detail screen---------------------------------------------------------- @@ -828,91 +863,91 @@ phone_label.set_long_mode(lv.label.LONG.CLIP) phone_label.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0) phone_one = lv.img(phone) -phone_one.set_src("E:/static/IMAGE_NUMBER_KEY1_ICON.jpg") +phone_one.set_src("E:/static/IMAGE_NUMBER_KEY1_ICON.png") phone_one.add_flag(lv.obj.FLAG.CLICKABLE) phone_one.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_one.set_pos(3, 100) phone_two = lv.img(phone) phone_two.set_size(76, 40) -phone_two.set_src("E:/static/IMAGE_NUMBER_KEY2_ICON.jpg") +phone_two.set_src("E:/static/IMAGE_NUMBER_KEY2_ICON.png") phone_two.add_flag(lv.obj.FLAG.CLICKABLE) phone_two.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_two.set_pos(82, 100) phone_three = lv.img(phone) phone_three.set_size(76, 40) -phone_three.set_src("E:/static/IMAGE_NUMBER_KEY3_ICON.jpg") +phone_three.set_src("E:/static/IMAGE_NUMBER_KEY3_ICON.png") phone_three.add_flag(lv.obj.FLAG.CLICKABLE) phone_three.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_three.set_pos(161, 100) phone_four = lv.img(phone) phone_four.set_size(76, 40) -phone_four.set_src("E:/static/IMAGE_NUMBER_KEY4_ICON.jpg") +phone_four.set_src("E:/static/IMAGE_NUMBER_KEY4_ICON.png") phone_four.add_flag(lv.obj.FLAG.CLICKABLE) phone_four.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_four.set_pos(3, 142) phone_five = lv.img(phone) phone_five.set_size(76, 40) -phone_five.set_src("E:/static/IMAGE_NUMBER_KEY5_ICON.jpg") +phone_five.set_src("E:/static/IMAGE_NUMBER_KEY5_ICON.png") phone_five.add_flag(lv.obj.FLAG.CLICKABLE) phone_five.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_five.set_pos(82, 142) phone_six = lv.img(phone) phone_six.set_size(76, 40) -phone_six.set_src("E:/static/IMAGE_NUMBER_KEY6_ICON.jpg") +phone_six.set_src("E:/static/IMAGE_NUMBER_KEY6_ICON.png") phone_six.add_flag(lv.obj.FLAG.CLICKABLE) phone_six.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_six.set_pos(161, 142) phone_seven = lv.img(phone) phone_seven.set_size(76, 40) -phone_seven.set_src("E:/static/IMAGE_NUMBER_KEY7_ICON.jpg") +phone_seven.set_src("E:/static/IMAGE_NUMBER_KEY7_ICON.png") phone_seven.add_flag(lv.obj.FLAG.CLICKABLE) phone_seven.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_seven.set_pos(3, 184) phone_eight = lv.img(phone) phone_eight.set_size(76, 40) -phone_eight.set_src("E:/static/IMAGE_NUMBER_KEY8_ICON.jpg") +phone_eight.set_src("E:/static/IMAGE_NUMBER_KEY8_ICON.png") phone_eight.add_flag(lv.obj.FLAG.CLICKABLE) phone_eight.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_eight.set_pos(82, 184) phone_nine = lv.img(phone) phone_nine.set_size(76, 40) -phone_nine.set_src("E:/static/IMAGE_NUMBER_KEY9_ICON.jpg") +phone_nine.set_src("E:/static/IMAGE_NUMBER_KEY9_ICON.png") phone_nine.add_flag(lv.obj.FLAG.CLICKABLE) phone_nine.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_nine.set_pos(161, 184) phone_start = lv.img(phone) phone_start.set_size(76, 40) -phone_start.set_src("E:/static/IMAGE_NUMBER_KEYSTAR_ICON.jpg") +phone_start.set_src("E:/static/IMAGE_NUMBER_KEYSTAR_ICON.png") phone_start.add_flag(lv.obj.FLAG.CLICKABLE) phone_start.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_start.set_pos(3, 226) phone_zero = lv.img(phone) phone_zero.set_size(76, 40) -phone_zero.set_src("E:/static/IMAGE_NUMBER_KEY0_ICON.jpg") +phone_zero.set_src("E:/static/IMAGE_NUMBER_KEY0_ICON.png") phone_zero.add_flag(lv.obj.FLAG.CLICKABLE) phone_zero.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_zero.set_pos(82, 226) phone_hash = lv.img(phone) phone_hash.set_size(76, 40) -phone_hash.set_src("E:/static/IMAGE_NUMBER_KEYHASH_ICON.jpg") +phone_hash.set_src("E:/static/IMAGE_NUMBER_KEYHASH_ICON.png") phone_hash.add_flag(lv.obj.FLAG.CLICKABLE) phone_hash.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_hash.set_pos(161, 226) phone_call = lv.img(phone) phone_call.set_size(76, 40) -phone_call.set_src("E:/static/IMAGE_BUTTON_DIAL.jpg") +phone_call.set_src("E:/static/IMAGE_BUTTON_DIAL.png") phone_call.add_flag(lv.obj.FLAG.CLICKABLE) phone_call.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_call.set_pos(3, 268) @@ -924,7 +959,7 @@ phone_call_btn.set_pos(3, 268) phone_contact = lv.img(phone) phone_contact.set_size(64, 40) -phone_contact.set_src("E:/static/IMAGE_BUTTON_DIAL_CONTACT.jpg") +phone_contact.set_src("E:/static/IMAGE_BUTTON_DIAL_CONTACT.png") phone_contact.add_flag(lv.obj.FLAG.CLICKABLE) phone_contact.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_contact.set_pos(87, 268) @@ -936,7 +971,7 @@ phone_contact_btn.set_pos(87, 268) phone_delete = lv.img(phone) phone_delete.set_size(76, 40) -phone_delete.set_src("E:/static/IMAGE_BUTTON_DELKEY.jpg") +phone_delete.set_src("E:/static/IMAGE_BUTTON_DELKEY.png") phone_delete.add_flag(lv.obj.FLAG.CLICKABLE) phone_delete.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phone_delete.set_pos(161, 268) @@ -1212,7 +1247,7 @@ none_call_log_title = lv.label(contacts_cont_list) none_call_log_title.set_pos(0, 120) none_call_log_title.set_size(240, 40) none_call_log_title.set_long_mode(lv.label.LONG.WRAP) -none_call_log_title.set_text("暂无记录") +none_call_log_title.set_text(" ") none_call_log_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) none_call_log_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -1249,13 +1284,20 @@ class CallLogScreen(Screen): self.btn_create() def initialization(self): - EventMesh.publish("call_log_update_show_list") + read_call_log = EventMesh.publish("get_call_log_list") + print("read_call_log:{}".format(read_call_log)) + self.check_json = read_call_log[0] #文件是否存在 + self.read_call_log = read_call_log[1]#通话记录数据 + if self.check_json == True and self.read_call_log != {}: + none_call_log_title.set_text(" ") + else: + none_call_log_title.set_text("暂无记录") self.btn_create() def btn_create(self): h = 0 if self.check_json == True and len(self.read_call_log) != 0: - none_call_log_title.add_flag(lv.obj.FLAG.HIDDEN) + none_call_log_title.set_text(" ") self.call_log_detail_list.delete()#先删除一次控件 self.call_log_detail_list = lv.obj(call_log_screen) self.call_log_detail_list.set_pos(0, 50) @@ -1274,8 +1316,8 @@ class CallLogScreen(Screen): # print("num_count :{} num_name:{} num_time:{}".format(num_count,num_name,num_time)) _btn = lv.btn(self.call_log_detail_list) - _btn.set_size(240,50) - _btn.set_pos(0,52*h) + _btn.set_size(240,80) + _btn.set_pos(0,82*h) _btn.add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.DEFAULT) _btn.add_event_cb(lambda e: self.calling(e), lv.EVENT.CLICKED, None) @@ -1288,16 +1330,15 @@ class CallLogScreen(Screen): #_btn_label2.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) # _btn_label3 = lv.label(_btn) - _btn_label3.set_pos(100, 5) - _btn_label3.set_size(40, 25) + _btn_label3.set_pos(0, 0) + _btn_label3.set_size(0, 0) _btn_label3.set_text("(" + str(num_count) + ")") - _btn_label3.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + # _btn_label3.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) _btn_label4 = lv.label(_btn) - _btn_label4.set_pos(0, 5) - _btn_label4.set_size(100, 25) + _btn_label4.set_pos(0, 38) + _btn_label4.set_size(230, 30) _btn_label4.set_text(num_phonnum) - _btn_label4.set_long_mode(lv.label.LONG.DOT) _btn_label4.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) _btn_label4 = lv.label(_btn) @@ -1308,14 +1349,13 @@ class CallLogScreen(Screen): # _btn_label4.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) _btn_label5 = lv.label(_btn) - _btn_label5.set_pos(135, 5) - _btn_label5.set_size(95, 25) + _btn_label5.set_pos(0, 5) + _btn_label5.set_size(230, 28) _btn_label5.set_text(num_name) - _btn_label5.set_long_mode(lv.label.LONG.DOT) _btn_label5.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) h = h + 1 else: - none_call_log_title.clear_flag(lv.obj.FLAG.HIDDEN) + none_call_log_title.set_text("暂无记录") self.call_log_detail_list.add_flag(lv.obj.FLAG.HIDDEN)#隐藏空文本 def calling(self,e): @@ -1383,26 +1423,26 @@ dialing.set_size(240, 320) dialing.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) dialing_img = lv.img(dialing) -dialing_img.set_pos(80, 20) +dialing_img.set_pos(80, 60) dialing_img.set_size(64, 64) -dialing_img.set_src("E:/static/IMAGE_NOTICE_CALL.jpg") +dialing_img.set_src("E:/static/IMAGE_NOTICE_CALL.png") dialing_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) dialing_name = lv.label(dialing) -dialing_name.set_pos(0, 100) +dialing_name.set_pos(0, 160) dialing_name.set_size(240, 50) dialing_name.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) dialing_name.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -dialing_content = lv.label(dialing) -dialing_content.set_pos(0, 160) -dialing_content.set_size(240, 50) -dialing_content.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -dialing_content.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +# dialing_content = lv.label(dialing) +# dialing_content.set_pos(0, 160) +# dialing_content.set_size(240, 50) +# dialing_content.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# dialing_content.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) hangup_imgbtn = lv.img(dialing) hangup_imgbtn.set_size(64, 64) -hangup_imgbtn.set_src("E:/static/IMG_CC_HUNGUP1.jpg") +hangup_imgbtn.set_src("E:/static/IMG_CC_HUNGUP1.png") hangup_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) hangup_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) hangup_imgbtn.set_pos(80, 220) @@ -1432,7 +1472,7 @@ class DialingScreen(Screen): # 格式:{"电话号码":{"timesec":'时间戳',"number":'电话号码',"name":'名字',"time":'时间',"count":'通话次数'}} dialing_name.set_text(name)#名称 - dialing_content.set_text(content)#电话号码 + # dialing_content.set_text(content)#电话号码 num = 0 date_tmp = utime.localtime() @@ -1531,9 +1571,13 @@ msg_list_t.set_size(240, 270) msg_list_t.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) msg_list_t.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) +heartrate_done_img = lv.img(msg_list_t) +heartrate_done_img.set_pos(53, 0) +heartrate_done_img.set_size(134, 117) +heartrate_done_img.set_src("E:/static/IMAGE_NOTICE_NONE.jpg") no_msg_text = lv.label(msg_list_t) -no_msg_text.set_pos(0, 120) +no_msg_text.set_pos(0, 130) no_msg_text.set_size(240, 40) no_msg_text.set_text("暂无信息") no_msg_text.set_long_mode(lv.label.LONG.WRAP) @@ -1583,8 +1627,9 @@ class PopupScreen(Screen): def btn_create(self,msg): - i = 0 + count = 0 j = 0 + print("self.msg_nums:{}".format(self.msg_nums)) if self.msg_nums > 0: no_msg_text.add_flag(lv.obj.FLAG.HIDDEN) self.sms_detail_list.delete()#先删除一次控件 @@ -1596,36 +1641,52 @@ class PopupScreen(Screen): self.sms_detail_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) if self.msg_nums > 10: j = self.msg_nums-10 - for i in range(self.msg_nums): - if i > (MSG_MAX-1): + for i in range(MSG_MAX): + if count > (MSG_MAX-1):#j = 16 -10 6 7 8 9 10 11 12 13 14 15 break - tmp = sms.searchTextMsg(j) - # print("self.msg_nums:{} sms.searchTextMsg(i):{} tmp[0]:{} tmp[1]:{} j:{} i:{}".format(self.msg_nums,sms.searchTextMsg(j),tmp[0],tmp[1],j,i)) - msg_btn = lv.btn(self.sms_detail_list) - msg_btn.set_size(240,90) - msg_btn.set_pos(0,92*i) - msg_btn.add_style(style_sms_bg_btn, lv.PART.MAIN | lv.STATE.DEFAULT) - msg_btn.add_event_cb(lambda e: self.calling(e), - lv.EVENT.CLICKED, None) - - _btn_label2 = lv.label(msg_btn) - _btn_label2.set_pos(0, 5) - _btn_label2.set_size(180, 25) - _btn_label2.set_text(tmp[0]) - _btn_label2.set_long_mode(lv.label.LONG.DOT) - _btn_label2.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) - # - - detail = tmp[1] - _btn_label3 = lv.label(msg_btn) - _btn_label3.set_pos(0, 34) - _btn_label3.set_size(220, 35) - _btn_label3.set_text(detail) - _btn_label3.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) - - i = i + 1 - j += 1 + + if tmp != -1: + msg_btn = lv.btn(self.sms_detail_list) + msg_btn.set_size(240,65) + msg_btn.set_pos(0,67*count) + msg_btn.add_style(style_sms_bg_btn, lv.PART.MAIN | lv.STATE.DEFAULT) + msg_btn.add_event_cb(lambda e: self.calling(e), + lv.EVENT.CLICKED, None) + + title = tmp[0] + # print("title:{}".format(title)) + _btn_label2 = lv.label(msg_btn) + _btn_label2.set_pos(0, 0) + _btn_label2.set_size(0, 0) + _btn_label2.set_text(title) + # _btn_label2.set_long_mode(lv.label.LONG.DOT) + # _btn_label2.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + # + detail = tmp[1] + _btn_label3 = lv.label(msg_btn) + _btn_label3.set_pos(0, 0) + _btn_label3.set_size(0, 0) + _btn_label3.set_text(detail) + # _btn_label3.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + + detail1 = tmp[1] + _btn_label4 = lv.label(msg_btn) + _btn_label4.set_pos(0, 34) + _btn_label4.set_size(220, 28) + _btn_label4.set_text(detail1) + _btn_label4.set_long_mode(lv.label.LONG.DOT) + _btn_label4.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + + title1 = tmp[0] + _btn_label5 = lv.label(msg_btn) + _btn_label5.set_pos(0, 5) + _btn_label5.set_size(180, 25) + _btn_label5.set_text(title1) + _btn_label5.set_long_mode(lv.label.LONG.DOT) + _btn_label5.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + count = count + 1 + j = j + 1 if msg == 1: bottom_btn = self.sms_detail_list.get_child(-1) bottom_btn.scroll_to_view(lv.ANIM.OFF) @@ -1786,8 +1847,11 @@ class HeartrateScreen(Screen): def Close(self): self.timer.stop() - EventMesh.publish("set_hr_state",0)#0代表关闭测试 - EventMesh.publish(constants.EVENT.STOP_HEART) + get_hr_state = EventMesh.publish("get_hr_state") + get_spo2_state = EventMesh.publish("get_spo2_state") + if get_hr_state == 1 or get_spo2_state == 1: + EventMesh.publish("set_hr_state",0)#0代表关闭测试 + EventMesh.publish(constants.EVENT.STOP_HEART) def done_return(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -1906,14 +1970,14 @@ class IncomingCallScreen(Screen): if self.name == None: self.name = str(self.meta_info) - incoming_call_label.set_text(str(self.meta_info)) + # incoming_call_label.set_text(str(self.meta_info)) incoming_call_name_label.set_text(self.name) EventMesh.publish("save_phonename",self.name) time = EventMesh.publish("screen_get_time")#获取系统时间 # ["15692025051","2","12:59","哥gdh符合双方和开发商开发好看的思考"], # 格式:{"电话号码":{"timesec":'时间戳',"number":'电话号码',"name":'名字',"time":'时间',"count":'通话次数'}} - num = 0 + self.num = 0 date_tmp = utime.localtime() time_tmp = utime.mktime(date_tmp) @@ -1932,9 +1996,9 @@ class IncomingCallScreen(Screen): num_tmp_t = number_tmp["count"]#读取本地保存的通话次数 else : num_tmp_t = 0 - num = num_tmp_t + self.num = num_tmp_t else: - num = 0 #通话次数 + self.num = 0 #通话次数 sort_tmp = {} sort_tmp = self.read_call_log.values() @@ -1949,7 +2013,10 @@ class IncomingCallScreen(Screen): del self.read_call_log[key_tmp] tmp = {} - tmp["count"]= num+1 #通话次数 + self.num = self.num +1 + if self.num > 99: + self.num = 99 + tmp["count"]= self.num #通话次数 tmp["time"]= "{}:{}".format("%02d"%(time[0][0]),"%02d"%(time[0][1]))#通话时间 tmp["name"]= self.name #名称 tmp["timesec"]= time_tmp #时间戳 @@ -2026,7 +2093,7 @@ class OnCallScreen(Screen): self.timer.start(1000,1,self.refresh) name = EventMesh.publish("get_phonename") on_call_label_name.set_text(name) - on_call_label.set_text(str(self.meta_info)) + # on_call_label.set_text(str(self.meta_info)) on_call_second_label.set_text("00:00") def refresh(self,e): @@ -2075,7 +2142,7 @@ step_label_01.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) step_img = lv.img(step) step_img.set_pos(100, 150) step_img.set_size(40, 65) -step_img.set_src("E:/static/IMAGE_STEP.jpg") +step_img.set_src("E:/static/IMAGE_STEP.png") step_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) class StepScreen(Screen): @@ -2099,7 +2166,7 @@ class StepScreen(Screen): EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "toolbox"}) # -------------------------------------------weather screen---------------------------------------------------------- weather_screen = lv.obj() @@ -2117,17 +2184,23 @@ weather_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) no_weather_img = lv.img(weather) no_weather_img.set_pos(10, 10) no_weather_img.set_size(135, 120) -no_weather_img.set_src("E:/static/update.jpg") +no_weather_img.set_src("E:/static/update.png") no_weather_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) weather_tem_label = lv.label(weather) weather_tem_label.set_pos(155, 40) -weather_tem_label.set_size(85, 50) -weather_tem_label.set_text("_ _C") +weather_tem_label.set_size(60, 50) +weather_tem_label.set_text("_ _") weather_tem_label.set_long_mode(lv.label.LONG.WRAP) weather_tem_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) weather_tem_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +no_weather_degree = lv.img(weather) +no_weather_degree.set_pos(200, 40) +no_weather_degree.set_size(22, 22) +no_weather_degree.set_src("E:/static/degree.png") +no_weather_degree.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + weather_detail_label = lv.label(weather) weather_detail_label.set_pos(155, 80) weather_detail_label.set_size(85, 50) @@ -2188,15 +2261,15 @@ class WeatherScreen(Screen): # print("self.weather_data:{}".format(self.weather_data)) type = self.weather_data[3] if type == None: - weather_img.set_src("E:/static/update.jpg")#天气类型 + weather_img.set_src("E:/static/update.png")#天气类型 else: - weather_img.set_src("E:/static/{}_weather.jpg".format(type))#天气类型 + weather_img.set_src("E:/static/{}_weather.png".format(type))#天气类型 temp = self.weather_data[4] if temp == None: - weather_tem_label.set_text("_ _C") + weather_tem_label.set_text("_ _") else: - weather_tem_label.set_text("{}C".format(temp)) + weather_tem_label.set_text("{}".format(temp)) date = self.weather_data[0] if date != '{}': @@ -2214,14 +2287,15 @@ class WeatherScreen(Screen): else:#已联网未获取到天气数据 weather_location_label.set_text(" ") weather_detail_label.set_text("-/-") - weather_tem_label.set_text("_ _C") + weather_tem_label.set_text("_ _") + no_connect_label.set_text("未获取网络数据") no_connect_label1.set_text("请稍候重试") else: weather_location_label.set_text(" ") weather_detail_label.set_text("-/-") - weather_tem_label.set_text("_ _C") + weather_tem_label.set_text("_ _") no_weather_img.clear_flag(lv.obj.FLAG.HIDDEN) weather_img.add_flag(lv.obj.FLAG.HIDDEN) @@ -2235,7 +2309,7 @@ class WeatherScreen(Screen): EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "toolbox"}) import audio from machine import Pin @@ -2569,7 +2643,6 @@ class Spo2Screen(Screen): def start_measure(self,*args): self.point = self.point + 1 EventMesh.publish("system_sleep_rest")#防止黑屏 - #if self.point == 1: self.spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN) if self.spo2_value == 0: spo2_label.set_text("--%") @@ -2586,23 +2659,24 @@ class Spo2Screen(Screen): if self.point > 60: #测20s self.spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN) - print("ui self.spo2_value :{}".format(self.spo2_value)) + # print("ui self.spo2_value :{}".format(self.spo2_value)) if self.spo2_value > 85 and self.spo2_value != None: EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,self.spo2_value) spo2_label.set_text("{} %".format(self.spo2_value)) if self.spo2_value == 0: + spo2_label.set_text(" ") spo2_label_1.set_text("退出,请重新测量") self.last_spo2_value = EventMesh.publish("get_old_spo2_data") - spo2_last_value.set_text("{}%".format(self.last_spo2_value)) + spo2_last_value.set_text(" ") else: self.last_spo2_value = self.spo2_value spo2_last_value.set_text("{}%".format(self.last_spo2_value)) spo2_label_1.set_text("测量完成") - time = EventMesh.publish("screen_get_time") - time_year = time[4] - time_month = time[2] - time_time =" {}:{}".format("%02d"%(time[0][0]),"%02d"%(time[0][1]))#通话时间 - spo2_last_time.set_text(str(time_year)+str(time_month)+str(time_time)) + time = EventMesh.publish("screen_get_time") + time_year = time[4] + time_month = time[2] + time_time =" {}:{}".format("%02d"%(time[0][0]),"%02d"%(time[0][1]))#通话时间 + spo2_last_time.set_text(str(time_year)+str(time_month)+str(time_time)) EventMesh.publish("set_old_spo2_data",self.spo2_value) @@ -2614,8 +2688,11 @@ class Spo2Screen(Screen): def Close(self): self.timer.stop() - EventMesh.publish("set_spo2_state",0)#0代表关闭测试 - EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) + get_hr_state = EventMesh.publish("get_hr_state") + get_spo2_state = EventMesh.publish("get_spo2_state") + if get_hr_state == 1 or get_spo2_state == 1: + EventMesh.publish("set_spo2_state",0)#0代表关闭测试 + EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) def done_return(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -2679,6 +2756,10 @@ class CountdownScreen(Screen): countdown_min_down.clear_flag(lv.obj.FLAG.HIDDEN) countdown_sec_up.clear_flag(lv.obj.FLAG.HIDDEN) countdown_sec_down.clear_flag(lv.obj.FLAG.HIDDEN) + countdown_sec.clear_flag(lv.obj.FLAG.HIDDEN) + countdown_min.clear_flag(lv.obj.FLAG.HIDDEN) + countdown_hour.clear_flag(lv.obj.FLAG.HIDDEN) + countdown_title.clear_flag(lv.obj.FLAG.HIDDEN) self.g_end = 0 self.total = 0 self.hour = 0 @@ -2761,6 +2842,10 @@ class CountdownScreen(Screen): self.show_value() if self.total <= 0: + countdown_sec.add_flag(lv.obj.FLAG.HIDDEN) + countdown_min.add_flag(lv.obj.FLAG.HIDDEN) + countdown_hour.add_flag(lv.obj.FLAG.HIDDEN) + countdown_title.add_flag(lv.obj.FLAG.HIDDEN) countdown_end_label.clear_flag(lv.obj.FLAG.HIDDEN) countdown_end_img.clear_flag(lv.obj.FLAG.HIDDEN) countdown_start_imgbtn.add_flag(lv.obj.FLAG.HIDDEN) @@ -2811,9 +2896,9 @@ class CountdownScreen(Screen): def show_value(self): # print(" in show value :",str(self.sec),str(self.min),str(self.hour)) - countdown_sec.set_text(str(self.sec)) - countdown_min.set_text(str(self.min)) - countdown_hour.set_text(str(self.hour)) + countdown_sec.set_text(str("%02d"%(self.sec))) + countdown_min.set_text(str("%02d"%(self.min))) + countdown_hour.set_text(str("%02d"%(self.hour))) def done_return(self): @@ -2832,7 +2917,7 @@ class CountdownScreen(Screen): def btn8_press(self): if self.g_state == 0: self.timer.stop() - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "toolbox"}) class StopwatchScreen(Screen): @@ -2895,10 +2980,9 @@ class StopwatchScreen(Screen): self.show_value() def show_value(self): - - stopwatch_label_ms.set_text(str(self.ms_value)) - stopwatch_label_sec.set_text(str(self.sec_value)) - stopwatch_label_min.set_text(str(self.min_value)) + stopwatch_label_ms.set_text(str("%d"%(self.ms_value))) + stopwatch_label_sec.set_text(str("%02d"%(self.sec_value))) + stopwatch_label_min.set_text(str("%02d"%(self.min_value))) def done_return(self): if self.s_state == 0: @@ -2913,7 +2997,7 @@ class StopwatchScreen(Screen): def btn8_press(self): if self.s_state == 0: self.timer.stop() - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "toolbox"}) @@ -2941,7 +3025,7 @@ class UIFINDScreen(Screen): self.watchface_mpsignal_img.set_size(140,140) self.watchface_mpsignal_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface_mpsignal_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface_mpsignal_img.set_src("E:/static/time_finish.jpg") + self.watchface_mpsignal_img.set_src("E:/static/time_finish.png") self.watchface_mpsignal_img.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) def initialization(self): @@ -2961,6 +3045,8 @@ class UIFINDScreen(Screen): def stop_FIND(self) : self.FIND_timer.stop() self.aud.stopAll() + def Close(self): + self.stop_FIND() def done_left_to_right(self): EventMesh.publish("load_screen", {"screen": "watchface"}) @@ -2975,12 +3061,6 @@ class UIFINDScreen(Screen): def done_click(self): EventMesh.publish("load_screen", {"screen": "watchface"}) - - - def Close(self): - self.stop_FIND() - pass - def btn1_release(self): EventMesh.publish("load_screen", {"screen": "watchface"}) @@ -3001,8 +3081,38 @@ class UI(object): self.system_sleep_timer_count = 0 self.main_flag = 0 self.sleep_flag = 1 - self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, 1, 1) + self.level = 0 + self.read_data = {} + self.level = EventMesh.publish("get_brightness_level") + self.read_data = EventMesh.publish("get_storage_data") + # print("self.read_data:{} self.level:{}".format(self.read_data,self.level)) + if self.level == None: + + check = ql_fs.path_exists("/ext/static/storage_file/config.json") + if check == True: + with open("/ext/static/storage_file/config.json","r") as fd: + self.read_data = ujson.load(fd) + if self.read_data != {}: + b = str("brightness_level") in self.read_data.keys() + if b == True: + self.level = self.read_data["brightness_level"] + else: + self.level = 5 + self.read_data["brightness_level"] = self.level + EventMesh.publish("set_storage_data", self.read_data) + with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd: + ujson.dump(self.read_data,fd) + else: + self.level = 5 #默认是5级别 + EventMesh.publish("set_brightness_level", self.level) + elif self.level > 10: + self.level = 10 + elif self.level <= 0: + self.level = 1 + + self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, self.level, 10) self.PWM_backlight.open() + self.sleep_lock = 0 def post_processor_after_instantiation(self): EventMesh.subscribe("load_screen", self.load_screen) @@ -3084,17 +3194,32 @@ class UI(object): def __lcd_on(self): print("__lcd_on") if self.sleep_flag == 0 : + if self.sleep_lock == 1: + utime.sleep_ms(200) + self.sleep_lock = 1 self.sleep_flag = 1 self.system_sleep_timeout_rest() - self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, 1, 1) - self.PWM_backlight.open() + #lcd_ctrl.write(1) #utime.sleep(10) tp_cst816.resume() lcd.lcd_display_on() lv.autoSleep(0) pm.autosleep(0) - #utime.sleep_ms(100) + utime.sleep_ms(100) + self.level = EventMesh.publish("get_brightness_level") + + self.read_data = EventMesh.publish("get_storage_data") + # print("self.read_data:{} self.level:{}".format(self.read_data,self.level)) + if self.level == None: + self.level = 5 + elif self.level > 10: + self.level = 10 + elif self.level <= 0: + self.level = 1 + self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, self.level, 10) + self.PWM_backlight.open() + self.sleep_lock = 0 def publish_call_in(self, event, msg): EventMesh.publish("load_screen", {"screen": "dialing", "meta": msg}) @@ -3102,6 +3227,9 @@ class UI(object): def __lcd_off(self): #print("__lcd_off") if self.sleep_flag == 1 : + if self.sleep_lock == 1: + utime.sleep_ms(200) + self.sleep_lock = 1 self.sleep_flag = 0 self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, 0, 1) self.PWM_backlight.open() @@ -3111,7 +3239,9 @@ class UI(object): lcd.lcd_display_off() lv.autoSleep(1) pm.autosleep(1) - #utime.sleep_ms(300) + utime.sleep_ms(100) + + self.sleep_lock = 0 def system_sleep(self, event, msg) : self.__lcd_off() diff --git a/3.code/1.watch/2.code/ui_WatchFaceScreen.py b/3.code/1.watch/2.code/ui_WatchFaceScreen.py index b5cb3500..0ce62bde 100644 --- a/3.code/1.watch/2.code/ui_WatchFaceScreen.py +++ b/3.code/1.watch/2.code/ui_WatchFaceScreen.py @@ -1,20 +1,15 @@ #表盘 -import utime import osTimer import lvgl as lv from ext import EventMesh -from machine import Timer -import voiceCall import osTimer from ext import constants -from misc import Power -import pm from ext.ui import Screen style_font_youyuan_20 = lv.style_t() style_font_youyuan_20.init() style_font_youyuan_20.set_text_color(lv.color_make(0xff, 0xff, 0xff)) -style_font_youyuan_20.set_text_font_v2("font_20.bin",18,0) +style_font_youyuan_20.set_text_font_v2("font_20.bin",20,0) class Watchface2(): NAME = "Watchface2" @@ -45,7 +40,7 @@ class Watchface2(): self.watchface_mpsignal_img.set_size(24,17) self.watchface_mpsignal_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface_mpsignal_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface_mpsignal_img.set_src("E:/static/mpsignal5.jpg") + self.watchface_mpsignal_img.set_src("E:/static/mpsignal5.png") self.watchface_mpsignal_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface_res_stat_battery_img = lv.img(self.meta) @@ -53,7 +48,7 @@ class Watchface2(): self.watchface_res_stat_battery_img.set_size(30,18) self.watchface_res_stat_battery_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface_res_stat_battery_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface_res_stat_battery_img.set_src("E:/static/vbat_100.jpg") + self.watchface_res_stat_battery_img.set_src("E:/static/vbat_100.png") self.watchface_res_stat_battery_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface_res_stat_charge_in_img = lv.img(self.meta) @@ -61,7 +56,7 @@ class Watchface2(): self.watchface_res_stat_charge_in_img.set_size(10,18) self.watchface_res_stat_charge_in_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface_res_stat_charge_in_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface_res_stat_charge_in_img.set_src("E:/static/charge_in.jpg") + self.watchface_res_stat_charge_in_img.set_src("E:/static/charge_in.png") # add style for watchface_res_stat_charge_in_img self.watchface_res_stat_charge_in_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) @@ -73,7 +68,7 @@ class Watchface2(): self.watchface1_time1_img.set_size(56,56) self.watchface1_time1_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time1_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time1_img.set_src("E:/static/watch_plate/style_2/time/1.jpg") + self.watchface1_time1_img.set_src("E:/static/watch_plate/style_2/time/1.png") self.watchface1_time1_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_time2_img = lv.img(self.meta) @@ -81,7 +76,7 @@ class Watchface2(): self.watchface1_time2_img.set_size(56,56) self.watchface1_time2_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time2_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time2_img.set_src("E:/static/watch_plate/style_2/time/3.jpg") + self.watchface1_time2_img.set_src("E:/static/watch_plate/style_2/time/3.png") self.watchface1_time2_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_time4_img = lv.img(self.meta) @@ -89,7 +84,7 @@ class Watchface2(): self.watchface1_time4_img.set_size(56,56) self.watchface1_time4_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time4_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time4_img.set_src("E:/static/watch_plate/style_2/time/2.jpg") + self.watchface1_time4_img.set_src("E:/static/watch_plate/style_2/time/2.png") self.watchface1_time4_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_time5_img = lv.img(self.meta) @@ -97,7 +92,7 @@ class Watchface2(): self.watchface1_time5_img.set_size(56,56) self.watchface1_time5_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time5_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time5_img.set_src("E:/static/watch_plate/style_2/time/3.jpg") + self.watchface1_time5_img.set_src("E:/static/watch_plate/style_2/time/3.png") self.watchface1_time5_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) #星期 @@ -107,7 +102,7 @@ class Watchface2(): self.weekday.set_size(56,56) self.weekday.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.weekday.add_flag(lv.obj.FLAG.CLICKABLE) - self.weekday.set_src("E:/static/watch_plate/style_2/week/fri.jpg") + self.weekday.set_src("E:/static/watch_plate/style_2/week/fri.png") self.weekday.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) #日期 @@ -132,7 +127,7 @@ class Watchface2(): self.weather = lv.img(self.meta) self.weather.set_pos(0, 50) self.weather.set_size(240, 96) - self.weather.set_src("E:/static/IMAGE_HEART_ONLY_TEST_DONE.jpg") + self.weather.set_src("E:/static/IMAGE_HEART_ONLY_TEST_DONE.png") #温度 @@ -166,7 +161,7 @@ class Watchface1(): self.watchface_mpsignal_img.set_size(24,17) self.watchface_mpsignal_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface_mpsignal_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface_mpsignal_img.set_src("E:/static/mpsignal5.jpg") + self.watchface_mpsignal_img.set_src("E:/static/mpsignal5.png") self.watchface_mpsignal_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface_res_stat_battery_img = lv.img(self.meta) @@ -174,7 +169,7 @@ class Watchface1(): self.watchface_res_stat_battery_img.set_size(30,18) self.watchface_res_stat_battery_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface_res_stat_battery_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface_res_stat_battery_img.set_src("E:/static/vbat_100.jpg") + self.watchface_res_stat_battery_img.set_src("E:/static/vbat_100.png") self.watchface_res_stat_battery_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface_res_stat_charge_in_img = lv.img(self.meta) @@ -182,7 +177,7 @@ class Watchface1(): self.watchface_res_stat_charge_in_img.set_size(6,16) self.watchface_res_stat_charge_in_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface_res_stat_charge_in_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface_res_stat_charge_in_img.set_src("E:/static/charge_in.jpg") + self.watchface_res_stat_charge_in_img.set_src("E:/static/charge_in.png") # add style for watchface_res_stat_charge_in_img self.watchface_res_stat_charge_in_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) @@ -192,7 +187,7 @@ class Watchface1(): self.watchface1_bg_img.set_size(240,280) self.watchface1_bg_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_bg_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_bg_img.set_src("E:/static/watch_plate/style_1/bg.jpg") + self.watchface1_bg_img.set_src("E:/static/watch_plate/style_1/bg.png") self.watchface1_bg_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) #时间 x = 40 @@ -202,7 +197,7 @@ class Watchface1(): self.watchface1_time1_img.set_size(36,44) self.watchface1_time1_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time1_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time1_img.set_src("E:/static/watch_plate/style_1/time/1.jpg") + self.watchface1_time1_img.set_src("E:/static/watch_plate/style_1/time/1.png") self.watchface1_time1_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_time2_img = lv.img(self.meta) @@ -210,7 +205,7 @@ class Watchface1(): self.watchface1_time2_img.set_size(36,44) self.watchface1_time2_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time2_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time2_img.set_src("E:/static/watch_plate/style_1/time/3.jpg") + self.watchface1_time2_img.set_src("E:/static/watch_plate/style_1/time/3.png") self.watchface1_time2_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_time3_img = lv.img(self.meta) @@ -218,7 +213,7 @@ class Watchface1(): self.watchface1_time3_img.set_size(8,24) self.watchface1_time3_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time3_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time3_img.set_src("E:/static/watch_plate/style_1/time/colon.jpg") + self.watchface1_time3_img.set_src("E:/static/watch_plate/style_1/time/colon.png") self.watchface1_time3_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_time4_img = lv.img(self.meta) @@ -226,7 +221,7 @@ class Watchface1(): self.watchface1_time4_img.set_size(36,44) self.watchface1_time4_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time4_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time4_img.set_src("E:/static/watch_plate/style_1/time/2.jpg") + self.watchface1_time4_img.set_src("E:/static/watch_plate/style_1/time/2.png") self.watchface1_time4_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_time5_img = lv.img(self.meta) @@ -234,7 +229,7 @@ class Watchface1(): self.watchface1_time5_img.set_size(36,44) self.watchface1_time5_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time5_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time5_img.set_src("E:/static/watch_plate/style_1/time/3.jpg") + self.watchface1_time5_img.set_src("E:/static/watch_plate/style_1/time/3.png") self.watchface1_time5_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) # create style self.watchface1_style_default self.watchface1_style_default = lv.style_t() @@ -251,7 +246,7 @@ class Watchface1(): self.watchface1_style_default.set_pad_right(0) self.watchface1_style_default.set_pad_top(0) self.watchface1_style_default.set_pad_bottom(0) - self.watchface1_style_default.set_text_font_v2("font_20.bin",20,0) #将外部字体库与该style对象绑定 + self.watchface1_style_default.set_text_font_v2("font_18.bin",18,0) #将外部字体库与该style对象绑定 #日期 self.watchface1_date = lv.spangroup(self.meta) self.watchface1_date.set_pos(int(24),int(131)) @@ -271,7 +266,7 @@ class Watchface1(): self.watchface1_date.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) #星期 self.watchface1_week = lv.spangroup(self.meta) - self.watchface1_week.set_pos(int(29),int(163)) + self.watchface1_week.set_pos(int(29),int(166)) self.watchface1_week.set_size(80,25) self.watchface1_week.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_week.set_align(lv.TEXT_ALIGN.LEFT) @@ -307,7 +302,7 @@ class Watchface1(): self.watchface1_step_img.set_size(26,24) self.watchface1_step_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_step_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_step_img.set_src("E:/static/watch_plate/style_1/step.jpg") + self.watchface1_step_img.set_src("E:/static/watch_plate/style_1/step.png") self.watchface1_step_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_step_txt = lv.spangroup(self.meta) @@ -332,7 +327,7 @@ class Watchface1(): self.watchface1_HB_img.set_size(30,27) self.watchface1_HB_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_HB_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_HB_img.set_src("E:/static/watch_plate/style_1/heart.jpg") + self.watchface1_HB_img.set_src("E:/static/watch_plate/style_1/heart.png") self.watchface1_HB_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_HB_txt = lv.spangroup(self.meta) @@ -357,7 +352,7 @@ class Watchface1(): self.watchface1_SPO2_img.set_size(23,32) self.watchface1_SPO2_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_SPO2_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_SPO2_img.set_src("E:/static/watch_plate/style_1/blood.jpg") + self.watchface1_SPO2_img.set_src("E:/static/watch_plate/style_1/blood.png") self.watchface1_SPO2_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_SPO2_txt = lv.spangroup(self.meta) @@ -431,10 +426,10 @@ class Watchface1(): hour2_chose = (msg[0][0])%10 min1_chose = (msg[0][1])//10%10 min2_chose = (msg[0][1])%10 - self.watchface1_time1_img.set_src("E:/static/watch_plate/style_1/time/%d.jpg"%(hour1_chose)) - self.watchface1_time2_img.set_src("E:/static/watch_plate/style_1/time/%d.jpg"%(hour2_chose)) - self.watchface1_time4_img.set_src("E:/static/watch_plate/style_1/time/%d.jpg"%(min1_chose)) - self.watchface1_time5_img.set_src("E:/static/watch_plate/style_1/time/%d.jpg"%(min2_chose)) + self.watchface1_time1_img.set_src("E:/static/watch_plate/style_1/time/%d.png"%(hour1_chose)) + self.watchface1_time2_img.set_src("E:/static/watch_plate/style_1/time/%d.png"%(hour2_chose)) + self.watchface1_time4_img.set_src("E:/static/watch_plate/style_1/time/%d.png"%(min1_chose)) + self.watchface1_time5_img.set_src("E:/static/watch_plate/style_1/time/%d.png"%(min2_chose)) self.watchface1_date_span.set_text(msg[2])#日期 self.watchface1_week_span.set_text(msg[3]) #星期 @@ -444,19 +439,19 @@ class Watchface1(): #print("__signal_cb:{}".format(msg//8)) if msg: if msg >= 0 and msg<=31 : - self.watchface_mpsignal_img.set_src("E:/static/mpsignal{}.jpg".format(msg//8)) + self.watchface_mpsignal_img.set_src("E:/static/mpsignal{}.png".format(msg//8)) else : - self.watchface_mpsignal_img.set_src("E:/static/mpsignal5.jpg") + self.watchface_mpsignal_img.set_src("E:/static/mpsignal5.png") def __battery(self, event, msg): #print("__battery_cb:",str(msg)) #print(msg) if msg[0] == '1': - self.watchface_res_stat_charge_in_img.set_src("E:/static/charge_in.jpg") + self.watchface_res_stat_charge_in_img.set_src("E:/static/charge_in.png") else: - self.watchface_res_stat_charge_in_img.set_src("E:/static/charge_in1.jpg") + self.watchface_res_stat_charge_in_img.set_src("E:/static/charge_in1.png") - self.watchface_res_stat_battery_img.set_src("E:/static/vbat_%d.jpg"%(msg[1]))#"E:/vbat_60.jpg" + self.watchface_res_stat_battery_img.set_src("E:/static/vbat_%d.png"%(msg[1]))#"E:/vbat_60.png" pass def __oldHrValue(self, event, msg): diff --git a/3.code/1.watch/2.code/ui_main_menu.py b/3.code/1.watch/2.code/ui_main_menu.py index 49ee0ffc..c10f2d13 100644 --- a/3.code/1.watch/2.code/ui_main_menu.py +++ b/3.code/1.watch/2.code/ui_main_menu.py @@ -129,7 +129,7 @@ class MainMenu1(): self.MainMenu1_1_img = lv.img(self.MainMenu1_1) self.MainMenu1_1_img.set_size(240, 200) self.MainMenu1_1_img.set_pos(0,60) - self.MainMenu1_1_img.set_src("E:/static/main_menu/main_menu1/4-1.jpg") + self.MainMenu1_1_img.set_src("E:/static/main_menu/main_menu1/4-1.png") self.MainMenu1_1_img.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -173,7 +173,7 @@ class MainMenu1(): self.MainMenu1_2_img = lv.img(self.MainMenu1_2) self.MainMenu1_2_img.set_size(240, 200) self.MainMenu1_2_img.set_pos(0,60) - self.MainMenu1_2_img.set_src("E:/static/main_menu/main_menu1/4-2.jpg") + self.MainMenu1_2_img.set_src("E:/static/main_menu/main_menu1/4-2.png") self.MainMenu1_2_img.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) #第三页 @@ -183,7 +183,7 @@ class MainMenu1(): self.MainMenu1_3_img = lv.img(self.MainMenu1_3) self.MainMenu1_3_img.set_size(240, 200) self.MainMenu1_3_img.set_pos(0,60) - self.MainMenu1_3_img.set_src("E:/static/main_menu/main_menu1/4-3.jpg") + self.MainMenu1_3_img.set_src("E:/static/main_menu/main_menu1/4-3.png") self.MainMenu1_3_img.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) # #通讯录 @@ -221,7 +221,7 @@ class MainMenu1(): self.MainMenu1_4_img = lv.img(self.MainMenu1_4) self.MainMenu1_4_img.set_size(240, 200) self.MainMenu1_4_img.set_pos(0,60) - self.MainMenu1_4_img.set_src("E:/static/main_menu/main_menu1/4-4.jpg") + self.MainMenu1_4_img.set_src("E:/static/main_menu/main_menu1/4-4.png") self.MainMenu1_4_img.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) # #秒表 @@ -263,7 +263,7 @@ class MainMenu1(): self.MainMenu1_img_wechat = lv.img(self.MainMenu1_5) self.MainMenu1_img_wechat.set_size(70, 70) self.MainMenu1_img_wechat.set_pos(30,60) - self.MainMenu1_img_wechat.set_src("E:/static/main_menu/main_menu1/IMAGE_MAINMENU_WECHAT.jpg") + self.MainMenu1_img_wechat.set_src("E:/static/main_menu/main_menu1/IMAGE_MAINMENU_WECHAT.png") self.MainMenu1_img_wechat.add_flag(lv.obj.FLAG.CLICKABLE) self.MainMenu1_img_wechat.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) self.MainMenu1_img_wechat.add_event_cb(lambda e: self.img_cb(e, "wechat"), lv.EVENT.CLICKED, None) @@ -290,145 +290,145 @@ class MainMenu2(): #支付宝 self.MainMenu2_alipay = self.MainMenu2.add_tile(0, 0, lv.DIR.LEFT | lv.DIR.RIGHT) self.MainMenu2_img_alipay = lv.img(self.MainMenu2_alipay) - self.MainMenu2_img_alipay.set_size(128,128) - self.MainMenu2_img_alipay.set_pos(56,50) - self.MainMenu2_img_alipay.set_src("E:/static/main_menu/main_menu2/alipay_.jpg") + self.MainMenu2_img_alipay.set_size(160,230) + self.MainMenu2_img_alipay.set_pos(40,20) + self.MainMenu2_img_alipay.set_src("E:/static/main_menu/main_menu2/alipay_.png") self.MainMenu2_img_alipay.add_flag(lv.obj.FLAG.CLICKABLE) self.MainMenu2_img_alipay.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - self.label_alipay = lv.label(self.MainMenu2_alipay) - self.label_alipay.set_pos(0, 240) - self.label_alipay.set_size(240, 80) - self.label_alipay.set_text("支付宝") - self.label_alipay.set_long_mode(lv.label.LONG.WRAP) - self.label_alipay.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - self.label_alipay.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) + # self.label_alipay = lv.label(self.MainMenu2_alipay) + # self.label_alipay.set_pos(0, 240) + # self.label_alipay.set_size(240, 80) + # self.label_alipay.set_text("支付宝") + # self.label_alipay.set_long_mode(lv.label.LONG.WRAP) + # self.label_alipay.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + # self.label_alipay.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) #拨号盘 self.MainMenu2_phone = self.MainMenu2.add_tile(1, 0, lv.DIR.LEFT | lv.DIR.RIGHT) self.MainMenu2_img_phone = lv.img(self.MainMenu2_phone) - self.MainMenu2_img_phone.set_size(128,128) - self.MainMenu2_img_phone.set_pos(56,50) - self.MainMenu2_img_phone.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CALL.jpg") + self.MainMenu2_img_phone.set_size(160,230) + self.MainMenu2_img_phone.set_pos(40,20) + self.MainMenu2_img_phone.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CALL.png") self.MainMenu2_img_phone.add_flag(lv.obj.FLAG.CLICKABLE) self.MainMenu2_img_phone.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - self.label_phone = lv.label(self.MainMenu2_phone) - self.label_phone.set_pos(0, 240) - self.label_phone.set_size(240, 80) - self.label_phone.set_text("拨号盘") - self.label_phone.set_long_mode(lv.label.LONG.WRAP) - self.label_phone.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - self.label_phone.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) + # self.label_phone = lv.label(self.MainMenu2_phone) + # self.label_phone.set_pos(0, 240) + # self.label_phone.set_size(240, 80) + # self.label_phone.set_text("拨号盘") + # self.label_phone.set_long_mode(lv.label.LONG.WRAP) + # self.label_phone.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + # self.label_phone.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) #通讯录 self.MainMenu2_contacts = self.MainMenu2.add_tile(2, 0, lv.DIR.LEFT | lv.DIR.RIGHT) self.MainMenu2_img_contacts = lv.img(self.MainMenu2_contacts) - self.MainMenu2_img_contacts.set_size(128,128) - self.MainMenu2_img_contacts.set_pos(56,50) - self.MainMenu2_img_contacts.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CONTACTS.jpg") + self.MainMenu2_img_contacts.set_size(160,230) + self.MainMenu2_img_contacts.set_pos(40,20) + self.MainMenu2_img_contacts.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_CONTACTS.png") self.MainMenu2_img_contacts.add_flag(lv.obj.FLAG.CLICKABLE) self.MainMenu2_img_contacts.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - self.label_contacts = lv.label(self.MainMenu2_contacts) - self.label_contacts.set_pos(0, 240) - self.label_contacts.set_size(240, 80) - self.label_contacts.set_text("通讯录") - self.label_contacts.set_long_mode(lv.label.LONG.WRAP) - self.label_contacts.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - self.label_contacts.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) + # self.label_contacts = lv.label(self.MainMenu2_contacts) + # self.label_contacts.set_pos(0, 240) + # self.label_contacts.set_size(240, 80) + # self.label_contacts.set_text("通讯录") + # self.label_contacts.set_long_mode(lv.label.LONG.WRAP) + # self.label_contacts.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + # self.label_contacts.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) #心律检测 self.MainMenu2_heartrate = self.MainMenu2.add_tile(3, 0, lv.DIR.LEFT | lv.DIR.RIGHT) self.MainMenu2_img_heartrate = lv.img(self.MainMenu2_heartrate) - self.MainMenu2_img_heartrate.set_size(128,128) - self.MainMenu2_img_heartrate.set_pos(56,50) - self.MainMenu2_img_heartrate.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_HEART_RATE_HEALTH_DETECT.jpg") + self.MainMenu2_img_heartrate.set_size(160,230) + self.MainMenu2_img_heartrate.set_pos(40,20) + self.MainMenu2_img_heartrate.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_HEART_RATE_HEALTH_DETECT.png") self.MainMenu2_img_heartrate.add_flag(lv.obj.FLAG.CLICKABLE) self.MainMenu2_img_heartrate.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - self.label_heartrate = lv.label(self.MainMenu2_heartrate) - self.label_heartrate.set_pos(0, 240) - self.label_heartrate.set_size(240, 80) - self.label_heartrate.set_text("心率") - self.label_heartrate.set_long_mode(lv.label.LONG.WRAP) - self.label_heartrate.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - self.label_heartrate.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) + # self.label_heartrate = lv.label(self.MainMenu2_heartrate) + # self.label_heartrate.set_pos(0, 240) + # self.label_heartrate.set_size(240, 80) + # self.label_heartrate.set_text("心率") + # self.label_heartrate.set_long_mode(lv.label.LONG.WRAP) + # self.label_heartrate.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + # self.label_heartrate.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) #血样检测 self.MainMenu2_spo2 = self.MainMenu2.add_tile(4, 0, lv.DIR.LEFT | lv.DIR.RIGHT) self.MainMenu2_img_spo2 = lv.img(self.MainMenu2_spo2) - self.MainMenu2_img_spo2.set_size(128,128) - self.MainMenu2_img_spo2.set_pos(56,50) - self.MainMenu2_img_spo2.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SPO2_DETECT.jpg") + self.MainMenu2_img_spo2.set_size(160,230) + self.MainMenu2_img_spo2.set_pos(40,20) + self.MainMenu2_img_spo2.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SPO2_DETECT.png") self.MainMenu2_img_spo2.add_flag(lv.obj.FLAG.CLICKABLE) self.MainMenu2_img_spo2.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - self.label_spo2 = lv.label(self.MainMenu2_spo2) - self.label_spo2.set_pos(0, 240) - self.label_spo2.set_size(240, 80) - self.label_spo2.set_text("血氧") - self.label_spo2.set_long_mode(lv.label.LONG.WRAP) - self.label_spo2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - self.label_spo2.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) + # self.label_spo2 = lv.label(self.MainMenu2_spo2) + # self.label_spo2.set_pos(0, 240) + # self.label_spo2.set_size(240, 80) + # self.label_spo2.set_text("血氧") + # self.label_spo2.set_long_mode(lv.label.LONG.WRAP) + # self.label_spo2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + # self.label_spo2.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) #工具箱 self.MainMenu2_toolbox = self.MainMenu2.add_tile(5, 0, lv.DIR.LEFT | lv.DIR.RIGHT) self.MainMenu2_img_toolbox = lv.img(self.MainMenu2_toolbox) - self.MainMenu2_img_toolbox.set_size(128,128) - self.MainMenu2_img_toolbox.set_pos(56,50) - self.MainMenu2_img_toolbox.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TOOLS.jpg") + self.MainMenu2_img_toolbox.set_size(160,230) + self.MainMenu2_img_toolbox.set_pos(40,20) + self.MainMenu2_img_toolbox.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TOOLS.png") self.MainMenu2_img_toolbox.add_flag(lv.obj.FLAG.CLICKABLE) self.MainMenu2_img_toolbox.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - self.label_toolbox = lv.label(self.MainMenu2_toolbox) - self.label_toolbox.set_pos(0, 240) - self.label_toolbox.set_size(240, 80) - self.label_toolbox.set_text("工具箱") - self.label_toolbox.set_long_mode(lv.label.LONG.WRAP) - self.label_toolbox.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - self.label_toolbox.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) + # self.label_toolbox = lv.label(self.MainMenu2_toolbox) + # self.label_toolbox.set_pos(0, 240) + # self.label_toolbox.set_size(240, 80) + # self.label_toolbox.set_text("工具箱") + # self.label_toolbox.set_long_mode(lv.label.LONG.WRAP) + # self.label_toolbox.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + # self.label_toolbox.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) #设置 self.MainMenu2_setting = self.MainMenu2.add_tile(6, 0, lv.DIR.LEFT | lv.DIR.RIGHT) self.MainMenu2_img_setting = lv.img(self.MainMenu2_setting) - self.MainMenu2_img_setting.set_size(128,128) - self.MainMenu2_img_setting.set_pos(56,50) - self.MainMenu2_img_setting.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SETTINGS.jpg") + self.MainMenu2_img_setting.set_size(160,230) + self.MainMenu2_img_setting.set_pos(40,20) + self.MainMenu2_img_setting.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_SETTINGS.png") self.MainMenu2_img_setting.add_flag(lv.obj.FLAG.CLICKABLE) self.MainMenu2_img_setting.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - self.label_setting = lv.label(self.MainMenu2_setting) - self.label_setting.set_pos(0, 240) - self.label_setting.set_size(240, 80) - self.label_setting.set_text("设置") - self.label_setting.set_long_mode(lv.label.LONG.WRAP) - self.label_setting.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - self.label_setting.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) + # self.label_setting = lv.label(self.MainMenu2_setting) + # self.label_setting.set_pos(0, 240) + # self.label_setting.set_size(240, 80) + # self.label_setting.set_text("设置") + # self.label_setting.set_long_mode(lv.label.LONG.WRAP) + # self.label_setting.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + # self.label_setting.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) #体温测量 self.MainMenu2_temperature = self.MainMenu2.add_tile(7, 0, lv.DIR.LEFT | lv.DIR.RIGHT) self.MainMenu2_img_temperature = lv.img(self.MainMenu2_temperature) - self.MainMenu2_img_temperature.set_size(128,128) - self.MainMenu2_img_temperature.set_pos(56,50) - self.MainMenu2_img_temperature.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TEMPERATURE.jpg") + self.MainMenu2_img_temperature.set_size(160,230) + self.MainMenu2_img_temperature.set_pos(40,20) + self.MainMenu2_img_temperature.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_TEMPERATURE.png") self.MainMenu2_img_temperature.add_flag(lv.obj.FLAG.CLICKABLE) self.MainMenu2_img_temperature.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - self.label_temperature = lv.label(self.MainMenu2_temperature) - self.label_temperature.set_pos(0, 240) - self.label_temperature.set_size(240, 80) - self.label_temperature.set_text("体温") - self.label_temperature.set_long_mode(lv.label.LONG.WRAP) - self.label_temperature.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - self.label_temperature.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) + # self.label_temperature = lv.label(self.MainMenu2_temperature) + # self.label_temperature.set_pos(0, 240) + # self.label_temperature.set_size(240, 80) + # self.label_temperature.set_text("体温") + # self.label_temperature.set_long_mode(lv.label.LONG.WRAP) + # self.label_temperature.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + # self.label_temperature.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) #微聊 self.MainMenu2_wechat = self.MainMenu2.add_tile(8, 0, lv.DIR.LEFT | lv.DIR.RIGHT) self.MainMenu2_img_wechat = lv.img(self.MainMenu2_wechat) - self.MainMenu2_img_wechat.set_size(128,128) - self.MainMenu2_img_wechat.set_pos(56,50) - self.MainMenu2_img_wechat.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_WECHAT.jpg") + self.MainMenu2_img_wechat.set_size(160,230) + self.MainMenu2_img_wechat.set_pos(40,20) + self.MainMenu2_img_wechat.set_src("E:/static/main_menu/main_menu2/IMAGE_ONE_PAGE_WECHAT.png") self.MainMenu2_img_wechat.add_flag(lv.obj.FLAG.CLICKABLE) self.MainMenu2_img_wechat.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - self.label_wechat = lv.label(self.MainMenu2_wechat) - self.label_wechat.set_pos(0, 240) - self.label_wechat.set_size(240, 80) - self.label_wechat.set_text("微聊") - self.label_wechat.set_long_mode(lv.label.LONG.WRAP) - self.label_wechat.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - self.label_wechat.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) + # self.label_wechat = lv.label(self.MainMenu2_wechat) + # self.label_wechat.set_pos(0, 240) + # self.label_wechat.set_size(240, 80) + # self.label_wechat.set_text("微聊") + # self.label_wechat.set_long_mode(lv.label.LONG.WRAP) + # self.label_wechat.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + # self.label_wechat.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) diff --git a/3.code/1.watch/2.code/ui_setting.py b/3.code/1.watch/2.code/ui_setting.py index c7b63e8d..c8e1c4eb 100644 --- a/3.code/1.watch/2.code/ui_setting.py +++ b/3.code/1.watch/2.code/ui_setting.py @@ -4,7 +4,9 @@ import ql_fs from ext import EventMesh from misc import Power from ext.ui import style_screen,style_font_youyuan_20,ContStyle,style_btn,style_img,Screen,style_contact_btn - +from ext import constants +import osTimer +from ext.lcd import style_font_youyuan_40 # -------------------------------------------setting screen---------------------------------------------------------- style_bar = lv.style_t() @@ -70,7 +72,7 @@ setting_cont.add_style( # setting_language_img.set_pos(10, setting_cont_y) # setting_language_img.set_size(47, 47) # setting_language_img.add_flag(lv.obj.FLAG.CLICKABLE) -# setting_language_img.set_src("E:/static/menu_language.jpg") +# setting_language_img.set_src("E:/static/menu_language.png") # setting_language_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) #setting_cont_y += 60 @@ -88,7 +90,7 @@ setting_dialswitch_img = lv.img(setting_cont) setting_dialswitch_img.set_pos(10, setting_cont_y) setting_dialswitch_img.set_size(47, 47) setting_dialswitch_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_dialswitch_img.set_src("E:/static/menu_watch_switch.jpg") +setting_dialswitch_img.set_src("E:/static/menu_watch_switch.png") setting_dialswitch_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) setting_cont_y+=60 @@ -107,7 +109,7 @@ setting_cont_y+=60 # setting_themeswitch_img.set_pos(10, 120) # setting_themeswitch_img.set_size(47, 47) # setting_themeswitch_img.add_flag(lv.obj.FLAG.CLICKABLE) -# setting_themeswitch_img.set_src("E:/static/menu_theme_switch.jpg") +# setting_themeswitch_img.set_src("E:/static/menu_theme_switch.png") # setting_themeswitch_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) #setting_cont_y+=60 @@ -125,7 +127,7 @@ setting_imei_img = lv.img(setting_cont) setting_imei_img.set_pos(10, setting_cont_y) setting_imei_img.set_size(47, 47) setting_imei_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_imei_img.set_src("E:/static/menu_imei_qrcode.jpg") +setting_imei_img.set_src("E:/static/menu_imei_qrcode.png") setting_imei_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) setting_cont_y+=60 @@ -143,7 +145,7 @@ setting_app_img = lv.img(setting_cont) setting_app_img.set_pos(10, setting_cont_y) setting_app_img.set_size(47, 47) setting_app_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_app_img.set_src("E:/static/menu_app_qrcode.jpg") +setting_app_img.set_src("E:/static/menu_app_qrcode.png") setting_app_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) setting_cont_y+=60 @@ -161,9 +163,9 @@ setting_bright_img = lv.img(setting_cont) setting_bright_img.set_pos(10, setting_cont_y) setting_bright_img.set_size(47, 47) setting_bright_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_bright_img.set_src("E:/static/menu_bright.jpg") +setting_bright_img.set_src("E:/static/menu_bright.png") setting_bright_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -setting_cont_y+60 +setting_cont_y+=60 setting_volume = lv.btn(setting_cont) setting_volume.set_pos(0, setting_cont_y) @@ -179,7 +181,7 @@ setting_volume_img = lv.img(setting_cont) setting_volume_img.set_pos(10, setting_cont_y) setting_volume_img.set_size(47, 47) setting_volume_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_volume_img.set_src("E:/static/menu_volume.jpg") +setting_volume_img.set_src("E:/static/menu_volume.png") setting_volume_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) setting_cont_y+=60 @@ -197,7 +199,7 @@ setting_restore_img = lv.img(setting_cont) setting_restore_img.set_pos(10, setting_cont_y) setting_restore_img.set_size(47, 47) setting_restore_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_restore_img.set_src("E:/static/menu_restore.jpg") +setting_restore_img.set_src("E:/static/menu_restore.png") setting_restore_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) setting_cont_y+=60 @@ -215,7 +217,7 @@ setting_poweroff_img = lv.img(setting_cont) setting_poweroff_img.set_pos(10, setting_cont_y) setting_poweroff_img.set_size(47, 47) setting_poweroff_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_poweroff_img.set_src("E:/static/menu_poweroff.jpg") +setting_poweroff_img.set_src("E:/static/menu_poweroff.png") setting_poweroff_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) setting_cont_y+=60 @@ -233,7 +235,7 @@ setting_version_img = lv.img(setting_cont) setting_version_img.set_pos(10, setting_cont_y) setting_version_img.set_size(47, 47) setting_version_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_version_img.set_src("E:/static/menu_version.jpg") +setting_version_img.set_src("E:/static/menu_version.png") setting_version_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) setting_cont_y+=60 @@ -251,7 +253,7 @@ setting_update_img = lv.img(setting_cont) setting_update_img.set_pos(10, setting_cont_y) setting_update_img.set_size(47, 47) setting_update_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_update_img.set_src("E:/static/menu_upgrade.jpg") +setting_update_img.set_src("E:/static/menu_upgrade.png") setting_update_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) class SettingScreen(Screen): @@ -431,31 +433,7 @@ menu_btn2_switch.set_style_bg_color(lv.color_make(0xff, 0x00, 0x00),lv.PART.KNOB menu_btn2_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.KNOB) -# -------------------------------------------imei screen---------------------------------------------------------- -imei_screen = lv.obj() -imei = lv.obj(imei_screen) -imei.center() -imei.set_size(240, 320) -imei.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - -bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5) -fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4) - -imei_qr = lv.qrcode(imei, 150, fg_color, bg_color) -imei_qr.center() -# Add a border with bg_color -imei_qr.set_style_border_color(bg_color, 0) -imei_qr.set_style_border_width(5, 0) -imei_qr_data = str("867387060319145") -imei_qr.update(imei_qr_data,len(imei_qr_data)) -imei_label = lv.label(imei) -imei_label.set_pos(0, 280) -imei_label.set_size(240, 20) -imei_label.set_text("867387060319145") -imei_label.set_long_mode(lv.label.LONG.WRAP) -imei_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -imei_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) # -------------------------------------------app screen---------------------------------------------------------- @@ -470,7 +448,7 @@ app_img.set_pos(int(20),int(40)) app_img.set_size(200,200) app_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) app_img.add_flag(lv.obj.FLAG.CLICKABLE) -app_img.set_src("E:/static/IMAGE_APP_QR_CODE.jpg") +app_img.set_src("E:/static/IMAGE_APP_QR_CODE.png") app_img.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) # app_qr = lv.qrcode(imei, 150, fg_color, bg_color) # app_qr.center() @@ -483,59 +461,11 @@ app_img.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) app_label = lv.label(app_screen) app_label.set_pos(0, 280) app_label.set_size(240, 20) -app_label.set_text("867387060319145") +app_label.set_text(" ") app_label.set_long_mode(lv.label.LONG.WRAP) app_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) app_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -# -------------------------------------------brightness screen---------------------------------------------------------- -brightness_screen = lv.obj() -brightness = lv.obj(brightness_screen) -brightness.center() -brightness.set_size(240, 320) -brightness.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - -brightness_title = lv.label(brightness) -brightness_title.set_pos(0, 10) -brightness_title.set_size(240, 40) -brightness_title.set_text("屏幕调节") -brightness_title.set_long_mode(lv.label.LONG.WRAP) -brightness_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -brightness_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -brightness_label1 = lv.label(brightness) -brightness_label1.set_pos(10, 60) -brightness_label1.set_size(50, 40) -brightness_label1.set_text("亮度") -brightness_label1.set_long_mode(lv.label.LONG.WRAP) -brightness_label1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) -brightness_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - -brightness_bar = lv.bar(brightness) -brightness_bar.set_pos(20, 120) -brightness_bar.set_size(200, 15) -brightness_bar.set_style_anim_time(1000, lv.PART.INDICATOR | lv.STATE.DEFAULT) -brightness_bar.set_mode(lv.bar.MODE.NORMAL) -brightness_bar.set_value(50, lv.ANIM.OFF) -brightness_bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT) -brightness_bar.add_style(style_bar_indic, lv.PART.INDICATOR | lv.STATE.DEFAULT) - -brightness_add_imgbtn = lv.img(brightness) -brightness_add_imgbtn.set_pos(50, 250) -brightness_add_imgbtn.set_size(34, 30) -brightness_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -brightness_add_imgbtn.set_src("E:/static/time_up.jpg") -brightness_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - -brightness_reduce_imgbtn = lv.img(brightness) -brightness_reduce_imgbtn.set_pos(150, 250) -brightness_reduce_imgbtn.set_size(34, 30) -brightness_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -brightness_reduce_imgbtn.set_src("E:/static/time_down.jpg") -brightness_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - # -------------------------------------------volume screen---------------------------------------------------------- volume_screen = lv.obj() @@ -610,7 +540,7 @@ phonering_reduce_imgbtn = lv.img(phonering) phonering_reduce_imgbtn.set_pos(0, 150) phonering_reduce_imgbtn.set_size(110, 46) phonering_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -phonering_reduce_imgbtn.set_src("E:/static/reduce_btn.jpg") +phonering_reduce_imgbtn.set_src("E:/static/reduce_btn.png") phonering_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -619,7 +549,7 @@ phonering_add_imgbtn.set_pos(120, 150) phonering_add_imgbtn.set_size(110, 46) phonering_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -phonering_add_imgbtn.set_src("E:/static/add_btn.jpg") +phonering_add_imgbtn.set_src("E:/static/add_btn.png") phonering_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -661,7 +591,7 @@ alarmvolume_reduce_imgbtn.set_pos(5, 150) alarmvolume_reduce_imgbtn.set_size(110, 46) alarmvolume_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -alarmvolume_reduce_imgbtn.set_src("E:/static/reduce_btn.jpg") +alarmvolume_reduce_imgbtn.set_src("E:/static/reduce_btn.png") alarmvolume_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -671,7 +601,7 @@ alarmvolume_add_imgbtn.set_pos(125, 150) alarmvolume_add_imgbtn.set_size(110, 46) alarmvolume_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -alarmvolume_add_imgbtn.set_src("E:/static/add_btn.jpg") +alarmvolume_add_imgbtn.set_src("E:/static/add_btn.png") alarmvolume_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -713,7 +643,7 @@ msgvolume_reduce_imgbtn.set_pos(5, 150) msgvolume_reduce_imgbtn.set_size(110, 46) msgvolume_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -msgvolume_reduce_imgbtn.set_src("E:/static/reduce_btn.jpg") +msgvolume_reduce_imgbtn.set_src("E:/static/reduce_btn.png") msgvolume_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -723,7 +653,7 @@ msgvolume_add_imgbtn.set_pos(125, 150) msgvolume_add_imgbtn.set_size(110, 46) msgvolume_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -msgvolume_add_imgbtn.set_src("E:/static/add_btn.jpg") +msgvolume_add_imgbtn.set_src("E:/static/add_btn.png") msgvolume_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -763,50 +693,7 @@ restore_cancel.set_ext_click_area(20) -# -------------------------------------------poweroff screen---------------------------------------------------------- -poweroff_screen = lv.obj() -poweroff = lv.obj(poweroff_screen) -poweroff.center() -poweroff.set_size(240, 320) -poweroff.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) -poweroff_img = lv.img(poweroff) -poweroff_img.set_pos(100, 30) -poweroff_img.set_size(61, 61) -poweroff_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -poweroff_img.set_src("E:/static/poweroff_icon.jpg") - -poweroff_label = lv.label(poweroff) -poweroff_label.set_text("是否关机?") -poweroff_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -poweroff_label.set_size(240, 20) -poweroff_label.set_pos(0,120) -poweroff_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -poweroff_confirm = lv.img(poweroff) -poweroff_confirm.set_size(176, 46) -poweroff_confirm.set_pos(32, 150) -poweroff_confirm.set_src("E:/static/off_icon.jpg") -poweroff_confirm.add_flag(lv.obj.FLAG.CLICKABLE) -poweroff_confirm.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -poweroff_confirm.set_ext_click_area(20) - -poweroff_confirm_label = lv.label(poweroff_confirm) -poweroff_confirm_label.set_text("关机") -poweroff_confirm_label.align(lv.ALIGN.CENTER, 0, 0) -poweroff_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -poweroff_return = lv.img(poweroff) -poweroff_return.set_size(176, 46) -poweroff_return.set_pos(32, 210) -poweroff_return.set_src("E:/static/cancel_icon.jpg") -poweroff_return.add_flag(lv.obj.FLAG.CLICKABLE) -poweroff_return.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -poweroff_return_label = lv.label(poweroff_return) -poweroff_return_label.set_text("返回") -poweroff_return_label.align(lv.ALIGN.CENTER, 0, 0) -poweroff_return_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -poweroff_return.set_ext_click_area(20) # -------------------------------------------version screen---------------------------------------------------------- version_screen = lv.obj() @@ -823,18 +710,25 @@ Build Time: 2-17-2023 9:32:5 IMEI: -867387060319145 """ version_label = lv.label(version) version_label.set_pos(0, 0) -version_label.set_size(240, 320) +version_label.set_size(240, 150) version_label.set_long_mode(lv.label.LONG.WRAP) version_label.set_text(version_msg) - version_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) version_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +version_label1 = lv.label(version) +version_label1.set_pos(20, 160) +version_label1.set_size(220, 100) +version_label1.set_long_mode(lv.label.LONG.WRAP) +version_label1.set_text(" ") +version_label1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +version_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + + # -------------------------------------------update screen---------------------------------------------------------- update_screen = lv.obj() @@ -894,7 +788,7 @@ class RestoreScreen(Screen): EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "setting"}) class UpdateScreen(Screen): @@ -915,7 +809,7 @@ class UpdateScreen(Screen): EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "setting"}) class VersionScreen(Screen): @@ -925,6 +819,9 @@ class VersionScreen(Screen): super().__init__() self.meta = version_screen self.btn_count = 0 + def initialization(self): + imei = EventMesh.publish(constants.EVENT.GET_IMEI) + version_label1.set_text(imei) def Close(self): self.btn_count = 0 @@ -946,8 +843,58 @@ class VersionScreen(Screen): EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "setting"}) + +# -------------------------------------------poweroff screen---------------------------------------------------------- +poweroff_screen = lv.obj() +poweroff = lv.obj(poweroff_screen) +poweroff.center() +poweroff.set_size(240, 320) +poweroff.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + +poweroff_img = lv.img(poweroff) +poweroff_img.set_pos(100, 30) +poweroff_img.set_size(61, 61) +poweroff_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) +poweroff_img.set_src("E:/static/poweroff_icon.png") + +poweroff_label = lv.label(poweroff) +poweroff_label.set_text("是否关机?") +poweroff_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +poweroff_label.set_size(240, 20) +poweroff_label.set_pos(0,120) +poweroff_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +poweroff_confirm = lv.img(poweroff) +poweroff_confirm.set_size(176, 46) +poweroff_confirm.set_pos(32, 150) +poweroff_confirm.set_src("E:/static/off_icon.png") +poweroff_confirm.add_flag(lv.obj.FLAG.CLICKABLE) +poweroff_confirm.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) +poweroff_confirm.set_ext_click_area(20) + +poweroff_confirm_label = lv.label(poweroff_confirm) +poweroff_confirm_label.set_text("关机") +poweroff_confirm_label.align(lv.ALIGN.CENTER, 0, 0) +poweroff_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +poweroff_return = lv.img(poweroff) +poweroff_return.set_size(176, 46) +poweroff_return.set_pos(32, 210) +poweroff_return.set_src("E:/static/cancel_icon.png") +poweroff_return.add_flag(lv.obj.FLAG.CLICKABLE) +poweroff_return.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) +poweroff_return_label = lv.label(poweroff_return) +poweroff_return_label.set_text("返回") +poweroff_return_label.align(lv.ALIGN.CENTER, 0, 0) +poweroff_return_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +poweroff_return.set_ext_click_area(20) + +poweroff_confirm_label1 = lv.label(poweroff) +poweroff_confirm_label1.set_text("Goodbye") +poweroff_confirm_label1.align(lv.ALIGN.CENTER, 0, 0) +poweroff_confirm_label1.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) class PoweroffScreen(Screen): NAME = "poweroff" @@ -955,24 +902,72 @@ class PoweroffScreen(Screen): def __init__(self): super().__init__() self.meta = poweroff_screen + self.timer = osTimer() + self.button_flag = 0 poweroff_confirm.add_event_cb(lambda e: self.confirm(e),lv.EVENT.CLICKED, None) poweroff_return.add_event_cb(lambda e: self.concel(e),lv.EVENT.CLICKED, None) + def initialization(self): + self.button_flag = 0 + poweroff_confirm_label1.add_flag(lv.obj.FLAG.HIDDEN) + + poweroff_img.clear_flag(lv.obj.FLAG.HIDDEN) + poweroff_label.clear_flag(lv.obj.FLAG.HIDDEN) + poweroff_confirm.clear_flag(lv.obj.FLAG.HIDDEN) + poweroff_confirm_label.clear_flag(lv.obj.FLAG.HIDDEN) + poweroff_return.clear_flag(lv.obj.FLAG.HIDDEN) + poweroff_return_label.clear_flag(lv.obj.FLAG.HIDDEN) + def done_return(self): - EventMesh.publish("load_screen", {"screen": "setting"}) + if self.button_flag == 0: + EventMesh.publish("load_screen", {"screen": "setting"}) def confirm(self, e): + self.button_flag = 1 + poweroff_img.add_flag(lv.obj.FLAG.HIDDEN) + poweroff_label.add_flag(lv.obj.FLAG.HIDDEN) + poweroff_confirm.add_flag(lv.obj.FLAG.HIDDEN) + poweroff_confirm_label.add_flag(lv.obj.FLAG.HIDDEN) + poweroff_return.add_flag(lv.obj.FLAG.HIDDEN) + poweroff_return_label.add_flag(lv.obj.FLAG.HIDDEN) + poweroff_confirm_label1.clear_flag(lv.obj.FLAG.HIDDEN) + self.timer.start(2*1000,0,self.power_off_event) + + def power_off_event(self,e): Power.powerDown() - # EventMesh.publish("load_screen", {"screen": "setting"}) def concel(self, e): EventMesh.publish("load_screen", {"screen": "setting"}) def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + if self.button_flag == 0: + EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + if self.button_flag == 0: + EventMesh.publish("load_screen", {"screen": "setting"}) + + + + + + +# class PoweroffScreen(Screen): +# NAME = "poweroff_comfirm" + +# def __init__(self): +# super().__init__() +# self.meta = poweroff_confirm_screen +# self.timer = osTimer() +# def done_return(self): +# EventMesh.publish("load_screen", {"screen": "setting"}) + +# def confirm(self, e): + + +# # EventMesh.publish("load_screen", {"screen": "setting"}) +# def power_off(self,event,msg): +# Power.powerDown() class LanguageScreen(Screen): @@ -986,10 +981,10 @@ class LanguageScreen(Screen): EventMesh.publish("load_screen", {"screen": "setting"}) def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "setting"}) + EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "setting"}) class DialswitchScreen(Screen): @@ -1025,7 +1020,7 @@ class DialswitchScreen(Screen): EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "setting"}) class ThemeswitchScreen(Screen): @@ -1059,9 +1054,32 @@ class ThemeswitchScreen(Screen): EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "setting"}) + +# -------------------------------------------imei screen---------------------------------------------------------- +imei_screen = lv.obj() +imei = lv.obj(imei_screen) +imei.center() +imei.set_size(240, 320) +imei.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + +bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5) +fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4) + +imei_qr = lv.qrcode(imei, 150, fg_color, bg_color) +imei_qr.center() +# Add a border with bg_color +imei_qr.set_style_border_color(bg_color, 0) +imei_qr.set_style_border_width(5, 0) +imei_label = lv.label(imei) +imei_label.set_pos(0, 280) +imei_label.set_size(240, 20) +imei_label.set_text(" ") +imei_label.set_long_mode(lv.label.LONG.WRAP) +imei_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +imei_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) class ImeiScreen(Screen): NAME = "imei" @@ -1069,6 +1087,13 @@ class ImeiScreen(Screen): super().__init__() self.meta = imei_screen + def initialization(self): + + imei = EventMesh.publish(constants.EVENT.GET_IMEI) + imei_qr_data = str(imei) + imei_qr.update(imei_qr_data,len(imei_qr_data)) + imei_label.set_text(imei) + def done_return(self): EventMesh.publish("load_screen", {"screen": "setting"}) @@ -1076,7 +1101,7 @@ class ImeiScreen(Screen): EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "setting"}) class AppScreen(Screen): @@ -1085,7 +1110,10 @@ class AppScreen(Screen): def __init__(self): super().__init__() self.meta = app_screen - + def initialization(self): + imei = EventMesh.publish(constants.EVENT.GET_IMEI) + app_label.set_text(imei) + def done_return(self): EventMesh.publish("load_screen", {"screen": "setting"}) @@ -1093,8 +1121,56 @@ class AppScreen(Screen): EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "setting"}) +# -------------------------------------------brightness screen---------------------------------------------------------- +brightness_screen = lv.obj() +brightness = lv.obj(brightness_screen) +brightness.center() +brightness.set_size(240, 320) +brightness.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + + +brightness_title = lv.label(brightness) +brightness_title.set_pos(0, 10) +brightness_title.set_size(240, 40) +brightness_title.set_text("屏幕调节") +brightness_title.set_long_mode(lv.label.LONG.WRAP) +brightness_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +brightness_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +brightness_label1 = lv.label(brightness) +brightness_label1.set_pos(10, 70) +brightness_label1.set_size(230, 40) +brightness_label1.set_text("亮度:") +brightness_label1.set_long_mode(lv.label.LONG.WRAP) +brightness_label1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) +brightness_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +brightness_bar = lv.bar(brightness) +brightness_bar.set_pos(20, 120) +brightness_bar.set_size(200, 15) +brightness_bar.set_style_anim_time(1000, lv.PART.INDICATOR | lv.STATE.DEFAULT) +brightness_bar.set_mode(lv.bar.MODE.NORMAL) +brightness_bar.set_value(50, lv.ANIM.OFF) +brightness_bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT) +brightness_bar.add_style(style_bar_indic, lv.PART.INDICATOR | lv.STATE.DEFAULT) +brightness_reduce_imgbtn = lv.img(brightness) +brightness_reduce_imgbtn.set_pos(5, 150) +brightness_reduce_imgbtn.set_size(110, 46) +brightness_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) + +brightness_reduce_imgbtn.set_src("E:/static/reduce_btn.png") + +brightness_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + + +brightness_add_imgbtn = lv.img(brightness) +brightness_add_imgbtn.set_pos(125, 150) +brightness_add_imgbtn.set_size(110, 46) +brightness_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) +brightness_add_imgbtn.set_src("E:/static/add_btn.png") +brightness_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) class BrightnessScreen(Screen): NAME = "brightness" @@ -1107,7 +1183,9 @@ class BrightnessScreen(Screen): lv.EVENT.CLICKED, None) brightness_reduce_imgbtn.add_event_cb(lambda e: self.reduce_level(e), lv.EVENT.CLICKED, None) - + def initialization(self): + self.level = EventMesh.publish("get_brightness_level") + self.show_bar() def add_level(self, e): EventMesh.publish("push_add_brightness_level") self.level = EventMesh.publish("get_brightness_level") @@ -1119,11 +1197,10 @@ class BrightnessScreen(Screen): self.show_bar() def show_bar(self): - brightness_bar.set_value((100 // 7) * self.level, lv.ANIM.OFF) + if self.level == None: + self.level = 5 + brightness_bar.set_value((100 // 10) * self.level, lv.ANIM.OFF) - def initialization(self): - self.level = EventMesh.publish("get_brightness_level") - self.show_bar() def done_return(self): EventMesh.publish("load_screen", {"screen": "setting"}) @@ -1132,7 +1209,7 @@ class BrightnessScreen(Screen): EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "setting"}) class VolumeScreen(Screen): @@ -1152,7 +1229,7 @@ class VolumeScreen(Screen): EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "setting"}) @@ -1199,7 +1276,7 @@ class PhoneringScreen(Screen): EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "volume"}) @@ -1239,7 +1316,7 @@ class AlarmvolumeScreen(Screen): EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) + EventMesh.publish("load_screen", {"screen": "volume"}) @@ -1279,4 +1356,4 @@ class MsgvolumeScreen(Screen): EventMesh.publish("load_screen", {"screen": "watchface"}) def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "watchface"}) \ No newline at end of file + EventMesh.publish("load_screen", {"screen": "volume"}) \ No newline at end of file