mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-26 04:06:34 +00:00
Fix: update position for all shutter types
This commit is contained in:
parent
4b816864a1
commit
2b1a9845d7
@ -296,16 +296,16 @@ void ShutterUpdatePosition(void)
|
|||||||
for (uint32_t i = 0; i < shutters_present; i++) {
|
for (uint32_t i = 0; i < shutters_present; i++) {
|
||||||
if (Shutter.direction[i] != 0) {
|
if (Shutter.direction[i] != 0) {
|
||||||
int32_t stop_position_delta = 20;
|
int32_t stop_position_delta = 20;
|
||||||
if (Shutter.mode == SHT_OFF_ON__OPEN_CLOSE_STEPPER) {
|
// Calculate position with counter. Much more accurate and no need for motordelay workaround
|
||||||
// Calculate position with counter. Much more accurate and no need for motordelay workaround
|
// adding some steps to stop early
|
||||||
// adding some steps to stop early
|
Shutter.real_position[i] = ShutterCounterBasedPosition(i);
|
||||||
Shutter.real_position[i] = ShutterCounterBasedPosition(i);
|
if (!Shutter.start_reported) {
|
||||||
if (!Shutter.start_reported) {
|
ShutterReportPosition(true);
|
||||||
ShutterReportPosition(true);
|
XdrvRulesProcess();
|
||||||
XdrvRulesProcess();
|
Shutter.start_reported = 1;
|
||||||
Shutter.start_reported = 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
if (Shutter.mode == SHT_OFF_ON__OPEN_CLOSE_STEPPER) {
|
||||||
int32_t max_frequency = Shutter.direction[i] == 1 ? Shutter.max_pwm_frequency : Shutter.max_close_pwm_frequency[i];
|
int32_t max_frequency = Shutter.direction[i] == 1 ? Shutter.max_pwm_frequency : Shutter.max_close_pwm_frequency[i];
|
||||||
int32_t max_freq_change_per_sec = Shutter.max_pwm_frequency*steps_per_second / (Shutter.motordelay[i]>0 ? Shutter.motordelay[i] : 1);
|
int32_t max_freq_change_per_sec = Shutter.max_pwm_frequency*steps_per_second / (Shutter.motordelay[i]>0 ? Shutter.motordelay[i] : 1);
|
||||||
int32_t min_runtime_ms = Shutter.pwm_frequency[i]*1000 / max_freq_change_per_sec;
|
int32_t min_runtime_ms = Shutter.pwm_frequency[i]*1000 / max_freq_change_per_sec;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user