From: d15521469561 Date: Wed, 24 May 2023 10:09:52 +0000 (+0800) Subject: ui相关更改 X-Git-Url: http://git.snicker.com.cn/css/static/script.js?a=commitdiff_plain;h=0e733d8de7e4508573885bf3416149b0b3f0ab30;p=mirrors%2FASR1603_G5.git ui相关更改 --- diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appAlipay.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appAlipay.py index 45acdb6f..92798fcb 100644 --- a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appAlipay.py +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appAlipay.py @@ -11,7 +11,7 @@ import constants from misc import Power import pm from ui import Screen -from code import code_39_generate_barcode +from code import code_128_generate_barcode 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)) @@ -629,49 +629,103 @@ alipay_paycode_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) # add style for watchface alipay_paycode_screen.add_style(style_alipay_screen_default, lv.PART.MAIN|lv.STATE.DEFAULT) -alipay_paycode = lv.tileview(alipay_paycode_screen) -alipay_paycode.center() -alipay_paycode.set_size(240, 320) -alipay_paycode.add_style(style_alipay_screen_default, lv.PART.MAIN | lv.STATE.DEFAULT) -# 1 - 条形码界面 -# alipay_barcode = alipay_paycode.add_tile(0, 0, lv.DIR.LEFT | lv.DIR.RIGHT) -#椭圆背景 +# alipay_paycode = lv.tileview(alipay_paycode_screen) +# alipay_paycode.center() +# alipay_paycode.set_size(240, 320) +# alipay_paycode.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +# alipay_paycode.add_style(style_alipay_screen_default, lv.PART.MAIN | lv.STATE.DEFAULT) + +# # 1 - 二维码界面 +# alipay_qrcode = alipay_paycode.add_tile(0, 0, lv.DIR.LEFT | lv.DIR.RIGHT) +# alipay_paycode_bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5) +# alipay_paycode_fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4) +# #二维码 +# alipay_paycode_alipay_qr = lv.qrcode(alipay_qrcode, 150, alipay_paycode_fg_color, alipay_paycode_bg_color) +# alipay_paycode_alipay_qr.set_pos(45,61) +# alipay_paycode_alipay_qr.set_style_border_color(alipay_paycode_bg_color, 0) +# alipay_paycode_alipay_qr.set_style_border_width(5, 0) + +# #提示词 +# alipay_paycode_label = lv.label(alipay_qrcode) +# alipay_paycode_label.set_pos(0, 33) +# alipay_paycode_label.set_size(240, 30) +# alipay_paycode_label.set_long_mode(lv.label.LONG.WRAP) +# alipay_paycode_label.set_text("收银员扫一扫完成付款") +# alipay_paycode_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# alipay_paycode_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + + +# # 2 - 条形码界面 +# alipay_barcode = alipay_paycode.add_tile(1, 0, lv.DIR.LEFT | lv.DIR.RIGHT) + # alipay_paycode_cont = lv.obj(alipay_barcode) -# alipay_paycode_cont.set_size(240,220) -# alipay_paycode_cont.set_pos(0,21) +# alipay_paycode_cont.set_size(240,150) +# alipay_paycode_cont.set_pos(0,85) # alipay_paycode_cont.add_style(style_cont_alipay, lv.PART.MAIN | lv.STATE.DEFAULT) -#条形码 -alipay_paycode_bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5) -alipay_paycode_fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4) -# alipay_bar = lv.qrcode(alipay_barcode, 150, alipay_paycode_fg_color, alipay_paycode_bg_color) -# alipay_bar.set_pos(33,61) -# alipay_bar.set_style_border_color(alipay_paycode_bg_color, 0) -# alipay_bar.set_style_border_width(5, 0) - -#编号 +# alipay_barcode_label = lv.label(alipay_barcode) +# alipay_barcode_label.set_pos(0, 33) +# alipay_barcode_label.set_size(240, 30) +# alipay_barcode_label.set_long_mode(lv.label.LONG.WRAP) +# alipay_barcode_label.set_text("收银员扫一扫完成付款") +# alipay_barcode_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# alipay_barcode_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -# 2 - 二维码界面 -alipay_qrcode = alipay_paycode.add_tile(0, 0, lv.DIR.LEFT | lv.DIR.RIGHT) +# alipay_barcode_num = lv.label(alipay_barcode) +# alipay_barcode_num.set_pos(0, 240) +# alipay_barcode_num.set_size(240, 30) +# alipay_barcode_num.set_long_mode(lv.label.LONG.WRAP) +# alipay_barcode_num.set_text(" ") +# alipay_barcode_num.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# alipay_barcode_num.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -#二维码 -alipay_paycode_alipay_qr = lv.qrcode(alipay_qrcode, 150, alipay_paycode_fg_color, alipay_paycode_bg_color) -alipay_paycode_alipay_qr.set_pos(45,61) -alipay_paycode_alipay_qr.set_style_border_color(alipay_paycode_bg_color, 0) -alipay_paycode_alipay_qr.set_style_border_width(5, 0) #提示词 -alipay_paycode_label = lv.label(alipay_qrcode) -alipay_paycode_label.set_pos(0, 33) -alipay_paycode_label.set_size(240, 24) + + + +# 1 - 条形码界面 +# alipay_barcode = alipay_paycode.add_tile(0, 0, lv.DIR.LEFT | lv.DIR.RIGHT) + +alipay_paycode_label = lv.label(alipay_paycode_screen) +alipay_paycode_label.set_pos(0, 3) +alipay_paycode_label.set_size(240, 25) alipay_paycode_label.set_long_mode(lv.label.LONG.WRAP) alipay_paycode_label.set_text("收银员扫一扫完成付款") alipay_paycode_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) alipay_paycode_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +# alipay_paycode_cont = lv.obj(alipay_paycode_screen) +# alipay_paycode_cont.set_size(240,280) +# alipay_paycode_cont.set_pos(0,40) +# alipay_paycode_cont.add_style(style_cont_alipay, lv.PART.MAIN | lv.STATE.DEFAULT) + +style_font_youyuan_black_20 = lv.style_t() +style_font_youyuan_black_20.init() +style_font_youyuan_black_20.set_text_color(lv.color_make(0xff, 0xff, 0xff)) +style_font_youyuan_black_20.set_text_font_v2("font_24.bin",24,0) + +# alipay_barcode_num = lv.label(alipay_paycode_screen) +# alipay_barcode_num.set_pos(0, 130) +# alipay_barcode_num.set_size(240, 30) +# alipay_barcode_num.set_long_mode(lv.label.LONG.WRAP) +# alipay_barcode_num.set_text(" ") +# alipay_barcode_num.add_style(style_font_youyuan_black_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +# 2 - 二维码界面 + +# alipay_qrcode = alipay_paycode.add_tile(0, 0, lv.DIR.LEFT | lv.DIR.RIGHT) +alipay_paycode_bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5) +alipay_paycode_fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4) +#二维码 +alipay_paycode_alipay_qr = lv.qrcode(alipay_paycode_screen, 150, alipay_paycode_fg_color, alipay_paycode_bg_color) +alipay_paycode_alipay_qr.set_pos(45,150) +alipay_paycode_alipay_qr.set_style_border_color(alipay_paycode_bg_color, 0) +alipay_paycode_alipay_qr.set_style_border_width(5, 0) + class Alipay_paycode(Screen): NAME = "alipay_paycode" @@ -679,15 +733,64 @@ class Alipay_paycode(Screen): def __init__(self): super().__init__() self.meta = alipay_paycode_screen - + self.container = lv.obj(alipay_paycode_screen) + self.container.set_pos(0, 33) + self.container.set_size(240, 100) + self.container.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.container.add_style(style_alipay_screen_default, lv.PART.MAIN | lv.STATE.DEFAULT) + + self.timer = osTimer() + def post_processor_after_initialization(self): self.alipay_qr_data = str(self.meta_info) print("alipay_paycode:",str(self.meta_info)) alipay_paycode_alipay_qr.update(self.alipay_qr_data,len(self.alipay_qr_data)) # alipay_bar.update(self.alipay_qr_data,len(self.alipay_qr_data)) - # code_39_generate_barcode(alipay_barcode,self.alipay_qr_data,120,320) + # alipay_barcode_num.set_text(self.alipay_qr_data) + # left_curr_line = 0 + + # # 删除上次的container + # # 生成二进制码 + # binary_data = code128.encode(self.alipay_qr_data) + # if not binary_data: + # return + # # print("binary_data is ",binary_data) + + # # 在LVGL中创建一个容器对象 + # self.container.delete()#先删除一次控件 + # self.container = lv.obj(alipay_paycode_screen) + # self.container.set_pos(0, 30) + # self.container.set_size(240, 100) + # self.container.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + # self.container.add_style(style_alipay_screen_default, lv.PART.MAIN | lv.STATE.DEFAULT) + + # # 计算每个条的宽度 + # bar_width = 240 // (len(binary_data)) + # # print("bar_width is :{} len(binary_data):{}".format(bar_width,len(binary_data))) + # # 按照二进制码中的1和0,分别创建LVGL矩形对象 + # for i in range(len(binary_data)): + # # print("left_curr_line is :{} width:{}".format(left_curr_line,width)) + # bar = lv.obj(self.container) + # bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT) + # real_width = bar_width * 1 + # bar.set_size(1,90) + # left = (240 - len(binary_data))//2#240-152 = 88 //2 ==44 + # bar.set_pos(left+left_curr_line,0) + # if binary_data[i] == 0xff: + # bar.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff), lv.PART.MAIN | lv.STATE.DEFAULT) + # else: + # bar.set_style_bg_color(lv.color_make(0x00, 0x00, 0x00), lv.PART.MAIN | lv.STATE.DEFAULT) + # left_curr_line += real_width + + code_128_generate_barcode(alipay_paycode_screen,self.alipay_qr_data,240,100) + def initialization(self): + self.timer.start(10*1000,1,self.update_alipy) + + def update_alipy(self,e): + EventMesh.publish("get_payment_code") def Close(self): + self.timer.stop() EventMesh.publish("alipay_exit") pass def done_click(self): @@ -732,7 +835,7 @@ alipay_pay_text = lv.label(alipay_pay_success_screen) alipay_pay_text.set_text("支付完成") alipay_pay_text.set_pos(0, 220) alipay_pay_text.set_size(240,45) -alipay_pay_text.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) +alipay_pay_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) alipay_pay_text.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) class Alipay_pay_success(Screen): diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appWechat.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appWechat.py index ea2c3fc6..69dabb8d 100644 --- a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appWechat.py +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appWechat.py @@ -40,8 +40,17 @@ style_wechat_btn.set_shadow_opa(0) # -------------------------------------------wechat screen---------------------------------------------------------- wechat_screen = lv.obj() +wechat_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) wechat_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) +wechat_screen_list_screen = lv.obj(wechat_screen) +wechat_screen_list_screen.set_pos(0, 0) +wechat_screen_list_screen.set_size(240, 260) +wechat_screen_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +wechat_screen_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + + + wechat_press_btn = lv.btn(wechat_screen) wechat_press_btn.set_pos(10, 260) wechat_press_btn.set_size(220, 56) @@ -54,21 +63,21 @@ wechat_press_label.set_text("请按住说话") wechat_press_label.align(lv.ALIGN.CENTER, 10, 0) wechat_press_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -wechat_label = lv.label(wechat_screen) -wechat_label.center() +wechat_label = lv.label(wechat_screen_list_screen) +wechat_label.set_pos(0, 140) wechat_label.set_size(240, 40) wechat_label.set_long_mode(lv.label.LONG.WRAP) wechat_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) wechat_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -wechat_press_label_countdown = lv.label(wechat_screen) -wechat_press_label_countdown.set_pos(100, 100) -wechat_press_label_countdown.set_size(40, 40) +wechat_press_label_countdown = lv.label(wechat_screen_list_screen) +wechat_press_label_countdown.set_pos(0, 100) +wechat_press_label_countdown.set_size(240, 40) wechat_press_label_countdown.set_text(" ") wechat_press_label_countdown.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) wechat_press_label_countdown.set_long_mode(lv.label.LONG.WRAP) -wechat_press_label_countdown.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0) +wechat_press_label_countdown.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -132,11 +141,7 @@ class WechatScreen(Screen): self.startWidth = 0 self.check_json = 0 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.wechat_list.add_flag(lv.obj.FLAG.HIDDEN) EventMesh.subscribe("wechat_updata_list_show", self.wechat_updata_list_show) EventMesh.subscribe("get_wechat_data", self.get_wechat_data) @@ -186,6 +191,7 @@ class WechatScreen(Screen): def updata_list_show(self,index): + global wechat_screen_list_screen if self.press_state != 1: if self.wechat_num != 0: if index == 0: @@ -197,9 +203,9 @@ class WechatScreen(Screen): print("self.wechat_recode_list:{}".format(self.wechat_recode_list)) self.wechat_list.delete()#先删除一次控件 - self.wechat_list = lv.obj(wechat_screen) + self.wechat_list = lv.obj(wechat_screen_list_screen) self.wechat_list.set_pos(0, 0) - self.wechat_list.set_size(240, 250) + self.wechat_list.set_size(240, 261) 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 = lv.img(self.wechat_list) diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/code.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/code.py index 7ba9301f..3f9b53cf 100644 --- a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/code.py +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/code.py @@ -1,4 +1,5 @@ import lvgl as lv +import code128 # 界面风格1 # style_bar = lv.style_t() # style_bar.init() @@ -20,51 +21,10 @@ style_bar.set_pad_top(0) style_bar.set_pad_bottom(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 = 2 - - -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条形码""" +def code_128_generate_barcode(screen, data, width=180, height=80): + left_curr_line = 0 # 删除上次的container @@ -73,52 +33,35 @@ def code_39_generate_barcode(screen, data, width=180, height=80): old_container.delete() # 生成二进制码 - binary_data = code_39_generate_binary(data) + binary_data = code128.encode(data) if not binary_data: return - print("binary_data is ",binary_data) + # print("binary_data is ",binary_data) # 在LVGL中创建一个容器对象 container = lv.obj(screen) - container.set_size(240, 330) + container.set_size(width, height) + container.set_pos(0, 33) + container.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) container.add_style(style_bar,lv.PART.MAIN | lv.STATE.DEFAULT) - container.center() # 计算每个条的宽度 - bar_width = height // (len(binary_data)) - print("bar_width is :{} len(binary_data):{}".format(bar_width,len(binary_data))) + bar_width = width // (len(binary_data)) + # print("bar_width is :{} len(binary_data):{}".format(bar_width,len(binary_data))) # 按照二进制码中的1和0,分别创建LVGL矩形对象 for i in range(len(binary_data)): - print("left_curr_line is :{} width:{}".format(left_curr_line,width)) - 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(120, 2) - else: - real_width = bar_width * code_39_narrow - bar.set_size(120, 2 ) - bar.set_pos(60, 0+left_curr_line+20) - bar.set_style_bg_color(lv.color_make(0x00, 0x00, 0x00), lv.PART.MAIN | lv.STATE.DEFAULT) - left_curr_line += real_width + # print("left_curr_line is :{} width:{}".format(left_curr_line,width)) + bar = lv.obj(container) + bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT) + real_width = bar_width * 1 + bar.set_size(1,90) + left = (width - len(binary_data))//2#240-152 = 88 //2 ==44 + bar.set_pos(left+left_curr_line,0) + if binary_data[i] == 0xff: + bar.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff), lv.PART.MAIN | lv.STATE.DEFAULT) else: - # 创建一个白色矩形 - bar = 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(120, 2) - else: - real_width = bar_width * code_39_narrow - bar.set_size(120, 2) - bar.set_pos(60, 0+left_curr_line+20) - # 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(240,330 ) + bar.set_style_bg_color(lv.color_make(0x00, 0x00, 0x00), lv.PART.MAIN | lv.STATE.DEFAULT) + left_curr_line += real_width # if __name__ == "__main__": diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py index de7af292..0fbb7618 100644 --- a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py @@ -168,11 +168,12 @@ class CountdownManager(Abstract): EventMesh.subscribe("countdown_end_cb", self.countdown_end_cb) + EventMesh.subscribe("reset_time_countdown",self.reset) def set_countdown_all_time(self, event, msg): self.total = msg[0] self.total_sec = msg[1] - print("self.total:{} self.total_sec:{}".format(self.total,self.total_sec)) + # print("self.total:{} self.total_sec:{}".format(self.total,self.total_sec)) def get_countdown_all_time(self, event, msg): @@ -182,7 +183,7 @@ class CountdownManager(Abstract): self.time_cb = msg[0] self.time_play = msg[1] - print("self.time_cb:{} self.total_sec:{}".format(self.time_cb,self.time_play)) + # print("self.time_cb:{} self.total_sec:{}".format(self.time_cb,self.time_play)) def get_countdown_off_state(self, event, msg): @@ -751,7 +752,12 @@ class DeviceInfoManager(Abstract): time_tmp = utime.mktime(date_tmp) # print("date_tmp......01....{} time_tmp:{}\r\n".format(date_tmp,time_tmp)) EventMesh.publish("countdown_end_cb") - + gnss_state = quecgnss.get_state() + get_location_flag = EventMesh.publish("get_location_thread_flag") + if get_location_flag != None: + if gnss_state == 2 and get_location_flag == 0: + EventMesh.publish(constants.EVENT.GPSCLOSE) + if math.fabs(time_tmp - self.KA_time) > 7*60: #7分钟一次心跳 self.KA_time = time_tmp EventMesh.publish(constants.PROTOCOL.KA_SEND) diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/protocol.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/protocol.py index a59d0755..148e3d95 100644 --- a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/protocol.py +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/protocol.py @@ -474,23 +474,24 @@ class PHL_ProtoCol(ProtoCol): phonebook = {} msg_tmp = msg_tmp[1:] - # print("msg_tmp1:{}".format(msg_tmp)) + j = 0 i = 0 phonebook_oldtmp = {} # 0 1 2 3 for phonebook_tmp in msg_tmp: j+=1 - # print("phonebook_tmp:{}".format(phonebook_tmp)) + # print("phonebook_tmp:{} len:{}".format(phonebook_tmp,len(phonebook_tmp))) if (j%2) == 0: i+=1 - phonebook_name = UnicodeHexStr_To_Utf8Str(phonebook_tmp) - phonebook_name = "{}:{}".format("%03d"%i,phonebook_name) - phonebook[phonebook_name] = phonebook_oldtmp + if len(phonebook_tmp) != 0: + phonebook_name = UnicodeHexStr_To_Utf8Str(phonebook_tmp) + phonebook_name = "{}:{}".format("%03d"%i,phonebook_name) + phonebook[phonebook_name] = phonebook_oldtmp phonebook_oldtmp = phonebook_tmp - # print("phonebook_oldtmp!!!:{}".format(str(phonebook_oldtmp))) + # print("phonebook_oldtmp!!!:{}".format(str(phonebook_oldtmp))) # print("phonebook!!!:{}".format(str(phonebook))) with open("/ext/static/storage_file/phonebook.json","w",encoding="utf-8") as fd: ujson.dump(phonebook,fd) diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui.py index 44f64d79..5796ce4e 100644 --- a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui.py +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui.py @@ -616,7 +616,7 @@ call_log_screen = None contacts_cont_list = None call_log_title = None none_call_log_title = None - +call_log_cont_list_screen = None CALLLOG_FLAG = 0 class CallLogScreen(Screen): NAME = "call_log" @@ -634,32 +634,36 @@ class CallLogScreen(Screen): def post_processor_before_initialization(self): read_call_log = EventMesh.publish("get_call_log_list") - self.check_json = read_call_log[0] - self.read_call_log = read_call_log[1] + if read_call_log != None: + self.check_json = read_call_log[0] + self.read_call_log = read_call_log[1] def call_log_update_show_list(self, event, msg): 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]#通话记录数据 - self.timer.start(500,0,self.reciving) + if read_call_log != None: + # print("read_call_log:{}".format(read_call_log)) + self.check_json = read_call_log[0] #文件是否存在 + self.read_call_log = read_call_log[1]#通话记录数据 + self.timer.start(500,0,self.reciving) def reciving(self,e): self.btn_create() def initialization(self): - global call_log_screen,contacts_cont_list ,call_log_title ,none_call_log_title + global call_log_screen,contacts_cont_list ,call_log_title ,none_call_log_title ,call_log_cont_list_screen if call_log_screen == None: call_log_screen = lv.obj() + call_log_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) call_log_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - contacts_cont_list= lv.obj(call_log_screen) - contacts_cont_list.set_pos(0, 50) - contacts_cont_list.set_size(240, 270) - contacts_cont_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - contacts_cont_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + call_log_cont_list_screen = lv.obj(call_log_screen) + call_log_cont_list_screen.set_pos(0, 50) + call_log_cont_list_screen.set_size(240, 270) + call_log_cont_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + call_log_cont_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + call_log_title = lv.label(call_log_screen) call_log_title.set_pos(0, 10) @@ -669,7 +673,7 @@ class CallLogScreen(Screen): call_log_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) call_log_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - none_call_log_title = lv.label(contacts_cont_list) + none_call_log_title = lv.label(call_log_cont_list_screen) 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) @@ -682,8 +686,9 @@ class CallLogScreen(Screen): 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 read_call_log != None: + 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: @@ -691,15 +696,15 @@ class CallLogScreen(Screen): self.btn_create() def btn_create(self): - global call_log_screen,contacts_cont_list ,call_log_title ,none_call_log_title + global call_log_screen,contacts_cont_list ,call_log_title ,none_call_log_title ,call_log_cont_list_screen h = 0 if call_log_screen != None: if self.check_json == True and len(self.read_call_log) != 0: 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) - self.call_log_detail_list.set_size(240, 270) + self.call_log_detail_list = lv.obj(call_log_cont_list_screen) + self.call_log_detail_list.set_pos(0, 0) + self.call_log_detail_list.set_size(240, 271) self.call_log_detail_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.call_log_detail_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) sort_tmp = self.read_call_log.values() @@ -753,7 +758,8 @@ class CallLogScreen(Screen): _btn_label5.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) h = h + 1 else: - none_call_log_title.set_text("暂无记录") + if call_log_cont_list_screen != None: + none_call_log_title.set_text("暂无记录") self.call_log_detail_list.add_flag(lv.obj.FLAG.HIDDEN)#隐藏空文本 def calling(self,e): @@ -1103,6 +1109,7 @@ msg_cont_detail = None msg_list_t = None msg_list_t_done_img = None no_msg_text = None +msg_cont_list_screen = None class PopupScreen(Screen): NAME = "popup" @@ -1119,11 +1126,14 @@ class PopupScreen(Screen): self.msg_nums = sms.getMsgNums() #获取短信条数 def initialization(self): - global msg_list_screen,msg_top_title,msg_cont_detail,msg_list_t,msg_list_t_done_img,no_msg_text + global msg_list_screen,msg_top_title,msg_cont_detail,msg_list_t,msg_list_t_done_img,no_msg_text,msg_cont_list_screen if msg_list_screen == None : msg_list_screen = lv.obj() + msg_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) msg_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + + msg_top_title = lv.label(msg_list_screen) msg_top_title.set_pos(0, 10) msg_top_title.set_size(240, 40) @@ -1132,25 +1142,21 @@ class PopupScreen(Screen): msg_top_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) msg_top_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - msg_cont_detail = lv.obj(msg_list_screen) - msg_cont_detail.set_pos(0, 50) - msg_cont_detail.set_size(240, 270) - msg_cont_detail.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + msg_cont_list_screen = lv.obj(msg_list_screen) + msg_cont_list_screen.set_pos(0, 50) + msg_cont_list_screen.set_size(240, 270) + msg_cont_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + msg_cont_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - msg_list_t= lv.obj(msg_list_screen) - msg_list_t.set_pos(0, 50) - 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) - msg_list_t_done_img = lv.img(msg_list_t) + msg_list_t_done_img = lv.img(msg_cont_list_screen) msg_list_t_done_img.set_pos(53, 20) msg_list_t_done_img.set_size(134, 117) msg_list_t_done_img.set_src("E:/static/IMAGE_NOTICE_NONE.png") msg_list_t_done_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - no_msg_text = lv.label(msg_list_t) + no_msg_text = lv.label(msg_cont_list_screen) no_msg_text.set_pos(0, 210) no_msg_text.set_size(240, 40) no_msg_text.set_text("暂无信息") @@ -1171,7 +1177,7 @@ class PopupScreen(Screen): def btn_create(self,msg): - global msg_list_screen,msg_top_title,msg_cont_detail,msg_list_t,msg_list_t_done_img,no_msg_text + global msg_list_screen,msg_top_title,msg_cont_detail,msg_list_t,msg_list_t_done_img,no_msg_text,msg_cont_list_screen count = 0 j = 0 print("self.msg_nums:{}".format(self.msg_nums)) @@ -1179,10 +1185,9 @@ class PopupScreen(Screen): msg_list_t_done_img.add_flag(lv.obj.FLAG.HIDDEN) no_msg_text.add_flag(lv.obj.FLAG.HIDDEN) self.sms_detail_list.delete()#先删除一次控件 - - self.sms_detail_list = lv.obj(msg_list_screen) - self.sms_detail_list.set_pos(0, 50) - self.sms_detail_list.set_size(230, 270) + self.sms_detail_list = lv.obj(msg_cont_list_screen) + self.sms_detail_list.set_pos(0, 0) + self.sms_detail_list.set_size(230, 271) self.sms_detail_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.sms_detail_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) if self.msg_nums > MSG_MAX: @@ -1237,10 +1242,12 @@ class PopupScreen(Screen): bottom_btn = self.sms_detail_list.get_child(-1) bottom_btn.scroll_to_view(lv.ANIM.OFF) else: - msg_list_t_done_img.clear_flag(lv.obj.FLAG.HIDDEN) - no_msg_text.clear_flag(lv.obj.FLAG.HIDDEN) + if msg_cont_list_screen != None: + msg_list_t_done_img.clear_flag(lv.obj.FLAG.HIDDEN) + no_msg_text.clear_flag(lv.obj.FLAG.HIDDEN) + no_msg_text.set_text("暂无信息") self.sms_detail_list.add_flag(lv.obj.FLAG.HIDDEN) - no_msg_text.set_text("暂无信息") + def sms_cb(self,e): code = e.get_code() @@ -2129,11 +2136,13 @@ contacts_screen = None contacts_cont = None contacts_top_title = None contact_none_label = None +contacts_screen_list_screen = None class ContactsScreen(Screen): NAME = "contacts" def __init__(self): super().__init__() + # -------------------------------------------popup_menu screen---------------------------------------------------------- self.meta = None self.phonebook = {} self.count = 0 @@ -2144,25 +2153,27 @@ class ContactsScreen(Screen): self.timer = osTimer() self.contact_detail_list = None EventMesh.subscribe("contact_updata_list_show", self.btn_create_list) + def post_processor_before_initialization(self): data = EventMesh.publish("get_phonebook_list") - self.check_json = data[0] - self.phonebook = data[1] - self.count = 0 + if data != None: + self.check_json = data[0] + self.phonebook = data[1] + self.count = 0 def initialization(self): - global contacts_screen,contacts_cont,contacts_top_title,contact_none_label + global contacts_screen,contacts_cont,contacts_top_title,contact_none_label,contacts_screen_list_screen if contacts_screen == None: contacts_screen = lv.obj() + contacts_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) contacts_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - contacts_screen.set_scrollbar_mode(0) - contacts_cont= lv.obj(contacts_screen) - contacts_cont.set_pos(0, 50) - contacts_cont.set_size(240, 270) - contacts_cont.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - contacts_cont.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + contacts_screen_list_screen = lv.obj(contacts_screen) + contacts_screen_list_screen.set_pos(0, 50) + contacts_screen_list_screen.set_size(240, 270) + contacts_screen_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + contacts_screen_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) contacts_top_title = lv.label(contacts_screen) contacts_top_title.set_pos(0, 10) @@ -2171,19 +2182,20 @@ class ContactsScreen(Screen): contacts_top_title.set_long_mode(lv.label.LONG.WRAP) contacts_top_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) contacts_top_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + - - - contact_none_label = lv.label(contacts_cont) - contact_none_label.set_pos(0, 120) - contact_none_label.set_size(240, 60) + contact_none_label = lv.label(contacts_screen_list_screen) + contact_none_label.set_pos(0, 80) + contact_none_label.set_size(240, 40) contact_none_label.set_text("空") + contact_none_label.set_long_mode(lv.label.LONG.WRAP) contact_none_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) contact_none_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - self.meta = contacts_screen + self.contact_detail_list = lv.obj(contacts_screen) - #读取json文件中的字典放到self.phonebook中 - #创建btn + self.meta = contacts_screen + + self.count = 0 self.btn_create_list_show(0) @@ -2195,7 +2207,7 @@ class ContactsScreen(Screen): self.btn_create_list_show(1) def btn_create_list_show(self,state): - global contacts_screen,contacts_cont,contacts_top_title,contact_none_label + global contacts_screen,contacts_cont,contacts_top_title,contact_none_label,contacts_screen_list_screen #读取json文件中的键作为label文本; if self.check_json == True and len(self.phonebook) != 0: contact_none_label.add_flag(lv.obj.FLAG.HIDDEN)#隐藏空文本 @@ -2205,11 +2217,12 @@ class ContactsScreen(Screen): phonebook_keys = sorted(self.phonebook.keys()) self.contact_detail_list.delete()#先删除一次控件 - self.contact_detail_list = lv.obj(contacts_screen) - self.contact_detail_list.set_pos(0, 50) - self.contact_detail_list.set_size(240, 270) + self.contact_detail_list = lv.obj(contacts_screen_list_screen) + self.contact_detail_list.set_pos(0, 0) + self.contact_detail_list.set_size(240, 271) self.contact_detail_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.contact_detail_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + # print("self.phonebook sorted :{}".format(len(self.phonebook))) for i in range(len(self.phonebook)): #字典 key value if j > 50: j = 0 @@ -2251,11 +2264,12 @@ class ContactsScreen(Screen): bottom_btn = self.contact_detail_list.get_child(-1) bottom_btn.scroll_to_view(lv.ANIM.OFF) else: - contact_none_label.clear_flag(lv.obj.FLAG.HIDDEN) #显示空文本 - self.contact_detail_list.add_flag(lv.obj.FLAG.HIDDEN)#隐藏空文本 + if contacts_screen_list_screen != None: + contact_none_label.clear_flag(lv.obj.FLAG.HIDDEN) #显示空文本 + if self.contact_detail_list != None: + self.contact_detail_list.add_flag(lv.obj.FLAG.HIDDEN)#隐藏空文本 - def calling(self,e): code = e.get_code() if code == lv.EVENT.CLICKED: @@ -2279,7 +2293,6 @@ class ContactsScreen(Screen): def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) - # -------------------------------------------temperature screen---------------------------------------------------------- temperature_screen = None @@ -2816,7 +2829,6 @@ class CountdownScreen(Screen): # lv.EVENT.CLICKED, None) date_tmp = utime.localtime() self.time_tmp = utime.mktime(date_tmp) - self.timer_cb = 1 if self.g_state == 0: countdown_start_img.clear_flag(lv.obj.FLAG.HIDDEN) countdown_stop_img.add_flag(lv.obj.FLAG.HIDDEN) @@ -2836,8 +2848,11 @@ class CountdownScreen(Screen): self.hour = 0 self.min = 0 self.sec = 0 - self.timeSecond = self.time_tmp self.show_value() + if self.g_state == 1: + if self.timer_cb == 1: + EventMesh.publish("set_countdown_off_state", [0,self.g_state]) + self.timer.start(1000,1,self.fun) def sec_up(self,e): EventMesh.publish("add_countdown_sec") @@ -2942,7 +2957,7 @@ class CountdownScreen(Screen): date_tmp = utime.localtime() self.time_tmp = utime.mktime(date_tmp) total_sec = self.time_tmp - self.timeSecond - print("total_sec:{} self.time_tmp:{} self.timeSecond:{} self.total:{}".format(total_sec,self.time_tmp,self.timeSecond,self.total)) + # print("total_sec:{} self.time_tmp:{} self.timeSecond:{} self.total:{}".format(total_sec,self.time_tmp,self.timeSecond,self.total)) if self.total > 0: self.total = self.total - total_sec self.timeSecond = self.time_tmp @@ -3002,6 +3017,9 @@ class CountdownScreen(Screen): self.sec = 0 self.g_state = 0 self.g_end = 0 + self.total = 0 + EventMesh.publish("set_countdown_off_state", [0,self.g_state]) + EventMesh.publish("reset_time_countdown") countdown_start_img.clear_flag(lv.obj.FLAG.HIDDEN) countdown_stop_img.add_flag(lv.obj.FLAG.HIDDEN) countdown_reset_img.clear_flag(lv.obj.FLAG.HIDDEN) @@ -3013,6 +3031,7 @@ class CountdownScreen(Screen): countdown_sec_up.clear_flag(lv.obj.FLAG.HIDDEN) countdown_sec_down.clear_flag(lv.obj.FLAG.HIDDEN) self.show_value() + def show_value(self): global countdown_screen ,countdown_title,countdown_hour ,countdown_mao ,countdown_mao ,countdown_mao1 ,\ diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui_health.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui_health.py new file mode 100644 index 00000000..d355d12b --- /dev/null +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui_health.py @@ -0,0 +1,161 @@ + +import lvgl as lv +import ql_fs +import EventMesh +from misc import Power +from ui import style_screen,style_font_youyuan_20,style_btn,style_img,Screen,style_contact_btn +import constants +import osTimer +import audio +from machine import Pin +import ujson +from lcd import style_font_youyuan_40 +# -------------------------------------------setting screen---------------------------------------------------------- + +style_bar = lv.style_t() +style_bar.init() +style_bar.set_radius(10) +style_bar.set_bg_color(lv.color_make(0xA0, 0xA0, 0xA0)) +style_bar.set_bg_grad_color(lv.color_make(0xA0, 0xA0, 0xA0)) +style_bar.set_bg_grad_dir(lv.GRAD_DIR.VER) +style_bar.set_bg_opa(60) +style_bar.set_pad_left(0) +style_bar.set_pad_right(0) +style_bar.set_pad_top(0) +style_bar.set_pad_bottom(0) + +style_volume_btn = lv.style_t() +style_volume_btn.init() +style_volume_btn.set_shadow_opa(0) +style_volume_btn.set_border_width(0) +style_volume_btn.set_bg_color(lv.color_make(0x80, 0x80, 0x80)) + +style_bar_indic = lv.style_t() +style_bar_indic.init() +style_bar_indic.set_radius(10) +style_bar_indic.set_bg_color(lv.color_make(0xff, 0x61, 0x3a)) +style_bar_indic.set_bg_grad_color(lv.color_make(0xff, 0x61, 0x3a)) +style_bar_indic.set_bg_grad_dir(lv.GRAD_DIR.VER) +style_bar_indic.set_bg_opa(255) + +health_cont_y = 0 +health_screen = lv.obj() +health_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +health_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + +health_title_img = lv.img(health_screen) +health_title_img.set_pos(58, 10) +health_title_img.set_size(124, 30) +health_title_img.set_src("E:/static/health/health_text.png") +health_title_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + + + +setting_cont_style = lv.style_t() +setting_cont_style.init() +setting_cont_style.set_radius(0) +setting_cont_style.set_bg_color(lv.color_make(0x00, 0x00, 0x00)) +setting_cont_style.set_bg_grad_color(lv.color_make(0x00, 0x00, 0x00)) +setting_cont_style.set_bg_grad_dir(lv.GRAD_DIR.VER) +setting_cont_style.set_bg_opa(255) +setting_cont_style.set_border_width(0) +setting_cont_style.set_pad_left(0) +setting_cont_style.set_pad_right(0) +setting_cont_style.set_pad_top(0) +setting_cont_style.set_pad_bottom(0) + +health_list_screen = lv.obj(health_screen) +health_list_screen.set_pos(0, 50) +health_list_screen.set_size(240, 270) +health_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +health_list_screen.add_style(setting_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT) + +setting_cont = lv.obj(health_list_screen) +setting_cont.set_pos(0, 0) +setting_cont.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +setting_cont.set_size(240, 271) +setting_cont.add_style(setting_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT) + + +health_hr = lv.btn(setting_cont) +health_hr.set_pos(0, health_cont_y) +health_hr.set_size(0, 0) +health_hr_label = lv.label(health_hr) +health_hr_label.set_text("心率") +health_hr.set_style_pad_all(0, lv.STATE.DEFAULT) +health_hr_label.align(lv.ALIGN.LEFT_MID, 70, 0) +health_hr_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) +health_hr_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +health_hr.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) +health_hr_img = lv.img(setting_cont) +health_hr_img.set_pos(0, health_cont_y) +health_hr_img.set_size(232, 80) +health_hr_img.add_flag(lv.obj.FLAG.CLICKABLE) +health_hr_img.set_src("E:/static/health/health_hr.png") +health_hr_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) +health_cont_y+=90 + + + +health_spo2 = lv.btn(setting_cont) +health_spo2.set_pos(0, health_cont_y) +health_spo2.set_size(0, 0) +health_spo2_label = lv.label(health_spo2) +health_spo2_label.set_text("血氧") +health_spo2.set_style_pad_all(0, lv.STATE.DEFAULT) +health_spo2_label.align(lv.ALIGN.LEFT_MID, 70, 0) +health_spo2_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) +health_spo2_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +health_spo2.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) +health_spo2_img = lv.img(setting_cont) +health_spo2_img.set_pos(0, health_cont_y) +health_spo2_img.set_size(232, 80) +health_spo2_img.add_flag(lv.obj.FLAG.CLICKABLE) +health_spo2_img.set_src("E:/static/health/health_spo2.png") +health_spo2_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) +health_cont_y+=90 + +health_temp = lv.btn(setting_cont) +health_temp.set_pos(0, health_cont_y) +health_temp.set_size(0, 0) +health_temp_label = lv.label(health_temp) +health_temp_label.set_text("体温") +health_temp.set_style_pad_all(0, lv.STATE.DEFAULT) +health_temp_label.align(lv.ALIGN.LEFT_MID, 70, 0) +health_temp_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) +health_temp_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +health_temp.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) +health_temp_img = lv.img(setting_cont) +health_temp_img.set_pos(0, health_cont_y) +health_temp_img.set_size(232, 80) +health_temp_img.add_flag(lv.obj.FLAG.CLICKABLE) +health_temp_img.set_src("E:/static/health/health_temp.png") +health_temp_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) +health_cont_y+=90 + + + + +class HealthScreen(Screen):#健康测量 + NAME = "health" + + def __init__(self): + super().__init__() + self.meta = health_screen + # setting_language.add_event_cb(lambda e: self.load_screen(e, {"screen": "language"}), lv.EVENT.CLICKED, None) + health_hr_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "heartrate"})), lv.EVENT.CLICKED, None) + # setting_themeswitch.add_event_cb(lambda e: self.load_screen(e, {"screen": "themeswitch"}), lv.EVENT.CLICKED, None) + health_spo2_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "spo2"})), lv.EVENT.CLICKED, None) + health_temp_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "temperature"})), lv.EVENT.CLICKED, None) + + def done_return(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + + def btn1_release(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + + def btn8_press(self): + EventMesh.publish("watch_top_show") + EventMesh.publish("load_screen", {"screen": "main_menu"}) +################################################################## +# -------------------------------------------language screen---------------------------------------------------------- diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui_setting.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui_setting.py index a5788afc..e3f3e8cc 100644 --- a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui_setting.py +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui_setting.py @@ -67,6 +67,7 @@ setting_cont_style.set_pad_right(0) setting_cont_style.set_pad_top(0) setting_cont_style.set_pad_bottom(0) + setting_cont = lv.obj(setting_screen) setting_cont.set_pos(0, 50) setting_cont.set_size(240, 270) diff --git a/2.sdk/project/K5/usr/main.py b/2.sdk/project/K5/usr/main.py index 1c685290..a69ce086 100644 --- a/2.sdk/project/K5/usr/main.py +++ b/2.sdk/project/K5/usr/main.py @@ -137,8 +137,8 @@ if __name__ == '__main__': import mgr as mgr print("init7:{}".format(utime.localtime())) - from mgr import ConfigStoreManager,getBootOffManager,getSosFlagManager, LocationManager, SockManager,getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\ - NetManager,AddrBookManager,MsgdetailManager,CountdownManager,PhoneCallingManager,getOldTimeManager,getStorageDataManager,getBrightnessManager,getHrTimeManager,getTempTimeManager,getLowBatManager + from mgr import ConfigStoreManager,getBootOffManager,getSosFlagManager,CountdownManager, LocationManager, SockManager,getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\ + NetManager,AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldTimeManager,getStorageDataManager,getBrightnessManager,getHrTimeManager,getTempTimeManager,getLowBatManager print("init8:{}".format(utime.localtime())) @@ -188,6 +188,7 @@ if __name__ == '__main__': app.append_manager(getOldTimeManager()) app.append_manager(getSosFlagManager()) app.append_manager(CountdownManager()) + print("init21:{}".format(utime.localtime())) print("init11:{}".format(utime.localtime()))