mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Limit pressure and temperature values
Limit temperatures and cylinder pressures to somewhat sensible values. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e157f6220f
commit
c7f803b878
1 changed files with 8 additions and 3 deletions
11
parse-xml.c
11
parse-xml.c
|
@ -2090,15 +2090,20 @@ extern int dm5_dive(void *param, int columns, char **data, char **column)
|
|||
sampleBlob = (unsigned const char *)data[17];
|
||||
for (i = 0; interval && i * interval < cur_dive->duration.seconds; i++) {
|
||||
float *depth = (float *)&sampleBlob[i * 16 + 3];
|
||||
|
||||
int32_t temp = (sampleBlob[i * 16 + 10] << 8) + sampleBlob[i * 16 + 11];
|
||||
int32_t pressure = (sampleBlob[i * 16 + 9] << 16) + (sampleBlob[i * 16 + 8] << 8) + sampleBlob[i * 16 + 7];
|
||||
|
||||
sample_start();
|
||||
cur_sample->time.seconds = i * interval;
|
||||
cur_sample->depth.mm = depth[0] * 1000;
|
||||
cur_sample->temperature.mkelvin = C_to_mkelvin(temp);
|
||||
cur_sample->cylinderpressure.mbar = pressure;
|
||||
/*
|
||||
* Limit temperatures and cylinder pressures to somewhat
|
||||
* sensible values
|
||||
*/
|
||||
if (temp >= -10 && temp < 50)
|
||||
cur_sample->temperature.mkelvin = C_to_mkelvin(temp);
|
||||
if (pressure >= 0 && pressure < 350000)
|
||||
cur_sample->cylinderpressure.mbar = pressure;
|
||||
sample_end();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue