display: Choose arrow character based on display

Choose the arrow character based on whether the display is ST7920 or
HD44780.

Signed-off-by: Marcio Teixeira <marcio@alephobjects.com>
This commit is contained in:
Marcio Teixeira 2018-02-21 08:15:20 -07:00 committed by Kevin O'Connor
parent 923954772f
commit 04602b2470
1 changed files with 3 additions and 1 deletions

View File

@ -16,6 +16,7 @@ BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000
HD44780_DELAY = .000037
class HD44780:
char_right_arrow = '\x7e'
def __init__(self, config):
self.printer = config.get_printer()
# pin config
@ -110,6 +111,7 @@ class HD44780:
ST7920_DELAY = .000020 # Spec says 72us, but faster is possible in practice
class ST7920:
char_right_arrow = '\x1a'
def __init__(self, config):
printer = config.get_printer()
# pin config
@ -434,7 +436,7 @@ class PrinterLCD:
def format_temperature(self, info):
temperature, target = info['temperature'], info['target']
if target and abs(temperature - target) > 2.:
return "%3d/%-3d" % (temperature, target)
return "%3d%s%-3d" % (temperature, self.lcd_chip.char_right_arrow, target)
return "%3d" % (temperature)
def work_event(self, eventtime):
self.lcd_chip.clear()