B4J Question Too much high latency in pressing buttons

Alessandra Pellegri

Active Member
Licensed User
Longtime User
Hi everyone,
I am building a control panel with a Raspberry 4 connected to a touchscreen. The problem is that when I press a toggle button, it reacts into half second or more (sometime also 1 second I think). This give an ugly effect, the latency is too high.

I don't have the same effect on PC. Have you got some idea to solve it ?
I already added usbhid.mousepoll=0 option to cmdline.txt, but the problem is not the mouse polling rate because, if I active the mouse pointer, it immediatly moves on the position. The problem is the time intercurring between when mouse pointer is in the position, and when the button changes its state.

Thank you
 
Last edited:

Alessandra Pellegri

Active Member
Licensed User
Longtime User
Does it take the same time until you see the button changing its visual state (getting pushed)?
I'm not sure I understand the question. Anyway I've uploaded a video to show the effect:
How you can see, the button changes its state when the finger is already far from the display.
 
Upvote 0

rspitzer

Active Member
I have noticed the same thing in my projects. When I use the raspberry pi 3, seems to have more of a problem than the raspberry pi 4 from my own testing. Also there is quite a difference in running the program in debug vs real time, do you have the same problem when you don't run it in debug mode?
 
Upvote 0

rspitzer

Active Member
I use 2 different manufacturers of touch screens, one manufacturer does not require a separate driver for the touch screen, the touch interface is setup to look like a mouse, the other screen requires a driver that is separate and needs to load during the boot up process. The screen with the driver has more latency problems than the non driver model. Just offering this up as a possibility? BTW, your graphics are very nice, very good looking interface.
 
Upvote 0

Alessandra Pellegri

Active Member
Licensed User
Longtime User
This touchscreen model doesn't require any additional driver. In any case it isn't the cause because the arrow of the pointer goes immediatly in the correct position. It is the button to be slow.
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
I would do a test: Make a brand new (really, don't reuse anything) project with just two buttons and no code. Put it on the device, test and record a new video and post it here.
 
Upvote 0

Alessandra Pellegri

Active Member
Licensed User
Longtime User
I detected the cause of the problem: the library jGauges. It seems requiring too much resources. So on the PC it runs good but RPi 4 can't manage it well.
 
Upvote 0
Top