Skip to content

Commit 024b080

Browse files
committed
Schedule: Improve doc, code comments.
1 parent 1e6dbe5 commit 024b080

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

v3/as_drivers/sched/sched.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
# uasyncio can't handle long delays so split into 1000s (1e6 ms) segments
1313
_MAXT = const(1000)
14-
# Wait prior to a sequence start
14+
# Wait prior to a sequence start: see
15+
# https://github.com/peterhinch/micropython-async/blob/master/v3/docs/SCHEDULE.md#71-initialisation
1516
_PAUSE = const(2)
1617

1718

v3/docs/SCHEDULE.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ asyncio.create_task(schedule(foo, 'every 4 mins', hrs=None, mins=range(0, 60, 4)
115115
Positional args:
116116
1. `func` This may be a callable (callback or coroutine) to run, a user defined
117117
`Event` or an instance of a `Sequence`.
118-
2. Any further positional args are passed to the callable or the `Sequence`.
118+
2. Any further positional args are passed to the callable or the `Sequence`;
119+
these args can be used to enable the triggered object to determine the source
120+
of the trigger.
119121

120122
Keyword-only args. Args 1..6 are
121123
[Time specifiers](./SCHEDULE.md#41-time-specifiers): a variety of data types
@@ -168,6 +170,9 @@ try:
168170
finally:
169171
_ = asyncio.new_event_loop()
170172
```
173+
Note that the asynchronous iterator produces a `tuple` of the args passed to the
174+
`schedule` that triggered it. This enables the code to determine the source of
175+
the trigger.
171176

172177
##### [Top](./SCHEDULE.md#0-contents)
173178

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy