display: Allow redrawing the screen up to 10 times per second

Increase the maximum redraw rate from 4 times per second to 10 times
per second.  Some users have reported slower rendering times as a
result of 8fa1c977.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-08-24 18:57:53 -04:00
parent af43faa3f2
commit ff6e879349
1 changed files with 8 additions and 3 deletions

View File

@ -8,6 +8,11 @@
import logging, os, ast
from . import hd44780, st7920, uc1701, menu
# Normal time between each screen redraw
REDRAW_TIME = 0.500
# Minimum time between screen redraws
REDRAW_MIN_TIME = 0.100
LCD_chips = {
'st7920': st7920.ST7920, 'hd44780': hd44780.HD44780,
'uc1701': uc1701.UC1701, 'ssd1306': uc1701.SSD1306, 'sh1106': uc1701.SH1106,
@ -190,21 +195,21 @@ class PrinterLCD:
def screen_update_event(self, eventtime):
if self.redraw_request_pending:
self.redraw_request_pending = False
self.redraw_time = eventtime + 0.250
self.redraw_time = eventtime + REDRAW_MIN_TIME
self.lcd_chip.clear()
# update menu component
if self.menu is not None:
ret = self.menu.screen_update_event(eventtime)
if ret:
self.lcd_chip.flush()
return eventtime + .500
return eventtime + REDRAW_TIME
# Update normal display
try:
self.show_data_group.show(self, self.display_templates, eventtime)
except:
logging.exception("Error during display screen update")
self.lcd_chip.flush()
return eventtime + .500
return eventtime + REDRAW_TIME
def request_redraw(self):
if self.redraw_request_pending:
return