self.extint_22 = 0
self.GPIO22_status = 1
- self.extint_17= 1
+ self.extint_17 = 0
self.KeyCall2_status = 1
+ self.extint_7 = 1
+ self.extint_8 = 1
+
self.extint_19= 0
self.KeyCall1_status = 1
self.extint_19 = ExtInt(ExtInt.GPIO19,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.key19_extint_cb)
self.extint_19.enable()
- self.extint_17 = ExtInt(ExtInt.GPIO17,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.key17_extint_cb)
+ self.extint_17 = ExtInt(ExtInt.GPIO7,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.key17_extint_cb)
self.extint_17.enable()
self.wechatKey = ExtInt(ExtInt.GPIO22, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.wechatKey_extint_cb)
self.wechatKey.enable()
-
def key17_extint_cb(self,args):#call 1
+ # EventMesh.debug_log('key17_extint_cb :{}'.format(args))
open_power = EventMesh.publish("get_power_on_state")#获取开机标识
open_power_off = EventMesh.publish("get_power_off_state")#获取开机标识
video_state = EventMesh.publish("get_video_state")#获取视频通话状态 5在通话状态不允许按键输入
return
flag = EventMesh.publish("get_call_state")#在通话或者电话拨进 或者拨出不允许寻找设备
fall_down = EventMesh.publish("get_fall_down_state")#跌倒报警标识
- # print("call2Key_timeout_cb",self.Keycall2_press_count,flag)
+ print("call2Key_timeout_cb",self.Keycall2_press_count,flag)
if self.Keycall1_press_count > 1:#
if fall_down != None:
if fall_down != 0 or flag != 0 or video_state != 0:#在打电话或者跌倒报警提醒中不允许按键触发
self.upload_time = 0
self.UD_timeout = 7*60
+ self.low_power_AL = 0
+
self.temp_time = 0
self.temp_state = 0
self.temp_one_state = 0
if battery[0] != '1':
if battery[1] == 0:
EventMesh.publish("open_power_on",2)# #未检测到sim卡15分钟后关机
-
+ """"低电报警"""
+ if battery[1] <= 15 and self.low_power_AL==0:
+ self.low_power_AL = 1
+ dev_state = EventMesh.publish("get_dev_state")
+
+ tmp = 1 << 17
+ dev_state = dev_state|tmp #第17位=1
+ EventMesh.publish("set_dev_state",dev_state)
+ EventMesh.publish(constants.EVENT.START_LOCATION,[constants.PROTOCOL.AL_SEND,dev_state]) #开始AL定位
+ if battery[1] >= 50:
+ self.low_power_AL = 0
+
"""未联网提示关机"""
ble=EventMesh.publish(constants.EVENT.GET_CONNECT)
# EventMesh.debug_log("ble",ble)
#self.sock.setblocking(False) &self.sock.settimeout(0)不阻塞
self.sock.connect((self.server_addr, self.server_port))
- #utime.sleep_ms(500)
+ self.publish_timer.start(2000, 1, self.publish_timer_cb)
+
+ utime.sleep_ms(500)
+ EventMesh.publish(constants.PROTOCOL.LK_SEND)
# 发送数据
- self.publish_timer.start(1000, 0, self.publish_timer_cb)
+
except Exception as e:
usys.print_exception(e)
EventMesh.debug_log("connect2{}:{}".format(self.server_addr, self.server_port))
self.reconnect_flag = 0
def publish_timer_cb(self, *args):
- EventMesh.publish(constants.PROTOCOL.LK_SEND)
+
self.authen_set()
def authen_set(self):
print("self.reconnect_flag",self.reconnect_flag)
self.reconnect_flag = 0
self.reconnect()#重连设备
- EventMesh.publish("set_server_state",1)#获取修改服务器状态
+ self.publish_timer.stop()
+ EventMesh.publish("set_server_state",1)#获取修改服务器状态
def check(self, *args):