changeset 129:06c4899ddb4b

Custom views in dive mode configrable (New CF50-CF53) Total Average Depth (Non-Resetable) Some Display fixes in Divemode Bugfix Timeout reset in Surfacemode
author Heinrichsweikamp
date Tue, 04 Jan 2011 16:32:28 +0100
parents 245de99d1d15
children d721b49b8934
files code_part1/OSTC_code_asm_part1/MAIN.ASM code_part1/OSTC_code_asm_part1/changelog.txt code_part1/OSTC_code_asm_part1/customview.asm code_part1/OSTC_code_asm_part1/definitions.asm code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/io.asm code_part1/OSTC_code_asm_part1/menu.asm code_part1/OSTC_code_asm_part1/menu_reset.asm code_part1/OSTC_code_asm_part1/oled_samsung.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm code_part1/OSTC_code_asm_part1/text_table.asm
diffstat 11 files changed, 142 insertions(+), 95 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/MAIN.ASM	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/MAIN.ASM	Tue Jan 04 16:32:28 2011 +0100
@@ -114,7 +114,6 @@
 #include	sync_clock.asm		; syncs RTC with PC
 #include	start.asm			; Startup and init, checks background debugger
 #include	simulator.asm		; Stand-alone simulator routines
-#include 	io.asm				; Low-Level I/O access
 #include	customview.asm		; Customview for divemode
 #include    strings.asm         ; Basic string operations
 
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Tue Jan 04 16:32:28 2011 +0100
@@ -1,7 +1,17 @@
 New in 1.75 Beta:
 BETA Version - Do NOT use for diving!
 BUGFIX: Decomask in Gauge mode removed
-
+NEW: Decoplan rewritten, now has practically unlimited number of stops (OSTC MK.2 only)
+NEW: Altimeter (OSTC MK.2 only)
+BUGFIX: Timeout reset in Customview  (OSTC MK.2 only)
+BUGFIX: Surface Interval
+NEW: Non-Resettable Average Depth (OSTC MK.2 only)
+NEW: CF41: Mix Type Icons in Surfacemode
+NEW: CF49: Show Altimeter in Surfacemode
+NEW: CF50: Show LogMarker in Divemode/Customview
+NEW: CF51: Show Stopwatch in Divemode/Customview
+NEW: CF52: Show Tissue Graph in Divemode/Customview
+NEW: CF53: Show Leading Tissue in Divemode/Customview
 
 New in 1.74 Beta:
 BETA Version - Do NOT use for diving!
--- a/code_part1/OSTC_code_asm_part1/customview.asm	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/customview.asm	Tue Jan 04 16:32:28 2011 +0100
@@ -60,8 +60,14 @@
 	bra		customview_1sec_clock			; Update the Clock
 	dcfsnz	temp1,F
 	bra		customview_1sec_lead_tiss		; Update the leading tissue
+	dcfsnz	temp1,F
+	bra		customview_1sec_average			; Update the Average depth
 	; Menupos3=0, do nothing
 	return
+
+customview_1sec_average:
+	call	PLED_total_average_show2	; Update the figures only
+	return
 	
 customview_1sec_stopwatch:
 	call	PLED_stopwatch_show2	; Update figures only
@@ -83,6 +89,8 @@
 	bra		customview_minute_clock			; Update the Clock
 	dcfsnz	temp1,F
 	bra		customview_minute_lead_tiss		; Update the leading tissue
+	dcfsnz	temp1,F
+	bra		customview_minute_average		; Update the Average depth
 	; Menupos3=0, do nothing
 	return
 
@@ -96,12 +104,13 @@
 
 customview_minute_marker:			; Do nothing extra
 customview_minute_stopwatch:		; Do nothing extra
+customview_minute_average:			; Do nothing extra
 	return
 
 customview_toggle:		; Yes, show next customview (and delete this flag)
 	ostc_debug	'X'		; Sends debug-information to screen if debugmode active
 	incf	menupos3,F			; Number of customview to show
-	movlw	d'4'				; Max number
+	movlw	d'5'				; Max number
 	cpfsgt	menupos3			; Max reached?
 	bra		customview_mask		; No, show
 	clrf	menupos3			; Reset to zero (Zero=no custom view)
@@ -116,16 +125,29 @@
 	bra		customview_init_clock			; Show the clock
 	dcfsnz	temp1,F
 	bra		customview_init_lead_tissue		; Show the leading tissue
+	dcfsnz	temp1,F
+	bra		customview_init_average			; Show Total average depth
 ;	bra		customview_init_nocustomview	; menupos3=0 -> No Customview
 customview_init_nocustomview:
 	bra		customview_toggle_exit	
 
+customview_init_average:
+	call	PLED_total_average_show		; Show Average with mask
+	bra		customview_toggle_exit	
+
 customview_init_stopwatch:
-; Init Stopwatch
-	call	PLED_stopwatch_show
+	GETCUSTOM8	d'51'					; Show Stopwatch? (=1 in WREG)
+	decfsz		WREG,F					; WREG=1?	
+	bra			customview_toggle		; No, use next Customview
+
+	call	PLED_stopwatch_show			; Init Stopwatch display
 	bra		customview_toggle_exit	
 
 customview_init_marker:					; Init Marker 
+	GETCUSTOM8	d'50'					; Show Marker? (=1 in WREG)
+	decfsz		WREG,F					; WREG=1?	
+	bra			customview_toggle		; No, use next Customview
+
 	DISPLAYTEXT		d'151'				; Set Marker?
 	bra		customview_toggle_exit	
 
@@ -134,9 +156,18 @@
 	bra		customview_toggle_exit	
 
 customview_init_lead_tissue:			; Show leading tissue
+	GETCUSTOM8	d'53'					; Show Lead Tissue? (=1 in WREG)
+	decfsz		WREG,F					; WREG=1?	
+	bra			customview_toggle		; No, use next Customview
+
 	call	PLED_show_leading_tissue
 	bra		customview_toggle_exit	
 
+;customview_init_graphs:					; Show tissue graph
+; 	GETCUSTOM8	d'52'					; Show Tissue Graph? (=1 in WREG)
+;	decfsz		WREG,F					; WREG=1?	
+;	bra			customview_toggle		; No, use next Customview
+
 customview_toggle_exit:
 	bcf		toggle_customview			; Clear flag
 	ostc_debug	'Y'		; Sends debug-information to screen if debugmode active
@@ -200,7 +231,8 @@
 
 surfcustomview_toggle_exit:
 	bcf		toggle_customview			; Clear flag
-
+	clrf	timeout_counter2			; Clear timeout
+	return
 
 
 
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Tue Jan 04 16:32:28 2011 +0100
@@ -121,7 +121,8 @@
 	textlength					
 	textaddress:2				
 
-	average_depth_hold:4		; Holds Sum of depths
+	average_depth_hold:4		; Holds Sum of depths (Resettable)
+	average_depth_hold_total:4	; Holds Sum of depths (Non-Resettable)
 	b0_lo						; Temp (calculate_average)
 	b0_hi						; Temp (calculate_average)
 	average_divesecs:2			; Used for resetable average depth display
@@ -215,7 +216,8 @@
    	amb_pressure:2					; ambient pressure [mBar]
    	rel_pressure:2					; amb_pressure - surface pressure [mBar]
    	max_pressure:2					; Max. pressure for the dive [mBar]
-	avr_rel_pressure:2				; Average rel. pressure (Average depth) for the dive [mBar]
+	avr_rel_pressure:2				; Average rel. pressure (Average depth) for the dive [mBar], Resettable
+ 	avr_rel_pressure_total:2		; Average rel. pressure (Average depth) for the dive [mBar], Non-Resettable
    	last_pressure:2
   	temperature:2
   	last_temperature:2
@@ -297,8 +299,6 @@
 	customfunction_temp1		; start of custom function descriptors 
 	customfunction_temp2		; used in GETCUSTOM8 and GETCUSTOM15
 	
-	switch_timeout				; used for hold-down count function
-	
 	decoplan_page				; used in PLED_MultiGF,...
 	temp10						; used in customview
 
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Jan 04 16:32:28 2011 +0100
@@ -1274,6 +1274,8 @@
 
 change_logbook_offset2:
 	bcf		LED_blue
+	clrf	surface_interval+0
+	clrf	surface_interval+1		; Clear surface interval timer
 
 end_dive_common:
 	bcf		simulatormode_active		; if we were in simulator mode
@@ -1284,11 +1286,6 @@
 	call	deco_gradient_array
 	movlb	b'00000001'					; select ram bank 1
 
-	btfss	restore_deco_data			; Restore decodata?
-	goto	surfloop					; and return to surfaceloop
-;new 1.71beta:
-	clrf	surface_interval+0
-	clrf	surface_interval+1		; Clear surface interval timer
 	goto	surfloop					; and return to surfaceloop
 
 timeout_divemode:
@@ -1464,7 +1461,7 @@
 
 	; 1. Add new 2xdepth to the Sum of depths registers
 	movff	rel_pressure+0,b0_lo
-	movff	rel_pressure+1,b0_hi
+	movff	rel_pressure+1,b0_hi	; Buffer...
 
 	movf	b0_lo,w
 	addwf	average_depth_hold+0,F
@@ -1482,8 +1479,24 @@
 	addwfc	average_depth_hold+2,F
 	addwfc	average_depth_hold+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar
 
+; Do the same for the _total registers (Non-Resettable)
+	movf	b0_lo,w
+	addwf	average_depth_hold_total+0,F
+	movf	b0_hi,w
+	addwfc	average_depth_hold_total+1,F
+	movlw	d'0'
+	addwfc	average_depth_hold_total+2,F
+	addwfc	average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar
+
+	movf	b0_lo,w
+	addwf	average_depth_hold_total+0,F
+	movf	b0_hi,w
+	addwfc	average_depth_hold_total+1,F
+	movlw	d'0'
+	addwfc	average_depth_hold_total+2,F
+	addwfc	average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar
+
 	; 2. Compute Average Depth on base of average_divesecs:2
-	
 	movff	average_divesecs+0,xB+0
 	movff	average_divesecs+1,xB+1		; Copy
 	movff	average_depth_hold+0,xC+0
@@ -1494,6 +1507,36 @@
 	call	div32x16 	; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
 	movff	xC+0,avr_rel_pressure+0
 	movff	xC+1,avr_rel_pressure+1
+
+	; Compute Total Average Depth on base of divemins:2 and divesecs
+	movff	divemins+0,xA+0
+	movff	divemins+1,xA+1
+	movlw	d'60'
+	movwf	xB+0
+	clrf	xB+1
+	call	mult16x16				; xC:4=xA:2*xB:2
+	movf	divesecs,W
+	addwf	xC+0,F
+	movlw	d'0'
+	addwfc	xC+1,F
+	movlw	d'3'					; 2+1
+	btfss	divesecs,0				; divesecs even?
+	movlw	d'2'					; Yes, do not add +1
+	addwf	xC+0,F
+	movlw	d'0'
+	addwfc	xC+1,F
+	; Ignore xC+2 and xC+3. Total Average will only work up to divetime=1092:16
+	movff	xC+0,xB+0
+	movff	xC+1,xB+1		; Copy
+	movff	average_depth_hold_total+0,xC+0
+	movff	average_depth_hold_total+1,xC+1
+	movff	average_depth_hold_total+2,xC+2
+	movff	average_depth_hold_total+3,xC+3
+
+	call	div32x16 	; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+	movff	xC+0,avr_rel_pressure_total+0
+	movff	xC+1,avr_rel_pressure_total+1
+
 	return
 	
 reset_average1:
@@ -1540,6 +1583,10 @@
 	clrf	AlarmType					; Clear all alarms
 	bcf		event_occured				; clear flag
 	rcall	reset_average1				; Reset the resettable average depth
+	clrf	average_depth_hold_total+0
+	clrf	average_depth_hold_total+1
+	clrf	average_depth_hold_total+2
+	clrf	average_depth_hold_total+3	; Clear Non-Resettable Average
 	bcf		depth_greater_100m			; clear flag
 	setf	last_diluent				; to be displayed after first calculation (range: 0 to 100 [%])
 	bcf		dekostop_active	
--- a/code_part1/OSTC_code_asm_part1/io.asm	Tue Jan 04 02:49:15 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-; OSTC - diving computer code
-; Copyright (C) 2009 HeinrichsWeikamp GbR
-;    This program is free software: you can redistribute it and/or modify
-;    it under the terms of the GNU General Public License as published by
-;    the Free Software Foundation, either version 3 of the License, or
-;    (at your option) any later version.
-;    This program is distributed in the hope that it will be useful,
-;    but WITHOUT ANY WARRANTY; without even the implied warranty of
-;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;    GNU General Public License for more details.
-;    You should have received a copy of the GNU General Public License
-;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-
-; low-level routines for i/O
-; written by: Matthias Heinrichs, info@heinrichsweikamp.com
-; written: 090801
-; last updated: 100421
-; known bugs:
-; ToDo: Remove file
-
--- a/code_part1/OSTC_code_asm_part1/menu.asm	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/menu.asm	Tue Jan 04 16:32:28 2011 +0100
@@ -28,40 +28,6 @@
 	bcf		switch_right
 	return
 
-;	movlw	d'40'
-;	btfss	button_delay_done		; Start counting?
-;	movlw	d'200'
-;	movwf	switch_timeout
-;
-;wait_switches1:
-;	WAITMS	d'5'
-;	btfsc	SWITCH2
-;	bra		wait_switches2		; Check other switch
-;
-;	decfsz	switch_timeout,F
-;	bra		wait_switches1
-;	
-;	btfsc	SWITCH2
-;	bra		wait_switches3
-;	
-;	bsf		button_delay_done		; Start counting
-;	bsf		switch_left				; Set button flag
-;	bcf		switch_right			; only for the other button
-;;	bcf		LEDg
-;	return
-;
-;wait_switches2:
-;	btfss	SWITCH1
-;	bra		wait_switches1		; Wait 
-;	
-;	; Yes, both switches released before timeout...
-;wait_switches3:
-;	bcf		switch_left
-;	bcf		switch_right
-;	bcf		button_delay_done
-;	bcf		LED_red
-;	return
-;
 menu:
 	bcf		deco_mode_changed			; Clear flag (Description is only showed once)
 	bcf		LED_blue
--- a/code_part1/OSTC_code_asm_part1/menu_reset.asm	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm	Tue Jan 04 16:32:28 2011 +0100
@@ -165,11 +165,11 @@
 	CF_DEFAULT    CF_INT8,	    d'15',  d'7',   d'20'	; color_warn_celocity_mmin	warn at xx m/min
 	CF_DEFAULT    CF_SEC,	    d'42',  d'0',   d'240'  ; time_correction_value_default	Adds to Seconds on Midnight
 	CF_DEFAULT    CF_BOOL,      d'1',   0,      0 		; CF#49 Show Altimeter in surface mode
-	CF_DEFAULT    CF_INT15,     0,      0,      0       ; UNUSED
-	CF_DEFAULT    CF_INT15,     0,      0,      0 		; UNUSED
+	CF_DEFAULT    CF_BOOL,     	d'0',   0,      0       ; CF50 Show Log-Marker
+	CF_DEFAULT    CF_BOOL,	    d'1',   0,      0 		; CF51 Show Stopwatch
 	                
-	CF_DEFAULT    CF_INT15,     0,      0,      0 		; UNUSED
-	CF_DEFAULT    CF_INT15,     0,      0,      0 		; UNUSED
+	CF_DEFAULT    CF_BOOL,     	d'1',   0,      0 		; CF52 Show Tissue Graph in Divemode
+	CF_DEFAULT    CF_BOOL,	    d'0',   0,      0 		; CF53 Show Laeding Tissue in Divemode
 	CF_DEFAULT    CF_INT15,     0,      0,      0 		; UNUSED
 	CF_DEFAULT    CF_INT15,     0,      0,      0 		; UNUSED
 	CF_DEFAULT    CF_INT15,     0,      0,      0 		; UNUSED
--- a/code_part1/OSTC_code_asm_part1/oled_samsung.asm	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/oled_samsung.asm	Tue Jan 04 16:32:28 2011 +0100
@@ -237,10 +237,10 @@
 	bra		PLED_box2
 
 	movlw	0x00					; NOP, to stop Address Update Counter
-	bra     PLED_CmdWrite
+	bra     PLED_CmdWrite			; Returns...
 
 ;=============================================================================
-; PLED_ClearScreen: An optimized version of PLEX_box, for ful screen black.
+; PLED_ClearScreen: An optimized version of PLEX_box, for full screen black.
 ; Trashed: WREG, PROD
 
 PLED_ClearScreen:
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Tue Jan 04 16:32:28 2011 +0100
@@ -867,7 +867,7 @@
 
 PLED_show_ppO2:					; Show ppO2
 	ostc_debug	't'		; Sends debug-information to screen if debugmode active
