diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-06-26 10:45:06 -0400 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2019-07-10 10:43:20 -0400 |
commit | b2c778b93122aacd93b983775c10b97d392e92b4 (patch) | |
tree | 247370860c7be3de3511561ccff3d597d40f7d4d /klippy/extras/query_endstops.py | |
parent | ced5e35f0c37991c13e4a607369c20edd02b5761 (diff) | |
download | kutter-b2c778b93122aacd93b983775c10b97d392e92b4.tar.gz kutter-b2c778b93122aacd93b983775c10b97d392e92b4.tar.xz kutter-b2c778b93122aacd93b983775c10b97d392e92b4.zip |
mcu: Integrate query_endstop_wait() into query_endstop()
There is no need to have two separate calls to query an endstop.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/query_endstops.py')
-rw-r--r-- | klippy/extras/query_endstops.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/klippy/extras/query_endstops.py b/klippy/extras/query_endstops.py index 0b139ec2..f0e5c58e 100644 --- a/klippy/extras/query_endstops.py +++ b/klippy/extras/query_endstops.py @@ -1,6 +1,6 @@ # Utility for querying the current state of all endstops # -# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net> +# Copyright (C) 2018-2019 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. @@ -16,14 +16,10 @@ class QueryEndstops: self.endstops.append((mcu_endstop, name)) cmd_QUERY_ENDSTOPS_help = "Report on the status of each endstop" def cmd_QUERY_ENDSTOPS(self, params): - toolhead = self.printer.lookup_object('toolhead') - print_time = toolhead.get_last_move_time() # Query the endstops - for mcu_endstop, name in self.endstops: - mcu_endstop.query_endstop(print_time) - out = [] - for mcu_endstop, name in self.endstops: - out.append((name, mcu_endstop.query_endstop_wait())) + print_time = self.printer.lookup_object('toolhead').get_last_move_time() + out = [(name, mcu_endstop.query_endstop(print_time)) + for mcu_endstop, name in self.endstops] # Report results msg = " ".join(["%s:%s" % (name, ["open", "TRIGGERED"][not not t]) for name, t in out]) |