From: dxy15521469561 <1731678236@qq.com> Date: Thu, 21 Sep 2023 09:17:38 +0000 (+0800) Subject: D10: X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=f759ab98dbad297814d559e855f25fcddd6442c6;p=mirrors%2FASR1603_G5.git D10: bug修复 K01: bug修复 --- diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/alarm.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/alarm.py index 7be99310..64c8ffb4 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/alarm.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/alarm.py @@ -394,13 +394,10 @@ label_ok.set_text("完成") label_ok.set_long_mode(lv.label.LONG.DOT) label_ok.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) label_ok.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - +fffffffffffffffff #闹钟信息 alarm_list = [{'hour': 16, 'repeart': 10, 'idx': 0, 'enabled': 0, 'days': [], 'minute': 39}, - {'hour': 16, 'repeart': 10, 'idx': 1, 'enabled': 0, 'days': [], 'minute': 39}, - {'hour': 15, 'repeart': 1, 'idx': 2, 'enabled': 0, 'days': [], 'minute': 13}, - {'hour': 16, 'repeart': 1, 'idx': 3, 'enabled': 0, 'days': [], 'minute': 39}, - {'hour': 15, 'repeart': 1, 'idx': 4, 'enabled': 0, 'days': [], 'minute': 13}] + {'hour': 16, 'repeart': 10, 'idx': 1, 'enabled': 0, 'days': [], 'minute': 39}] #用于显示闹钟列表不包含开关机信息 class ClockManager(Abstract): @@ -415,8 +412,7 @@ class ClockManager(Abstract): if IFEXIST == True: with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd: self.check_alarm_list = ujson.load(fd) - - def post_processor_after_instantiation(self): + EventMesh.subscribe("push_clock_info", self.set) EventMesh.subscribe("read_alarminjson", self.read_alarminjson) EventMesh.subscribe("add_alarm", self.add_alarm) @@ -424,8 +420,17 @@ class ClockManager(Abstract): EventMesh.subscribe("set_rtc_alarm", self.set_rtc_alarm) EventMesh.subscribe("get_alarm_indx", self.get_alarm_indx) EventMesh.subscribe("get_check_alarm_list", self.get_check_alarm_list) + EventMesh.subscribe("push_update_alarm_show", self.update_show_info) + + def post_processor_after_instantiation(self): + + EventMesh.publish("read_alarminjson") + EventMesh.publish("set_rtc_alarm") + def update_show_info(self,event,msg): + EventMesh.publish("read_alarminjson") + EventMesh.publish("set_rtc_alarm") def get_check_alarm_list(self, event, msg): alarm_len = 0 @@ -652,16 +657,17 @@ class ClockManager(Abstract): print("end_min:{} current:{} off_tmp2:{}".format(end_min,current,off_tmp2)) if end_min == current:#结束的时间分钟等于关机时间分钟数则关机 - EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"}) + # EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"}) return - 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"}) + # 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("OPEN_ALARM_RING")#闹钟到点响铃 + # EventMesh.publish("load_screen", {"screen": "popup_alarm"}) # def _reset_rtc_alarm_time(self, args): # print("---alarm_ring---") @@ -879,7 +885,7 @@ class ClkListScreen(Screen): # clk_list_add_btn.add_event_cb(lambda e: self.add_alarm_btn(e), # lv.EVENT.PRESSED, None) self.weekdays_list = ["日","一","二","三","四","五","六"] - EventMesh.subscribe("push_update_alarm_show", self.update_show_info) + self.alarm_show_list = lv.obj(clk_list_screen) self.timer=osTimer() diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/appWechat.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/appWechat.py index 4eca41a7..58c3e1b8 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/appWechat.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/appWechat.py @@ -102,7 +102,7 @@ class WechatScreen(Screen): def __init__(self): super().__init__() self.MXA_MSG = 10 - self.wechat_recode_list = {} + self.wechat_recode_list = {"num":0} self.wechat_num = 0 self.read_data = {} self.volum_size = 8 @@ -120,7 +120,7 @@ class WechatScreen(Screen): self.wechat_num = self.wechat_recode_list["num"] else : self.wechat_recode_list = {"num":0} - with open("/usr/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd: + with open("/usr/static/storage_file/wechat_record.json","w+",encoding="utf-8") as fd: ujson.dump(self.wechat_recode_list,fd) # if self.wechat_num != 0: # with open("/usr/static/storage_file/wechat_record.json","r",encoding="utf-8") as fd:#音频文件记录 diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py index 321b0bca..4c27be38 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py @@ -26,7 +26,9 @@ def open_motor(): def close_motor(): motor_pin.write(0) -audio_buf =['audio_audio_haixiu', 'R_ALARM_3', 'R_CALL_mp3', 'R_CHARGE_FULL', 'R_CHARGE_IN', 'R_CHARGE_OUT', 'R_HSENSOR_RESULT_FAILE', 'R_HSENSOR_RESULT_HR_TITLE', 'R_HSENSOR_RESULT_OK', 'R_HSENSOR_SPO2_TITLE', 'R_HSENSOR_TEMP_TITLE', 'R_NO_SET_SOS_DIAL', 'R_NO_SIM', 'R_POWER_OFF_1', 'R_READ_STEP_0', 'R_READ_STEP_1', 'R_READ_STEP_2', 'R_READ_STEP_3', 'R_READ_STEP_4', 'R_READ_TIME_0', 'R_READ_TIME_1', 'R_READ_TIME_2', 'R_READ_TIME_3', 'R_READ_TIME_4', 'R_READ_TIME_5', 'R_READ_TIME_6', 'R_READ_TIME_7', 'R_READ_TIME_8', 'R_READ_TIME_9', 'R_READ_TIME_MIN', 'R_READ_TIME_ZHENG', 'R_SIM_CONNECT', 'R_SIM_FAILE', 'R_SOS_ALERT', 'R_TSENSOR_RESULT_VALUE_DOT', 'R_UNREAD_WECHAT'] +audio_buf = ['audio_audio_haixiu', 'R_ALARM_NEW', 'R_CALL_mp3', 'R_CHARGE_FULL', 'R_CHARGE_IN', 'R_CHARGE_OUT', 'R_HSENSOR_RESULT_FAILE', 'R_HSENSOR_RESULT_HR_TITLE', 'R_HSENSOR_RESULT_OK', 'R_HSENSOR_SPO2_TITLE', 'R_HSENSOR_TEMP_TITLE', 'R_NO_SET_SOS_DIAL', 'R_NO_SIM', 'R_POWER_OFF_1', 'R_READ_STEP_0', 'R_READ_STEP_1', 'R_READ_STEP_2', 'R_READ_STEP_3', 'R_READ_STEP_4', 'R_READ_TIME_0', 'R_READ_TIME_1', 'R_READ_TIME_2', 'R_READ_TIME_3', 'R_READ_TIME_4', 'R_READ_TIME_5', 'R_READ_TIME_6', 'R_READ_TIME_7', 'R_READ_TIME_8', 'R_READ_TIME_9', 'R_READ_TIME_MIN', 'R_READ_TIME_ZHENG', 'R_SIM_CONNECT', 'R_SIM_FAILE', 'R_SOS_ALERT', 'R_TSENSOR_RESULT_VALUE_DOT', 'R_UNREAD_WECHAT', 'R_WECHAT_RECV'] + + class call: CALL_OUT = 1 CALL_IN = 2 @@ -38,6 +40,7 @@ class intervManager(Abstract): self.timer = osTimer() self.pwk_timer = osTimer() + self.timer1 = osTimer() self.aud = audio.Audio(0) self.aud.set_pa(Pin.GPIO29) self.aud.setVolume(11) @@ -65,6 +68,8 @@ class intervManager(Abstract): self.FIND_timer_count = 0 self.old_hour = 0 + self.alarm_state = 0 + self.alarm_timer_count = 0 self.old_min = 0 self.interInfo_queue = Queue() _thread.start_new_thread(self.interInfo_queue_thread, ()) @@ -84,12 +89,14 @@ class intervManager(Abstract): self.power_on_flag = 0 - self.MXA_MSG = 3 - self.wechat_recode_list = {} + self.MXA_MSG = 1 + self.wechat_recode_list = {"num":0} self.wechat_num = 0 self.read_data = {} self.volum_size = 8 + self.phone_num = '' self.msg_tmp = "" + self.time_count = 0 check_txt = ql_fs.path_exists("/usr/static/storage_file/wechat_record.json") if check_txt == True : with open("/usr/static/storage_file/wechat_record.json","r") as fd:#音频文件编号 @@ -164,6 +171,16 @@ class intervManager(Abstract): EventMesh.subscribe("play_audio_file", self.play_audio_file)#获取播放音频文件 + EventMesh.subscribe("OPEN_ALARM_RING", self.send_alarm_ring)#闹钟到点响铃 + EventMesh.subscribe("STOP_ALARM_RING", self.stop_alarm_ring)#是否需要关闭闹钟 + + EventMesh.subscribe("recv_wechat_audio", self.recv_wechat_audio)# + + def recv_wechat_audio(self,event,str_data):#接收微聊语音播放 + if self.press_btn == 0: + str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_WECHAT_RECV")) + EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件 + def play_audio_file(self,event,str_data):#msg 拼接的路径文件 open_power = EventMesh.publish("get_power_on_state")#获取开机标识 power_off = EventMesh.publish("get_power_off_state")#获取开机标识 @@ -173,7 +190,7 @@ class intervManager(Abstract): if power_off != None: if power_off == 1: return - #str_data[0] 路径 str_data[1] 是否需要被打断 + print("play_audio_file",str_data[0],str_data[1])#路径 str_data[1] 是否需要被打断 self.aud.montage_play('U:/static/audio.bin',1,str_data[1],str_data[0]) @@ -204,6 +221,9 @@ class intervManager(Abstract): def publish_find_watch_event_cb(self, *args, **kwargs):#查找设备 EventMesh.publish("publish_message_event_interInfo",{"func":self.FIND_timer_cb,"data":0}) + def publish_alarm_ring_event_cb(self, *args, **kwargs):#闹钟响铃 + EventMesh.publish("publish_message_event_interInfo",{"func":self.Alarm_timer_cb,"data":0}) + def powe_resatrt_down_fun(self, *args): EventMesh.publish("close_all_led")#关闭所有的灯 self.aud.stopPlayStream() @@ -230,7 +250,6 @@ class intervManager(Abstract): def close_timer_all(self, event, msg): - EventMesh.publish("stop_led_timer")#设置参数 self.timer.stop() open_power = EventMesh.publish("get_power_on_state")#获取开机标识 power_off = EventMesh.publish("get_power_off_state")#获取开机标识 @@ -284,6 +303,9 @@ class intervManager(Abstract): EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件 # EventMesh.publish("play_audio_file",str_data)#获取播放音频文件('U:/static/audio.bin',1,1,str_data) + + EventMesh.publish("get_phonebook_list") + def dial_out_call_center_cb(self, event, msg):#电话拨出去 open_power = EventMesh.publish("get_power_on_state")#获取开机标识 if open_power != None: @@ -293,19 +315,26 @@ class intervManager(Abstract): if power_off != None: if power_off == 1: return - print("dial_out_call_center_cb",msg) + # print("dial_out_call_center_cb",msg) if self.call_state == 0: + self.phone_num = '' EventMesh.publish("close_timer_all")# if msg == None: str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_NO_SET_SOS_DIAL")) EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件 # EventMesh.publish("play_audio_file",str_data)#获取播放音频文件('U:/static/audio.bin',1,1,str_data) else: + self.time_count = 0 + self.phone_num = str(msg) + self.timer1.start(2000, 0, self.time_out_phone) str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_SOS_ALERT")) EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件 - voiceCall.callStart(str(msg)) + + def time_out_phone(self, msg):#电话拨出去 + voiceCall.callStart(self.phone_num) + def call_test_event(self, event, msg): voiceCall.callStart(str("10086")) @@ -322,7 +351,7 @@ class intervManager(Abstract): flag = EventMesh.publish("get_call_state") if flag == 1:#电话呼叫中 voiceCall.callEnd() - + def play_cur_step_event(self, event, msg): #msg 1 播放当前步数 @@ -633,9 +662,8 @@ class intervManager(Abstract): if step != 0: EventMesh.publish("set_storage_config",["old_step",step]) date_tmp = utime.localtime() - EventMesh.publish("set_storage_config",["old_timesecond",date_tmp])#关机保存一个是时间 + EventMesh.publish("set_storage_config",["old_time",date_tmp])#关机保存一个是时间 str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_POWER_OFF_1")) - print("audio hecheng!!!!!") EventMesh.publish("play_audio_file",[str_data,0])#获取播放音频文件('U:/static/audio.bin',1,1,str_data) EventMesh.publish("set_led_time_arg",[1,2,4*8,led_mode.FLASH_LIGHT_RED,4,2,led_mode.OTHER_MEASURE_MODE])# @@ -648,7 +676,7 @@ class intervManager(Abstract): voiceCall.callEnd() str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_POWER_OFF_1")) EventMesh.publish("play_audio_file",[str_data,0])#获取播放音频文件('U:/static/audio.bin',1,1,str_data) - EventMesh.publish("stop_led_timer")#设置参数 + # EventMesh.publish("stop_led_timer")#设置参数 self.power_off = 1 self.timer.start(8000,0,self.publish_resatrt_down_event_cb) #EventMesh.publish("set_led_time_arg",[3000,4000,1,led_mode.LONG_LIGHT_GREEN,led_mode.DEFAULT_LONG_LIGHT_MODE])# @@ -675,7 +703,6 @@ class intervManager(Abstract): def power_on_cb(self, msg): #msg 开机标识 self.power_on_flag = 1 - self.pwk_timer.stop() def get_power_on_state(self, event, msg): return self.power_on_flag @@ -697,15 +724,17 @@ class intervManager(Abstract): EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) def set_manual_measure_mode(self, event, msg): #手动测试 1心率 2 血氧 3 体温 + get_hr_state = EventMesh.publish("get_hr_state") + get_spo2_state = EventMesh.publish("get_spo2_state") + get_temp_state = EventMesh.publish("get_temp_state") if msg == 1: - get_hr_state = EventMesh.publish("get_hr_state") if get_hr_state != 1:#不是手动测试直接打断 print("set_manual_measure_mode",msg) EventMesh.publish("set_hr_state",1) EventMesh.publish("set_start_measure_time")#设置开始测量的时间戳时间 + EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) #停止测试血氧 EventMesh.publish(constants.EVENT.START_HEART) #手动心率测试 elif msg == 2: - get_spo2_state = EventMesh.publish("get_spo2_state") if get_hr_state == 0: if get_spo2_state != 1: print("set_manual_measure_mode",msg) @@ -713,7 +742,6 @@ class intervManager(Abstract): EventMesh.publish("set_start_measure_time")#设置开始测量的时间戳时间 EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN) #手动血氧测试 elif msg == 3: - get_temp_state = EventMesh.publish("get_temp_state") if get_temp_state != 1: print("set_manual_measure_mode",msg) EventMesh.publish("set_temp_state",1) @@ -1003,7 +1031,7 @@ class intervManager(Abstract): if self.find_state == 1: self.find_state = 0 self.FIND_timer_count = 0 - EventMesh.publish("stop_led_timer")#设置参数 + # EventMesh.publish("stop_led_timer")#设置参数 self.aud.stopPlayStream() #播放声音 self.timer.stop() @@ -1019,6 +1047,43 @@ class intervManager(Abstract): def stop_FIND(self) : self.timer.stop() + def send_alarm_ring(self, event, msg): #发送查找设备指令 + open_power = EventMesh.publish("get_power_on_state")#获取开机标识 + if open_power != None: + if open_power == 0: + return + power_off = EventMesh.publish("get_power_off_state")#获取开机标识 + if power_off != None: + if power_off == 1: + return + flag = EventMesh.publish("get_call_state")#在通话或者电话拨进 或者拨出不允许寻找设备 + wechat_state = EventMesh.publish("get_wechat_state") + if flag == 0 and wechat_state == 0: + EventMesh.publish("close_timer_all")# + self.alarm_state = 1 + self.alarm_timer_count = 0 + self.timer.start(3000,1,self.publish_alarm_ring_event_cb) + # EventMesh.publish("set_led_time_arg",[1,1,330,led_mode.LONG_LIGHT_GREEN,2,1,led_mode.OTHER_MEASURE_MODE])#測量成功 + # EventMesh.publish("set_led_time_arg",[1000,33000,1,led_mode.FLASH_LIGHT_GREEN,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#设置参数 + str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_ALARM_NEW")) + EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data) + + def stop_alarm_ring(self, event, msg): #停止闹钟响铃 + if self.alarm_state == 1: + self.alarm_state = 0 + self.alarm_timer_count = 0 + self.aud.stopPlayStream() #停止播放 + self.timer.stop() + + def Alarm_timer_cb(self, data): + if self.alarm_state == 1: + print("self.alarm_timer_count:{}".format(self.alarm_timer_count)) + str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_ALARM_NEW")) + EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data) + self.alarm_timer_count += 1 + if self.alarm_timer_count > 15: #120秒30s + EventMesh.publish("STOP_ALARM_RING") + def play_cur_time_event(self, event, msg): #播放当前时间 flag = EventMesh.publish("get_call_state") @@ -1302,10 +1367,12 @@ class intervManager(Abstract): #录音时间太短 return else: - self.wechat_recode_list["%02d"%(self.wechat_show)] = "read:1" + self.wechat_recode_list["%02d"%(self.wechat_show)] = "read:0" self.wechat_recode_list["num"] = self.wechat_show print("self.wechat_recode_list :{}".format(self.wechat_recode_list)) + + with open("/usr/static/storage_file/wechat_record.json","w+",encoding="utf-8") as fd: ujson.dump(self.wechat_recode_list,fd) print("send wechat data!!!!!!!!!!!!!!!!!!!!!") @@ -1343,7 +1410,7 @@ class intervManager(Abstract): num = 0 play_state = 0 if len(self.wechat_recode_list) > 1: - num = self.wechat_recode_list["num"] + num = int(self.wechat_recode_list["num"]) #print("self.wechat_recode_list1:{}".format(self.wechat_recode_list)) if num != 0: last_num = str("%02d"%(num)) @@ -1371,7 +1438,7 @@ class intervManager(Abstract): self.wechat_recode_list[key] = "read:0" self.wechat_recode_list["num"] = num print("self.wechat_recode_list2:{} num_id:{} num:{}".format(self.wechat_recode_list,num_id,num)) - self.aud.play(1, 1, '/usr/static/storage_file/{}.amr'.format(num_id)) #文件名前面要加上路径 + # self.aud.play(1, 1, '/usr/static/storage_file/{}.amr'.format(num)) #文件名前面要加上路径 play_state = 1 with open("/usr/static/storage_file/wechat_record.json","w+",encoding="utf-8") as fd: ujson.dump(self.wechat_recode_list,fd) @@ -1383,17 +1450,17 @@ class intervManager(Abstract): else: continue #print("play_state:{}".format(play_state)) - if play_state == 0: - check_amr = ql_fs.path_exists("/usr/static/storage_file/{}.amr".format(num))#还要检测这个文件是否存在 - if check_amr == True: - self.aud.play(1, 1, '/usr/static/storage_file/{}.amr'.format(num)) #文件名前面要加上路径 + # if play_state == 0:# + check_amr = ql_fs.path_exists("/usr/static/storage_file/{}.amr".format(num))#还要检测这个文件是否存在 + if check_amr == True: + self.aud.play(1, 1, '/usr/static/storage_file/{}.amr'.format(num)) #文件名前面要加上路径 def play_unread_wechat_infor(self,event,msg):#未读微聊语音 if self.wechat_recode_list != None: num = 0 play_state = 0 if len(self.wechat_recode_list) > 1: - num = self.wechat_recode_list["num"] + num = int(self.wechat_recode_list["num"]) if num != 0: for i in range(len(self.wechat_recode_list)-1):#1 01 02 key = "%02d"%(i+1) @@ -1452,7 +1519,9 @@ class BtnDevice(Abstract): def __init__(self, tp=None): self.pk = PowerKey() self.__pwk_timer = osTimer() - + self.aud = audio.Audio(0) + self.aud.set_pa(Pin.GPIO29) + self.aud.setVolume(11) # self.keypad = machine.KeyPad(1, 2) self.__PowerDownTimeOut = 3000 self.__tp = tp @@ -1514,6 +1583,8 @@ class BtnDevice(Abstract): def publish_pwkKey_btn_event_cb(self, *args, **kwargs): EventMesh.publish("publish_message_event_btnInfo",{"func":self.pwKey_press_cb,"data":0}) + + def post_processor_after_instantiation(self): # self.keypad.init() # self.keypad.set_callback(self.key_callback) @@ -1537,36 +1608,43 @@ class BtnDevice(Abstract): EventMesh.publish("close_audio_play")#强制关闭音频文件播放 EventMesh.publish("stop_led_timer")#设置参数关闭定时器 同时也关闭所有的灯再开相对应的灯 EventMesh.publish("STOP_FIND_WATCH")#停止查找设备 + EventMesh.publish("STOP_ALARM_RING")#停止闹钟响铃 EventMesh.publish("play_cur_time_event")#播报当前时间 #播报当前时间 def pwk_extint_cb(self,args):#侧边按键 + self.GPIO26_status = self.extint.read_level() + print('### key20_extint_cb {} self.GPIO26_status :{}'.format(args,self.GPIO26_status)) # args[0]:gpio号 args[1]:上升沿或下降沿 power_off = EventMesh.publish("get_power_off_state")#获取关机标识 if power_off != None: if power_off == 1: return - self.GPIO26_status = self.extint.read_level() - print('### key20_extint_cb {} self.GPIO26_status :{}'.format(args,self.GPIO26_status)) # args[0]:gpio号 args[1]:上升沿或下降沿 if self.sosKey_status != 0 and self.WeChatKey_status != 0: if self.GPIO26_status == 0:#按下 if self.pwkey_press == 0 : + self.aud.stop() #播放声音 + # self.wechatKey_timeout_cb(0) + # self.sosKey_timeout_cb(0) + self.wechatKey_timer.stop() + self.pwkey_timer.stop() + self.sosKey_timer.stop() + self.wechatKey_press_count = 0 + self.sosKey_press_count = 0 + self.sosKey_press = 0 + self.wechatKey_press = 0 + self.pwkey_press = 1 self.pwkey_count = 0 self.led_state = 0 self.pwkey_timer.start(100, 1, self.publish_pwkKey_btn_event_cb) - print("key22_extint_cb:self.key22_timer.start!!!!\n") + # print("key22_extint_cb:self.key22_timer.start!!!!\n") def pwKey_press_cb(self, data): '''KEY2:联动屏幕右下角或返回键长按关机''' if self.pwkey_press == 1 : self.pwkey_count += 1 if self.pwkey_count > 5: - # if self.led_state == 0: - # self.led_state = 1 - # # print("self.pwkey_count {} self._state:{}",self.pwkey_count,self.led_state) - # EventMesh.publish("set_led_time_arg",[10000,1000,1,led_mode.LONG_LIGHT_GREEN,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])# - # print("self.self.pwkey_count!!!!!!!!!!!!!!",self.pwkey_count) if self.pwkey_count >= 10*10: self.pwkey_timer.stop() self.pwkey_count = 0 @@ -1577,36 +1655,23 @@ class BtnDevice(Abstract): EventMesh.publish("open_power_on", 2)# else: EventMesh.publish("open_power_on", 3)# - return - else: - if self.GPIO26_status == 1:#松开 - pass - # EventMesh.publish("stop_led_timer")#设置参数 - - - - if self.GPIO26_status == 1:#松开 - if self.pwkey_count >= 1 and self.pwkey_count <= 5: #防抖100ms + if self.pwkey_count >= 1: #防抖100ms self.pwkey_timer.stop() self.pwkey_count = 0 self.pwkey_press = 0 self.led_state = 0 self.pwKey_press_count+=1 - self.pwkey_timer.start(500, 0, self.pwKey_timeout_cb)#松手超时1s判断 - else: - self.pwkey_timer.stop() - self.pwkey_count = 0 - self.pwkey_press = 0 - self.led_state = 0 - self.pwKey_press_count = 0 - - print("self.pwKey_status!!!!!!!!!!!!!!") + self.pwkey_timer.start(500, 0, self.publish_pwKey_timeout_cb_do)#松手超时1s判断 - def pwKey_timeout_cb(self, *args):#侧边按键 + def publish_pwKey_timeout_cb_do(self, *args, **kwargs): + EventMesh.publish("publish_message_event_btnInfo",{"func":self.pwKey_timeout_cb,"data":0}) + + def pwKey_timeout_cb(self, data):#侧边按键 if self.pwKey_press_count >= 1: + EventMesh.publish("dialing_out_event")#电话呼叫中voiceCall.callEnd() self.pwKey_press_count = 0 # EventMesh.publish(constants.EVENT.START_LOCATION) #开始定位 sos_flag = EventMesh.publish("get_sos_flag") @@ -1614,7 +1679,7 @@ class BtnDevice(Abstract): EventMesh.publish("set_sos_flag",0) EventMesh.publish("set_sos_num",0) EventMesh.publish("set_hangup_mode",0) - EventMesh.publish("dialing_out_event")#电话呼叫中 + EventMesh.publish("close_hr_sop2")# flag = EventMesh.publish("get_call_state") if flag != 1: @@ -1626,15 +1691,23 @@ class BtnDevice(Abstract): if power_off == 1: return self.sosKey_status = self.sosKey.read_level() - print('### key22_extint_cb {} self.GPIO22_status:{}'.format(args,self.sosKey_status)) # args[0]:gpio号 args[1]:上升沿或下降沿 + # print('### key22_extint_cb {} self.GPIO22_status:{}'.format(args,self.sosKey_status)) # args[0]:gpio号 args[1]:上升沿或下降沿 if self.WeChatKey_status != 0 and self.GPIO26_status != 0: if self.sosKey_status == 0:#按下 if self.sosKey_press == 0 : + # self.wechatKey_timeout_cb(0) + # self.pwKey_timeout_cb(0) + self.wechatKey_timer.stop() + self.pwkey_timer.stop() + self.sosKey_timer.stop() + self.wechatKey_press_count = 0 self.sosKey_press = 1 + self.pwkey_press = 0 + self.wechatKey_press = 0 self.sosKey_long_press = 0 self.sosKey_count = 0 self.sosKey_timer.start(100, 1, self.publish_soskey_btn_event_cb) - print("key22_extint_cb:self.key22_timer.start!!!!\n") + # print("key22_extint_cb:self.key22_timer.start!!!!\n") def sosKey_press_cb(self, data): '''KEY2:联动屏幕右下角或返回键长按关机''' @@ -1655,23 +1728,15 @@ class BtnDevice(Abstract): # print("self.sosKey_count {}",self.sosKey_count) if self.sosKey_status == 1:#松开 - if self.sosKey_count >= 1 and self.sosKey_count <= 5: #防抖100ms + if self.sosKey_count >= 1: #防抖100ms self.sosKey_timer.stop() self.sosKey_count = 0 self.sosKey_press = 0 self.sosKey_press_count+=1 - self.sosKey_timer.start(500, 0, self.sosKey_timeout_cb)#松手超时1s判断 - else: - self.sosKey_timer.stop() - self.sosKey_count = 0 - self.sosKey_press = 0 - self.sosKey_press_count=0 - - print("self.sosKey_status!!!!!!!!!!!!!!") - # import audio - # aud.montage_play('U:/mp3.bin',2,1,'mp3files=1.mp3+2.mp3+3.mp3') - - def sosKey_timeout_cb(self, *args):#微聊键 + self.sosKey_timer.start(500, 0, self.publish_sosKey_timeout_cb_do)#松手超时1s判断 + def publish_sosKey_timeout_cb_do(self, *args, **kwargs): + EventMesh.publish("publish_message_event_btnInfo",{"func":self.sosKey_timeout_cb,"data":0}) + def sosKey_timeout_cb(self, data):# print("sosKey_press_count!!!!!!!!!!!!!! ",self.sosKey_press_count) if self.sosKey_press_count >= 10:# self.sosKey_press_count = 0 @@ -1714,16 +1779,23 @@ class BtnDevice(Abstract): if power_off == 1: return self.WeChatKey_status = self.wechatKey.read_level() - print('### wechatKey_extint_cb {} self.WeChatKey_status:{}'.format(args,self.WeChatKey_status)) # args[0]:gpio号 args[1]:上升沿或下降沿 + # print('### wechatKey_extint_cb {} self.WeChatKey_status:{}'.format(args,self.WeChatKey_status)) # args[0]:gpio号 args[1]:上升沿或下降沿 if self.sosKey_status != 0 and self.GPIO26_status != 0: if self.WeChatKey_status == 0:#按下 - if self.wechatKey_press == 0 : + if self.wechatKey_press == 0: + # self.pwKey_timeout_cb(0) + # self.sosKey_timeout_cb(0) + self.wechatKey_timer.stop() + self.pwkey_timer.stop() + self.sosKey_timer.stop() + self.sosKey_press_count = 0 + self.pwKey_press_count = 0 + self.sosKey_press = 0 + self.pwkey_press = 0 self.wechatKey_press = 1 self.wechatKey_count = 0 self.wechat_state = 1 self.wechatKey_timer.start(100, 1, self.publish_wechat_btn_event_cb) - - print("wechatKey_extint_cb:selfwechatKey_timer.start!!!!\n") def close_wechat_btn_timer(self,event,*argc): tmp = EventMesh.publish("get_wechat_time")#获取微聊时间戳 @@ -1760,15 +1832,6 @@ class BtnDevice(Abstract): if self.wechatKey_press == 1 :#是否按下 tmp = EventMesh.publish("get_wechat_time")#获取微聊时间戳 self.wechatKey_count += 1 - # print("self.wechatKey_count {}",self.wechatKey_count) - # if self.wechatKey_count <= 2: - # if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#未联网不需要录音 - # print("self.wechatKey_count1111") - # # EventMesh.publish("set_led_time_arg",[1000,500,1,led_mode.FLASH_LIGHT_GREEN,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#设置参数 - # else: - # print("self.wechatKey_count1111") - # # EventMesh.publish("set_led_time_arg",[1000,500,1,led_mode.FLASH_LIGHT_RED,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#设置参数 - if self.wechatKey_count >= 10: #长按1s进入微聊录音 if self.WeChatKey_status == 0: if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#未联网不需要录音 @@ -1807,7 +1870,7 @@ class BtnDevice(Abstract): if tmp[0] != 0: time_sec = tmp[1] wechat_time = time_tmp - time_sec - print("WECHAT TIEM",time_tmp,time_sec,wechat_time) + # print("WECHAT TIEM",time_tmp,time_sec,wechat_time) if wechat_time >= 15: wechat_time = 15 @@ -1820,20 +1883,18 @@ class BtnDevice(Abstract): return if self.WeChatKey_status == 1:#松开 - if self.wechatKey_count >= 1 and self.wechatKey_count <= 5: #防抖100ms + if self.wechatKey_count >= 1: #防抖100ms # print("WeChat time!!!!!!!!!!!!!!") self.wechatKey_timer.stop() self.wechatKey_count = 0 self.wechatKey_press = 0 self.wechatKey_press_count+=1 - self.wechatKey_timer.start(500, 0, self.wechatKey_timeout_cb)#松手超时1s判断 - else: - self.wechatKey_timer.stop() - self.wechatKey_count = 0 - self.wechatKey_press = 0 - self.wechatKey_press_count = 0 + self.wechatKey_timer.start(500, 0, self.publish_wechatKey_btn_event_cb)#松手超时1s判断 + + def publish_wechatKey_btn_event_cb(self, *args, **kwargs): + EventMesh.publish("publish_message_event_btnInfo",{"func":self.wechatKey_timeout_cb,"data":0}) - def wechatKey_timeout_cb(self, *args):#微聊键 + def wechatKey_timeout_cb(self,data):#微聊键 print("wechatKey_timeout_cb!!!!!!!!!!!!!! ",self.wechatKey_press_count) if self.wechatKey_press_count >= 10:#短按十次解绑app self.wechatKey_press_count = 0 diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/led.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/led.py index db3e498c..38e92564 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/led.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/led.py @@ -217,8 +217,6 @@ class ledEventManager(Abstract):#灯事件 if self.timer_state == 0: self.timer_state = 1 self.timer.stop() - - EventMesh.publish("close_led_pin") self.timer.start(LED_TIMER_OUT,1,self.publish_led_event_cb) @@ -307,7 +305,7 @@ class ledEventManager(Abstract):#灯事件 def led_fun_cb(self, data):# if self.led_enable ==0 and self.led_total_time == 0: return - print("self.long_count",self.long_count) + # print("self.long_count",self.long_count) if self.led_total_time != 0: #红灯闪烁 if self.long_light_mode == led_mode.FLASH_LIGHT_RED :# @@ -462,12 +460,17 @@ class ledEventManager(Abstract):#灯事件 close_led_white() def close_all_led(self, event, msg): + + print("close_all_led!!2222222!!") + EventMesh.publish("publish_message_event_ledInfo",{"func":self.close_all_led_do,"data":0}) + def close_all_led_do(self,data): print("close_all_led!!!!") usb_in = EventMesh.publish("get_usb")# if usb_in != None: if usb_in == 1 or usb_in == 3:#正在充电或者充电已满都不要被打断 - self.timer_state = 0 - self.timer.stop() + if self.timer_state == 1: + self.timer_state = 0 + self.timer.stop() return else: get_hr_state = EventMesh.publish("get_hr_state") @@ -479,8 +482,10 @@ class ledEventManager(Abstract):#灯事件 if wechat_state != None: #获取微聊状态 if wechat_state == 1 or get_spo2_state != 0 or get_hr_state != 0 or temp_state != 0: return + + if self.timer_state == 1: + self.timer.stop() self.timer_state = 0 - self.timer.stop() self.led_total_time = 0 self.led_enable = 0 self.led_mode = 0 diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/main_1.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/main_1.py index c6bfef1a..972f1a2a 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/main_1.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/main_1.py @@ -165,7 +165,7 @@ if __name__ == '__main__': # .append_manager(mgr.StopwatchManager()) \ # .append_manager(mgr.CountdownManager()) \ - app.append_manager(Alipay()) + app.append_manager(ConfigStoreManager()) app.append_manager(NetManager()) app.append_manager(LocationManager()) diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/main_init.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/main_init.py index 14636c17..3dc9c17c 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/main_init.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/main_init.py @@ -79,11 +79,10 @@ def main_init(): import mgr as mgr print("init7:{}".format(utime.localtime())) - from mgr import testSmsSetIPManager,ConfigStoreManager,sosInfoCallManager,getBootOffManager,getSosFlagManager,CountdownManager, LocationManager, getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\ + from mgr import ClockManager,deleteSmsManager,testSmsSetIPManager,ConfigStoreManager,sosInfoCallManager,getBootOffManager,getSosFlagManager,CountdownManager, LocationManager, getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\ AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldTimeManager,getStorageDataManager,getBrightnessManager,getHrTimeManager,getTempTimeManager,getLowBatManager print("init8:{}".format(utime.localtime())) - # from appWechat import TK_ProtoCol,MESSAGE_ProtoCol @@ -141,6 +140,8 @@ def main_init(): app.append_manager(CountdownManager()) app.append_manager(sosInfoCallManager()) app.append_manager(testSmsSetIPManager()) + app.append_manager(deleteSmsManager()) + app.append_manager(ClockManager()) print("init21:{}".format(utime.localtime())) diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py index 36bd60c4..48617e11 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py @@ -615,6 +615,7 @@ def voice_callback(args): elif args[0] == 15: print('voicecall alerting, PhoneNO.: ', args[6]) + EventMesh.publish("set_call_state",1) elif args[0] == 16: print('voicecall holding, PhoneNO.: ', args[6]) @@ -1600,7 +1601,7 @@ class DeviceInfoManager(Abstract): if battery[0] == '1': if battery[1] >= 100:#充电已满 if self.charge_full_count == 0: - EventMesh.publish("set_usb_state",3)# + EventMesh.publish("set_usb",3)# print("charge R_CHARGE_full") self.charge_full_count = 1 else: @@ -1609,19 +1610,9 @@ class DeviceInfoManager(Abstract): self.charge_full_count = 0 low_power = battery[1] if low_power <= 5:#小于5%红色灯慢闪 - EventMesh.publish("set_led_time_arg",[1,2,10*11,led_mode.FLASH_LIGHT_RED,10,5,led_mode.OTHER_MEASURE_MODE])#測量成功 + EventMesh.publish("set_led_time_arg",[1,2,20*11,led_mode.FLASH_LIGHT_RED,20,10,led_mode.OTHER_MEASURE_MODE])#測量成功 # EventMesh.publish("set_led_time_arg",[1000,400,52,led_mode.FLASH_LIGHT_RED,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#開始測量 - # self.charge_full_count+=1 - # print("self.charge_full_count",self.charge_full_count) - # if self.charge_full_count == 6: - # EventMesh.publish("set_usb", 1)# - # elif self.charge_full_count == 7: - # EventMesh.publish("set_usb", 2)# - # elif self.charge_full_count >= 8: - # self.charge_full_count = 0 - # EventMesh.publish("set_usb", 2)# - def get_sim_Status(self, event, msg): return sim.getStatus() @@ -2442,7 +2433,7 @@ class AddrBookManager(Abstract): EventMesh.publish("dial_out_call_center_cb",None)#电话拨出去 else: EventMesh.publish("dial_out_call_center_cb",None)#电话拨出去 - print("call_phonebook_one_call name:{} key_tmp:{} len:{}".format(name,key_tmp,len(self.read_phonebook))) + print("call_phonebook_one_call name:{} key_tmp:{} len:{}".format(name,key_tmp,len(self.read_phonebook))) def call_phonebook_two_call(self, event, msg): name = '' @@ -2470,21 +2461,23 @@ class AddrBookManager(Abstract): name = '' key_tmp = '' if self.read_phonebook != {}: - if len(self.read_phonebook) >= 3: + if len(self.read_phonebook) >= 2: phonebook_keys = sorted(self.read_phonebook.keys()) name = self.read_phonebook[phonebook_keys[2]] key_tmp = phonebook_keys[2] if len(name) != 0: + #voiceCall.callStart(str(name)) EventMesh.publish("save_phonename",str(name)) EventMesh.publish("save_phonenum",str(name)) EventMesh.publish("dial_out_call_center_cb",str(name))#电话拨出去 - # voiceCall.callStart(str(name)) else: EventMesh.publish("dial_out_call_center_cb",None)#电话拨出去 else: EventMesh.publish("dial_out_call_center_cb",None)#电话拨出去 - print("call_phonebook_three_call name:{} key_tmp:{}".format(name,key_tmp)) + else: + EventMesh.publish("dial_out_call_center_cb",None)#电话拨出去 + print("call_phonebook_three_call name:{} key_tmp:{}".format(name,key_tmp)) def set(self, event, msg): self.check_json = msg[0] @@ -3303,6 +3296,345 @@ class testSmsSetIPManager(Abstract):# # return [self.newip,self.newcom,self.newmd5] if(tmp_data != None): return [self.newip,self.newcom] + + +class deleteSmsManager(Abstract):#删除信息 + def __init__(self): + pass + + def post_processor_after_instantiation(self): + EventMesh.subscribe("delete_sms_event", self.delete_sms_event)#删除短信 + EventMesh.subscribe("delete_sms_thread", self.delete_sms_thread)# + + def delete_sms_event(self, event, msg): + EventMesh.publish_async("remove_all_sms_cb","",1*1024) + + def delete_sms_thread(self, event, msg): + sms.deleteMsg(1,4) + +#闹钟信息 +alarm_list = [{'hour': 16, 'repeart': 10, 'idx': 0, 'enabled': 0, 'days': [], 'minute': 39}, + {'hour': 16, 'repeart': 10, 'idx': 1, 'enabled': 0, 'days': [], 'minute': 39}] +#用于显示闹钟列表不包含开关机信息 + +class ClockManager(Abstract): + def __init__(self): + super().__init__() + self.rtc = RTC() + self.days = 0 + self.idx = 0 + + IFEXIST = ql_fs.path_exists("/usr/static/storage_file/alarm_msg.json") + self.check_alarm_list = [] + if IFEXIST == True: + with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd: + self.check_alarm_list = ujson.load(fd) + + EventMesh.subscribe("push_clock_info", self.set) + EventMesh.subscribe("read_alarminjson", self.read_alarminjson) + EventMesh.subscribe("add_alarm", self.add_alarm) + EventMesh.subscribe("remove_alarm", self.remove_alarm) + EventMesh.subscribe("set_rtc_alarm", self.set_rtc_alarm) + EventMesh.subscribe("get_alarm_indx", self.get_alarm_indx) + EventMesh.subscribe("get_check_alarm_list", self.get_check_alarm_list) + EventMesh.subscribe("push_update_alarm_show", self.update_show_info) + + def post_processor_after_instantiation(self): + + + EventMesh.publish("read_alarminjson") + EventMesh.publish("set_rtc_alarm") + + def update_show_info(self,event,msg): + EventMesh.publish("read_alarminjson") + EventMesh.publish("set_rtc_alarm") + + def get_check_alarm_list(self, event, msg): + alarm_len = 0 + global alarm_list + EventMesh.publish("read_alarminjson") + alarm_len = len(alarm_list) + return alarm_len + + + def set(self, event, msg): + global alarm_list + print("msg = {}".format(msg)) + idx = msg.get("idx") + print("修改第{}个闹钟信息{}".format(idx,alarm_list[idx])) + alarm_list[idx]["hour"] = msg["hour"] + 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("/usr/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd: + ujson.dump(alarm_list,fd) + + def read_alarminjson(self, event, msg): + IFEXIST = ql_fs.path_exists("/usr/static/storage_file/alarm_msg.json") + global alarm_list + print("IFEXIST:{}".format(IFEXIST)) + if IFEXIST == True: + with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd: + alarm_list = ujson.load(fd) + return alarm_list + + def add_alarm(self, event, msg): + + global alarm_list + EventMesh.publish("read_alarminjson") + idx = len(alarm_list) + + # msg = ['1','06:90','23:59'] + count = 1 + new = 0 + num = 0 + print("msg:{}".format(msg)) + # if msg[0] == 1: + # msg_new = msg[1] + for i in range(0,2):#开关机固定是 idx 0 1 + off_msg1 = msg[i+1] + msg_tmp1 = off_msg1.split(':') + start_hour = int(msg_tmp1[0]) + start_min = int(msg_tmp1[1]) + enable = int(msg[0]) + EventMesh.publish("set_boot_off_time",[msg[0],msg[1],msg[2]]) + if alarm_list and new == 0 : + for x in range(0,5): + # print("count :{} self.alarm_list:111111{} len(self.alarm_list):{}".format(count,alarm_list,len(alarm_list))) + if new == 1 and count > len(alarm_list): + break + tmp = alarm_list[count-1]['idx'] + if tmp == 0 or tmp == 1:#覆盖旧的 + alarm_list[count-1] = {"idx": tmp, "hour": start_hour, "minute": start_min, "days":[0,1,2,3,4,5,6], "enabled": enable,"repeart":10} + count+=1 + if count > len(alarm_list): + new = 1 + # print("self.alarm_list:5555 {}".format(alarm_list)) + break + else:#添加最新的 + count+=1 + if tmp == 2 or tmp == 3 or tmp == 4:#添加最新的 + msg_tmp = EventMesh.publish("get_boot_off_time") + # print("msg_tmp all_data {}".format(msg_tmp)) + if msg_tmp != None: + if len(msg_tmp[0]) > 0:#只有关机时间长度为0时才添加新元素 不是就覆盖原来旧的数据 + # print("self.alarm_list:444444 {}".format(alarm_list)) + if count > len(alarm_list): + new = 1 + continue + else: + alarm_list.append({"idx": num, "hour": start_hour, "minute": start_min, "days":[0,1,2,3,4,5,6], "enabled": enable,"repeart":10}) + # print("self.alarm_list:7777777 {}".format(alarm_list)) + if count > len(alarm_list): + new = 1 + break + count+=1 + # print("self.alarm_list:111111 {}".format(alarm_list)) + + else:#添加最新的 + alarm_list.append({"idx": num, "hour": start_hour, "minute": start_min, "days":[0,1,2,3,4,5,6], "enabled": enable,"repeart":10}) + new = 1 + num+=1 + # print("add_here-----idx:{} msg:{} alarm_list:{}".format(idx,msg,alarm_list)) + + + print("alarm_list----len- :{}".format(len(alarm_list))) + with open("/usr/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd: + ujson.dump(alarm_list,fd) + EventMesh.publish("push_update_alarm_show") + + + + + + def remove_alarm(self, event, msg): + global alarm_list + print("ddddddddddddddddddd:",msg) + idx = msg.get("idx") + print("delete_here1-----{},{}:".format(idx,msg)) + + for i, alarm in enumerate(alarm_list): + print("delete_here2-----{},{}:".format(i,alarm)) + + if alarm["idx"] == idx: + del alarm_list[i] + print("delete_here3-----",alarm_list) + + #删除闹钟后,对idx重新排序 + if alarm_list: + for j in range(i,len(alarm_list)): + alarm_list[j]["idx"] -= 1 + print("delete_here4-----",alarm_list) + + with open("/usr/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd: + ujson.dump(alarm_list,fd) + + + def get_alarm_indx(self,event,msg): + return self.idx + + def _rtc_callback(self,args): + print("---!!!!!!alarm_ring!!!!!!!---,idx:",args) + global alarm_list + EventMesh.publish("read_alarminjson") + idx = self.idx + print("单次闹钟关闭:{} alarm_list:{}".format(idx,alarm_list)) + #判断是否是单次闹钟,如果是,则将开关状态设置为关闭 + # for i in range(len(alarm_list)): + # if alarm_list[i]["idx"] == self.idx: + # idx = i + if not alarm_list[idx]["days"] : + print("关闭1:",alarm_list[idx]["days"]) + print("关闭2:",alarm_list [idx]["days"]) + alarm_list[idx]["enabled"] = False + with open("/usr/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd: + ujson.dump(alarm_list,fd) + EventMesh.publish("set_rtc_alarm") + #设置下一个闹钟,定时开关机功能 + if 0 : + msg_data = EventMesh.publish("get_boot_off_time") + print("msg_tmp:{}".format(msg_data)) + + msg_tmp = msg_data[0] + off_tmp2 = msg_tmp[2] + msg_tmp2 = off_tmp2.split(':') + end_min = int(msg_tmp2[0])*60+int(msg_tmp2[1]) + + rtc_now_time = self.rtc.datetime() + current = rtc_now_time[4]*60+rtc_now_time[5] + + print("end_min:{} current:{} off_tmp2:{}".format(end_min,current,off_tmp2)) + if end_min == current:#结束的时间分钟等于关机时间分钟数则关机 + # EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"}) + return + + + + # 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("OPEN_ALARM_RING")#闹钟到点响铃 + # EventMesh.publish("load_screen", {"screen": "popup_alarm"}) + # def _reset_rtc_alarm_time(self, args): + # print("---alarm_ring---") + + def set_rtc_alarm(self,event,msg): + global alarm_list + EventMesh.publish("read_alarminjson") + rtc_now_time = self.rtc.datetime() + + # print("00获取所有闹钟信息:{}".format(alarm_list)) + new_alarm_list = [(alarm['hour'], alarm['minute'], alarm['days'],alarm["idx"]) for alarm in alarm_list if alarm['enabled']] + + print("01获取开启的闹钟:{}".format(new_alarm_list)) + start_day = 0 # 周日 + start_minute = 0 # 0点 + end_minute = 60*24*7 + minute_list = [] + + if not new_alarm_list: + print("02当前并没有开启的闹钟,退出闹钟设置程序:{}".format(new_alarm_list)) + self.rtc.enable_alarm(0) + return + + for alarm in new_alarm_list: + hour, minute, days,idx = alarm + #如果没有选择day,则表示是单次闹钟 + if days: + for day in days: + minute_list.append(hour*60 + minute + (day-start_day)*24*60) + + else: + #如果当前时间没超过闹钟设置时间,则设置为今天,否则设置为明天 + if (hour*60 + minute) > (rtc_now_time[4]*60 + rtc_now_time[5]): + minute_list.append(hour*60 + minute + (rtc_now_time[3]-start_day)*24*60) + print("设置单次闹钟:{}".format(new_alarm_list)) + + else: + minute_list.append(hour*60 + minute + (rtc_now_time[3]-start_day+1)*24*60) + + total_minutes = sorted(minute_list) + print("02以周日00:00为起点,计算所有开启闹钟的total_min并排序:{}".format(total_minutes)) + + #获取当前时间 (2020, 9, 11, 5, 15, 43, 23, 0) + # rtc_now_time = (2020, 9, 11, 6, 11, 43, 23, 0) + # rtc_now_time = self.rtc.datetime() + + print("03当前的rtc时间:{}".format(rtc_now_time)) + + current_minute = rtc_now_time[4]*60 + rtc_now_time[5] + (rtc_now_time[3]-start_day)*24*60 + print("04当前的rtc_total_minutes:{}".format(current_minute)) + + if current_minute in minute_list: + print("当前时间和闹钟列表时间重复,删除重复的时间") + minute_list.remove(current_minute) + + minute_list.append(current_minute) + + # 对分钟数列表进行排序,并获取当前时间分钟数所在的位置 + minute_list = sorted(minute_list) + current_index = minute_list.index(current_minute) + + print("05将当前时间插入min_list后的min_list:{}".format(minute_list)) + print("06当前时间所在位置:{}".format(current_index)) + + next_index = current_index + 1 + if next_index >= len(minute_list): + next_minute = minute_list[0] + print("07下一个闹钟的分钟数:", next_minute) + else: + next_minute = minute_list[next_index] + print("07下一个闹钟的分钟数:", next_minute) + + if next_minute >= current_minute: + interval_minute = next_minute - current_minute + print("08距离下一次响铃的的分钟数:", interval_minute) + else: + interval_minute = end_minute - current_minute + next_minute + print("08距离下一次响铃的的分钟数:", interval_minute) + + #反向获取时间戳 + time = utime.localtime() + print("09获取utime的时间戳:", time) + rtc_mktime = utime.mktime(time) + print("10反向获取utime的mktime:", rtc_mktime) + + #加上下一次响铃需要的时间 + next_alarm_mktime = rtc_mktime + interval_minute*60 + print("11下一次响铃的mktime:", next_alarm_mktime) + + #格式化时间戳,得到下一次闹钟的时间 + next_alarm_time = utime.localtime(next_alarm_mktime) + print("12下一次响铃的准确时间:", next_alarm_time) + #将时间转换为rtc的格式 + data_l = [2021, 7, 9, 5, 12, 30, 0, 0] + #给rtc时间赋值 + data_l[0] = next_alarm_time[0] #year + data_l[1] = next_alarm_time[1] #month + data_l[2] = next_alarm_time[2] #day + data_l[4] = next_alarm_time[3] #hour + data_l[5] = next_alarm_time[4] #minute + #转换为元组 + data_e=tuple(data_l) + print("13将该时间转换为RTC元组:", data_e) + + for alarm in alarm_list: + if not alarm["days"] and alarm["enabled"]: + print("关闭666:",alarm["idx"]) + if alarm["hour"] == data_l[4] and alarm["minute"]==data_l[5]: + self.idx = alarm["idx"] + #设置rtc闹钟时间 + self.rtc.register_callback(self._rtc_callback) + + FLAG = self.rtc.set_alarm(data_e) + if FLAG == 0: + print("14成功设置rtc的到期时间:", data_e) + else: + print("14设置rtc的到期时间失败:", data_e) + + self.rtc.enable_alarm(1) + - \ No newline at end of file diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/protocol.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/protocol.py index c742273b..0d7aa643 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/protocol.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/protocol.py @@ -781,39 +781,72 @@ class REMIND_ProtoCol(ProtoCol): alarm_new = EventMesh.publish("read_alarminjson") # print("alarm_list:{} msg_tmp:{}",alarm_new,msg_tmp) - - k=0 - if len(alarm_new) < 5 : - alarm_new = [] - for i in range(5): - alarm_new.append({'hour': 16, 'repeart': 1, 'idx': i, 'enabled': 0, 'days': [], 'minute': 39}) - for j in range(2,5):#0 1是开关机,234是闹钟 + k=1 + count = 0 + + for i in range(len(str(msg_tmp))):#寻找有多少个,号 + if msg_tmp[i] == ',':#, , , + k+=1 + # if len(alarm_new) < 5 : + # alarm_new = [] + # for i in range(5): + # alarm_new.append({'hour': 8, 'repeart': 10, 'idx': i, 'enabled': 0, 'days': [], 'minute': 39}) + # print("len",len(alarm_new),alarm_new) + if len(alarm_new) > 2: + for i in range(0,len(alarm_new)-2): + # print("alarm_new_tmp",alarm_new) + del alarm_new[2] + # print("alarm_new:{}",alarm_new) + for j in range(2,2+k):#0 1是开关机,234是闹钟 alarm_day = [] alarm_week = [] alarm_total_data = [] - alarm_total_data = msg_tmp.split(',')[k] - k+=1 - b = alarm_total_data.find('-') - if b != -1: - alarm_data = 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: - alarm_week = alarm_data[3]#星期 - - if alarm_day_num == 2:#每一天 - alarm_day = [1,2,3,4,5,6,0] - elif alarm_day_num == 3:#自定义 - for i in range(0,7): - if alarm_week[i] != '0': - alarm_day.append(i) - alarm_new[j] = {"idx": j, "hour": alarm_time_hour, "minute": alarm_time_min, "days":alarm_day, "enabled": alarm_switch,"repeart":alarm_day_num} - - # print("self.alarm_list: {}".format(alarm_new)) + # print("j!!!!!!!!!!",j) + if k == 1: + if len(msg_tmp) != 0: + alarm_data = msg_tmp.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: + alarm_week = alarm_data[3]#星期 + + if alarm_day_num == 2:#每一天 + alarm_day = [1,2,3,4,5,6,0] + elif alarm_day_num == 3:#自定义 + for i in range(0,7): + if alarm_week[i] != '0': + alarm_day.append(i) + alarm_new.append({"idx": j, "hour": alarm_time_hour, "minute": alarm_time_min, "days":alarm_day, "enabled": alarm_switch,"repeart":alarm_day_num}) + else: + if len(msg_tmp) != 0: + alarm_total_data = msg_tmp.split(',')[count] + count+=1 + b = alarm_total_data.find('-') + if b != -1: + alarm_data = 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: + alarm_week = alarm_data[3]#星期 + + if alarm_day_num == 2:#每一天 + alarm_day = [1,2,3,4,5,6,0] + elif alarm_day_num == 3:#自定义 + for i in range(0,7): + if alarm_week[i] != '0': + alarm_day.append(i) + alarm_new.append({"idx": j, "hour": alarm_time_hour, "minute": alarm_time_min, "days":alarm_day, "enabled": alarm_switch,"repeart":alarm_day_num}) + + # print("alarm_new end:{}",alarm_new) + with open("/usr/static/storage_file/alarm_msg.json", 'w',encoding='utf-8') as fd: ujson.dump(alarm_new,fd) EventMesh.publish("push_update_alarm_show") @@ -821,6 +854,9 @@ class REMIND_ProtoCol(ProtoCol): # EventMesh.publish("add_alarm",[0,msg_tmp]) EventMesh.publish(constants.PROTOCOL.REMIND_SEND) + + + class HRSTART_ProtoCol(ProtoCol): """心率频率数据""" TYPE = "hrtstart" @@ -1132,15 +1168,25 @@ class MONITOR_ProtoCol(ProtoCol): @param msg: 接收到的下行数据 """ # b'[SZKW*867387060319166*000A*MONITOR]' - read_data = EventMesh.publish("get_storage_config","center_dial") - print("MONITOR:data:%s"%(read_data)) - if read_data != None: - contact = read_data - if len(contact) > 0: - print("MONITOR RECV msg:{} {}".format(contact,type(contact))) - EventMesh.publish("save_phonename", contact) - EventMesh.publish("save_phonenum", contact) - EventMesh.publish("dial_out_call_center_cb",contact)#电话拨出去 + msg = msg[1:-1] + msg_tmp = msg.decode('ascii') + msg_tmp = msg_tmp.split('MONITOR') + msg_tmp = msg_tmp[1] + print("MONITOR_ProtoCol RECV msg:{} msg_:{}".format(msg,len(msg_tmp))) + if len(msg_tmp) != 0: + EventMesh.publish("save_phonename", contact) + EventMesh.publish("save_phonenum", contact) + EventMesh.publish("dial_out_call_center_cb",contact)#电话拨出去 + else: + read_data = EventMesh.publish("get_storage_config","center_dial") + print("MONITOR:data:%s"%(read_data)) + if read_data != None: + contact = read_data + if len(contact) > 0: + print("MONITOR RECV msg:{} {}".format(contact,type(contact))) + EventMesh.publish("save_phonename", contact) + EventMesh.publish("save_phonenum", contact) + EventMesh.publish("dial_out_call_center_cb",contact)#电话拨出去 EventMesh.publish(constants.PROTOCOL.MONITOR_SEND) #定时开关机 @@ -1423,7 +1469,7 @@ class TK_ProtoCol(ProtoCol): get_wechat_data = EventMesh.publish("get_wechat_data") MXA_MSG = get_wechat_data[0] wechat_recode_list = get_wechat_data[1] - wechat_num = wechat_recode_list["num"] + wechat_num = int(wechat_recode_list["num"]) # Wechat_log("TK_ProtoCol:datalen:{} {} {}".format(wechat_num,MXA_MSG,wechat_recode_list)) if wechat_num >= MXA_MSG: @@ -1468,6 +1514,7 @@ class TK_ProtoCol(ProtoCol): break fd.write(arm) EventMesh.publish(constants.PROTOCOL.TK_SEND,1) + EventMesh.publish("recv_wechat_audio")# @@ -1532,6 +1579,7 @@ class MESSAGE_ProtoCol(ProtoCol): # else: # EventMesh.publish("wechat_updata_list_show") EventMesh.publish(constants.PROTOCOL.MESSAGE_SEND) + # EventMesh.publish("recv_wechat_audio")# class ProtoColResolver(object): diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/ui.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/ui.py index 0f3463a3..c31b85b0 100644 --- a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/ui.py +++ b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/ui.py @@ -31,6 +31,30 @@ CALL_LOG_MAX = 50 aud = audio.Audio(0) aud.setCallback(audio_cb) +def msg_cb(args): + index = args[1] + storage = args[2] + print("index:{}".format(index)) + sms_data = sms.getSaveLoc() + sms_max = sms_data[0][2] + if index != -1: + tmp = sms.searchTextMsg(index) + detail = tmp[1]#内容 + print("msg_cb:detail {}".format,detail) + if detail.find("SETIP:") != -1:#寻找是否有这个字符串 + tmp_test = detail.split("SETIP:")[1] + if tmp_test.find(":") != -1: + new_ip = tmp_test.split(':')[0] + # print("tmp_test:{} new_ip:{}".format(tmp_test,new_ip)) + new_com = tmp_test.split(':')[1] + # new_md5 = detail.split(':')[3] + if len(new_ip) > 0 and len(new_com) > 0: + EventMesh.publish("set_new_ip", [new_ip,new_com,tmp[0]])#设置关机时间 + # EventMesh.publish("set_new_ip", [new_ip,new_com,new_md5])#设置关机时间 + + if index >= sms_max-1:#删除短信 + EventMesh.publish("delete_sms_event")#删除短信 +sms.setCallback(msg_cb) import audio from machine import Pin diff --git a/2.sdk/project/D10/usr/static/audio.bin b/2.sdk/project/D10/usr/static/audio.bin index d18e50bc..c4c3aaae 100644 Binary files a/2.sdk/project/D10/usr/static/audio.bin and b/2.sdk/project/D10/usr/static/audio.bin differ diff --git a/2.sdk/project/D10/usr/static/storage_file/wechat_record.json b/2.sdk/project/D10/usr/static/storage_file/wechat_record.json index 3c028156..acd65639 100644 --- a/2.sdk/project/D10/usr/static/storage_file/wechat_record.json +++ b/2.sdk/project/D10/usr/static/storage_file/wechat_record.json @@ -1 +1 @@ -{ "a": "1" } \ No newline at end of file +{ "num": "0" } \ No newline at end of file diff --git a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/protocol.py b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/protocol.py index 9a0a1271..e94509f9 100644 --- a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/protocol.py +++ b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/protocol.py @@ -849,6 +849,12 @@ class REMIND_ProtoCol(ProtoCol): # EventMesh.publish("add_alarm",[0,msg_tmp]) EventMesh.publish(constants.PROTOCOL.REMIND_SEND) + + + + + + class HRSTART_ProtoCol(ProtoCol): """心率频率数据""" TYPE = "hrtstart" @@ -1559,7 +1565,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']}) diff --git a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui.py b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui.py index 71ff5a8d..18426463 100644 --- a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui.py +++ b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui.py @@ -2149,7 +2149,7 @@ class PopupScreen(Screen): self.sms_detail_list_dict[i]["_btn_label5"].set_size(LCD_X-15, 20) self.sms_detail_list_dict[i]["_btn_label5"].set_text(title1) self.sms_detail_list_dict[i]["_btn_label5"].set_long_mode(lv.label.LONG.DOT) - # self.sms_detail_list_dict[i]["_btn_label5"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + self.sms_detail_list_dict[i]["_btn_label5"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) self.sms_detail_list_dict[i]["msg_btn"].clear_flag(lv.obj.FLAG.HIDDEN) #if msg == 1: diff --git a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_main_menu.py b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_main_menu.py index 04a64870..1f3d46b4 100644 --- a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_main_menu.py +++ b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_main_menu.py @@ -215,27 +215,27 @@ MainMenu2x+=1 # MainMenu2x+=1 #视频通话 -MainMenu2_camera_video = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) -label_text = lv.label(MainMenu2_camera_video) -label_text.set_pos(0, 0) -label_text.set_size(0, 0) -label_text.set_text("{}".format(MainMenu2_num)) -MainMenu2_img_camera_video = lv.img(MainMenu2_camera_video) -MainMenu2_img_camera_video.set_size(80,80) -MainMenu2_img_camera_video.set_pos(24,10) -MainMenu2_img_camera_video.set_src("U:/static/IMAGE_ONE_PAGE_VIDEOCALL.png") -MainMenu2_img_camera_video.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu2_img_camera_video.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - -MainMenu2_img_camera_video_txt = lv.label(MainMenu2_camera_video) -MainMenu2_img_camera_video_txt.set_pos(int(0),int(100)) -MainMenu2_img_camera_video_txt.set_size(128,20) -MainMenu2_img_camera_video_txt.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu2_img_camera_video_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu2_img_camera_video_txt.set_text("视频通话") -MainMenu2_img_camera_video_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT) -MainMenu2_num+=1 -MainMenu2x+=1 +# MainMenu2_camera_video = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) +# label_text = lv.label(MainMenu2_camera_video) +# label_text.set_pos(0, 0) +# label_text.set_size(0, 0) +# label_text.set_text("{}".format(MainMenu2_num)) +# MainMenu2_img_camera_video = lv.img(MainMenu2_camera_video) +# MainMenu2_img_camera_video.set_size(80,80) +# MainMenu2_img_camera_video.set_pos(24,10) +# MainMenu2_img_camera_video.set_src("U:/static/IMAGE_ONE_PAGE_VIDEOCALL.png") +# MainMenu2_img_camera_video.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu2_img_camera_video.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) + +# MainMenu2_img_camera_video_txt = lv.label(MainMenu2_camera_video) +# MainMenu2_img_camera_video_txt.set_pos(int(0),int(100)) +# MainMenu2_img_camera_video_txt.set_size(128,20) +# MainMenu2_img_camera_video_txt.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu2_img_camera_video_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# MainMenu2_img_camera_video_txt.set_text("视频通话") +# MainMenu2_img_camera_video_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT) +# MainMenu2_num+=1 +# MainMenu2x+=1 # #相机 # MainMenu2_camera = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) @@ -349,7 +349,7 @@ class MainMenuScreen(Screen): MainMenu2_img_phone.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.CLICKED, None) MainMenu2_img_toolbox.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.CLICKED, None) MainMenu2_img_setting.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.CLICKED, None) - MainMenu2_img_camera_video.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera_video")), lv.EVENT.CLICKED, None) + # MainMenu2_img_camera_video.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera_video")), lv.EVENT.CLICKED, None) # MainMenu2_img_camera.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera")), lv.EVENT.CLICKED, None) # MainMenu2_img_camera_album.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera_album")), lv.EVENT.CLICKED, None) MainMenu2_img_contacts.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "contacts")), lv.EVENT.CLICKED, None)