From 4492a145743e2dee6ea1382f5a196baae51368e5 Mon Sep 17 00:00:00 2001 From: Gabor Simon Date: Sun, 24 Feb 2019 12:07:15 +0000 Subject: [PATCH 1/6] Added SetOption37 for RGB remapping --- sonoff/.gitignore | 3 ++ sonoff/.travis.yml | 67 ++++++++++++++++++++++++++++++++++++++++ sonoff/my_user_config.h | 1 - sonoff/settings.ino | 4 +++ sonoff/sonoff.h | 18 ++++++----- sonoff/xdrv_04_light.ino | 45 +++++++++++++-------------- 6 files changed, 106 insertions(+), 32 deletions(-) create mode 100644 sonoff/.gitignore create mode 100644 sonoff/.travis.yml diff --git a/sonoff/.gitignore b/sonoff/.gitignore new file mode 100644 index 000000000..58e33b977 --- /dev/null +++ b/sonoff/.gitignore @@ -0,0 +1,3 @@ +.pio +.pioenvs +.piolibdeps diff --git a/sonoff/.travis.yml b/sonoff/.travis.yml new file mode 100644 index 000000000..7c486f183 --- /dev/null +++ b/sonoff/.travis.yml @@ -0,0 +1,67 @@ +# Continuous Integration (CI) is the practice, in software +# engineering, of merging all developer working copies with a shared mainline +# several times a day < https://docs.platformio.org/page/ci/index.html > +# +# Documentation: +# +# * Travis CI Embedded Builds with PlatformIO +# < https://docs.travis-ci.com/user/integration/platformio/ > +# +# * PlatformIO integration with Travis CI +# < https://docs.platformio.org/page/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < https://docs.platformio.org/page/userguide/cmd_ci.html > +# +# +# Please choose one of the following templates (proposed below) and uncomment +# it (remove "# " before each line) or use own configuration according to the +# Travis CI documentation (see above). +# + + +# +# Template #1: General project. Test it using existing `platformio.ini`. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# install: +# - pip install -U platformio +# - platformio update +# +# script: +# - platformio run + + +# +# Template #2: The project is intended to be used as a library with examples. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# env: +# - PLATFORMIO_CI_SRC=path/to/test/file.c +# - PLATFORMIO_CI_SRC=examples/file.ino +# - PLATFORMIO_CI_SRC=path/to/test/directory +# +# install: +# - pip install -U platformio +# - platformio update +# +# script: +# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N diff --git a/sonoff/my_user_config.h b/sonoff/my_user_config.h index d447eed08..f0cd75cf6 100644 --- a/sonoff/my_user_config.h +++ b/sonoff/my_user_config.h @@ -421,7 +421,6 @@ // #define USE_ALECTO_V2 // Add support for decoding Alecto V2 sensors like ACH2010, WS3000 and DKW2012 weather stations using 868MHz RF sensor receiver (+1k7 code) #define USE_SM16716 // Add support for SM16716 RGB LED controller (+0k7 code) - #define USE_SM16716_RGB_ORDER SM16716_RGB // SM16716 RGB order (SM16716_RGB, SM16716_RBG, SM16716_GRB, SM16716_GBR, SM16716_BRG, SM16716_BGR) /*********************************************************************************************\ * Debug features are only supported in development branch diff --git a/sonoff/settings.ino b/sonoff/settings.ino index 2fb9a9afa..c18d60d3f 100644 --- a/sonoff/settings.ino +++ b/sonoff/settings.ino @@ -587,6 +587,7 @@ void SettingsDefaultSet2(void) // Settings.flag.stop_flash_rotate = 0; Settings.save_data = SAVE_DATA; Settings.param[P_BOOT_LOOP_OFFSET] = BOOT_LOOP_OFFSET; + Settings.param[P_RGB_REMAP] = RGB_REMAP_RGB; Settings.sleep = APP_SLEEP; if (Settings.sleep < 50) { Settings.sleep = 50; // Default to 50 for sleep, for now @@ -1055,6 +1056,9 @@ void SettingsDelta(void) if (Settings.version < 0x06040110) { ModuleDefault(WEMOS); } + if (Settings.version < 0x06040112) { + Settings.param[P_RGB_REMAP] = RGB_REMAP_RGB; + } Settings.version = VERSION; SettingsSave(1); diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index a30cf4019..aafc98615 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -171,12 +171,16 @@ typedef unsigned long power_t; // Power (Relay) type #define LT_SM16716 16 // Lights that use SM16716 will have this bit set in light_type -#define SM16716_RGB 0 -#define SM16716_RBG 1 -#define SM16716_GRB 2 -#define SM16716_GBR 3 -#define SM16716_BRG 4 -#define SM16716_BGR 5 +// Remap constants are 3-digit ternary numbers, each digit tells where the corresponding color component is mapped *from* +// digit 0 = ( n % 3) tells where the red is mapped from (0=red, 1=green, 2=blue) +// digit 1 = ((n/3) % 3) tells where the green is mapped from +// digit 2 = ((n/9) % 3) tells where the blue is mapped from +#define RGB_REMAP_RGB (0*1 + 1*3 + 2*9) +#define RGB_REMAP_RBG (0*1 + 2*3 + 1*9) +#define RGB_REMAP_GRB (1*1 + 0*3 + 2*9) +#define RGB_REMAP_GBR (1*1 + 2*3 + 0*9) +#define RGB_REMAP_BRG (2*1 + 0*3 + 1*9) +#define RGB_REMAP_BGR (2*1 + 1*3 + 0*9) #define MQTT_PUBSUBCLIENT 1 // Mqtt PubSubClient library #define MQTT_TASMOTAMQTT 2 // Mqtt TasmotaMqtt library based on esp-mqtt-arduino - soon obsolete @@ -237,7 +241,7 @@ enum ButtonStates { PRESSED, NOT_PRESSED }; enum Shortcuts { SC_CLEAR, SC_DEFAULT, SC_USER }; -enum SettingsParmaIndex {P_HOLD_TIME, P_MAX_POWER_RETRY, P_TUYA_DIMMER_ID, P_MDNS_DELAYED_START, P_BOOT_LOOP_OFFSET, P_MAX_PARAM8}; // Max is PARAM8_SIZE (18) - SetOption32 until SetOption49 +enum SettingsParmaIndex {P_HOLD_TIME, P_MAX_POWER_RETRY, P_TUYA_DIMMER_ID, P_MDNS_DELAYED_START, P_BOOT_LOOP_OFFSET, P_RGB_REMAP, P_MAX_PARAM8}; // Max is PARAM8_SIZE (18) - SetOption32 until SetOption49 enum DomoticzSensors {DZ_TEMP, DZ_TEMP_HUM, DZ_TEMP_HUM_BARO, DZ_POWER_ENERGY, DZ_ILLUMINANCE, DZ_COUNT, DZ_VOLTAGE, DZ_CURRENT, DZ_AIRQUALITY, DZ_MAX_SENSORS}; diff --git a/sonoff/xdrv_04_light.ino b/sonoff/xdrv_04_light.ino index 9083372dd..54085a4ba 100644 --- a/sonoff/xdrv_04_light.ino +++ b/sonoff/xdrv_04_light.ino @@ -397,12 +397,6 @@ void SM16716_SendByte(uint8_t v) } } -void SM16716_SendRGB(uint8_t duty_r, uint8_t duty_g, uint8_t duty_b) { - SM16716_SendByte(duty_r); - SM16716_SendByte(duty_g); - SM16716_SendByte(duty_b); -} - void SM16716_Update(uint8_t duty_r, uint8_t duty_g, uint8_t duty_b) { if (sm16716_pin_sel < 99) { @@ -437,30 +431,18 @@ void SM16716_Update(uint8_t duty_r, uint8_t duty_g, uint8_t duty_b) // send start bit SM16716_SendBit(1); - // send 24-bit rgb data -#if USE_SM16716_RGB_ORDER == SM16716_RGB - SM16716_SendRGB(duty_r, duty_g, duty_b); -#elif USE_SM16716_RGB_ORDER == SM16716_RBG - SM16716_SendRGB(duty_r, duty_b, duty_g); -#elif USE_SM16716_RGB_ORDER == SM16716_GRB - SM16716_SendRGB(duty_g, duty_r, duty_b); -#elif USE_SM16716_RGB_ORDER == SM16716_GBR - SM16716_SendRGB(duty_g, duty_b, duty_r); -#elif USE_SM16716_RGB_ORDER == SM16716_BRG - SM16716_SendRGB(duty_b, duty_r, duty_g); -#elif USE_SM16716_RGB_ORDER == SM16716_BGR - SM16716_SendRGB(duty_b, duty_g, duty_r); -#else - // fall back to RGB - SM16716_SendRGB(duty_r, duty_g, duty_b); -#endif + SM16716_SendByte(duty_r); + SM16716_SendByte(duty_g); + SM16716_SendByte(duty_b); // send a 'do it' pulse // (if multiple chips are chained, each one processes the 1st '1rgb' 25-bit block and // passes on the rest, right until the one starting with 0) //SM16716_Init(); SM16716_SendBit(0); - SM16716_SendRGB(0, 0, 0); + SM16716_SendByte(0); + SM16716_SendByte(0); + SM16716_SendByte(0); } bool SM16716_ModuleSelected(void) @@ -980,6 +962,21 @@ void LightAnimate(void) light_last_color[i] = light_new_color[i]; cur_col[i] = light_last_color[i]*Settings.rgbwwTable[i]/255; cur_col[i] = (Settings.light_correction) ? ledTable[cur_col[i]] : cur_col[i]; + } + + // RGB remapping + uint8_t rgb_mapping = Settings.param[P_RGB_REMAP]; + + if (rgb_mapping != RGB_REMAP_RGB) { + uint8_t orig_col[3]; + memcpy(orig_col, cur_col, sizeof(orig_col)); + for (uint8_t i = 0; i < 3; i++) { + cur_col[i] = orig_col[rgb_mapping % 3]; + rgb_mapping /= 3; + } + } + + for (uint8_t i = 0; i < light_subtype; i++) { if (light_type < LT_PWM6) { if (pin[GPIO_PWM1 +i] < 99) { if (cur_col[i] > 0xFC) { From 0bb05bb604b66fc595d8af2a19e973780ac5035b Mon Sep 17 00:00:00 2001 From: Gabor Simon Date: Sun, 24 Feb 2019 16:41:54 +0400 Subject: [PATCH 2/6] Delete .travis.yml meanwhile removed at adc781b8fcfb173787c192763a3046412c0dd783 --- sonoff/.travis.yml | 67 ---------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 sonoff/.travis.yml diff --git a/sonoff/.travis.yml b/sonoff/.travis.yml deleted file mode 100644 index 7c486f183..000000000 --- a/sonoff/.travis.yml +++ /dev/null @@ -1,67 +0,0 @@ -# Continuous Integration (CI) is the practice, in software -# engineering, of merging all developer working copies with a shared mainline -# several times a day < https://docs.platformio.org/page/ci/index.html > -# -# Documentation: -# -# * Travis CI Embedded Builds with PlatformIO -# < https://docs.travis-ci.com/user/integration/platformio/ > -# -# * PlatformIO integration with Travis CI -# < https://docs.platformio.org/page/ci/travis.html > -# -# * User Guide for `platformio ci` command -# < https://docs.platformio.org/page/userguide/cmd_ci.html > -# -# -# Please choose one of the following templates (proposed below) and uncomment -# it (remove "# " before each line) or use own configuration according to the -# Travis CI documentation (see above). -# - - -# -# Template #1: General project. Test it using existing `platformio.ini`. -# - -# language: python -# python: -# - "2.7" -# -# sudo: false -# cache: -# directories: -# - "~/.platformio" -# -# install: -# - pip install -U platformio -# - platformio update -# -# script: -# - platformio run - - -# -# Template #2: The project is intended to be used as a library with examples. -# - -# language: python -# python: -# - "2.7" -# -# sudo: false -# cache: -# directories: -# - "~/.platformio" -# -# env: -# - PLATFORMIO_CI_SRC=path/to/test/file.c -# - PLATFORMIO_CI_SRC=examples/file.ino -# - PLATFORMIO_CI_SRC=path/to/test/directory -# -# install: -# - pip install -U platformio -# - platformio update -# -# script: -# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N From 0a4a21a038261e8f9f1d97650c5eabb4f4ce292c Mon Sep 17 00:00:00 2001 From: Gabor Simon Date: Sun, 24 Feb 2019 16:43:42 +0400 Subject: [PATCH 3/6] Delete .gitignore created by mistake --- sonoff/.gitignore | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 sonoff/.gitignore diff --git a/sonoff/.gitignore b/sonoff/.gitignore deleted file mode 100644 index 58e33b977..000000000 --- a/sonoff/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.pio -.pioenvs -.piolibdeps From 945e7000dd0c925c637923d4b274cbe24e11bdf2 Mon Sep 17 00:00:00 2001 From: netpok Date: Sun, 24 Feb 2019 21:03:33 +0100 Subject: [PATCH 4/6] Implement full color remapper --- sonoff/settings.ino | 4 ---- sonoff/sonoff.h | 11 ----------- sonoff/xdrv_04_light.ino | 37 +++++++++++++++++++++++++++---------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/sonoff/settings.ino b/sonoff/settings.ino index c18d60d3f..2fb9a9afa 100644 --- a/sonoff/settings.ino +++ b/sonoff/settings.ino @@ -587,7 +587,6 @@ void SettingsDefaultSet2(void) // Settings.flag.stop_flash_rotate = 0; Settings.save_data = SAVE_DATA; Settings.param[P_BOOT_LOOP_OFFSET] = BOOT_LOOP_OFFSET; - Settings.param[P_RGB_REMAP] = RGB_REMAP_RGB; Settings.sleep = APP_SLEEP; if (Settings.sleep < 50) { Settings.sleep = 50; // Default to 50 for sleep, for now @@ -1056,9 +1055,6 @@ void SettingsDelta(void) if (Settings.version < 0x06040110) { ModuleDefault(WEMOS); } - if (Settings.version < 0x06040112) { - Settings.param[P_RGB_REMAP] = RGB_REMAP_RGB; - } Settings.version = VERSION; SettingsSave(1); diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index aafc98615..f83e7e390 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -171,17 +171,6 @@ typedef unsigned long power_t; // Power (Relay) type #define LT_SM16716 16 // Lights that use SM16716 will have this bit set in light_type -// Remap constants are 3-digit ternary numbers, each digit tells where the corresponding color component is mapped *from* -// digit 0 = ( n % 3) tells where the red is mapped from (0=red, 1=green, 2=blue) -// digit 1 = ((n/3) % 3) tells where the green is mapped from -// digit 2 = ((n/9) % 3) tells where the blue is mapped from -#define RGB_REMAP_RGB (0*1 + 1*3 + 2*9) -#define RGB_REMAP_RBG (0*1 + 2*3 + 1*9) -#define RGB_REMAP_GRB (1*1 + 0*3 + 2*9) -#define RGB_REMAP_GBR (1*1 + 2*3 + 0*9) -#define RGB_REMAP_BRG (2*1 + 0*3 + 1*9) -#define RGB_REMAP_BGR (2*1 + 1*3 + 0*9) - #define MQTT_PUBSUBCLIENT 1 // Mqtt PubSubClient library #define MQTT_TASMOTAMQTT 2 // Mqtt TasmotaMqtt library based on esp-mqtt-arduino - soon obsolete #define MQTT_ESPMQTTARDUINO 3 // Mqtt esp-mqtt-arduino library by Ingo Randolf - obsolete but define is present for debugging purposes diff --git a/sonoff/xdrv_04_light.ino b/sonoff/xdrv_04_light.ino index 54085a4ba..10ac7253f 100644 --- a/sonoff/xdrv_04_light.ino +++ b/sonoff/xdrv_04_light.ino @@ -86,6 +86,8 @@ struct LCwColor { #define MAX_FIXED_COLD_WARM 4 const LCwColor kFixedColdWarm[MAX_FIXED_COLD_WARM] PROGMEM = { 0,0, 255,0, 0,255, 128,128 }; +uint8_t remap[5]; + uint8_t ledTable[] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -563,6 +565,26 @@ void LightInit(void) light_power = 0; light_update = 1; light_wakeup_active = 0; + + uint8_t param = Settings.param[P_RGB_REMAP]; + if(param > 119){ + param = 119; + } + std::vector tmp = {0,1,2,3,4}; + remap[0] = tmp[param / 24]; + tmp.erase(tmp.begin() + (param / 24)); + param = param % 24; + remap[1] = tmp[(param / 6)]; + tmp.erase(tmp.begin() + (param / 6)); + param = param % 6; + remap[2] = tmp[(param / 2)]; + tmp.erase(tmp.begin() + (param / 2)); + param = param % 2; + remap[3] = tmp[param]; + remap[4] = tmp[1-param]; + + //snprintf_P(log_data, sizeof(log_data), "%d colors: %d %d %d %d %d",Settings.param[P_RGB_REMAP], remap[0],remap[1],remap[2],remap[3],remap[4]); + //AddLog(LOG_LEVEL_DEBUG); } void LightSetColorTemp(uint16_t ct) @@ -964,16 +986,11 @@ void LightAnimate(void) cur_col[i] = (Settings.light_correction) ? ledTable[cur_col[i]] : cur_col[i]; } - // RGB remapping - uint8_t rgb_mapping = Settings.param[P_RGB_REMAP]; - - if (rgb_mapping != RGB_REMAP_RGB) { - uint8_t orig_col[3]; - memcpy(orig_col, cur_col, sizeof(orig_col)); - for (uint8_t i = 0; i < 3; i++) { - cur_col[i] = orig_col[rgb_mapping % 3]; - rgb_mapping /= 3; - } + // color remapping + uint8_t orig_col[5]; + memcpy(orig_col, cur_col, sizeof(orig_col)); + for (uint8_t i = 0; i < 5; i++) { + cur_col[i] = orig_col[remap[i]]; } for (uint8_t i = 0; i < light_subtype; i++) { From 430334e6040b15fb116e9f27a7e55f458ea5acd6 Mon Sep 17 00:00:00 2001 From: netpok Date: Sun, 24 Feb 2019 21:56:44 +0100 Subject: [PATCH 5/6] Replace vector with array it saves 24 bytes of code --- sonoff/xdrv_04_light.ino | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sonoff/xdrv_04_light.ino b/sonoff/xdrv_04_light.ino index 10ac7253f..c6868a09e 100644 --- a/sonoff/xdrv_04_light.ino +++ b/sonoff/xdrv_04_light.ino @@ -570,15 +570,21 @@ void LightInit(void) if(param > 119){ param = 119; } - std::vector tmp = {0,1,2,3,4}; + uint8_t tmp[] = {0,1,2,3,4}; remap[0] = tmp[param / 24]; - tmp.erase(tmp.begin() + (param / 24)); + for (uint8_t i = param / 24; i<4; ++i){ + tmp[i] = tmp[i+1]; + } param = param % 24; remap[1] = tmp[(param / 6)]; - tmp.erase(tmp.begin() + (param / 6)); + for (uint8_t i = param / 6; i<3; ++i){ + tmp[i] = tmp[i+1]; + } param = param % 6; remap[2] = tmp[(param / 2)]; - tmp.erase(tmp.begin() + (param / 2)); + for (uint8_t i = param / 2; i<2; ++i){ + tmp[i] = tmp[i+1]; + } param = param % 2; remap[3] = tmp[param]; remap[4] = tmp[1-param]; From 48f6b09987e098ffeb57727e92009ee18fc89368 Mon Sep 17 00:00:00 2001 From: Gabor Simon Date: Sun, 24 Feb 2019 23:48:03 +0000 Subject: [PATCH 6/6] Initialisation and updating of color mapping added --- sonoff/settings.ino | 4 ++++ sonoff/sonoff.h | 7 +++++++ sonoff/sonoff.ino | 10 ++++++++++ sonoff/xdrv_04_light.ino | 21 +++++++++++++-------- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/sonoff/settings.ino b/sonoff/settings.ino index 2fb9a9afa..843c9fee5 100644 --- a/sonoff/settings.ino +++ b/sonoff/settings.ino @@ -587,6 +587,7 @@ void SettingsDefaultSet2(void) // Settings.flag.stop_flash_rotate = 0; Settings.save_data = SAVE_DATA; Settings.param[P_BOOT_LOOP_OFFSET] = BOOT_LOOP_OFFSET; + Settings.param[P_RGB_REMAP] = RGB_REMAP_RGBW; Settings.sleep = APP_SLEEP; if (Settings.sleep < 50) { Settings.sleep = 50; // Default to 50 for sleep, for now @@ -1055,6 +1056,9 @@ void SettingsDelta(void) if (Settings.version < 0x06040110) { ModuleDefault(WEMOS); } + if (Settings.version < 0x06040112) { + Settings.param[P_RGB_REMAP] = RGB_REMAP_RGBW; + } Settings.version = VERSION; SettingsSave(1); diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index f83e7e390..951c7f6d2 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -171,6 +171,13 @@ typedef unsigned long power_t; // Power (Relay) type #define LT_SM16716 16 // Lights that use SM16716 will have this bit set in light_type +#define RGB_REMAP_RGBW 0 +#define RGB_REMAP_RBGW 6 +#define RGB_REMAP_GRBW 24 +#define RGB_REMAP_GBRW 30 +#define RGB_REMAP_BRGW 48 +#define RGB_REMAP_BGRW 54 + #define MQTT_PUBSUBCLIENT 1 // Mqtt PubSubClient library #define MQTT_TASMOTAMQTT 2 // Mqtt TasmotaMqtt library based on esp-mqtt-arduino - soon obsolete #define MQTT_ESPMQTTARDUINO 3 // Mqtt esp-mqtt-arduino library by Ingo Randolf - obsolete but define is present for debugging purposes diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 2a65f8f65..2c771a8ab 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -789,9 +789,19 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) param_low = 1; param_high = 250; break; + + case P_RGB_REMAP: + param_low = 0; + param_high = 119; + break; } if ((payload >= param_low) && (payload <= param_high)) { Settings.param[pindex] = payload; + switch (pindex) { + case P_RGB_REMAP: + LightUpdateColorMapping(); + break; + } } } } diff --git a/sonoff/xdrv_04_light.ino b/sonoff/xdrv_04_light.ino index c6868a09e..c606425b4 100644 --- a/sonoff/xdrv_04_light.ino +++ b/sonoff/xdrv_04_light.ino @@ -86,7 +86,7 @@ struct LCwColor { #define MAX_FIXED_COLD_WARM 4 const LCwColor kFixedColdWarm[MAX_FIXED_COLD_WARM] PROGMEM = { 0,0, 255,0, 0,255, 128,128 }; -uint8_t remap[5]; +uint8_t color_remap[5]; uint8_t ledTable[] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -566,30 +566,35 @@ void LightInit(void) light_update = 1; light_wakeup_active = 0; + LightUpdateColorMapping(); +} + +void LightUpdateColorMapping(void) +{ uint8_t param = Settings.param[P_RGB_REMAP]; if(param > 119){ param = 119; } uint8_t tmp[] = {0,1,2,3,4}; - remap[0] = tmp[param / 24]; + color_remap[0] = tmp[param / 24]; for (uint8_t i = param / 24; i<4; ++i){ tmp[i] = tmp[i+1]; } param = param % 24; - remap[1] = tmp[(param / 6)]; + color_remap[1] = tmp[(param / 6)]; for (uint8_t i = param / 6; i<3; ++i){ tmp[i] = tmp[i+1]; } param = param % 6; - remap[2] = tmp[(param / 2)]; + color_remap[2] = tmp[(param / 2)]; for (uint8_t i = param / 2; i<2; ++i){ tmp[i] = tmp[i+1]; } param = param % 2; - remap[3] = tmp[param]; - remap[4] = tmp[1-param]; + color_remap[3] = tmp[param]; + color_remap[4] = tmp[1-param]; - //snprintf_P(log_data, sizeof(log_data), "%d colors: %d %d %d %d %d",Settings.param[P_RGB_REMAP], remap[0],remap[1],remap[2],remap[3],remap[4]); + //snprintf_P(log_data, sizeof(log_data), "%d colors: %d %d %d %d %d",Settings.param[P_RGB_REMAP], color_remap[0],color_remap[1],color_remap[2],color_remap[3],color_remap[4]); //AddLog(LOG_LEVEL_DEBUG); } @@ -996,7 +1001,7 @@ void LightAnimate(void) uint8_t orig_col[5]; memcpy(orig_col, cur_col, sizeof(orig_col)); for (uint8_t i = 0; i < 5; i++) { - cur_col[i] = orig_col[remap[i]]; + cur_col[i] = orig_col[color_remap[i]]; } for (uint8_t i = 0; i < light_subtype; i++) {