aboutsummaryrefslogtreecommitdiff
path: root/turtetris_master/__init__.py
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2017-07-19 11:06:04 +0200
committerKarel Kočí <karel.koci@nic.cz>2017-07-19 14:31:18 +0200
commitb934596cfd5415ce83b5a7b42120e0f0e229937a (patch)
treeeba32535681447d1eedad0e8f1f40f299f86f027 /turtetris_master/__init__.py
parentdd8bcc2da80d15280b9aa94cec648fbdac576cc3 (diff)
downloadturris-tetris-b934596cfd5415ce83b5a7b42120e0f0e229937a.tar.gz
turris-tetris-b934596cfd5415ce83b5a7b42120e0f0e229937a.tar.bz2
turris-tetris-b934596cfd5415ce83b5a7b42120e0f0e229937a.zip
Add screen checker
Diffstat (limited to 'turtetris_master/__init__.py')
-rw-r--r--turtetris_master/__init__.py21
1 files changed, 15 insertions, 6 deletions
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__':