hall_filament_width_sensor: Fix race condition (#3790)

Fix race condition of filament width sensor
Added fix to similar code of TSL1401CL filament width sensor

Signed-off-by: Pascal Pieper <accounts@pascalpieper.de>
This commit is contained in:
Pascal P 2021-01-22 19:41:34 +01:00 committed by GitHub
parent 8cc1d84180
commit 1e2eb9a4de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -152,7 +152,11 @@ class HallFilamentWidthSensor:
else: else:
self.gcode.run_script("M221 S100") self.gcode.run_script("M221 S100")
self.filament_array = [] self.filament_array = []
return eventtime + 1
if self.is_active:
return eventtime + 1
else:
return self.reactor.NEVER
def cmd_M407(self, gcmd): def cmd_M407(self, gcmd):
response = "" response = ""

View File

@ -101,7 +101,11 @@ class FilamentWidthSensor:
else: else:
self.gcode.run_script("M221 S100") self.gcode.run_script("M221 S100")
self.filament_array = [] self.filament_array = []
return eventtime + 1
if self.is_active:
return eventtime + 1
else:
return self.reactor.NEVER
def cmd_M407(self, gcmd): def cmd_M407(self, gcmd):
response = "" response = ""