|
Post by desiredshoe on May 21, 2018 17:25:59 GMT -8
Hello everyone, I'm looking to make an automotive display for my car and happen to stumble across gameduino and the ftdi chipset. I had a decent prototype with a Nextion display but the quality left a lot to be desired. I'm running an hotmcu display, FT811CB-HY50HD with an Arduino Mega as the MCU. I have the display up and running and the code is working how it should but I'm having an issue with sensor input delay. There seems to be a .5 second delay from changing the input to when the screen refreshes. I'm monitoring the serial data and that seems to be updating instantly. Since this display will be using in an automotive environment with fast acting sensors, I would like the display to react pretty quick to some inputs. Below is a video showing the delay I'm talking about. I've tried playing with the SPI speed but it's still the same. If anyone knows a fix, I would greatly appreciate it. photos.google.com/share/AF1QipOg--8Wr3xfvGXt-kRSg_UdWM7wer5DUSCgEqYqKPp0sksBLEzAOFgmvwIVACOsvw?key=bmxPX2xELWJOWUs4NVoxVFluanJTQjhzNjItOVJ3
|
|
|
Post by desiredshoe on May 21, 2018 18:09:11 GMT -8
Here's my code...
#include <SPI.h> #include <GD3.h>
#define PDPin 8
int analogPIN = 0; int val = 0; int KPA = 0;
void setup() { Serial.begin(9600); pinMode(PDPin, OUTPUT); digitalWrite(PDPin, HIGH); delay(20); digitalWrite(PDPin, LOW); delay(20); digitalWrite(PDPin, HIGH); delay(20);
delay(500); GD.begin(3);
for (int i = 0; i <= 0; i++) { GD.wr(REG_PWM_DUTY, i); delay(100); } }
void loop() { GD.ClearColorRGB(0x000000); GD.Clear(); GD.cmd_text(600, GD.h / 2, 31, OPT_CENTER, "KPA");
GD.ColorRGB(0x229954); GD.cmd_gauge(200,200,220,12544,9,5,(KPA*1.23),250);
GD.ColorRGB(0x000000); GD.PointSize(16 * 150); GD.Begin(POINTS); GD.Vertex2ii(200,200);
GD.ColorRGB(0xFF0000); GD.cmd_gauge(200,200,200,12544,9,5,KPA,100); GD.ClearColorRGB(255,255,255);
GD.ColorRGB(0xFFFFFF); GD.cmd_number(200,300,31,OPT_RIGHTX,(KPA)); GD.ColorRGB(0xFF0000); GD.cmd_gauge(600,147,112,12544, 5,5,KPA,250); GD.cmd_bgcolor(0x000000); GD.cmd_progress(20,450,600,20,OPT_FLAT,KPA,250);
GD.swap(); val = analogRead(analogPIN); KPA = map(val, 0, 1023, 0, 100); Serial.println(KPA); }
|
|
|
Post by jamesbowman on May 22, 2018 6:02:46 GMT -8
Yes, the GPU has a graphics work FIFO, which is full all the time and it's holding about 30 frames of data. That's why it's drawing aboout .5 seconds in the past.
To fix this call:
GD.finish(); just before you do the analog sensing.
GD.finish() returns after all drawing has actually reached the display. It's similar to OpenGL's glFinish().
|
|
|
Post by desiredshoe on May 22, 2018 14:47:34 GMT -8
Thanks! Works perfectly now!
Now begins the fun part of designing the gauge layout.
|
|