changeset 372:d8e83ef49962 64kByte Logbook

Merge fixed x-slace
author Heinrichsweikamp
date Fri, 10 Jun 2011 13:59:10 +0200
parents 61742b3ef842 (diff) 160b3216b335 (current diff)
children 8781d1cf96d8
files
diffstat 11 files changed, 185 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Fri Jun 10 13:57:28 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Fri Jun 10 13:59:10 2011 +0200
@@ -345,6 +345,7 @@
     extern deco_calc_tissue
     extern deco_calc_percentage
     extern deco_calc_wo_deco_step_1_min
+    extern deco_calc_dive_interval
     extern deco_clear_CNS_fraction
     extern deco_clear_tissue
     extern deco_hash    
--- a/code_part1/OSTC_code_asm_part1/english_text.asm	Fri Jun 10 13:57:28 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/english_text.asm	Fri Jun 10 13:59:10 2011 +0200
@@ -323,7 +323,7 @@
     TCODE    .50,   .145,    "LowBatt!"                  ;246 LowBatt!
     TCODE    .20,   .125,    "Simulator"                 ;247 Simulator
     TCODE    .30,   .2,      "OSTC Simulator"            ;248 OSTC Simulator
-    TCODE    .20,   .35,     "Start Dive"                ;249 Start Dive
+    TCODE    .20,   .65,     "Start Dive"                ;249 Start Dive
     TCODE    .100,  .25,     "+ 1m"                      ;250 + 1m
     TCODE    .100,  .50,     "- 1m"                      ;251 - 1m
     TCODE    .100,  .75,     "+10m"                      ;252 +10m
@@ -356,10 +356,10 @@
     TCODE    .0,    .125,    "for Details!"              ;275 for Details!
     TCODE    .20,   .95,     "Salinity: "                ;276 Salinity:
 ;
-    TCODE    .20,   .65,     "Bottom Time:"              ;277 Bottom Time:
-    TCODE    .20,   .95,     "Max. Depth:"               ;278 Max. Depth:
-    TCODE    .20,   .125,    "Calculate Deco"            ;279 Calculate Deco
-    TCODE    .20,   .155,    "Show Decoplan"             ;280 Show Decoplan
+    TCODE    .20,   .95,     "Bottom Time:"              ;277 Bottom Time:
+    TCODE    .20,   .125,    "Max. Depth:"               ;278 Max. Depth:
+    TCODE    .20,   .155,    "Calculate Deco"            ;279 Calculate Deco
+    TCODE    .0,    .0,      ""                          ;280 UNUSED
 ;
     TCODE    .93,   .170,    "Avr.Depth"                 ;281 Avr.Depth
     TCODE    .90,   .170,    "Lead Tiss."                ;282 Lead Tiss.
@@ -383,7 +383,7 @@
     TCODE    .0,    .0,      "MOD:"                      ;297 MOD:                  (max operating depth of a gas).
     TCODE    .0,    .0,      "END:"                      ;298 END:                  (equivalent nitrogen depth of a gas).
     TCODE    .0,    .0,      "EAD:"                      ;299 EAD:                  (equivalent air depth of a gas).
-	TCODE	 .100,	.125,	 "Active?"					 ;300 Active?               (Enable/Disable Gas underwater)
+	TCODE    .100,  .125,	 "Active?"					 ;300 Active?               (Enable/Disable Gas underwater)
 	TCODE    .0,    .2,      "OCR Gas Usage:"            ;301 OCR Gas Usage:        (Planned gas consumtion by tank).
 ; 115k Bootloader support:
 	TCODE	 .45,	.100,	 "Bootloader"				 ;302 Bootloader
@@ -391,5 +391,9 @@
 	TCODE	 .50,	.130,	 "Aborted!"					 ;304 Aborted
 ;@5 variant
     TCODE    .0,    .0,      "Future TTS"                ;305 Future TTS            (=10 chars. Title for @5 customview).
+;
     TCODE    .100,  .125,    "Quit Sim"                  ;306 Quit Sim (=8char max. Quit Simulator mode)
+;Dive interval
+    TCODE    .20,   .35,     "Interval:"                 ;307 Interval:
+    TCODE    .0,    .0,      "Now"                       ;308 Now
 ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/french_text.asm	Fri Jun 10 13:57:28 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/french_text.asm	Fri Jun 10 13:59:10 2011 +0200
@@ -324,7 +324,7 @@
     TCODE    .50,   .145,    "BattFaible!"               ;246 LowBatt!
     TCODE    .20,   .125,    "Simulateur"                ;247 Simulator
     TCODE    .27,   .2,      "Simulateur OSTC"           ;248 OSTC Simulator
-    TCODE    .20,   .35,     "Mode Simulation..."        ;249 Start Dive
+    TCODE    .20,   .65,     "Début Simulation..."       ;249 Start Dive
     TCODE    .100,  .25,     "+ 1m"                      ;250 + 1m
     TCODE    .100,  .50,     "- 1m"                      ;251 - 1m
     TCODE    .100,  .75,     "+10m"                      ;252 +10m
@@ -357,10 +357,10 @@
     TCODE    .0,    .125,    "pour plus de détails!"     ;275 for Details!
     TCODE    .20,   .95,     "Salinité: "                ;276 Salinity:
 ;
-    TCODE    .20,   .65,     "Temps fond:"               ;277 Bottom Time:
-    TCODE    .20,   .95,     "Prof. Max.:"               ;278 Max. Depth:
-    TCODE    .20,   .125,    "Calculer la Déco"          ;279 Calculate Deco
-    TCODE    .20,   .155,    "Voir Plan de Déco"         ;280 Show Decoplan
+    TCODE    .20,   .95,     "Temps fond:"               ;277 Bottom Time:
+    TCODE    .20,   .125,    "Prof. Max.:"               ;278 Max. Depth:
+    TCODE    .20,   .155,    "Calculer la Déco"          ;279 Calculate Deco
+    TCODE    .0,    .0,      ""                          ;280 UNUSED
 ;
     TCODE    .97,   .170,    "Prof.Moyn"                 ;281 Avr.Depth
     TCODE    .90,   .170,    "TissuDirec"                ;282 Lead Tiss.
@@ -392,5 +392,9 @@
 	TCODE	 .50,	.130,	 "Aborted!"					 ;304 Aborted
 ;@5 variant
     TCODE    .0,    .0,      "DTR Réchap"                ;305 Future TTS            (=10 chars. Title for @5 customview).
+;
     TCODE    .100,  .125,    "Quit Sim"                  ;306 Quit Sim 				(=8char max. Quit Simulator mode)
+;Dive interval
+    TCODE    .20,   .35,     "Intervalle: "              ;307 Interval:
+    TCODE    .0,    .0,      "Maintenant"                ;308 Dive now
 ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/german_text.asm	Fri Jun 10 13:57:28 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/german_text.asm	Fri Jun 10 13:59:10 2011 +0200
@@ -324,7 +324,7 @@
     TCODE    .50,   .145,    "Battery schwach!"          ;246 LowBatt!
     TCODE    .20,   .125,    "Simulator"                 ;247 Simulator
     TCODE    .30,   .2,      "OSTC Simulator"            ;248 OSTC Simulator
-    TCODE    .20,   .35,     "TG beginnen"               ;249 Start Dive
+    TCODE    .20,   .65,     "TG beginnen"               ;249 Start Dive
     TCODE    .100,  .25,     "+ 1m"                      ;250 + 1m
     TCODE    .100,  .50,     "- 1m"                      ;251 - 1m
     TCODE    .100,  .75,     "+10m"                      ;252 +10m
@@ -357,10 +357,10 @@
     TCODE    .0,    .125,    "Menü für Details!"         ;275 for Details!
     TCODE    .20,   .95,     "Salzgeh.: "                ;276 Salinity:
 ;
