I've been trying to jump from a macro back to the start of the main macro, after an initialisation of lcd and sd card and rtc. I.e. a reset without the first stages. It wont compile and says its an invalid connection point. Can I only jump within the macro that the connection is within?
N
Connection points
-
- Posts: 262
- http://meble-kuchenne.info.pl
- Joined: Tue Jul 13, 2021 1:53 pm
- Has thanked: 35 times
- Been thanked: 27 times
-
- Matrix Staff
- Posts: 1610
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 567 times
- Been thanked: 531 times
Re: Connection points
Yes you can only jump within a user macro.
Jumping is not recommended within programming as it causes all sorts of issues.
What I do is use continual loops, e.g Loop until .Exit = 1
Try to avoid call a user macro from another user macro.
You will be better of using a state machine type of program.
Jumping is not recommended within programming as it causes all sorts of issues.
What I do is use continual loops, e.g Loop until .Exit = 1
Try to avoid call a user macro from another user macro.
You will be better of using a state machine type of program.
Martin
-
- Valued Contributor
- Posts: 1213
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 118 times
- Been thanked: 622 times
Re: Connection points
If doesn't sound as though you want to jump back to the start of the main macro...
Main macro will call initialization code - if you jump back to the start then it will call the initialization again - actually just returning from the macro will do what you want - which is continue program execution after the setup code...
I
Returning (in effect dropping of the end of a macro) returns to where it was called from. Except main - which has Asian infinite loop at the end....
Martin
Main macro will call initialization code - if you jump back to the start then it will call the initialization again - actually just returning from the macro will do what you want - which is continue program execution after the setup code...
Code: Select all
Main
Call setup macro
More setup macro
Do stuff
Returning (in effect dropping of the end of a macro) returns to where it was called from. Except main - which has Asian infinite loop at the end....
Martin
Re: Connection points
At the moment (and I'm still developing this in my head) I want to go back to a state after initialisation. Like a reset but not total reset. I want to use as few buttons as possible to display and control a menu and modify some config settings on an sd card. So in my head max of 3 buttons and the flow through the menu system will change the purpose of the buttons depending which stage of the menu the user is at. This is probably the most complex part of the project so far and its been a steep and huge but satisfying learning curve.
My initial thought was a jump straight out to the start of the main code after initialisation if the user had made a mistake or changed their mind
N
My initial thought was a jump straight out to the start of the main code after initialisation if the user had made a mistake or changed their mind
N