From: Eduardo Date: Sun, 10 Dec 2023 21:59:34 +0000 (+0100) Subject: get ram and others tests to see how fast can I update the screen X-Git-Url: http://git.edufdez.es/?a=commitdiff_plain;h=ea4040defaac232353eeec8bc6da56a8ecb8f929;p=Edus-pomo-can-dispenser.git get ram and others tests to see how fast can I update the screen --- diff --git a/main.py b/main.py index c6a9bd6..0971926 100644 --- a/main.py +++ b/main.py @@ -1,10 +1,9 @@ from machine import Pin, Timer, SPI -from libs.neopixel import ( - Neopixel, -) # https://github.com/blaz-r/pi_pico_neopixel/wiki/Library-methods-documentation # type: ignore -from libs.ili9341 import Display -from uasyncio import sleep_ms -from utils import df +from libs.neopixel import Neopixel # https://github.com/blaz-r/pi_pico_neopixel/wiki/Library-methods-documentation +from libs.ili9341 import Display, color565 +from libs.xglcd_font import XglcdFont +from time import sleep_us, ticks_cpu, ticks_us, ticks_diff +from utils import df, free # region SPI SCREEN @@ -29,11 +28,18 @@ spi = SPI( sck=Pin(TFT_CLK_PIN), ) display = Display(spi, dc=Pin(TFT_DC_PIN), cs=Pin(TFT_CS_PIN), rst=Pin(TFT_RST_PIN)) -display.clear() +display.clear(hlines=80) +display.fill_rectangle(0, 0, 240, 320, -1) # display.draw_image('ili9341/images/kururin_anim/kururin1.raw', 0, 0) # display.draw_image('ili9341/images/RaspberryPiWB128x128.raw', 0, 0, 128, 128) +# arcadepix = XglcdFont('fonts/ArcadePix9x11.c', 9, 11) +# print('Fonts loaded.') + +# def print_clock(time): +# display.draw_text(10, 10, 'Arcade Pix 9x11', arcadepix, color565(255, 0, 0), -1) + # endregion # region RGB PIXEL @@ -56,8 +62,8 @@ def move_rgb(_): # endregion # region main program -print(df()) -display.fill_rectangle(0, 0, 239, 319, -1) +print("Disk: " + df()) +print("RAM: " + free()) # makes the rgb led rotate colors rgb_timer = Timer(period=50, mode=Timer.PERIODIC, callback=move_rgb) @@ -66,6 +72,7 @@ y = 0 right = False bottom = False while True: + timer = ticks_us() if x + 128 > 239: right = True elif x == 0: @@ -84,7 +91,12 @@ while True: else: y += 1 - display.draw_image("ili9341/images/RaspberryPiWB128x128.raw", x, y, 128, 128) - sleep_ms(10) + # display.draw_image("ili9341/images/RaspberryPiWB128x128.raw", x, y, 128, 128) + + # print_clock(0) + timer = ticks_us() + timer_dif = 333 - ticks_diff(ticks_us(), timer) + if timer_dif > 0: + sleep_us(timer_dif) # endregion