changeset 251:f0cba9cff25c

Still hunting for bb13...
author JeanDo
date Tue, 29 Mar 2011 23:47:34 +0200
parents 4ef3bcbc7091
children 8b252ff2eded
files code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/sleepmode.asm code_part1/OSTC_code_c_part2/p2_deco.c code_part1/OSTC_code_c_part2/p2_deco.o
diffstat 4 files changed, 30 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Mar 29 23:47:19 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Mar 29 23:47:34 2011 +0200
@@ -985,6 +985,10 @@
 	; calculate nofly time
 	movff	int_O_desaturation_time+0,xA+0
 	movff	int_O_desaturation_time+1,xA+1
+
+    btfsc   xA+1,7                  ; Is desat time negatif ?
+    bra     calculate_noflytime_3   ; Then surely not valid !
+
 	tstfsz	xA+0			; Desat=0?
 	bra		calculate_noflytime2
 	tstfsz	xA+1			; Desat=0?
@@ -1036,14 +1040,14 @@
 	rcall	apnoe_calc_maxdepth
 
 	; calculate desaturation time
-	movff	last_surfpressure_30min+0,int_I_pres_respiration+0		; copy surface air pressure to deco routine
-	movff	last_surfpressure_30min+1,int_I_pres_respiration+1		; 30min old values 
+	movff	last_surfpressure_30min+0,int_I_pres_surface+0          ; Pass surface to desat routine !
+	movff	last_surfpressure_30min+1,int_I_pres_surface+1
 
-	GETCUSTOM8	d'12'				; Desaturation multiplier %
+	GETCUSTOM8	d'12'                   ; Desaturation multiplier %
 	movff	WREG,char_I_desaturation_multiplier
 
 	ostc_debug	'G'		; Sends debug-information to screen if debugmode active
-	call	deco_calc_desaturation_time	; calculate desaturation time
+	call	deco_calc_desaturation_time ; calculate desaturation time
 	movlb	b'00000001'                 ; select ram bank 1
 	rcall	calculate_noflytime         ; Calc NoFly time
 	ostc_debug	'H'                     ; Sends debug-information to screen if debugmode active
--- a/code_part1/OSTC_code_asm_part1/sleepmode.asm	Tue Mar 29 23:47:19 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/sleepmode.asm	Tue Mar 29 23:47:34 2011 +0200
@@ -101,11 +101,9 @@
 	movff	amb_pressure+0,int_I_pres_respiration+0		; LOW copy pressure to deco routine
 	movff	amb_pressure+1,int_I_pres_respiration+1		; HIGH
 	GETCUSTOM8	d'11'				; Saturation multiplier %
-	movwf	wait_temp
-	movff	wait_temp,char_I_saturation_multiplier
+	movff	WREG,char_I_saturation_multiplier
 	GETCUSTOM8	d'12'				; Desaturation multiplier %
-	movwf	wait_temp
-	movff	wait_temp,char_I_desaturation_multiplier
+	movff	WREG,char_I_desaturation_multiplier
 	call	deco_calc_wo_deco_step_1_min	; "calc_tissue_sleep"
 	movlb	b'00000001'									; RAM Bank1 selected
 
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Tue Mar 29 23:47:19 2011 +0200
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Tue Mar 29 23:47:34 2011 +0200
@@ -1473,8 +1473,8 @@
 //
 static void calc_tissue(PARAMETER unsigned char period)
 {
-    assert( 0.00 <= ppN2 && ppN2 < 6.40 );  // 80% N2 at 70m
-    assert( 0.00 <= ppHe && ppHe < 18.9 );  // 90% He at 200m
+    assert( 0.00 <= ppN2 && ppN2 < 11.2 );  // 80% N2 at 130m
+    assert( 0.00 <= ppHe && ppHe < 12.6 );  // 90% He at 130m
 
     for (ci=0;ci<16;ci++)
     {
@@ -1655,8 +1655,8 @@
 //   + Do it on sim_pres_tissue, instead of pres_tissue.
 static void sim_tissue(PARAMETER unsigned char period)
 {
-    assert( 0.00 <= ppN2 && ppN2 < 6.40 );  // 80% N2 at 70m
-    assert( 0.00 <= ppHe && ppHe < 18.9 );  // 90% He at 200m
+    assert( 0.00 <= ppN2 && ppN2 < 11.2 );  // 80% N2 at 130m
+    assert( 0.00 <= ppHe && ppHe < 12.6 );  // 90% He at 130m
 
     for(ci=0; ci<16; ci++)
     {
@@ -1857,11 +1857,6 @@
 //
 void deco_calc_desaturation_time(void)
 {
-    overlay unsigned short desat_time;    // For a particular compartiment, in min.
-    overlay float temp1;
-    overlay float temp2;
-    overlay float temp3;
-    overlay float temp4;
     RESET_C_STACK
 
     assert( 800 < int_I_pres_surface && int_I_pres_surface < 1100 );
@@ -1875,6 +1870,12 @@
 
     for (ci=0;ci<16;ci++)
     {
+        overlay unsigned short desat_time;    // For a particular compartiment, in min.
+        overlay float temp1;
+        overlay float temp2;
+        overlay float temp3;
+        overlay float temp4;
+    
         overlay float var_N2_halftime = buhlmann_ht[ci];
         overlay float var_He_halftime = (buhlmann_ht+16)[ci];
 
@@ -1893,7 +1894,7 @@
         }
         else
             temp1 = temp1 / temp2;
-         if (temp1 > 0.0)
+        if( 0.0 < temp1 && temp1 < 1.0 )
         {
             temp1 = log(1.0 - temp1);
             temp1 = temp1 / -0.6931; // temp1 is the multiples of half times necessary.
@@ -1916,7 +1917,7 @@
         }
         else
             temp3 = -1.0 * temp3 / (pres_tissue+16)[ci];
-        if (temp3 > 0.0)
+        if( 0.0 < temp3 && temp3 < 1.0 )
     	{
         	temp3 = log(1.0 - temp3);
         	temp3 = temp3 / -0.6931; // temp1 is the multiples of half times necessary.
@@ -1935,8 +1936,9 @@
             desat_time = (unsigned short)temp4;
         else
             desat_time = (unsigned short)temp2;
-         if(desat_time > int_O_desaturation_time)
-        	int_O_desaturation_time = desat_time;
+
+        if(desat_time > int_O_desaturation_time)
+            int_O_desaturation_time = desat_time;
 
         // N2 saturation in multiples of halftime for display purposes
         temp2 = temp1 * 20.0;  // 0 = 1/8, 120 = 0, 249 = 8
@@ -1967,6 +1969,11 @@
 //
 static void calc_wo_deco_step_1_min(void)
 {
+    assert( 800 < int_I_pres_surface && int_I_pres_surface < 1100 );
+    assert( 800 < int_I_pres_respiration && int_I_pres_respiration < 1100 );
+    assert( 100 <= char_I_saturation_multiplier && char_I_saturation_multiplier < 200 );
+    assert( 0 < char_I_desaturation_multiplier && char_I_desaturation_multiplier <= 100 );
+
 	if(flag_in_divemode)
 	{
 		flag_in_divemode = 0;
Binary file code_part1/OSTC_code_c_part2/p2_deco.o has changed