-    TCODE    .20,   .65,     "Grundzeit:"                ;277 Bottom Time:
-    TCODE    .20,   .95,     "Max. Tiefe:"               ;278 Max. Depth:
-    TCODE    .20,   .125,    "Dekoplan berechn."         ;279 Calculate Deco
-    TCODE    .20,   .155,    "Dekoplan anzeigen."        ;280 Show Decoplan
+    TCODE    .20,   .95,     "Grundzeit:"                ;277 Bottom Time:
+    TCODE    .20,   .125,    "Max. Tiefe:"               ;278 Max. Depth:
+    TCODE    .20,   .155,    "Dekoplan berechn."         ;279 Calculate Deco
+    TCODE    .0,    .0,      ""                          ;280 UNUSED
 ;
     TCODE    .107,   .170,   "D-Tiefe"                   ;281 Avr.Depth
     TCODE    .90,   .170,    "Leitgewebe"                ;282 Lead Tiss.
@@ -384,7 +384,7 @@
     TCODE    .0,    .0,      "MOD:"                      ;297 MOD:                  (max operating depth of a gas).
     TCODE    .0,    .0,      "END:"                      ;298 END:                  (equivalent nitrogen depth of a gas).
     TCODE    .0,    .0,      "EAD:"                      ;299 EAD:                  (equivalent air depth of a gas).
-    TCODE  .100,  .125,	     "Aktiv?"			 		 ;300 Active?               (Enable/Disable Gas underwater)
+    TCODE    .100,  .125,	 "Aktiv?"			 		 ;300 Active?               (Enable/Disable Gas underwater)
     TCODE    .0,    .2,      "OCR Gasverbrauch:"         ;301 OCR Gas Usage:        (Planned gas consumtion by tank).
 ; 115k Bootloader support:
 	TCODE	 .45,	.100,	 "Bootloader"				 ;302 Bootloader
@@ -392,5 +392,9 @@
 	TCODE	 .40,	.130,	 "Abgebrochen!"				 ;304 Aborted
 ;@5 variant
     TCODE    .0,    .0,      "TTS @+Min."                ;305 Future TTS            (=10 chars. Title for @5 customview).
+;
     TCODE    .100,  .125,    "Ende Sim"                  ;306 Quit Sim (=8char max. Quit Simulator mode)
+;Dive interval
+    TCODE    .20,   .35,     "Interval:"                 ;307 Interval:
+    TCODE    .0,    .0,      "Now"                       ;308 Now
 ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Fri Jun 10 13:57:28 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Fri Jun 10 13:59:10 2011 +0200
@@ -515,28 +515,50 @@
 ;       that part of the mask to be sure the numbers fit in the right places.
 PLED_simulator_data:
 	WIN_LEFT	.20
-	WIN_TOP		.65
 	WIN_FONT 	FT_SMALL
 	call	PLED_standard_color
-	lfsr	FSR2,letter
-	OUTPUTTEXTH .277                    ; Bottom Time:
-	
-	movff	logbook_temp1,lo            
+
+    ;---- Updates interval line ----------------------------------------------
+	WIN_TOP    .35
+	lfsr	    FSR2,letter
+	OUTPUTTEXTH .307                    ; Interval:
+
+	movff	    char_I_dive_interval,lo
+    movf        lo,W
+    bnz         PLED_simulator_data_1
+    OUTPUTTEXTH .308                    ; Now
+    clrf        POSTINC2                ; End buffer.
+    bra         PLED_simulator_data_2
+
+PLED_simulator_data_1:
 	bsf		leftbind
 	output_8
-	bcf		leftbind
+	STRCAT      "0min"
+
+PLED_simulator_data_2:
+    call        word_processor
+
+    ;---- Updates bottom time line -------------------------------------------
+	WIN_TOP		.95
+	lfsr        FSR2,letter
+	OUTPUTTEXTH .277                    ; Bottom Time:
+
+	movff	logbook_temp1,lo
+	bsf		leftbind
+	output_8
 	STRCAT_PRINT  "min "
 
-	WIN_LEFT	.20
-	WIN_TOP		.95
+    ;---- Updates depth line -------------------------------------------------
+	WIN_TOP		.125
 	lfsr	FSR2,letter
 	OUTPUTTEXTH .278                    ; Max. Depth:
 
 	movff	logbook_temp2,lo
 	bsf		leftbind
 	output_8
