WIP: feature/esp32-ng-basic #1

Draft
localhorst wants to merge 22 commits from feature/esp32-ng-basic into master
21 changed files with 4646 additions and 326 deletions
Showing only changes of commit 468d2cba74 - Show all commits

View File

@ -270,7 +270,7 @@ static void anim_chase(void)
continue; continue;
// Calculate brightness based on distance from center // Calculate brightness based on distance from center
uint8_t brightness = (offset == 0) ? 255 : 64; // Center: full, trailing: 25% uint8_t brightness = (offset == 0) ? 255 : 32; // Center: full, trailing: 12%
// Create dimmed color // Create dimmed color
rgb_t dimmed_red = { rgb_t dimmed_red = {
@ -299,26 +299,46 @@ static void anim_chase_rgb(void)
// RGB cycling dot sweeping with trailing dots // RGB cycling dot sweeping with trailing dots
led_clear_all(); led_clear_all();
uint16_t num_leds = led_get_num_leds_a() + led_get_num_leds_b(); uint16_t num_leds_a = led_get_num_leds_a();
int16_t pos = beatsin16(40, 0, num_leds - 1); uint16_t num_leds_b = led_get_num_leds_b();
uint16_t total_leds = num_leds_a + num_leds_b;
// Get oscillating position across both strips
int16_t center_pos = beatsin16(40, 0, total_leds - 1);
hsv_t hsv = {global_hue, 255, 192}; hsv_t hsv = {global_hue, 255, 192};
rgb_t color = led_hsv_to_rgb(hsv); rgb_t color = led_hsv_to_rgb(hsv);
// Set main dot and trailing dots // Draw center dot with dimmed trailing dots (3 dots total: center ±1)
for (int offset = -2; offset <= 2; offset++) for (int8_t offset = -1; offset <= 1; offset++)
{ {
int16_t led_pos = pos + offset; int16_t led_pos = center_pos + offset;
if (led_pos >= 0 && led_pos < num_leds)
// Skip if position is out of bounds
if (led_pos < 0 || led_pos >= total_leds)
continue;
// Calculate brightness based on distance from center
uint8_t brightness = (offset == 0) ? 255 : 32; // Center: full, trailing: 12%
// Create dimmed color
rgb_t dimmed_color = {
(color.r * brightness) / 255,
(color.g * brightness) / 255,
(color.b * brightness) / 255};
// Map virtual position to physical LED
if (led_pos < num_leds_a)
{ {
if (led_pos < led_get_num_leds_a()) // Strip A (mirrored: position 0 maps to last LED)
{ uint16_t strip_a_index = num_leds_a - led_pos - 1;
led_add_pixel_a(led_pos, color); led_set_pixel_a(strip_a_index, dimmed_color);
} }
else else
{ {
led_add_pixel_b(led_pos - led_get_num_leds_a(), color); // Strip B (direct mapping)
} uint16_t strip_b_index = led_pos - num_leds_a;
led_set_pixel_b(strip_b_index, dimmed_color);
} }
} }
} }
@ -432,7 +452,7 @@ void animation_update(void)
anim_chase(); anim_chase();
break; break;
case ANIM_CHASE_RGB: case ANIM_CHASE_RGB:
// anim_chase_rgb(); anim_chase_rgb();
break; break;
case ANIM_RANDOM: case ANIM_RANDOM:
anim_random(); anim_random();