Bump version to 6.6.0.20

Add command SetOption65 0/1 to disable (1) fast power cycle detection fixing unwanted brownout trigger
This commit is contained in:
Theo Arends 2019-10-18 15:18:39 +02:00
parent 3bb58b3ea0
commit 84fe7b8e76
7 changed files with 33 additions and 16 deletions

View File

@ -1,4 +1,7 @@
/*********************************************************************************************\ /*********************************************************************************************\
* 6.6.0.20 20191018
* Add command SetOption65 0/1 to disable (1) fast power cycle detection fixing unwanted brownout trigger
*
* 6.6.0.19 20191018 * 6.6.0.19 20191018
* Replace obsolete xsns_23_sdm120 with xnrg_08_sdm120 and consolidate define USE_SDM120 * Replace obsolete xsns_23_sdm120 with xnrg_08_sdm120 and consolidate define USE_SDM120
* Replace obsolete xsns_25_sdm630 with xnrg_10_sdm630 and consolidate define USE_SDM630 * Replace obsolete xsns_25_sdm630 with xnrg_10_sdm630 and consolidate define USE_SDM630
@ -78,7 +81,7 @@
* Add support for Hiking DDS238-2 Modbus energy meter by Matteo Campanella (#6384) * Add support for Hiking DDS238-2 Modbus energy meter by Matteo Campanella (#6384)
* *
* 6.6.0.10 20190905 * 6.6.0.10 20190905
* Redesign Tuya support by Shantur Rathore (#6353) * Redesign Tuya support by Shantur Rathore removing commands SetOption34, 41, 44, 45, 46 and 65 (#6353)
* Add command Reset 99 to reset bootcount to zero (#684, #6351) * Add command Reset 99 to reset bootcount to zero (#684, #6351)
* Change command Time 1/2/3 to select JSON time format ISO, ISO + Epoch or Epoch for legacy reason * Change command Time 1/2/3 to select JSON time format ISO, ISO + Epoch or Epoch for legacy reason
* *

View File

@ -78,7 +78,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t no_hold_retain : 1; // bit 12 (v6.4.1.19) - SetOption62 - Don't use retain flag on HOLD messages uint32_t no_hold_retain : 1; // bit 12 (v6.4.1.19) - SetOption62 - Don't use retain flag on HOLD messages
uint32_t no_power_feedback : 1; // bit 13 (v6.5.0.9) - SetOption63 - Don't scan relay power state at restart uint32_t no_power_feedback : 1; // bit 13 (v6.5.0.9) - SetOption63 - Don't scan relay power state at restart
uint32_t use_underscore : 1; // bit 14 (v6.5.0.12) - SetOption64 - Enable "_" instead of "-" as sensor index separator uint32_t use_underscore : 1; // bit 14 (v6.5.0.12) - SetOption64 - Enable "_" instead of "-" as sensor index separator
uint32_t ex_tuya_disable_dimmer : 1; // bit 15 (v6.5.0.15) - SetOption65 - (Enable or Disable Tuya Serial Dimmer control) - free since 6.6.0.10 uint32_t fast_power_cycle_disable : 1; // bit 15 (v6.6.0.20) - SetOption65 - Disable fast power cycle detection for device reset
uint32_t ex_tuya_dimmer_range_255 : 1; // bit 16 (v6.6.0.1) - SetOption66 - Enable or Disable Dimmer range 255 slider control uint32_t ex_tuya_dimmer_range_255 : 1; // bit 16 (v6.6.0.1) - SetOption66 - Enable or Disable Dimmer range 255 slider control
uint32_t buzzer_enable : 1; // bit 17 (v6.6.0.1) - SetOption67 - Enable buzzer when available uint32_t buzzer_enable : 1; // bit 17 (v6.6.0.1) - SetOption67 - Enable buzzer when available
uint32_t pwm_multi_channels : 1; // bit 18 (v6.6.0.3) - SetOption68 - Enable multi-channels PWM instead of Color PWM uint32_t pwm_multi_channels : 1; // bit 18 (v6.6.0.3) - SetOption68 - Enable multi-channels PWM instead of Color PWM

View File

@ -366,6 +366,8 @@ void SettingsSaveAll(void)
void UpdateQuickPowerCycle(bool update) void UpdateQuickPowerCycle(bool update)
{ {
if (Settings.flag3.fast_power_cycle_disable) { return; }
uint32_t pc_register; uint32_t pc_register;
uint32_t pc_location = SETTINGS_LOCATION - CFG_ROTATES; uint32_t pc_location = SETTINGS_LOCATION - CFG_ROTATES;
@ -378,7 +380,7 @@ void UpdateQuickPowerCycle(bool update)
} else { } else {
pc_register = 0xFFA55AB0 | counter; pc_register = 0xFFA55AB0 | counter;
ESP.flashWrite(pc_location * SPI_FLASH_SEC_SIZE, (uint32*)&pc_register, sizeof(pc_register)); ESP.flashWrite(pc_location * SPI_FLASH_SEC_SIZE, (uint32*)&pc_register, sizeof(pc_register));
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("QPC: Flag %02X"), counter); // Won't show as too early in power on sequence AddLog_P2(LOG_LEVEL_DEBUG, PSTR("QPC: Flag %02X"), counter);
} }
} }
else if (pc_register != 0xFFA55ABF) { else if (pc_register != 0xFFA55ABF) {
@ -386,7 +388,7 @@ void UpdateQuickPowerCycle(bool update)
// Assume flash is default all ones and setting a bit to zero does not need an erase // Assume flash is default all ones and setting a bit to zero does not need an erase
ESP.flashEraseSector(pc_location); ESP.flashEraseSector(pc_location);
ESP.flashWrite(pc_location * SPI_FLASH_SEC_SIZE, (uint32*)&pc_register, sizeof(pc_register)); ESP.flashWrite(pc_location * SPI_FLASH_SEC_SIZE, (uint32*)&pc_register, sizeof(pc_register));
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("QPC: Reset")); // Won't show as too early in power on sequence AddLog_P2(LOG_LEVEL_DEBUG, PSTR("QPC: Reset"));
} }
} }
@ -1137,11 +1139,11 @@ void SettingsDelta(void)
if (Settings.version < 0x0606000A) { if (Settings.version < 0x0606000A) {
uint8_t tuyaindex = 0; uint8_t tuyaindex = 0;
if (Settings.param[P_BACKLOG_DELAY] > 0) { // ex SetOption34 if (Settings.param[P_BACKLOG_DELAY] > 0) { // ex SetOption34
Settings.tuya_fnid_map[tuyaindex].fnid = 21; // TUYA_MCU_FUNC_DIMMER - Move Tuya Dimmer Id to Map Settings.tuya_fnid_map[tuyaindex].fnid = 21; // TUYA_MCU_FUNC_DIMMER - Move Tuya Dimmer Id to Map
Settings.tuya_fnid_map[tuyaindex].dpid = Settings.param[P_BACKLOG_DELAY]; Settings.tuya_fnid_map[tuyaindex].dpid = Settings.param[P_BACKLOG_DELAY];
tuyaindex++; tuyaindex++;
} else if (Settings.flag3.ex_tuya_disable_dimmer == 1) { // ex SetOption65 } else if (Settings.flag3.fast_power_cycle_disable == 1) { // ex SetOption65
Settings.tuya_fnid_map[tuyaindex].fnid = 11; // TUYA_MCU_FUNC_REL1 - Create FnID for Switches Settings.tuya_fnid_map[tuyaindex].fnid = 11; // TUYA_MCU_FUNC_REL1 - Create FnID for Switches
Settings.tuya_fnid_map[tuyaindex].dpid = 1; Settings.tuya_fnid_map[tuyaindex].dpid = 1;
tuyaindex++; tuyaindex++;
@ -1195,6 +1197,20 @@ void SettingsDelta(void)
Settings.dimmer_hw_max = Settings.param[P_ex_DIMMER_MAX]; Settings.dimmer_hw_max = Settings.param[P_ex_DIMMER_MAX];
} }
} }
if (Settings.version < 0x06060014) {
// Clear unused parameters for future use
Settings.flag3.ex_tuya_dimmer_range_255 = 0;
Settings.flag3.ex_tuya_dimmer_min_limit = 0;
Settings.param[P_ex_TUYA_RELAYS] = 0;
Settings.param[P_ex_DIMMER_MAX] = 0;
Settings.param[P_ex_TUYA_VOLTAGE_ID] = 0;
Settings.param[P_ex_TUYA_CURRENT_ID] = 0;
Settings.param[P_ex_TUYA_POWER_ID] = 0;
Settings.ex_baudrate = 0;
Settings.ex_sbaudrate = 0;
Settings.flag3.fast_power_cycle_disable = 0;
}
Settings.version = VERSION; Settings.version = VERSION;
SettingsSave(1); SettingsSave(1);

View File

@ -1472,7 +1472,6 @@ void setup(void)
RtcRebootLoad(); RtcRebootLoad();
if (!RtcRebootValid()) { if (!RtcRebootValid()) {
RtcReboot.fast_reboot_count = 0; RtcReboot.fast_reboot_count = 0;
UpdateQuickPowerCycle(true); // As RTC is invalid it must be a power cycle
} }
RtcReboot.fast_reboot_count++; RtcReboot.fast_reboot_count++;
RtcRebootSave(); RtcRebootSave();
@ -1497,6 +1496,7 @@ void setup(void)
GetFeatures(); GetFeatures();
if (1 == RtcReboot.fast_reboot_count) { // Allow setting override only when all is well if (1 == RtcReboot.fast_reboot_count) { // Allow setting override only when all is well
UpdateQuickPowerCycle(true);
XdrvCall(FUNC_SETTINGS_OVERRIDE); XdrvCall(FUNC_SETTINGS_OVERRIDE);
} }
@ -1547,8 +1547,6 @@ void setup(void)
} }
} }
// UpdateQuickPowerCycle(true); // Test location
Format(mqtt_client, Settings.mqtt_client, sizeof(mqtt_client)); Format(mqtt_client, Settings.mqtt_client, sizeof(mqtt_client));
Format(mqtt_topic, Settings.mqtt_topic, sizeof(mqtt_topic)); Format(mqtt_topic, Settings.mqtt_topic, sizeof(mqtt_topic));
if (strstr(Settings.hostname, "%") != nullptr) { if (strstr(Settings.hostname, "%") != nullptr) {

View File

@ -20,6 +20,6 @@
#ifndef _SONOFF_VERSION_H_ #ifndef _SONOFF_VERSION_H_
#define _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_
const uint32_t VERSION = 0x06060013; const uint32_t VERSION = 0x06060014;
#endif // _SONOFF_VERSION_H_ #endif // _SONOFF_VERSION_H_

View File

@ -1685,8 +1685,8 @@ void LightAnimate(void)
for (uint32_t i = 0; i < 3; i++) { for (uint32_t i = 0; i < 3; i++) {
scale_col[i] = (0 == max) ? 255 : (255 > max) ? changeUIntScale(cur_col[i], 0, max, 0, 255) : cur_col[i]; scale_col[i] = (0 == max) ? 255 : (255 > max) ? changeUIntScale(cur_col[i], 0, max, 0, 255) : cur_col[i];
} }
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("LGT: R%d(%d) G%d(%d) B%d(%d), C%d W%d, D%d"), // AddLog_P2(LOG_LEVEL_DEBUG, PSTR("LGT: R%d(%d) G%d(%d) B%d(%d), C%d W%d, D%d"),
cur_col[0], scale_col[0], cur_col[1], scale_col[1], cur_col[2], scale_col[2], cur_col[3], cur_col[4], light_state.getDimmer()); // cur_col[0], scale_col[0], cur_col[1], scale_col[1], cur_col[2], scale_col[2], cur_col[3], cur_col[4], light_state.getDimmer());
char *tmp_data = XdrvMailbox.data; char *tmp_data = XdrvMailbox.data;
char *tmp_topic = XdrvMailbox.topic; char *tmp_topic = XdrvMailbox.topic;

View File

@ -95,7 +95,7 @@ a_setoption = [[
"Ignore hold time (s)", "Ignore hold time (s)",
"(not used) Number of Tuya MCU relays", "(not used) Number of Tuya MCU relays",
"Over temperature threshold (celsius)", "Over temperature threshold (celsius)",
"Tuya MCU max dimmer value", "(not used) Tuya MCU max dimmer value",
"(not used) Tuya MCU voltage Id", "(not used) Tuya MCU voltage Id",
"(not used) Tuya MCU current Id", "(not used) Tuya MCU current Id",
"(not used) Tuya MCU power Id", "(not used) Tuya MCU power Id",
@ -118,11 +118,11 @@ a_setoption = [[
"Do not use retain flag on HOLD messages", "Do not use retain flag on HOLD messages",
"Do not scan relay power state at restart", "Do not scan relay power state at restart",
"Use _ instead of - as sensor index separator", "Use _ instead of - as sensor index separator",
"(not used) Disable Dimmer slider control", "Disable fast power cycle detection for device reset",
"Disable Dimmer range 255 slider control", "(not used) Disable Dimmer range 255 slider control",
"Enable buzzer when available", "Enable buzzer when available",
"Enable multi-channels PWM instead of Color PWM", "Enable multi-channels PWM instead of Color PWM",
"Limits Tuya MCU dimmers to minimum of 10% (25) when enabled", "(not used) Limits Tuya MCU dimmers to minimum of 10% (25) when enabled",
"Enable Weekend Energy Tariff", "Enable Weekend Energy Tariff",
"Select different Modbus registers for Active Energy", "Select different Modbus registers for Active Energy",
"","", "","",