+	STRCAT_PRINT  "m "
+
 	bcf		leftbind
-	STRCAT_PRINT  "m "
 	return
 
 ;=============================================================================
@@ -932,13 +954,13 @@
 	call	PLED_topline_box
 	WIN_INVERT	.1	; Init new Wordprocessor	
 	DISPLAYTEXT	.248		; OSTC Simulator
-	WIN_INVERT	.0	; Init new Wordprocessor	
-	DISPLAYTEXT	.249		; Start Dive
-	DISPLAYTEXTH	.277	; Bottom Time:
-	DISPLAYTEXTH	.278	; Max. Depth:
-	DISPLAYTEXTH	.279	; Calculate Deco
-	DISPLAYTEXTH	.280	; Show Decoplan
-	DISPLAYTEXT .11			; Exit
+	WIN_INVERT	.0	; Init new Wordprocessor
+    DISPLAYTEXTH    .307                ; Interval:
+	DISPLAYTEXT	    .249                ; Start Dive
+	DISPLAYTEXTH	.277                ; Bottom Time:
+	DISPLAYTEXTH	.278                ; Max. Depth:
+	DISPLAYTEXTH	.279                ; Calculate Deco
+	DISPLAYTEXT     .11                 ; Exit
 	return
 	
 PLED_temp_surfmode:
--- a/code_part1/OSTC_code_asm_part1/simulator.asm	Fri Jun 10 13:57:28 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/simulator.asm	Fri Jun 10 13:59:10 2011 +0200
@@ -30,6 +30,8 @@
 	movwf	logbook_temp2		; Max. Depth
 	movlw	d'1'
 	movwf	menupos
+    clrf    WREG                        ; Interval
+    movff   WREG,char_I_dive_interval
 
 menu_simulator1:
 	clrf	timeout_counter2
@@ -77,6 +79,8 @@
 
 menu_simulator_do:						; calls submenu
 	dcfsnz	menupos,F
+	bra		simulator_inc_interval
+	dcfsnz	menupos,F
 	bra		simulator_startdive
 	dcfsnz	menupos,F
 	bra		simulator_inc_bottomtime
@@ -84,20 +88,31 @@
 	bra		simulator_inc_maxdepth
 	dcfsnz	menupos,F
 	bra		simulator_calc_deco
-	dcfsnz	menupos,F
-	bra		simulator_show_decoplan
+
 menu_simulator_exit:
 	movlw	d'4'
 	movwf	menupos
-	goto	more_menu2						; exit...
+	goto	more_menu2                  ; exit...
 
+simulator_inc_interval:
+    movff   char_I_dive_interval,PRODL
+    incf    PRODL,F
+    movlw   .24*6                       ; Max 24h delay.
+    cpfslt  PRODL
+    clrf    PRODL
+    movff   PRODL,char_I_dive_interval
+
+	movlw	d'1'
+	movwf	menupos
+	bra		menu_simulator2
+    
 simulator_inc_bottomtime:
 	movlw	d'2'
 	addwf	logbook_temp1,F				; Here: Bottomtime in m
 	movlw	d'199'
 	cpfslt	logbook_temp1
 	movwf	logbook_temp1
-	movlw	d'2'
+	movlw	d'3'
 	movwf	menupos
 	bra		menu_simulator2
 
@@ -107,17 +122,19 @@
 	movlw	d'99'
 	cpfslt	logbook_temp2
 	movwf	logbook_temp2
-	movlw	d'3'
+	movlw	d'4'
 	movwf	menupos
 	bra		menu_simulator2
 
+;=============================================================================
+
 simulator_startdive:
 	; Descent to -15m depth
 	; Set standalone_simulator flag (Displays Simulator menu during simulation by pressing ENTER button)
 	; Clear standalone_simulator after (any) dive
 	bsf		simulatormode_active			; normal simulator mode
 	bsf		standalone_simulator			; Standalone Simulator active
-	
+
 	movff	logbook_temp2,xA+0
 	clrf	xA+1
 	movlw	d'100'
@@ -143,14 +160,20 @@
 	bcf		switch_left
 	bcf		switch_right
 
-	call	simulator_save_tissue_data		; Stores 32 floats "pre_tissue" into bank3
+	call	simulator_save_tissue_data  ; Stores 32 floats "pre_tissue" into bank3
 
-	movlw	d'3'                            ; Begin of deco cycle (reset table).
-	movff	WREG,char_O_deco_status         ; Reset Deco module.
+    movff   char_I_dive_interval,WREG   ; Any interval ?
+    iorlw   0                           ; Test for null
+    btfss   STATUS,Z
+    call    deco_calc_dive_interval     ; NZ: call interval subroutine.
+    movlb   1
+    
+	movlw	d'3'                        ; Begin of deco cycle (reset table).
+	movff	WREG,char_O_deco_status     ; Reset Deco module.
 
-	bsf		divemode						; Set divemode flag
-	ostc_debug	'P'							; Sends debug-information to screen if debugmode active
-	goto	diveloop						; Start Divemode
+	bsf		divemode                    ; Set divemode flag
+	ostc_debug	'P'                     ; Sends debug-information to screen if debugmode active
+	goto	diveloop                    ; Start Divemode
 
 ;=============================================================================
 ; Show decoplanning result.
@@ -194,25 +217,25 @@
         WIN_INVERT	.0                  ; Init new Wordprocessor	
 	
 simulator_show_decoplan1:
-	bcf		switch_left
-	bcf		switch_right
+        bcf		switch_left
+        bcf		switch_right
 simulator_show_decoplan2:
-	btfsc	uart_dump_screen            ; Asked to dump screen contains ?
-	call	dump_screen     		    ; Yes!
-
-	btfss	onesecupdate
-	bra		simulator_show_decoplan3
-
-	call	timeout_surfmode
-	call	set_dive_modes
-	call	test_charger				; check if charger IC is active
-	call	get_battery_voltage			; get battery voltage
-	
-	bcf		onesecupdate				; End of one second tasks
+        btfsc	uart_dump_screen        ; Asked to dump screen contains ?
+        call	dump_screen             ; Yes!
+        
+        btfss	onesecupdate
+        bra		simulator_show_decoplan3
+        
+        call	timeout_surfmode
+        call	set_dive_modes
+        call	test_charger            ; check if charger IC is active
+        call	get_battery_voltage     ; get battery voltage
+        
+        bcf		onesecupdate            ; End of one second tasks
 
 simulator_show_decoplan3:
 	btfsc	switch_right
-	bra		simulator_show_decoplan4	; Quit display
+	bra		menu_simulator1             ; Quit display
 
 	btfsc	switch_left
 	bra		simulator_show_decoplan5	; Next decoplan-page.
@@ -236,12 +259,12 @@
 ;---- In OCR mode, show the gas Usage special page ---------------------------
 simulator_show_decoplan5_0:    
     btfss   display_see_deco            ; Already displayed ?
-    bra     simulator_show_decoplan4    ; Exit to menu.
+    bra     menu_simulator1             ; Exit to menu.
 
 	bcf		display_see_deco			; clear flag
    
     btfsc   FLAG_const_ppO2_mode        ; In CCR mode ?
-    bra     simulator_show_decoplan4    ; YES: finished.
+    bra     menu_simulator1             ; YES: finished.
 
     ; Make sure to pass first gas
     clrf    EEADRH
@@ -308,14 +331,15 @@
 ;=============================================================================
 ; OSTC Simulator: compute a new runtime
 ;
-simulator_show_decoplan4:
-	movlw	d'5'
-	movwf	menupos
-	bra		menu_simulator1
-
 simulator_calc_deco:
 	call	simulator_save_tissue_data  ; Stores 32 floats "pre_tissue" into bank3
 
+    movff   char_I_dive_interval,WREG   ; Any interval ?
+    iorlw   0                           ; Test for null
+    btfss   STATUS,Z
+    call    deco_calc_dive_interval     ; NZ: call interval subroutine.
+    movlb   1
+
 	bsf		simulatormode_active        ; normal simulator mode
 	bsf		standalone_simulator        ; Standalone Simulator active
 	bsf		no_sensor_int               ; Disable sensor interrupt
