changeset 11:04794990b619

Show Max. Depth with 0.1m precision
author heinrichsweikamp
date Sun, 26 May 2013 10:24:50 +0200
parents 55dfc8f6093f
children 9db9a1deefd1
files src/changelog.txt src/divemode.inc src/ostc3.inc src/tft_outputs.asm
diffstat 4 files changed, 98 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/changelog.txt	Thu May 16 14:48:32 2013 +0200
+++ b/src/changelog.txt	Sun May 26 10:24:50 2013 +0200
@@ -1,3 +1,6 @@
+New in 0.94:
+CHANGE: Show Max. Depth with 0.1m precision
+
 New in 0.91:
 BUGFIX: Battery percents in cold water
 
--- a/src/divemode.inc	Thu May 16 14:48:32 2013 +0200
+++ b/src/divemode.inc	Sun May 26 10:24:50 2013 +0200
@@ -25,6 +25,8 @@
 
 #DEFINE	max_depth_row           depth_row
 #DEFINE	max_depth_column        .64
+#DEFINE	max_depth_dm_column     .87
+#DEFINE max_depth_dm_row        depth_row+.12
 #DEFINE	max_depth_feet_row		max_depth_row
 #DEFINE	max_depth_feet_column	.64
 
--- a/src/ostc3.inc	Thu May 16 14:48:32 2013 +0200
+++ b/src/ostc3.inc	Sun May 26 10:24:50 2013 +0200
@@ -19,7 +19,7 @@
 #include <ports.inc>                        ; Portmap
 
 #DEFINE	softwareversion_x		d'0'		; Software version  XX.YY
-#DEFINE	softwareversion_y		d'93'		; Software version  XX.YY
+#DEFINE	softwareversion_y		d'94'		; Software version  XX.YY
 #DEFINE softwareversion_beta 	0 			; (and 0 for release)
 
 #DEFINE comm_service_key        0xABCDEF
@@ -565,6 +565,7 @@
 #DEFINE ccr_diluent_setup       flag7,4 ; =1: Setting up Diluents ("Gas6-10")
 #DEFINE menu_show_sensors       flag7,5 ; =1: Update HUD data in menu
 #DEFINE short_gas_decriptions   flag7,6 ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
+#DEFINE max_depth_greater_100m  flag7,7 ; =1: Max. Depth > 100m
 
 #DEFINE is_bailout              flag8,0 ; =1: Bailout
 #DEFINE is_bailout_menu         flag8,1 ; =1: Bailout
--- a/src/tft_outputs.asm	Thu May 16 14:48:32 2013 +0200
+++ b/src/tft_outputs.asm	Sun May 26 10:24:50 2013 +0200
@@ -1651,9 +1651,13 @@
     bra		depth_greater_99_84mtr
 
 	btfsc	depth_greater_100m			; Was depth>100m during last call
-	call	TFT_clear_depth             ; Yes, clear depth area
+	rcall	TFT_clear_depth             ; Yes, clear depth area
 	bcf		depth_greater_100m			; Do this once only...
 
+	movlw	.039
+	cpfslt	hi
+    bra		depth_greater_99_84mtr
+
 	lfsr    FSR2,buffer
 	movlw	HIGH	d'1000'
 	movwf	sub_a+1
@@ -2080,14 +2084,97 @@
 	return
 
 TFT_max_pressure2_metric:
+    WIN_MEDIUM	max_depth_column,max_depth_row
+
+	movlw	.039
+	cpfslt	hi
+    bra		max_depth_greater_99_84mtr
+
+	btfsc	max_depth_greater_100m			; Was depth>100m during last call
+	rcall	TFT_clear_max_depth             ; Yes, clear depth area
+	bcf		max_depth_greater_100m			; Do this once only...
+
+	movlw	.039
+	cpfslt	hi
+    bra		max_depth_greater_99_84mtr
+
+	lfsr    FSR2,buffer
+	movlw	HIGH	d'1000'
+	movwf	sub_a+1
+	movlw	LOW		d'1000'
+	movwf	sub_a+0
+	movff	hi,sub_b+1
+	movff	lo,sub_b+0
+	incf	sub_b+0,F
+	movlw	d'0'
+	addwfc	sub_b+1,F				; Add 1mbar offset
+	call	sub16					; sub_c = sub_a - sub_b
+    movlw   ' '
+	btfss	neg_flag				; Depth lower then 10m?
+    movwf   POSTINC2                ; Yes, add extra space
+
+	clrf    sub_a+1
+	movlw	d'99'
+	movwf	sub_a+0
+	movff	hi,sub_b+1
+	movff	lo,sub_b+0
+	call	subU16					; sub_c = sub_a - sub_b
+	btfss	neg_flag				; Depth lower then 1m?
+	bra		tft_max_depth2          ; Yes, display manual Zero
+
+	bsf     ignore_digit4			; no 0.1m
+    bsf     leftbind
+	output_16
+	bra		tft_max_depth3
+
+tft_max_depth2:
 	WIN_MEDIUM	max_depth_column,max_depth_row
-	lfsr	FSR2,buffer
+	STRCAT	"0"
+
+tft_max_depth3:
 	call	TFT_standard_color
-	bsf		ignore_digit4			; no 0.1m
+	STRCAT_PRINT ""					; Display full meters
+    bcf     leftbind
+
+	; .1m in SMALL font
+	WIN_SMALL	max_depth_dm_column,max_depth_dm_row
+
+    SAFE_2BYTE_COPY max_pressure, lo
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
+
+    lfsr    FSR2,buffer
+	PUTC    "."
+
+	movlw	d'4'
+	movwf	ignore_digits
+	bsf		ignore_digit5
+    bsf     leftbind
+	output_16dp	d'0'
+	STRCAT_PRINT ""					; Display decimeters
+    bcf     leftbind
+	return
+
+max_depth_greater_99_84mtr:             ; Display only in full meters
+	btfss	max_depth_greater_100m		; Is max depth>100m already?
+	rcall	TFT_clear_max_depth			; No, clear max depth area and set flag
+	; Max. Depth is already in hi:lo
+	; Show max. depth in Full meters
+	; That means ignore figure 4 and 5
+	lfsr    FSR2,buffer
+	bsf		ignore_digit4
+	bsf		leftbind
 	output_16
-	STRCAT_PRINT ""
+	bcf		leftbind
+    STRCAT_PRINT ""					; Display full meters only
+	WIN_FONT 	FT_SMALL
 	return
 
+TFT_clear_max_depth:            			; No, clear max. depth area and set flag
+    WIN_BOX_BLACK   max_depth_row,.49,max_depth_column, max_depth_dm_column+.13    ;top, bottom, left, right
+	bsf		max_depth_greater_100m			; Set Flag
+	return
+
+
 TFT_max_pressure_apnoe:
 	btfss	FLAG_active_descent				; Are we descending?			
 	bra		TFT_max_pressure2				; Yes, show normal max.