Fix int16 overflow on large open times

This commit is contained in:
stefanbode 2020-09-18 08:31:05 +02:00 committed by GitHub
parent d7ef5a1c4e
commit ecf9e4ea65
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: