Page 1 of 1
Bug?: redraws in ruby even wo events
Posted: Wed Apr 01, 2015 2:00 pm
by Walter Sommerfeld
Hi guys,
this maybe related to other trigger mysteries in your projects too:
please load my little fsm and test it...
click on the schematic and/or slowly move your mouse cursor over a link line...
Some triggers appear but nothing unexpected happens - right?!
But in my way bigger project (in FS and the compiled exe) on the front panel the led continuously lights up and the trigger rate is around 50 per sec...
=> even w/o any redraw or input event inside or from outside...
looks like it back fires a trigger in a loop?!...
Please check this behaviour in your project!
Re: Bug?: redraws in ruby even wo events
Posted: Wed Apr 01, 2015 6:16 pm
by KG_is_back
I can't confirm this by testing, but here's my theory:
When a module is redrawed, it must trigger redraw of all modules, that occupy the same area, because they are overlayed. This seems logical, because the final view is an overlay of multiple bitmaps. This might be implemented via redraw-area-type of algorithm. That way, modules that do not share the view area will not cause CPU increase, because they will draw nothing (area of zero size). Nevertheless the redraw happens - redraw method is called (there might be some algorithm that prevents this, when the redraw area should be zero. I don't really know - we'll have to test that).
I will do some testing to confirm this, but it'll take time...
Re: Bug?: redraws in ruby even wo events
Posted: Wed Apr 01, 2015 10:46 pm
by Walter Sommerfeld
Thanks KG for ur supply.
I thought 2 it must be something u described...
but how could we limit redraws if the hole ruby view is always refreshed > 50 Hz ???
Keep on doing!
Walter
Re: Bug?: redraws in ruby even wo events
Posted: Thu Apr 02, 2015 1:05 am
by KG_is_back
I've wrote E-mail to DSProbotics support, hopefully they will reply. Meanwhile I can think of one way to minimize the issue - limit the output method, so it doesn't shoot outputs like crazy.
Code: Select all
def init
@time
end
def draw v
#some code
if @time<time then output 0,something end
#some code
#put this in the end of redraw method
#0.2 is just an example, which will limit outputs to max 5 per second
if @time<time then @time=time+0.2 end
end
Re: Bug?: redraws in ruby even wo events
Posted: Thu Apr 02, 2015 3:45 pm
by tulamide
Do you remember
this thread?
From there:
tulamide wrote:Yes, I think so, too. Had some testing with the sprite font project. Remember that I complained about continous redraws? It's because of the output triggers. They can cause feedback loops, and that's what's happening there (A char list is drawn, the number of rows is sent to a slider. The slider takes it as input and sends out the current position. As soon as both are directly adjacent, one of those "redraw areas outside the view area" triggers redraws, which forces the loop).
There are two ways to avoid that behaviour: Either don't place panels directly adjacent in the top front panel, or don't use 'output' from within the draw method. (This second route was how I solved it in my project)
Re: Bug?: redraws in ruby even wo events
Posted: Fri Apr 03, 2015 11:01 am
by Walter Sommerfeld
@KG: Will try your code asap!
@tulamide: Yes i remember - but must have over read the 'adjacent' or simply misinterpreted it...
Now i get it and will try to avoid it and follow your hint:
don't use 'output' from within the draw method.
Thanks to you both...
btw: i thought i got rid of this with my external redraw
