From a9a5c33327b867f173acc51d0d3321e5d9a1e0a2 Mon Sep 17 00:00:00 2001 From: to-scho Date: Thu, 2 Jan 2020 12:46:12 +0100 Subject: [PATCH] Wrong shutter percentage reporting With calibrated shutters and ShutterPosition 100 the resulting position may not be 100. This is due to 2 issues. a) percentage is calculated wrong from position due to numerical precision. b) real_position and subsequently position after movement is slightly smaller than max_position. a) is fixed here by avoiding calculation when position is equal to calibration point b) open, not fixed here. Issue further depends on start_position which makes it hard to reproduce. Maybe 'stop_position_delta=20' results is real_position not reaching max_position. --- tasmota/xdrv_27_shutter.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/xdrv_27_shutter.ino b/tasmota/xdrv_27_shutter.ino index 457d2870f..326e792fb 100644 --- a/tasmota/xdrv_27_shutter.ino +++ b/tasmota/xdrv_27_shutter.ino @@ -132,7 +132,7 @@ uint8_t ShutterRealToPercentPosition(int32_t realpos, uint8_t index) uint16_t realpercent; for (uint8_t i=0 ; i < 5 ; i++) { - if (realpos > Shutter.open_max[index] * calibrate_pos[i+1] / 100) { + if (realpos >= Shutter.open_max[index] * calibrate_pos[i+1] / 100) { realpercent = Settings.shuttercoeff[i][index] /10; //AddLog_P2(LOG_LEVEL_INFO, PSTR("Realpercent TEMP1: %d, %% %d, coeff %d"), realpercent, realpos, Shutter_Open_Max[index] * calibrate_pos[i+1] / 100); } else {