micronEC/welcome.py
2023-11-02 19:00:25 +01:00

51 lines
1.7 KiB
Python

"""
micronEC: Simple, easy-to-use hardware counter. Raspberry Pico basis. 16*2 LCD display. micronEC.
Copyright (C) 2023 Benjamin Burkhardt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import time
"""
WelcomeScreen:
provide a simple welcome/startup screen
"""
class WelcomeScreen:
def __init__(self, lcd):
self.lcd = lcd
def show_welcome(self, loops=1): # loops says how often the Starting text goes through
if loops < 1: loops = 1
padding = " " # 16 spaces
started_str = " Started! "
for i in range(loops):
line1 = padding + "Starting..." + padding
line2 = " micronEC "
for i in range(32):
self.lcd.putstr(line1[0:16])
self.lcd.move_to(0,1)
self.lcd.putstr(line2[0:16])
line1 = line1[1:]
self.lcd.move_to(0,0)
self.lcd.putstr(started_str)
# now fade down
time.sleep(2)
self.lcd.move_to(0,0)
self.lcd.putstr(padding + started_str)
time.sleep(0.1)
self.lcd.clear()