changeset 492:19b9e19ea4da

+CHANGE: Velocity display updated every second +NEW: CF60: Show graphical velocity indicator (Ascend only)
author heinrichsweikamp
date Sun, 06 Nov 2011 11:02:03 +0100
parents 560764da0629
children 4b2add2adde3
files code_part1/OSTC_code_asm_part1/MAIN.ASM code_part1/OSTC_code_asm_part1/changelog.txt code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/english_text.asm code_part1/OSTC_code_asm_part1/french_text.asm code_part1/OSTC_code_asm_part1/german_text.asm code_part1/OSTC_code_asm_part1/menu_reset.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm code_part1/OSTC_code_asm_part1/spanish_text.asm
diffstat 9 files changed, 125 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/MAIN.ASM	Fri Nov 04 16:24:12 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/MAIN.ASM	Sun Nov 06 11:02:03 2011 +0100
@@ -28,7 +28,8 @@
 	#include <P18F4685.INC>					;processor specific variable definitions
 
 	#include	definitions.asm				; Defines, I/O Ports and variables
-    #include    "../OSTC_code_c_part2/shared_definitions.h"
+;    #include    "../OSTC_code_c_part2/shared_definitions.h"
+     #include    "C:\Mk2\ostc2_code\code_part1\OSTC_code_c_part2\shared_definitions.h"
 
 reset_v code     0x0000
         goto	start						; Start!
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Fri Nov 04 16:24:12 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Sun Nov 06 11:02:03 2011 +0100
@@ -2,6 +2,8 @@
 BETA Version - Do NOT use for diving!
 BUGFIX: Missing surface pressure for CNS in decoplan.
 BUGFIX: Surface desat factor missing for Interval planning in GF mode.
+CHANGE: Velocity display updated every second
+NEW: CF60: Show graphical velocity indicator (Ascend only)
 
 New in 2.03 beta:
 BETA Version - Do NOT use for diving!
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Fri Nov 04 16:24:12 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Sun Nov 06 11:02:03 2011 +0100
@@ -80,7 +80,7 @@
 
 	bsf		twosecupdate					; Routines used in the "other second"
 	call	calc_average_depth				; calculate average depth
-	call	calc_velocity					; calculate vertical velocity and display if > threshold (every two seconds)
+;	call	calc_velocity					; calculate vertical velocity and display if > threshold (every two seconds)
 	
 	bra		diveloop_loop1x					; Common Tasks
 
@@ -138,6 +138,8 @@
 	btfsc	enter_error_sleep				; Enter Fatal Error Routine?
 	call	fatal_error_sleep				; Yes (In Sleepmode_vxx.asm!)
 
+	call	calc_velocity					; calculate vertical velocity and display if > threshold
+
 	bcf		onesecupdate					; one seconds update done
 
 diveloop_loop3:
@@ -278,7 +280,7 @@
 	bsf		twosecupdate		; No, but next second!
 	; Routines used in the "other second"
 	call	calc_average_depth	; calculate average depth
-	call	calc_velocity		; calculate vertical velocity and display if > threshold (every two seconds)
+;	call	calc_velocity		; calculate vertical velocity and display if > threshold (every two seconds)
 	
 ; Calculate CNS	
     rcall    set_actual_ppo2            ; Set char_I_actual_ppO2
@@ -809,7 +811,8 @@
 
 	movff	sub_c+0,xA+0
 	movff	sub_c+1,xA+1
-	movlw	d'39'			;77 when called every second....
+	;movlw	d'39'						;77 when called every second....
+	movlw	d'77'						;77 when called every second....
 	movwf	xB+0
 	clrf	xB+1
 	call	mult16x16					; differential pressure in mbar*77...
@@ -820,12 +823,11 @@
 	call	div16						; devided by 2^7 equals velocity in m/min
 
 	movlw	d'99'
-	cpfsgt	divA
+	cpfsgt	divA						; Limit to 99m/min max.
 	bra		calc_velocity3
 	movwf	divA						; divA=99
 
 calc_velocity3:
-
 	GETCUSTOM8	d'5'					; threshold for display vertical velocity
 	subwf	divA+0,W					; 
 
@@ -834,6 +836,17 @@
 
 update_velocity:
 	bsf		display_velocity
+
+	GETCUSTOM8	d'60'		; use graphic velocity (=1)?
+	movwf	lo
+	movlw	d'1'
+	cpfseq	lo					; =1?
+	bra		update_velocity1	; No
+
+	call	PLED_display_velocity_graphical
+	return
+
+update_velocity1:
 	call	PLED_display_velocity
 	return
 
--- a/code_part1/OSTC_code_asm_part1/english_text.asm	Fri Nov 04 16:24:12 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/english_text.asm	Sun Nov 06 11:02:03 2011 +0100
@@ -311,7 +311,7 @@
     TCODE    .40,   .35,     "AscentGas[/min]"           ;179 AscentGas[/min]   (Ascent+Deco gas usage)
     TCODE    .40,   .35,     "Future TTS[min]"           ;180 Future TTS[min]   (Compute TTS for extra time at current depth)
     TCODE    .40,   .35,     "Cave Warning[l]"           ;181 Cave Warning[l]   (Consomation warning for cave divers)
-    TCODE    .40,   .35,     "not used       "           ;182 not used
+    TCODE    .40,   .35,     "Graph. Velocity"           ;182 Graph. Velocity	(Show a graphical representation of the ascend speed)
     TCODE    .40,   .35,     "not used       "           ;183 not used
     TCODE    .40,   .35,     "not used       "           ;184 not used
     TCODE    .40,   .35,     "not used       "           ;185 not used
--- a/code_part1/OSTC_code_asm_part1/french_text.asm	Fri Nov 04 16:24:12 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/french_text.asm	Sun Nov 06 11:02:03 2011 +0100
@@ -311,7 +311,7 @@
     TCODE    .40,   .35,     "ConsoDeco[/min]"           ;179 AscentGas[/min]   (Ascent+Deco gas usage)
     TCODE    .40,   .35,     "DTR Réchap[min]"           ;180 Future TTS[min]   (Compute TTS for extra time at current depth)
     TCODE    .40,   .35,     "Alarme Sout.[l]"           ;181 Cave Warning[l]   (Consomation warning for cave divers)
-    TCODE    .40,   .35,     "not used       "           ;182 not used
+    TCODE    .40,   .35,     "Graph. Velocity"           ;182 Graph. Velocity	(Show a graphical representation of the ascend speed)
     TCODE    .40,   .35,     "not used       "           ;183 not used
     TCODE    .40,   .35,     "not used       "           ;184 not used
     TCODE    .40,   .35,     "not used       "           ;185 not used
--- a/code_part1/OSTC_code_asm_part1/german_text.asm	Fri Nov 04 16:24:12 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/german_text.asm	Sun Nov 06 11:02:03 2011 +0100
@@ -311,7 +311,7 @@
     TCODE    .40,   .35,     "Sonst.Gas[/min]"           ;179 AscentGas[/min]   (Ascent+Deco gas usage)
     TCODE    .40,   .35,     "TTS @ Zeit[min]"           ;180 Future TTS[min]   (Compute TTS for extra time at current depth)
     TCODE    .40,   .35,     "Cave Warning[l]"           ;181 Cave Warning[l]   (Consomation warning for cave divers)
-    TCODE    .40,   .35,     "nicht verwendet"           ;182 not used
+    TCODE    .40,   .35,     "Graph. Velocity"           ;182 Graph. Velocity	(Show a graphical representation of the ascend speed)
     TCODE    .40,   .35,     "nicht verwendet"           ;183 not used
     TCODE    .40,   .35,     "nicht verwendet"           ;184 not used
     TCODE    .40,   .35,     "nicht verwendet"           ;185 not used
--- a/code_part1/OSTC_code_asm_part1/menu_reset.asm	Fri Nov 04 16:24:12 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm	Sun Nov 06 11:02:03 2011 +0100
@@ -156,7 +156,7 @@
 	CF_DEFAULT    CF_COLOR,     d'255', 0,      0 		; color_standard1			Color Standard: White
 	CF_DEFAULT    CF_COLOR,     d'62',  0,      0 		; color_divemask			Color Divemask: Light green
     
