feat: wordclock works!

This commit is contained in:
Philip Stark 2023-05-09 20:01:36 +02:00
parent 5b0930d616
commit 7f091409cf
8 changed files with 1405 additions and 12 deletions

View file

@ -1,5 +1,5 @@
esphome:
name: "display_thing"
name: "display-thing"
esp8266:
board: d1_mini
@ -26,8 +26,8 @@ ota:
logger:
# esp8266_store_log_strings_in_flash: false
web_server:
port: 80
# web_server:
# port: 80
light:
- name: NeoPixel Strip 1
@ -36,8 +36,10 @@ light:
type: GRB
variant: WS2812
pin: GPIO3
num_leds: 200
# default_transition_length: 0.2s
num_leds: 199
restore_mode: ALWAYS_ON
default_transition_length: 0s
color_correct: [100%, 100%, 100%]
method:
type: esp8266_dma
@ -47,18 +49,48 @@ display:
addressable_light_id: neopixel_strip_1
width: 18
height: 11
rotation: 0°
rotation: 270°
update_interval: 16ms
pixel_mapper: |-
int mapping_even[] = {0, 2, 4, 6,8,10,11,13,15,17, 16,16,16,16, 16,16,16,16};
int mapping_odd[] = {17,15,13,11,9, 7, 6, 4, 2, 0, 16,16,16,16, 16,16,16,16};
if (x > 9) return -1;
if (y % 2 == 0) {
return (y * 18 + mapping_even[x]); // mapping_even[y];
} else {
return (y * 18 + mapping_odd[x]); // mapping_odd[y];
//return (y * 18 + 17 - x); // mapping_odd[y];
}
//if (x % 2 == 0) {
// return (x * 8) + y;
//}
//return (x * 8) + (7 - y);
lambda: |-
// Draw a bulls-eye pattern
Color red = Color(0xFF0000);
Color green = Color(0x00FF00);
Color blue = Color(0x0000FF);
it.rectangle(0, 0, 18, 11, red);
it.rectangle(1, 1, 17, 10, green);
it.rectangle(2, 2, 16, 9, blue);
it.rectangle(3, 3, 15, 8, red);
Color turquoise = Color(0x00FFFF);
it.draw_pixel_at(0,0, green);
it.draw_pixel_at(10,0, red);
it.draw_pixel_at(0,9, turquoise);
it.draw_pixel_at(10,9, blue);
//it.line(0,0, 11,0, red);
//it.line(0,1, 11,1, green);
//it.line(0,2, 11,2, blue);
//it.line(0,3, 11,3, red);
//it.line(0,4, 11,4, green);
//it.line(0,5, 11,5, blue);
//it.line(0,6, 11,6, red);
//it.line(0,7, 11,7, green);
//it.line(0,8, 11,8, blue);
//it.line(0,9, 11,9, red);
//it.line(0,10, 9,10, green);
//it.line(0,11, 9,11, blue);
// it.line(5,14, 10,14, green);
//it.rectangle(0, 0, 17, 10, red);
//it.rectangle(1, 1, 16, 9, green);
//it.rectangle(2, 2, 15, 8, blue);
//it.rectangle(3, 3, 14, 7, red);
time:
- platform: sntp