08-31-2021 09:19 AM
Alright, so I am making a QMH and two of the cases are a quick-save and an auto-save. For the quick-save event I'm able to place the actual boolean control inside the event structure, but for the auto-save I set up an Elapsed Time VI inside a while loop to count down and turn on a "Save ready" boolean which is then supposed to trigger the event structure. I also have an indicator to show how much time is left until the next auto-save.
I know that best practice is to place your UI controls inside of the specific event they trigger, but of course this complicates things with the auto-save feature since I can't actually place the Elapsed Time VI and its inputs/outputs inside of the event structure.
Being that the while loop and producer loops are in parallel I tried creating a local variable for the "Save ready" and placing that inside the event structure. I made it a read and then hooked it up to another boolean indicator "Save ready2" which I then changed to the controlling variable for that event. Still no use.
I got it to work by putting the auto-save feature in the timeout case, but I want the auto-saves to always be a set time period, and if I were to quick-save it will reset the timeout timer and cause the auto-save to shift.
Another thought I had was to set the timeout time to 1 sec and place the Elapsed Time VI setup inside the producer loop (see picture below). My thought was that this will allow me to see a "live" update to the auto-save countdown and allow me to place the "Save ready" indicator inside of the event structure, but this still doesn't work right.
I'm at a loss, I can probably live with the method where I link the auto-save to the timeout event case, but it's not ideal, and I'm struggling to include the countdown till the next save. Anyone ever set up something similar and care to share a few pointers?
Also, another related question, what's the reason for placing the actual controls inside the event structure? I know it's best practice, but I never understood the reason behind that.
Thanks for your help!
Solved! Go to Solution.
08-31-2021 09:34 AM - edited 08-31-2021 09:35 AM
It seems like you're going through a lot of mental headache to avoid placing the auto-save code into its own loop. To me, that's your easiest solution. Make a separate loop that has nothing but the timing code, update the time remaining indicator on every iteration, and when the time elapses enqueue an auto-save event. Add a little something something to stop that loop when your other loops stop, and you're done.
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
08-31-2021 09:38 AM
@FireFist-Redhawk wrote:
It seems like you're going through a lot of mental headache to avoid placing the auto-save code into its own loop.
I completely forgot that I can have two or more producer loops. Such a simple solution, thank you so much!