Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: WAIT macro #134

Open
urfdvw opened this issue Apr 29, 2024 · 2 comments
Open

Feature Request: WAIT macro #134

urfdvw opened this issue Apr 29, 2024 · 2 comments

Comments

@urfdvw
Copy link

urfdvw commented Apr 29, 2024

Is it possible to have a "WAIT" macro to wait for a specific time.
My usage is in the macro automation, there are some loading time.
I know there is a step duration in config, but I only want to wait on the load part.
It can happen that there are many steps, especially when there is text inputting, but only want to wait for 5s in the load process.
Setting the duration in config to be 5s will make the macro too slow to run.

Prior to creation

  • searched in issue
  • read docs
@jfedor2
Copy link
Owner

jfedor2 commented Apr 29, 2024

It's not currently possible.

You could implement such a delay by using two macros, the following mappings:

Left button -> Macro 1
Expression 2 -> Macro 2

And the following expressions:
Expression 1:

1 recall 
0x00090001 input_state_binary not
mul
0x00090001 input_state_binary
time
5000 add
mul
add
1 store
2 recall
0x00090001 input_state_binary
bitwise_or
2 store 

Expression 2:

1 recall
time eq
2 recall
mul

Expression 3:

1 recall
time eq
not
2 recall
mul
2 store

(Change 0x00090001 in the expression to the usage that you want to trigger the macro.)

I realize it's not the most straightforward.

The way it works is Expression 1 stores the current time plus 5 seconds in register 1 if the button is pressed and at the same time updates register 2 with the value of "1".

Expression 2 checks if the current time matches the value in register 1 and additionally checks if register 2 is "1". This triggers the second macro.

Expression 3 resets register 2 to "0" after the second macro is triggered.

Register 2 is necessary because the clock wraps around after like 35 minutes, I think, so it prevents it the second macro from executing again (at least I hope it does, I didn't wait 35 minutes to check.)

(EDIT: I guess we should also think about what happens when current time+5 seconds wraps. Maybe we need to add some modulo or something.)

@dglaude
Copy link

dglaude commented May 6, 2024

There are some discussion on "startup" Wait in #132 and it worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants