BigW Consortium Gitlab

Commit dda1a381 by Gabor Kiss-Vamosi

chart:init_points and set_points added

parent d239b319
......@@ -260,16 +260,18 @@ static void lv_refr_area_with_vdb(const lv_area_t * area_p)
/*Calculate the max row num*/
lv_coord_t w = lv_area_get_width(area_p);
lv_coord_t h = lv_area_get_height(area_p);
lv_coord_t x2;
lv_coord_t y2 = area_p->y2 >= LV_VER_RES ? y2 = LV_VER_RES - 1 : area_p->y2;
lv_coord_t max_row = (uint32_t) LV_VDB_SIZE / (w << LV_AA);
uint32_t max_row = (uint32_t) LV_VDB_SIZE / (w << LV_AA);
if(max_row > (h << LV_AA)) max_row = (h << LV_AA);
max_row = max_row >> LV_AA ;
/*Always use the full row*/
lv_coord_t row;
uint32_t row;
lv_coord_t row_last = 0;
for(row = area_p->y1; row + max_row - 1 <= area_p->y2; row += max_row) {
for(row = area_p->y1; row + max_row - 1 <= y2; row += max_row) {
lv_vdb_t * vdb_p = lv_vdb_get();
/*Calc. the next y coordinates of VDB*/
......@@ -277,19 +279,20 @@ static void lv_refr_area_with_vdb(const lv_area_t * area_p)
vdb_p->area.x2 = area_p->x2;
vdb_p->area.y1 = row;
vdb_p->area.y2 = row + max_row - 1;
row_last = row + max_row - 1;
if(vdb_p->area.y2 > y2) vdb_p->area.y2 = y2;
row_last = vdb_p->area.y2;
lv_refr_area_part_vdb(area_p);
}
/*If the last y coordinates are not handled yet ...*/
if(area_p->y2 != row_last) {
if(y2 != row_last) {
lv_vdb_t * vdb_p = lv_vdb_get();
/*Calc. the next y coordinates of VDB*/
vdb_p->area.x1 = area_p->x1;
vdb_p->area.x2 = area_p->x2;
vdb_p->area.y1 = row;
vdb_p->area.y2 = area_p->y2;
vdb_p->area.y2 = y2;
/*Refresh this part too*/
lv_refr_area_part_vdb(area_p);
......
......@@ -260,6 +260,35 @@ void lv_chart_set_series_darking(lv_obj_t * chart, lv_opa_t dark_eff)
}
/**
* Initialize all data points with a value
* @param chart pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param y the new value for all points
*/
void lv_chart_init_points(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t y)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
uint16_t i;
for(i = 0; i < ext->point_cnt; i++) {
ser->points[i] = y;
}
lv_chart_refresh(chart);
}
/**
* Set the value s of points from an array
* @param chart pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param y_array array of 'lv_coord_t' points (with 'points count' elements )
*/
void lv_chart_set_points(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t * y_array)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
memcpy(ser->points, y_array, ext->point_cnt * (sizeof(lv_coord_t)));
lv_chart_refresh(chart);
}
/**
* Shift all data right and set the most right data on a data line
* @param chart pointer to chart object
* @param ser pointer to a data series on 'chart'
......
......@@ -141,6 +141,22 @@ void lv_chart_set_series_width(lv_obj_t * chart, lv_coord_t width);
void lv_chart_set_series_darking(lv_obj_t * chart, lv_opa_t dark_eff);
/**
* Initialize all data points with a value
* @param chart pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param y the new value for all points
*/
void lv_chart_init_points(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t y);
/**
* Set the value s of points from an array
* @param chart pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param y_array array of 'lv_coord_t' points (with 'points count' elements )
*/
void lv_chart_set_points(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t * y_array);
/**
* Shift all data right and set the most right data on a data line
* @param chart pointer to chart object
* @param ser pointer to a data series on 'chart'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment