diff options
author | Len Trigg <lenbok@gmail.com> | 2019-04-16 13:11:26 +1200 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2019-04-15 21:11:26 -0400 |
commit | 1102c6c232251074c49b81758a94256d4a29e817 (patch) | |
tree | a159b12d6701221fde97a780635bd5cbab9635c0 /klippy/extras/tsl1401cl_filament_width_sensor.py | |
parent | 1b92af60784ea811a7ca04dfbce75224874cf84a (diff) | |
download | kutter-1102c6c232251074c49b81758a94256d4a29e817.tar.gz kutter-1102c6c232251074c49b81758a94256d4a29e817.tar.xz kutter-1102c6c232251074c49b81758a94256d4a29e817.zip |
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>
Diffstat (limited to 'klippy/extras/tsl1401cl_filament_width_sensor.py')
-rw-r--r-- | klippy/extras/tsl1401cl_filament_width_sensor.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/klippy/extras/tsl1401cl_filament_width_sensor.py b/klippy/extras/tsl1401cl_filament_width_sensor.py index a564ddb0..c9f5ab17 100644 --- a/klippy/extras/tsl1401cl_filament_width_sensor.py +++ b/klippy/extras/tsl1401cl_filament_width_sensor.py @@ -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") |