self.PIN_BT_ON =Pin(Pin.GPIO31, Pin.OUT, Pin.PULL_DISABLE, 1)
#马达
self.PIN_MOT=Pin(Pin.GPIO36, Pin.OUT, Pin.PULL_DISABLE, 1)
- utime.sleep_ms(1000)
+ utime.sleep_ms(500)
self.PIN_MOT=Pin(Pin.GPIO36, Pin.OUT, Pin.PULL_DISABLE, 0)
self.extint_wakeup_cta1_timer = osTimer()
print("sys_sleep_cb!!!!!!!!!!!!!!!")
print("sys_sleep_cb!!!!!!!!!!!!!!!")
print("sys_sleep_cb!!!!!!!!!!!!!!!")
+ EventMesh.publish("sleep_BT")#休眠蓝牙
self.PIN_wakeup_bt.write(0)
def sys_up_cb(self,event=None,msg=None):#唤醒前回调
print("sys_up_cb!!!!!!!!!!!!!!!")
self.pwk_key_timer.stop()
self.pwk_key_timer_count = 0
self.pwk_key_press = 0
+
except Exception as e:
usys.print_exception(e)
def pwk_key_release(self, event, msg):#电源键短按,关闭
print("pwk_key_release")
EventMesh.publish("publish_AI_btnInfo",{"func":self.Close})
+ EventMesh.publish("stop_sos_call")
EventMesh.publish("sleep_BT")#休眠蓝牙
def key_prompt(self):
return 0
else:
EventMesh.publish("publish_AI_btnInfo",{"func":self.Close})
- EventMesh.publish("sleep_BT")#休眠蓝牙
+ #EventMesh.publish("sleep_BT")#休眠蓝牙
return 1
if len(text)<12 and (text.find("关机") != -1 ):
if dev_type == "7PIN" or dev_type == "7PIN_coze":#柒牌
EventMesh.publish("publish_AI_btnInfo",{"func":self.Close})
- EventMesh.publish("sleep_BT")#休眠蓝牙
+ #EventMesh.publish("sleep_BT")#休眠蓝牙
return 1
EventMesh.publish("publish_AI_btnInfo",{"func":self.Close})
EventMesh.publish("Power_off")
self.ud_error(["VC",self.VC_taskid])
else:
EventMesh.publish("publish_AI_btnInfo",{"func":self.Close})
- EventMesh.publish("sleep_BT")#休眠蓝牙
+ #EventMesh.publish("sleep_BT")#休眠蓝牙
# print("get_audio_state !!!!!{} {} {}\r\n".format(self.play_end,EventMesh.publish("get_audio_state"),self.play_flag))
if self.LocalRespondingEnded_timerout>0 :#
self.LocalRespondingEnded_timerout = 0
if self.VC_mode == 1 :#长按单次问答模式
EventMesh.publish("publish_AI_btnInfo",{"func":self.Close})
- EventMesh.publish("sleep_BT")#休眠蓝牙
+ #EventMesh.publish("sleep_BT")#休眠蓝牙
else:
EventMesh.publish("open_led_blue")
if self.Close_flag == 1:
self.Close_flag = 0
EventMesh.publish("publish_AI_btnInfo",{"func":self.Close})
- EventMesh.publish("sleep_BT")#休眠蓝牙
+ #EventMesh.publish("sleep_BT")#休眠蓝牙
else:
#utime.sleep_ms(1000)
EventMesh.publish("publish_AI_btnInfo",{"func":self.VC_Play_End})
voiceCall.setCallback(self.voice_callback)
EventMesh.subscribe("set_sos_info_call", self.set_sos_info_call)
EventMesh.subscribe("set_sos_list_info",self.set_sos_list_info)
+ EventMesh.subscribe("stop_sos_call",self.stop_sos_call)
def get_sos_flag(self,event,msg):
return self.sos_flag
# EventMesh.publish("set_sos_info_call")
def close_call_timer(self):
self.sos_timer2.stop()
+ pass
+ def stop_sos_call(self,event,msg): #停止sos拨打
+ EventMesh.publish("publish_AI_btnInfo",{"func":self.stop_sos_call_cb})
+ def stop_sos_call_cb(self):
+ if self.sos_flag == 0:
+ return
+ self.sos_flag = 0
+ self.num = 0
+ self.call_state = 0
+ self.num=0 #不管有没有拨打sos都清除
+ self.num_len = 0
+ self.sos_flag = 0
+ self.sos_timer2.stop()
+ self.sos_timer1.stop()
+ voiceCall.callEnd() #挂断
+
pass
def start_phone110112(self):
if self.call_state == 0:
if "data" in msg:
mac = msg["data"]
# mac = "75:e8:8c:62:9a:df"
- # mac = "36:72:cc:b4:58:a9"
- # mac = "a9:58:b4:cc:72:36"
+ # mac = "36:72:cc:e6:dd:e8"
if len(mac) == 17:
ok = 1
EventMesh.publish("send_connect_bt_mac",mac)