mirror of https://github.com/Desuuuu/klipper.git
mcu: Add support for setting reqclock in CommandQueryWrapper.send()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
5f96f8a29b
commit
79877acb14
|
@ -102,7 +102,8 @@ class PrinterNeoPixel:
|
|||
minclock = self.mcu.print_time_to_clock(print_time)
|
||||
scmd = self.neopixel_send_cmd.send
|
||||
for i in range(8):
|
||||
params = scmd([self.oid], minclock=minclock)
|
||||
params = scmd([self.oid], minclock=minclock,
|
||||
reqclock=BACKGROUND_PRIORITY_CLOCK)
|
||||
if params['success']:
|
||||
break
|
||||
else:
|
||||
|
|
|
@ -339,8 +339,8 @@ class RetryAsyncCommand:
|
|||
if params['#sent_time'] >= self.min_query_time:
|
||||
self.min_query_time = self.reactor.NEVER
|
||||
self.reactor.async_complete(self.completion, params)
|
||||
def get_response(self, cmd, cmd_queue, minclock=0):
|
||||
self.serial.raw_send_wait_ack(cmd, minclock, minclock, cmd_queue)
|
||||
def get_response(self, cmd, cmd_queue, minclock=0, reqclock=0):
|
||||
self.serial.raw_send_wait_ack(cmd, minclock, reqclock, cmd_queue)
|
||||
first_query_time = query_time = self.reactor.monotonic()
|
||||
while 1:
|
||||
params = self.completion.wait(query_time + self.RETRY_TIME)
|
||||
|
@ -368,11 +368,12 @@ class CommandQueryWrapper:
|
|||
if cmd_queue is None:
|
||||
cmd_queue = serial.get_default_command_queue()
|
||||
self._cmd_queue = cmd_queue
|
||||
def send(self, data=(), minclock=0):
|
||||
def send(self, data=(), minclock=0, reqclock=0):
|
||||
cmd = self._cmd.encode(data)
|
||||
xh = self._xmit_helper(self._serial, self._response, self._oid)
|
||||
reqclock = max(minclock, reqclock)
|
||||
try:
|
||||
return xh.get_response(cmd, self._cmd_queue, minclock=minclock)
|
||||
return xh.get_response(cmd, self._cmd_queue, minclock, reqclock)
|
||||
except serialhdl.error as e:
|
||||
raise error(str(e))
|
||||
|
||||
|
|
|
@ -235,11 +235,11 @@ class SerialRetryCommand:
|
|||
self.serial.register_response(self.handle_callback, name, oid)
|
||||
def handle_callback(self, params):
|
||||
self.last_params = params
|
||||
def get_response(self, cmd, cmd_queue, minclock=0):
|
||||
def get_response(self, cmd, cmd_queue, minclock=0, reqclock=0):
|
||||
retries = 5
|
||||
retry_delay = .010
|
||||
while 1:
|
||||
self.serial.raw_send_wait_ack(cmd, minclock, minclock, cmd_queue)
|
||||
self.serial.raw_send_wait_ack(cmd, minclock, reqclock, cmd_queue)
|
||||
params = self.last_params
|
||||
if params is not None:
|
||||
self.serial.register_response(None, self.name, self.oid)
|
||||
|
|
Loading…
Reference in New Issue