@@ -421,7 +445,9 @@
 	movwf	menupos
 	movff	char_I_bottom_time,logbook_temp1    ; Restore bottom time,
 	movff   char_I_bottom_depth,logbook_temp2   ; and depth.
-	bra     menu_simulator1                 ; Done.
+
+	clrf	timeout_counter2            ; Restart menu timeout.
+    bra     simulator_show_decoplan     ; Done.
 
 simulator_save_tissue_data:
 	bsf		restore_deco_data           ; Set restore flag
--- a/code_part1/OSTC_code_asm_part1/spanish_text.asm	Fri Jun 10 13:57:28 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/spanish_text.asm	Fri Jun 10 13:59:10 2011 +0200
@@ -323,7 +323,7 @@
     TCODE    .50,   .145,    "BatBaja!"                  ;246 LowBatt!
     TCODE    .20,   .125,    "Simulador"                 ;247 Simulator
     TCODE    .30,   .2,      "Simulador OSTC"            ;248 OSTC Simulator
-    TCODE    .20,   .35,     "Inicio Buc."               ;249 Start Dive
+    TCODE    .20,   .65,     "Inicio Buc."               ;249 Start Dive
     TCODE    .100,  .25,     "+ 1m"                      ;250 + 1m
     TCODE    .100,  .50,     "- 1m"                      ;251 - 1m
     TCODE    .100,  .75,     "+10m"                      ;252 +10m
@@ -356,10 +356,10 @@
     TCODE    .0,    .125,    "más Detalles!"             ;275 for Details!
     TCODE    .20,   .95,     "Salinidad:"                ;276 Salinity:
 ;
-    TCODE    .20,   .65,     "Tiempo Fondo:"             ;277 Bottom Time:
-    TCODE    .20,   .95,     "Prof. Max.:"               ;278 Max. Depth:
-    TCODE    .20,   .125,    "Calcular Deco"             ;279 Calculate Deco
-    TCODE    .20,   .155,    "Mostr. Plan Deco"          ;280 Show Decoplan
+    TCODE    .20,   .95,     "Tiempo Fondo:"             ;277 Bottom Time:
+    TCODE    .20,   .125,    "Prof. Max.:"               ;278 Max. Depth:
+    TCODE    .20,   .155,    "Calcular Deco"             ;279 Calculate Deco
+    TCODE    .0,    .0,      ""                          ;280 UNUSED
 ;
     TCODE    .93,   .170,    "ProfMedia"                 ;281 Avr.Depth
     TCODE    .90,   .170,    "TejControl"                ;282 Lead Tiss.
@@ -391,5 +391,9 @@
 	TCODE	 .50,	.130,	 "ˇAborta!"					 ;304 Aborted
 ;@5 variant
     TCODE    .0,    .0,      "Futuro TTS"                ;305 Future TTS            (=10 chars. Title for @5 customview).
+;
     TCODE    .100,  .125,    "Quit Sim"                  ;306 Quit Sim (=8char max. Quit Simulator mode)
+;Dive interval
+    TCODE    .20,   .35,     "Interval:"                 ;307 Interval:
+    TCODE    .0,    .0,      "Now"                       ;308 Now
 ;=============================================================================
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Fri Jun 10 13:57:28 2011 +0200
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Fri Jun 10 13:59:10 2011 +0200
@@ -131,6 +131,7 @@
 static void sim_tissue(PARAMETER unsigned char period);
 static void sim_limit(PARAMETER float GF_current);
 static void sim_extra_time(void);
+static void calc_dive_interval(void);
 
 static void calc_gradient_factor(void);
 static void calc_wo_deco_step_1_min(void);
@@ -963,6 +964,14 @@
 
 //////////////////////////////////////////////////////////////////////////////
 
