changeset 497:06db5dd9149f

show numeric _and_ graphic velocity, move desat, nofly and interval into isr
author heinrichsweikamp
date Wed, 09 Nov 2011 16:17:11 +0100
parents 97d3f5537b43
children 4c7f7807b250
files code_part1/OSTC_code_asm_part1/isr.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm code_part1/OSTC_code_asm_part1/sleepmode.asm code_part1/OSTC_code_asm_part1/surfmode.asm
diffstat 4 files changed, 58 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/isr.asm	Mon Nov 07 13:08:52 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/isr.asm	Wed Nov 09 16:17:11 2011 +0100
@@ -388,6 +388,10 @@
         return                              ; NO : done.
 		clrf		secs                    ; YES: increment minutes instead...
 		bsf			oneminupdate
+
+		btfss		divemode				; In Divemode?
+		rcall		check_nofly_desat_time	; No, so reduce NoFly and Desat and increase interval
+
 		incf		mins,F
 		movlw		d'59'
 		cpfsgt		mins
@@ -438,4 +442,51 @@
 		movlw		.1
 		movwf		month
 		incf		year,F				
-		return
\ No newline at end of file
+		return
+
+check_nofly_desat_time:
+	bcf		nofly_active                ; Clear flag
+    movf    nofly_time+0,W              ; Is nofly null ?
+    iorwf   nofly_time+1,W
+    bz     	check_nofly_desat_time2     ; yes...
+
+	bsf		nofly_active                ; Set flag (again)
+	movlw	d'1'
+	subwf	nofly_time+0,F
+	movlw	d'0'
+	subwfb	nofly_time+1,F               ; reduce by one
+
+check_nofly_desat_time2:
+	movff	desaturation_time_buffer+0,lo
+	movff	desaturation_time_buffer+1,hi
+
+    movf    lo,W			             ; Is Desat null ?
+    iorwf   hi,W
+    bz     	check_nofly_desat_time3      ; yes...
+
+	movlw	d'1'
+	subwf	lo,F
+	movlw	d'0'
+	subwfb	hi,F		              	; reduce by one...
+
+	movff		lo,desaturation_time_buffer+0	; ...and copy back
+	movff		hi,desaturation_time_buffer+1
+
+check_nofly_desat_time3:
+	; Now increase interval timer
+	movff		desaturation_time_buffer+0,lo
+	movff		desaturation_time_buffer+1,hi
+	tstfsz		lo							;=0?
+	bra			calc_surface_interval2		; No
+	tstfsz		hi							;=0?
+	bra			calc_surface_interval2		; No
+	clrf		surface_interval+0
+	clrf		surface_interval+1			; Clear surface interval timer
+	return									; Done.
+
+calc_surface_interval2:						; Increase surface interval timer 
+	movlw		d'1'
+	addwf		surface_interval+0,F
+	movlw		d'0'
+	addwfc		surface_interval+1,F
+	return									; Done
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Mon Nov 07 13:08:52 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Wed Nov 09 16:17:11 2011 +0100
@@ -610,9 +610,13 @@
 	bcf			timeout_display				; Clear flag
 	bra			PLED_display_clear_common_y1
 
+PLED_display_velocity_graphical_clear:
+	WIN_BOX_BLACK	 .20, .90, .65, .75		; Clear graphic display
+	bra		PLED_display_velocity			; Continue with normal output
+
 PLED_display_velocity_graphical:
 	btfss	neg_flag
-	bra		PLED_display_velocity_clear	; No display for descend speed, clear instead
+	bra		PLED_display_velocity_graphical_clear
 	bsf		pled_velocity_display
 	; divA+0 holding the ascend speed in m/min
 	movff	divA+0,hi	; Copy
@@ -641,6 +645,7 @@
 	call	div16x16						;xA/xB=xC with xA as remainder 	
 	; xC+0 now holds amount of segments to show
 
+	movff	hi,divA+0	; Copy back for numeric output
 	movlw	d'7'
 	cpfslt	xC+0
 	bra		PLED_graph_vel_7
@@ -681,19 +686,6 @@
 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
@@ -721,8 +713,6 @@
 	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'
--- a/code_part1/OSTC_code_asm_part1/sleepmode.asm	Mon Nov 07 13:08:52 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/sleepmode.asm	Wed Nov 09 16:17:11 2011 +0100
@@ -62,9 +62,6 @@
 	btfsc	enter_error_sleep		; Enter Fatal Error Routine?
 	call	fatal_error_sleep		; Yes (In Sleepmode_vxx.asm!)
 	
-	call	calc_surface_interval	; Increases Surface-Interval time
-	call	nofly_timeout60			; check for no fly time
-
     ;---- adjust airpressure compensation any 15 minutes
 	incf	divemins+1,F			; counts to 14...
 	movlw	d'14'
--- a/code_part1/OSTC_code_asm_part1/surfmode.asm	Mon Nov 07 13:08:52 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/surfmode.asm	Wed Nov 09 16:17:11 2011 +0100
@@ -217,7 +217,6 @@
 	call	calc_deko_surfmode			; calculate desaturation every minute
 	call	check_temp_extrema			; check for new temperature extremas
 	call	PLED_custom_text			; Displays custom text
-	call	calc_surface_interval		; Increases Surface-Interval time
 	call	surfcustomview_minute		; Do every-minute tasks for the custom view area
 
 	btfsc	gauge_mode					; Ignore in gauge mode
@@ -233,56 +232,9 @@
 	bra		update_surfloop60_2
 
 update_surfloop60_2:
-	call	nofly_timeout60				; checks if nofly time is > 0
 	bcf		oneminupdate				
 	return
 
-nofly_timeout60:
-	movf	desaturation_time_buffer+0,W; Is Desat null ?
-    iorwf   desaturation_time_buffer+1,W
-    rcall	nofly_timeout60_0           ; No...
-
-    movf    nofly_time+0,W              ; Is nofly null ?
-    iorwf   nofly_time+1,W
-    bnz     nofly_timeout60_1           ; No...
-    
-	bcf		nofly_active                ; Clear flag
-	bcf		LED_blue                    ; Clear led.
-	return
-
-nofly_timeout60_0:
-	movlw	d'1'
-	subwf	desaturation_time_buffer+0,F
-	movlw	d'0'
-	subwfb	desaturation_time_buffer+1,F              ; reduce by one
-	return
-
-nofly_timeout60_1:
-	bsf		nofly_active                ; Set flag
-	movlw	d'1'
-	subwf	nofly_time+0,F
-	movlw	d'0'
-	subwfb	nofly_time+1,F              ; reduce by one
-	return
-
-calc_surface_interval:
-	movff		int_O_desaturation_time+0,lo			; divide by 60...
-	movff		int_O_desaturation_time+1,hi
-	tstfsz		lo							;=0?
-	bra			calc_surface_interval2		; No
-	tstfsz		hi							;=0?
-	bra			calc_surface_interval2		; No
-	clrf		surface_interval+0
-	clrf		surface_interval+1			; Clear surface interval timer
-	return
-
-calc_surface_interval2:						; Increase surface interval timer 
-	movlw		d'1'
-	addwf		surface_interval+0,F
-	movlw		d'0'
-	addwfc		surface_interval+1,F
-	return
-
 set_leds_surfmode:	
 	btfsc	nofly_active
 	btg		LED_blue