add tuya_allow_dimmer_0 (SetOption131)

This commit is contained in:
Tedrick DUFOUR 2021-11-29 19:27:09 +01:00
parent 990065df69
commit 0f08b4cbca
4 changed files with 5 additions and 2 deletions

View File

@ -337,6 +337,7 @@
#define RF_DATA_RADIX false // [SetOption28] RF receive data format (false = hexadecimal, true = decimal)
#define IR_DATA_RADIX false // [SetOption29] IR receive data format (false = hexadecimal, true = decimal)
#define TUYA_SETOPTION_20 false // [SetOption54] Apply SetOption20 settings to Tuya device
#define TUYA_ALLOW_DIMMER_0 false // [SetOption131] Allow save dimmer = 0 receved by MCU
#define TUYA_TEMP_SET_RES 1 // [TuyaTempSetRes] Maximum number of decimals (0 - 3) showing sensor TemperatureSet
#define IR_ADD_RAW_DATA false // [SetOption58] Add IR Raw data to JSON message
#define BUZZER_ENABLE false // [SetOption67] Enable buzzer when available

View File

@ -160,7 +160,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t disable_referer_chk : 1; // bit 14 (v9.5.0.5) - SetOption128 - (Web) Allow access without referer check
uint32_t energy_phase : 1; // bit 15 (v9.5.0.9) - SetOption129 - (Energy) Show phase information
uint32_t show_heap_with_timestamp : 1; // bit 16 (v9.5.0.9) - SetOption130 - (Debug) Show heap with logging timestamp
uint32_t spare17 : 1; // bit 17
uint32_t tuya_allow_dimmer_0 : 1; // bit 17 (v10.0.0.3) - SetOption131 - (Tuya) Allow save dimmer = 0 receved by MCU
uint32_t spare18 : 1; // bit 18
uint32_t spare19 : 1; // bit 19
uint32_t spare20 : 1; // bit 20

View File

@ -1182,6 +1182,7 @@ void SettingsDefaultSet2(void) {
// Tuya
flag3.tuya_apply_o20 |= TUYA_SETOPTION_20;
flag5.tuya_allow_dimmer_0 |= TUYA_ALLOW_DIMMER_0;
flag3.tuya_serial_mqtt_publish |= MQTT_TUYA_RECEIVED;
mbflag2.temperature_set_res |= TUYA_TEMP_SET_RES;

View File

@ -842,7 +842,8 @@ void TuyaProcessStatePacket(void) {
(fnId == TUYA_MCU_FUNC_CT) || (fnId == TUYA_MCU_FUNC_WHITE)) {
if (Tuya.ignore_dimmer_cmd_timeout < millis()) {
if ((TasmotaGlobal.power || Settings->flag3.tuya_apply_o20) && ((Tuya.Levels[dimIndex] > 0) && (Tuya.Levels[dimIndex] != Tuya.Snapshot[dimIndex]))) { // SetOption54 - Apply SetOption20 settings to Tuya device
//if ((TasmotaGlobal.power || Settings->flag3.tuya_apply_o20) && ((Tuya.Levels[dimIndex] > 0) && (Tuya.Levels[dimIndex] != Tuya.Snapshot[dimIndex]))) { // SetOption54 - Apply SetOption20 settings to Tuya device
if ((TasmotaGlobal.power || Settings->flag3.tuya_apply_o20) && ((Tuya.Levels[dimIndex] > 0 || Settings->flag5.tuya_allow_dimmer_0) && (Tuya.Levels[dimIndex] != Tuya.Snapshot[dimIndex]))) { // SetOption54 - Apply SetOption20 settings to Tuya device
Tuya.ignore_dim = true;
TasmotaGlobal.skip_light_fade = true;