Author Topic: Need advice in my Project.  (Read 1975 times)

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Need advice in my Project.
« on: April 01, 2018, 06:22:27 am »
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

Offline AeroShark333

  • float
  • ****
  • Posts: 319
    • View Profile
Re: Need advice in my Project.
« Reply #1 on: April 01, 2018, 03:32:49 pm »
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...

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Re: Need advice in my Project.
« Reply #2 on: April 03, 2018, 08:19:09 pm »
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