Browse Source

remove strobe from dmx scenes at startup

master
Andreas Demmelbauer 5 years ago
parent
commit
33426184a4
1 changed files with 29 additions and 5 deletions
  1. +29
    -5
      discobert.py

+ 29
- 5
discobert.py View File

@@ -37,7 +37,7 @@ pin_pir = 0
pin_door = 11 pin_door = 11




# for system stuff
dmxScenes = { dmxScenes = {
"fadecolors":[255,255,255,255,255,192], "fadecolors":[255,255,255,255,255,192],
"plain-red":[255,255,0,0,0,0], "plain-red":[255,255,0,0,0,0],
@@ -73,20 +73,42 @@ dmxUserScenes = [
[120,0,255,255,0,224] [120,0,255,255,0,224]
] ]


# no strobe etc.
dmxStartupScenes = [
[255,255,255,255,255,192],
[255,0,180,180,0,0],
[255,255,0,0,0,0],
[255,0,255,0,0,0],
[255,0,0,255,0,0],
[120,0,255,255,0,224]
]

def setDmxScene(scene): def setDmxScene(scene):
# a universe of zeros
cv = [0 for v in range(0, 512)] cv = [0 for v in range(0, 512)]
errorcode = [240,255,0,0,0,0] errorcode = [240,255,0,0,0,0]
for index, val in enumerate(dmxScenes.get(scene,errorcode)): for index, val in enumerate(dmxScenes.get(scene,errorcode)):
cv[index] = val cv[index] = val
dev.send_multi_value(1, cv) dev.send_multi_value(1, cv)


def setStartupDmxScene():
# a universe of zeros
cv = [0 for v in range(0, 512)]
errorcode = [240,255,0,0,0,0]
scene = random.choice(dmxStartupScenes)
for index, val in enumerate(dmxUserScenes[scene]):
cv[index] = val
dev.send_multi_value(1, cv)



def setUserDmxScene(): def setUserDmxScene():
# loop through scenes
global dmxScene global dmxScene
if dmxScene < len(dmxUserScenes)-1: if dmxScene < len(dmxUserScenes)-1:
dmxScene += 1 dmxScene += 1
else: else:
dmxScene = 0 dmxScene = 0
# setup the universe
cv = [0 for v in range(0, 512)] cv = [0 for v in range(0, 512)]
for index, val in enumerate(dmxUserScenes[dmxScene]): for index, val in enumerate(dmxUserScenes[dmxScene]):
cv[index] = val cv[index] = val
@@ -198,10 +220,12 @@ def setMode(string):
if mode == "off": if mode == "off":
inUse = False inUse = False


def setDiscoMode():
def setDiscoMode(startup=False):
setKugel('on') setKugel('on')
setDmxScene('fadecolors')
setUserDmxScene()
if startup:
setStartupDmxScene()
else:
setUserDmxScene()
sleep(0.3) sleep(0.3)
setSun('off') setSun('off')
setMode('disco') setMode('disco')
@@ -312,7 +336,7 @@ def closeService(sleepsecs=0):


def initService(): def initService():
startMusic('0', True) # start intro music startMusic('0', True) # start intro music
setDiscoMode()
setDiscoMode(True)
global volume global volume
global defaultvolume global defaultvolume
global uservolume global uservolume


Loading…
Cancel
Save