displays now Graphics as Splashscreen
This commit is contained in:
parent
137a385707
commit
b8a7f23f30
3 changed files with 39 additions and 2 deletions
BIN
fafo_green.png
Normal file
BIN
fafo_green.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
BIN
src/fafogreen.bmp
Normal file
BIN
src/fafogreen.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
41
src/main.py
41
src/main.py
|
|
@ -2,7 +2,7 @@
|
||||||
# MIT License; Copyright (c) 2017 Jeffrey N. Magee
|
# MIT License; Copyright (c) 2017 Jeffrey N. Magee
|
||||||
from ili934xnew import ILI9341, color565
|
from ili934xnew import ILI9341, color565
|
||||||
from machine import Pin, SPI,Timer
|
from machine import Pin, SPI,Timer
|
||||||
from ST7735 import TFT
|
from ST7735 import TFT,TFTColor
|
||||||
import m5stack
|
import m5stack
|
||||||
import tt14
|
import tt14
|
||||||
import glcdfont
|
import glcdfont
|
||||||
|
|
@ -44,7 +44,43 @@ def splash():
|
||||||
display.print("Spincoater",size=3,nowrap=True)
|
display.print("Spincoater",size=3,nowrap=True)
|
||||||
|
|
||||||
# #display.show()
|
# #display.show()
|
||||||
|
def fafo():
|
||||||
|
with open('fafogreen.bmp','rb') as f:
|
||||||
|
if f.read(2) == b'BM': #header
|
||||||
|
print("BMP@")
|
||||||
|
dummy = f.read(8) #file size(4), creator bytes(4)
|
||||||
|
offset = int.from_bytes(f.read(4), 'little')
|
||||||
|
hdrsize = int.from_bytes(f.read(4), 'little')
|
||||||
|
width = int.from_bytes(f.read(4), 'little')
|
||||||
|
height = int.from_bytes(f.read(4), 'little')
|
||||||
|
print("Image size:", width, "x", height)
|
||||||
|
|
||||||
|
if int.from_bytes(f.read(2), 'little') == 1: #planes must be 1
|
||||||
|
depth = int.from_bytes(f.read(2), 'little')
|
||||||
|
print("DEPTH",depth)
|
||||||
|
if depth == 24 and int.from_bytes(f.read(4), 'little') == 0:#compress method == uncompressed
|
||||||
|
print("Image size:", width, "x", height)
|
||||||
|
rowsize = (width * 3 + 3) & ~3
|
||||||
|
if height < 0:
|
||||||
|
height = -height
|
||||||
|
flip = False
|
||||||
|
else:
|
||||||
|
flip = True
|
||||||
|
w, h = width, height
|
||||||
|
if w > 128: w = 128
|
||||||
|
if h > 160: h = 160
|
||||||
|
tft._setwindowloc((0,0),(w - 1,h - 1))
|
||||||
|
for row in range(h):
|
||||||
|
if flip:
|
||||||
|
pos = offset + (height - 1 - row) * rowsize
|
||||||
|
else:
|
||||||
|
pos = offset + row * rowsize
|
||||||
|
if f.tell() != pos:
|
||||||
|
dummy = f.seek(pos)
|
||||||
|
for col in range(w):
|
||||||
|
bgr = f.read(3)
|
||||||
|
tft._pushcolor(TFTColor(bgr[2],bgr[1],bgr[0]))
|
||||||
|
time.sleep(10)
|
||||||
def tftprinttest():
|
def tftprinttest():
|
||||||
tft.fill(TFT.BLACK)
|
tft.fill(TFT.BLACK)
|
||||||
v = 30
|
v = 30
|
||||||
|
|
@ -373,7 +409,8 @@ with open("config.json", "r") as f:
|
||||||
#display.set_font(tt32)
|
#display.set_font(tt32)
|
||||||
tft.fill(TFT.BLACK)
|
tft.fill(TFT.BLACK)
|
||||||
|
|
||||||
splash()
|
# splash()
|
||||||
|
fafo()
|
||||||
# for ff in fonts:
|
# for ff in fonts:
|
||||||
# display.set_font(ff)
|
# display.set_font(ff)
|
||||||
# display.print(text)
|
# display.print(text)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue