Keep movement physics ticking while idle
This commit is contained in:
1 parent
8d2374346e
commit
e8b1913e97
2 files changed
+67
-6
No files matched your search
+9
-6
@@ -160,8 +160,11 @@ def tick(global_state):
|
||||
print('Chunks loaded in', round(time.time() - g.chunks.loading, 2), 's')
|
||||
g.chunks.loading = False
|
||||
g.chunk_wait_report_at = 0
|
||||
job = g.get('job')
|
||||
job_active = job is not None and job.state != job.idle
|
||||
status = ('draining_inventory' if g.get('draining') else
|
||||
'following_path' if g.path else 'running_job')
|
||||
'following_path' if g.path else
|
||||
'running_job' if job_active else 'idle')
|
||||
if g.get('movement_status') != status:
|
||||
print('[movement] status={}'.format(status), flush=True)
|
||||
g.movement_status = status
|
||||
@@ -563,9 +566,11 @@ def start_automation(global_state, initialize=True):
|
||||
bool(g.get('drop_waiting')))
|
||||
if g.get('movement_paused'):
|
||||
set_status('paused')
|
||||
elif has_work and not movement_ready:
|
||||
set_status('waiting_for_chunks')
|
||||
elif has_work and movement_ready:
|
||||
elif not movement_ready:
|
||||
set_status('waiting_for_chunks' if has_work else 'idle')
|
||||
else:
|
||||
# Keep local physics running even when there is no path or job:
|
||||
# gravity and position packets must continue while standing idle.
|
||||
try:
|
||||
reload_lock = g.get('reload_lock')
|
||||
if reload_lock is None:
|
||||
@@ -581,8 +586,6 @@ def start_automation(global_state, initialize=True):
|
||||
print('[movement] stopped after navigation error',
|
||||
flush=True)
|
||||
return
|
||||
elif not has_work and not g.get('movement_paused'):
|
||||
set_status('idle')
|
||||
delay = max(0.0, utils.TICK - (time.monotonic() - started))
|
||||
time.sleep(delay)
|
||||
|
||||
|
||||
Reference in new issue
Block a user