changeset 519:154b1d1c489e

NEW added GF surface display.
author JeanDo
date Tue, 06 Dec 2011 18:02:18 +0100
parents 52f3f3f39932
children acf4776eec08
files code_part1/OSTC_code_asm_part1/changelog.txt code_part1/OSTC_code_asm_part1/pled_outputs.asm code_part1/OSTC_code_asm_part1/simulator.asm code_part1/OSTC_code_asm_part1/surfmode.asm
diffstat 4 files changed, 60 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Mon Dec 05 21:04:10 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Tue Dec 06 18:02:18 2011 +0100
@@ -1,3 +1,6 @@
+New in 2.07 beta:
+NEW: Added GF surface display (when > CF08).
+
 New in 2.06 beta:
 BETA Version - Do NOT use for diving!
 CHANGE: NDL routine faster/more precise simulation
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Mon Dec 05 21:04:10 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Tue Dec 06 18:02:18 2011 +0100
@@ -1878,8 +1878,8 @@
 	bsf			leftbind
 	movf		lo,W
 	movff		hi,lo
-	movwf		hi							; exchange lo and hi...
-	output_8							; Hours
+	movwf		hi                      ; exchange lo and hi...
+	output_8                            ; Hours
 	PUTC        ':'
 	movff		hi,lo					; Minutes
 	output_99x
@@ -2020,7 +2020,7 @@
 	movwf	wait_temp					; Minimum = 3
 
 update_batt_voltage2a:
-    WIN_BOX_STD .181, .187, .32, .34
+    WIN_BOX_STD .181, .187, .32, .34    ; Battery nose
 
 update_batt_voltage3:
 	GETCUSTOM8	d'34'			; Color battery
@@ -2030,17 +2030,17 @@
 	movlw	color_green			; Charge done.
     call	PLED_set_color
 
-	movlw	.175
-	movff	WREG,win_top		; row top (0-239)
-	movlw	.19
-	movff	WREG,win_height
-	movlw	.2
-	movff	WREG,win_leftx2		; column left (0-159)
+	movlw   .175
+	movff   WREG,win_top		; row top (0-239)
+	movlw   .19
+	movff   WREG,win_height
+	movlw   .2
+	movff   WREG,win_leftx2		; column left (0-159)
     movff   wait_temp,win_width	; column right (0-159)
-	call	PLED_box
-	call		PLED_standard_color
+	call    PLED_box
+	call    PLED_standard_color
 	return
-		
+
 update_batt_voltage2_empty:
 	movlw	d'1'
 	movwf	wait_temp
@@ -2266,7 +2266,6 @@
 	DISPLAYTEXT	d'140'			; "SURFACE"
 	call	PLED_standard_color
 
-
 	WIN_TOP		.85
 	WIN_LEFT	.90
 	WIN_FONT	FT_MEDIUM
@@ -3592,6 +3591,8 @@
 	STRCAT_PRINT "%"
 	return
 
+;-----------------------------------------------------------------------------
+;
 PLED_display_cns_surface:
 ; Check if CNS should be displayed
 	movff	char_O_CNS_fraction,lo		; copy into bank1
@@ -3614,9 +3615,32 @@
 	bsf		leftbind
 	output_8
 	bcf		leftbind
-	STRCAT_PRINT "%"
+	STRCAT_PRINT "% "
 	return
 
+;-----------------------------------------------------------------------------
+; Display GF at furface, if > CF8.
+;
+PLED_display_gf_surface:
+        movff	char_O_gradient_factor,lo   ; gradient factor
+        GETCUSTOM8	d'8'                ; threshold for display
+        cpfslt	lo                      ; show value?
+        bra		PLED_display_gf_surf_1  ; YES: do it.
+        return
+
+PLED_display_gf_surf_1:
+        WIN_TOP	    .175
+        WIN_LEFT	.45
+        WIN_FONT 	FT_SMALL
+        PLED_color_code		warn_gf		; Color-code Output
+
+        STRCPY  TXT_GF3
+        movff   char_O_gradient_factor,lo		; gradient factor
+        output_8
+        STRCAT_PRINT  "%  "
+        goto    PLED_standard_color
+
+;-----------------------------------------------------------------------------
 
 PLED_custom_text:
 	read_int_eeprom	d'64'
