Skip to content

Commit 1eb461f

Browse files
committed
Fixed radius maps, clock, and swirl patterns after physical testing.
1 parent a64f66a commit 1eb461f

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

esp8266-fastled-webserver/Map.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@
6767
const uint8_t coordsX[NUM_PIXELS] { 133, 156, 165, 168, 165, 158, 147, 132, 114, 95, 76, 57, 41, 28, 19, 15, 17, 24, 37, 56, 123, 96, 73, 53, 38, 28, 24, 25, 31, 41, 55, 71, 89, 106, 122, 136, 146, 152, 152, 143, 138, 136, 128, 115, 101, 85, 70, 56, 44, 37, 33, 34, 41, 53, 69, 90, 114, 140, 167, 226, 204, 180, 154, 129, 106, 85, 67, 54, 46, 43, 44, 50, 60, 72, 86, 100, 113, 123, 128, 117, 104, 90, 78, 67, 59, 54, 54, 59, 68, 82, 100, 121, 143, 167, 191, 212, 231, 246, 255, 251, 251, 245, 233, 218, 199, 178, 156, 134, 114, 96, 82, 73, 67, 66, 70, 78, 89, 103, 111, 94, 84, 80, 81, 86, 96, 109, 126, 145, 165, 185, 204, 220, 233, 241, 244, 241, 232, 217, 179, 201, 217, 229, 235, 235, 230, 220, 207, 190, 172, 154, 136, 121, 108, 99, 95, 96, 104, 120, 110, 111, 118, 130, 144, 160, 176, 192, 206, 217, 224, 227, 224, 216, 202, 184, 162, 137, 110, 44, 68, 94, 120, 145, 168, 187, 202, 212, 216, 216, 212, 203, 191, 177, 162, 148, 135, 126, 122, 136, 147, 161, 174, 186, 197, 204, 206, 205, 198, 187, 172, 152, 130, 106, 81, 58, 36, 17, 0, 5, 15, 30, 49, 71, 93, 116, 138, 157, 173, 185, 192, 195, 193, 187, 178, 166, 152, 137, 149, 164, 175, 180, 182, 179, 171, 159, 143, 125, 105, 83, 63, 44, 28, 16, 9, 7, 12, 23 };
6868
const uint8_t coordsY[NUM_PIXELS] { 126, 120, 109, 96, 82, 69, 57, 49, 45, 45, 50, 59, 74, 92, 114, 138, 163, 188, 211, 231, 255, 248, 235, 218, 198, 175, 152, 129, 107, 89, 74, 63, 57, 56, 59, 66, 76, 88, 102, 116, 103, 88, 77, 71, 68, 70, 77, 88, 103, 121, 141, 163, 184, 205, 222, 236, 245, 249, 247, 208, 224, 235, 241, 240, 234, 223, 209, 191, 172, 152, 132, 115, 101, 90, 84, 82, 86, 95, 114, 107, 98, 98, 103, 112, 126, 142, 159, 177, 195, 210, 222, 230, 233, 230, 223, 209, 191, 168, 142, 98, 125, 151, 174, 194, 209, 219, 223, 223, 218, 208, 195, 180, 164, 148, 134, 122, 114, 112, 123, 128, 138, 151, 165, 180, 193, 203, 211, 214, 212, 206, 194, 178, 158, 134, 109, 83, 58, 35, 11, 28, 48, 71, 95, 120, 142, 163, 179, 192, 200, 203, 202, 196, 187, 175, 162, 148, 136, 133, 152, 166, 177, 186, 190, 191, 187, 178, 165, 148, 128, 107, 84, 62, 41, 24, 11, 2, 0, 28, 16, 9, 8, 13, 23, 37, 55, 75, 96, 116, 135, 151, 164, 173, 177, 177, 172, 162, 146, 153, 161, 163, 160, 152, 139, 124, 106, 87, 69, 51, 36, 25, 18, 16, 20, 29, 44, 64, 133, 106, 81, 60, 44, 32, 26, 25, 29, 38, 50, 65, 82, 99, 115, 129, 140, 147, 148, 138, 134, 131, 122, 110, 95, 80, 65, 52, 42, 36, 34, 37, 45, 59, 77, 98, 123, 149, 176, 202 };
6969
const uint8_t angles[NUM_PIXELS] { 0, 247, 238, 229, 220, 211, 203, 194, 185, 176, 167, 159, 150, 141, 132, 123, 115, 106, 97, 88, 65, 74, 83, 92, 100, 109, 118, 127, 136, 144, 153, 162, 171, 180, 188, 197, 206, 215, 224, 232, 209, 201, 192, 183, 174, 165, 157, 148, 139, 130, 121, 113, 104, 95, 86, 77, 69, 60, 51, 28, 37, 46, 54, 63, 72, 81, 90, 98, 107, 116, 125, 134, 142, 151, 160, 169, 178, 186, 195, 172, 163, 155, 146, 137, 128, 119, 111, 102, 93, 84, 75, 67, 58, 49, 40, 31, 23, 14, 5, 246, 255, 8, 17, 26, 35, 44, 52, 61, 70, 79, 88, 96, 105, 114, 123, 132, 140, 149, 135, 126, 117, 108, 100, 91, 82, 73, 64, 56, 47, 38, 29, 20, 12, 3, 250, 241, 232, 223, 209, 218, 227, 235, 244, 253, 6, 15, 24, 33, 41, 50, 59, 68, 77, 85, 94, 103, 112, 98, 89, 80, 71, 62, 54, 45, 36, 27, 18, 10, 1, 247, 239, 230, 221, 212, 203, 195, 186, 163, 172, 180, 189, 198, 207, 216, 224, 233, 242, 251, 4, 13, 22, 31, 39, 48, 57, 66, 75, 52, 43, 34, 25, 16, 8, 254, 245, 237, 228, 219, 210, 201, 193, 184, 175, 166, 157, 149, 126, 134, 143, 152, 161, 170, 178, 187, 196, 205, 214, 222, 231, 240, 249, 2, 11, 20, 28, 37, 14, 5, 252, 243, 235, 226, 217, 208, 199, 191, 182, 173, 164, 155, 147, 138, 129, 120, 111, 103 };
70-
const uint8_t radius[NUM_PIXELS] { 0, 9, 15, 19, 24, 27, 31, 34, 37, 40, 42, 45, 47, 50, 52, 54, 56, 58, 60, 62, 64, 66, 67, 69, 71, 72, 74, 76, 77, 79, 80, 82, 83, 85, 86, 88, 89, 90, 92, 93, 94, 96, 97, 98, 100, 101, 102, 103, 104, 106, 107, 108, 109, 110, 111, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 143, 144, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 160, 161, 162, 163, 164, 164, 165, 166, 167, 168, 168, 169, 170, 171, 171, 172, 173, 174, 174, 175, 176, 177, 177, 178, 179, 180, 180, 181, 182, 182, 183, 184, 185, 185, 186, 187, 187, 188, 189, 190, 190, 191, 192, 192, 193, 194, 194, 195, 196, 196, 197, 198, 198, 199, 200, 200, 201, 202, 202, 203, 204, 204, 205, 206, 206, 207, 207, 208, 209, 209, 210, 211, 211, 212, 212, 213, 214, 214, 215, 216, 216, 217, 217, 218, 219, 219, 220, 220, 221, 222, 222, 223, 223, 224, 225, 225, 226, 226, 227, 227, 228, 229, 229, 230, 230, 231, 232, 232, 233, 233, 234, 234, 235, 235, 236, 237, 237, 238, 238, 239, 239, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 247, 247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 };
71-
const uint8_t (&radiusProxy)[NUM_PIXELS] = radius;
70+
const uint8_t (&radiusProxy)[NUM_PIXELS] = physicalToFibonacci;
7271
#elif defined(PRODUCT_FIBONACCI128)
7372
const uint8_t physicalToFibonacci[NUM_PIXELS] { 0, 13, 26, 39, 52, 65, 78, 91, 104, 117, 122, 109, 96, 83, 70, 57, 44, 31, 18, 5, 10, 23, 36, 49, 62, 75, 88, 101, 114, 127, 119, 106, 93, 80, 67, 54, 41, 28, 15, 2, 7, 20, 33, 46, 59, 72, 85, 98, 111, 124, 116, 103, 90, 77, 64, 51, 38, 25, 12, 4, 17, 30, 43, 56, 69, 82, 95, 108, 121, 126, 113, 100, 87, 74, 61, 48, 35, 22, 9, 1, 14, 27, 40, 53, 66, 79, 92, 105, 118, 123, 110, 97, 84, 71, 58, 45, 32, 19, 6, 11, 24, 37, 50, 63, 76, 89, 102, 115, 120, 107, 94, 81, 68, 55, 42, 29, 16, 3, 8, 21, 34, 47, 60, 73, 86, 99, 112, 125 };
7473
const uint8_t fibonacciToPhysical[NUM_PIXELS] { 0, 79, 39, 117, 59, 19, 98, 40, 118, 78, 20, 99, 58, 1, 80, 38, 116, 60, 18, 97, 41, 119, 77, 21, 100, 57, 2, 81, 37, 115, 61, 17, 96, 42, 120, 76, 22, 101, 56, 3, 82, 36, 114, 62, 16, 95, 43, 121, 75, 23, 102, 55, 4, 83, 35, 113, 63, 15, 94, 44, 122, 74, 24, 103, 54, 5, 84, 34, 112, 64, 14, 93, 45, 123, 73, 25, 104, 53, 6, 85, 33, 111, 65, 13, 92, 46, 124, 72, 26, 105, 52, 7, 86, 32, 110, 66, 12, 91, 47, 125, 71, 27, 106, 51, 8, 87, 31, 109, 67, 11, 90, 48, 126, 70, 28, 107, 50, 9, 88, 30, 108, 68, 10, 89, 49, 127, 69, 29 };
@@ -91,7 +90,7 @@
9190
const uint8_t coordsX[NUM_PIXELS] { 152, 224, 252, 210, 211, 184, 169, 161, 89, 121, 138, 102, 61, 19, 13, 57, 82, 29, 0, 36, 63, 111, 79, 83, 158, 129, 118, 160, 196, 255, 212, 163, 203, 250 };
9291
const uint8_t coordsY[NUM_PIXELS] { 120, 101, 69, 7, 48, 90, 50, 7, 0, 27, 83, 62, 37, 35, 84, 78, 112, 125, 154, 185, 149, 140, 195, 236, 255, 226, 179, 198, 223, 181, 183, 156, 144, 135 };
9392
const uint8_t angles[NUM_PIXELS] { 255, 246, 237, 214, 223, 232, 208, 199, 176, 185, 193, 170, 161, 152, 138, 147, 132, 123, 114, 100, 108, 94, 85, 76, 53, 62, 70, 47, 38, 15, 23, 32, 9, 0 };
94-
const uint8_t radius[NUM_PIXELS] { 0, 26, 44, 58, 71, 82, 92, 102, 111, 119, 127, 135, 142, 149, 156, 162, 168, 174, 180, 186, 192, 197, 203, 208, 213, 218, 223, 228, 232, 237, 242, 246, 251, 255 };
93+
const uint8_t radius[NUM_PIXELS] { 0, 100, 201, 240, 139, 39, 77, 178, 216, 116, 15, 54, 155, 255, 193, 93, 31, 131, 232, 170, 70, 8, 108, 209, 247, 147, 46, 85, 185, 224, 124, 23, 62, 162 };
9594
const uint8_t (&radiusProxy)[NUM_PIXELS] = radius;
9695
#elif defined(PRODUCT_KRAKEN64)
9796
const uint8_t coordsX[NUM_PIXELS] { 151, 188, 199, 199, 171, 147, 131, 119, 124, 179, 200, 217, 237, 249, 242, 234, 255, 148, 175, 177, 150, 143, 171, 153, 155, 106, 110, 102, 75, 86, 106, 108, 88, 90, 84, 78, 107, 98, 121, 128, 80, 69, 134, 159, 192, 202, 195, 218, 61, 32, 18, 26, 39, 20, 3, 0, 48, 52, 61, 54, 33, 20, 7, 8 };
@@ -404,9 +403,9 @@ void radarSweepPalette() {
404403
}
405404

