add debugging on pngdec
parent
4ff4f3f122
commit
fa601bee56
|
@ -35,14 +35,23 @@ global graphics
|
||||||
def display_image(j):
|
def display_image(j):
|
||||||
# Open the PNG file
|
# Open the PNG file
|
||||||
j.open_file(CONFIG.FILENAME)
|
j.open_file(CONFIG.FILENAME)
|
||||||
|
graphics.set_pen(0)
|
||||||
|
graphics.set_font('sans')
|
||||||
|
|
||||||
# Decode the PNG
|
# Decode the PNG
|
||||||
|
try:
|
||||||
j.decode()
|
j.decode()
|
||||||
|
except Exception as e:
|
||||||
|
# if that fails, try to recover enough to show
|
||||||
|
# an error. This seems to fail sometimes and I
|
||||||
|
# don't know why.
|
||||||
|
del j
|
||||||
|
gc.collect()
|
||||||
|
graphics.text( e, 10, 200, scale=1 )
|
||||||
|
|
||||||
# write the date/time at the top
|
# write the date/time at the top
|
||||||
tz_seconds = (CONFIG.TZ_OFFSET * 3600)
|
tz_seconds = (CONFIG.TZ_OFFSET * 3600)
|
||||||
year, month, day, hour, minute, second, dow, _ = time.gmtime(time.time() + tz_seconds)
|
year, month, day, hour, minute, second, dow, _ = time.gmtime(time.time() + tz_seconds)
|
||||||
graphics.set_pen(0)
|
|
||||||
graphics.set_font('sans')
|
|
||||||
# display.text(text, x, y, wordwrap, scale, angle, spacing)
|
# display.text(text, x, y, wordwrap, scale, angle, spacing)
|
||||||
graphics.text(f"{hour:02}:{minute:02} {year}-{month}-{day}", 230, 10, scale=0.5)
|
graphics.text(f"{hour:02}:{minute:02} {year}-{month}-{day}", 230, 10, scale=0.5)
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
|
Loading…
Reference in New Issue