diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-04-02 15:06:54 -0500 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-04-04 22:37:18 -0700 |
commit | e0824ef9f3e2a0cc0fae435b8e3560b309d9708e (patch) | |
tree | 4597890128bc8ebee2dfb4335dc5c9b855e4a68e /core/dive.h | |
parent | 7a444c0210783b926c9f60dd7b436eb086e8f396 (diff) | |
download | subsurface-e0824ef9f3e2a0cc0fae435b8e3560b309d9708e.tar.gz |
Make gas change events always have a cylinder index
In commit df4e26c8757a ("Start sanitizing gaschange event information")
back about a year and a half ago, I started sanitizing the gas switch
event data, allowing gas switches to be associated with a particular
cylinder index rather than just the gas mix that is switched to.
But that initial step only _allowed_ a gas switch event to be associated
with a particular cylinder, the primary model was still to just specify
the mix.
This finally takes the next step, and *always* associates a gas switch
event with a particular cylinder. Instead of then looking up the
cylinder by trying to match gas mixes at runtime, subsurface now looks
it up when loading the dive initially as part of the dive fixup code.
The switch event still has an a separate gas mix associated with it, but
this patch also starts preparing for entirely relying on the gas mix in
the cylinder itself, by starting to pass in not just the event but also
the dive pointer to the routines that look up gas mix details.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/dive.h')
-rw-r--r-- | core/dive.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/dive.h b/core/dive.h index e9dd4fb59..be721348c 100644 --- a/core/dive.h +++ b/core/dive.h @@ -115,7 +115,6 @@ struct event { }; extern int event_is_gaschange(struct event *ev); -extern int event_gasmix_redundant(struct event *ev); extern int get_pressure_units(int mb, const char **units); extern double get_depth_units(int mm, int *frac, const char **units); @@ -150,7 +149,7 @@ extern void fill_pressures(struct gas_pressures *pressures, const double amb_pre extern void sanitize_gasmix(struct gasmix *mix); extern int gasmix_distance(const struct gasmix *a, const struct gasmix *b); -extern struct gasmix *get_gasmix_from_event(struct event *ev); +extern int find_best_gasmix_match(struct gasmix *mix, cylinder_t array[], unsigned int used); static inline bool gasmix_is_air(const struct gasmix *gasmix) { @@ -757,6 +756,7 @@ extern void update_event_name(struct dive *d, struct event* event, char *name); extern void add_extra_data(struct divecomputer *dc, const char *key, const char *value); extern void per_cylinder_mean_depth(struct dive *dive, struct divecomputer *dc, int *mean, int *duration); extern int get_cylinder_index(struct dive *dive, struct event *ev); +extern struct gasmix *get_gasmix_from_event(struct dive *, struct event *ev); extern int nr_cylinders(struct dive *dive); extern int nr_weightsystems(struct dive *dive); @@ -896,7 +896,7 @@ extern void set_userid(char *user_id); extern void set_informational_units(char *units); extern const char *get_dive_date_c_string(timestamp_t when); -extern void update_setpoint_events(struct divecomputer *dc); +extern void update_setpoint_events(struct dive *dive, struct divecomputer *dc); #ifdef __cplusplus } #endif |