russhughes / gc9a01_mpy

Fast MicroPython driver for GC9A01 display modules written in C
Other
153 stars 31 forks source link

Help: Image Drawing Not Working #3

Closed xrolfex closed 2 years ago

xrolfex commented 2 years ago

Attempting to do a simple jpg draw on a WaveShare 240x240 round display and it doesn't draw the image.

I am using PyCharm CE with mico pi support. Pins are as followed:

Pico Pin Display
14 (GP10) BL
15 (GP11) RST
16 (GP12) DC
17 (GP13) CS
18 (GND) GND
19 (GP14) CLK
20 (GP15) DIN
05 (3v3) VCC

I can get other display drawing to work just not images, im wondering if pycharm is not sending the resource as part of the flash or not. IMG_2251

'''
    Pico Pin   Display
    =========  =======
    14 (GP10)  BL
    15 (GP11)  RST
    16 (GP12)  DC
    17 (GP13)  CS
    18 (GND)   GND
    19 (GP14)  CLK
    20 (GP15)  DIN
'''

import gc
import random
import time
from machine import Pin, SPI
import gc9a01
import vga1_bold_16x32 as font

gc.enable()
gc.collect()

def main():
    spi = SPI(1, baudrate=60000000, sck=Pin(14), mosi=Pin(15))
    tft = gc9a01.GC9A01(
        spi,
        240,
        240,
        reset=Pin(11, Pin.OUT),
        cs=Pin(13, Pin.OUT),
        dc=Pin(12, Pin.OUT),
        backlight=Pin(10, Pin.OUT),
        rotation=0)

    # enable display and clear screen
    tft.init()

    tft.fill_rect(0, 0, tft.width(), tft.height(),  gc9a01.color565(
                  random.getrandbits(8),
                  random.getrandbits(8),
                  random.getrandbits(8)))

    col_max = tft.width() - font.WIDTH*6
    row_max = tft.height() - font.HEIGHT

    tft.text(
        font,
        "Eric!",
        random.randint(0, col_max),
        random.randint(0, row_max),
        gc9a01.color565(
            random.getrandbits(8),
            random.getrandbits(8),
            random.getrandbits(8)),
        gc9a01.color565(
            random.getrandbits(8),
            random.getrandbits(8),
            random.getrandbits(8))
    )

    tft.jpg("bluemarble.jpg",
            0,
            0,
            gc9a01.SLOW)
main()
xrolfex commented 2 years ago

I found the issue. Pycharm was not set to include the files as part of the build. Thanks for the great work on the library