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,7 +179,7 @@ float ProbeTempComp::get_offset_for_temperature(const TempSensorID tsi, const fl
179 179
   };
180 180
 
181 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 184
   // offset in um
185 185
   float offset = 0.0f;
@@ -190,9 +190,9 @@ float ProbeTempComp::get_offset_for_temperature(const TempSensorID tsi, const fl
190 190
     else if (idx > measurements - 2)
191 191
       offset = static_cast<float>(data[measurements - 1]);
192 192
   #else
193
-    if (idx < 0) 
193
+    if (idx < 0)
194 194
       offset = linear_interp(temp, point(0), point(PTC_LINEAR_EXTRAPOLATION));
195
-    else if (idx > measurements - 2) 
195
+    else if (idx > measurements - 2)
196 196
       offset = linear_interp(temp, point(measurements - PTC_LINEAR_EXTRAPOLATION - 1), point(measurements - 1));
197 197
   #endif
198 198
     else

Loading…
Cancel
Save