more tweak

This commit is contained in:
Tassilo Schweyer 2025-12-29 00:06:51 +01:00
parent 5362c3079f
commit 321b370b2d

View file

@ -62,13 +62,15 @@ s = setup_listener()
c = []
def controlloop(last_start, next_action):
now = time.ticks_us()
#print('CTRL: ', last_start, next_action)
if time.ticks_us() < last_start + 100000:
#print(' DEADTIME -> ignore')
if time.ticks_diff(now, time.ticks_add(last_start, 100000)) < 0:
print(' DEADTIME -> ignore')
return last_start
if next_action is None and time.ticks_us() > last_start + 600000:
#print(' ACTION TIMED OUT -> stopping')
if next_action is None and time.ticks_diff(time.ticks_add(last_start, 601000), now) > 0:
print(' ACTION TIMED OUT -> stopping')
next_action = (0,0)
elif next_action is None:
return last_start
@ -96,7 +98,10 @@ def controlloop(last_start, next_action):
MOTOR_B1.off()
# we just started new action
return time.ticks_us()
if next_action != (0,0):
return time.ticks_us()
else:
return last_start
def mainloop(l):