changeset 777:b92ee354baae

show bailout in logbook, 2.91 beta release
author heinrichsweikamp
date Fri, 02 May 2014 21:40:54 +0200
parents 5760f2b689c5
children 43ef5a003df7
files code_part1/OSTC_code_asm_part1/changelog.txt code_part1/OSTC_code_asm_part1/definitions.asm code_part1/OSTC_code_asm_part1/menu_logbook.asm
diffstat 3 files changed, 46 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Tue Apr 15 12:20:15 2014 +0200
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Fri May 02 21:40:54 2014 +0200
@@ -1,5 +1,6 @@
 New in 2.91:
-BETA Version - Do NOT use for diving
+BETA Version
+New: Show bailout event in internal logbook
 
 New in 2.90:
 Stable Release
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Tue Apr 15 12:20:15 2014 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Fri May 02 21:40:54 2014 +0200
@@ -24,7 +24,7 @@
 #DEFINE	softwareversion_x		d'2'		; Software version  XX.YY
 #DEFINE	softwareversion_y		d'91'		; Software version  XX.YY
 
-#DEFINE softwareversion_beta 	0 			; (and 0 for release)
+#DEFINE softwareversion_beta 	1 			; (and 0 for release)
 
 #DEFINE	max_custom_number		d'73'		; Number of last used custom function
 
@@ -42,6 +42,7 @@
 #DEFINE	logbook_profile_version	0x21        ; Do not touch!
 #DEFINE	T0CON_debounce	b'00000000'         ; Timer0 Switch Debounce
 
+;#DEFINE __DEBUG
 
 ; CPU Speed Settings
 ; Standard 16MHz mode
@@ -293,7 +294,7 @@
 decodata                res 2   ; Deco data
 mintemp                 res 2   ; min temperature
 ProfileFlagByte         res 1   ; stores number of addional bytes per sample
-EventByte               res 1   ; Stores the Event type plus flags	
+EventByte               res 1   ; Stores the Event type plus flags
 AlarmType               res 1   ; 0= No Alarm
 								; 1= SLOW
 								; 2= DecoStop missed
--- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Tue Apr 15 12:20:15 2014 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Fri May 02 21:40:54 2014 +0200
@@ -243,7 +243,8 @@
 	bra			display_profile				; No, show details/profile
 	goto		menu
 
-display_profile:	
+display_profile:
+    bcf         is_bailout
 	movff		menupos,mintemp+1				; store current cursor position
 	bsf			return_from_profileview			; tweak search routine to exit after found
 
@@ -817,6 +818,18 @@
 	bra			profile_display_loop		; Not ready yet
 ; Done.
 profile_display_loop_done:
+    btfss   is_bailout                       ; Bailout during the dive?
+    bra     profile_display_loop_done_nobail ; No
+    ; Yes, show "Bailout"
+   	movlw   color_pink
+	call    DISP_set_color
+	WIN_TOP		.210
+	WIN_LEFT	.105
+	WIN_FONT 	FT_SMALL
+	lfsr	FSR2,letter
+    OUTPUTTEXT d'137'                      ; Bailout
+    call	word_processor
+profile_display_loop_done_nobail:
 	call		DISP_standard_color			; Restore color
 	call		menu_pre_loop_common		; Clear some menu flags, timeout and switches
 
@@ -849,7 +862,7 @@
 	dcfsnz		active_gas,F
 	movlw		color_violet				; Color for Gas 5
 	dcfsnz		active_gas,F
-	movlw		color_cyan					; Color for Gas 6
+	movlw		color_pink                  ; Color for Gas 6
 	goto		DISP_set_color				; Set Color...
 
 ;=============================================================================
@@ -1279,14 +1292,20 @@
 	return
 
 profile_view_get_depth_new2:
+    clrf        EventByte
 	call		I2CREAD2					; Read Event byte
 	movff		SSPBUF,EventByte			; store EventByte
 	decf		timeout_counter2,F			; reduce counter
+
 ; Check Event flags in the EventByte
-	btfsc		EventByte,4					; Manual Gas Changed?
-	bra			logbook_event1				; Yes!
-	btfss		EventByte,5					; Stored Gas Changed?
-	return									; No, return
+	btfsc		EventByte,7                 ; Bailout?
+	bra			logbook_event2				; Yes!
+ 	btfsc		EventByte,4					; Manual Gas Changed?
+ 	bra			logbook_event1				; Yes!
+	btfsc		EventByte,6                 ; Setpoint Change?
+	bra			logbook_event3				; Yes!
+ 	btfss		EventByte,5					; Stored Gas Changed?
+ 	return									; No, return
 ; Stored Gas changed!
 	call		I2CREAD2					; Read Gas#
 	movff		SSPBUF,average_depth_hold_total+3
@@ -1301,6 +1320,22 @@
     rcall       profile_display_color       ; Back to normal profile color.
 	return		;(The two bytes indicating the manual gas change will be ignored in the standard "ignore loop" above...)
 
+logbook_event2: ; Bailout
+    bsf         is_bailout                  ; Set flag
+    movff       average_depth_hold_total+3,total_divetime_seconds+0 ; Backup last gas color in case we return to CCR
+    movlw       6                           ; Use Gas6 color
+    movwf       average_depth_hold_total+3
+    rcall       profile_display_color       ; Back to normal profile color.
+	return		;(The two bytes indicating the bailout gas selected will be ignored in the standard "ignore loop" above...)
+
+logbook_event3: ; Setpoint change
+    btfss       is_bailout                  ; Are we in bailout?
+    return      ; No, return
+    ; We were in bailout before, restore profile color
+    movff       total_divetime_seconds+0,average_depth_hold_total+3 ; Restore color
+    rcall       profile_display_color       ; Back to normal profile color.
+    return
+
 exit_profileview:
 	bcf			sleepmode
 	clrf		timeout_counter2				; restore all registers to build same page again