From 516ef1d3616acd7ddfd61b80b562f58a7800ceed Mon Sep 17 00:00:00 2001 From: Russell Cloran Date: Mon, 17 Mar 2025 20:50:10 -0700 Subject: hall_filament_width_sensor: Add filament switch values to status `hall_filament_width_sensor` contains a runout sensor object internally. This exposes those values in the API status result. ``` SEND: {"id":123,"method":"objects/query","params":{"objects":{"hall_filament_width_sensor":["enabled","filament_detected","is_active","Diameter","Raw"]}}} GOT: b'{"id":123,"result":{"eventtime":199567.823596603,"status":{"hall_filament_width_sensor":{"enabled":true,"filament_detected":true,"is_active":true,"Diameter":1.9499999999999986,"Raw":6113}}}}' ``` The duplication of `is_active` and `enabled` seems confusing, but both of these can be independently manipulated by GCode: ``` SEND: {"id":123,"method":"gcode/script","params":{"script":"DISABLE_FILAMENT_WIDTH_SENSOR"}} GOT: b'{"id":123,"result":{}}' SEND: {"id":123,"method":"objects/query","params":{"objects":{"hall_filament_width_sensor":["enabled","is_active"]}}} GOT: b'{"id":123,"result":{"eventtime":199770.446013297,"status":{"hall_filament_width_sensor":{"enabled":true,"is_active":false}}}}' SEND: {"id":123,"method":"gcode/script","params":{"script":"SET_FILAMENT_SENSOR SENSOR=hall_filament_width_sensor ENABLE=0"}} GOT: b'{"id":123,"result":{}}' SEND: {"id":123,"method":"objects/query","params":{"objects":{"hall_filament_width_sensor":["enabled","is_active"]}}} GOT: b'{"id":123,"result":{"eventtime":199847.927726196,"status":{"hall_filament_width_sensor":{"enabled":false,"is_active":false}}}}' ``` Signed-off-by: Russell Cloran --- klippy/extras/hall_filament_width_sensor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'klippy') diff --git a/klippy/extras/hall_filament_width_sensor.py b/klippy/extras/hall_filament_width_sensor.py index c71b2b2e..865e49af 100644 --- a/klippy/extras/hall_filament_width_sensor.py +++ b/klippy/extras/hall_filament_width_sensor.py @@ -209,10 +209,12 @@ class HallFilamentWidthSensor: +self.lastFilamentWidthReading2)) gcmd.respond_info(response) def get_status(self, eventtime): - return {'Diameter': self.diameter, + status = self.runout_helper.get_status(eventtime) + status.update({'Diameter': self.diameter, 'Raw':(self.lastFilamentWidthReading+ self.lastFilamentWidthReading2), - 'is_active':self.is_active} + 'is_active':self.is_active}) + return status def cmd_log_enable(self, gcmd): self.is_log = True gcmd.respond_info("Filament width logging Turned On") -- cgit v1.2.3-70-g09d2