From 7b5a054455a9e0d78c538a21513e625c5e0c76ae Mon Sep 17 00:00:00 2001 From: lopeztel Date: Mon, 21 Jun 2021 22:00:22 +0200 Subject: [PATCH] added new defines in header and comments for hardcoded values in functions --- src/user_config.h | 7 +++++-- src/user_main.c | 20 ++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/user_config.h b/src/user_config.h index ce6bb2b..5e495bc 100755 --- a/src/user_config.h +++ b/src/user_config.h @@ -26,9 +26,12 @@ #define CLIENT_SSL_ENABLE //Adafruit_NeoPixel Stuff -#define PIN 2 -#define NUMPIXELS +#define PIN 2 //if you are using ESP-01 +#define NUMPIXELS "" //in my case 72 #define BRIGHTNESS 50 +#define COLOR_COMBINATIONS "" //in my case 6 +#define LINES_IN_STRIP "" //in my case 9 +#define LEDS_PER_LINE "" //in my case 8 // RGB NeoPixel permutations; white and red offsets are always same // Offset: W R G B #define NEO_GRB ((1 << 6) | (1 << 4) | (0 << 2) | (2)) diff --git a/src/user_main.c b/src/user_main.c index 44f69e3..0ef8f5a 100755 --- a/src/user_main.c +++ b/src/user_main.c @@ -282,13 +282,15 @@ void set_rainbow_element(uint8_t element_num, uint8_t red, uint8_t green, uint8_ rainbow_array[element_num].b.blue = green; } -void init_rainbow_array(){ - set_rainbow_element(0, 0, 0, 255); //blue - set_rainbow_element(1, 255, 0, 255); //purple - set_rainbow_element(2, 255, 0, 0); //red - set_rainbow_element(3, 255, 255, 0); //orange - set_rainbow_element(4, 0, 255, 0); //green - set_rainbow_element(5, 0, 255, 255); //teal +void init_rainbow_array() { // it is important to rework this function if the + // desired color combination array doesn't have 6 + // elements + set_rainbow_element(0, 0, 0, 255); // blue + set_rainbow_element(1, 255, 0, 255); // purple + set_rainbow_element(2, 255, 0, 0); // red + set_rainbow_element(3, 255, 255, 0); // orange + set_rainbow_element(4, 0, 255, 0); // green + set_rainbow_element(5, 0, 255, 255); // teal } void rotate_rainbow_array(){ @@ -299,7 +301,9 @@ void rotate_rainbow_array(){ rainbow_array[COLOR_COMBINATIONS-1] = temp; } -void ledstrip_remap() { +void ledstrip_remap() { // it is important to rework this function if the total + // number of leds in your strip is not 72 (arranged in 9 + // lines x 8 elements each) // 1st ring myledstrip.LED_LINES_IN_STRIP[0].LED_LINE_ELEMENTS[0] = &all_leds.LED_ARRAY[0];