diff options
-rw-r--r-- | subsurface-core/deco.c | 18 | ||||
-rw-r--r-- | subsurface-core/deco.h | 1 | ||||
-rw-r--r-- | subsurface-core/dive.c | 2 | ||||
-rw-r--r-- | subsurface-core/dive.h | 5 | ||||
-rw-r--r-- | subsurface-core/planner.c | 11 |
5 files changed, 19 insertions, 18 deletions
diff --git a/subsurface-core/deco.c b/subsurface-core/deco.c index dff88d338..3cd8c4a16 100644 --- a/subsurface-core/deco.c +++ b/subsurface-core/deco.c @@ -34,13 +34,13 @@ extern pressure_t first_ceiling_pressure; //! Option structure for Buehlmann decompression. struct buehlmann_config { - double satmult; //! safety at inert gas accumulation as percentage of effect (more than 100). - double desatmult; //! safety at inert gas depletion as percentage of effect (less than 100). - unsigned int last_deco_stop_in_mtr; //! depth of last_deco_stop. - double gf_high; //! gradient factor high (at surface). - double gf_low; //! gradient factor low (at bottom/start of deco calculation). - double gf_low_position_min; //! gf_low_position below surface_min_shallow. - bool gf_low_at_maxdepth; //! if true, gf_low applies at max depth instead of at deepest ceiling. + double satmult; //! safety at inert gas accumulation as percentage of effect (more than 100). + double desatmult; //! safety at inert gas depletion as percentage of effect (less than 100). + int last_deco_stop_in_mtr; //! depth of last_deco_stop. + double gf_high; //! gradient factor high (at surface). + double gf_low; //! gradient factor low (at bottom/start of deco calculation). + double gf_low_position_min; //! gf_low_position below surface_min_shallow. + bool gf_low_at_maxdepth; //! if true, gf_low applies at max depth instead of at deepest ceiling. }; struct buehlmann_config buehlmann_config = { @@ -572,9 +572,9 @@ void restore_deco_state(char *data) memcpy(&ci_pointing_to_guiding_tissue, data, sizeof(int)); } -unsigned int deco_allowed_depth(double tissues_tolerance, double surface_pressure, struct dive *dive, bool smooth) +int deco_allowed_depth(double tissues_tolerance, double surface_pressure, struct dive *dive, bool smooth) { - unsigned int depth; + int depth; double pressure_delta; /* Avoid negative depths */ diff --git a/subsurface-core/deco.h b/subsurface-core/deco.h index 08ff93422..fd3b94a9f 100644 --- a/subsurface-core/deco.h +++ b/subsurface-core/deco.h @@ -11,6 +11,7 @@ extern double tissue_inertgas_saturation[16]; extern double buehlmann_inertgas_a[16], buehlmann_inertgas_b[16]; extern double gf_low_pressure_this_dive; +extern int deco_allowed_depth(double tissues_tolerance, double surface_pressure, struct dive *dive, bool smooth); #ifdef __cplusplus } diff --git a/subsurface-core/dive.c b/subsurface-core/dive.c index cad2a85cc..ccb27aaf7 100644 --- a/subsurface-core/dive.c +++ b/subsurface-core/dive.c @@ -3252,7 +3252,7 @@ void set_informational_units(char *units) } } -void average_max_depth(struct diveplan *dive, unsigned int *avg_depth, unsigned int *max_depth) +void average_max_depth(struct diveplan *dive, int *avg_depth, int *max_depth) { int integral = 0; int last_time = 0; diff --git a/subsurface-core/dive.h b/subsurface-core/dive.h index 484a67f8a..d52ef5272 100644 --- a/subsurface-core/dive.h +++ b/subsurface-core/dive.h @@ -793,7 +793,6 @@ extern void subsurface_command_line_exit(int *, char ***); extern void add_segment(double pressure, const struct gasmix *gasmix, int period_in_seconds, int setpoint, const struct dive *dive, int sac); extern void clear_deco(double surface_pressure); extern void dump_tissues(void); -extern unsigned int deco_allowed_depth(double tissues_tolerance, double surface_pressure, struct dive *dive, bool smooth); extern void set_gf(short gflow, short gfhigh, bool gf_low_at_maxdepth); extern void cache_deco_state(char **datap); extern void restore_deco_state(char *data); @@ -805,7 +804,7 @@ extern double tissue_tolerance_calc(const struct dive *dive, double pressure); /* this should be converted to use our types */ struct divedatapoint { int time; - unsigned int depth; + int depth; struct gasmix gasmix; int setpoint; bool entered; @@ -893,7 +892,7 @@ extern depth_t string_to_depth(const char *str); extern pressure_t string_to_pressure(const char *str); extern volume_t string_to_volume(const char *str, pressure_t workp); extern fraction_t string_to_fraction(const char *str); -extern void average_max_depth(struct diveplan *dive, unsigned int *avg_depth, unsigned int *max_depth); +extern void average_max_depth(struct diveplan *dive, int *avg_depth, int *max_depth); #include "pref.h" diff --git a/subsurface-core/planner.c b/subsurface-core/planner.c index 6649f72ef..705aad1cb 100644 --- a/subsurface-core/planner.c +++ b/subsurface-core/planner.c @@ -9,6 +9,7 @@ #include <ctype.h> #include <string.h> #include "dive.h" +#include "deco.h" #include "divelist.h" #include "planner.h" #include "gettext.h" @@ -103,7 +104,7 @@ int get_gasidx(struct dive *dive, struct gasmix *mix) void interpolate_transition(struct dive *dive, duration_t t0, duration_t t1, depth_t d0, depth_t d1, const struct gasmix *gasmix, o2pressure_t po2) { - int j; + uint32_t j; for (j = t0.seconds; j < t1.seconds; j++) { int depth = interpolate(d0.mm, d1.mm, j - t0.seconds, t1.seconds - t0.seconds); @@ -476,11 +477,11 @@ static struct gaschanges *analyze_gaslist(struct diveplan *diveplan, int *gascha } /* sort all the stops into one ordered list */ -static unsigned int *sort_stops(int *dstops, int dnr, struct gaschanges *gstops, int gnr) +static int *sort_stops(int *dstops, int dnr, struct gaschanges *gstops, int gnr) { int i, gi, di; int total = dnr + gnr; - unsigned int *stoplevels = malloc(total * sizeof(int)); + int *stoplevels = malloc(total * sizeof(int)); /* no gaschanges */ if (gnr == 0) { @@ -981,13 +982,13 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool int po2; int transitiontime, gi; int current_cylinder; - unsigned int stopidx; + int stopidx; int depth; struct gaschanges *gaschanges = NULL; int gaschangenr; int *decostoplevels; int decostoplevelcount; - unsigned int *stoplevels = NULL; + int *stoplevels = NULL; bool stopping = false; bool pendinggaschange = false; int clock, previous_point_time; |