From b934596cfd5415ce83b5a7b42120e0f0e229937a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 19 Jul 2017 11:06:04 +0200 Subject: Add screen checker --- turtetris_master/__init__.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'turtetris_master/__init__.py') diff --git a/turtetris_master/__init__.py b/turtetris_master/__init__.py index 401accb..e7f9fab 100644 --- a/turtetris_master/__init__.py +++ b/turtetris_master/__init__.py @@ -1,19 +1,28 @@ import time from .led_output import Matrix from .usb_input import Gamepad +from .screen_checker import ScreenChecker def main(): "Main function" inpt = Gamepad() - print('Gamepad initialized') mtrx = Matrix() - print('Matrix initialized') + sc = ScreenChecker(mtrx) + mtrx.display() # Display first state while True: - print('loop!!!!') - print(inpt.check()) - mtrx.display() - time.sleep(1) + tstart = time.time() + ## + #print(inpt.check()) + if sc.tick(): + mtrx.display() + #print(mtrx.__mat__[2]) + ## + trest = (1/60) - (time.time() - tstart) + if trest > 0: + time.sleep(trest) + else: + print("Output took too long!!") if __name__ == '__main__': -- cgit v1.2.3