Authentication method changed. UCLouvain users, please use the "UCLouvain SSO" button to connect on the website and use ssh + ssh key (https://git.immc.ucl.ac.be/-/profile/keys) or https + personnal access token (https://git.immc.ucl.ac.be/-/profile/personal_access_tokens) in your git clients.

Commit a265190a authored by Nicolas Docquier's avatar Nicolas Docquier
Browse files

Merge branch 'sdl_plot_later_curve' into 'dev'

correct sdl plot when curves are not plotted at the beginning of the simu

See merge request !131
parents b106fb79 f7c88a62
......@@ -405,8 +405,9 @@ Screen_sdl* init_screen_sdl(Realtime_option *options)
*
* \param[in,out] screen_sdl SDL main data structure
* \param[in] nb_new_curves number of new curves
* \param[in] y_curves current y values
*/
void new_curves_save(Screen_sdl *screen_sdl, int nb_new_curves)
void new_curves_save(Screen_sdl *screen_sdl, int nb_new_curves, double *y_curves)
{
int i, j;
int cur_nb_curves, buffer_size;
......@@ -418,9 +419,14 @@ void new_curves_save(Screen_sdl *screen_sdl, int nb_new_curves)
{
screen_sdl->y_save[i] = (double*) malloc(buffer_size * sizeof(double));
for(j=0; j<buffer_size; j++)
for(j=0; j<=screen_sdl->min_tsim_index; j++)
{
screen_sdl->y_save[i][j] = 0.0;
screen_sdl->y_save[i][j] = y_curves[i];
}
for(j=screen_sdl->min_tsim_index+1; j<buffer_size; j++)
{
screen_sdl->y_save[i][j] = 0.0;
}
}
......@@ -823,7 +829,7 @@ void update_plot_vectors(Simu_realtime *realtime, double t)
update_scale_signals(screen_sdl, realtime, 0);
}
/*! \brief update 'y_tab' and 't_vec' for plot data durinf the breaks
/*! \brief update 'y_tab' and 't_vec' for plot data during the breaks
*
* \param[in,out] screen_sdl SDL main data structure
*/
......@@ -1326,23 +1332,21 @@ void update_full_vectors(Simu_realtime *realtime, double tsim)
nb_curves = auto_plot->nb;
if (!nb_curves)
// at least one curve to draw
if (nb_curves > 0)
{
screen_sdl->max_tsim = tsim;
return;
screen_sdl->flag_started = 1;
}
if (auto_plot->nb_new_curves > 0)
{
new_curves_save(screen_sdl, auto_plot->nb_new_curves);
new_curves_save(screen_sdl, auto_plot->nb_new_curves, y_curves);
auto_plot->nb_new_curves = 0;
update_sdl_legend(realtime, auto_plot->nb);
}
screen_sdl->flag_started = 1;
min_tsim_index = screen_sdl->min_tsim_index;
buffer_size = screen_sdl->buffer_size;
......@@ -2055,7 +2059,7 @@ void plot_screen_sdl(Simu_realtime *realtime, double tsim, int screen_flag)
if (screen_sdl->auto_plot->nb_new_curves > 0)
{
new_curves_save(screen_sdl, screen_sdl->auto_plot->nb_new_curves);
new_curves_save(screen_sdl, screen_sdl->auto_plot->nb_new_curves, screen_sdl->auto_plot->y_curves);
screen_sdl->auto_plot->nb_new_curves = 0;
......
......@@ -250,7 +250,7 @@ typedef struct Screen_sdl
void wait_key_generic(Simu_realtime *realtime, int cur_t_usec, double tsim);
Screen_sdl* init_screen_sdl(Realtime_option *options);
void new_curves_save(Screen_sdl *screen_sdl, int nb_new_curves);
void new_curves_save(Screen_sdl *screen_sdl, int nb_new_curves, double *y_curves);
TTF_Font* init_font(char *folder, int font_size);
void free_screen_sdl(Screen_sdl *screen_sdl);
......
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