mirror of
https://github.com/arendst/Tasmota.git
synced 2025-08-06 09:27:41 +00:00
Updated the code based on the feedback
* Updated xdrv_01_webserver.ino to show dimmer slider2 by default for Tuya Dimmer Module * Updated xdrv_16_tuyadimmer.ino remove the use of XdrvMailbox and removed the pow functions now the size for 6.5.0 build is 510kb * updated sonoff.ino to hold current device id
This commit is contained in:
parent
fce9ae6762
commit
6b013144ab
@ -1,8 +1,15 @@
|
|||||||
/* 6.5.0.12 20190517
|
/*
|
||||||
|
* 6.5.0.13 20190518
|
||||||
|
* Updated xdrv_01_webserver.ino to show dimmer slider2 by default for Tuya Dimmer Module optionally disabled for non dimmers
|
||||||
|
* Updated xdrv_16_tuyadimmer.ino remove the use of XdrvMailbox and removed the pow functions
|
||||||
|
* updated sonoff.ino to hold current device id
|
||||||
|
*
|
||||||
|
* 6.5.0.12 20190517
|
||||||
* Add command SetOption65 (tuya_show_dimmer) to enable or disable dimmer Slider ( for 4 Gang Tuya switch)
|
* Add command SetOption65 (tuya_show_dimmer) to enable or disable dimmer Slider ( for 4 Gang Tuya switch)
|
||||||
* Added Seeting.pram9 to define no of Tuya MCU devices
|
* Added Seeting.pram9 to define no of Tuya MCU devices
|
||||||
* Updated xdrv_01_webserver.ino to check for the tuya_show_dimmer option to display slider2
|
* Updated xdrv_01_webserver.ino to check for the tuya_show_dimmer option to display slider2
|
||||||
* Updated xdrv_16_tuyadimmer.ino create bool serial packet based on the Device Id and set the power status based on the Device id from MCU packet
|
* Updated xdrv_16_tuyadimmer.ino create bool serial packet based on the Device Id and set the power status based on the Device id from MCU packet
|
||||||
|
*
|
||||||
* 6.5.0.11 20190517
|
* 6.5.0.11 20190517
|
||||||
* Add command SetOption64 0/1 to switch between "-" or "_" as sensor index separator impacting DS18X20, DHT, BMP and SHT3X sensor names (#5689)
|
* Add command SetOption64 0/1 to switch between "-" or "_" as sensor index separator impacting DS18X20, DHT, BMP and SHT3X sensor names (#5689)
|
||||||
*
|
*
|
||||||
|
@ -109,6 +109,7 @@ unsigned long pulse_timer[MAX_PULSETIMERS] = { 0 }; // Power off timer
|
|||||||
unsigned long blink_timer = 0; // Power cycle timer
|
unsigned long blink_timer = 0; // Power cycle timer
|
||||||
unsigned long backlog_delay = 0; // Command backlog delay
|
unsigned long backlog_delay = 0; // Command backlog delay
|
||||||
power_t power = 0; // Current copy of Settings.power
|
power_t power = 0; // Current copy of Settings.power
|
||||||
|
power_t deviceid = 1; // hold current deviceid
|
||||||
power_t blink_power; // Blink power state
|
power_t blink_power; // Blink power state
|
||||||
power_t blink_mask = 0; // Blink relay active mask
|
power_t blink_mask = 0; // Blink relay active mask
|
||||||
power_t blink_powersave; // Blink start power save state
|
power_t blink_powersave; // Blink start power save state
|
||||||
@ -1535,7 +1536,7 @@ void ExecuteCommandPower(uint8_t device, uint8_t state, int source)
|
|||||||
|
|
||||||
// ShowSource(source);
|
// ShowSource(source);
|
||||||
|
|
||||||
XdrvMailbox.notused = device;
|
deviceid = device;
|
||||||
|
|
||||||
if (SONOFF_IFAN02 == my_module_type) {
|
if (SONOFF_IFAN02 == my_module_type) {
|
||||||
blink_mask &= 1; // No blinking on the fan relays
|
blink_mask &= 1; // No blinking on the fan relays
|
||||||
|
@ -890,7 +890,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 == 1)
|
if(Settings.flag3.tuya_show_dimmer == 0)
|
||||||
{
|
{
|
||||||
WSContentSend_P(HTTP_MSG_SLIDER2, Settings.light_dimmer);
|
WSContentSend_P(HTTP_MSG_SLIDER2, Settings.light_dimmer);
|
||||||
}
|
}
|
||||||
|
@ -123,26 +123,23 @@ bool TuyaSetPower(void)
|
|||||||
int16_t source = XdrvMailbox.payload;
|
int16_t source = XdrvMailbox.payload;
|
||||||
|
|
||||||
if (source != SRC_SWITCH && TuyaSerial) { // ignore to prevent loop from pushing state from faceplate interaction
|
if (source != SRC_SWITCH && TuyaSerial) { // ignore to prevent loop from pushing state from faceplate interaction
|
||||||
boolean Bin[] = {0,0,0,0};
|
TuyaSendBool(deviceid, TuyaGetPower(rpower, deviceid));
|
||||||
convertDecToBin(rpower, Bin);
|
|
||||||
TuyaSendBool(XdrvMailbox.notused, Bin[XdrvMailbox.notused-1]);
|
|
||||||
|
|
||||||
status = true;
|
status = true;
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void convertDecToBin(int Dec, boolean Bin[]) {
|
uint8_t TuyaGetPower(uint8_t p, uint8_t d) {
|
||||||
for(int i = 3 ; i >= 0 ; i--) {
|
uint8_t g = 0;
|
||||||
if(pow(2, i)<=Dec) {
|
for(int i = 7 ; i >= 0 ; i--) {
|
||||||
Dec = Dec - pow(2, i);
|
g = p >> i;
|
||||||
Bin[(i)] = 1;
|
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: --SetDevicePower3-- for Device = %d, Power=%d"),i, k&1);
|
||||||
} else {
|
if (i== d-1)
|
||||||
|
{
|
||||||
|
return g&1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TuyaSetChannels(void)
|
bool TuyaSetChannels(void)
|
||||||
{
|
{
|
||||||
LightSerialDuty(((uint8_t*)XdrvMailbox.data)[0]);
|
LightSerialDuty(((uint8_t*)XdrvMailbox.data)[0]);
|
||||||
@ -157,7 +154,7 @@ void LightSerialDuty(uint8_t duty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(Settings.flag3.tuya_show_dimmer == 1) // no Dimmer for 4 relay
|
if(Settings.flag3.tuya_show_dimmer == 0)
|
||||||
{
|
{
|
||||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR( "TYA: Send Serial Packet Dim Value=%d (id=%d)"), duty, Settings.param[P_TUYA_DIMMER_ID]);
|
AddLog_P2(LOG_LEVEL_DEBUG, PSTR( "TYA: Send Serial Packet Dim Value=%d (id=%d)"), duty, Settings.param[P_TUYA_DIMMER_ID]);
|
||||||
TuyaSendValue(Settings.param[P_TUYA_DIMMER_ID], duty);
|
TuyaSendValue(Settings.param[P_TUYA_DIMMER_ID], duty);
|
||||||
@ -165,7 +162,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 == 1) // no Dimmer for 4 relay
|
if(Settings.flag3.tuya_show_dimmer == 0)
|
||||||
{
|
{
|
||||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR( "TYA: Send Dim Level skipped due to 0 or already set. Value=%d"), duty);
|
AddLog_P2(LOG_LEVEL_DEBUG, PSTR( "TYA: Send Dim Level skipped due to 0 or already set. Value=%d"), duty);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user