-	CF_DEFAULT    CF_COLOR,     d'224', 0,      0 		; color_warnings			Color Warnings: Red
+	CF_DEFAULT    CF_COLOR,     d'224', 0,      0 		; CF37 color_warnings			Color Warnings: Red
 	CF_DEFAULT    CF_BOOL,	    d'0',   0,      0       ; show_seconds_divemode		=1 Show the seconds in Divemode
 	CF_DEFAULT    CF_BOOL,     	0,      0,      0 		; Adjust SetPoint if Diluent ppO2 > SetPoint
 	CF_DEFAULT    CF_BOOL,	    d'1',   0,      0       ; warn_ceiling_divemode		=1 Warn ceiling violation in divemode
@@ -168,8 +168,8 @@
 	CF_DEFAULT    CF_PERCENT,	d'101', d'50',  d'101'  ; color_warn_gf_percent		Warn-%
 	CF_DEFAULT    CF_CENTI,     d'161', d'100', d'161'  ; color_warn_ppo2_cbar		ppO2 warn
 
-	CF_DEFAULT    CF_INT8,	    d'15',  d'7',   d'20'	; color_warn_celocity_mmin	warn at xx m/min
-	CF_DEFAULT    CF_SEC+CF_NEG,d'0',  -d'120' ,d'120'  ; time_correction_value_default	Adds to Seconds on Midnight
+	CF_DEFAULT    CF_INT8,	    d'15',  d'7',   d'20'	; CF47 color_warn_celocity_mmin	warn at xx m/min
+	CF_DEFAULT    CF_SEC+CF_NEG,d'0',  -d'120' ,d'120'  ; CF48 time_correction_value_default	Adds to Seconds on Midnight
 	CF_DEFAULT    CF_BOOL,      d'0',   0,      0 		; CF49 Show Altimeter in surface mode
 	CF_DEFAULT    CF_BOOL,     	d'0',   0,      0       ; CF50 Show Log-Marker
 	CF_DEFAULT    CF_BOOL,	    d'1',   0,      0 		; CF51 Show Stopwatch
@@ -183,7 +183,7 @@
 	CF_DEFAULT    CF_INT8,      d'20',  d'5',   d'50'   ; CF57 Ascent/deco gas usage (SAC l/min)
 	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'10'   ; CF58 TTS for extra time at current depth [min]
 	CF_DEFAULT    CF_INT15,     d'0',   d'0',   d'7000' ; CF59 Cave conso warning [l]
-	CF_DEFAULT    CF_INT15,     0,      0,      0 		; UNUSED
+	CF_DEFAULT    CF_BOOL,     	0,   	0,      0 		; CF60 Show Graphical ascend speed indicator
 	CF_DEFAULT    CF_INT15,     0,      0,      0 		; UNUSED
 	                
 	CF_DEFAULT    CF_INT15,     0,      0,      0 		; UNUSED
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Fri Nov 04 16:24:12 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Sun Nov 06 11:02:03 2011 +0100
@@ -610,6 +610,91 @@
 	bcf			timeout_display				; Clear flag
 	bra			PLED_display_clear_common_y1
 
