profile: remove fast argument of create_plot_info_new()

This prevented calculation of the pressure data when dragging
planner handles. However, this lead to weird artifacts.

As an alternative, if this turns out to be too slow, we might
disable the plotting of the pressure curves instead.

That said, even on my super-slow fanless laptop, this performs
reasonably.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-12-10 17:44:37 +01:00 committed by Dirk Hohndel
parent 352cdcc863
commit 2645fa1495
4 changed files with 7 additions and 9 deletions

View file

@ -1270,7 +1270,7 @@ void init_plot_info(struct plot_info *pi)
* The old data will be freed. Before the first call, the plot
* info must be initialized with init_plot_info().
*/
void create_plot_info_new(const struct dive *dive, const struct divecomputer *dc, struct plot_info *pi, bool fast, const struct deco_state *planner_ds)
void create_plot_info_new(const struct dive *dive, const struct divecomputer *dc, struct plot_info *pi, const struct deco_state *planner_ds)
{
int o2, he, o2max;
struct deco_state plot_deco_state;
@ -1294,10 +1294,8 @@ void create_plot_info_new(const struct dive *dive, const struct divecomputer *dc
check_setpoint_events(dive, dc, pi); /* Populate setpoints */
setup_gas_sensor_pressure(dive, dc, pi); /* Try to populate our gas pressure knowledge */
if (!fast) {
for (int cyl = 0; cyl < pi->nr_cylinders; cyl++)
populate_pressure_information(dive, dc, pi, cyl);
}
fill_o2_values(dive, dc, pi); /* .. and insert the O2 sensor data having 0 values. */
calculate_sac(dive, dc, pi); /* Calculate sac */

View file

@ -81,7 +81,7 @@ struct plot_data {
extern void compare_samples(const struct dive *d, const struct plot_info *pi, int idx1, int idx2, char *buf, int bufsize, bool sum);
extern void init_plot_info(struct plot_info *pi);
/* when planner_dc is non-null, this is called in planner mode. */
extern void create_plot_info_new(const struct dive *dive, const struct divecomputer *dc, struct plot_info *pi, bool fast, const struct deco_state *planner_ds);
extern void create_plot_info_new(const struct dive *dive, const struct divecomputer *dc, struct plot_info *pi, const struct deco_state *planner_ds);
extern int get_plot_details_new(const struct dive *d, const struct plot_info *pi, int time, struct membuffer *);
extern void free_plot_info_data(struct plot_info *pi);

View file

@ -213,7 +213,7 @@ static void save_profiles_buffer(struct membuffer *b, bool select_only)
for_each_dive(i, dive) {
if (select_only && !dive->selected)
continue;
create_plot_info_new(dive, &dive->dc, &pi, false, planner_deco_state);
create_plot_info_new(dive, &dive->dc, &pi, planner_deco_state);
put_headers(b, pi.nr_cylinders);
for (int i = 0; i < pi.nr; i++)
@ -229,7 +229,7 @@ void save_subtitles_buffer(struct membuffer *b, struct dive *dive, int offset, i
struct deco_state *planner_deco_state = NULL;
init_plot_info(&pi);
create_plot_info_new(dive, &dive->dc, &pi, false, planner_deco_state);
create_plot_info_new(dive, &dive->dc, &pi, planner_deco_state);
put_format(b, "[Script Info]\n");
put_format(b, "; Script generated by Subsurface %s\n", subsurface_canonical_version());

View file

@ -438,7 +438,7 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM
* create_plot_info_new() automatically frees old plot data.
*/
if (!keepPlotInfo)
create_plot_info_new(d, get_dive_dc_const(d, dc), &plotInfo, !calcMax, planner_ds);
create_plot_info_new(d, get_dive_dc_const(d, dc), &plotInfo, planner_ds);
bool hasHeartBeat = plotInfo.maxhr;
// For mobile we might want to turn of some features that are normally shown.