Merge pull request #9336 from stefanbode/patch-4

Fix int16 overflow on large open times
This commit is contained in:
Theo Arends 2020-09-18 09:15:26 +02:00 committed by GitHub
commit d34be3009f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -560,7 +560,7 @@ int32_t ShutterCalculatePosition(uint32_t i)
if (Shutter[i].direction != 0) {
switch (ShutterGlobal.position_mode) {
case SHT_COUNTER:
return ((int32_t)RtcSettings.pulse_counter[i]*Shutter[i].direction*STEPS_PER_SECOND*RESOLUTION / ShutterGlobal.open_velocity_max)+Shutter[i].start_position;
return ((int32_t)RtcSettings.pulse_counter[i]*Shutter[i].direction*STEPS_PER_SECOND / ShutterGlobal.open_velocity_max * RESOLUTION)+Shutter[i].start_position;
break;
case SHT_TIME:
case SHT_TIME_UP_DOWN: