Mentions légales du service

Skip to content

Add a periodic timer event to VPL, variant 2

SHERMAN David requested to merge github/fork/cwalther/periodic-event-2 into master

Created by: cwalther

(continued from #469)

This variant uses the metaphor of a metronome to represent the periodic event and compared to variant 1 adds the possibility to trigger the event at either of two opposite phases of the period (on the “tick” or on the “tock” of the pendulum).

This addition arose from the insight that most of the actions available in VPL are idempotent, so that executing them periodically by themselves has no immediately observable effect. The effect only becomes apparent when between two executions another action is executed that undoes the first action, and it is often more convenient to trigger that second action from the same timer rather than requiring use of the other (non-periodic) timer.

While adding a small amount of UI complexity, this makes the implementation of blinking even simpler, it is now possible without using advanced mode:

blink-periodic2

On a technical note, I had to extend the VPL compiler a bit to implement this, it would be good to test it with some existing VPL files to ensure that it still generates the same code, but I didn’t have any such files available.

Merge request reports