Tuya: Rename tuya_show_dimmer to tuya_disable_dimmer to make the option clear.

By default the option is set to 0 in which case the tuya serial will act as dimmer
When its set to 1 tuya serial will disable dimmer functions.
This commit is contained in:
Shantur Rathore 2019-08-22 13:46:42 +01:00
parent 1da6cd0ae0
commit 1c7fd88ec4
3 changed files with 5 additions and 5 deletions

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 tuya_show_dimmer : 1; // bit 15 (v6.5.0.15) - SetOption65 - Enable or Disable Dimmer slider control uint32_t tuya_disable_dimmer : 1; // bit 15 (v6.5.0.15) - SetOption65 - Enable or Disable Tuya Serial Dimmer control
uint32_t tuya_dimmer_range_255 : 1; // bit 16 (v6.6.0.1) - SetOption66 - Enable or Disable Dimmer range 255 slider control uint32_t 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

@ -942,7 +942,7 @@ void HandleRoot(void)
if ((LST_COLDWARM == (light_type &7)) || (LST_RGBWC == (light_type &7))) { if ((LST_COLDWARM == (light_type &7)) || (LST_RGBWC == (light_type &7))) {
WSContentSend_P(HTTP_MSG_SLIDER1, LightGetColorTemp()); WSContentSend_P(HTTP_MSG_SLIDER1, LightGetColorTemp());
} }
if (!Settings.flag3.tuya_show_dimmer) { if (!Settings.flag3.tuya_disable_dimmer) {
WSContentSend_P(HTTP_MSG_SLIDER2, Settings.light_dimmer); WSContentSend_P(HTTP_MSG_SLIDER2, Settings.light_dimmer);
} }
} }

View File

@ -149,7 +149,7 @@ void LightSerialDuty(uint8_t duty)
if (duty < 25) { duty = 25; } // dimming acts odd below 25(10%) - this mirrors the threshold set on the faceplate itself if (duty < 25) { duty = 25; } // dimming acts odd below 25(10%) - this mirrors the threshold set on the faceplate itself
} }
if (Settings.flag3.tuya_show_dimmer == 0) { if (Settings.flag3.tuya_disable_dimmer == 0) {
if(Settings.flag3.tuya_dimmer_range_255 == 0) { if(Settings.flag3.tuya_dimmer_range_255 == 0) {
duty = changeUIntScale(duty, 0, 255, 0, 100); duty = changeUIntScale(duty, 0, 255, 0, 100);
} }
@ -160,7 +160,7 @@ void LightSerialDuty(uint8_t duty)
} }
} else { } else {
Tuya.ignore_dim = false; // reset flag Tuya.ignore_dim = false; // reset flag
if (Settings.flag3.tuya_show_dimmer == 0) { if (Settings.flag3.tuya_disable_dimmer == 0) {
if(Settings.flag3.tuya_dimmer_range_255 == 0) { if(Settings.flag3.tuya_dimmer_range_255 == 0) {
duty = changeUIntScale(duty, 0, 255, 0, 100); duty = changeUIntScale(duty, 0, 255, 0, 100);
} }
@ -216,7 +216,7 @@ void TuyaPacketProcess(void)
else if (Tuya.buffer[5] == 8) { // dim packet else if (Tuya.buffer[5] == 8) { // dim packet
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: RX Dim State=%d"), Tuya.buffer[13]); AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: RX Dim State=%d"), Tuya.buffer[13]);
if (Settings.flag3.tuya_show_dimmer == 0) { if (Settings.flag3.tuya_disable_dimmer == 0) {
if (!Settings.param[P_TUYA_DIMMER_ID]) { if (!Settings.param[P_TUYA_DIMMER_ID]) {
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: Autoconfiguring Dimmer ID %d"), Tuya.buffer[6]); AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: Autoconfiguring Dimmer ID %d"), Tuya.buffer[6]);
Settings.param[P_TUYA_DIMMER_ID] = Tuya.buffer[6]; Settings.param[P_TUYA_DIMMER_ID] = Tuya.buffer[6];