Close

First version of the display is done

A project log for GC9A01 Flight Displays

Using ESP32 with GC9A01 round displays to visualize flight instruments

dvid-mtDávid Máté 12/27/2022 at 18:310 Comments

Preface

I've always wanted some flight simulator equipment at home. Of course one could always buy some setup in a shop, but I prefer building my own stuff. I've already made myself a rudder pedal, and a throttle quadrant. I also have an ongoing project for the radio stack as well, but the most important step for me is to make working gauges.

Of course one could go to ebay, and purchase some real avionics, fiddle with it, and call it a day, but it's pretty expensive. So I bought some GC9A01 circular displays.... 

On a normal plane, there are six primary instruments ("six-pack"), which are necessary for a good flight. These are:

From these six, the Airspeed Indicator, the Altimeter, the Vertical Speed Indicator and the Turn Coordinator are pretty simple. We have a static dial in the background, and some moving hands. (Well, actually the Turn Coordinator is an exotic animal, but I'll address that in the future hopefully)

The Road to the current status

The problem arises with the Heading Indicator. It has a static plane in the middle, and the dial itself rotates. When I first tried to tackle this problem, I've used an ESP8266. I've been using TFT_eSPI as my main library. It can draw rotated sprites, but it needs to be in the RAM. For the GC9A01 this means 240*240*bpp. The 8266 simply aren't enough for this task. I've tried to use the Arduino_GFX library, I even wrote some extensions for it to be able to draw rotated text, but at the end of the day I still felt that I should upgrade the microcontroller. So I've bought a bunch of ESP-32S. After I managed to get the connections correctly, and had something on my display, I've loaded my original code. As ESP32 has 4 megabytes of PSRAM, we are not so tight on memory budget anymore. The process was the following:

  1. Draw the rotated dial
  2. Draw the plane
  3. Repeat

The problem with this approach is that the plane logo will flicker, as it's drawn after the dial is drawn. We can easily solve this by allocating a sprite as a framebuffer, and draw the two sprites on it, then draw the framebuffer sprite on the screen.

This means we need another sprite which is 240x240. The current version will only work if the dial is loaded on an 8bpp sprite. I'm still not really sure why, but I'm happy that I see my dial rotating without flickering.

What's next

First I'll try to draw some more appealing dial, as the current one is a bit botched :) I've been using LCD Image Converter to convert my 32 bit png to RGB565, and somehow the colors aren't in the order that they are supposed to be, so I hacked the image, removed colors, and it's not really good looking.

If that goes well, I'll address the previously mentioned issue with the 16 bit dial not drawing. Maybe indexed colors will work better.

After I'm satisfied with the result, I'll write some interfacing code with the SimConnect SDK, so I can see the results real time.

Discussions