source "../system/config.in"
endmenu
-menu "EG810MCN_GA_ALIPAY"
+menu "EG810MCN_GA_VOLTE"
source "../services/microPython/config/config.in"
source "../components/poc/poc_option.in"
source "../components/GH301x/GH301x_option.in"
-source "../components/HX3918/HX3918_option.in"
source "../components/SC7A20/SC7A20_option.in"
source "../components/juphoon/juphoon_option.in"
endmenu
self.motor_open_time = 0 #开马达事件
self.motor_close_time = 0#关马达事件100ms
self.motor_count = 0
+ self.motor_count_tmp = 0
self.motor_mode = 0#模式
_thread.start_new_thread(self.motorInfo_queue_thread, ())
EventMesh.subscribe("publish_message_event_motorInfo",self.publish_message_event_motorInfo)
EventMesh.subscribe("set_motor_time", self.set_motor_time)#设置参数
EventMesh.subscribe("close_motor_infor", self.close_motor_infor)#关闭马达和定时器
+ EventMesh.subscribe("get_motor_enable", self.get_motor_enable)#关闭马达和定时器
pass
+ def get_motor_enable(self,event=None,msg=None):
+ return self.motor_enable
def motorInfo_queue_thread(self):
while True:
self.motor_total_time = msg[2]#总的时间
self.motor_open_time = msg[3] #开马达事件
self.motor_close_time = msg[4]#关马达事件100ms
- self.motor_count = 0
+ self.motor_total_time_tmp=self.motor_total_time
+ if len(msg) <= 5:
+ self.motor_count = 0
+ else:
+ self.motor_count = msg[5]
+
self.motor_timer.stop()
- # print("motor msg",msg)
+ print("motor msg:{} len:{} self.motor_count:{}".format(msg,len(msg),self.motor_count))
close_motor()
self.motor_timer.start(MOTOR_TIME,1,self.publish_motor_event_cb)
EventMesh.publish("close_motor_infor")#关闭马达和定时器
return
if self.motor_mode == 1:# 持续振动时间100单位 长振
- if self.motor_total_time > 0:
+ if self.motor_count == 0:
self.motor_total_time-=1
if self.motor_total_time > 0:
open_motor()
close_motor()
EventMesh.publish("close_motor_infor")#关闭马达和定时器
return
+ else:
+ if self.motor_count_tmp > self.motor_count:
+ close_motor()
+ EventMesh.publish("close_motor_infor")#关闭马达和定时器
+ return
+ self.motor_total_time_tmp-=1
+ if self.motor_total_time_tmp > 0:
+ open_motor()
+ else:
+ close_motor()
+ self.motor_total_time_tmp=self.motor_total_time
+ self.motor_count_tmp+=1
+
+ pass
elif self.motor_mode == 2:# 间隔振动
# print("self.motor_count",self.motor_count,self.motor_open_time,self.motor_close_time,self.motor_total_time)
if self.motor_count % (self.motor_open_time) < self.motor_close_time: # 4 4 2 1%4 = 1 2%4 = 2 3%4 = 3
else:
close_motor()
if self.motor_count >= self.motor_total_time-1:
+ close_motor()
EventMesh.publish("close_motor_infor")#关闭马达和定时器
return
self.motor_count+=1