From: dxy15521469561 <1731678236@qq.com> Date: Fri, 7 Jul 2023 03:03:50 +0000 (+0800) Subject: 1.优化sos界面 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=f9f68e550eac9505bc4687cf1d62468adacb9720;p=mirrors%2FASR1603_G5.git 1.优化sos界面 2.优化电话界面 --- diff --git a/2.sdk/project/K5/ext/static/REDUCE_VOLUM_ICON.png b/2.sdk/project/K5/ext/static/REDUCE_VOLUM_ICON.png new file mode 100644 index 00000000..10a69cab Binary files /dev/null and b/2.sdk/project/K5/ext/static/REDUCE_VOLUM_ICON.png differ diff --git a/2.sdk/project/K5/ext/static/RED_RETURN_PNG.png b/2.sdk/project/K5/ext/static/RED_RETURN_PNG.png new file mode 100644 index 00000000..8589c8d9 Binary files /dev/null and b/2.sdk/project/K5/ext/static/RED_RETURN_PNG.png differ diff --git a/2.sdk/project/K5/ext/static/VOLUM_ADD_ICON.png b/2.sdk/project/K5/ext/static/VOLUM_ADD_ICON.png new file mode 100644 index 00000000..75b8c932 Binary files /dev/null and b/2.sdk/project/K5/ext/static/VOLUM_ADD_ICON.png differ diff --git a/2.sdk/project/K5/ext/static/temp_current.png b/2.sdk/project/K5/ext/static/temp_current.png index a179774a..25861c50 100644 Binary files a/2.sdk/project/K5/ext/static/temp_current.png and b/2.sdk/project/K5/ext/static/temp_current.png differ diff --git a/2.sdk/project/K5/ext/static/temp_hand.png b/2.sdk/project/K5/ext/static/temp_hand.png index 4fe7f927..4fef5be7 100644 Binary files a/2.sdk/project/K5/ext/static/temp_hand.png and b/2.sdk/project/K5/ext/static/temp_hand.png differ diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py index 8c4059ee..44cbe135 100644 --- a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py @@ -13,8 +13,9 @@ class BtnDevice(Abstract): self.__pwk_timer = osTimer() self.keypad = machine.KeyPad(4, 1) - self.__PowerDownTimeOut = 8000 + self.__PowerDownTimeOut = 4000 self.__tp = tp + self.long_press = 0 def post_processor_after_instantiation(self): self.keypad.init() @@ -57,6 +58,7 @@ class BtnDevice(Abstract): pass if (l_list[1] == 3) and (l_list[2] == 0): if l_list[0] == 1: + self.long_press = 0 EventMesh.publish("btn1_press") else: pass @@ -66,17 +68,20 @@ class BtnDevice(Abstract): def pwk_callback(self, status): - print('==pwr:', status) - if status == 1: - + print('==pwr:', status)# 0 1 0 + if status == 1:#按下 self.__pwk_timer.start(self.__PowerDownTimeOut, 0, self.__pwk_long_press_cb) - elif status == 0: + elif status == 0:#松开 self.__pwk_timer.stop() # print("btn_back:{}".format(mdls.screen_size_style[mdls.models][1])) + if self.long_press != 0: + self.long_press = 0 + return EventMesh.publish("btn8_press") def __pwk_long_press_cb(self, *args): '''KEY2:联动屏幕右下角或返回键长按关机''' + self.long_press = 1 EventMesh.publish("btn8_long_press") def start(self): 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 81f980c2..f81ba932 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 @@ -507,16 +507,16 @@ def voice_callback(args): EventMesh.publish("set_interrup_incall",0) EventMesh.publish("set_UI_high_priority",0) - print('voicecall disconnect') + EventMesh.publish("load_screen", {"screen": "main_menu"}) hangup_mode = EventMesh.publish("get_hangup_mode") if hangup_mode == 1: EventMesh.publish("set_sos_flag",0) EventMesh.publish("set_sos_num",0) EventMesh.publish("set_hangup_mode",0) - + print('hangup_mode disconnect',hangup_mode) sos_flag = EventMesh.publish("get_sos_flag") - + print('voicecall sos_flag',sos_flag) if sos_flag == 0 : EventMesh.publish("set_sos_num",0) else: @@ -2311,9 +2311,9 @@ class getSosFlagManager(Abstract):#设置sos if number != None: if len(number) > 0: - EventMesh.publish("save_phonename",number[0]) EventMesh.publish("save_phonenum",number[0]) + EventMesh.publish("set_sos_num",0) voiceCall.callStart(str(number[0])) def set_callnumer_cb(self, event, msg): 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 2ca3d7f6..b50425a5 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 @@ -21,6 +21,7 @@ import gc import _thread from queue import Queue + def audio_cb(event): if event == 0: EventMesh.publish("set_audio_state", 1) @@ -43,6 +44,26 @@ style_screen.set_pad_right(0) style_screen.set_pad_top(0) style_screen.set_pad_bottom(0) +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_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) # 默认白色 style_font_youyuan_20 = lv.style_t() @@ -61,6 +82,11 @@ style_font_youyuan_20_black.set_text_color(lv.color_make(0x00, 0x00, 0x00)) style_font_youyuan_20_black.set_text_font_v2("font_24.bin",24,0) +style_font_youyuan_20_red = lv.style_t() +style_font_youyuan_20_red.init() +style_font_youyuan_20_red.set_text_color(lv.color_make(0xff, 0x00, 0x00)) +style_font_youyuan_20_red.set_text_font_v2("font_24.bin",24,0) + style_img = lv.style_t() style_img.init() style_img.set_img_opa(255) @@ -1917,9 +1943,32 @@ class IncomingCallScreen(Screen): on_call_screen = None +on_call_obj =None on_call_label_name = None on_call_second_label = None +on_call_volum_label = None +on_call_tab_label = None on_call_hangup = None +on_call_bar = None +on_call_volum_reduce = None +on_call_volum_add = None +on_call_phone_one = None +on_call_phone_two = None +on_call_phone_three = None +on_call_phone_four = None +on_call_phone_five = None +on_call_phone_six = None +on_call_phone_seven = None +on_call_phone_eight = None +on_call_phone_nine = None +on_call_phone_start = None +on_call_phone_zero = None +on_call_screen_tab = None +on_call_phone_hash = None +on_call_phone_return =None +on_call_screen_tab_label =None +on_call_phone_return_btn = None +ON_CALL_MAX_DATA = 9 class OnCallScreen(Screen): NAME = "on_call" @@ -1928,47 +1977,473 @@ class OnCallScreen(Screen): self.meta = None self.count_sec = 0 self.timer = osTimer() + self.aud = audio.Audio(0) + self.aud.set_pa(Pin.GPIO29) + self.read_data = {} + self.volum_size = 8 + self.open_volum = 0 + self.phone_num = '' + self.phone_list = [] + self.button = 0 + def initialization(self): EventMesh.publish("set_UI_high_priority", 1) - global on_call_screen,on_call_label_name,on_call_second_label ,on_call_hangup + global on_call_screen,on_call_label_name,on_call_second_label ,on_call_hangup ,on_call_volum_label,on_call_tab_label,on_call_bar,on_call_obj,\ + on_call_volum_reduce,on_call_volum_add,on_call_phone_one ,on_call_phone_two ,on_call_phone_three,on_call_phone_four,on_call_phone_five,\ + on_call_phone_six,on_call_phone_seven,on_call_screen_tab_label ,on_call_phone_return,on_call_phone_eight ,on_call_phone_nine ,on_call_phone_start ,\ + on_call_phone_zero ,on_call_phone_hash,on_call_phone_return_btn,\ + on_call_screen_tab if on_call_screen ==None : on_call_screen = lv.obj() - print("on_call_screen") on_call_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_label_name = lv.label(on_call_screen) - on_call_label_name.set_pos(0, 100) + on_call_obj = lv.obj(on_call_screen) + on_call_obj.set_size(240,320) + on_call_obj.set_pos(0,0) + on_call_obj.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + print("on_call_screen") + + on_call_label_name = lv.label(on_call_obj) + on_call_label_name.set_pos(0, 80) 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_second_label = lv.label(on_call_screen) - on_call_second_label.set_pos(0, 160) - on_call_second_label.set_size(240, 50) + on_call_second_label = lv.label(on_call_obj) + on_call_second_label.set_pos(0, 140) + on_call_second_label.set_size(240, 30) on_call_second_label.set_text("00:00") on_call_second_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) on_call_second_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_bar = lv.bar(on_call_obj) + on_call_bar.set_pos(49, 183) + on_call_bar.set_size(140, 25) + on_call_bar.set_style_anim_time(1000, lv.PART.INDICATOR | lv.STATE.DEFAULT) + on_call_bar.set_mode(lv.bar.MODE.NORMAL) + on_call_bar.set_value(50, lv.ANIM.OFF) + on_call_bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_bar.add_style(style_bar_indic, lv.PART.INDICATOR | lv.STATE.DEFAULT) + + on_call_volum_reduce = lv.img(on_call_obj) + on_call_volum_reduce.set_size(36, 36) + on_call_volum_reduce.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_volum_reduce.set_pos(4, 178) + on_call_volum_reduce.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_volum_reduce.set_src("E:/static/REDUCE_VOLUM_ICON.png") + on_call_volum_reduce.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_volum_size(e)), + lv.EVENT.CLICKED, None) + + on_call_volum_add = lv.img(on_call_obj) + on_call_volum_add.set_size(36, 36) + on_call_volum_add.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_volum_add.set_pos(194, 178) + on_call_volum_add.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_volum_add.set_src("E:/static/VOLUM_ADD_ICON.png") + on_call_volum_add.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_volum_size(e)), + lv.EVENT.CLICKED, None) - on_call_hangup = lv.img(on_call_screen) + + on_call_volum_label = lv.label(on_call_obj) + on_call_volum_label.set_pos(0, 270) + on_call_volum_label.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_volum_label.set_size(85, 50) + on_call_volum_label.set_text("静音") + on_call_volum_label.set_style_text_align(lv.TEXT_ALIGN.CENTER,0) + on_call_volum_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_volum_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.open_volum_show(e)), + lv.EVENT.CLICKED, None) + + on_call_hangup = lv.img(on_call_obj) 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.set_pos(85, 245) on_call_hangup.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) on_call_hangup.set_src("E:/static/hang_up.png") on_call_hangup.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)), lv.EVENT.CLICKED, None) + + on_call_tab_label = lv.label(on_call_obj) + on_call_tab_label.set_pos(150, 270) + on_call_tab_label.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_tab_label.set_size(90, 50) + on_call_tab_label.set_text("键盘") + on_call_tab_label.set_style_text_align(lv.TEXT_ALIGN.CENTER,0) + on_call_tab_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_tab_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.on_call_tab_show(e)), + lv.EVENT.CLICKED, None) + + on_call_screen_tab = lv.obj(on_call_screen) + on_call_screen_tab.set_size(240,320) + on_call_screen_tab.set_pos(0,0) + on_call_screen_tab.add_flag(lv.obj.FLAG.HIDDEN) + on_call_screen_tab.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + + on_call_screen_tab_label = lv.label(on_call_screen_tab) + on_call_screen_tab_label.set_pos(40, 34) + on_call_screen_tab_label.set_size(0, 30) + on_call_screen_tab_label.set_text(" ") + on_call_screen_tab_label.set_long_mode(lv.label.LONG.CLIP) + on_call_screen_tab_label.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_screen_tab_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + + on_call_phone_return = lv.img(on_call_screen_tab) + on_call_phone_return.set_src("E:/static/RED_RETURN_PNG.png") + on_call_phone_return.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_return.set_pos(0, 30) + on_call_phone_return.set_size(36, 36) + + on_call_phone_return_btn = lv.img(on_call_screen_tab) + on_call_phone_return_btn.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_return_btn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_return_btn.set_pos(0, 0) + on_call_phone_return_btn.set_size(50, 100) + on_call_phone_return_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.on_return_show(e)), + lv.EVENT.CLICKED, None) + + + on_call_phone_one = lv.img(on_call_screen_tab) + on_call_phone_one.set_src("E:/static/IMAGE_NUMBER_KEY1_ICON.png") + on_call_phone_one.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_one.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_one.set_pos(3, 110) + on_call_phone_one.set_size(76, 50) + + on_call_phone_two = lv.img(on_call_screen_tab) + on_call_phone_two.set_size(76, 50) + on_call_phone_two.set_src("E:/static/IMAGE_NUMBER_KEY2_ICON.png") + on_call_phone_two.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_two.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_two.set_pos(82, 110) + + on_call_phone_three = lv.img(on_call_screen_tab) + on_call_phone_three.set_size(76, 50) + on_call_phone_three.set_src("E:/static/IMAGE_NUMBER_KEY3_ICON.png") + on_call_phone_three.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_three.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_three.set_pos(161, 110)#1 + + on_call_phone_four = lv.img(on_call_screen_tab) + on_call_phone_four.set_size(76, 50) + on_call_phone_four.set_src("E:/static/IMAGE_NUMBER_KEY4_ICON.png") + on_call_phone_four.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_four.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_four.set_pos(3, 162) + + on_call_phone_five = lv.img(on_call_screen_tab) + on_call_phone_five.set_size(76, 50) + on_call_phone_five.set_src("E:/static/IMAGE_NUMBER_KEY5_ICON.png") + on_call_phone_five.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_five.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_five.set_pos(82, 162) + + on_call_phone_six = lv.img(on_call_screen_tab) + on_call_phone_six.set_size(76, 50) + on_call_phone_six.set_src("E:/static/IMAGE_NUMBER_KEY6_ICON.png") + on_call_phone_six.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_six.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_six.set_pos(161, 162)#2 + + on_call_phone_seven = lv.img(on_call_screen_tab) + on_call_phone_seven.set_size(76, 50) + on_call_phone_seven.set_src("E:/static/IMAGE_NUMBER_KEY7_ICON.png") + on_call_phone_seven.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_seven.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_seven.set_pos(3, 214) + + on_call_phone_eight = lv.img(on_call_screen_tab) + on_call_phone_eight.set_size(76, 50) + on_call_phone_eight.set_src("E:/static/IMAGE_NUMBER_KEY8_ICON.png") + on_call_phone_eight.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_eight.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_eight.set_pos(82, 214) + + on_call_phone_nine = lv.img(on_call_screen_tab) + on_call_phone_nine.set_size(76, 50) + on_call_phone_nine.set_src("E:/static/IMAGE_NUMBER_KEY9_ICON.png") + on_call_phone_nine.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_nine.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_nine.set_pos(161, 214) + + on_call_phone_start = lv.img(on_call_screen_tab) + on_call_phone_start.set_size(76, 50) + on_call_phone_start.set_src("E:/static/IMAGE_NUMBER_KEYSTAR_ICON.png") + on_call_phone_start.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_start.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_start.set_pos(3, 266) + + on_call_phone_zero = lv.img(on_call_screen_tab) + on_call_phone_zero.set_size(76, 50) + on_call_phone_zero.set_src("E:/static/IMAGE_NUMBER_KEY0_ICON.png") + on_call_phone_zero.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_zero.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_zero.set_pos(82, 266) + + on_call_phone_hash = lv.img(on_call_screen_tab) + on_call_phone_hash.set_size(76, 50) + on_call_phone_hash.set_src("E:/static/IMAGE_NUMBER_KEYHASH_ICON.png") + on_call_phone_hash.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_hash.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_hash.set_pos(161, 266) + self.meta = on_call_screen + + on_call_phone_one.add_event_cb(lambda e: EventMesh.callback_wrapper(self.one(e)), + lv.EVENT.CLICKED, None) + on_call_phone_two.add_event_cb(lambda e: EventMesh.callback_wrapper(self.two(e)), + lv.EVENT.CLICKED, None) + on_call_phone_three.add_event_cb(lambda e: EventMesh.callback_wrapper(self.three(e)), + lv.EVENT.CLICKED, None) + on_call_phone_four.add_event_cb(lambda e: EventMesh.callback_wrapper(self.four(e)), + lv.EVENT.CLICKED, None) + on_call_phone_five.add_event_cb(lambda e: EventMesh.callback_wrapper(self.five(e)), + lv.EVENT.CLICKED, None) + on_call_phone_six.add_event_cb(lambda e: EventMesh.callback_wrapper(self.six(e)), + lv.EVENT.CLICKED, None) + on_call_phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.seven(e)), + lv.EVENT.CLICKED, None) + on_call_phone_eight.add_event_cb(lambda e: EventMesh.callback_wrapper(self.eight(e)), + lv.EVENT.CLICKED, None) + on_call_phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.nine(e)), + lv.EVENT.CLICKED, None) + on_call_phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero(e)), + lv.EVENT.CLICKED, None) + + on_call_phone_start.add_event_cb(lambda e: EventMesh.callback_wrapper(self.start(e)), + lv.EVENT.CLICKED, None)#短按显示* + + on_call_phone_start.add_event_cb(lambda e: EventMesh.callback_wrapper(self.pressed_start(e)), + lv.EVENT.LONG_PRESSED, None)#长按显示+ + + on_call_phone_start.add_event_cb(lambda e: EventMesh.callback_wrapper(self.endpressed_start(e)), + lv.EVENT.RELEASED, None)#释放按键 + + on_call_phone_hash.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hash(e)), + lv.EVENT.CLICKED, None) name = EventMesh.publish("get_phonename") on_call_label_name.set_text(name) # on_call_label.set_text(str(self.meta_info)) on_call_second_label.set_text("00:00") + self.phone_num = '' + self.phone_list = [] + self.button = 0 + + + def show_num(self): + global on_call_screen_tab_label + print("phone self.phone_num ",self.phone_num,self.phone_list) + on_call_screen_tab_label.set_size(200, 30) + on_call_screen_tab_label.set_text(self.phone_num) + def one(self,e): + if len(self.phone_list) >= ON_CALL_MAX_DATA: + self.phone_list.pop(0) + #return + + voiceCall.startDtmf("1",100) + self.phone_list.append("1") + self.phone_num = ''.join(self.phone_list) + self.show_num() + + def two(self,e): + if len(self.phone_list) >= ON_CALL_MAX_DATA: + self.phone_list.pop(0) + #return + voiceCall.startDtmf("2",100) + self.phone_list.append("2") + self.phone_num = ''.join(self.phone_list) + self.show_num() + + def three(self,e): + if len(self.phone_list) >= ON_CALL_MAX_DATA: + self.phone_list.pop(0) + voiceCall.startDtmf("3",100) + self.phone_list.append("3") + self.phone_num = ''.join(self.phone_list) + self.show_num() + + def four(self,e): + if len(self.phone_list) >= ON_CALL_MAX_DATA: + self.phone_list.pop(0) + voiceCall.startDtmf("4",100) + self.phone_list.append("4") + self.phone_num = ''.join(self.phone_list) + self.show_num() + + def five(self,e): + if len(self.phone_list) >= ON_CALL_MAX_DATA: + self.phone_list.pop(0) + #return + voiceCall.startDtmf("5",100) + self.phone_list.append("5") + self.phone_num = ''.join(self.phone_list) + self.show_num() + + def six(self,e): + if len(self.phone_list) >= ON_CALL_MAX_DATA: + self.phone_list.pop(0) + #return + voiceCall.startDtmf("6",100) + self.phone_list.append("6") + self.phone_num = ''.join(self.phone_list) + self.show_num() + + def seven(self,e): + if len(self.phone_list) >= ON_CALL_MAX_DATA: + self.phone_list.pop(0) + #return + voiceCall.startDtmf("7",100) + self.phone_list.append("7") + self.phone_num = ''.join(self.phone_list) + self.show_num() + + def eight(self,e): + if len(self.phone_list) >= ON_CALL_MAX_DATA: + self.phone_list.pop(0) + #return + voiceCall.startDtmf("8",100) + self.phone_list.append("8") + self.phone_num = ''.join(self.phone_list) + self.show_num() + + def nine(self,e): + if len(self.phone_list) >= ON_CALL_MAX_DATA: + self.phone_list.pop(0) + #return + voiceCall.startDtmf("9",100) + self.phone_list.append("9") + self.phone_num = ''.join(self.phone_list) + self.show_num() + + def zero(self,e): + if len(self.phone_list) >= ON_CALL_MAX_DATA:#限制拨号数量20个数字 + self.phone_list.pop(0) + #return + voiceCall.startDtmf("0",100) + self.phone_list.append("0") + self.phone_num = ''.join(self.phone_list) + self.show_num() + + def start(self,e): + self.button = 0 + + def pressed_start(self,e): + self.button = 1 + def Close(self): + self.timer_cb = 0 + self.timer.stop() + + def endpressed_start(self,e): + if len(self.phone_list) >= ON_CALL_MAX_DATA:#限制拨号数量20个数字 + self.phone_list.pop(0) + #return + + # if self.button == 1:#长按 + # voiceCall.startDtmf("+",100) + # self.phone_list.append("+") + # else:#短按 + voiceCall.startDtmf("*",100) + self.phone_list.append("*") + + self.phone_num = ''.join(self.phone_list) + self.show_num() + + def hash(self,e): + if len(self.phone_list) >= ON_CALL_MAX_DATA:#限制拨号数量20个数字 + self.phone_list.pop(0) + #return + voiceCall.startDtmf("#",100) + self.phone_list.append("#") + self.phone_num = ''.join(self.phone_list) + self.show_num() + + def add_show_hidden(self): + on_call_volum_add.add_flag(lv.obj.FLAG.HIDDEN) + on_call_volum_reduce.add_flag(lv.obj.FLAG.HIDDEN) + on_call_bar.add_flag(lv.obj.FLAG.HIDDEN) + + def clear_show_hidden(self): + on_call_volum_add.clear_flag(lv.obj.FLAG.HIDDEN) + on_call_volum_reduce.clear_flag(lv.obj.FLAG.HIDDEN) + on_call_bar.clear_flag(lv.obj.FLAG.HIDDEN) + + def open_volum_show(self, e): + global on_call_screen_tab,on_call_screen,on_call_obj + # self.aud.setVolume(0) + # if self.open_volum_state == 1: + # self.open_volum_state = 0 + # else: + # self.open_volum_state = 1 + # if self.open_volum_state == 1: + # self.add_show_hidden() + # else: + # self.clear_show_hidden() + + + def on_call_tab_show(self, e): + global on_call_screen_tab,on_call_screen,on_call_obj + if on_call_screen_tab != None: + self.phone_num = '' + self.phone_list = [] + self.show_num() + on_call_screen_tab.clear_flag(lv.obj.FLAG.HIDDEN) + on_call_obj.add_flag(lv.obj.FLAG.HIDDEN) + + + def on_return_show(self, e): + global on_call_screen_tab,on_call_screen,on_call_obj + if on_call_screen_tab != None: + on_call_screen_tab.add_flag(lv.obj.FLAG.HIDDEN) + on_call_obj.clear_flag(lv.obj.FLAG.HIDDEN) + + def add_volum_size(self, e): + self.volum_size+=2 + if self.volum_size >= 11: + self.volum_size = 11 + self.show_bar(1) + + def reduce_volum_size(self, e): + + self.volum_size -= 2 + if self.volum_size < 0: + self.volum_size = 0 + self.show_bar(1) + + def show_bar(self,msg): + on_call_bar.set_value((100 // 11) * self.volum_size, lv.ANIM.OFF) + if msg == 1: + self.read_data = EventMesh.publish("get_storage_data") + self.read_data["volum"] = self.volum_size + self.aud.setVolume(self.volum_size) + EventMesh.publish("set_storage_data", self.read_data) + EventMesh.publish("set_volum_size",self.volum_size) + # print("self.read_data:size :{}".format(self.read_data)) + with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd: + ujson.dump(self.read_data,fd) def post_processor_after_initialization(self): + global on_call_screen_tab,on_call_obj self.count_sec = 0 self.timer.start(1000,1,self.refresh) - + self.read_data = EventMesh.publish("get_storage_data") + # print("self.read_data:{}".format(self.read_data)) + num = EventMesh.publish("get_volum_size") + if num == None: + self.volum_size = 8 + else: + self.volum_size = num + self.aud.setVolume(self.volum_size) + self.show_bar(0) + self.open_volum = 0 + self.phone_num = '' + self.phone_list = [] + self.button = 0 + if on_call_obj != None: + on_call_obj.clear_flag(lv.obj.FLAG.HIDDEN) + if on_call_screen_tab != None: + on_call_screen_tab.add_flag(lv.obj.FLAG.HIDDEN) + self.show_num() + def refresh(self,e): # print("call_in") @@ -2455,8 +2930,8 @@ class TemperatureScreen(Screen): temperature_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) temperature_bg_img = lv.img(temperature_screen) - temperature_bg_img.set_pos(0, 5) - temperature_bg_img.set_size(71, 85) + temperature_bg_img.set_pos(30, 50) + temperature_bg_img.set_size(31, 32) temperature_bg_img.set_src("E:/static/temp_hand.png") temperature_bg_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -3743,6 +4218,175 @@ class LowPowerScreen(Screen): def btn8_press(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) +sos_screen = None +sos_screen_label = None +sos_screen_label_p = None + +#sos求组提示界面 +class sosScreen(Screen): + NAME = "SOS_POPUP" + def __init__(self): + super().__init__() + self.meta = None + self.timer1 = osTimer() + self.timer2 = osTimer() + self.meta_type = "popup" + self.count = 0 + + def initialization(self): + global sos_screen ,sos_screen_label + if sos_screen == None : + sos_screen = lv.obj() + print("SOS_POPUP") + sos_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + # add style for watchface + sos_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) + #进入图片 + + sos_screen_label = lv.label(sos_screen) + sos_screen_label.set_pos(0, 20) + sos_screen_label.set_size(240, 30) + sos_screen_label.set_text("SOS") + sos_screen_label.add_style(style_font_youyuan_20_red, lv.PART.MAIN | lv.STATE.DEFAULT) + sos_screen_label.set_long_mode(lv.label.LONG.WRAP) + sos_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + + sos_screen_label_p = lv.label(sos_screen) + sos_screen_label_p.set_pos(int(0),int(100)) + sos_screen_label_p.set_size(240,50) + sos_screen_label_p.set_text("正在紧急呼叫中,请稍等...") + sos_screen_label_p.set_long_mode(lv.label.LONG.WRAP) + sos_screen_label_p.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + sos_screen_label_p.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + + self.meta = sos_screen + def post_processor_before_initialization(self): + self.count = 0 + self.timer1.start(5000,0,self.timer_cb) + self.timer2.start(1000,1,self.timer_cb_onescond) + + def timer_cb(self,e): + EventMesh.publish("set_sos_flag", 1) + + def timer_cb_onescond(self,e): + EventMesh.publish("system_sleep_rest")#防止黑屏 + self.count+=1 + if self.count >= 10: + self.count = 0 + EventMesh.publish("return_prev_screen") + + def Close(self): + self.timer2.stop() + + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + pass + def done_right_to_left(self): + EventMesh.publish("return_prev_screen") + pass + def done_bottom_to_top(self): + EventMesh.publish("return_prev_screen") + pass + def done_top_to_bottom(self): + EventMesh.publish("return_prev_screen") + pass + def done_return(self): + EventMesh.publish("return_prev_screen") + pass + def done_click(self): + EventMesh.publish("return_prev_screen") + pass + + def btn8_press(self): + + pass + def btn1_press(self): + EventMesh.publish("return_prev_screen") + pass + def btn1_release(self): + EventMesh.publish("return_prev_screen") + pass + + +no_sos_screen = None +no_sos_screen_label = None + +#没有设置紧急联系人的号码 +class noSosDataScreen(Screen): + NAME = "NO_SOS_POPUP" + def __init__(self): + super().__init__() + self.meta = None + self.meta_type = "popup" + self.count = 0 + self.timer = osTimer() + + def initialization(self): + global no_sos_screen ,no_sos_screen_label + if no_sos_screen == None : + no_sos_screen = lv.obj() + print("NO_SOS_POPUP") + no_sos_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + # add style for watchface + no_sos_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) + #进入图片 + + no_sos_screen_label = lv.label(no_sos_screen) + no_sos_screen_label.set_pos(0, 110) + no_sos_screen_label.set_size(240, 80) + no_sos_screen_label.set_text("请在手机app上设置紧急联系人号码") + no_sos_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + no_sos_screen_label.set_long_mode(lv.label.LONG.WRAP) + no_sos_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + + + self.meta = no_sos_screen + def post_processor_before_initialization(self): + self.count = 0 + self.timer.start(1000,1,self.timer_cb_onescond) + + def Close(self): + self.timer.stop() + + def timer_cb_onescond(self,e): + EventMesh.publish("system_sleep_rest")#防止黑屏 + self.count+=1 + if self.count >= 10: + self.count = 0 + EventMesh.publish("return_prev_screen") + + + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + pass + def done_right_to_left(self): + EventMesh.publish("return_prev_screen") + pass + def done_bottom_to_top(self): + EventMesh.publish("return_prev_screen") + pass + def done_top_to_bottom(self): + EventMesh.publish("return_prev_screen") + pass + def done_return(self): + EventMesh.publish("return_prev_screen") + pass + def done_click(self): + EventMesh.publish("return_prev_screen") + pass + + def btn8_press(self): + + pass + def btn1_press(self): + EventMesh.publish("return_prev_screen") + pass + def btn1_release(self): + EventMesh.publish("return_prev_screen") + pass + + + system_init_screen = None system_init_label = None @@ -3949,7 +4593,15 @@ class UI(object): if self.main_flag != 1 and self.sleep_flag == 0: if event == "btn8_long_press": if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#有卡时触发sos报警 无卡时自动关机 - EventMesh.publish("set_sos_flag", 1) + sos_number = EventMesh.publish("get_dial_sos_number") + if sos_number != None: + if len(sos_number) != 0: + screen_NAME = EventMesh.publish("get_screen_NAME") + if screen_NAME != None: + if screen_NAME != "SOS_POPUP": + EventMesh.publish("load_screen", {"screen": "SOS_POPUP"}) + else: + EventMesh.publish("load_screen", {"screen": "NO_SOS_POPUP"}) else: EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"}) else: @@ -3962,7 +4614,15 @@ class UI(object): self.screen.btn8_press() if event == "btn8_long_press": if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#有卡时触发sos报警 无卡时自动关机 - EventMesh.publish("set_sos_flag", 1) + sos_number = EventMesh.publish("get_dial_sos_number") + if sos_number != None: + if len(sos_number) != 0: + screen_NAME = EventMesh.publish("get_screen_NAME") + if screen_NAME != None: + if screen_NAME != "SOS_POPUP": + EventMesh.publish("load_screen", {"screen": "SOS_POPUP"}) + else: + EventMesh.publish("load_screen", {"screen": "NO_SOS_POPUP"}) else: EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"}) 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 85c2a2a1..d2b2604d 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 @@ -3,7 +3,7 @@ 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 +from ui import style_screen,style_font_youyuan_20,style_btn,style_img,Screen,style_contact_btn,style_bar,style_bar_indic import constants import osTimer import audio @@ -12,17 +12,7 @@ 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() @@ -30,13 +20,7 @@ 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) + setting_cont_y = 0 setting_screen = lv.obj() diff --git a/2.sdk/project/K5/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/images/firmware_base_release_pack.zip b/2.sdk/project/K5/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/images/firmware_base_release_pack.zip index 998fb8de..93e8005f 100644 Binary files a/2.sdk/project/K5/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/images/firmware_base_release_pack.zip and b/2.sdk/project/K5/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/images/firmware_base_release_pack.zip differ diff --git a/2.sdk/project/K5/usr/main.py b/2.sdk/project/K5/usr/main.py index 3ccfa72f..0b4df1b7 100644 --- a/2.sdk/project/K5/usr/main.py +++ b/2.sdk/project/K5/usr/main.py @@ -132,6 +132,8 @@ if __name__ == '__main__': ui.add_screen(PopupAlarmScreen()) ui.add_screen(_ui.LowPowerScreen()) ui.add_screen(_ui.NewMessageScreen()) + ui.add_screen(_ui.sosScreen()) + ui.add_screen(_ui.noSosDataScreen()) ui.add_screen(NewWechatPopupScreen()) ui.add_screen(HealthScreen()) # ui.add_screen(_ui.Setting3Screen())