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:
Linus Torvalds 2017-07-20 14:39:02 -07:00 committed by Dirk Hohndel
parent 94d8abd1a2
commit 11a0c0cc70
17 changed files with 68 additions and 68 deletions

View file

@ -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);