Tick the slow chart task on a 1sec index event

history_view
Tyler Goodlet 2022-09-19 17:39:26 -04:00
parent c0d490ed63
commit 90754f979b
1 changed files with 19 additions and 3 deletions

View File

@ -206,6 +206,7 @@ class DisplayState(Struct):
state['i_last_append'] = i_step state['i_last_append'] = i_step
do_rt_update = uppx < update_uppx do_rt_update = uppx < update_uppx
_, _, _, r = chart.bars_range() _, _, _, r = chart.bars_range()
liv = r >= i_step liv = r >= i_step
@ -346,11 +347,20 @@ async def graphics_update_loop(
_, hist_step_size_s, _ = feed.get_ds_info() _, hist_step_size_s, _ = feed.get_ds_info()
async with feed.index_stream( async with feed.index_stream(
int(hist_step_size_s) # int(hist_step_size_s)
# TODO: seems this is more reliable at keeping the slow
# chart incremented in view more correctly?
# - It might make sense to just inline this logic with the
# main display task? => it's a tradeoff of slower task
# wakeups/ctx switches verus logic checks (as normal)
# - we need increment logic that only does the view shift
# call when the uppx permits/needs it
int(1),
) as istream: ) as istream:
async for msg in istream: async for msg in istream:
# check if slow chart needs a resize # check if slow chart needs an x-domain shift and/or
# y-range resize.
( (
uppx, uppx,
liv, liv,
@ -364,6 +374,12 @@ async def graphics_update_loop(
state=state, state=state,
# update_state=False, # update_state=False,
) )
# print(
# f'liv: {liv}\n'
# f'do_append: {do_append}\n'
# f'append_diff: {append_diff}\n'
# )
if ( if (
do_append do_append
and liv and liv
@ -395,7 +411,7 @@ async def graphics_update_loop(
# chart isn't active/shown so skip render cycle and pause feed(s) # chart isn't active/shown so skip render cycle and pause feed(s)
if chart.linked.isHidden(): if chart.linked.isHidden():
print('skipping update') # print('skipping update')
chart.pause_all_feeds() chart.pause_all_feeds()
continue continue