Need advice in my Project.

Started by Melssj5, April 01, 2018, 06:22:27 AM

Previous topic - Next topic

Melssj5

Hi all friends, I am in a project and need advice.

Actually I am building a custom instrument cluster for my car, I am doing this:

I have a class MyRenderer implements GLSurfaceView.Renderer

that loops rendering the world and applying the changes on it, my arduino board reads the events on the original cluster conenctor and sends to the android app via tcp. Most of changes on the world are showing/hiding indicators (low beams, high beams, parking brake, low fuel, etc), they appear and dissapear when expected, but..... when moving the RPM and SPEED needles the move slow and its not continous.

I am sending the actual speed or rpm value from the arduino to the render thread. lets say 1000 rpms ans if the next read its 1200 rpms for a fast engine movementthe needle will JUMP from 1000 rpms to 1200 rpms but it wont move smootly, it will jump..... How can I achieve a more natural movement????

I have tested moving increasing 100 rpms on wach arduino loop, even with that small movements the jpct app wont show smooth movement, in fact I see delays between each loop.

ANy ideas???
Nada por ahora

AeroShark333

I would create a variable for the renderer and a variable for the iast value from the Arduino.
Then for every draw call: rendererVariable = 0.8f* rendererVariable + 0.2f  * arduinoValue;
So it will slowly adopt to the arduinoValue.

I'm not sure if you mean something like this...

Melssj5

while asking a new question I answered my self...

1.- doing a different Thread than the renderThread to listen to commands via tcp and make the RenderThread and the TCP Thread independent from each other.

2.-Writting the values read from the tcp connection in static variables in order to be shared between the TCPThread and the RenderThread

3.-defining a maxium steep value in order the have a smooth movement

4.-doing the movement in intervals of that maxium steep size until reaching the current value (increasing or decreaseing) and moving just one step on each RenderThread iteration
Nada por ahora