-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSequenceGroup.py
45 lines (36 loc) · 1.05 KB
/
SequenceGroup.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
import time
from SequenceBase import SequenceBase
class SequenceGroup( SequenceBase ):
def __init__(self):
super(SequenceGroup, self).__init__([])
self.children = []
self.pinsChanged = []
self.delay = 0.05
def Add(self, sequence):
self.children.append(sequence)
def Restart(self):
self.seq = 0
self.lastSeq = 0
self.pinsChanged = []
for child in self.children:
child.Restart()
def ProcessNext(self):
self.pinsChanged = []
for child in self.children:
child.ProcessNext()
for child in self.children:
for childPins in child.GetPinsChanged():
self.pinsChanged.append( childPins )
return self.delay
def ProcessShutdown(self):
# put everything back to how it was
self.pinsChanged = []
for child in self.children:
child.ProcessShutdown()
for child in self.children:
for childPins in child.GetPinsChanged():
self.pinsChanged.append( childPins )
def GetPinsChanged(self):
return self.pinsChanged
def SetDelay(self, d):
self.delay = d