aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/display/hd44780.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-08-25 10:36:45 -0400
committerKevin O'Connor <kevin@koconnor.net>2021-08-25 10:36:45 -0400
commit84ac5b0146cbcec46419d4636b949f144992072e (patch)
tree81aaefd6ea5f939b9ad23935bdfbfaf4eefcb3b3 /klippy/extras/display/hd44780.py
parent75183bfb86c7003d3bac0116dba7765e4a4ab241 (diff)
downloadkutter-84ac5b0146cbcec46419d4636b949f144992072e.tar.gz
kutter-84ac5b0146cbcec46419d4636b949f144992072e.tar.xz
kutter-84ac5b0146cbcec46419d4636b949f144992072e.zip
configfile: Support config.getchoice() with integer keys
If the choice mapping uses integer keys then lookup the config option using self.getint(). This simplifies the callers and improves the encoding of the printer.configfile.settings export. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/display/hd44780.py')
-rw-r--r--klippy/extras/display/hd44780.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/klippy/extras/display/hd44780.py b/klippy/extras/display/hd44780.py
index 7d7b5c6b..ea161348 100644
--- a/klippy/extras/display/hd44780.py
+++ b/klippy/extras/display/hd44780.py
@@ -7,8 +7,8 @@
import logging
BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000
-LINE_LENGTH_DEFAULT="20"
-LINE_LENGTH_OPTIONS={"16":16, "20":20}
+LINE_LENGTH_DEFAULT=20
+LINE_LENGTH_OPTIONS={16:16, 20:20}
TextGlyphs = { 'right_arrow': '\x7e' }
@@ -22,9 +22,9 @@ class HD44780:
pins = [ppins.lookup_pin(config.get(name + '_pin'))
for name in ['rs', 'e', 'd4', 'd5', 'd6', 'd7']]
self.hd44780_protocol_init = config.getboolean('hd44780_protocol_init',
- True)
+ True)
self.line_length = config.getchoice('line_length', LINE_LENGTH_OPTIONS,
- LINE_LENGTH_DEFAULT)
+ LINE_LENGTH_DEFAULT)
mcu = None
for pin_params in pins:
if mcu is not None and pin_params['chip'] != mcu:
@@ -43,9 +43,9 @@ class HD44780:
self.all_framebuffers = [
# Text framebuffers
(self.text_framebuffers[0], bytearray('~'*2*self.line_length),
- 0x80),
+ 0x80),
(self.text_framebuffers[1], bytearray('~'*2*self.line_length),
- 0xc0),
+ 0xc0),
# Glyph framebuffer
(self.glyph_framebuffer, bytearray('~'*64), 0x40) ]
def build_config(self):