Skip to content

Commit 96ce972

Browse files
committed
Corrected description of minSpacing parameter for actions
1 parent caf9ed8 commit 96ce972

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

docs/writing-reactors/actions.mdx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,12 @@ For a **physical** action, the preliminary time is similar, except that _t_ is r
174174
If a `<min_spacing>` has been declared, then it gives a minimum logical time
175175
interval between the tags of two subsequently scheduled events. If the
176176
preliminary time is closer than `<min_spacing>` to the time of the previously
177-
scheduled event (if there is one), then `<policy>` (if supported by the target)
177+
scheduled event (if there is one), or if the preliminary time is earlier than
178+
the previously scheduled event, then the time will be modified to enforce
179+
the minimum spacing. The `<policy>` argument (if supported by the target)
178180
determines how the minimum spacing constraint is enforced.
179181
Note that "previously scheduled" here means specifically the tag resulting from
180-
the most recent call to `lf_schedule` for the same action.
181-
:::warning
182-
Since calls to `lf_schedule` can specify arbitrary extra delays,
183-
`<min_spacing>` does not necessarily result in events with minimum spacing between them.
184-
If your calls to `lf_schedule` result in monotonically increasing tags, however, you will
185-
get events with minimum spacing between them.
186-
:::
182+
the most recent call to the schedule function for the same action.
187183

188184
<ShowIfs>
189185
<ShowIf c py>
@@ -200,11 +196,16 @@ Note that while the `"defer"` policy is conservative in the sense that it does n
200196

201197
<ShowIf cpp ts rs>
202198

203-
> The `<policy>` argument is currently not supported.
199+
> The `<policy>` argument is currently not supported by cpp, ts, or rs.
204200
205201
</ShowIf>
206202
</ShowIfs>
207203

204+
For example, suppose the minimum spacing of a logical action is 10 ms and the policy is `"defer"`.
205+
Suppose that in a reaction to `startup`, the logical action is scheduled with a delay of
206+
100 ms, then again with a delay of 99 ms, and a third time with a delay of 101 ms.
207+
The logical action will trigger at elapsed times 100 ms, 110 ms, and 120 ms.
208+
208209
## Testing an Action for Presence
209210

210211
{/* This looks like crap but what can you do?*/}

0 commit comments

Comments
 (0)