changeset 265:ab8ce7de2b46

BUGFIX zero gas rate (bug bb28).
author JeanDo
date Tue, 12 Apr 2011 01:19:33 +0200
parents d9593e0f1eea
children ba109a7948df
files code_part1/OSTC_code_asm_part1/simulator.asm code_part1/OSTC_code_c_part2/p2_deco.c code_part1/OSTC_code_c_part2/p2_deco.o
diffstat 3 files changed, 29 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/simulator.asm	Tue Apr 12 00:36:23 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/simulator.asm	Tue Apr 12 01:19:33 2011 +0200
@@ -301,14 +301,13 @@
     incf    WREG
     bnz     simulator_show_decoplan5_2
     call    PLED_warnings_color
-    STRCPY  "> "
-    bra     simulator_show_decoplan5_3
+    STRCPY_PRINT  "= xxxx.x"
+    call    PLED_standard_color   
+    bra     simulator_show_decoplan5_1
     
 simulator_show_decoplan5_2: 
-    call    PLED_standard_color   
     STRCPY  "= "
 
-simulator_show_decoplan5_3:    
     bsf     leftbind
     output_16dp .4                      ; 1 decimal.
     bcf     leftbind
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Tue Apr 12 00:36:23 2011 +0200
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Tue Apr 12 01:19:33 2011 +0200
@@ -2292,7 +2292,7 @@
 void deco_gas_volumes(void)
 {
     overlay float volumes[5];
-    overlay float ascent_usage;
+    overlay float bottom_usage, ascent_usage;
     overlay unsigned char i, deepest_first;
     overlay unsigned char gas;
     RESET_C_STACK
@@ -2304,11 +2304,14 @@
     assert(1 <= char_I_first_gas && char_I_first_gas <= 5);
     gas = char_I_first_gas - 1;
 
-    volumes[gas]
-        = (char_I_bottom_depth*0.1 + 1.0)           // Use Psurface = 1.0 bar.
-        * char_I_bottom_time                        // in minutes.
-        * read_custom_function(56)                  // In deci-liter/minutes.
-        * 0.1;                                      // deci-liters --> liters.
+    bottom_usage = read_custom_function(56) * 0.1;
+    if( bottom_usage > 0.0 )
+        volumes[gas]
+            = (char_I_bottom_depth*0.1 + 1.0)           // Use Psurface = 1.0 bar.
+            * char_I_bottom_time                        // in minutes.
+            * bottom_usage;                             // In liter/minutes.
+    else
+        volumes[gas] = 65535.0;
 
     //---- Ascent usage ------------------------------------------------------
 
@@ -2320,10 +2323,13 @@
     //  - with an ascent speed of 10m/min.
     //  - with ascent litter / minutes.
     //  - still using bottom gas:
-    volumes[gas]
-        += (char_I_bottom_depth*0.1 + 1.0)          // Depth -> bar
-         * (char_I_bottom_depth - char_O_first_deco_depth) * 0.1  // ascent time (min)
-         * ascent_usage;                            // Consumption ( xxx / min @ 1 bar)
+    if( ascent_usage > 0.0 )
+        volumes[gas]
+            += (char_I_bottom_depth*0.1 + 1.0)          // Depth -> bar
+             * (char_I_bottom_depth - char_O_first_deco_depth) * 0.1  // ascent time (min)
+             * ascent_usage;                            // Consumption ( xxx / min @ 1 bar)
+    else
+        volumes[gas] = 65535.0;
 
     for(i=0; i<32; ++i)
     {
@@ -2360,13 +2366,16 @@
 
         // usage during stop:
         // Note: because first gas is not in there, increment gas+1
-        volumes[gas] += (depth*0.1 + 1.0)   // depth --> bar.
-                      * time                // in minutes.
-                      * ascent_usage        // in xxx / min @ 1bar.
-        // Plus usage during ascent to the next stop, at 10m/min.
-                      + (depth*0.1  + 1.0)
-                      * ascent*0.1          // meter --> min
-                      * ascent_usage;
+        if( ascent_usage > 0.0 )
+            volumes[gas] += (depth*0.1 + 1.0)   // depth --> bar.
+                          * time                // in minutes.
+                          * ascent_usage        // in xxx / min @ 1bar.
+            // Plus usage during ascent to the next stop, at 10m/min.
+                          + (depth*0.1  + 1.0)
+                          * ascent*0.1          // meter --> min
+                          * ascent_usage;
+        else
+            volumes[gas] = 65535.0;
     }
 
     //---- convert results for the ASM interface -----------------------------
Binary file code_part1/OSTC_code_c_part2/p2_deco.o has changed