@@ -3693,7 +3717,7 @@
 	movff	hi,lo			; copy gas number
 	output_8				; display gas number
 	PUTC    ':'
-	movff	wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM
+	movff	wait_temp, EEADR            ; Gas #hi: %O2 - Set address in internal EEPROM
 	call	read_eeprom		; get byte (stored in EEDATA)
 	movff	EEDATA,lo		; copy to lo
 	output_8				; outputs into Postinc2!
--- a/code_part1/OSTC_code_asm_part1/simulator.asm	Mon Dec 05 21:04:10 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/simulator.asm	Tue Dec 06 18:02:18 2011 +0100
@@ -503,7 +503,13 @@
 	ostc_debug	'G'		; Sends debug-information to screen if debugmode active
 	call	deco_calc_desaturation_time	; calculate desaturation time
 	movlb	b'00000001'                 ; select ram bank 1
-	
+
+	; Reset gradient factor until next computation, to avoid spurious
+	; displays after  simulation.
+	clrf    WREG
+	movff   WREG,char_O_gradient_factor
+	movff   WREG,char_O_relative_gradient_GF
+
 	; Note: should not reset nofly-time here: the true value have continued to be decremented
 	;       during simulation, which is the right thing to do...
 	ostc_debug	'H'		; Sends debug-information to screen if debugmode active
--- a/code_part1/OSTC_code_asm_part1/surfmode.asm	Mon Dec 05 21:04:10 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/surfmode.asm	Tue Dec 06 18:02:18 2011 +0100
@@ -128,16 +128,23 @@
 	call	PLED_clock					; update clock
 	call	test_charger				; check if charger IC is active
 	call	timeout_surfmode			; check timeout 
-	call	update_batt_voltage			; display battery voltage
+    call    update_batt_voltage			; display battery voltage
 	call	timeout_premenu				; timeout premenu
 	call	set_leds_surfmode			; Sets Warning and No-Fly LEDs
 	call    check_customfunctions       ; Checks CF functions and displays warning symbol if something critical is wrong
 	call	PLED_display_decotype_surface	; Show deco mode
 	call	surfcustomview_second		; Do every-second tasks for the custom view area
 	call    dive_type_icons             ; Draw Air/Nitrox/Trimix color icon.
-	btfsc	enter_error_sleep			; Enter Fatal Error Routine?
-	call	fatal_error_sleep			; Yes (In Sleepmode.asm!)
-	bcf		onesecupdate				; every second tasks done
+
+; Every 2 seconds, overwrite with GF value (if needed to display)
+    btfsc   secs,1                      ; Alternating every 2sec (if needed)
+    call    PLED_display_cns_surface    ; Display CNS (if > CF15).
+    btfss   secs,1
+    call    PLED_display_gf_surface     ; Display GF (if > CF8).
+
+    btfsc	enter_error_sleep			; Enter Fatal Error Routine?
+    call	fatal_error_sleep			; Yes (In Sleepmode.asm!)
+    bcf		onesecupdate				; every second tasks done
 	
 surfloop_loop2:	
 ; Tasks approx. every 50ms for all modes
@@ -225,7 +232,6 @@
 	bra		update_surfloop60_2
 
 ; One Minute tasks for deco modes
-	call	PLED_display_cns_surface	; Update surface CNS display (If allowed by CF15)
 	call	PLED_nofly_time				; display nofly time
 	call	PLED_desaturation_time		; display desaturation time
 	btfsc	premenu						; Not when "Menu?" is displayed!