v5.9.1a - Fix PWM Watchdog Timeout

5.9.1a
 * Fix PWM watchdog timeout if Dimmer is set to 100 or Color set
to 0xFF (#1146)
This commit is contained in:
arendst 2017-11-08 11:57:16 +01:00
parent 19533cc995
commit 7098d058b1
6 changed files with 32 additions and 16 deletions

View File

@ -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.9.0b** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
Current version is **5.9.1a** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
### ATTENTION All versions

View File

@ -1,12 +1,13 @@
/* 5.9.0b
/* 5.9.1a
* Fix PWM watchdog timeout if Dimmer is set to 100 or Color set to 0xFF (#1146)
*
* 5.9.1 20171107
* Add external sensor function pointer interface to enable easy sensor addition
* Add support for ADS1115 to be enabled in user_config.h and needs libraries i2cdevlib-Core and i2cdevlib-ADS1115 (#338, #660)
* Fix Backup Configuration file download failure by defining proper file size (#1115)
* Fix Exception 26 and empty console screen after usage of command WakeupDuration (#1133)
* Fix some changed iTead web links in README.md (#1137)
*
* 5.9.0a
* Add external sensor function pointer interface to enable easy sensor addition
* Fix Backup Configuration file download failure by defining proper file size (#1115)
*
* 5.9.0 20171030
* Rewrite code (partly) using Google C++ Style Guide (https://google.github.io/styleguide/cppguide.html)
* Rewrite code by using command lookup tables and javascript (client side) web page expansions

View File

@ -100,18 +100,27 @@ enum WeekInMonthOptions {Last, First, Second, Third, Fourth};
enum DayOfTheWeekOptions {Sun=1, Mon, Tue, Wed, Thu, Fri, Sat};
enum MonthNamesOptions {Jan=1, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec};
enum HemisphereOptions {North, South};
enum LoggingLevels {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL};
enum WifiConfigOptions {WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY, WIFI_WAIT, MAX_WIFI_OPTION};
enum SwitchModeOptions {TOGGLE, FOLLOW, FOLLOW_INV, PUSHBUTTON, PUSHBUTTON_INV, PUSHBUTTONHOLD, PUSHBUTTONHOLD_INV, MAX_SWITCH_OPTION};
enum LedStateOptions {LED_OFF, LED_POWER, LED_MQTTSUB, LED_POWER_MQTTSUB, LED_MQTTPUB, LED_POWER_MQTTPUB, LED_MQTT, LED_POWER_MQTT, MAX_LED_OPTION};
enum EmulationOptions {EMUL_NONE, EMUL_WEMO, EMUL_HUE, EMUL_MAX};
enum ButtonStates {PRESSED, NOT_PRESSED};
enum SettingsParmaIndex {P_HOLD_TIME, P_MAX_POWER_RETRY, P_MAX_PARAM8};
enum Ws2812ClockIndex {WS_SECOND, WS_MINUTE, WS_HOUR};
enum Ws2812Color {WS_RED, WS_GREEN, WS_BLUE};
enum LightTypes {LT_BASIC, LT_PWM1, LT_PWM2, LT_PWM3, LT_PWM4, LT_PWM5, LT_PWM6, LT_PWM7, LT_NU8, LT_NU9, LT_NU10, LT_WS2812, LT_RGBW, LT_RGBWC};
enum LichtSubtypes {LST_NONE, LST_SINGLE, LST_COLDWARM, LST_RGB, LST_RGBW, LST_RGBWC};
enum LichtSchemes {LS_POWER, LS_WAKEUP, LS_CYCLEUP, LS_CYCLEDN, LS_RANDOM, LS_MAX};
enum XsnsFunctions {FUNC_XSNS_INIT, FUNC_XSNS_PREP, FUNC_XSNS_JSON_APPEND, FUNC_XSNS_MQTT_SHOW, FUNC_XSNS_WEB};
const uint8_t kDefaultRfCode[9] PROGMEM = { 0x21, 0x16, 0x01, 0x0E, 0x03, 0x48, 0x2E, 0x1A, 0x00 };

View File

@ -25,7 +25,7 @@
- Select IDE Tools - Flash Size: "1M (no SPIFFS)"
====================================================*/
#define VERSION 0x05090002 // 5.9.0b
#define VERSION 0x05090101 // 5.9.1a
// Location specific includes
#include "sonoff.h" // Enumaration used in user_config.h
@ -2612,7 +2612,7 @@ void GpioInit()
hlw_flg = ((pin[GPIO_HLW_SEL] < 99) && (pin[GPIO_HLW_CF1] < 99) && (pin[GPIO_HLW_CF] < 99));
XSnsInit();
// XSnsInit();
}
extern "C" {
@ -2726,9 +2726,10 @@ void setup()
blink_powersave = power;
if (SONOFF_SC == Settings.module) {
SonoffScInit();
}
// if (SONOFF_SC == Settings.module) {
// SonoffScInit();
// }
XSnsInit();
RtcInit();

View File

@ -179,7 +179,7 @@ void LightInit(void)
Settings.pwm_value[i] = 0; // Disable direct PWM control
}
if (LT_PWM1 == light_type) {
Settings.light_color[0] = 255; // One PWM channel only supports Dimmer but needs max color
Settings.light_color[0] = 255; // One PWM channel only supports Dimmer but needs max color
}
if (SONOFF_LED == Settings.module) { // Fix Sonoff Led instabilities
if (!my_module.gp.io[4]) {
@ -270,8 +270,8 @@ void LightSetDimmer(uint8_t myDimmer)
{
float temp;
if ((SONOFF_BN == Settings.module) && (100 == myDimmer)) {
myDimmer = 99; // BN-SZ01 starts flickering at dimmer = 100
if (LT_PWM1 == light_type) {
Settings.light_color[0] = 255; // One PWM channel only supports Dimmer but needs max color
}
float dimmer = 100 / (float)myDimmer;
for (byte i = 0; i < light_subtype; i++) {
@ -527,6 +527,9 @@ void LightAnimate()
cur_col[i] = (Settings.light_correction) ? ledTable[light_last_color[i]] : light_last_color[i];
if (light_type < LT_PWM6) {
if (pin[GPIO_PWM1 +i] < 99) {
if (cur_col[i] > 0xFC) {
cur_col[i] = 0xFC; // Fix unwanted blinking and PWM watchdog errors for values close to pwm_range (H801, Arilux and BN-SZ01)
}
uint16_t curcol = cur_col[i] * (Settings.pwm_range / 255);
// snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION "Cur_Col%d %d, CurCol %d"), i, cur_col[i], curcol);
// AddLog(LOG_LEVEL_DEBUG);
@ -856,6 +859,7 @@ boolean LightCommand(char *type, uint16_t index, char *dataBuf, uint16_t data_le
else if (CMND_DIMMER == command_code) {
if ((payload >= 0) && (payload <= 100)) {
Settings.light_dimmer = payload;
light_update = 1;
coldim = true;
} else {
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.light_dimmer);

View File

@ -148,8 +148,9 @@ boolean Xsns04(byte function)
if (SONOFF_SC == Settings.module) {
switch (function) {
// case FUNC_XSNS_INIT:
// break;
case FUNC_XSNS_INIT:
SonoffScInit();
break;
// case FUNC_XSNS_PREP:
// break;
case FUNC_XSNS_JSON_APPEND: