A few questions about how XOD works

(1) Several times I have needed (wanted) to combine components into a larger component (two motors, for example, three digital pins, etc). Each component may have a DONE output. Is it “safe” to combine all of the outputs with an ANY node to produce a single output? (see example below)

Or should I be handling each DONE pulse separately?

(2) At times I want to modify a patch, but don’t want to “mess up” what is already working. So, I create a “misc” patch and just copy my patch over to it for “safe keeping”. Then I can modify the original as much as I want knowing that I can always start over with the stored copy if necessary. Is that likely to cause any problem when I run or debug the code? (This relates to my next question.)

(3) When you debug a patch, are all of them running “in the background” or is just one patch running, namely the patch on the tab page that you are working on at the moment that you have displayed? In other words, can circuits you have on other patches potentially affect the operation of the patch you are testing even if there is no dependency between them? (did that make sense? - I feel that I should put a “defer” node in there somewhere!)

That should do it for now.

EDIT: It occurred to me that I should probably explain what I think the answers are to these questions.

(1) I think it is safe to combine the DONE outputs because of the “transaction” execution model. All three outputs will be evaluated and then the system will “idle”. I should never have a problem with having one component report that it is DONE when the others are not also DONE.

(2) I don’t think copying to another patch to “archive” my progress will affect other patches because so far it has not caused any problems that I have attributed to that fact.

(3) My guess is that only the patch on the displayed tab is run during a debugging session.

1- You can combine the outputs pulse with “any”

2- if you want to modify an original node (button), in the project create a new patch (example: button-mod)

3- If in a project, you have:

  • main
  • patch 1
  • patch 2
  • patch 3
  • patch 4

If debug in “main”, it is running only main.
But main can include “patch 2” and “patch 3”, and will become part of “main”, and “main” will depend on these.

Thanks cesars. I thought that was probably the case.

I need to clarify that when you create a modified node copies the original content, but do not change the original.

Also, that original node will not suffer modification, if you do not save the project.

If you modify any native node by mistake, you can delete only the folder C:\Users\User\xod\__lib __\xod

For question #1, you can combine the DONE outputs using any, but it may not do what you want it to. In your example, you poll 3 buttons using loop for each. I don’t think there is any guarantee that all three buttons will get checked before something after the any node executes. In this case, we are talking about someone manually pressing a button; unless you have a huge program (or some delay timers), program execution will be fast enough it would probably never be an issue. This will not always be the case; especially if the different paths have different complexities (i.e. 1 path checking button press, another performing a long path of multiple nodes doing calculations).

There is another thread where I provided example code using flip-flop to create a patch much like any, except the output doesn’t pulse until ALL inputs have pulsed (actually output changes to TRUE when all flip-flops are TRUE, which can be used as a pulse). Combining DONE Pulses Into a Single Output

1 Like

gweimer, your custom node to manage multiple inputs/single output is “way cool!” I suspect that I will be using that a lot!

(P.S. I had read that post before but I really did not understand what you were doing. The “-” node and the variadic were “throwing me.”)

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.