diff options
author | Florian Heilmann <Florian.Heilmann@gmx.net> | 2020-06-07 16:25:19 +0000 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2020-06-08 16:40:45 -0400 |
commit | 3dcac1308e6fe132487c45824d142609f2571df6 (patch) | |
tree | 29a45f14e29ce3361830853a7808125a05e18d72 /klippy/extras/display/uc1701.py | |
parent | 722770f62ff493b5ecef553bf36be84de3c23907 (diff) | |
download | kutter-3dcac1308e6fe132487c45824d142609f2571df6.tar.gz kutter-3dcac1308e6fe132487c45824d142609f2571df6.tar.xz kutter-3dcac1308e6fe132487c45824d142609f2571df6.zip |
display: Move glyph definition to printer config
This commit allows to modify the icons (or glyphs) in the displays that
support it. Existing icons can be modified and new icons can be added via
a [display_glyph] section in the config.
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
Diffstat (limited to 'klippy/extras/display/uc1701.py')
-rw-r--r-- | klippy/extras/display/uc1701.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/klippy/extras/display/uc1701.py b/klippy/extras/display/uc1701.py index f19d9f97..690ea0bc 100644 --- a/klippy/extras/display/uc1701.py +++ b/klippy/extras/display/uc1701.py @@ -5,7 +5,7 @@ # # This file may be distributed under the terms of the GNU GPLv3 license. import logging -import icons, font8x14, extras.bus +import font8x14, extras.bus BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000 @@ -23,10 +23,6 @@ class DisplayBase: self.font = [self._swizzle_bits(bytearray(c)) for c in font8x14.VGA_FONT] self.icons = {} - for name, icon in icons.Icons16x16.items(): - top1, bot1 = self._swizzle_bits([d >> 8 for d in icon]) - top2, bot2 = self._swizzle_bits(icon) - self.icons[name] = (top1 + top2, bot1 + bot2) def flush(self): # Find all differences in the framebuffers and send them to the chip for new_data, old_data, page in self.all_framebuffers: @@ -83,6 +79,11 @@ class DisplayBase: if (bits << col) & 0x80: page[pix_x] ^= bit pix_x += 1 + def set_glyphs(self, glyphs): + for glyph_name, glyph_data in glyphs.items(): + top1, bot1 = self._swizzle_bits([d >> 8 for d in glyph_data]) + top2, bot2 = self._swizzle_bits(glyph_data) + self.icons[glyph_name] = (top1 + top2, bot1 + bot2) def write_glyph(self, x, y, glyph_name): icon = self.icons.get(glyph_name) if icon is not None and x < 15: |