aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/example-extras.cfg3
-rw-r--r--docs/HallFilamentWidthSensor.md12
-rw-r--r--klippy/extras/hall_filament_width_sensor.py17
3 files changed, 32 insertions, 0 deletions
diff --git a/config/example-extras.cfg b/config/example-extras.cfg
index 15b95e87..8e7e0a5b 100644
--- a/config/example-extras.cfg
+++ b/config/example-extras.cfg
@@ -2035,6 +2035,9 @@
#measurement_interval: 10
# The approximate distance (in mm) between sensor readings. The
# default is 10mm.
+#logging: False
+# Out diameter to terminal and klipper.log
+# can be turn on|of by command
#Virtual filament_switch_sensor support. Create sensor named hall_filament_width_sensor.
#min_diameter:1.0
#Minimal diameter for trigger virtual filament_switch_sensor.
diff --git a/docs/HallFilamentWidthSensor.md b/docs/HallFilamentWidthSensor.md
index 5867662d..efb62128 100644
--- a/docs/HallFilamentWidthSensor.md
+++ b/docs/HallFilamentWidthSensor.md
@@ -48,6 +48,10 @@ Sensor generates two analog output based on calculated filament width. Sum of ou
# measurement_interval:10
# Sensor readings done with 10 mm intervals by default. If necessary you are free to change this setting
+ #logging: False
+ # Out diameter to terminal and klipper.log
+ # can be turn on|of by command
+
#Virtual filament_switch_sensor suppurt. Create sensor named hall_filament_width_sensor.
#
#min_diameter:1.0
@@ -75,6 +79,10 @@ Sensor generates two analog output based on calculated filament width. Sum of ou
**QUERY_RAW_FILAMENT_WIDTH** Return the current ADC channel values and RAW sensor value for calibration points
+**ENABLE_FILAMENT_WIDTH_LOG** - Turn on diameter logging
+
+**DISABLE_FILAMENT_WIDTH_LOG** - Turn off diameter logging
+
## Menu variables
**hall_filament_width_sensor.Diameter** current measured filament width in mm
@@ -117,3 +125,7 @@ Save raw values in config
## How to enable sensor
After power on by default sensor disabled.
Enable sensor in start g-code by command **ENABLE_FILAMENT_WIDTH_SENSOR** or change enable parameter in config
+
+## Logging
+After power on by default diameter Logging disabled.
+Data to log added on every measurement interval (10 mm by default)
diff --git a/klippy/extras/hall_filament_width_sensor.py b/klippy/extras/hall_filament_width_sensor.py
index e065f175..d84cfd70 100644
--- a/klippy/extras/hall_filament_width_sensor.py
+++ b/klippy/extras/hall_filament_width_sensor.py
@@ -31,6 +31,7 @@ class HallFilamentWidthSensor:
self.diameter =self.nominal_filament_dia
self.is_active =config.getboolean('enable', False)
self.runout_dia=config.getfloat('min_diameter', 1.0)
+ self.is_log =config.getboolean('logging', False)
# Use the current diameter instead of nominal while the first
# measurement isn't in place
self.use_current_dia_while_delay = config.getboolean(
@@ -63,6 +64,11 @@ class HallFilamentWidthSensor:
self.cmd_M405)
self.gcode.register_command('QUERY_RAW_FILAMENT_WIDTH',
self.cmd_Get_Raw_Values)
+ self.gcode.register_command('ENABLE_FILAMENT_WIDTH_LOG',
+ self.cmd_log_enable)
+ self.gcode.register_command('DISABLE_FILAMENT_WIDTH_LOG',
+ self.cmd_log_disable)
+
self.runout_helper = filament_switch_sensor.RunoutHelper(config)
# Initialization
def handle_ready(self):
@@ -97,6 +103,10 @@ class HallFilamentWidthSensor:
if next_reading_position <= (last_epos + self.measurement_delay):
self.filament_array.append([last_epos + self.measurement_delay,
self.diameter])
+ if self.is_log:
+ self.gcode.respond_info("Filament width:%.3f" %
+ ( self.diameter ))
+
else:
# add first item to array
self.filament_array.append([self.measurement_delay + last_epos,
@@ -190,6 +200,13 @@ class HallFilamentWidthSensor:
'Raw':(self.lastFilamentWidthReading+
self.lastFilamentWidthReading2),
'is_active':self.is_active}
+ def cmd_log_enable(self, gcmd):
+ self.is_log = True
+ gcmd.respond_info("Filament width logging Turned On")
+
+ def cmd_log_disable(self, gcmd):
+ self.is_log = False
+ gcmd.respond_info("Filament width logging Turned Off")
def load_config(config):
return HallFilamentWidthSensor(config)