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:
Len Trigg 2019-04-16 13:11:26 +12:00 committed by KevinOConnor
parent 1b92af6078
commit 1102c6c232
1 changed files with 2 additions and 2 deletions

View File

@ -93,8 +93,8 @@ class FilamentWidthSensor:
filament_width = item[1]
if ((filament_width <= self.max_diameter)
and (filament_width >= self.min_diameter)):
percentage = round(self.nominal_filament_dia
/ filament_width * 100)
percentage = round(self.nominal_filament_dia**2
/ filament_width**2 * 100)
self.gcode.run_script("M221 S" + str(percentage))
else:
self.gcode.run_script("M221 S100")