mirror of https://github.com/arendst/Tasmota.git
Bugfix: Shutter missed stop on tilt
Fix bug where shutter continuously moves, when tilt end was not reached due to rounding effects.
This commit is contained in:
parent
1e326460bd
commit
fa06a7bcfc
|
@ -631,8 +631,12 @@ int32_t ShutterCalculatePosition(uint32_t i)
|
|||
case SHT_TIME:
|
||||
case SHT_TIME_UP_DOWN:
|
||||
case SHT_TIME_GARAGE:
|
||||
if (Shutter[i].time <= Shutter[i].venetian_delay && Shutter[i].tilt_config[2] > 0) {
|
||||
Shutter[i].tilt_real_pos = (Shutter[i].tilt_start_pos + ((Shutter[i].direction * (int16_t)Shutter[i].time * (Shutter[i].tilt_config[1]-Shutter[i].tilt_config[0])) / Shutter[i].tilt_config[2]));
|
||||
if (Shutter[i].tilt_config[2] > 0) {
|
||||
if (Shutter[i].time <= Shutter[i].venetian_delay) {
|
||||
Shutter[i].tilt_real_pos = (Shutter[i].tilt_start_pos + ((Shutter[i].direction * (int16_t)Shutter[i].time * (Shutter[i].tilt_config[1]-Shutter[i].tilt_config[0])) / Shutter[i].tilt_config[2]));
|
||||
} else {
|
||||
Shutter[i].tilt_real_pos = Shutter[i].direction == 1 ? Shutter[i].tilt_config[1] : Shutter[i].tilt_config[0];
|
||||
}
|
||||
}
|
||||
return Shutter[i].start_position + ( (Shutter[i].time - tmin(Shutter[i].venetian_delay+Shutter[i].motordelay, Shutter[i].time)) * (Shutter[i].direction > 0 ? RESOLUTION : -Shutter[i].close_velocity));
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue