aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArksine <arksine.code@gmail.com>2020-02-16 16:49:09 -0500
committerKevinOConnor <kevin@koconnor.net>2020-02-17 16:48:43 -0500
commit718da75910f77a0617254ef5c587b5bfddd99aa3 (patch)
treec8d51736d9f8963624f4d6fddaadcf5b9756f35d
parent941507148256d368ed23375158891a0504646715 (diff)
downloadkutter-718da75910f77a0617254ef5c587b5bfddd99aa3.tar.gz
kutter-718da75910f77a0617254ef5c587b5bfddd99aa3.tar.xz
kutter-718da75910f77a0617254ef5c587b5bfddd99aa3.zip
filament_switch_sensor: Add a get_status() method
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
-rw-r--r--klippy/extras/filament_switch_sensor.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/klippy/extras/filament_switch_sensor.py b/klippy/extras/filament_switch_sensor.py
index 9019b767..e1411bd4 100644
--- a/klippy/extras/filament_switch_sensor.py
+++ b/klippy/extras/filament_switch_sensor.py
@@ -111,6 +111,8 @@ class RunoutHelper:
"Filament Sensor %s: runout event detected, Time %.2f" %
(self.name, eventtime))
self.reactor.register_callback(self._runout_event_handler)
+ def get_status(self, eventtime):
+ return {"filament_detected": bool(self.filament_present)}
cmd_QUERY_FILAMENT_SENSOR_help = "Query the status of the Filament Sensor"
def cmd_QUERY_FILAMENT_SENSOR(self, params):
if self.filament_present:
@@ -129,6 +131,7 @@ class SwitchSensor:
switch_pin = config.get('switch_pin')
buttons.register_buttons([switch_pin], self._button_handler)
self.runout_helper = RunoutHelper(config)
+ self.get_status = self.runout_helper.get_status
def _button_handler(self, eventtime, state):
self.runout_helper.note_filament_present(state)