diff --git a/ChaseFade.py b/ChaseFade.py index 111bf12..c05e843 100644 --- a/ChaseFade.py +++ b/ChaseFade.py @@ -11,6 +11,7 @@ def UserInput(): Color1 = Color2 = Colors = ReversedDevice = OnlySet = Zones = None Speed = 50 + Delay = 1 for arg in sys.argv: if arg == '--C1': Pos = sys.argv.index(arg) + 1 @@ -70,9 +71,11 @@ def UserInput(): Zones += [Z] elif arg == '--speed': Speed = int(sys.argv[(sys.argv.index(arg) + 1)]) + elif arg == '--delay': + Delay = int(sys.argv[(sys.argv.index(arg) + 1)]) else: pass - return(Color1, Color2, Colors, Speed, ReversedDevice, OnlySet, Zones) + return(Color1, Color2, Colors, Speed, Delay, ReversedDevice, OnlySet, Zones) def SetStatic(Dlist): """A quick function I use to make sure that everything is in direct or static mode""" @@ -92,7 +95,7 @@ def Debug(Output): if DEBUG: print(Output) -def InfiniteCycle(Colors, Zone, Passes, Speed): +def InfiniteCycle(Colors, Zone, Passes, Speed, Delay): RunThrough = 0 FadeCount = 5 * Passes ColorFades = [] @@ -155,13 +158,15 @@ def InfiniteCycle(Colors, Zone, Passes, Speed): ColorFadeIndex += 1 else: ColorFadeIndex = 0 - time.sleep(1) + if Delay != 0: + time.sleep(Delay) elif ZOType == ZoneType.MATRIX: pass #print('matrix support not done yet') if __name__ == '__main__': - C1, C2, Colors, Speed, Reversed, Enabled, Zones = UserInput() + Debug(client.devices) + C1, C2, Colors, Speed, Delay, Reversed, Enabled, Zones = UserInput() if Colors == None: Colors = [] if C1 == None: @@ -186,6 +191,7 @@ def InfiniteCycle(Colors, Zone, Passes, Speed): SetStatic(Enable) for Device in Enable: + Debug(Device.zones) ReverseBool = False if Reversed != None: for R in Reversed: @@ -199,8 +205,7 @@ def InfiniteCycle(Colors, Zone, Passes, Speed): setattr(zone, 'index', -6) setattr(zone, 'length', len(zone.leds)) setattr(zone, 'reverse', ReverseBool) - LEDAmount = len(zone.leds) # the amount of leds in a zone - Thread = threading.Thread(target=InfiniteCycle, args=(Colors, zone, Passes, Speed), daemon=True) + Thread = threading.Thread(target=InfiniteCycle, args=(Colors, zone, Passes, Speed, Delay), daemon=True) Thread.start() - Thread.join() \ No newline at end of file + Thread.join() diff --git a/README.md b/README.md index 939defd..755b2d3 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ Effect (left to right), Flag (top to bottom) |C2 | No | No | Yes | Yes | No | No | Yes | No | No | No | No | No | |Colors | No | No | No | Yes | No | No | No | No | No | No | No | No | |Speed | No | Yes | No | Yes | No | No | Yes | No | Yes | No | No | No | +|Delay | No | No | No | Yes | No | No | No | No | No | No | No | No | |Reversed | No | No | Yes | Yes | No | No | Yes | Yes | Yes | Yes | No | No | |Only-Set | No | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | |Only-Zones | No | No | No | Yes | No | No | No | No | No | No | No | No | @@ -64,6 +65,8 @@ Effect (left to right), Flag (top to bottom) * ``--speed``: Self explanitory, It is kinda hard to implement or I am lazy so it isn't in a lot of effects. Usage is ``python file.py --speed int`` (any number is fine but I haven't tested over 50) +* ``--delay``: When an effect is between transitions or fades, set the number of seconds it should wait to start the next transition or fade. Usage is ``python file.py --delay int`` + * ``--reversed``: Reverses effects for specific devices. Usage is ``python file.py --reversed "example device"`` or ``python file.py --reversed "device 1 , device 2`` for multiple devices. seperate the devices by `` , ``(space comma space) * ``--only-set``: Used if you only want to apply the effect to one device. I made it a goal for all effects to use this flag. Enables all devices if the flag isn't called. Also same usage as --reversed but with a different flag