summaryrefslogtreecommitdiffstats
path: root/core/sample.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-07-18 22:26:38 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-07-19 10:13:51 -0700
commit7e11a3537102697604dbb971a0f3800b25db5ffe (patch)
treebbe09e35746d217b062d941bd963b783dd3c2713 /core/sample.h
parent48c2929f480b74f50d97ea6790161e2a5446929d (diff)
downloadsubsurface-7e11a3537102697604dbb971a0f3800b25db5ffe.tar.gz
core: add a special NO_SENSOR value for sample::sensor
The sensor member of sample refers to a cylinder from which the pressure was read. However, some dives don't even have a cylinder. Therefore, introduce a special NO_SENSOR value for these dives. Since the cylinder is given as a uint8_t, 0xff seems to be a sensible choice. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/sample.h')
-rw-r--r--core/sample.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/sample.h b/core/sample.h
index 75c7bb1b4..1732b4d02 100644
--- a/core/sample.h
+++ b/core/sample.h
@@ -9,6 +9,8 @@ extern "C" {
#endif
#define MAX_SENSORS 2
+#define NO_SENSOR ((uint8_t)-1)
+
struct sample // BASE TYPE BYTES UNITS RANGE DESCRIPTION
{ // --------- ----- ----- ----- -----------
duration_t time; // int32_t 4 seconds (0-34 yrs) elapsed dive time up to this sample
@@ -23,7 +25,7 @@ struct sample // BASE TYPE BYTES UNITS RANGE
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 (-1 no val, 0-360 deg) compass bearing
- uint8_t sensor[MAX_SENSORS]; // uint8_t 1 sensorID (0-255) ID of cylinder pressure sensor
+ uint8_t sensor[MAX_SENSORS]; // uint8_t 1 sensorID (0-254) ID of cylinder pressure sensor
uint16_t cns; // uint16_t 1 % (0-64k %) cns% accumulated
uint8_t heartbeat; // uint8_t 1 beats/m (0-255) heart rate measurement
volume_t sac; // 4 ml/min predefined SAC