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

Higher-order macros #31

Closed
andrewmiller1 opened this issue Jun 9, 2019 · 4 comments
Closed

Higher-order macros #31

andrewmiller1 opened this issue Jun 9, 2019 · 4 comments

Comments

@andrewmiller1
Copy link

I could be overlooking the feature, but if not I think it would be good to have macros able to play macros created in UHK Agent. I'm making a Starcraft II configuration and need many macros to do some of the same actions.

@kareltucek
Copy link
Owner

kareltucek commented Jun 10, 2019

Hi Andrew and thanks for getting in touch!

I have considered a possibility of adding a command which would allow executing macros as functions. Unfortunately, the matter is rather complex - call stack would have to be implemented so that you could return from a call, and some sort of typing system which would allow passing arguments... Also one of the complications is that the amount of available RAM of UHK is rather limited, while modules are not-yet implemented and official tracker promises some features which will eat significant amount of memory in the future. ...And the macro-state records are currently quite large. As a result, I don't feel very strongly about implementing such thing - It is not impossible, but so far, it wasn't worth the trouble for me.

One thing I could implement quite easily is an "exec" command, which would execute another macro in place of current macro - i.e., with no possibility of returning to the caller macro. How much would such functionality help you?

Also, could you explain some real-life examples? There might be some other solution not requiring a full-fledged call stack.

@luteijn
Copy link

luteijn commented Jun 10, 2019

Might consider an 'include X' instead of a 'call X' command that would inline the X macro in the flash. The hard part would be how/when to expand this, ideally it would be done in agent, but probably don't want to go there...

@kareltucek
Copy link
Owner

kareltucek commented Jun 10, 2019

I definitely do not want to meddle with writing into flash, since it is an easy way to brick a UHK or at least shorten its life. Also I feel that credibility of the fork could suffer from such decision.

Regarding agent, feel free to implement such thing, but as far as my time goes, I am not going to invest it into agent. Among other things, requiring modified agent would make compatibility a nightmare.

Compared to those suggestions, solving the call stack via RAM is a rather minor inconvenience. Anyway this is more bout how much resources I want to invest into the development - the firmware currently fits my needs quite well so I am reluctant to pursue features which would take huge amount of time.

@kareltucek
Copy link
Owner

kareltucek commented Jul 4, 2019

In the end, I've reconsidered this and implemented a very minimalistic implementation, containing both call and exec. In this implementation, call command simply remembers its caller and returns there. No arguments, no advanced memory management.

See https://github.com/kareltucek/firmware/releases/tag/v8.5.4.kt.20

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