from machine import Pin, I2C
from Log import *
from EPaperDisplay import *
if __name__ == "__main__":
Log.i("EPaperDisplay: Running self-contained verification test")
try:
display = EPaperDisplay(sck=18, mosi=23, cs=15, dc=14, rst=12, busy=13, width=296, height=128, rotation=0)
# Test clear
display.clear(EPaperDisplay.WHITE)
# Test basic shapes
display.rect(5, 5, 118, 240, EPaperDisplay.BLACK)
display.fill_rect(10, 10, 40, 40, EPaperDisplay.BLACK)
display.circle(64, 100, 20, EPaperDisplay.BLACK, f=False)
display.triangle(20, 180, 64, 140, 100, 180, EPaperDisplay.BLACK, f=True)
# Test text
display.showText("CrowPanel 2.13", row=15, col=60, size=1, show=False)
display.showText("EPD TEST", row=15, col=200, size=2, show=False)
display.showNumber(2026, row=15, col=225, size=1, show=False)
# Test bitmap drawing helper
icon_data = bytearray([0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF]) # 8x8 square border
display.draw_bitmap(icon_data, 90, 10, 8, 8)
# Trigger display update
display.show(full_update=True)
display.sleep()
Log.i("Testing complete - EPaperDisplay checks passed successfully")
except Exception as e:
Log.e(f"Testing encountered error: {e}")