You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
uint16_t mode_2Ddna(void) { // dna originally by by ldirko at https://pastebin.com/pCkkkzcs. Updated by Preyy. WLED conversion by Andrew Tuline.
5122
+
uint16_t mode_2Ddna(void) { // dna originally by by ldirko at https://pastebin.com/pCkkkzcs. Updated by Preyy. WLED conversion by Andrew Tuline. Phases added by @ewoudwijma
5064
5123
if (!strip.isMatrix) return mode_static(); // not a 2D set-up
5065
5124
5066
5125
const uint16_t cols = SEGMENT.virtualWidth();
5067
5126
const uint16_t rows = SEGMENT.virtualHeight();
5127
+
unsigned phases = SEGMENT.custom1;
5128
+
if (phases > 179) phases = 179 + 2.5f * (phases - 179); // boost for values > 179
5068
5129
5069
5130
if (SEGENV.call == 0) {
5070
5131
SEGMENT.setUpLeds();
@@ -5077,8 +5138,12 @@ uint16_t mode_2Ddna(void) { // dna originally by by ldirko at https://pa
5077
5138
int lastY1 = -1;
5078
5139
int lastY2 = -1;
5079
5140
for (int i = 0; i < cols; i++) {
5080
-
int posY1 = beatsin8_t(SEGMENT.speed/8, 0, rows-1, 0, i*4 );
5081
-
int posY2 = beatsin8_t(SEGMENT.speed/8, 0, rows-1, 0, i*4+128);
5141
+
// 256 is a complete phase; half a phase of dna is 128
5142
+
// unsigned phase = i * 4 * phases / cols; // original formula; cols ==0 cannot happen due to the for loop
5143
+
unsigned phase = i * 4 * phases / 128; // WLEDMM this reproduces the previous behaviour at phases=127
5144
+
int posY1 = beatsin8_t(SEGMENT.speed/8, 0, rows-1, 0, phase );
5145
+
int posY2 = beatsin8_t(SEGMENT.speed/8, 0, rows-1, 0, phase+128);
5146
+
5082
5147
if ((i==0) || ((abs(lastY1 - posY1) < 2) && (abs(lastY2 - posY2) < 2))) { // use original code when no holes
0 commit comments