From 42ad9e1a66d41f3948fc47affcee0573e864e5aa Mon Sep 17 00:00:00 2001 From: Theo Arends Date: Sat, 17 Mar 2018 15:10:08 +0100 Subject: [PATCH] Revert "v5.12.0f - Add BRG support" This reverts commit 55c43ded0e8c1e5343dc56f68922dbaaf217bd70. --- README.md | 2 +- sonoff/_releasenotes.ino | 5 +---- sonoff/settings.ino | 4 ++-- sonoff/sonoff.h | 12 ----------- sonoff/sonoff.ino | 2 +- sonoff/sonoff_post.h | 2 +- sonoff/user_config.h | 8 +++---- sonoff/xdrv_00_mqtt.ino | 28 ++++++++++++------------ sonoff/xdrv_01_light.ino | 2 +- sonoff/xplg_ws2812.ino | 46 +++++++++++++++++----------------------- 10 files changed, 44 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index 6b30d05d0..1c1b625dc 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Sonoff-Tasmota Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE. -Current version is **5.12.0f** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. +Current version is **5.12.0e** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. ### ATTENTION All versions diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index 82d94a3ca..d7ebcf426 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,7 +1,4 @@ -/* 5.12.0f - * Add support for WS2812 BRG led configuration to be defined as NEO_BRG in user_config.h (#1690) - * - * 5.12.0e +/* 5.12.0e * Add Domoticz dust (custom) sensors to PMS5003 and NovaFitness SDS drivers as PM1, PM2.5 and PM10 * Add a second TLS fingerprint to allow switching keys in TLS mode (#2033, #2102) * Add display of remaining pulse time to command PulseTime (#2085) diff --git a/sonoff/settings.ino b/sonoff/settings.ino index cc2d1c955..503ebfb86 100644 --- a/sonoff/settings.ino +++ b/sonoff/settings.ino @@ -509,7 +509,7 @@ void SettingsDefaultSet2() // Settings.domoticz_switch_idx[i] = 0; } - Settings.energy_power_delta = DEFAULT_POWER_DELTA; + Settings.energy_power_delta = 80; Settings.energy_power_calibration = HLW_PREF_PULSE; Settings.energy_voltage_calibration = HLW_UREF_PULSE; Settings.energy_current_calibration = HLW_IREF_PULSE; @@ -890,7 +890,7 @@ void SettingsDelta() } if (Settings.version < 0x050C0005) { Settings.light_rotation = 0; - Settings.energy_power_delta = DEFAULT_POWER_DELTA; + Settings.energy_power_delta = 80; char fingerprint[60]; memcpy(fingerprint, Settings.mqtt_fingerprint, sizeof(fingerprint)); char *p = fingerprint; diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index 518408e0c..c90b31550 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -107,18 +107,6 @@ typedef unsigned long power_t; // Power (Relay) type #define max(a,b) ((a)>(b)?(a):(b)) */ -//enum ws2812NeopixelbusFeature { NEO_RGB, NEO_GRB, NEO_BRG, NEO_4LED, NEO_RGBW, NEO_GRBW }; // Doesn't work -#define NEO_RGB 0 // Neopixel RGB leds -#define NEO_GRB 1 // Neopixel GRB leds -#define NEO_BRG 2 // Neopixel BRG leds -#define NEO_4LED 3 // Placeholder to test for 4 led types -#define NEO_RGBW 4 // Neopixel RGBW leds -#define NEO_GRBW 5 // Neopixel GRBW leds - -#define MQTT_PUBSUBCLIENT 1 // Mqtt PubSubClient library -#define MQTT_TASMOTAMQTT 2 // Mqtt TasmotaMqtt library based on esp-mqtt-arduino -#define MQTT_ESPMQTTARDUINO 3 // Mqtt esp-mqtt-arduino library by Ingo Randolf - /*********************************************************************************************\ * Enumeration \*********************************************************************************************/ diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index e4a8c0b2a..3edbeac23 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -25,7 +25,7 @@ - Select IDE Tools - Flash Size: "1M (no SPIFFS)" ====================================================*/ -#define VERSION 0x050C0006 // 5.12.0f +#define VERSION 0x050C0005 // 5.12.0e // Location specific includes #include // Arduino_Esp8266 version information (ARDUINO_ESP8266_RELEASE and ARDUINO_ESP8266_RELEASE_2_3_0) diff --git a/sonoff/sonoff_post.h b/sonoff/sonoff_post.h index 078d880a0..b6ab9e999 100644 --- a/sonoff/sonoff_post.h +++ b/sonoff/sonoff_post.h @@ -68,7 +68,7 @@ void WifiWpsStatusCallback(wps_cb_status status); #define USE_IR_RECEIVE // Support for IR receiver (+5k5 code, 264 iram) #define USE_WS2812 // WS2812 Led string using library NeoPixelBus (+5k code, +1k mem, 232 iram) - Disable by // #ifndef USE_WS2812_CTYPE - #define USE_WS2812_CTYPE NEO_GRB // WS2812 Color type (NEO_RGB, NEO_GRB, NEO_BRG, NEO_RGBW, NEO_GRBW) + #define USE_WS2812_CTYPE 1 // WS2812 Color type (0 - RGB, 1 - GRB, 2 - RGBW, 3 - GRBW) #endif // #define USE_WS2812_DMA // DMA supports only GPIO03 (= Serial RXD) (+1k mem). When USE_WS2812_DMA is enabled expect Exceptions on Pow #define USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0)) diff --git a/sonoff/user_config.h b/sonoff/user_config.h index fcc39b63c..92a8c160f 100644 --- a/sonoff/user_config.h +++ b/sonoff/user_config.h @@ -78,11 +78,11 @@ * Select ONE of possible MQTT library types below \*********************************************************************************************/ // Default MQTT driver for both non-TLS and TLS connections. Blocks network if MQTT server is unavailable. -#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library +#define MQTT_LIBRARY_TYPE 1 // Use PubSubClient library // Alternative MQTT driver does not block network when MQTT server is unavailable. No TLS support -//#define MQTT_LIBRARY_TYPE MQTT_TASMOTAMQTT // Use TasmotaMqtt library (+4k4 code, +4k mem) - non-TLS only +//#define MQTT_LIBRARY_TYPE 2 // Use TasmotaMqtt library (+4k4 code, +4k mem) - non-TLS only // Alternative MQTT driver does not block network when MQTT server is unavailable. No TLS support -//#define MQTT_LIBRARY_TYPE MQTT_ESPMQTTARDUINO // Use (patched) esp-mqtt-arduino library (+4k8 code, +4k mem) - non-TLS only +//#define MQTT_LIBRARY_TYPE 3 // Use (patched) esp-mqtt-arduino library (+4k8 code, +4k mem) - non-TLS only // -- MQTT ---------------------------------------- #define MQTT_USE 1 // [SetOption3] Select default MQTT use (0 = Off, 1 = On) @@ -227,7 +227,7 @@ #define USE_IR_RECEIVE // Support for IR receiver (+5k5 code, 264 iram) #define USE_WS2812 // WS2812 Led string using library NeoPixelBus (+5k code, +1k mem, 232 iram) - Disable by // - #define USE_WS2812_CTYPE NEO_GRB // WS2812 Color type (NEO_RGB, NEO_GRB, NEO_BRG, NEO_RGBW, NEO_GRBW) + #define USE_WS2812_CTYPE 1 // WS2812 Color type (0 - RGB, 1 - GRB, 2 - RGBW, 3 - GRBW) // #define USE_WS2812_DMA // DMA supports only GPIO03 (= Serial RXD) (+1k mem). When USE_WS2812_DMA is enabled expect Exceptions on Pow #define USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0)) diff --git a/sonoff/xdrv_00_mqtt.ino b/sonoff/xdrv_00_mqtt.ino index 6a87f1f25..9f89eb259 100644 --- a/sonoff/xdrv_00_mqtt.ino +++ b/sonoff/xdrv_00_mqtt.ino @@ -18,23 +18,23 @@ */ /*********************************************************************************************\ - * Select ONE of possible MQTT library types below + * Select ONE of possible MQTT libraries below \*********************************************************************************************/ // Default MQTT driver for both non-TLS and TLS connections. Blocks network if MQTT server is unavailable. -//#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library +//#define MQTT_LIBRARY_TYPE 1 // Use PubSubClient library // Alternative MQTT driver does not block network when MQTT server is unavailable. No TLS support -//#define MQTT_LIBRARY_TYPE MQTT_TASMOTAMQTT // Use TasmotaMqtt library (+4k4 code, +4k mem) - non-TLS only +//#define MQTT_LIBRARY_TYPE 2 // Use TasmotaMqtt library (+4k4 code, +4k mem) - non-TLS only // Alternative MQTT driver does not block network when MQTT server is unavailable. No TLS support -//#define MQTT_LIBRARY_TYPE MQTT_ESPMQTTARDUINO // Use (patched) esp-mqtt-arduino library (+4k8 code, +4k mem) - non-TLS only +//#define MQTT_LIBRARY_TYPE 3 // Use (patched) esp-mqtt-arduino library (+4k8 code, +4k mem) - non-TLS only #ifdef USE_MQTT_TLS #ifdef MQTT_LIBRARY_TYPE #undef MQTT_LIBRARY_TYPE #endif -#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library as it only supports TLS +#define MQTT_LIBRARY_TYPE 1 // Use PubSubClient library as it only supports TLS #else #ifndef MQTT_LIBRARY_TYPE -#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library as default +#define MQTT_LIBRARY_TYPE 1 // Use PubSubClient library as default #endif #endif @@ -63,7 +63,7 @@ bool mqtt_connected = false; // MQTT virtual connection status * void MqttLoop() \*********************************************************************************************/ -#if (MQTT_LIBRARY_TYPE == MQTT_PUBSUBCLIENT) /***********************************************/ +#if (1 == MQTT_LIBRARY_TYPE) /*****************************************************************/ #include @@ -100,7 +100,7 @@ void MqttLoop() MqttClient.loop(); } -#elif (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT) /**********************************************/ +#elif (2 == MQTT_LIBRARY_TYPE) /*****************************************************************/ #include TasmotaMqtt MqttClient; @@ -134,7 +134,7 @@ void MqttLoop() { } -#elif (MQTT_LIBRARY_TYPE == MQTT_ESPMQTTARDUINO) /*******************************************/ +#elif (3 == MQTT_LIBRARY_TYPE) /***************************************************************/ #include MQTT *MqttClient = NULL; @@ -450,14 +450,14 @@ void MqttReconnect() if (!MqttCheckTls()) return; #endif // USE_MQTT_TLS -#if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT) +#if (2 == MQTT_LIBRARY_TYPE) MqttClient.InitConnection(Settings.mqtt_host, Settings.mqtt_port); MqttClient.InitClient(mqtt_client, mqtt_user, mqtt_pwd, MQTT_KEEPALIVE); MqttClient.InitLWT(stopic, mqtt_data, 1, true); MqttClient.OnConnected(MqttConnected); MqttClient.OnDisconnected(MqttDisconnectedCb); MqttClient.OnData(MqttDataHandler); -#elif (MQTT_LIBRARY_TYPE == MQTT_ESPMQTTARDUINO) +#elif (3 == MQTT_LIBRARY_TYPE) MqttClient = new MQTT(mqtt_client, Settings.mqtt_host, Settings.mqtt_port, stopic, 1, true, mqtt_data); MqttClient->setUserPwd(mqtt_user, mqtt_pwd); MqttClient->onConnected(MqttConnected); @@ -468,7 +468,7 @@ void MqttReconnect() mqtt_initial_connection_state = 1; } -#if (MQTT_LIBRARY_TYPE == MQTT_PUBSUBCLIENT) +#if (1 == MQTT_LIBRARY_TYPE) MqttClient.setCallback(MqttDataHandler); MqttClient.setServer(Settings.mqtt_host, Settings.mqtt_port); if (MqttClient.connect(mqtt_client, mqtt_user, mqtt_pwd, stopic, 1, true, mqtt_data)) { @@ -476,9 +476,9 @@ void MqttReconnect() } else { MqttDisconnected(MqttClient.state()); // status codes are documented here http://pubsubclient.knolleary.net/api.html#state } -#elif (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT) +#elif (2 == MQTT_LIBRARY_TYPE) MqttClient.Connect(); -#elif (MQTT_LIBRARY_TYPE == MQTT_ESPMQTTARDUINO) +#elif (3 == MQTT_LIBRARY_TYPE) MqttClient->connect(); #endif // MQTT_LIBRARY_TYPE } diff --git a/sonoff/xdrv_01_light.ino b/sonoff/xdrv_01_light.ino index 8182a032b..6bcf20bea 100644 --- a/sonoff/xdrv_01_light.ino +++ b/sonoff/xdrv_01_light.ino @@ -376,7 +376,7 @@ void LightInit() } #ifdef USE_WS2812 // ************************************************************************ else if (LT_WS2812 == light_type) { -#if (USE_WS2812_CTYPE > NEO_4LED) +#if (USE_WS2812_CTYPE > 1) light_subtype++; // from RGB to RGBW #endif Ws2812Init(); diff --git a/sonoff/xplg_ws2812.ino b/sonoff/xplg_ws2812.ino index 3f1652c40..42aafb8f3 100644 --- a/sonoff/xplg_ws2812.ino +++ b/sonoff/xplg_ws2812.ino @@ -25,25 +25,21 @@ #include #ifdef USE_WS2812_DMA -#if (USE_WS2812_CTYPE == NEO_GRB) +#if (USE_WS2812_CTYPE == 1) NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_BRG) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_RGBW) +#elif (USE_WS2812_CTYPE == 2) NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_GRBW) +#elif (USE_WS2812_CTYPE == 3) NeoPixelBus *strip = NULL; #else // USE_WS2812_CTYPE NeoPixelBus *strip = NULL; #endif // USE_WS2812_CTYPE #else // USE_WS2812_DMA -#if (USE_WS2812_CTYPE == NEO_GRB) +#if (USE_WS2812_CTYPE == 1) NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_BRG) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_RGBW) +#elif (USE_WS2812_CTYPE == 2) NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_GRBW) +#elif (USE_WS2812_CTYPE == 3) NeoPixelBus *strip = NULL; #else // USE_WS2812_CTYPE NeoPixelBus *strip = NULL; @@ -94,7 +90,7 @@ uint8_t ws_show_next = 1; void Ws2812StripShow() { -#if (USE_WS2812_CTYPE > NEO_4LED) +#if (USE_WS2812_CTYPE > 1) RgbwColor c; #else RgbColor c; @@ -106,7 +102,7 @@ void Ws2812StripShow() c.R = ledTable[c.R]; c.G = ledTable[c.G]; c.B = ledTable[c.B]; -#if (USE_WS2812_CTYPE > NEO_4LED) +#if (USE_WS2812_CTYPE > 1) c.W = ledTable[c.W]; #endif strip->SetPixelColor(i, c); @@ -126,7 +122,7 @@ int mod(int a, int b) void Ws2812UpdatePixelColor(int position, struct WsColor hand_color, float offset) { -#if (USE_WS2812_CTYPE > NEO_4LED) +#if (USE_WS2812_CTYPE > 1) RgbwColor color; #else RgbColor color; @@ -209,7 +205,7 @@ void Ws2812Gradient(uint8_t schemenr) * Display a gradient of colors for the current color scheme. * Repeat is the number of repetitions of the gradient (pick a multiple of 2 for smooth looping of the gradient). */ -#if (USE_WS2812_CTYPE > NEO_4LED) +#if (USE_WS2812_CTYPE > 1) RgbwColor c; c.W = 0; #else @@ -257,7 +253,7 @@ void Ws2812Bars(uint8_t schemenr) * Display solid bars of color for the current color scheme. * Width is the width of each bar in pixels/lights. */ -#if (USE_WS2812_CTYPE > NEO_4LED) +#if (USE_WS2812_CTYPE > 1) RgbwColor c; c.W = 0; #else @@ -302,25 +298,21 @@ void Ws2812Bars(uint8_t schemenr) void Ws2812Init() { #ifdef USE_WS2812_DMA -#if (USE_WS2812_CTYPE == NEO_GRB) +#if (USE_WS2812_CTYPE == 1) strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#elif (USE_WS2812_CTYPE == NEO_BRG) - strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#elif (USE_WS2812_CTYPE == NEO_RGBW) +#elif (USE_WS2812_CTYPE == 2) strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#elif (USE_WS2812_CTYPE == NEO_GRBW) +#elif (USE_WS2812_CTYPE == 3) strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. #else // USE_WS2812_CTYPE strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. #endif // USE_WS2812_CTYPE #else // USE_WS2812_DMA -#if (USE_WS2812_CTYPE == NEO_GRB) +#if (USE_WS2812_CTYPE == 1) strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#elif (USE_WS2812_CTYPE == NEO_BRG) - strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#elif (USE_WS2812_CTYPE == NEO_RGBW) +#elif (USE_WS2812_CTYPE == 2) strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#elif (USE_WS2812_CTYPE == NEO_GRBW) +#elif (USE_WS2812_CTYPE == 3) strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); #else // USE_WS2812_CTYPE strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); @@ -339,7 +331,7 @@ void Ws2812Clear() void Ws2812SetColor(uint16_t led, uint8_t red, uint8_t green, uint8_t blue, uint8_t white) { -#if (USE_WS2812_CTYPE > NEO_4LED) +#if (USE_WS2812_CTYPE > 1) RgbwColor lcolor; lcolor.W = white; #else @@ -365,7 +357,7 @@ char* Ws2812GetColor(uint16_t led, char* scolor) { uint8_t sl_ledcolor[4]; - #if (USE_WS2812_CTYPE > NEO_4LED) + #if (USE_WS2812_CTYPE > 1) RgbwColor lcolor = strip->GetPixelColor(led -1); sl_ledcolor[3] = lcolor.W; #else