function phdCalcMasks() { var zones = new Set([]); var channels = new Set([13]); var zoneMask = 0; var chanMask = 0; var duty = false; var fadeRate = false; var outputNumber; var var1 = 0; ///THE DIMMING RELATED MASKS //Build the zone mask var zoneLookup = {1:'a', 2:'b', 3:'c', 4:'d', 5:'e', 6:'f', 7:'g', 8: 'h'}; //TODO: figure out what do with the different actions with zones for (var index = 0; index < 17; index++) { outputNumber = index + 1; //shift 1 left index times and OR it with chan17_mask_on to set that bit in chan17_mask_on if (zones.has(zoneLookup[outputNumber])) { //Set a flag if we need level and fade info //dim for set manual, auto for set auto zoneMask |= 1 << index; } if(channels.has(outputNumber)){ chanMask |= 1 << index; } } //For simple actions we skip this var outputMask = (('00' + zoneMask.toString(16)).substr(-2)) + (('0000' + chanMask.toString(16)).substr(-4)) + '1901'; console.log(outputMask);// outputMask = hexToDec(outputMask); console.log(parseInt('0x'+outputMask));}phdCalcMasks();

Written by Sebastien Gouin-Davis
Updated over a week ago