mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Unify sample pressure and o2pressure as pressure[2] array
We currently carry two pressures around for all the samples and plot info, but the second pressure is reserved for CCR dives as the O2 cylinder pressure. That's kind of annoying when we *could* use it for regular sidemount dives as the secondary pressure. So start prepping for that instead: don't make it "pressure" and "o2pressure", make it just be an array of two pressure values. NOTE! This is purely mindless prepwork. It literally just does a search-and-replace, keeping the exact same semantics, so "pressure[1]" is still just O2 pressure. But at some future date, we can now start using it for a second sensor value for sidemount instead. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
94d8abd1a2
commit
11a0c0cc70
17 changed files with 68 additions and 68 deletions
|
@ -585,7 +585,7 @@ static void cochran_parse_samples(struct dive *dive, const unsigned char *log,
|
|||
sample->stopdepth.mm = lrint(deco_ceiling * FEET * 1000);
|
||||
sample->temperature.mkelvin = C_to_mkelvin((temp - 32) / 1.8);
|
||||
sample->sensor = 0;
|
||||
sample->cylinderpressure.mbar = lrint(psi * PSI / 100);
|
||||
sample->pressure[0].mbar = lrint(psi * PSI / 100);
|
||||
|
||||
finish_sample(dc);
|
||||
|
||||
|
|
22
core/dive.c
22
core/dive.c
|
@ -1359,17 +1359,17 @@ static void simplify_dc_pressures(struct divecomputer *dc)
|
|||
|
||||
for (i = 0; i < dc->samples; i++) {
|
||||
struct sample *sample = dc->sample + i;
|
||||
int pressure = sample->cylinderpressure.mbar;
|
||||
int o2_pressure = sample->o2cylinderpressure.mbar;
|
||||
int pressure = sample->pressure[0].mbar;
|
||||
int o2_pressure = sample->pressure[1].mbar;
|
||||
int index;
|
||||
|
||||
index = sample->sensor;
|
||||
if (index == lastindex) {
|
||||
/* Remove duplicate redundant pressure information */
|
||||
if (pressure == lastpressure)
|
||||
sample->cylinderpressure.mbar = 0;
|
||||
sample->pressure[0].mbar = 0;
|
||||
if (o2_pressure == lasto2pressure)
|
||||
sample->o2cylinderpressure.mbar = 0;
|
||||
sample->pressure[1].mbar = 0;
|
||||
}
|
||||
lastindex = index;
|
||||
lastpressure = pressure;
|
||||
|
@ -1423,8 +1423,8 @@ static void fixup_dive_pressures(struct dive *dive, struct divecomputer *dc)
|
|||
if (sample->depth.mm < SURFACE_THRESHOLD)
|
||||
continue;
|
||||
|
||||
fixup_start_pressure(dive, sample->sensor, sample->cylinderpressure);
|
||||
fixup_start_pressure(dive, o2index, sample->o2cylinderpressure);
|
||||
fixup_start_pressure(dive, sample->sensor, sample->pressure[0]);
|
||||
fixup_start_pressure(dive, o2index, sample->pressure[1]);
|
||||
}
|
||||
|
||||
/* ..and from the end for ending pressures */
|
||||
|
@ -1434,8 +1434,8 @@ static void fixup_dive_pressures(struct dive *dive, struct divecomputer *dc)
|
|||
if (sample->depth.mm < SURFACE_THRESHOLD)
|
||||
continue;
|
||||
|
||||
fixup_end_pressure(dive, sample->sensor, sample->cylinderpressure);
|
||||
fixup_end_pressure(dive, o2index, sample->o2cylinderpressure);
|
||||
fixup_end_pressure(dive, sample->sensor, sample->pressure[0]);
|
||||
fixup_end_pressure(dive, o2index, sample->pressure[1]);
|
||||
}
|
||||
|
||||
simplify_dc_pressures(dc);
|
||||
|
@ -1713,8 +1713,8 @@ static void merge_samples(struct divecomputer *res, struct divecomputer *a, stru
|
|||
sample.depth = as->depth;
|
||||
if (as->temperature.mkelvin)
|
||||
sample.temperature = as->temperature;
|
||||
if (as->cylinderpressure.mbar)
|
||||
sample.cylinderpressure = as->cylinderpressure;
|
||||
if (as->pressure[0].mbar)
|
||||
sample.pressure[0] = as->pressure[0];
|
||||
if (as->sensor)
|
||||
sample.sensor = as->sensor;
|
||||
if (as->cns)
|
||||
|
@ -2625,7 +2625,7 @@ static int same_sample(struct sample *a, struct sample *b)
|
|||
return 0;
|
||||
if (a->temperature.mkelvin != b->temperature.mkelvin)
|
||||
return 0;
|
||||
if (a->cylinderpressure.mbar != b->cylinderpressure.mbar)
|
||||
if (a->pressure[0].mbar != b->pressure[0].mbar)
|
||||
return 0;
|
||||
return a->sensor == b->sensor;
|
||||
}
|
||||
|
|
|
@ -194,8 +194,7 @@ struct sample // BASE TYPE BYTES UNITS RANGE DE
|
|||
depth_t depth; // int32_t 4 mm (0-2000 km) dive depth of this sample
|
||||
depth_t stopdepth; // int32_t 4 mm (0-2000 km) depth of next deco stop
|
||||
temperature_t temperature; // int32_t 4 mdegrK (0-2 MdegK) ambient temperature
|
||||
pressure_t cylinderpressure; // int32_t 4 mbar (0-2 Mbar) main cylinder pressure
|
||||
pressure_t o2cylinderpressure; // int32_t 4 mbar (0-2 Mbar) CCR o2 cylinder pressure (rebreather)
|
||||
pressure_t pressure[2]; // int32_t 4 mbar (0-2 Mbar) cylinder pressures (main and CCR o2)
|
||||
o2pressure_t setpoint; // uint16_t 2 mbar (0-65 bar) O2 partial pressure (will be setpoint)
|
||||
o2pressure_t o2sensor[3]; // uint16_t 6 mbar (0-65 bar) Up to 3 PO2 sensor values (rebreather)
|
||||
bearing_t bearing; // int16_t 2 degrees (-32k to 32k deg) compass bearing
|
||||
|
|
|
@ -291,7 +291,7 @@ static void add_sample_data(struct sample *sample, enum csv_format type, double
|
|||
sample->temperature.mkelvin = F_to_mkelvin(val);
|
||||
break;
|
||||
case CSV_PRESSURE:
|
||||
sample->cylinderpressure.mbar = psi_to_mbar(val * 4);
|
||||
sample->pressure[0].mbar = psi_to_mbar(val * 4);
|
||||
break;
|
||||
case POSEIDON_DEPTH:
|
||||
sample->depth.mm = lrint(val * 0.5 * 1000);
|
||||
|
@ -309,10 +309,10 @@ static void add_sample_data(struct sample *sample, enum csv_format type, double
|
|||
sample->o2sensor[1].mbar = lrint(val * 10);
|
||||
break;
|
||||
case POSEIDON_PRESSURE:
|
||||
sample->cylinderpressure.mbar = lrint(val * 1000);
|
||||
sample->pressure[0].mbar = lrint(val * 1000);
|
||||
break;
|
||||
case POSEIDON_O2CYLINDER:
|
||||
sample->o2cylinderpressure.mbar = lrint(val * 1000);
|
||||
sample->pressure[1].mbar = lrint(val * 1000);
|
||||
break;
|
||||
case POSEIDON_NDL:
|
||||
sample->ndl.seconds = lrint(val * 60);
|
||||
|
|
|
@ -249,12 +249,12 @@ static void fill_missing_tank_pressures(struct dive *dive, struct plot_info *pi,
|
|||
if (cyl < 0)
|
||||
return; // Can we do this?!?
|
||||
pressure = O2CYLINDER_PRESSURE(entry);
|
||||
save_pressure = &(entry->o2cylinderpressure[SENSOR_PR]);
|
||||
save_interpolated = &(entry->o2cylinderpressure[INTERPOLATED_PR]);
|
||||
save_pressure = &(entry->pressure[1][SENSOR_PR]);
|
||||
save_interpolated = &(entry->pressure[1][INTERPOLATED_PR]);
|
||||
} else {
|
||||
pressure = SENSOR_PRESSURE(entry);
|
||||
save_pressure = &(entry->pressure[SENSOR_PR]);
|
||||
save_interpolated = &(entry->pressure[INTERPOLATED_PR]);
|
||||
save_pressure = &(entry->pressure[0][SENSOR_PR]);
|
||||
save_interpolated = &(entry->pressure[0][INTERPOLATED_PR]);
|
||||
cyl = entry->cylinderindex;
|
||||
}
|
||||
|
||||
|
|
|
@ -354,14 +354,14 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, void *userdata)
|
|||
break;
|
||||
case DC_SAMPLE_PRESSURE:
|
||||
/* Do we already have a pressure reading? */
|
||||
if (sample->cylinderpressure.mbar) {
|
||||
if (sample->pressure[0].mbar) {
|
||||
/* Do we prefer the one we already have? */
|
||||
/* If so, just ignore the new one */
|
||||
if (sample->sensor == current_gas_index)
|
||||
break;
|
||||
}
|
||||
sample->sensor = value.pressure.tank;
|
||||
sample->cylinderpressure.mbar = lrint(value.pressure.value * 1000);
|
||||
sample->pressure[0].mbar = lrint(value.pressure.value * 1000);
|
||||
break;
|
||||
case DC_SAMPLE_GASMIX:
|
||||
handle_gasmix(dc, sample, value.gasmix);
|
||||
|
|
|
@ -335,7 +335,7 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int
|
|||
sample->depth.mm = array_uint16_le(ds + (d - 1) * 2) * 10; // cm->mm
|
||||
sample->temperature.mkelvin = C_to_mkelvin((float) array_uint16_le(ts + (d - 1) * 2) / 10); // dC->mK
|
||||
sample->sensor = event.pressure.sensor;
|
||||
sample->cylinderpressure.mbar = event.pressure.mbar;
|
||||
sample->pressure[0].mbar = event.pressure.mbar;
|
||||
finish_sample(dc);
|
||||
|
||||
break;
|
||||
|
@ -353,7 +353,7 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int
|
|||
sample->depth.mm = depth_mm;
|
||||
sample->temperature.mkelvin = temp_mk;
|
||||
sample->sensor = event.pressure.sensor;
|
||||
sample->cylinderpressure.mbar = event.pressure.mbar;
|
||||
sample->pressure[0].mbar = event.pressure.mbar;
|
||||
finish_sample(dc);
|
||||
d++;
|
||||
|
||||
|
@ -361,7 +361,7 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int
|
|||
} else { // Event is prior to sample
|
||||
sample->time.seconds = event.time;
|
||||
sample->sensor = event.pressure.sensor;
|
||||
sample->cylinderpressure.mbar = event.pressure.mbar;
|
||||
sample->pressure[0].mbar = event.pressure.mbar;
|
||||
if (last_time == sample_time) {
|
||||
sample->depth.mm = depth_mm;
|
||||
sample->temperature.mkelvin = temp_mk;
|
||||
|
|
|
@ -540,7 +540,7 @@ static void parse_sample_keyvalue(void *_sample, const char *key, const char *va
|
|||
}
|
||||
if (!strcmp(key, "o2pressure")) {
|
||||
pressure_t p = get_pressure(value);
|
||||
sample->o2cylinderpressure.mbar = p.mbar;
|
||||
sample->pressure[1].mbar = p.mbar;
|
||||
return;
|
||||
}
|
||||
if (!strcmp(key, "heartbeat")) {
|
||||
|
@ -574,7 +574,7 @@ static char *parse_sample_unit(struct sample *sample, double val, char *unit)
|
|||
sample->depth.mm = lrint(1000*val);
|
||||
break;
|
||||
case 'b':
|
||||
sample->cylinderpressure.mbar = lrint(1000*val);
|
||||
sample->pressure[0].mbar = lrint(1000*val);
|
||||
break;
|
||||
default:
|
||||
sample->temperature.mkelvin = C_to_mkelvin(val);
|
||||
|
@ -600,7 +600,7 @@ static struct sample *new_sample(struct divecomputer *dc)
|
|||
struct sample *sample = prepare_sample(dc);
|
||||
if (sample != dc->sample) {
|
||||
memcpy(sample, sample-1, sizeof(struct sample));
|
||||
sample->cylinderpressure.mbar = 0;
|
||||
sample->pressure[0].mbar = 0;
|
||||
}
|
||||
return sample;
|
||||
}
|
||||
|
|
|
@ -712,7 +712,7 @@ static int divinglog_fill_sample(struct sample *sample, const char *name, char *
|
|||
return MATCH("time.p", sampletime, &sample->time) ||
|
||||
MATCH("depth.p", depth, &sample->depth) ||
|
||||
MATCH("temp.p", fahrenheit, &sample->temperature) ||
|
||||
MATCH("press1.p", psi_or_bar, &sample->cylinderpressure) ||
|
||||
MATCH("press1.p", psi_or_bar, &sample->pressure[0]) ||
|
||||
0;
|
||||
}
|
||||
|
||||
|
@ -731,7 +731,7 @@ static int uddf_fill_sample(struct sample *sample, const char *name, char *buf)
|
|||
return MATCH("divetime", sampletime, &sample->time) ||
|
||||
MATCH("depth", depth, &sample->depth) ||
|
||||
MATCH("temperature", temperature, &sample->temperature) ||
|
||||
MATCH("tankpressure", pressure, &sample->cylinderpressure) ||
|
||||
MATCH("tankpressure", pressure, &sample->pressure[0]) ||
|
||||
MATCH("ref.switchmix", uddf_gasswitch, sample) ||
|
||||
0;
|
||||
}
|
||||
|
@ -927,13 +927,13 @@ static void try_to_fill_sample(struct sample *sample, const char *name, char *bu
|
|||
int in_deco;
|
||||
|
||||
start_match("sample", name, buf);
|
||||
if (MATCH("pressure.sample", pressure, &sample->cylinderpressure))
|
||||
if (MATCH("pressure.sample", pressure, &sample->pressure[0]))
|
||||
return;
|
||||
if (MATCH("cylpress.sample", pressure, &sample->cylinderpressure))
|
||||
if (MATCH("cylpress.sample", pressure, &sample->pressure[0]))
|
||||
return;
|
||||
if (MATCH("pdiluent.sample", pressure, &sample->cylinderpressure))
|
||||
if (MATCH("pdiluent.sample", pressure, &sample->pressure[0]))
|
||||
return;
|
||||
if (MATCH("o2pressure.sample", pressure, &sample->o2cylinderpressure))
|
||||
if (MATCH("o2pressure.sample", pressure, &sample->pressure[1]))
|
||||
return;
|
||||
if (MATCH("cylinderindex.sample", get_cylinderindex, &sample->sensor))
|
||||
return;
|
||||
|
@ -2364,7 +2364,7 @@ extern int dm4_dive(void *param, int columns, char **data, char **column)
|
|||
if (data[18] && data[18][0])
|
||||
cur_sample->temperature.mkelvin = C_to_mkelvin(tempBlob[i]);
|
||||
if (data[19] && data[19][0])
|
||||
cur_sample->cylinderpressure.mbar = pressureBlob[i];
|
||||
cur_sample->pressure[0].mbar = pressureBlob[i];
|
||||
sample_end();
|
||||
}
|
||||
|
||||
|
@ -2498,7 +2498,7 @@ extern int dm5_dive(void *param, int columns, char **data, char **column)
|
|||
if (temp >= -10 && temp < 50)
|
||||
cur_sample->temperature.mkelvin = C_to_mkelvin(temp);
|
||||
if (pressure >= 0 && pressure < 350000)
|
||||
cur_sample->cylinderpressure.mbar = pressure;
|
||||
cur_sample->pressure[0].mbar = pressure;
|
||||
sample_end();
|
||||
}
|
||||
|
||||
|
@ -2526,7 +2526,7 @@ extern int dm5_dive(void *param, int columns, char **data, char **column)
|
|||
if (data[18] && data[18][0])
|
||||
cur_sample->temperature.mkelvin = C_to_mkelvin(tempBlob[i]);
|
||||
if (data[19] && data[19][0])
|
||||
cur_sample->cylinderpressure.mbar = pressureBlob[i];
|
||||
cur_sample->pressure[0].mbar = pressureBlob[i];
|
||||
sample_end();
|
||||
}
|
||||
}
|
||||
|
@ -2687,7 +2687,7 @@ extern int shearwater_profile_sample(void *handle, int columns, char **data, cha
|
|||
/* We don't actually have data[3], but it should appear in the
|
||||
* SQL query at some point.
|
||||
if (data[3])
|
||||
cur_sample->cylinderpressure.mbar = metric ? atoi(data[3]) * 1000 : psi_to_mbar(atoi(data[3]));
|
||||
cur_sample->pressure[0].mbar = metric ? atoi(data[3]) * 1000 : psi_to_mbar(atoi(data[3]));
|
||||
*/
|
||||
sample_end();
|
||||
|
||||
|
@ -3137,7 +3137,7 @@ extern int divinglog_profile(void *handle, int columns, char **data, char **colu
|
|||
|
||||
if (data[2]) {
|
||||
memcpy(pres, &data[2][i * 11 + 3], 4);
|
||||
cur_sample->cylinderpressure.mbar = atoi(pres) * 100;
|
||||
cur_sample->pressure[0].mbar = atoi(pres) * 100;
|
||||
}
|
||||
|
||||
if (data[3] && strlen(data[3])) {
|
||||
|
|
|
@ -296,7 +296,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
|
|||
sample->sac.mliter = prefs.bottomsac;
|
||||
oldpo2 = dp->setpoint;
|
||||
if (track_gas && cyl->type.workingpressure.mbar)
|
||||
sample->cylinderpressure.mbar = cyl->end.mbar;
|
||||
sample->pressure[0].mbar = cyl->end.mbar;
|
||||
sample->manually_entered = true;
|
||||
finish_sample(dc);
|
||||
while (dp) {
|
||||
|
@ -334,7 +334,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
|
|||
sample->manually_entered = dp->entered;
|
||||
sample->sac.mliter = dp->entered ? prefs.bottomsac : prefs.decosac;
|
||||
if (track_gas && cyl->type.workingpressure.mbar)
|
||||
sample->cylinderpressure.mbar = cyl->sample_end.mbar;
|
||||
sample->pressure[0].mbar = cyl->sample_end.mbar;
|
||||
finish_sample(dc);
|
||||
lastcylid = dp->cylinderid;
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
|
|||
update_cylinder_pressure(&displayed_dive, sample[-1].depth.mm, depth.mm, time - sample[-1].time.seconds,
|
||||
dp->entered ? diveplan->bottomsac : diveplan->decosac, cyl, !dp->entered);
|
||||
if (cyl->type.workingpressure.mbar)
|
||||
sample->cylinderpressure.mbar = cyl->end.mbar;
|
||||
sample->pressure[0].mbar = cyl->end.mbar;
|
||||
}
|
||||
finish_sample(dc);
|
||||
dp = dp->next;
|
||||
|
|
|
@ -370,7 +370,7 @@ static int set_cylinder_index(struct plot_info *pi, int i, int cylinderindex, in
|
|||
break;
|
||||
if (entry->cylinderindex != cylinderindex) {
|
||||
entry->cylinderindex = cylinderindex;
|
||||
entry->pressure[0] = 0;
|
||||
entry->pressure[0][0] = 0;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer
|
|||
|
||||
while (--i >= 0) {
|
||||
int depth = s->depth.mm;
|
||||
int pressure = s->cylinderpressure.mbar;
|
||||
int pressure = s->pressure[0].mbar;
|
||||
int temperature = s->temperature.mkelvin;
|
||||
int heartbeat = s->heartbeat;
|
||||
|
||||
|
@ -641,8 +641,8 @@ struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *
|
|||
}
|
||||
/* FIXME! sensor index -> cylinder index translation! */
|
||||
// entry->cylinderindex = sample->sensor;
|
||||
SENSOR_PRESSURE(entry) = sample->cylinderpressure.mbar;
|
||||
O2CYLINDER_PRESSURE(entry) = sample->o2cylinderpressure.mbar;
|
||||
SENSOR_PRESSURE(entry) = sample->pressure[0].mbar;
|
||||
O2CYLINDER_PRESSURE(entry) = sample->pressure[1].mbar;
|
||||
if (sample->temperature.mkelvin)
|
||||
entry->temperature = lasttemp = sample->temperature.mkelvin;
|
||||
else
|
||||
|
|
|
@ -23,12 +23,13 @@ struct plot_data {
|
|||
unsigned int in_deco : 1;
|
||||
int cylinderindex;
|
||||
int sec;
|
||||
/* pressure[0] is sensor cylinder pressure [when CCR, the pressure of the diluent cylinder]
|
||||
* pressure[1] is interpolated cylinder pressure */
|
||||
int pressure[2];
|
||||
/* o2pressure[0] is o2 cylinder pressure [CCR]
|
||||
* o2pressure[1] is interpolated o2 cylinder pressure [CCR] */
|
||||
int o2cylinderpressure[2];
|
||||
/* pressure[0] is main sensor pressure (diluent for CCR)
|
||||
* pressure[1] is secondary sensor pressure (O2 for CCR)
|
||||
*
|
||||
* pressure[x][0] is sensor pressure
|
||||
* pressure[x][1] is interpolated pressure
|
||||
*/
|
||||
int pressure[2][2];
|
||||
int temperature;
|
||||
/* Depth info */
|
||||
int depth;
|
||||
|
@ -97,11 +98,11 @@ int get_maxdepth(struct plot_info *pi);
|
|||
|
||||
#define SENSOR_PR 0
|
||||
#define INTERPOLATED_PR 1
|
||||
#define SENSOR_PRESSURE(_entry) (_entry)->pressure[SENSOR_PR]
|
||||
#define O2CYLINDER_PRESSURE(_entry) (_entry)->o2cylinderpressure[SENSOR_PR]
|
||||
#define SENSOR_PRESSURE(_entry) (_entry)->pressure[0][SENSOR_PR]
|
||||
#define O2CYLINDER_PRESSURE(_entry) (_entry)->pressure[1][SENSOR_PR]
|
||||
#define CYLINDER_PRESSURE(_o2, _entry) (_o2 ? O2CYLINDER_PRESSURE(_entry) : SENSOR_PRESSURE(_entry))
|
||||
#define INTERPOLATED_PRESSURE(_entry) (_entry)->pressure[INTERPOLATED_PR]
|
||||
#define INTERPOLATED_O2CYLINDER_PRESSURE(_entry) (_entry)->o2cylinderpressure[INTERPOLATED_PR]
|
||||
#define INTERPOLATED_PRESSURE(_entry) (_entry)->pressure[0][INTERPOLATED_PR]
|
||||
#define INTERPOLATED_O2CYLINDER_PRESSURE(_entry) (_entry)->pressure[1][INTERPOLATED_PR]
|
||||
#define GET_PRESSURE(_entry) (SENSOR_PRESSURE(_entry) ? SENSOR_PRESSURE(_entry) : INTERPOLATED_PRESSURE(_entry))
|
||||
#define GET_O2CYLINDER_PRESSURE(_entry) (O2CYLINDER_PRESSURE(_entry) ? O2CYLINDER_PRESSURE(_entry) : INTERPOLATED_O2CYLINDER_PRESSURE(_entry))
|
||||
#define SAC_WINDOW 45 /* sliding window in seconds for current SAC calculation */
|
||||
|
|
|
@ -246,14 +246,14 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl
|
|||
put_format(b, "%3u:%02u", FRACTION(sample->time.seconds, 60));
|
||||
put_milli(b, " ", sample->depth.mm, "m");
|
||||
put_temperature(b, sample->temperature, " ", "°C");
|
||||
put_pressure(b, sample->cylinderpressure, " ", "bar");
|
||||
put_pressure(b, sample->o2cylinderpressure," o2pressure=","bar");
|
||||
put_pressure(b, sample->pressure[0], " ", "bar");
|
||||
put_pressure(b, sample->pressure[1]," o2pressure=","bar");
|
||||
|
||||
/*
|
||||
* We only show sensor information for samples with pressure, and only if it
|
||||
* changed from the previous sensor we showed.
|
||||
*/
|
||||
if (sample->cylinderpressure.mbar && sample->sensor != old->sensor) {
|
||||
if (sample->pressure[0].mbar && sample->sensor != old->sensor) {
|
||||
put_format(b, " sensor=%d", sample->sensor);
|
||||
old->sensor = sample->sensor;
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ void put_HTML_samples(struct membuffer *b, struct dive *dive)
|
|||
|
||||
char *separator = "\"samples\":[";
|
||||
for (i = 0; i < dive->dc.samples; i++) {
|
||||
put_format(b, "%s[%d,%d,%d,%d]", separator, s->time.seconds, s->depth.mm, s->cylinderpressure.mbar, s->temperature.mkelvin);
|
||||
put_format(b, "%s[%d,%d,%d,%d]", separator, s->time.seconds, s->depth.mm, s->pressure[0].mbar, s->temperature.mkelvin);
|
||||
separator = ", ";
|
||||
s++;
|
||||
}
|
||||
|
|
|
@ -200,14 +200,14 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl
|
|||
put_temperature(b, sample->temperature, " temp='", " C'");
|
||||
old->temperature = sample->temperature;
|
||||
}
|
||||
put_pressure(b, sample->cylinderpressure, " pressure='", " bar'");
|
||||
put_pressure(b, sample->o2cylinderpressure, " o2pressure='", " bar'");
|
||||
put_pressure(b, sample->pressure[0], " pressure='", " bar'");
|
||||
put_pressure(b, sample->pressure[1], " o2pressure='", " bar'");
|
||||
|
||||
/*
|
||||
* We only show sensor information for samples with pressure, and only if it
|
||||
* changed from the previous sensor we showed.
|
||||
*/
|
||||
if (sample->cylinderpressure.mbar && sample->sensor != old->sensor) {
|
||||
if (sample->pressure[0].mbar && sample->sensor != old->sensor) {
|
||||
put_format(b, " sensor='%d'", sample->sensor);
|
||||
old->sensor = sample->sensor;
|
||||
}
|
||||
|
|
|
@ -360,7 +360,7 @@ void uemis_parse_divelog_binary(char *base64, void *datap)
|
|||
sample->depth.mm = rel_mbar_to_depth(u_sample->water_pressure, dive);
|
||||
sample->temperature.mkelvin = C_to_mkelvin(u_sample->dive_temperature / 10.0);
|
||||
sample->sensor = active;
|
||||
sample->cylinderpressure.mbar =
|
||||
sample->pressure[0].mbar =
|
||||
(u_sample->tank_pressure_high * 256 + u_sample->tank_pressure_low) * 10;
|
||||
sample->cns = u_sample->cns;
|
||||
uemis_event(dive, dc, sample, u_sample);
|
||||
|
|
|
@ -32,7 +32,7 @@ QVariant DivePlotDataModel::data(const QModelIndex &index, int role) const
|
|||
case TIME:
|
||||
return item.sec;
|
||||
case PRESSURE:
|
||||
return item.pressure[0];
|
||||
return item.pressure[0][0];
|
||||
case TEMPERATURE:
|
||||
return item.temperature;
|
||||
case COLOR:
|
||||
|
@ -42,9 +42,9 @@ QVariant DivePlotDataModel::data(const QModelIndex &index, int role) const
|
|||
case CYLINDERINDEX:
|
||||
return item.cylinderindex;
|
||||
case SENSOR_PRESSURE:
|
||||
return item.pressure[0];
|
||||
return item.pressure[0][0];
|
||||
case INTERPOLATED_PRESSURE:
|
||||
return item.pressure[1];
|
||||
return item.pressure[0][1];
|
||||
case CEILING:
|
||||
return item.ceiling;
|
||||
case SAC:
|
||||
|
|
Loading…
Reference in a new issue