remove try/except, check for 'DISPLAY' in dir(board)
This commit is contained in:
parent
6965241cbb
commit
2d4f747dad
1 changed files with 21 additions and 27 deletions
|
|
@ -7,7 +7,6 @@ import gc
|
||||||
import math
|
import math
|
||||||
from random import randint
|
from random import randint
|
||||||
import time
|
import time
|
||||||
import supervisor
|
|
||||||
import displayio
|
import displayio
|
||||||
import picodvi
|
import picodvi
|
||||||
import board
|
import board
|
||||||
|
|
@ -23,35 +22,30 @@ from adafruit_display_shapes.roundrect import RoundRect
|
||||||
from adafruit_display_shapes.triangle import Triangle
|
from adafruit_display_shapes.triangle import Triangle
|
||||||
from adafruit_display_shapes.line import Line
|
from adafruit_display_shapes.line import Line
|
||||||
|
|
||||||
displayio.release_displays()
|
# check for DVI Feather with built-in display
|
||||||
|
if 'DISPLAY' in dir(board):
|
||||||
|
display = board.DISPLAY
|
||||||
|
|
||||||
# check for DVI Feather
|
# check for DVI feather without built-in display
|
||||||
if 'CKP' in dir(board):
|
elif 'CKP' in dir(board):
|
||||||
try:
|
displayio.release_displays()
|
||||||
fb = picodvi.Framebuffer(320, 240,
|
fb = picodvi.Framebuffer(320, 240,
|
||||||
clk_dp=board.CKP, clk_dn=board.CKN,
|
clk_dp=board.CKP, clk_dn=board.CKN,
|
||||||
red_dp=board.D0P, red_dn=board.D0N,
|
red_dp=board.D0P, red_dn=board.D0N,
|
||||||
green_dp=board.D1P, green_dn=board.D1N,
|
green_dp=board.D1P, green_dn=board.D1N,
|
||||||
blue_dp=board.D2P, blue_dn=board.D2N,
|
blue_dp=board.D2P, blue_dn=board.D2N,
|
||||||
color_depth=8)
|
color_depth=8)
|
||||||
except MemoryError as e:
|
display = framebufferio.FramebufferDisplay(fb)
|
||||||
print("Error:\n", str(e))
|
|
||||||
time.sleep(5)
|
|
||||||
supervisor.reload()
|
|
||||||
# otherwise assume Pico
|
# otherwise assume Pico
|
||||||
else:
|
else:
|
||||||
try:
|
displayio.release_displays()
|
||||||
fb = picodvi.Framebuffer(320, 240,
|
fb = picodvi.Framebuffer(320, 240,
|
||||||
clk_dp=board.GP12, clk_dn=board.GP13,
|
clk_dp=board.GP12, clk_dn=board.GP13,
|
||||||
red_dp=board.GP10, red_dn=board.GP11,
|
red_dp=board.GP10, red_dn=board.GP11,
|
||||||
green_dp=board.GP8, green_dn=board.GP9,
|
green_dp=board.GP8, green_dn=board.GP9,
|
||||||
blue_dp=board.GP6, blue_dn=board.GP7,
|
blue_dp=board.GP6, blue_dn=board.GP7,
|
||||||
color_depth=8)
|
color_depth=8)
|
||||||
except MemoryError as e:
|
display = framebufferio.FramebufferDisplay(fb)
|
||||||
print("Error:\n", str(e))
|
|
||||||
time.sleep(5)
|
|
||||||
supervisor.reload()
|
|
||||||
display = framebufferio.FramebufferDisplay(fb)
|
|
||||||
|
|
||||||
bitmap = displayio.Bitmap(display.width, display.height, 3)
|
bitmap = displayio.Bitmap(display.width, display.height, 3)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue