changeset 302:36cc8f0c1d73

Minor corrections in assert conditions.
author JeanDo
date Sat, 30 Apr 2011 13:07:37 +0200
parents a5fd8777a598
children 9c39cedb662b
files code_part1/OSTC_code_asm_part1/menu_logbook.asm code_part1/OSTC_code_c_part2/p2_deco.c
diffstat 2 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Sat Apr 30 10:40:18 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Sat Apr 30 13:07:37 2011 +0200
@@ -983,6 +983,7 @@
 	return									; No (0)
 
 profile_view_get_depth_new3:
+    ; read optional Tp° here, if any, and decrement timeout_counter2 by two...
 	movf		timeout_counter2,W			; number of additional bytes to ignore (0-127)
 	call		incf_eeprom_address0		; increases bytes in eeprom_address:2 with 0x8000 bank switching
 	return
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Sat Apr 30 10:40:18 2011 +0200
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Sat Apr 30 13:07:37 2011 +0200
@@ -684,7 +684,7 @@
     overlay float depth = (temp_deco - pres_surface) / 0.09985;
 
     // At most, ascent 1 minute, at 10m/min == 10.0 m.
-    overlay float min_depth = depth - 10.0;
+    overlay float min_depth = (depth > 10.0) ? (depth - 10.0) : 0.0;
     
     // Do we need to stop at current depth ?
     overlay unsigned char need_stop = 0;
@@ -733,8 +733,8 @@
                     // With alpha = currentDepth / maxDepth, hence in [0..1]
                     sim_limit( GF_high - first_stop * locked_GF_step );
 
-                // upper limit (lowest pressure tolerated):
-                assert( sim_lead_tissue_limit < pres_stop );
+                // upper limit (lowest pressure tolerated), + 1mbar for rounding...:
+                assert( sim_lead_tissue_limit < (pres_stop + 0.001) );
             }
 #endif
 
@@ -1786,8 +1786,8 @@
         //       so that can change who is the leading gas...
         // Note: Also depends of the GF_current...
         if( char_I_deco_model == 1 )
-            p = ( p - var_N2_a * GF_current) * var_N2_b
-              / (GF_current + var_N2_b * (1.0 - GF_current));
+            p = ( p - var_N2_a * GF_current) 
+              / (GF_current / var_N2_b + 1.0 - GF_current);
         else
             p = (p - var_N2_a) * var_N2_b;
         if( p < 0.0 ) p = 0.0;
@@ -1884,8 +1884,8 @@
     assert( 0.800 <= pres_respiration && pres_respiration < 14.0 );
 
 	// tissue > respiration (currently off-gasing)
-	// GF =   0% when respiration == tissue
-	// GF = 100% when respiration == limit
+	// GF =   0% when respiration == tissue, ie. bubbles are at equilibrium.
+	// GF = 100% when respiration == limit.
     temp_tissue = N2 + He;
     if( temp_tissue <= pres_respiration )
  		gf = 0.0;
@@ -2318,7 +2318,7 @@
 
     int_I_temp = (unsigned short)(((float)int_I_temp * (float)char_I_temp) * 0.01 );
 
-    assert( int_I_temp < 1440 );                            // Less than 24h...
+    assert( int_I_temp < 2880 );                            // Less than 48h...
 }