Repair SHUTTER Shelly 2.5 with manual relay change on switches (#18877)

* Repair manual relay change

* Repair manual relay change
This commit is contained in:
stefanbode 2023-06-14 16:14:10 +02:00 committed by GitHub
parent bbd6fa7202
commit 156a3551b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -1128,14 +1128,14 @@ void ShutterRelayChanged(void)
case SHT_COUNTER:
case SHT_PWM_VALUE:
case SHT_PWM_TIME:
ShutterPowerOff(i);
case SHT_TIME: {
ShutterPowerOff(i);
// powerstate_local == 0 => direction=0, stop
// powerstate_local == 1 => direction=1, target=Shutter[i].open_max
// powerstate_local == 2 => direction=-1, target=0 // only happen on SHT_TIME
// powerstate_local == 3 => direction=-1, target=0 // only happen if NOT SHT_TIME
int8_t direction = (powerstate_local == 0) ? 0 : (powerstate_local == 1) ? 1 : -1;
int8_t target = (powerstate_local == 1) ? Shutter[i].open_max : 0;
int32_t target = (powerstate_local == 1) ? Shutter[i].open_max : 0;
if (direction != 0) {
ShutterStartInit(i, direction, target);

View File

@ -893,14 +893,14 @@ void ShutterRelayChanged(void)
case SHT_COUNTER:
case SHT_PWM_VALUE:
case SHT_PWM_TIME:
ShutterPowerOff(i);
case SHT_TIME: {
ShutterPowerOff(i);
// powerstate_local == 0 => direction=0, stop
// powerstate_local == 1 => direction=1, target=Shutter[i].open_max
// powerstate_local == 2 => direction=-1, target=0 // only happen on SHT_TIME
// powerstate_local == 3 => direction=-1, target=0 // only happen if NOT SHT_TIME
int8_t direction = (powerstate_local == 0) ? 0 : (powerstate_local == 1) ? 1 : -1;
int8_t target = (powerstate_local == 1) ? Shutter[i].open_max : 0;
int32_t target = (powerstate_local == 1) ? Shutter[i].open_max : 0;
if (direction != 0) {
ShutterStartInit(i, direction, target);