From b90187af904c11aaa5277542e49f950c15c43692 Mon Sep 17 00:00:00 2001 From: Nathaniel Walizer Date: Sun, 27 Nov 2022 21:50:34 -0800 Subject: [PATCH] Fix high ouput timing to 417/833 ns widths This has the side effect of lengthening the low time proportionally, to a total of 417 ns longer than necessary. This does not appear to have any observable negative impact. --- main/main.cpp | 2 +- main/spi_leds.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main/main.cpp b/main/main.cpp index 895cfce..35ff7c7 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -106,7 +106,7 @@ extern "C" void app_main(void) { // ScreenLEDs() // SPI_LEDs(39); LEDStrip *LEDs = new SPI_LEDs(39); - int frequency = 60; + int frequency = 30; while (true) { // Trash the old preset in case we can't find the set effect diff --git a/main/spi_leds.cpp b/main/spi_leds.cpp index 174347d..641fd96 100644 --- a/main/spi_leds.cpp +++ b/main/spi_leds.cpp @@ -54,7 +54,9 @@ SPI_LEDs::SPI_LEDs(int _gpio, int length) : .cs_ena_posttrans = 0, // moot // Datasheet implies 3.2 MHz => 1.25 us / 4 // We can get away with 4.4_ MHz => 900 ns / 4 - .clock_speed_hz = 3200000, + // HOWEVER, better implementations divide 1.25 us into thirds! + // Thus, 2.4 MHz has the same H times and slightly longer L times. + .clock_speed_hz = 2400000, .input_delay_ns = 0, // moot .spics_io_num = -1, .flags = 0, // Keep it MSB first