Cover image for Day 2: Enough with e-ink, let's try TFT Gizmo

Day 2: Enough with e-ink, let's try TFT Gizmo

whykay profile image whykay 👩đŸģ‍đŸ’ģ🐈đŸŗī¸â€đŸŒˆ (she/her) ãƒģ2 min read

Decided to switch to TFT Gizmo - e-ink Gizmo is very slow to work with. It's all ready and set up, and passed the TFT Gizmo test.

So finding out how to talk to TFT Gizmo on CPX with Circuit Python.

Alt Text

Modified code so it loads up a bitmap on the TFT Gizmo.'

Alt Text

ℹī¸ https://learn.adafruit.com/adafruit-tft-gizmo/tft-gizmo-test

Back to the Processing on the Pi.

Running it via command line (it's warn it's not fully supported on newer versions of Java or OpenJDK).

ℹī¸ https://py.processing.org/tutorials/command-line/

Created the Python script from the Processing sketch sample. Got the processing-py.jar file.

java -jar processing-py.jar [name of my python script]

It worked!

I wanted to save the image to the disk - used save(), and that worked.

Next I want the dialog to close after it ran - used exit(), and that worked also.

Alt Text

Next thing now is to pop that image onto the TFT Gizmo.

Loaded up the code from the e-ink Gizmo (will be modifying for TFT Gizmo) and its having problem not finding displayiomodule. Looks like I need to flash it with cpx with displayio (after a bit of troubleshooting).

ℹī¸ https://learn.adafruit.com/adafruit-tft-gizmo/circuitpython-displayio-quickstart

Then it needed also adafruit_pypixelbuf module.

Ok, now I can modify to look for tft calls nows instead of e-ink.

Moments later, I hit a problem... The dreaded memory allocation errors.

ℹī¸ https://learn.adafruit.com/adafruit-circuit-playground-express/frequently-asked-questions

I forgot the flash memory for CPX is quite small.

ℹī¸ https://learn.adafruit.com/adafruit-circuit-playground-express/overview

I've removed comments and imports not needed. I'm only testing the example and can only display 1 of the 3 parts of the code

ℹī¸ https://learn.adafruit.com/adafruit-tft-gizmo/circuitpython-displayio-quickstart

📍 In case I need to reduce size of my jpg image: https://stackoverflow.com/questions/59483536/why-does-pil-pillow-image-save-reduce-file-size

Ok, I just want to bare minimum load an image I generated earlier with Processing, it's a JPG. It gave an error saying it doesn't not support the file format, so I converted it to BMP with PIL.

ℹī¸ https://www.daniweb.com/programming/software-development/threads/253957/converting-an-image-file-png-to-a-bitmap-file

And tried to load it again, and it worked.

NOTE: READ THE TOP "GREEN BANNER" ABOUT MEM CONSTRAINTS ON https://learn.adafruit.com/adafruit-tft-gizmo/circuitpython-displayio-quickstart 😅

(Thanks to Mick for finding this https://github.com/adafruit/Adafruit_CircuitPython_ST7789/issues/9)



Posted on by:

whykay profile

whykay 👩đŸģ‍đŸ’ģ🐈đŸŗī¸â€đŸŒˆ (she/her)


Volunteer: Coder, tech event organiser, mentor, advocates diversity in tech | Working as Maker Advocate


Editor guide