+PLED_display_velocity_graphical:
+	btfss	neg_flag
+	bra		PLED_display_velocity_clear	; No display for descend speed, clear instead
+	bsf		pled_velocity_display
+	; divA+0 holding the ascend speed in m/min
+	movff	divA+0,hi	; Copy
+	WIN_BOX_BLACK	 .20, .90, .65, .75		; Clear graphic display
+	GETCUSTOM8		d'36'					; Divemode mask
+    WIN_FRAME_COLOR   .20, .90, .65, .75	; Outer frame
+	GETCUSTOM8		d'36'					; Divemode mask
+	WIN_FRAME_COLOR   .20+.10, .90-.10, .65, .75	; Inner frames
+	GETCUSTOM8		d'36'					; Divemode mask
+	WIN_FRAME_COLOR   .20+.20, .90-.20, .65, .75	;
+	GETCUSTOM8		d'36'					; Divemode mask
+	WIN_FRAME_COLOR   .20+.30, .90-.30, .65, .75	;
+	
+	GETCUSTOM8		d'47'					; color_warn_celocity_mmin	
+	movwf	xA+0
+	clrf	xA+1
+	movlw	.5
+	movwf	xB+0							; Threshold for color warning (5 color normal + 2 color warning)
+	clrf	xB+1
+	call	div16x16						;xA/xB=xC with xA as remainder 	
+	; xC+0 holds stepsize in m/min (e.g. =3 for 15m/min warning treshold)
+	movff	hi,xA+0							; Velocity in m/min
+	clrf	xA+1
+	movff	xC+0,xB+0						; Step size
+	clrf	xB+1
+	call	div16x16						;xA/xB=xC with xA as remainder 	
+	; xC+0 now holds amount of segments to show
+
+	movlw	d'7'
+	cpfslt	xC+0
+	bra		PLED_graph_vel_7
+	movlw	d'6'
+	cpfslt	xC+0
+	bra		PLED_graph_vel_6
+	movlw	d'5'
+	cpfslt	xC+0
+	bra		PLED_graph_vel_5
+	movlw	d'4'
+	cpfslt	xC+0
+	bra		PLED_graph_vel_4
+	movlw	d'3'
+	cpfslt	xC+0
+	bra		PLED_graph_vel_3
+	movlw	d'2'
+	cpfslt	xC+0
+	bra		PLED_graph_vel_2
+	movlw	d'1'
+	cpfslt	xC+0
+	bra		PLED_graph_vel_1
+	bra		PLED_graph_vel_0			; Should not happen...
+
+PLED_graph_vel_7:
+	GETCUSTOM8		d'37'					; Color warning
+    WIN_BOX_COLOR   .22, .22+.6, .67, .73	; Fill box
+PLED_graph_vel_6:
+	GETCUSTOM8		d'37'					; Color warning
+    WIN_BOX_COLOR   .32, .32+.6, .67, .73	; Fill box
+PLED_graph_vel_5:
+    WIN_BOX_STD   	.42, .42+.6, .67, .73	; Fill box
+PLED_graph_vel_4:
+    WIN_BOX_STD   	.52, .52+.6, .67, .73	; Fill box
+PLED_graph_vel_3:
+    WIN_BOX_STD   	.62, .62+.6, .67, .73	; Fill box
+PLED_graph_vel_2:
+    WIN_BOX_STD   	.72, .72+.6, .67, .73	; Fill box
+PLED_graph_vel_1:
+    WIN_BOX_STD   	.82, .82+.6, .67, .73	; Fill box
+PLED_graph_vel_0:
+;	WIN_TOP		.90
+;	WIN_LEFT	.0
+;	WIN_FONT 	FT_SMALL
+;	lfsr	FSR2,letter
+;	movff	xC+0,lo
+;	output_99
+;	PUTC	' '
+;	movff	divA+0,lo
+;	output_99
+;	PUTC	' '
+;	call	word_processor
+	return
+
+
 PLED_display_velocity:
 	ostc_debug	'v'		; Sends debug-information to screen if debugmode active
 	WIN_TOP		.90
@@ -630,6 +715,16 @@
 	return
 
 PLED_display_velocity_clear:
+	GETCUSTOM8	d'60'			; use graphic velocity (=1)?
+	movwf	lo
+	movlw	d'1'
+	cpfseq	lo					; =1?
+	bra		PLED_display_velocity_clear1	; No, clear text display
+	WIN_BOX_BLACK	 .20, .90, .65, .75		; Clear graphic display
+	return
+
+
+PLED_display_velocity_clear1:
 	movlw	d'8'
 	movwf	temp1
 	WIN_TOP		.90
--- a/code_part1/OSTC_code_asm_part1/spanish_text.asm	Fri Nov 04 16:24:12 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/spanish_text.asm	Sun Nov 06 11:02:03 2011 +0100
@@ -310,7 +310,7 @@
     TCODE    .40,   .35,     "GasAscens[/min]"           ;179 AscentGas[/min]   (Ascent+Deco gas usage)
     TCODE    .40,   .35,     "Futuro TTS[min]"           ;180 Future TTS[min]   (Compute TTS for extra time at current depth)
     TCODE    .40,   .35,     "Cave Warning[l]"           ;181 Cave Warning[l]   (Consomation warning for cave divers)
-    TCODE    .40,   .35,     "sin uso        "           ;182 not used
+    TCODE    .40,   .35,     "Graph. Velocity"           ;182 Graph. Velocity	(Show a graphical representation of the ascend speed)
     TCODE    .40,   .35,     "sin uso        "           ;183 not used
     TCODE    .40,   .35,     "sin uso        "           ;184 not used
     TCODE    .40,   .35,     "sin uso        "           ;185 not used