diff --git a/dive.c b/dive.c index 950948b59..c07912ebd 100644 --- a/dive.c +++ b/dive.c @@ -678,7 +678,8 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc) if (asc_desc_time * 2 >= duration) asc_desc_time = duration/2; - dc->meandepth.mm = depth*(duration-asc_desc_time)/duration; + if (!dc->meandepth.mm) + dc->meandepth.mm = depth*(duration-asc_desc_time)/duration; if (depth > maxdepth) maxdepth = depth; } else { diff --git a/dives/sac-test.xml b/dives/sac-test.xml index 14ee3f17b..fe0f51994 100644 --- a/dives/sac-test.xml +++ b/dives/sac-test.xml @@ -6,7 +6,7 @@ SAC test dive 1 SAC should be 20l/min (0.7063 cuft/min) We have exactly 100 ATM of gas in a 10l cylinder, average 10m for 25min - + @@ -21,7 +21,7 @@ We have exactly 100 ATM of gas in a 10l cylinder, average 10m for 25min SAC test dive 2 SAC should be 20l/min (0.7063 cuft/min) We have exactly 100 ATM of gas in a 10l cylinder, average 10m for 25min - + @@ -33,11 +33,11 @@ We have exactly 100 ATM of gas in a 10l cylinder, average 10m for 25min SAC test dive 3 SAC should be 20l/min (0.7063 cuft/min) We have exactly 100 ATM of gas in 15l of cylinder, average 20m for 25min - - + + + - @@ -46,16 +46,16 @@ We have exactly 100 ATM of gas in 15l of cylinder, average 20m for 25min - - SAC test dive 3 + + SAC test dive 4 SAC should be 20l/min (0.7063 cuft/min) This adds a 5-minute surface time to the middle of the dive. We have exactly 100 ATM of gas in 15l of cylinder, average 20m for 25min - - + + + - @@ -65,5 +65,15 @@ We have exactly 100 ATM of gas in 15l of cylinder, average 20m for 25min + + SAC test dive 5 + SAC should be 20l/min (0.7063 cuft/min) +This verifies that it works without any sample data too. +We have exactly 100 ATM of gas in 15l of cylinder, average 20m for 25min + + + + +