Last active
March 27, 2019 21:35
-
-
Save Aircoookie/ac95a62eaccf3d6729d628486f27954e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Custom mode for Heiliger Gral | |
uint16_t WS2812FX::mode_engine() | |
{ | |
if (SEGMENT_LENGTH < 30) return mode_static(); | |
uint16_t stage = SEGMENT_RUNTIME.counter_mode_step; | |
//fill all cylinders with background color | |
fill(SEGMENT.colors[1]); | |
//ignition stage 0-255 fading up 256-511 fading down 512-x pause | |
if (stage < 512) | |
{ | |
uint32_t primary = color_from_palette(SEGMENT_RUNTIME.aux_param2, false, false, 0); | |
for (uint16_t i = 0; i < 6; i++) | |
{ | |
setPixelColor(SEGMENT.start + SEGMENT_RUNTIME.aux_param*6 + i, color_blend(primary, SEGMENT.colors[1], (stage > 255)? stage-256 : 255-stage)); | |
} | |
} | |
SEGMENT_RUNTIME.counter_mode_step += SEGMENT.speed/5 +1; | |
//completed ignition of one cylinder, select next (order 0-1-3-4-2) | |
uint16_t waitTime = (SEGMENT_RUNTIME.aux_param == 2)? SEGMENT.intensity*3 : SEGMENT.intensity; | |
if (SEGMENT_RUNTIME.counter_mode_step >= 512 + waitTime) { | |
switch (SEGMENT_RUNTIME.aux_param) | |
{ | |
case 0: SEGMENT_RUNTIME.aux_param = 1; break; | |
case 1: SEGMENT_RUNTIME.aux_param = 3; break; | |
case 2: SEGMENT_RUNTIME.aux_param = 0; SEGMENT_RUNTIME.aux_param2 = get_random_wheel_index(SEGMENT_RUNTIME.aux_param2); break; | |
case 3: SEGMENT_RUNTIME.aux_param = 4; break; | |
case 4: SEGMENT_RUNTIME.aux_param = 2; break; | |
default: SEGMENT_RUNTIME.aux_param = 0; | |
} | |
SEGMENT_RUNTIME.counter_mode_step = 0; | |
} | |
return 20; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment