mirror of https://github.com/arendst/Tasmota.git
introduce new api-call for dimmer-devices
This commit is contained in:
parent
a76ae557f0
commit
b2005fba40
|
@ -245,7 +245,7 @@ enum XsnsFunctions {FUNC_SETTINGS_OVERRIDE, FUNC_MODULE_INIT, FUNC_PRE_INIT, FUN
|
|||
FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA,
|
||||
FUNC_SET_POWER, FUNC_SET_DEVICE_POWER, FUNC_SHOW_SENSOR,
|
||||
FUNC_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM, FUNC_BUTTON_PRESSED,
|
||||
FUNC_WEB_ADD_BUTTON, FUNC_WEB_ADD_MAIN_BUTTON, FUNC_WEB_ADD_HANDLER};
|
||||
FUNC_WEB_ADD_BUTTON, FUNC_WEB_ADD_MAIN_BUTTON, FUNC_WEB_ADD_HANDLER, FUNC_SET_CHANNELS};
|
||||
|
||||
enum CommandSource { SRC_IGNORE, SRC_MQTT, SRC_RESTART, SRC_BUTTON, SRC_SWITCH, SRC_BACKLOG, SRC_SERIAL, SRC_WEBGUI, SRC_WEBCOMMAND, SRC_WEBCONSOLE, SRC_PULSETIMER,
|
||||
SRC_TIMER, SRC_RULE, SRC_MAXPOWER, SRC_MAXENERGY, SRC_LIGHT, SRC_KNX, SRC_DISPLAY, SRC_WEMO, SRC_HUE, SRC_RETRY, SRC_MAX };
|
||||
|
|
|
@ -828,30 +828,20 @@ void LightAnimate(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
XdrvMailbox.index = light_device;
|
||||
XdrvMailbox.data = (char*)cur_col;
|
||||
XdrvMailbox.data_len = sizeof(cur_col);
|
||||
if (XdrvCall(FUNC_SET_CHANNELS)) {
|
||||
// Serviced
|
||||
}
|
||||
#ifdef USE_WS2812 // ************************************************************************
|
||||
if (LT_WS2812 == light_type) {
|
||||
else if (LT_WS2812 == light_type) {
|
||||
Ws2812SetColor(0, cur_col[0], cur_col[1], cur_col[2], cur_col[3]);
|
||||
}
|
||||
#endif // USE_ES2812 ************************************************************************
|
||||
if (light_type > LT_WS2812) {
|
||||
else if (light_type > LT_WS2812) {
|
||||
LightMy92x1Duty(cur_col[0], cur_col[1], cur_col[2], cur_col[3], cur_col[4]);
|
||||
}
|
||||
#ifdef USE_TUYA_DIMMER
|
||||
if (light_type == LT_SERIAL1 && Settings.module == TUYA_DIMMER ) {
|
||||
LightSerialDuty(cur_col[0]);
|
||||
}
|
||||
#endif // USE_TUYA_DIMMER
|
||||
#ifdef USE_ARMTRONIX_DIMMERS
|
||||
if (light_type == LT_SERIAL2) {
|
||||
LightSerial2Duty(cur_col[0],cur_col[1]);
|
||||
}
|
||||
#endif // USE_ARMTRONIX_DIMMERS
|
||||
#ifdef USE_PS_16_DZ
|
||||
if (light_type == LT_SERIAL1 && Settings.module == PS_16_DZ) {
|
||||
PS16DZSerialDuty(cur_col[0]);
|
||||
}
|
||||
#endif // USE_PS_16_DZ
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,6 +133,12 @@ boolean TuyaSetPower(void)
|
|||
return status;
|
||||
}
|
||||
|
||||
boolean TuyaSetChannels(void)
|
||||
{
|
||||
LightSerialDuty(((uint8_t*)XdrvMailbox.data)[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
void LightSerialDuty(uint8_t duty)
|
||||
{
|
||||
if (duty > 0 && !tuya_ignore_dim && TuyaSerial) {
|
||||
|
@ -416,6 +422,9 @@ boolean Xdrv16(byte function)
|
|||
case FUNC_EVERY_SECOND:
|
||||
if(TuyaSerial && tuya_wifi_state!=WifiState()) { TuyaSetWifiLed(); }
|
||||
break;
|
||||
case FUNC_SET_CHANNELS:
|
||||
result = TuyaSetChannels();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -40,6 +40,12 @@ int8_t armtronix_knobState[2]; // Dimmer state values.
|
|||
* Internal Functions
|
||||
\*********************************************************************************************/
|
||||
|
||||
boolean ArmtronixSetChannels(void)
|
||||
{
|
||||
LightSerial2Duty(((uint8_t*)XdrvMailbox.data)[0], ((uint8_t*)XdrvMailbox.data)[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
void LightSerial2Duty(uint8_t duty1, uint8_t duty2)
|
||||
{
|
||||
if (ArmtronixSerial && !armtronix_ignore_dim) {
|
||||
|
@ -186,6 +192,9 @@ boolean Xdrv18(byte function)
|
|||
}
|
||||
}
|
||||
break;
|
||||
case FUNC_SET_CHANNELS:
|
||||
result = ArmtronixSetChannels();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -91,6 +91,12 @@ boolean PS16DZSetPower(void)
|
|||
return status;
|
||||
}
|
||||
|
||||
boolean PS16DZSetChannels(void)
|
||||
{
|
||||
PS16DZSerialDuty(((uint8_t*)XdrvMailbox.data)[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
void PS16DZSerialDuty(uint8_t duty)
|
||||
{
|
||||
if (duty > 0 && !ps16dz_ignore_dim && PS16DZSerial) {
|
||||
|
@ -236,6 +242,9 @@ boolean Xdrv19(byte function)
|
|||
case FUNC_SET_DEVICE_POWER:
|
||||
result = PS16DZSetPower();
|
||||
break;
|
||||
case FUNC_SET_CHANNELS:
|
||||
result = PS16DZSetChannels();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue