|
使用的是STemWin5.32,Graph控件大小为400*400,使用的是GRAPH_DATA_XY_AddPoint添加数据,一共显示3条曲线。如果以100ms为周期执行下面的代码,然后使用GUI_Exec函数,发现GUI_Exec函数耗时100~200ms,会造成界面上Edit控件中的数据变化出现明显卡顿。如果是以大于4s为周期执行下面代码,卡顿感会减少。有什么办法解决吗?求助各位大佬!
往Graph控件添加数据代码如下:
if(sys_timer_getstamp_between(update_timestamp) < 100000) //100ms刷新
{
return;
}
update_timestamp = sys_timer_Getstamp();
for(i = 0; i < 3; i++)
{
while(graph_data[i].rditem != graph_data[i].writem)
{
s_graph.point.y = (I16)((graph_data[i].vdata[graph_data[i].rditem] + s_graph.y_offset[i]) / s_graph.y_factor[i]);
if(s_graph.point_x[i] <= GRAPH_X_PIXEL_MAX)
{
s_graph.point.x = s_graph.point_x[i];
s_graph.point_x[i] = (s_graph.point_x[i] + s_graph.x_rep_cnt);
GRAPH_DATA_XY_AddPoint(pdataGRP[i], &s_graph.point);
}
else
{
s_graph.x_off[i] = s_graph.x_off[i] - s_graph.x_rep_cnt;
s_graph.point.x = GRAPH_X_PIXEL_MAX - s_graph.x_off[i]; //GRAPH_X_PIXEL_MAX为400
GRAPH_DATA_XY_SetOffX(pdataGRP[i], s_graph.x_off[i]);
GRAPH_DATA_XY_AddPoint(pdataGRP[i], &s_graph.point);
}
graph_data[i].rditem = (graph_data[i].rditem + 1) % GRAPH_DATA_SIZE;
}
}
|
|