diff options
author | Denis Ignatenko <60291791+test3210-d@users.noreply.github.com> | 2020-05-19 00:14:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-18 17:14:24 -0400 |
commit | 1d2746f1671bdb6a25c455a15267ccdee73c47d0 (patch) | |
tree | ac101d9b50a79fad621762fb0dec6cdf0c955783 /klippy/extras/hall_filament_width_sensor.py | |
parent | c9daefd97f61c8e291dcee6496fcfb5bf3926576 (diff) | |
download | kutter-1d2746f1671bdb6a25c455a15267ccdee73c47d0.tar.gz kutter-1d2746f1671bdb6a25c455a15267ccdee73c47d0.tar.xz kutter-1d2746f1671bdb6a25c455a15267ccdee73c47d0.zip |
hall_filament_width_sensor: Increasing measure stability (#2836)
Signed-off-by: Denis Ignatenko <deniss979@gmail.com>
Diffstat (limited to 'klippy/extras/hall_filament_width_sensor.py')
-rw-r--r-- | klippy/extras/hall_filament_width_sensor.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/klippy/extras/hall_filament_width_sensor.py b/klippy/extras/hall_filament_width_sensor.py index d9ddf827..f7ae7980 100644 --- a/klippy/extras/hall_filament_width_sensor.py +++ b/klippy/extras/hall_filament_width_sensor.py @@ -6,8 +6,8 @@ import filament_switch_sensor ADC_REPORT_TIME = 0.500 -ADC_SAMPLE_TIME = 0.001 -ADC_SAMPLE_COUNT = 5 +ADC_SAMPLE_TIME = 0.01 +ADC_SAMPLE_COUNT = 49 class HallFilamentWidthSensor: def __init__(self, config): @@ -77,10 +77,11 @@ class HallFilamentWidthSensor: # read sensor value self.lastFilamentWidthReading2 = round(read_value * 10000) # calculate diameter - self.diameter = round((self.dia2 - self.dia1)/ + diameter_new = round((self.dia2 - self.dia1)/ (self.rawdia2-self.rawdia1)* ((self.lastFilamentWidthReading+self.lastFilamentWidthReading2) -self.rawdia1)+self.dia1,2) + self.diameter=(5.0 * self.diameter + diameter_new)/6 def update_filament_array(self, last_epos): # Fill array |