minor comment update

Small corrections in Lissajous comments
This commit is contained in:
Frank 2023-06-15 09:30:44 +02:00 committed by GitHub
parent 7538649e81
commit bb15e1d8ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5103,8 +5103,8 @@ uint16_t mode_2DLissajous(void) { // By: Andrew Tuline
//float ylocn = float(cos8(now/4+i*2)) / 255.0f; //float ylocn = float(cos8(now/4+i*2)) / 255.0f;
uint_fast8_t xlocn = sin8(phase/2 + (i*SEGMENT.speed)/32); uint_fast8_t xlocn = sin8(phase/2 + (i*SEGMENT.speed)/32);
uint_fast8_t ylocn = cos8(phase/2 + i*2); uint_fast8_t ylocn = cos8(phase/2 + i*2);
xlocn = (cols < 2) ? 1 : (map(2*xlocn, 0,511, 0,2*(cols-1)) +1) /2; // softhack007: "*2 +1" for proper rounding xlocn = (cols < 2) ? 1 : (map(2*xlocn, 0,511, 0,2*(cols-1)) +1) /2; // softhack007: "(2* ..... +1) /2" for proper rounding
ylocn = (rows < 2) ? 1 : (map(2*ylocn, 0,511, 0,2*(rows-1)) +1) /2; // "rows > 2" is needed to avoid div/0 in map() ylocn = (rows < 2) ? 1 : (map(2*ylocn, 0,511, 0,2*(rows-1)) +1) /2; // "rows > 1" is needed to avoid div/0 in map()
SEGMENT.setPixelColorXY((uint8_t)xlocn, (uint8_t)ylocn, SEGMENT.color_from_palette(millis()/100+i, false, PALETTE_SOLID_WRAP, 0)); SEGMENT.setPixelColorXY((uint8_t)xlocn, (uint8_t)ylocn, SEGMENT.color_from_palette(millis()/100+i, false, PALETTE_SOLID_WRAP, 0));
} }