tsl1401cl_filament_width_sensor: Fix incorrect math in filament width sensor. (#1541)
The parameter to the M221 command should be the ratio of the nominal to measured filament area, rather than the ratio of the diameters. Since we are taking the ratio, most of the area calculation cancels out. Fixes #1535. Signed-off-by: Len Trigg <lenbok@gmail.com>
This commit is contained in:
parent
1b92af6078
commit
1102c6c232
|
@ -93,8 +93,8 @@ class FilamentWidthSensor:
|
||||||
filament_width = item[1]
|
filament_width = item[1]
|
||||||
if ((filament_width <= self.max_diameter)
|
if ((filament_width <= self.max_diameter)
|
||||||
and (filament_width >= self.min_diameter)):
|
and (filament_width >= self.min_diameter)):
|
||||||
percentage = round(self.nominal_filament_dia
|
percentage = round(self.nominal_filament_dia**2
|
||||||
/ filament_width * 100)
|
/ filament_width**2 * 100)
|
||||||
self.gcode.run_script("M221 S" + str(percentage))
|
self.gcode.run_script("M221 S" + str(percentage))
|
||||||
else:
|
else:
|
||||||
self.gcode.run_script("M221 S100")
|
self.gcode.run_script("M221 S100")
|
||||||
|
|
Loading…
Reference in New Issue