mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
CCR patch: Import and store oxygen sensor data
This patch allows the importing of oxygen sensor and setpoint data from Poseidon CCR dive logs. 1) Change parse-xml.c to read up to three oxygen sensor values from xml. and to store the information in sample structures 2) Change parse-xml.c to read o2 setpoint values fro xml and to store it in sample structures 3) Change dive.c to delete all sensor and setpoint values where subsequent samples have sensor/setpoint values that are the same. 4) Change profile.c to store the sensor/setpoint values from the samples into plotinfo. 5) Change the sample Poseidon xml log in the dives directory to ensure the correct order and hierarchy of the dive and divecomputer nodes. [Dirk Hohndel: minor cleanup, removed debug code, whitespace] Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2282035a4d
commit
46bb02e8fc
4 changed files with 41 additions and 7 deletions
25
dive.c
25
dive.c
|
@ -1039,19 +1039,19 @@ static void fixup_dc_events(struct divecomputer *dc)
|
|||
|
||||
static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc)
|
||||
{
|
||||
int i, j;
|
||||
int i, j, o2val;
|
||||
double depthtime = 0;
|
||||
int lasttime = 0;
|
||||
int lastindex = -1;
|
||||
int maxdepth = dc->maxdepth.mm;
|
||||
int mintemp = 0;
|
||||
int lastdepth = 0;
|
||||
int lasto2val[3] = { 0, 0, 0 }, lasto2setpoint = 0;
|
||||
int lasttemp = 0, lastpressure = 0, lastdiluentpressure = 0;
|
||||
int pressure_delta[MAX_CYLINDERS] = { INT_MAX, };
|
||||
|
||||
/* Fixup duration and mean depth */
|
||||
fixup_dc_duration(dc);
|
||||
|
||||
update_min_max_temperatures(dive, dc->watertemp);
|
||||
for (i = 0; i < dc->samples; i++) {
|
||||
struct sample *sample = dc->sample + i;
|
||||
|
@ -1108,6 +1108,27 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc)
|
|||
if (!mintemp || temp < mintemp)
|
||||
mintemp = temp;
|
||||
}
|
||||
|
||||
// If there are consecutive identical O2 sensor readings, throw away the redundant ones.
|
||||
for (j = 0; j < dc->no_o2sensors; j++) { // for CCR oxygen sensor data:
|
||||
o2val = sample->o2sensor[j].mbar;
|
||||
if (o2val) {
|
||||
if (lasto2val[j] == o2val)
|
||||
sample->o2sensor[j].mbar = 0;
|
||||
else
|
||||
lasto2val[j] = o2val;
|
||||
}
|
||||
}
|
||||
|
||||
// If there are consecutive identical CCR O2 setpoint readings, throw away the redundant ones.
|
||||
o2val = sample->o2setpoint.mbar;
|
||||
if (o2val) {
|
||||
if (lasto2setpoint == o2val)
|
||||
sample->o2setpoint.mbar = 0;
|
||||
else
|
||||
lasto2setpoint = o2val;
|
||||
}
|
||||
|
||||
update_min_max_temperatures(dive, sample->temperature);
|
||||
|
||||
depthtime += (time - lasttime) * (lastdepth + depth) / 2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue