Skip to content

Commit 059b255

Browse files
committed
aswitch.py simplify Delay_ms.
1 parent 05d1e6e commit 059b255

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

aswitch.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,7 @@ async def _run(self):
5252
if self.tstop is None: # Not running
5353
await asyncio.sleep_ms(0)
5454
else:
55-
twait = time.ticks_diff(self.tstop, time.ticks_ms())
56-
while twait > 0:
57-
# Must loop here: might be retriggered
58-
await asyncio.sleep_ms(twait)
59-
# stop() might be called during wait
60-
if self.tstop is None:
61-
break
62-
twait = time.ticks_diff(self.tstop, time.ticks_ms())
63-
if self.tstop is not None and self.func is not None:
64-
launch(self.func, self.args) # Execute callback
65-
self.tstop = None # Not running
55+
await self.killer()
6656

6757
def stop(self):
6858
self.tstop = None

0 commit comments

Comments
 (0)