Coder Social home page Coder Social logo

interrupting running macro about firmware HOT 10 CLOSED

bistabil avatar bistabil commented on August 30, 2024
interrupting running macro

from firmware.

Comments (10)

kareltucek avatar kareltucek commented on August 30, 2024

So far I've managed to repeat keystrokes indefinitely by reseting register's state.

I don't understand this, would you clarify?

Regular way would be to use $goTo
E.g.

$tapKey a
$tapKey b
$goTo 0

Since macros are executed asynchronously is there any way to stop them?

Yes, you can signal using a register.

E.g. InterruptionKey:

$setReg 5 1 

Macro:

$setReg 5 0
$tapKey a
$tapKey b
$ifRegEq 5 1 break
$goTo 1

Also, there is a set of diagnostic commands which reset the keyboard state including hard interrupt of all running macros. But you do not want to use that.

from firmware.

bistabil avatar bistabil commented on August 30, 2024

I will test this today.
So if I understood it, registers are not "created" for different instances of macros?
I didn't expected this to be the case as macros themselves can run in parallel so I assumed that these registers would be created for each macro instance.

from firmware.

kareltucek avatar kareltucek commented on August 30, 2024

Correct. "registers" are simply global variables.

from firmware.

kareltucek avatar kareltucek commented on August 30, 2024

Also, thinking about it again, the shortest variant is probably to use the conditional for modifiers. This variant would not need any signaling via registers...

E.g.:

$tapKey a
$tapKey b
$ifAnyMod break
$goTo 0

from firmware.

bistabil avatar bistabil commented on August 30, 2024

And how about longer action sequences?
Let's say that there are a lot of actions before $ifAnyMod break - commands such as delays and mouse movements. Is there another way to stop it other than using $ifAnyMod break after every action?

from firmware.

kareltucek avatar kareltucek commented on August 30, 2024

There is diagnose, which will however do more than that and should not be used as a regular way.

But I think I can add a new command like stopAllMacros. However, it might have to wait until situation around secondary roles is resolved.

from firmware.

kareltucek avatar kareltucek commented on August 30, 2024

Done.

Could you please test that it works as expected?

from firmware.

bistabil avatar bistabil commented on August 30, 2024

I've tested it while I was running a single macro and it worked!

from firmware.

kareltucek avatar kareltucek commented on August 30, 2024

Thanks!

from firmware.

kareltucek avatar kareltucek commented on August 30, 2024

So I guess this can be closed. (Ofc., feel free to follow up.)

from firmware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.