aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authoralocin73 <64709177+alocin73@users.noreply.github.com>2020-08-20 00:58:49 +0200
committerGitHub <noreply@github.com>2020-08-19 18:58:49 -0400
commit1bdf705524c4ac32829515e2919c543134a29076 (patch)
tree0b1aa2cf60e637d6bd4fa7d4b7687c76df843551 /klippy
parentbc904dd431eafb2593c6bbd9cb0ba735c74e2124 (diff)
downloadkutter-1bdf705524c4ac32829515e2919c543134a29076.tar.gz
kutter-1bdf705524c4ac32829515e2919c543134a29076.tar.xz
kutter-1bdf705524c4ac32829515e2919c543134a29076.zip
hall_filament_width_sensor: Fix Flow update before next pending_position #3184 (#3198)
After reading the first item of self.filament_array, filament_width is updated back to self.nominal_filament_dia or self.diameter instead of retaining the value until next pending_position. Updated Filament Menu Template. Signed-off-by: Nicola Falciani <nicola.fal@gmail.com>
Diffstat (limited to 'klippy')
-rw-r--r--klippy/extras/hall_filament_width_sensor.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/klippy/extras/hall_filament_width_sensor.py b/klippy/extras/hall_filament_width_sensor.py
index b01b69ac..213eba74 100644
--- a/klippy/extras/hall_filament_width_sensor.py
+++ b/klippy/extras/hall_filament_width_sensor.py
@@ -40,6 +40,8 @@ class HallFilamentWidthSensor:
self.filament_array = []
self.lastFilamentWidthReading = 0
self.lastFilamentWidthReading2 = 0
+ self.firstExtruderUpdatePosition = 0
+ self.filament_width = self.nominal_filament_dia
# printer objects
self.toolhead = self.ppins = self.mcu_adc = None
self.printer.register_event_handler("klippy:ready", self.handle_ready)
@@ -112,6 +114,8 @@ class HallFilamentWidthSensor:
# add first item to array
self.filament_array.append([self.measurement_delay + last_epos,
self.diameter])
+ self.firstExtruderUpdatePosition = (self.measurement_delay
+ + last_epos)
def extrude_factor_update_event(self, eventtime):
# Update extrude factor
@@ -130,15 +134,18 @@ class HallFilamentWidthSensor:
if pending_position <= last_epos:
# Get first item in filament_array queue
item = self.filament_array.pop(0)
- filament_width = item[1]
- elif self.use_current_dia_while_delay:
- filament_width = self.diameter
+ self.filament_width = item[1]
else:
- filament_width = self.nominal_filament_dia
- if ((filament_width <= self.max_diameter)
- and (filament_width >= self.min_diameter)):
+ if ((self.use_current_dia_while_delay)
+ and (self.firstExtruderUpdatePosition
+ == pending_position)):
+ self.filament_width = self.diameter
+ elif self.firstExtruderUpdatePosition == pending_position:
+ self.filament_width = self.nominal_filament_dia
+ if ((self.filament_width <= self.max_diameter)
+ and (self.filament_width >= self.min_diameter)):
percentage = round(self.nominal_filament_dia**2
- / filament_width**2 * 100)
+ / self.filament_width**2 * 100)
self.gcode.run_script("M221 S" + str(percentage))
else:
self.gcode.run_script("M221 S100")