Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Rybo

  1. Hello, I'm having a problem with a function which uses a timer for an input. I've got an application that uses multiple timers which all do relatively similar things. Basically, I have a display which shows the timers progression, so each timer needs to pass it's own preset and current values to the common variables I linked to the meter in the screen. Note that only one timer is active at a time, and the next timer starts when the previous timer ends, so I only need the one meter. I created all of the timers with the correct preset times, and I created a function with a timer input so that in my code I can call this function, give it the correct timer object, and have the function run the timer AND update the display without needing to repeat a bunch of code. But there seems to be something wrong with accessing timers this way. Everything works the first time around, but on subsequent passes, the timers only run for their preset time minus the previous timers preset time. So if I have four timers set to 5, 10, 12, and 6 seconds respectively, after the first round, the timers will run for 5, 5, 2, and 0 seconds respectively. The last timer doesn't even run! I've tried every which way to fix this, but nothing has worked. So before I have to go and add all the repeated elements back in to dozens of timers, I figured I'd ask here to see if anyone has a solution. One other interesting tidbit which might help figure this out, when I view the values from inside the offending function, I can see that the "preset" value is correct, which tells me the timer is being passed correctly. I can also see that the "current" value is correct for the timer I want to run (it starts off at the preset value until I call the function). But this is where it gets interesting. As soon as I call the function, the "current" value for the active timer drops to the wrong number. I'm not directly setting it anywhere, which tells me I may have stumbled into a bug. If the timers are not meant to be passed like this, then why else would there be the option to pass in a timer? I've attached a sample program to demonstrate the problem. In it, I've included two versions of the setup, "Test - Not Working" which is the same as described above, and "Test - Working" which is exactly the same, except instead of calling a function, all of the blocks from the function are repeated in each rung. You can select which method to use with the checkbox on the main screen. Just push the "Run Sequence" button, and whichever function is selected will run. Timer Test.ulpr
  • Create New...