+void deco_calc_dive_interval(void)
+{
+    RESET_C_STACK
+    calc_dive_interval();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
 void deco_debug(void)
 {
     RESET_C_STACK
@@ -2142,9 +2151,8 @@
 	}
 
     N2_ratio = 0.7902; // FIXED, sum lt. buehlmann
-    pres_respiration = int_I_pres_respiration * 0.001;  // assembler code uses different digit system
-    pres_surface = int_I_pres_surface * 0.001;          // the b"uhlmann formula using pres_surface does not use the N2_ratio
-    ppN2 = N2_ratio * (pres_respiration - ppWater);     // ppWater is the extra pressure in the body
+    pres_respiration = pres_surface = int_I_pres_surface * 0.001;
+    ppN2 = N2_ratio * (pres_respiration - ppWater);
     ppHe = 0.0;
     float_desaturation_multiplier = char_I_desaturation_multiplier / 142.0; // new in v.101	(70,42%/100.=142)
     float_saturation_multiplier   = char_I_saturation_multiplier   * 0.01;
@@ -2160,6 +2168,40 @@
 }
 
 //////////////////////////////////////////////////////////////////////////////
+// calc_dive_interval
+//
+// Prepare tissue for delay before the next dive simulation.
+//
+// Inputs:  char_I_dive_interval == delay before dive (in 10' steps).
+// Outputs: pres_tissue_N2/He[], CNS_fraction
+//
+// Should be protected by deco_push_tissues_to_vault(),
+//                        deco_pull_tissues_from_vault()
+//
+// desaturation slowed down to 70,42%.
+//
+static void calc_dive_interval()
+{
+    overlay unsigned char t;
+
+    //---- Initialize simulation parameters ----------------------------------
+    N2_ratio = 0.7902; // FIXED, sum lt. buehlmann
+    pres_respiration = pres_surface = int_I_pres_surface * 0.001;
+    ppN2 = N2_ratio * (pres_respiration - ppWater);
+    ppHe = 0.0;
+    float_desaturation_multiplier = char_I_desaturation_multiplier / 142.0; // new in v.101	(70,42%/100.=142)
+    float_saturation_multiplier   = char_I_saturation_multiplier   * 0.01;
+
+    //---- Perform simulation ------------------------------------------------
+    for(t=0; t<char_I_dive_interval; ++t)
+    {
+        calc_tissue(2);  // period = 10min.
+        CNS_fraction =  0.92587471 * CNS_fraction;  // Half-time = 90min: (1/2)^(1/9)
+    }
+    char_O_CNS_fraction = (char)(CNS_fraction * 100.0 + 0.5);
+}
+
+//////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////// deco_hash /////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////
Binary file code_part1/OSTC_code_c_part2/p2_deco.o has changed
--- a/code_part1/OSTC_code_c_part2/p2_definitions.h	Fri Jun 10 13:57:28 2011 +0200
+++ b/code_part1/OSTC_code_c_part2/p2_definitions.h	Fri Jun 10 13:59:10 2011 +0200
@@ -83,6 +83,7 @@
 extern void deco_clear_tissue(void);
 extern void deco_calc_percentage(void);
 extern void deco_calc_wo_deco_step_1_min(void);
+extern void deco_calc_dive_interval(void);
 extern void deco_debug(void);
 extern void deco_gradient_array(void);
 extern void deco_hash(void);
--- a/code_part1/OSTC_code_c_part2/shared_definitions.h	Fri Jun 10 13:57:28 2011 +0200
+++ b/code_part1/OSTC_code_c_part2/shared_definitions.h	Fri Jun 10 13:59:10 2011 +0200
@@ -156,6 +156,7 @@
 VAR_UCHAR (char_I_deco_model);             // new in v.102. 0 == ZH-L16, 1 = ZH-L16-GF (Grandiant facttor)
 VAR_UCHAR (char_I_bottom_depth);           // Bottom depth for planning (used in gas volume evaluation).
 VAR_UCHAR (char_I_bottom_time);            // Bottom time for planning (used in gas volume evaluation).
+VAR_UCHAR (char_I_dive_interval);          // Delay before next dive simulation.
 
 TAB_UCHAR (char_I_deco_gas_change,NUM_GAS);// new in v.101
 TAB_UCHAR (char_I_deco_N2_ratio, NUM_GAS); // new in v.101