aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/display/hd44780.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-09-20 12:40:30 -0400
committerKevinOConnor <kevin@koconnor.net>2018-09-21 16:39:38 -0400
commitc8d9d575a1eaddf536002b3a4330e5e3b4dc9ad1 (patch)
tree41f94a7c57556d374ee0050dbcb9ab1a104626c4 /klippy/extras/display/hd44780.py
parent2a5778be3a921a59733ee85791d18ae0b8ff4a92 (diff)
downloadkutter-c8d9d575a1eaddf536002b3a4330e5e3b4dc9ad1.tar.gz
kutter-c8d9d575a1eaddf536002b3a4330e5e3b4dc9ad1.tar.xz
kutter-c8d9d575a1eaddf536002b3a4330e5e3b4dc9ad1.zip
display: Support writing single character glyphs using write_glyph()
Add write_glyph() support to hd44780.py. Update uc1701.py and st7920.py to support writing single character glyphs via write_glyph(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/display/hd44780.py')
-rw-r--r--klippy/extras/display/hd44780.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/klippy/extras/display/hd44780.py b/klippy/extras/display/hd44780.py
index e4fd971e..d864ceaa 100644
--- a/klippy/extras/display/hd44780.py
+++ b/klippy/extras/display/hd44780.py
@@ -100,11 +100,18 @@ class HD44780:
data = data[:20 - min(x, 20)]
pos = [0, 40, 20, 60][y] + x
self.text_framebuffer[0][pos:pos+len(data)] = data
+ def write_glyph(self, x, y, glyph_name):
+ char = TextGlyphs.get(glyph_name)
+ if char is not None:
+ # Draw character
+ self.write_text(x, y, char)
+ return 1
+ return 0
def clear(self):
self.text_framebuffer[0][:] = ' '*80
HD44780_chars = [
- # Thermometer
+ # Extruder (a thermometer)
0b00100,
0b01010,
0b01010,
@@ -122,7 +129,7 @@ HD44780_chars = [
0b11111,
0b00000,
0b00000,
- # Speed factor
+ # Feed rate
0b11100,
0b10000,
0b11000,
@@ -168,3 +175,14 @@ HD44780_chars = [
0b11111,
0b00000,
]
+
+TextGlyphs = {
+ 'right_arrow': '\x7e',
+ 'extruder': '\x00',
+ 'bed': '\x01',
+ 'feedrate': '\x02',
+ 'clock': '\x03',
+ 'degrees': '\x04',
+ 'usb': '\x05',
+ 'sd': '\x06',
+}