Browse Source

Fix PTC calculation (#18265)

rudihorn 5 years ago
parent
commit
eef2931150
No account linked to committer's email address
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      Marlin/src/feature/probe_temp_comp.cpp

+ 3
- 3
Marlin/src/feature/probe_temp_comp.cpp View File

179
   };
179
   };
180
 
180
 
181
   // Linear interpolation
181
   // Linear interpolation
182
-  uint8_t idx = static_cast<uint8_t>(temp - start_temp / res_temp);
182
+  uint8_t idx = static_cast<uint8_t>((temp - start_temp) / res_temp);
183
 
183
 
184
   // offset in um
184
   // offset in um
185
   float offset = 0.0f;
185
   float offset = 0.0f;
190
     else if (idx > measurements - 2)
190
     else if (idx > measurements - 2)
191
       offset = static_cast<float>(data[measurements - 1]);
191
       offset = static_cast<float>(data[measurements - 1]);
192
   #else
192
   #else
193
-    if (idx < 0) 
193
+    if (idx < 0)
194
       offset = linear_interp(temp, point(0), point(PTC_LINEAR_EXTRAPOLATION));
194
       offset = linear_interp(temp, point(0), point(PTC_LINEAR_EXTRAPOLATION));
195
-    else if (idx > measurements - 2) 
195
+    else if (idx > measurements - 2)
196
       offset = linear_interp(temp, point(measurements - PTC_LINEAR_EXTRAPOLATION - 1), point(measurements - 1));
196
       offset = linear_interp(temp, point(measurements - PTC_LINEAR_EXTRAPOLATION - 1), point(measurements - 1));
197
   #endif
197
   #endif
198
     else
198
     else

Loading…
Cancel
Save