-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmatrices_test.py
executable file
·94 lines (74 loc) · 2.45 KB
/
matrices_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020-2021 by Murray Altheim. All rights reserved. This file is part
# of the Robot Operating System project, released under the MIT License. Please
# see the LICENSE file included as part of this package.
#
# This tests the 11x7 Matrix, including several custom modes.
#
import pytest
import sys, time
from colorama import init, Fore, Style
init()
from lib.logger import Logger, Level
from lib.i2c_scanner import I2CScanner
from lib.enums import Orientation
from lib.matrix import Matrices
# ..............................................................................
@pytest.mark.unit
def test_matrix():
_log = Logger('matrix-test', Level.INFO)
_matrices = None
try:
_log.info(Fore.CYAN + 'start matrices test...')
_matrices = Matrices(Level.INFO)
_log.info('matrix write text...')
_matrices.text('HE', 'LP')
time.sleep(3)
_matrices.clear()
time.sleep(1)
_log.info('matrix on...')
_matrices.on()
time.sleep(2)
_log.info('matrix off...')
_matrices.clear()
time.sleep(1)
_log.info('manual gradient wipes...')
for i in range(1,8):
_matrices.vertical_gradient(i)
time.sleep(0.02)
for i in range(7,-1,-1):
_matrices.vertical_gradient(i)
time.sleep(0.02)
time.sleep(1)
for i in range(1,11):
_matrices.horizontal_gradient(i)
time.sleep(0.02)
for i in range(11,-1,-1):
_matrices.horizontal_gradient(i)
time.sleep(0.02)
time.sleep(1)
_log.info('starting matrix vertical wipe...')
_matrices.wipe(Matrices.DOWN, True, 0.00)
time.sleep(0.0)
_matrices.wipe(Matrices.DOWN, False, 0.00)
_matrices.clear()
time.sleep(1)
_log.info('starting matrix horizontal wipe right...')
_matrices.wipe(Matrices.RIGHT, True, 0.00)
time.sleep(0.0)
_matrices.wipe(Matrices.RIGHT, False, 0.00)
_matrices.clear()
# UP and LEFT not implemented
except KeyboardInterrupt:
_log.info(Fore.MAGENTA + 'Ctrl-C caught: interrupted.')
finally:
_log.info('closing matrix test...')
if _matrices:
_matrices.clear()
# call main ......................................
def main():
test_matrix()
if __name__== "__main__":
main()