update
This commit is contained in:
parent
38d874a3dc
commit
1e25aa3bcd
@ -93,36 +93,37 @@
|
||||
if (!data[seg]) {
|
||||
data[seg] = new Array();
|
||||
}
|
||||
data[seg][led] = canvas_context.getImageData(x, y, 1, 1).data;
|
||||
let led_index = num_leds - led - 1;
|
||||
data[seg][led_index] = canvas_context.getImageData(x, y, 1, 1).data;
|
||||
for (let i = 0; i < 3; i++) {
|
||||
data[seg][led][i] = data[seg][led][i] - (data[seg][led][i] % 32);
|
||||
data[seg][led_index][i] = data[seg][led_index][i] - (data[seg][led_index][i] % 32);
|
||||
}
|
||||
let index = 4 * (x + y * canvas_out_elem.width);
|
||||
out_data.data[index] = data[seg][led][0];
|
||||
out_data.data[index + 1] = data[seg][led][1];
|
||||
out_data.data[index + 2] = data[seg][led][2];
|
||||
out_data.data[index + 3] = data[seg][led][3];
|
||||
out_data.data[index] = data[seg][led_index][0];
|
||||
out_data.data[index + 1] = data[seg][led_index][1];
|
||||
out_data.data[index + 2] = data[seg][led_index][2];
|
||||
out_data.data[index + 3] = data[seg][led_index][3];
|
||||
|
||||
index = 4 * ((seg * 2) + (num_leds - led) * num_segments * 2);
|
||||
out_data2.data[index] = data[seg][led][0];
|
||||
out_data2.data[index + 1] = data[seg][led][1];
|
||||
out_data2.data[index + 2] = data[seg][led][2];
|
||||
out_data2.data[index + 3] = data[seg][led][3];
|
||||
index = 4 * ((seg * 2) + (num_leds - led_index) * num_segments * 2);
|
||||
out_data2.data[index] = data[seg][led_index][0];
|
||||
out_data2.data[index + 1] = data[seg][led_index][1];
|
||||
out_data2.data[index + 2] = data[seg][led_index][2];
|
||||
out_data2.data[index + 3] = data[seg][led_index][3];
|
||||
|
||||
let found = -1;
|
||||
for (color = 0; color < color_palette.length; color++) {
|
||||
if (color_palette[color][0] == data[seg][led][0] && color_palette[color][1] == data[seg][led][1] && color_palette[color][2] == data[seg][led][2]) {
|
||||
if (color_palette[color][0] == data[seg][led_index][0] && color_palette[color][1] == data[seg][led_index][1] && color_palette[color][2] == data[seg][led_index][2]) {
|
||||
found = color;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found < 0) {
|
||||
color_palette[color_palette.length] = data[seg][led];
|
||||
color_palette[color_palette.length] = data[seg][led_index];
|
||||
found = 0;
|
||||
}
|
||||
|
||||
data[seg][led] = found;
|
||||
data[seg][led_index] = found;
|
||||
}
|
||||
}
|
||||
canvas_out_context.putImageData(out_data, 0, 0);
|
2
images.h
2
images.h
@ -10,6 +10,8 @@
|
||||
|
||||
// add images here created with bikewheel.html image generator, scroll down and add data to available images
|
||||
|
||||
#define LED_COUNT 26 // how many LEDs on one stripe
|
||||
|
||||
const PROGMEM uint8_t test_small_png_palette[][3] = {
|
||||
{0x60, 0x60, 0x60}, // 0x00
|
||||
{0x00, 0x00, 0x00}, // 0x01
|
||||
|
1626
images_2.h
1626
images_2.h
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
// set to true if you want to use NEOPIXEL (3 pins) instead of APA102 (4 pins)
|
||||
#define NEOPIXEL false
|
||||
#define NEOPIXEL true
|
||||
// set to true for image test modus, this will change the segments every 1/2 second
|
||||
#define TEST_STRIPES false
|
||||
|
||||
@ -28,8 +28,7 @@
|
||||
#define ROUND_COUNT 1 // how many rounds to take time (minimum 1)
|
||||
|
||||
#define NUM_SEGMENTS 360 // how much segements to divide image (gives an angle precision of 360 / NUM_SEGMENTS)
|
||||
#define LED_COUNT 26 // how many LEDs on one stripe
|
||||
#define LED_STRIPES 2 // how many LEDs stripes on wheel
|
||||
#define LED_STRIPES 1 // how many LEDs stripes on wheel
|
||||
|
||||
#if ARDUINO_ARCH_ESP32
|
||||
#define LED_BUILTIN 22
|
||||
@ -58,7 +57,7 @@ rgb_color color_buffer[LED_COUNT * LED_STRIPES]; // color buffer to write to
|
||||
#endif
|
||||
|
||||
float passed = 0;
|
||||
int current_image_index = 1;
|
||||
int current_image_index = 3;
|
||||
|
||||
uint8_t *current_palette;
|
||||
uint8_t *current_pixels;
|
||||
|
Loading…
Reference in New Issue
Block a user