diff --git a/klippy/chelper/c_helper.so b/klippy/chelper/c_helper.so index b4db819de326..2ae3ff2f58da 100755 Binary files a/klippy/chelper/c_helper.so and b/klippy/chelper/c_helper.so differ diff --git a/klippy/chelper/itersolve.o b/klippy/chelper/itersolve.o index 53ec524b80a6..c18e24fcf5e6 100644 Binary files a/klippy/chelper/itersolve.o and b/klippy/chelper/itersolve.o differ diff --git a/klippy/chelper/kin_cartesian.o b/klippy/chelper/kin_cartesian.o index f7d2661ebb6a..17d44f43cb56 100644 Binary files a/klippy/chelper/kin_cartesian.o and b/klippy/chelper/kin_cartesian.o differ diff --git a/klippy/chelper/kin_corexy.o b/klippy/chelper/kin_corexy.o index 1a37d0a75cf6..5a1f6034c174 100644 Binary files a/klippy/chelper/kin_corexy.o and b/klippy/chelper/kin_corexy.o differ diff --git a/klippy/chelper/kin_corexz.o b/klippy/chelper/kin_corexz.o index d1f0ca67eb95..435a9f8b737b 100644 Binary files a/klippy/chelper/kin_corexz.o and b/klippy/chelper/kin_corexz.o differ diff --git a/klippy/chelper/kin_delta.o b/klippy/chelper/kin_delta.o index dedff9dea5f9..eff926d79f54 100644 Binary files a/klippy/chelper/kin_delta.o and b/klippy/chelper/kin_delta.o differ diff --git a/klippy/chelper/kin_deltesian.o b/klippy/chelper/kin_deltesian.o index 84cf5c5ea100..543d34a87f62 100644 Binary files a/klippy/chelper/kin_deltesian.o and b/klippy/chelper/kin_deltesian.o differ diff --git a/klippy/chelper/kin_extruder.o b/klippy/chelper/kin_extruder.o index 4394e98e35db..e35b3ef712ce 100644 Binary files a/klippy/chelper/kin_extruder.o and b/klippy/chelper/kin_extruder.o differ diff --git a/klippy/chelper/kin_idex.o b/klippy/chelper/kin_idex.o index 5ed48c864a09..424e83576018 100644 Binary files a/klippy/chelper/kin_idex.o and b/klippy/chelper/kin_idex.o differ diff --git a/klippy/chelper/kin_polar.o b/klippy/chelper/kin_polar.o index ebe32bd1c30d..10e536ceb4ad 100644 Binary files a/klippy/chelper/kin_polar.o and b/klippy/chelper/kin_polar.o differ diff --git a/klippy/chelper/kin_rotary_delta.o b/klippy/chelper/kin_rotary_delta.o index e12d76404c82..12361a202569 100644 Binary files a/klippy/chelper/kin_rotary_delta.o and b/klippy/chelper/kin_rotary_delta.o differ diff --git a/klippy/chelper/kin_shaper.o b/klippy/chelper/kin_shaper.o index 85309d041476..3b52b0ac3e77 100644 Binary files a/klippy/chelper/kin_shaper.o and b/klippy/chelper/kin_shaper.o differ diff --git a/klippy/chelper/kin_winch.o b/klippy/chelper/kin_winch.o index e290621bce7f..39d6f4892349 100644 Binary files a/klippy/chelper/kin_winch.o and b/klippy/chelper/kin_winch.o differ diff --git a/klippy/chelper/msgblock.o b/klippy/chelper/msgblock.o index 401695a41fbb..0beb7f9c5f46 100644 Binary files a/klippy/chelper/msgblock.o and b/klippy/chelper/msgblock.o differ diff --git a/klippy/chelper/pollreactor.o b/klippy/chelper/pollreactor.o index 4d7b56ee6ea9..7d88a70457d3 100644 Binary files a/klippy/chelper/pollreactor.o and b/klippy/chelper/pollreactor.o differ diff --git a/klippy/chelper/pyhelper.o b/klippy/chelper/pyhelper.o index df6e839106d3..0e653c0d3a47 100644 Binary files a/klippy/chelper/pyhelper.o and b/klippy/chelper/pyhelper.o differ diff --git a/klippy/chelper/serialqueue.c b/klippy/chelper/serialqueue.c index c207495cdc6c..8f3cbb9aef43 100644 --- a/klippy/chelper/serialqueue.c +++ b/klippy/chelper/serialqueue.c @@ -612,6 +612,7 @@ static void * background_thread(void *data) { struct serialqueue *sq = data; + nice(-20); pollreactor_run(sq->pr); pthread_mutex_lock(&sq->lock); diff --git a/klippy/chelper/serialqueue.o b/klippy/chelper/serialqueue.o index 5260ef7c07a6..019f86356f7a 100644 Binary files a/klippy/chelper/serialqueue.o and b/klippy/chelper/serialqueue.o differ diff --git a/klippy/chelper/stepcompress.c b/klippy/chelper/stepcompress.c index 310f2bf31f64..8bfc330ab394 100644 --- a/klippy/chelper/stepcompress.c +++ b/klippy/chelper/stepcompress.c @@ -211,6 +211,17 @@ check_line(struct stepcompress *sc, struct step_move move) || move.interval >= 0x80000000) { errorf("stepcompress o=%d i=%d c=%d a=%d: Invalid sequence" , sc->oid, move.interval, move.count, move.add); + errorf("stepcompress queue[%p]=%u queue_end[%p]=%u queue_pos[%p]=%u queue_next[%p]=%u last_step_clock=%llu max_error=%u : lxc check_line" + , sc->queue, *(sc->queue), sc->queue_end, *(sc->queue_end), sc->queue_pos, *(sc->queue_pos), + sc->queue_next, *(sc->queue_next), sc->last_step_clock, sc->max_error); + uint16_t i; + uint32_t intervals = move.interval, ps = 0; + for (i=0; iqueue_pos + i); + errorf("stepcompress queue_pos+i=%u ps=%u minp=%u maxp=%u : lxc Invalid sequence 2" + , *(sc->queue_pos + i), ps, points.minp, points.maxp); + } return ERROR_RET; } uint32_t interval = move.interval, p = 0; diff --git a/klippy/chelper/stepcompress.o b/klippy/chelper/stepcompress.o index ae75ab6dc23d..1ded68865918 100644 Binary files a/klippy/chelper/stepcompress.o and b/klippy/chelper/stepcompress.o differ diff --git a/klippy/chelper/trapq.o b/klippy/chelper/trapq.o index 8816fdc780ca..9c404ca20af9 100644 Binary files a/klippy/chelper/trapq.o and b/klippy/chelper/trapq.o differ diff --git a/klippy/chelper/trdispatch.o b/klippy/chelper/trdispatch.o index 5323f35f085a..bd91e2f347e0 100644 Binary files a/klippy/chelper/trdispatch.o and b/klippy/chelper/trdispatch.o differ diff --git a/klippy/clocksync.py b/klippy/clocksync.py index 995c1b791330..f980c846403f 100644 --- a/klippy/clocksync.py +++ b/klippy/clocksync.py @@ -36,9 +36,12 @@ def connect(self, serial): self.mcu_freq = serial.msgparser.get_constant_float('CLOCK_FREQ') # Load initial clock and frequency params = serial.send_with_response('get_uptime', 'uptime') + self.time_avg = params['#sent_time'] + if not self.time_avg: + params = serial.send_with_response('get_uptime', 'uptime') + self.time_avg = params['#sent_time'] self.last_clock = (params['high'] << 32) | params['clock'] self.clock_avg = self.last_clock - self.time_avg = params['#sent_time'] self.clock_est = (self.time_avg, self.clock_avg, self.mcu_freq) self.prediction_variance = (.001 * self.mcu_freq)**2 # Enable periodic get_clock timer diff --git a/klippy/extras/statistics.py b/klippy/extras/statistics.py index 90cd53f8d774..de57653b6dce 100644 --- a/klippy/extras/statistics.py +++ b/klippy/extras/statistics.py @@ -67,7 +67,7 @@ def generate_stats(self, eventtime): if max([s[0] for s in stats]): logging.info("Stats %.1f: %s", eventtime, ' '.join([s[1] for s in stats])) - return eventtime + 1. + return eventtime + 3. def load_config(config): config.get_printer().add_object('system_stats', PrinterSysStats(config)) diff --git a/klippy/reactor.py b/klippy/reactor.py index 412d53edf64f..28cab4dfe1cf 100644 --- a/klippy/reactor.py +++ b/klippy/reactor.py @@ -336,6 +336,12 @@ def _dispatch_loop(self): self._g_dispatch = g_dispatch = greenlet.getcurrent() busy = True eventtime = self.monotonic() + try: + logging.info("_dispatch_loop current nice = %d", os.nice(0)) + val = os.nice(-10) + logging.info("_dispatch_loop new nice = %d", val) + except: + pass while self._process: timeout = self._check_timers(eventtime, busy) busy = False diff --git a/klippy/serialhdl.py b/klippy/serialhdl.py index d48e03bf6ed4..658093c14270 100644 --- a/klippy/serialhdl.py +++ b/klippy/serialhdl.py @@ -36,6 +36,12 @@ def __init__(self, reactor, warn_prefix="", mcu=None): self.pending_notifications = {} def _bg_thread(self): response = self.ffi_main.new('struct pull_queue_message *') + try: + val = os.nice(-20) + logging.info("%scurrent nice = %d" ,self.warn_prefix, val) + except: + logging.info("%snice process failed", self.warn_prefix) + pass while 1: self.ffi_lib.serialqueue_pull(self.serialqueue, response) count = response.len @@ -130,7 +136,7 @@ def connect_canbus(self, canbus_uuid, canbus_nodeid, canbus_iface="can0"): logging.info("%sStarting CAN connect", self.warn_prefix) start_time = self.reactor.monotonic() while 1: - if self.reactor.monotonic() > start_time + 90.: + if self.reactor.monotonic() > start_time + 50.: self._error("Unable to connect") try: bus = can.interface.Bus(channel=canbus_iface,