Added the WelcomeScreen library
This commit is contained in:
34
utils.py
34
utils.py
@@ -27,37 +27,3 @@ def log(log_level: int, message: str):
|
||||
elif cfg.LOG_LEVEL >= log_level: # if log level is valid
|
||||
print(f"[{log_mapping[log_level]}] {message}")
|
||||
|
||||
|
||||
"""
|
||||
Simple function that displays a startup "welcome" screen
|
||||
Configurable in config.py
|
||||
"""
|
||||
def show_welcome(): # cycles says how often the startup text goes through
|
||||
cycles = cfg.STARTUP_WELCOME_CYCLES
|
||||
if cycles < 1:
|
||||
cycles = 1
|
||||
|
||||
padding = " "*cfg.LCD_I2C_NUM_COLS
|
||||
started_str = cfg.STARTUP_MESSAGE_FINISHED
|
||||
starting_str = cfg.STARTUP_MESSAGE_STARTING
|
||||
|
||||
|
||||
# slide the first line over the display (animated from right to left)
|
||||
for i in range(cycles):
|
||||
line1 = padding + starting_str + padding
|
||||
line2 = cfg.STARTUP_PROJECT_NAME
|
||||
for i in range(cfg.LCD_I2C_NUM_COLS + len(starting_str)):
|
||||
cfg.LCD.putstr(line1[0:16])
|
||||
cfg.LCD.move_to(0,1)
|
||||
cfg.LCD.putstr(line2[0:16])
|
||||
line1 = line1[1:]
|
||||
|
||||
cfg.LCD.move_to(0,0)
|
||||
cfg.LCD.putstr(started_str)
|
||||
|
||||
# now fade down
|
||||
sleep(2)
|
||||
cfg.LCD.move_to(0,0)
|
||||
cfg.LCD.putstr(padding + started_str)
|
||||
sleep(0.1)
|
||||
cfg.LCD.clear()
|
||||
|
||||
Reference in New Issue
Block a user