406405
void drawAnalogClock() {
407-
const uint8_t hourRadius = (uint8_t)(NUM_PIXELS / 8u * 3u); // 96 designed for 256 pixels ==> 3/8
408-
const uint8_t minuteRadius = (uint8_t)(NUM_PIXELS / 4u * 3u); // 192 designed for 256 pixels ==> 3/4
409-
const uint8_t secondRadius = (uint8_t)(NUM_PIXELS - 1); // 255 designed for 256 pixels ==> all pixels
406+
const uint8_t hourRadius = 128; // 128 of 256 radius "units" ==> 1/2
407+
const uint8_t minuteRadius = 192; // 192 of 256 radius "units" ==> 3/4
408+
const uint8_t secondRadius = 255; // 255 of 256 radius "units" ==> 1/1
410409

411410
const uint8_t hourHandWidth = 8; // angle @ unit256 ~= 11.25000 degrees
412411
const uint8_t minuteHandWidth = 7; // angle @ unit256 ~= 9.84375 degrees
@@ -434,8 +433,8 @@ void drawAnalogClock() {
434433
fadeToBlackBy(leds, NUM_PIXELS, clockBackgroundFade);
435434
antialiasPixelAR(secondAngle, secondHandWidth, 0, secondRadius, CRGB::Blue );
436435
antialiasPixelAR(minuteAngle, minuteHandWidth, 0, minuteRadius, CRGB::Green);
437-
antialiasPixelAR(hourAngle, hourHandWidth, 0, hourRadius, CRGB::Red );
438-
leds[0] = CRGB::Red;
436+
antialiasPixelAR(hourAngle, hourHandWidth, 0, hourRadius, CRGB::Red);
437+
// leds[0] = CRGB::Red; // need to rethink, physical LED 0 is not always in the center...
439438
}
440439

441440
#endif

esp8266-fastled-webserver/esp8266-fastled-webserver.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,7 @@ void swirlFibonacci() {
13621362
CRGBPalette16 palette( gGradientPalettes[1] ); // es_rivendell_15_gp
13631363

13641364
for (uint16_t i = 0; i < NUM_PIXELS; i++) {
1365-
float r = radiusProxy[i] / 256.0 * z;
1365+
float r = physicalToFibonacci[i] / 256.0 * z;
13661366
float a = (angles[i] + (beat88(3*speed)>>3)) / 256.0 * TWO_PI;
13671367
float v = r - p + d * sin(w * a + s * r * r);
13681368
float c = 255 - b * pow(fabs(v), g);

0 commit comments

Comments
 (0)