From: dxy15521469561 <1731678236@qq.com> Date: Mon, 18 Sep 2023 03:09:43 +0000 (+0800) Subject: D10: X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=d66b467eaf0bac1bca154d62c6988608f214441d;p=mirrors%2FASR1603_G5.git D10: 修改按键 --- 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 58d7b95f..441b4d6f 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 @@ -620,7 +620,7 @@ class intervManager(Abstract): self.power_on_flag = 1 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("set_led_time_arg",[1,2,4*10,led_mode.FLASH_LIGHT_GREEN,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功 + EventMesh.publish("set_led_time_arg",[1,2,4*8,led_mode.FLASH_LIGHT_GREEN,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功 # EventMesh.publish("set_led_time_arg",[1000,200,10,led_mode.FLASH_LIGHT_GREEN,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#设置参数 self.power_on_flag = 0 self.pwk_timer.start(5000,0,self.power_on_cb) @@ -638,7 +638,7 @@ class intervManager(Abstract): 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*10,led_mode.FLASH_LIGHT_RED,4,2,led_mode.OTHER_MEASURE_MODE])# + EventMesh.publish("set_led_time_arg",[1,2,4*8,led_mode.FLASH_LIGHT_RED,4,2,led_mode.OTHER_MEASURE_MODE])# self.power_off = 1 # EventMesh.publish("set_led_time_arg",[1000,200,10,led_mode.FLASH_LIGHT_RED,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])# self.timer.start(6000,0,self.publish_power_down_event_cb) @@ -1567,7 +1567,7 @@ class BtnDevice(Abstract): # 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) + # print("self.self.pwkey_count!!!!!!!!!!!!!!",self.pwkey_count) if self.pwkey_count >= 10*10: self.pwkey_timer.stop() self.pwkey_count = 0 @@ -1596,7 +1596,7 @@ class BtnDevice(Abstract): self.pwkey_press = 0 self.led_state = 0 self.pwKey_press_count+=1 - self.pwkey_timer.start(600, 0, self.pwKey_timeout_cb)#松手超时1s判断 + self.pwkey_timer.start(500, 0, self.pwKey_timeout_cb)#松手超时1s判断 else: self.pwkey_timer.stop() self.pwkey_count = 0 @@ -1661,7 +1661,7 @@ class BtnDevice(Abstract): self.sosKey_count = 0 self.sosKey_press = 0 self.sosKey_press_count+=1 - self.sosKey_timer.start(600, 0, self.sosKey_timeout_cb)#松手超时1s判断 + self.sosKey_timer.start(500, 0, self.sosKey_timeout_cb)#松手超时1s判断 else: self.sosKey_timer.stop() self.sosKey_count = 0 @@ -1777,7 +1777,13 @@ class BtnDevice(Abstract): EventMesh.publish("start_wechat_record")#开始录音 self.wechat_state = 0 else: + self.wechat_state = 0 + self.wechatKey_timer.stop() + self.wechatKey_count = 0 + self.wechatKey_press = 0 + self.wechatKey_press_count=0 EventMesh.publish("set_sim_mode")#播報imei号 + return if self.WeChatKey_status == 0:#未松手超过15s啧停止录音 if self.wechat_state == 0: @@ -1821,7 +1827,7 @@ class BtnDevice(Abstract): self.wechatKey_count = 0 self.wechatKey_press = 0 self.wechatKey_press_count+=1 - self.wechatKey_timer.start(600, 0, self.wechatKey_timeout_cb)#松手超时1s判断 + self.wechatKey_timer.start(500, 0, self.wechatKey_timeout_cb)#松手超时1s判断 else: self.wechatKey_timer.stop() self.wechatKey_count = 0 diff --git a/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py b/2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py index 46a07883..f22eb339 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 @@ -951,19 +951,28 @@ class DeviceInfoManager(Abstract): self.bat_time = 0 """未联网提示关机""" - if EventMesh.publish(constants.EVENT.GET_CONNECT) == 0:#未联网提示关机 - if battery[0] == "0": - self.no_smi_count+=10 - if self.no_smi_count > (15*60) and self.no_smi_state == 0: + ble=EventMesh.publish(constants.EVENT.GET_CONNECT) + # print("ble",ble) + if ble == 0:#未联网提示关机 + usb_state = EventMesh.publish("get_usb_state")# + # print("usb_state",usb_state) + if usb_state != None: + if usb_state == 0 or usb_state == 2: + self.no_smi_count+=10 + print("self.no_smi_count",self.no_smi_count) + if self.no_smi_count > (15*60): + self.no_smi_count = 0 + EventMesh.publish("open_power_on", 2)# #未检测到sim卡15分钟后关机 + else: self.no_smi_count = 0 - self.no_smi_state = 1 - EventMesh.publish("long_press_power_off") #未检测到sim卡15分钟后关机 - else: - self.no_smi_count = 0 - self.no_smi_state = 0 + + if self.no_smi_state < 6: + self.no_smi_state+=1 + if self.no_smi_state >= 6:#开机一分钟后提示未检测到sim卡 + EventMesh.publish("sim_no_cb")#未插卡 + else: self.no_smi_count = 0 - self.no_smi_state = 0 # if battery[0] == "1": # if battery[1] >= 100: # if self.charge_full_count > 60 and self.charge_full_count % (60*10) == 0:#每十分钟提醒一次 @@ -1584,21 +1593,22 @@ class DeviceInfoManager(Abstract): EventMesh.publish("play_unread_wechat_infor")#每10s检测是否有未读语音数据 - if battery[0] == "1": - if battery[1] >= 100:#充电已满 - if self.charge_full_count == 0: - EventMesh.publish("set_usb",3)# - print("charge R_CHARGE_full") - self.charge_full_count = 1 + usb_state = EventMesh.publish("get_usb_state")# + if usb_state != None: + if usb_state == 1 or usb_state == 3: + if battery[1] >= 100:#充电已满 + if self.charge_full_count == 0: + EventMesh.publish("set_usb_state",3)# + print("charge R_CHARGE_full") + self.charge_full_count = 1 + else: + self.charge_full_count = 0 else: self.charge_full_count = 0 - else: - 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",[1000,400,52,led_mode.FLASH_LIGHT_RED,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#開始測量 - + 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",[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) diff --git a/2.sdk/project/S6/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py b/2.sdk/project/S6/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py index daae5bd4..391e4adb 100644 --- a/2.sdk/project/S6/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py +++ b/2.sdk/project/S6/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py @@ -111,6 +111,9 @@ class intervManager(Abstract): EventMesh.subscribe("dial_sos_phone", self.dial_sos_phone)#长按3s拨打sos求助号码 EventMesh.subscribe("set_sim_mode", self.set_sim_mode)#sim检测 + EventMesh.subscribe("sim_falied_cb", self.sim_falied_cb)##识别卡未联网 + EventMesh.subscribe("sim_connect_cb", self.sim_connect_cb)#识别已联网 + EventMesh.subscribe("sim_no_cb", self.sim_no_cb)#未插卡 EventMesh.subscribe("close_hr_sop2", self.close_hr_sop2)#关闭健康测试 EventMesh.subscribe("set_manual_measure_mode", self.set_manual_measure_mode)#设置测试模式 @@ -124,7 +127,7 @@ class intervManager(Abstract): EventMesh.subscribe("set_usb_state", self.set_usb_state)# - EventMesh.subscribe("get_usb", self.get_usb_state)# + EventMesh.subscribe("get_usb_state", self.get_usb_state)# EventMesh.subscribe("play_cur_step_event", self.play_cur_step_event)# @@ -612,7 +615,7 @@ class intervManager(Abstract): self.power_on_flag = 1 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("set_led_time_arg",[1,2,4*10,led_mode.FLASH_LIGHT_GREEN,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功 + EventMesh.publish("set_led_time_arg",[1,2,4*8,led_mode.FLASH_LIGHT_GREEN,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功 # EventMesh.publish("set_led_time_arg",[1000,200,10,led_mode.FLASH_LIGHT_GREEN,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#设置参数 # msg 0马达使能 1 马达振动时间100ms单位 2 震动次数 3 间隔时间振动 4 是否需要长振 5 长振时间 6长振次数1一次 EventMesh.publish("set_motor_time",[1,2,4,4,2])#设置马达参数 @@ -632,7 +635,7 @@ class intervManager(Abstract): EventMesh.publish("set_storage_config",["old_timesecond",date_tmp])#关机保存一个是时间 EventMesh.publish("set_motor_time",[1,2,4,4,2])#设置马达参数 - EventMesh.publish("set_led_time_arg",[1,2,4*10,led_mode.FLASH_LIGHT_RED,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功 + EventMesh.publish("set_led_time_arg",[1,2,4*8,led_mode.FLASH_LIGHT_RED,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功 self.power_off = 1 # EventMesh.publish("set_led_time_arg",[1000,200,10,led_mode.FLASH_LIGHT_RED,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])# self.timer.start(10000,0,self.publish_power_down_event_cb) @@ -915,16 +918,18 @@ class intervManager(Abstract): else:#未插卡 mode = 3 if mode == 1:#蓝灯色灯 - EventMesh.publish("set_led_time_arg",[1,1,6,led_mode.FLASH_LIGHT_WHITE,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功 + # EventMesh.publish("set_led_time_arg",[1000,400,1,led_mode.FLASH_LIGHT_WHITE,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#设置参数 str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_SIM_FAILE")) EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data) + EventMesh.publish("set_led_time_arg",[1,1,6,led_mode.FLASH_LIGHT_WHITE,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功 pass elif mode == 2:#绿色灯 - EventMesh.publish("set_led_time_arg",[1,1,6,led_mode.FLASH_LIGHT_GREEN,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功 + # EventMesh.publish("set_led_time_arg",[1000,400,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_SIM_CONNECT")) EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data) + EventMesh.publish("set_led_time_arg",[1,1,6,led_mode.FLASH_LIGHT_GREEN,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功 pass elif mode == 3:#红灯闪烁 str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_NO_SIM")) @@ -933,6 +938,22 @@ class intervManager(Abstract): # EventMesh.publish("set_led_time_arg",[1000,400,1,led_mode.FLASH_LIGHT_RED,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#设置参数 pass pass + def sim_falied_cb(self, event, msg):#识别卡未联网 + # EventMesh.publish("set_led_time_arg",[1000,400,1,led_mode.FLASH_LIGHT_WHITE,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#设置参数 + str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_SIM_FAILE")) + EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data) + EventMesh.publish("set_led_time_arg",[1,1,6,led_mode.FLASH_LIGHT_WHITE,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功 + pass + def sim_connect_cb(self, event, msg):#正常已联网 + str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_SIM_CONNECT")) + EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data) + EventMesh.publish("set_led_time_arg",[1,1,6,led_mode.FLASH_LIGHT_GREEN,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功 + pass + def sim_no_cb(self, event, msg):#未检测到SIM卡 + str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_NO_SIM")) + EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data) + EventMesh.publish("set_led_time_arg",[1,1,6,led_mode.FLASH_LIGHT_RED,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功 + pass def dial_sos_phone(self, event, msg): #拨打紧急求助电话 flag = EventMesh.publish("get_call_state") @@ -1600,7 +1621,7 @@ class BtnDevice(Abstract): self.pwkey_press = 0 self.led_state = 0 self.pwKey_press_count+=1 - self.pwkey_timer.start(600, 0, self.pwKey_timeout_cb)#松手超时1s判断 + self.pwkey_timer.start(500, 0, self.pwKey_timeout_cb)#松手超时1s判断 else: self.pwkey_timer.stop() self.pwkey_count = 0 @@ -1665,7 +1686,7 @@ class BtnDevice(Abstract): self.sosKey_count = 0 self.sosKey_press = 0 self.sosKey_press_count+=1 - self.sosKey_timer.start(600, 0, self.sosKey_timeout_cb)#松手超时1s判断 + self.sosKey_timer.start(500, 0, self.sosKey_timeout_cb)#松手超时1s判断 else: self.sosKey_timer.stop() self.sosKey_count = 0 @@ -1777,7 +1798,13 @@ class BtnDevice(Abstract): EventMesh.publish("start_wechat_record")#开始录音 self.wechat_state = 0 else: + self.wechat_state = 0 + self.wechatKey_timer.stop() + self.wechatKey_count = 0 + self.wechatKey_press = 0 + self.wechatKey_press_count=0 EventMesh.publish("set_sim_mode")#播報imei号 + return if self.WeChatKey_status == 0:#未松手超过15s啧停止录音 if self.wechat_state == 0: @@ -1820,7 +1847,7 @@ class BtnDevice(Abstract): self.wechatKey_count = 0 self.wechatKey_press = 0 self.wechatKey_press_count+=1 - self.wechatKey_timer.start(600, 0, self.wechatKey_timeout_cb)#松手超时1s判断 + self.wechatKey_timer.start(500, 0, self.wechatKey_timeout_cb)#松手超时1s判断 else: self.wechatKey_timer.stop() self.wechatKey_count = 0 diff --git a/2.sdk/project/S6/sdk/services/microPython/ports/quectel/core/led.py b/2.sdk/project/S6/sdk/services/microPython/ports/quectel/core/led.py index ee31216a..66be3cbe 100644 --- a/2.sdk/project/S6/sdk/services/microPython/ports/quectel/core/led.py +++ b/2.sdk/project/S6/sdk/services/microPython/ports/quectel/core/led.py @@ -315,7 +315,7 @@ class ledEventManager(Abstract):#灯事件 if open_power != None: if open_power == 0: return - usb_in = EventMesh.publish("get_usb")# + usb_in = EventMesh.publish("get_usb_state")# # print("usb_in",usb_in) if usb_in != None: if usb_in == 1 or usb_in == 3:#正在充电或者充电已满都不要被打断 @@ -542,7 +542,7 @@ class ledEventManager(Abstract):#灯事件 def close_all_led(self, event, msg): print("close_all_led!!!!") - usb_in = EventMesh.publish("get_usb")# + usb_in = EventMesh.publish("get_usb_state")# if usb_in != None: if usb_in == 1 or usb_in == 3:#正在充电或者充电已满都不要被打断 self.timer_state = 0 diff --git a/2.sdk/project/S6/sdk/services/microPython/ports/quectel/core/mgr.py b/2.sdk/project/S6/sdk/services/microPython/ports/quectel/core/mgr.py index a3b5aaac..0411741f 100644 --- a/2.sdk/project/S6/sdk/services/microPython/ports/quectel/core/mgr.py +++ b/2.sdk/project/S6/sdk/services/microPython/ports/quectel/core/mgr.py @@ -953,19 +953,29 @@ class DeviceInfoManager(Abstract): self.bat_time = 0 """未联网提示关机""" - if EventMesh.publish(constants.EVENT.GET_CONNECT) == 0:#未联网提示关机 - if battery[0] == "0": - self.no_smi_count+=10 - if self.no_smi_count > (15*60) and self.no_smi_state == 0: + ble=EventMesh.publish(constants.EVENT.GET_CONNECT) + print("ble",ble) + if ble == 0:#未联网提示关机 + + usb_state = EventMesh.publish("get_usb_state")# + print("usb_state",usb_state) + if usb_state != None: + if usb_state == 0 or usb_state == 2: + self.no_smi_count+=10 + print("self.no_smi_count",self.no_smi_count) + if self.no_smi_count >= (15*60): + self.no_smi_count = 0 + EventMesh.publish("open_power_on", 2)# #未检测到sim卡15分钟后关机 + else: self.no_smi_count = 0 - self.no_smi_state = 1 - EventMesh.publish("long_press_power_off") #未检测到sim卡15分钟后关机 - else: - self.no_smi_count = 0 - self.no_smi_state = 0 + + if self.no_smi_state < 6: + self.no_smi_state+=1 + if self.no_smi_state >= 6:#开机一分钟后提示未检测到sim卡 + EventMesh.publish("sim_no_cb")#未插卡 + else: self.no_smi_count = 0 - self.no_smi_state = 0 # if battery[0] == "1": # if battery[1] >= 100: # if self.charge_full_count > 60 and self.charge_full_count % (60*10) == 0:#每十分钟提醒一次 @@ -1587,20 +1597,22 @@ class DeviceInfoManager(Abstract): # EventMesh.publish("play_unread_wechat_infor")#每10s检测是否有未读语音数据 - if battery[0] == "1": - if battery[1] >= 100:#充电已满 - if self.charge_full_count == 0: - EventMesh.publish("set_usb_state",3)# - print("charge R_CHARGE_full") - self.charge_full_count = 1 + usb_state = EventMesh.publish("get_usb_state")# + if usb_state != None: + if usb_state == 1 or usb_state == 3: + if battery[1] >= 100:#充电已满 + if self.charge_full_count == 0: + EventMesh.publish("set_usb_state",3)# + print("charge R_CHARGE_full") + self.charge_full_count = 1 + else: + self.charge_full_count = 0 else: self.charge_full_count = 0 - else: - 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",[1000,400,52,led_mode.FLASH_LIGHT_RED,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#開始測量 + 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",[1000,400,52,led_mode.FLASH_LIGHT_RED,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#開始測量 # self.charge_full_count+=1