mirror of https://github.com/arendst/Tasmota.git
Merge pull request #17267 from stefanbode/patch-3
Fix rounding error on tiltmovement
This commit is contained in:
commit
a7eaca59e6
|
@ -690,8 +690,8 @@ void ShutterStartInit(uint32_t i, int32_t direction, int32_t target_pos)
|
|||
ShutterGlobal.start_reported = 0;
|
||||
Shutter[i].tilt_real_pos = tmax(tmin(Shutter[i].tilt_real_pos,Shutter[i].tilt_config[1]),Shutter[i].tilt_config[0]);
|
||||
Shutter[i].tilt_start_pos = Shutter[i].tilt_real_pos;
|
||||
if (Shutter[i].tilt_config[1]-Shutter[i].tilt_config[0] != 0) {
|
||||
Shutter[i].venetian_delay = (direction > 0 ? Shutter[i].tilt_config[1]-Shutter[i].tilt_real_pos : Shutter[i].tilt_real_pos-Shutter[i].tilt_config[0]) * Shutter[i].tilt_config[2] / (Shutter[i].tilt_config[1]-Shutter[i].tilt_config[0]);
|
||||
if (Shutter[i].tilt_config[1]-Shutter[i].tilt_config[0] != 0) {
|
||||
Shutter[i].venetian_delay = SHT_DIV_ROUND((direction > 0 ? Shutter[i].tilt_config[1]-Shutter[i].tilt_real_pos : Shutter[i].tilt_real_pos-Shutter[i].tilt_config[0]) * Shutter[i].tilt_config[2], Shutter[i].tilt_config[1]-Shutter[i].tilt_config[0]);
|
||||
//AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: real %d, start %d, counter %d,freq_max %d, dir %d, freq %d"),Shutter[i].real_position, Shutter[i].start_position ,RtcSettings.pulse_counter[i],ShutterGlobal.open_velocity_max , direction ,ShutterGlobal.open_velocity_max );
|
||||
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: VenetianDelay: %d, Pos: %d, Dir: %d, Delta: %d, Dur: %d, StartP: %d, TgtP: %d"),
|
||||
Shutter[i].venetian_delay, Shutter[i].tilt_real_pos,direction,(Shutter[i].tilt_config[1]-Shutter[i].tilt_config[0]), Shutter[i].tilt_config[2],Shutter[i].tilt_start_pos,Shutter[i].tilt_target_pos);
|
||||
|
|
Loading…
Reference in New Issue