mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 02:43:23 +00:00
Don't assume that pressures are always positive
When planning a dive, the dive could use more gas than is in the cylinder. So getting a negative end pressure is a useful indication to the user that there plan might not be a good one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
45725d1c30
commit
56395b3894
5 changed files with 7 additions and 7 deletions
4
dive.c
4
dive.c
|
@ -76,7 +76,7 @@ void remove_event(struct event* event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_pressure_units(unsigned int mb, const char **units)
|
int get_pressure_units(int mb, const char **units)
|
||||||
{
|
{
|
||||||
int pressure;
|
int pressure;
|
||||||
const char *unit;
|
const char *unit;
|
||||||
|
@ -454,7 +454,7 @@ void per_cylinder_mean_depth(struct dive *dive, struct divecomputer *dc, int *me
|
||||||
|
|
||||||
static void fixup_pressure(struct dive *dive, struct sample *sample)
|
static void fixup_pressure(struct dive *dive, struct sample *sample)
|
||||||
{
|
{
|
||||||
unsigned int pressure, index;
|
int pressure, index;
|
||||||
cylinder_t *cyl;
|
cylinder_t *cyl;
|
||||||
|
|
||||||
pressure = sample->cylinderpressure.mbar;
|
pressure = sample->cylinderpressure.mbar;
|
||||||
|
|
2
dive.h
2
dive.h
|
@ -68,7 +68,7 @@ typedef struct
|
||||||
const char *description; /* "integrated", "belt", "ankle" */
|
const char *description; /* "integrated", "belt", "ankle" */
|
||||||
} weightsystem_t;
|
} weightsystem_t;
|
||||||
|
|
||||||
extern int get_pressure_units(unsigned int mb, const char **units);
|
extern int get_pressure_units(int mb, const char **units);
|
||||||
extern double get_depth_units(int mm, int *frac, const char **units);
|
extern double get_depth_units(int mm, int *frac, const char **units);
|
||||||
extern double get_volume_units(unsigned int ml, int *frac, const char **units);
|
extern double get_volume_units(unsigned int ml, int *frac, const char **units);
|
||||||
extern double get_temp_units(unsigned int mk, const char **units);
|
extern double get_temp_units(unsigned int mk, const char **units);
|
||||||
|
|
|
@ -19,7 +19,7 @@ QString get_weight_unit();
|
||||||
QString get_cylinder_used_gas_string(cylinder_t *cyl, bool showunit = false);
|
QString get_cylinder_used_gas_string(cylinder_t *cyl, bool showunit = false);
|
||||||
QString get_temperature_string(temperature_t temp, bool showunit = false);
|
QString get_temperature_string(temperature_t temp, bool showunit = false);
|
||||||
QString get_temp_unit();
|
QString get_temp_unit();
|
||||||
QString get_volume_string(volume_t volume, bool showunit = false, unsigned int mbar = 0);
|
QString get_volume_string(volume_t volume, bool showunit = false, int mbar = 0);
|
||||||
QString get_volume_unit();
|
QString get_volume_unit();
|
||||||
QString get_pressure_string(pressure_t pressure, bool showunit = false);
|
QString get_pressure_string(pressure_t pressure, bool showunit = false);
|
||||||
QString get_pressure_unit();
|
QString get_pressure_unit();
|
||||||
|
|
|
@ -683,7 +683,7 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer
|
||||||
|
|
||||||
/* Get the per-cylinder maximum pressure if they are manual */
|
/* Get the per-cylinder maximum pressure if they are manual */
|
||||||
for (cyl = 0; cyl < MAX_CYLINDERS; cyl++) {
|
for (cyl = 0; cyl < MAX_CYLINDERS; cyl++) {
|
||||||
unsigned int mbar = dive->cylinder[cyl].start.mbar;
|
int mbar = dive->cylinder[cyl].start.mbar;
|
||||||
if (mbar > maxpressure)
|
if (mbar > maxpressure)
|
||||||
maxpressure = mbar;
|
maxpressure = mbar;
|
||||||
if (mbar < minpressure)
|
if (mbar < minpressure)
|
||||||
|
@ -964,7 +964,7 @@ static void populate_pressure_information(struct dive *dive, struct divecomputer
|
||||||
current = NULL;
|
current = NULL;
|
||||||
for (i = 0; i < pi->nr; i++) {
|
for (i = 0; i < pi->nr; i++) {
|
||||||
struct plot_data *entry = pi->entry + i;
|
struct plot_data *entry = pi->entry + i;
|
||||||
unsigned pressure = SENSOR_PRESSURE(entry);
|
int pressure = SENSOR_PRESSURE(entry);
|
||||||
|
|
||||||
/* discrete integration of pressure over time to get the SAC rate equivalent */
|
/* discrete integration of pressure over time to get the SAC rate equivalent */
|
||||||
if (current) {
|
if (current) {
|
||||||
|
|
|
@ -286,7 +286,7 @@ QString get_temp_unit()
|
||||||
return QString(UTF8_DEGREE "F");
|
return QString(UTF8_DEGREE "F");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString get_volume_string(volume_t volume, bool showunit, unsigned int mbar)
|
QString get_volume_string(volume_t volume, bool showunit, int mbar)
|
||||||
{
|
{
|
||||||
if (prefs.units.volume == units::LITER) {
|
if (prefs.units.volume == units::LITER) {
|
||||||
double liter = volume.mliter / 1000.0;
|
double liter = volume.mliter / 1000.0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue