mirror of
https://github.com/Crocmagnon/plant-badger.git
synced 2024-11-22 09:28:03 +01:00
Display plant picture
This commit is contained in:
parent
9e42a37c68
commit
2f30f2c8be
2 changed files with 15 additions and 4 deletions
|
@ -1,5 +1,7 @@
|
|||
from badger2040w import WIDTH, Badger2040W
|
||||
import urequests
|
||||
import jpegdec
|
||||
|
||||
from badger2040w import WIDTH, Badger2040W, UPDATE_NORMAL
|
||||
|
||||
import secrets
|
||||
from secrets import HA_BASE_URL, HA_ACCESS_TOKEN
|
||||
|
@ -7,14 +9,19 @@ from secrets import HA_BASE_URL, HA_ACCESS_TOKEN
|
|||
|
||||
display = Badger2040W()
|
||||
display.led(128)
|
||||
display.set_update_speed(2)
|
||||
display.set_update_speed(UPDATE_NORMAL)
|
||||
jpeg = jpegdec.JPEG(display.display)
|
||||
|
||||
BLACK = 0
|
||||
WHITE = 15
|
||||
IMAGE_WIDTH = 104
|
||||
|
||||
display.set_pen(BLACK)
|
||||
display.clear()
|
||||
display.connect()
|
||||
|
||||
LINE_START_OFFSET = 3
|
||||
STATUS_VALUE_OFFSET = 25
|
||||
LINE_START_OFFSET = IMAGE_WIDTH + 3
|
||||
STATUS_VALUE_OFFSET = IMAGE_WIDTH + 25
|
||||
|
||||
|
||||
class HAError(Exception):
|
||||
|
@ -124,6 +131,10 @@ class HAPlant:
|
|||
display.set_pen(WHITE)
|
||||
display.clear()
|
||||
|
||||
# Display image
|
||||
jpeg.open_file("/images/plant.jpg")
|
||||
jpeg.decode(0, 0)
|
||||
|
||||
# Draw the page header
|
||||
display.set_pen(BLACK)
|
||||
display.rectangle(0, 0, WIDTH, 20)
|
||||
|
|
BIN
src/images/plant.jpg
Normal file
BIN
src/images/plant.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Loading…
Reference in a new issue