Implement bailout outside of the dive planner

This is the second step for implementing bailout. The indirect
calls to fill_pressures through add_segment() (in deco.c) are
addressed. Bailout is now fully implemented in the dive log but
not in the dive planner.
1) The parameters to add_segment() are changed to take a
   divemode as the second last parameter, and not a *dive.
2) Call to add_segment() in profile.c and in divelist.c are
   adapted. In divelist.c some calls to add_segment were left
   using dc-> divemode instead of possible bailout. This appears
   tp be the most appropriate route.
3) The functions get_divemode_from_time() and get_next_divemodechange()
   in dive.c have had some small changes.
4) The calls to get_segment(0 in planner.c were changed to reflect
   the new parameter list, but not updated to reflect bailout. This
   is the next step.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
This commit is contained in:
Willem Ferguson 2018-04-03 19:30:27 +02:00 committed by Lubomir I. Ivanov
parent cf377beb2e
commit 27a0542220
6 changed files with 58 additions and 38 deletions

View file

@ -83,6 +83,7 @@ struct event {
/* This is the annoying libdivecomputer format. */
int flags, value;
/* .. and this is our "extended" data for some event types */
enum dive_comp_type divemode;
union {
/*
* Currently only for gas switch events.
@ -91,7 +92,6 @@ struct event {
* case, the get_cylinder_index() function will give the best
* match with the cylinders in the dive based on gasmix.
*/
enum dive_comp_type divemode;
struct {
int index;
struct gasmix mix;
@ -854,7 +854,7 @@ struct deco_state {
bool icd_warning;
};
extern void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int setpoint, const struct dive *dive, int sac);
extern void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int setpoint, enum dive_comp_type divemode, int sac);
extern void clear_deco(struct deco_state *ds, double surface_pressure);
extern void dump_tissues(struct deco_state *ds);
extern void set_gf(short gflow, short gfhigh);