diff --git a/discobert.py b/discobert.py index abd6e17..d4a9648 100644 --- a/discobert.py +++ b/discobert.py @@ -37,7 +37,7 @@ pin_pir = 0 pin_door = 11 - +# for system stuff dmxScenes = { "fadecolors":[255,255,255,255,255,192], "plain-red":[255,255,0,0,0,0], @@ -73,20 +73,42 @@ dmxUserScenes = [ [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): + # a universe of zeros cv = [0 for v in range(0, 512)] errorcode = [240,255,0,0,0,0] for index, val in enumerate(dmxScenes.get(scene,errorcode)): cv[index] = val 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(): + # loop through scenes global dmxScene if dmxScene < len(dmxUserScenes)-1: dmxScene += 1 else: dmxScene = 0 + # setup the universe cv = [0 for v in range(0, 512)] for index, val in enumerate(dmxUserScenes[dmxScene]): cv[index] = val @@ -198,10 +220,12 @@ def setMode(string): if mode == "off": inUse = False -def setDiscoMode(): +def setDiscoMode(startup=False): setKugel('on') - setDmxScene('fadecolors') - setUserDmxScene() + if startup: + setStartupDmxScene() + else: + setUserDmxScene() sleep(0.3) setSun('off') setMode('disco') @@ -312,7 +336,7 @@ def closeService(sleepsecs=0): def initService(): startMusic('0', True) # start intro music - setDiscoMode() + setDiscoMode(True) global volume global defaultvolume global uservolume