-	WIN_TOP		.120
+	WIN_TOP		.119
 	WIN_LEFT	.0
 	WIN_FONT 	FT_SMALL
 	PLED_color_code		warn_ppo2		; Color-code output (ppO2 stored in xC)
@@ -1346,7 +1346,7 @@
 	WIN_INVERT	.0					; Init new Wordprocessor
 	call	PLED_standard_color
 
-    STRCPY_PRINT "\xB7"
+    STRCPY_PRINT "\xB7"				; Cursor
 
 	bcf			sleepmode					; clear some flags
 	bcf			menubit2
@@ -2009,7 +2009,6 @@
     PUTC    ':'
 	movff	wait_temp,lo
 	output_99x
-	bcf		leftbind
 	call	word_processor
 
 	ostc_debug	'U'				; Sends debug-information to screen if debugmode active
@@ -2029,6 +2028,27 @@
 	STRCAT_PRINT "m"
 	return
 
+PLED_total_average_show:
+	; Non-Resettable Average
+	call		PLED_divemask_color	; Set Color for Divemode mask
+	DISPLAYTEXTH	d'281'			; Avr.Depth
+
+PLED_total_average_show2:
+	WIN_TOP		.192
+	WIN_LEFT	.110
+	WIN_FONT	FT_SMALL
+	call	PLED_standard_color
+
+	lfsr	FSR2,letter
+	movff	avr_rel_pressure_total+0,lo
+	movff	avr_rel_pressure_total+1,hi
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mBar]
+	bsf		ignore_digit5		; do not display 1cm depth
+	bcf		leftbind
+	output_16dp	d'3'
+	STRCAT_PRINT "m"
+	return
+
 
 PLED_serial:			; Writes OSTC #Serial and Firmware version in surfacemode
 	ostc_debug	'a'		; Sends debug-information to screen if debugmode active
@@ -2050,7 +2070,7 @@
 
 	bsf		leftbind
 	output_16
-	STRCAT  " \x85\x86 V"
+	STRCAT  " \x85\x86 V"		; Scribble logo...
 	movlw	softwareversion_x
 	movwf	lo
 	bsf		leftbind
@@ -2541,15 +2561,9 @@
 	movlw	d'125'
 	movff	WREG,win_top
 
-    STRCPY_PRINT "\xB7"
+    STRCPY_PRINT "\xB7"				; Cursor
 	return
 
-;PLED_profileview_menu:
-;	DISPLAYTEXT	.127					;"Exit"
-;	DISPLAYTEXT	.128					;"Delete"
-;;	DISPLAYTEXT	.132					;"Format"
-;	return
-
 ;PLED_saturation_graph_divemode:
 ;	ostc_debug	'h'		; Sends debug-information to screen if debugmode active
 PLED_tissue_saturation_graph:
--- a/code_part1/OSTC_code_asm_part1/text_table.asm	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/text_table.asm	Tue Jan 04 16:32:28 2011 +0100
@@ -399,7 +399,7 @@
 	DB	.20,.125			;279
 	DB	.20,.155			;280
 	
-	DB	.100,.50			;281
+	DB	.93,.170			;281	Avr.Depth
 	DB	.90,.170			;282	Lead Tiss.
 	DB	.93,.170			;283	Stopwatch
 	DB	.20,.95				;284
@@ -587,10 +587,10 @@
 	DA	"Vel.warn[m/min]}"		;169
 	DA	"Time offset/day}"		;170
 	DA	"Show altimeter }"		;171
-	DA	"not used       }"		;172
-	DA	"not used       }"		;173
-	DA	"not used       }"		;174
-	DA	"not used       }"		;175
+	DA	"Show Log-Marker}"		;172
+	DA	"Show Stopwatch }"		;173
+	DA	"ShowTissueGraph}"		;174
+	DA	"Show Lead.Tiss.}"		;175
 	DA	"not used       }"		;176
 	DA	"not used       }"		;177
 	DA	"not used       }"		;178
@@ -709,7 +709,7 @@
 	DA	"Max. Depth:}"			;278		l=12
 	DA	"Calculate Deco}}"		;279		l=16
 	DA	"Show Decoplan}"		;280		l=14
-	DA	"unused   }"			;281		l=10
+	DA	"Avr.Depth}"			;281		l=10
 	DA	"Lead Tiss.}}"			;282		l=12
 	DA	"Stopwatch}"			;283		l=10
 	DA	"Reset Logbook}"		;284		l=14