diff --git a/tasmota/xdrv_27_shutter.ino b/tasmota/xdrv_27_shutter.ino index 22cee4fe0..157ed7fca 100644 --- a/tasmota/xdrv_27_shutter.ino +++ b/tasmota/xdrv_27_shutter.ino @@ -206,7 +206,7 @@ void ShutterInit(void) Shutter.pwm_frequency[i] = 0; Shutter.accelerator[i] = 0; analogWriteFreq(Shutter.pwm_frequency[i]); - analogWrite(Pin(GPIO_PWM1, i), 50); + ExecuteCommandPower(Settings.shutter_startrelay[i]+2, 0, SRC_SHUTTER); } } @@ -358,13 +358,14 @@ void ShutterUpdatePosition(void) Shutter.accelerator[i] = 0; Shutter.pwm_frequency[i] = Shutter.pwm_frequency[i] > 250 ? 250 : Shutter.pwm_frequency[i]; analogWriteFreq(Shutter.pwm_frequency[i]); - analogWrite(Pin(GPIO_PWM1, i), 50); + analogWrite(Pin(GPIO_PWM1, i), 1); Shutter.pwm_frequency[i] = 0; analogWriteFreq(Shutter.pwm_frequency[i]); while (RtcSettings.pulse_counter[i] < (uint32_t)(Shutter.target_position[i]-Shutter.start_position[i])*Shutter.direction[i]*Shutter.max_pwm_frequency/2000) { delay(1); } - analogWrite(Pin(GPIO_PWM1, i), 0); + //analogWrite(Pin(GPIO_PWM1, i), 0); // removed with 8. because of reset + ExecuteCommandPower(Settings.shutter_startrelay[i]+2, 0, SRC_SHUTTER); Shutter.real_position[i] = ShutterCounterBasedPosition(i); AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: Real %d, pulsecount %d, start %d"), Shutter.real_position[i],RtcSettings.pulse_counter[i], Shutter.start_position[i]); @@ -428,6 +429,7 @@ void ShutterStartInit(uint32_t i, int32_t direction, int32_t target_pos) Shutter.pwm_frequency[i] = 0; analogWriteFreq(Shutter.pwm_frequency[i]); analogWrite(Pin(GPIO_PWM1, i), 0); + //ExecuteCommandPower(Settings.shutter_startrelay[i]+2, 1, SRC_SHUTTER); RtcSettings.pulse_counter[i] = 0; Shutter.accelerator[i] = Shutter.max_pwm_frequency / (Shutter.motordelay[i]>0 ? Shutter.motordelay[i] : 1); AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: Ramp up: %d"), Shutter.accelerator[i]); @@ -460,6 +462,7 @@ void ShutterWaitForMotorStop(uint32_t i) delay(50); } analogWrite(Pin(GPIO_PWM1, i), 0); + ExecuteCommandPower(Settings.shutter_startrelay[i]+2, 0, SRC_SHUTTER); Shutter.real_position[i] = ShutterCounterBasedPosition(i); } else { ExecuteCommandPower(Settings.shutter_startrelay[i], 0, SRC_SHUTTER); @@ -902,6 +905,9 @@ void CmndShutterPosition(void) ExecuteCommandPower(Settings.shutter_startrelay[index] +1, new_shutterdirection == 1 ? 0 : 1, SRC_SHUTTER); // power on ExecuteCommandPower(Settings.shutter_startrelay[index], 1, SRC_SHUTTER); + if (SHT_OFF_ON__OPEN_CLOSE_STEPPER == Shutter.mode) { + ExecuteCommandPower(Settings.shutter_startrelay[index]+2, 1, SRC_SHUTTER); + } } } else { // now start the motor for the right direction, work for momentary and normal shutters.