Fix TuyaMcu, Armtronix and Ps16dz

Fix TuyaMcu, Armtronix and Ps16dz after Light redesign (#6599)
This commit is contained in:
Theo Arends 2019-10-09 16:55:15 +02:00
parent 1316adfdca
commit 11048137ef
5 changed files with 11 additions and 7 deletions

View File

@ -1389,14 +1389,14 @@ void GpioInit(void)
}
#endif // USE_I2C
devices_present = 1;
devices_present = 0;
light_type = LT_BASIC; // Use basic PWM control if SetOption15 = 0
if (XdrvCall(FUNC_MODULE_INIT)) {
// Serviced
}
else if (YTF_IR_BRIDGE == my_module_type) {
ClaimSerial(); // Stop serial loopback mode
// devices_present = 1;
}
else if (SONOFF_DUAL == my_module_type) {
Settings.flag.mqtt_serial = 0;
@ -1415,7 +1415,6 @@ void GpioInit(void)
}
if (!light_type) {
devices_present = 0;
for (uint32_t i = 0; i < MAX_PWMS; i++) { // Basic PWM control only
if (pin[GPIO_PWM1 +i] < 99) {
pwm_present = true;

View File

@ -1068,6 +1068,10 @@ bool LightModuleInit(void)
light_type = LT_PWM2;
}
if (light_type > LT_BASIC) {
devices_present++;
}
// post-process for lights
if (Settings.flag3.pwm_multi_channels) {
uint32_t pwm_channels = (light_type & 7) > LST_MAX ? LST_MAX : (light_type & 7);
@ -1075,7 +1079,7 @@ bool LightModuleInit(void)
devices_present += pwm_channels - 1; // add the pwm channels controls at the end
}
return (light_type > 0);
return (light_type > LT_BASIC);
}
void LightInit(void)

View File

@ -469,8 +469,6 @@ bool TuyaModuleSelected(void)
bool relaySet = false;
devices_present--;
for (uint8_t i = 0 ; i < MAX_TUYA_FUNCTIONS; i++) {
if ((Settings.tuya_fnid_map[i].fnid >= TUYA_MCU_FUNC_REL1 && Settings.tuya_fnid_map[i].fnid <= TUYA_MCU_FUNC_REL8 ) ||
(Settings.tuya_fnid_map[i].fnid >= TUYA_MCU_FUNC_REL1_INV && Settings.tuya_fnid_map[i].fnid <= TUYA_MCU_FUNC_REL8_INV )) {
@ -486,6 +484,7 @@ bool TuyaModuleSelected(void)
}
if (TuyaGetDpId(TUYA_MCU_FUNC_DIMMER) != 0) {
devices_present++;
light_type = LT_SERIAL1;
} else {
light_type = LT_BASIC;

View File

@ -86,6 +86,7 @@ void ArmtronixRequestState(void)
bool ArmtronixModuleSelected(void)
{
devices_present++;
light_type = LT_SERIAL2;
return true;
}

View File

@ -125,10 +125,11 @@ bool PS16DZModuleSelected(void)
switch (my_module_type)
{
case PS_16_DZ:
devices_present++;
light_type = LT_SERIAL1;
break;
case SONOFF_L1:
devices_present++;
light_type = LT_PWM3;
break;
}