summaryrefslogtreecommitdiffstats
path: root/dive.h
diff options
context:
space:
mode:
authorGravatar Willem Ferguson <willemferguson@zoology.up.ac.za>2014-06-03 19:21:41 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-03 17:05:25 -0700
commiteaf6d564874ac838dc4f3cca7a781034ae60ef7f (patch)
treed214c58bdc33f6dbd058afe715de357dd14d4114 /dive.h
parent1fec6453a2b7b6dcd34901a4e92dd11aae38879c (diff)
downloadsubsurface-eaf6d564874ac838dc4f3cca7a781034ae60ef7f.tar.gz
CCR code: Change to sample structure
1) All the variables in the sample structures are strongly typed 2) Two additional types were declared in units.h: o2pressure_t bearing_t 3) The following variables were added: diluentpressure o2setpoint o2sensor[3] 4) Changes to a number of files were made to chanf sample->po2 to sample->po2.mbar bearing to bearring.degrees Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r--dive.h34
1 files changed, 19 insertions, 15 deletions
diff --git a/dive.h b/dive.h
index cdef2cd40..7a1c26d13 100644
--- a/dive.h
+++ b/dive.h
@@ -141,21 +141,25 @@ static inline depth_t gas_mod(struct gasmix *mix, pressure_t po2_limit) {
void get_gas_string(const struct gasmix *gasmix, char *text, int len);
const char *gasname(const struct gasmix *gasmix);
-struct sample {
- duration_t time;
- depth_t depth;
- temperature_t temperature;
- pressure_t cylinderpressure;
- int sensor; /* Cylinder pressure sensor index */
- duration_t ndl;
- duration_t stoptime;
- depth_t stopdepth;
- bool in_deco;
- int cns;
- int po2;
- int heartbeat;
- int bearing;
-};
+struct sample // BASE TYPE BYTES UNITS RANGE DESCRIPTION
+{ // --------- ----- ----- ----- -----------
+ duration_t time; // uint32_t 4 seconds (0-68 yrs) elapsed dive time up to this sample
+ duration_t stoptime; // uint32_t 4 seconds (0-18 h) time duration of next deco stop
+ duration_t ndl; // uint32_t 4 seconds (0-18 h) time duration before no-deco limit
+ 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 diluentpressure; // int32_t 4 mbar (0-2 Mbar) CCR diluent pressure (rebreather)
+ o2pressure_t po2; // uint16_t 2 mbar (0-65 bar) O2 partial pressure
+ o2pressure_t o2setpoint; // uint16_t 2 mbar (0-65 bar) CCR O2 setpoint (rebreather)
+ 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
+ uint8_t sensor; // uint8_t 1 sensorID (0-255) ID of cylinder pressure sensor
+ uint8_t cns; // uint8_t 1 % (0-255 %) cns% accumulated
+ uint8_t heartbeat; // uint8_t 1 beats/m (0-255) heart rate measurement
+ bool in_deco; // bool 1 y/n y/n this sample is part of deco
+}; // Total size of structure: 48 bytes, excluding padding at end
struct divetag {
/*