Add limits to cylinder maximum pressures on DM5 import

DM5 seems to have occasionally bogus data for cylinder start and end
pressures. Need to validate that.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Miika Turkia 2015-02-17 19:27:59 +02:00 committed by Dirk Hohndel
parent 56f6df4cd8
commit 5632c0b357

View file

@ -2220,11 +2220,11 @@ extern int dm5_dive(void *param, int columns, char **data, char **column)
* TODO: handle multiple cylinders
*/
cylinder_start();
if (data[22] && atoi(data[22]) > 0)
if (data[22] && atoi(data[22]) > 0 && atoi(data[22]) < 350000)
cur_dive->cylinder[cur_cylinder_index].start.mbar = atoi(data[22]);
else if (data[10] && atoi(data[10]) > 0)
cur_dive->cylinder[cur_cylinder_index].start.mbar = atoi(data[10]);
if (data[23] && atoi(data[23]) > 0)
if (data[23] && atoi(data[23]) > 0 && atoi(data[23]) < 350000)
cur_dive->cylinder[cur_cylinder_index].end.mbar = (atoi(data[23]));
if (data[11] && atoi(data[11]) > 0)
cur_dive->cylinder[cur_cylinder_index].end.mbar = (atoi(data[11]));