Diagram of Action Types, Their Triggers & Order of Execution

I found myself debugging some stuff today and ended up putting a diagram together of all the different action types, the events that trigger them and the order of execution.

Thought I’d share in case this is useful.

Welcome any feedback in case I’ve got anything wrong also :slight_smile:

Version 3

Version History

  • Version 2 (missing note on presence of “Double Tap” actions slightly delaying “Press” actions)
  • Version 1 (“Release All” is incorrectly positioned after “Release” / “Long Press Release”, these actions actually happened in the order they are defined)

Draw.io Files

PS: you’ll need to remove the .json file extension that I added for the purposes of uploading

2 Likes

Nice. @james might want to add this to the docs…

@James additionally, having studied your docs here…
https://morningstarengineering.atlassian.net/wiki/spaces/MMS/pages/181698574/Action+Type+List

I can see a discrepency between whats documented and what actually seems to happen (for me at least)…

  • “Release All” does not fire for “Double Tap” or “Double Tap and Hold” events

Not sure if this is a bug in the code/firmware, or an error in the docs. However further down in the docs we have this description for “Release All” which perhaps implies it only fires with “Press” / “Long Press”…

Release All
This action groups Release and Long Press Release together.

Thanks for sharing this. I’ll test the actions again and maybe edit the draw.io file before adding, if you don’t mind.

Yes, logically Release All should capture all release events. BUT, I can’t recall what is the rationale for leaving out double tap (long) release. I’ll need to do some digging first.

:+1: good man, here’s the draw.io file (I had to add a .json extension for upload purposes)…

MORNINGSTAR-Action-Order.drawio.json (2.7 KB)

@james the other question I had regarding the table in your docs is why the different release events are numbered the same?

For example

  • for "When switch is pressed and released" you have “Release” and “Release All” both numbered as 2
  • for "When switch is pressed, held down, and released" you have “Long Press Release” and “Release All” both numbered as 3
  • etc

Not sure if this is deliberate or an error?

After doing some more testing, I have answered my own question. The order in which the “Release” / “Long Press Release” / “Release All” actions are executed is entirely dependant upon the order they are defined in the editor.

I have updated the diagram in my original post to reflect this (now version 2).

Wow. That’s interesting. I can see it being useful in some situations … and perhaps confusing if not well documented. Advanced use case…

On a Double Tap, Release All could:

  • Fire just once … on the first release.
  • Fire just once … on the second release.
  • Fire on both releases

At the extreme, there could be multiple Release All events that cover each of the above cases. Not sure they all make sense or are useful. The first one is what I would expect (and easiest to implement without ambiguity or extra delays to see if it’s a tap or a double tap).

@quadstar your points about the double tap got me wondering about why a double tap doesn’t invoke a “Press” action and what implications that might have on a single tap. I eventually found a post from @james where he says…

If you have a double tap action in your preset, along with a press action, there will be a delay when you execute a press action as the controller is determining whether a double tap will be executed. If you remove the double tap action then there will be no delay.

So I’ve updated the diagram (now version 3) in my original post again adding a note about how the presence of a “Double Tap” action will cause a slight delay to “Press” actions.

On why a double tap action does not execute a press action:
if a double tap action executes a press action, the press and release logically should be immediately executed on the first tap. If that’s the case then a press and release action is useless in a preset that has a double tap action as well. The only solution would be to add a delay to the release action so the controller can differentiate between a double tap and a release. But if press also engages a double tap, then you’ll need to use release with double tap where release will have a delay in executing, which brings us back to why we decoupled press and double tap

1 Like