Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Custom Ticker not ticking when first starting

For general discussion related FlowStone

Custom Ticker not ticking when first starting

Postby dange11 » Tue Feb 26, 2013 3:18 am

FlowStone 3.0.1, windows 7

I have found that when I use the "Ticker - Custom" they do not tick when I initially strat the program, I have to go in and remove the "On" check mark and then replace it. Once I do that it works fine until I close the program and reopen it. Any thoughts?
Attachments
Ticker.JPG
Ticker.JPG (49.2 KiB) Viewed 21044 times
dange11
 
Posts: 2
Joined: Mon Dec 10, 2012 2:24 pm

Re: Custom Ticker not ticking when first starting

Postby billv » Tue Feb 26, 2013 7:42 am

Yeh i came across this a few days ago. It's a simple fix.
Add this line to the code...
output 0,t
Just like i have below with the smilely face.

.


def init
# Time step in secs
@step = 0.1

# Whether the timer has started ticking
@ticking = false
end

def event i,v,t
case i
when 0
if !@ticking && @state
@ticking = true
input 100,nil,t+@step
output 0,t :)
end
if @state
@step = 0.001 if @step <= 0

output 0

input 100,nil,t+@step
else
@ticking = false
end
end
end
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Custom Ticker not ticking when first starting

Postby dange11 » Thu Feb 28, 2013 4:36 pm

Thank you for the reply, I added the line, to include the smiley face, and the ticker would not initially start ticking until I removed and reinserted the check mark in the on box. I even tried it without the smiley face with no better results :(
dange11
 
Posts: 2
Joined: Mon Dec 10, 2012 2:24 pm

Re: Custom Ticker not ticking when first starting

Postby MyCo » Thu Feb 28, 2013 5:48 pm

Try this:
Code: Select all
def init
   # Time step in secs
   @step = 0.1   
   
   # change timer id
   @timerID = (@timerID.nil? || !@timerID.integer?) ? 0 : @timerID+1
   
   # Whether the timer has started ticking
   @ticking = false

   input 200, nil
end

def event(i,v,t)
   if (i == 100)
      @ticking = @state
      if ((@ticking) && (v == @timerID))
         output(0)
         @step = 0.001 if (@step <= 0)
         input(100,@timerID,t+@step)
      end
   else
      if ((!@ticking) && (@state))
         @ticking = true
         input(100,@timerID,t+@step)
      end
   end
end
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: Custom Ticker not ticking when first starting

Postby trogluddite » Thu Feb 28, 2013 7:21 pm

dange11 wrote:removed and reinserted the check mark in the on box

That's a clue to the easy way - by doing this you are sending a trigger into the input, causing an event which sets the timer running.
So the simplest way to make sure it automatically starts ticking is to simply put an "After Load" (and "After Duplicate" possibly) connected to the same Ruby input as the on/off checkbox.
That will give it the 'kick' it needs to get running at load time.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Custom Ticker not ticking when first starting

Postby billv » Fri Mar 01, 2013 3:46 am

MyCo wrote:Try this:

Ummm.....I'm not getting a result here Myco. It's behaving like the original ticker, waiting
the "step" time before it sends the first trigger. Put in a step value like"1", easier to notice
what i mean.
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Custom Ticker not ticking when first starting

Postby Nubeat7 » Fri Mar 01, 2013 10:05 am

there was also this problem with a time and date module
viewtopic.php?f=3&t=1133
at the end we solved it like this:

Code: Select all
def init
   input 100,nil
end
def event i,v,t
   output 0
   input 100,nil,t+1 #time+1sec
end


in this example it ticks every second (t+1) you just need to calculate the time, the ticker is always running.
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: Custom Ticker not ticking when first starting

Postby trogluddite » Fri Mar 01, 2013 3:23 pm

Yes, if the on/off switch is not required, that is the best way - much less Ruby processing too when all those other variables etc. are removed.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK


Return to General

Who is online

Users browsing this forum: No registered users and 81 guests