Merge pull request #14806 from stefanbode/patch-5

Fix shutter-stepper driver if >1 door moving
This commit is contained in:
Theo Arends 2022-02-12 10:24:03 +01:00 committed by GitHub
commit 804c4747eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -175,8 +175,16 @@ void ShutterRtc50mS(void)
if (Shutter[i].accelerator) {
//AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Accelerator i=%d -> %d"),i, Shutter[i].accelerator);
ShutterUpdateVelocity(i);
digitalWrite(Pin(GPIO_PWM1, i), LOW);
#ifdef ESP8266
// Convert frequency into clock cycles
uint32_t cc = microsecondsToClockCycles(1000000UL) / Shutter[i].pwm_velocity;
startWaveformClockCycles(Pin(GPIO_PWM1, i), cc/2, cc/2, 0, -1, 0, false);
#endif // ESP8266
#ifdef ESP32
analogWriteFreq(Shutter[i].pwm_velocity);
analogWrite(Pin(GPIO_PWM1, i), 50);
#endif // ESP32
}
break;
}