mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-18 12:17:56 -06:00
mcu: Introduce new lookup_query_command() command wrapper
Use new mcu.lookup_query_command() for all commands that query information from the micro-controller. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
332038ea01
commit
245917bf03
5 changed files with 73 additions and 56 deletions
|
@ -84,8 +84,9 @@ class MCU_stepper:
|
|||
"set_next_step_dir oid=%c dir=%c")
|
||||
self._reset_cmd_id = self._mcu.lookup_command_id(
|
||||
"reset_step_clock oid=%c clock=%u")
|
||||
self._get_position_cmd = self._mcu.lookup_command(
|
||||
"stepper_get_position oid=%c")
|
||||
self._get_position_cmd = self._mcu.lookup_query_command(
|
||||
"stepper_get_position oid=%c",
|
||||
"stepper_position oid=%c pos=%i", oid=self._oid)
|
||||
self._ffi_lib.stepcompress_fill(
|
||||
self._stepqueue, self._mcu.seconds_to_clock(max_error),
|
||||
self._invert_dir, step_cmd_id, dir_cmd_id)
|
||||
|
@ -134,8 +135,7 @@ class MCU_stepper:
|
|||
raise error("Internal error in stepcompress")
|
||||
if not did_trigger or self._mcu.is_fileoutput():
|
||||
return
|
||||
params = self._get_position_cmd.send_with_response(
|
||||
[self._oid], response='stepper_position', response_oid=self._oid)
|
||||
params = self._get_position_cmd.send([self._oid])
|
||||
mcu_pos_dist = params['pos'] * self._step_dist
|
||||
if self._invert_dir:
|
||||
mcu_pos_dist = -mcu_pos_dist
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue