switching.js
/**
 * Switch automatically between different light situations.
 * Selection of strategy possible
 *
 * @param msg -> {'devices': DMX.devices, 'setup': config}
 * @param updateDmx function for updating dmx with at least universe, update and maybe effect
 * @constructor
 */
Switch automatically between different light situations.
Selection of strategy possible

@param msg -> {'devices': DMX.devices, 'setup': config}
@param updateDmx function for updating dmx with at least universe, update and maybe effect
@constructor
Switch automatically between different light situations . Selection of strategy possible @param msg - > { ' devices ' : DMX . devices ' setup ' : config } @param updateDmx function for updating dmx with at least universe update and maybe effect @constructor
function Switching(msg, updateDmx) {
    this.fx_stack = [];
    this.aborted = false;
    this.running = false;
    this.updateDmx = updateDmx;
    this.mSecondsPerStep = 2000;
    this.intervalId = null;
    this.mSecondsStrobeDuration = 100;
    this.mSecondsStrobeLimit = 150; 
    this.strobeModeEnabled = false;
    this.fadeBlackModeEnabled = false;
    this.fadeBlackDuration = 0;
    this.timeoutDurationId = null;
    this.setupconfig = msg.setup;
    this.setupdevices = msg.devices;
    this.presets = msg.setup.presets;
    for (var color in this.setupconfig.colors) { 
        this.setupconfig.colors[color].id = color;
    }
    this.selectedColors = this.setupconfig.colors.slice();
    this.currentColorId = -1;
    this.randomizeColors = false;
    this.shuffleColors = false;
    this.randomizeDevices = false;
    this.shuffleDevices = false;
    this.allDevices = [];
    var deviceId = 0; 
    for (var universe in this.setupconfig.universes) {
        for (var deviceNum in this.setupconfig.universes[universe].devices) {
            var device = this.setupconfig.universes[universe].devices[deviceNum];
            if (this.setupdevices[device.type].hasOwnProperty("startRgbChannel")) {
                this.allDevices.push({universe: universe, device: device, id: deviceId});
                deviceId++;
            }
        }
    }
    this.selectedDevices = this.allDevices.slice();
    this.colorsStrategy();
    this.strategy = this.colorsStrategy;
}
function Switching ( msg , updateDmx ) { this . fx_stack = [ ] ; this . aborted = false ; this . running = false ; this . updateDmx = updateDmx ; this . mSecondsPerStep = 2000 ; this . intervalId = null ; this . mSecondsStrobeDuration = 100 ; this . mSecondsStrobeLimit = 150 ; this . strobeModeEnabled = false ; this . fadeBlackModeEnabled = false ; this . fadeBlackDuration = 0 ; this . timeoutDurationId = null ; this . setupconfig = msg . setup ; this . setupdevices = msg . devices ; this . presets = msg . setup . presets ; for ( var color in this . setupconfig . colors ) { this . setupconfig . colors [ color ] . id = color ; } this . selectedColors = this . setupconfig . colors . slice ( ) ; this . currentColorId = - 1 ; this . randomizeColors = false ; this . shuffleColors = false ; this . randomizeDevices = false ; this . shuffleDevices = false ; this . allDevices = [ ] ; var deviceId = 0 ; for ( var universe in this . setupconfig . universes ) { for ( var deviceNum in this . setupconfig . universes [ universe ] . devices ) { var device = this . setupconfig . universes [ universe ] . devices [ deviceNum ] ; if ( this . setupdevices [ device . type ] . hasOwnProperty ( "startRgbChannel" ) ) { this . allDevices . push ( { universe : universe , device : device , id : deviceId } ) ; deviceId ++ ; } } } this . selectedDevices = this . allDevices . slice ( ) ; this . colorsStrategy ( ) ; this . strategy = this . colorsStrategy ; }
Switch automatically between different light situations.
Switch automatically between different light situations .
//shorter steps have no strobe mode //assign IDs to color //assign id to all devices