# HG changeset patch
# User JeanDo
# Date 1329088693 -3600
# Node ID 43296991c283003778a7739593f47661a14ef20c
# Parent  896b6346ccd2b46c2af150d27af579383f2f01f6
BUGFIX: CF55 (gas switch delay) should not add fake stops when null.

diff -r 896b6346ccd2 -r 43296991c283 code_part1/OSTC_code_c_part2/p2_deco.c
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Fri Feb 10 16:23:41 2012 +0100
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Mon Feb 13 00:18:13 2012 +0100
@@ -859,6 +859,8 @@
     // If there is a better gas available
     if( switch_deco )
     {
+        unsigned char delay = read_custom_function(55);
+
         assert( !sim_gas_last_depth || sim_gas_last_depth > switch_deco );
 
         // Should restart gas-switch delay only when gas do changes...
@@ -866,11 +868,16 @@
 
         sim_gas_last_depth = switch_deco;
         sim_gas_last_used  = switch_last;
-        sim_gas_delay      = read_custom_function(55)
+        sim_gas_delay      = delay
                            + sim_dive_mins;
-        temp_depth_limit = switch_deco;
 
-        return 1;
+        if( delay )
+        {
+            temp_depth_limit = switch_deco;
+            return 1;
+        }
+        else
+            return 0;
     }
 
     sim_gas_delay = 0;