Bug?: redraws in ruby even wo events

For general discussion related FlowStone
Post Reply
User avatar
Walter Sommerfeld
Posts: 250
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany
Contact:

Bug?: redraws in ruby even wo events

Post 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!
Attachments
draw event 2 much triggers!.fsm
(88.39 KiB) Downloaded 817 times
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Bug?: redraws in ruby even wo events

Post 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...
User avatar
Walter Sommerfeld
Posts: 250
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany
Contact:

Re: Bug?: redraws in ruby even wo events

Post 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
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Bug?: redraws in ruby even wo events

Post 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

tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Bug?: redraws in ruby even wo events

Post 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)
"There lies the dog buried" (German saying translated literally)
User avatar
Walter Sommerfeld
Posts: 250
Joined: Wed Jul 14, 2010 6:00 pm
Location: HH - Made in Germany
Contact:

Re: Bug?: redraws in ruby even wo events

Post 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 :o :cry:
Post Reply