# HG changeset patch
# User heinrichsweikamp
# Date 1371391742 -7200
# Node ID ae641bcb0d02891ac3a83fb03f268a3001400320
# Parent  71e88ee8bbf2cc24c023b4245075bfc8f69f8de4
store a bailout event in the logbook

diff -r 71e88ee8bbf2 -r ae641bcb0d02 code_part1/OSTC_code_asm_part1/definitions.asm
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Sun Jun 16 15:50:37 2013 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Sun Jun 16 16:09:02 2013 +0200
@@ -574,4 +574,5 @@
 #DEFINE	maxdepth_greater_100m	flag15,6	;=1: Max Depth greater>100m
 #DEFINE	show_cns_in_logbook		flag15,7	;=1: Show CNS value in logbook (>= V1.84)
 
+#DEFINE store_bailout_event     flag16,0    ;=1: Store the bailout event
 
diff -r 71e88ee8bbf2 -r ae641bcb0d02 code_part1/OSTC_code_asm_part1/divemode.asm
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Sun Jun 16 15:50:37 2013 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Sun Jun 16 16:09:02 2013 +0200
@@ -758,6 +758,12 @@
 	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
 	bsf		EventByte,6			; Also set Flag in EventByte!
 check_event3:
+    btfss	store_bailout_event ; Check flag
+	bra		check_event4
+	movlw	d'2'				; Information length
+	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
+	bsf		EventByte,7			; Also set Flag in EventByte!
+check_event4:
 	bsf		ProfileFlagByte,7	; Set EventByte Flag in ProfileFlagByte
 
 store_dive_data3:
@@ -841,6 +847,14 @@
 	bcf		setpoint_changed		; Clear this event
 
 store_dive_data5:
+    btfss	store_bailout_event     ; Check flag
+    bra		store_dive_data6
+    movff   char_I_O2_ratio,WREG
+    call	write_external_eeprom
+    movff   char_I_He_ratio,WREG
+    call	write_external_eeprom
+    bcf		store_bailout_event		; Clear this event
+store_dive_data6:
 	bcf		event_occured		; Clear the global event flag
 	return						; Done. (Sample with all informations written to EEPROM)
 	
@@ -2028,6 +2042,7 @@
 	clrf	AlarmType					; Clear all alarms
 	bcf		event_occured				; clear flag
 	bcf		setpoint_changed			; clear flag
+    bcf     store_bailout_event         ; clear flag
 	rcall	reset_average1				; Reset the resettable average depth
 	clrf	average_depth_hold_total+0
 	clrf	average_depth_hold_total+1
diff -r 71e88ee8bbf2 -r ae641bcb0d02 code_part1/OSTC_code_asm_part1/divemode_menu.asm
--- a/code_part1/OSTC_code_asm_part1/divemode_menu.asm	Sun Jun 16 15:50:37 2013 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode_menu.asm	Sun Jun 16 16:09:02 2013 +0200
@@ -619,7 +619,8 @@
     bsf     decoplan_invalid            ; The decoplan needs to updated
     clrf    WREG
     movff   WREG,char_O_deco_status     ; Restart decoplan computation mH
-    bsf		is_bailout					;=1: CC mode, but bailout active!		
+    bsf		is_bailout					;=1: CC mode, but bailout active!
+    bsf     store_bailout_event
 	clrf	lo							; clear Setpoint, DISP_const_ppO2_value now displayes "Bail"
 	movff	lo,char_I_const_ppO2
     movlw   6
@@ -745,7 +746,9 @@
 	bra		divemode_set_xgas			; Configure the extra gas
 
 divemenu_set_gas2b:
-	bsf		is_bailout					;=1: CC mode, but bailout active!		
+	bsf		is_bailout					;=1: CC mode, but bailout active!
+    bsf     store_bailout_event
+	bsf		event_occured				; set global event flag
 	clrf	lo							; clear Setpoint, DISP_const_ppO2_value now displayes "Bail"
 	movff	lo,char_I_const_ppO2		
 
diff -r 71e88ee8bbf2 -r ae641bcb0d02 code_part1/OSTC_code_asm_part1/start.asm
--- a/code_part1/OSTC_code_asm_part1/start.asm	Sun Jun 16 15:50:37 2013 +0200
+++ b/code_part1/OSTC_code_asm_part1/start.asm	Sun Jun 16 16:09:02 2013 +0200
@@ -214,6 +214,7 @@
 	clrf	flag13
 	clrf	flag14
 	clrf	flag15
+    clrf	flag16
 
     ; Should we set win_flip_screen ?
 	bsf		flag1,0                 ; Precondition to yes
diff -r 71e88ee8bbf2 -r ae641bcb0d02 docu/ostc_interface_description.odt
Binary file docu/ostc_interface_description.odt has changed