From 80c3a1db8f7783a41f0619594fbf3a007e06d75e Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Sat, 14 Nov 2015 23:35:28 +0100 Subject: [PATCH] Assert display size from variables. --- upcd8544.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/upcd8544.py b/upcd8544.py index d404d27..e257487 100644 --- a/upcd8544.py +++ b/upcd8544.py @@ -113,9 +113,9 @@ class PCD8544: # 0x0c - normal display mode def position(self, x, y): - """ goto to column x in seg y """ - assert 0 <= x <= 83, "x must be between 0 and 83" - assert 0 <= y <= 5, "y must be between 0 and 5" + """ set cursor to bank y, column x """ + assert 0 <= x < self.width, "x must be between 0 and 83" + assert 0 <= y < self.height // 8, "y must be between 0 and 5" self.command([x + 0x80, y + 0x40]) def clear(self):