changeset 665:259e4c1bf3c2

grey-out TTS and ceiling after gas change (until new plan is ready)
author heinrichsweikamp
date Wed, 14 Nov 2012 12:39:39 +0100
parents 9c13bf8a3033
children 3282581fe178
files code_part1/OSTC_code_asm_part1/adc_rtc.asm code_part1/OSTC_code_asm_part1/definitions.asm code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/divemode_menu.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm
diffstat 5 files changed, 18 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/adc_rtc.asm	Wed Nov 14 12:02:14 2012 +0100
+++ b/code_part1/OSTC_code_asm_part1/adc_rtc.asm	Wed Nov 14 12:39:39 2012 +0100
@@ -91,9 +91,8 @@
 
 get_battery_voltage4:
 	; check if the battery control memory needs to be initialised!
-	bcf		initialize_battery1		; clear check-flags
-	bcf		initialize_battery2
-
+	bcf		initialize_battery1		; clear check-flag
+	
 	read_int_eeprom d'40'			; get lowest battery voltage seen in mV
 	movff	EEDATA,sub_b+0
 	read_int_eeprom d'41'
@@ -113,14 +112,11 @@
 	movwf	sub_a+1
 	call	sub16					;  sub_c = sub_a - sub_b
 	btfss	neg_flag				; neg_flag=1 if eeprom40:41 < 4500
-	bsf		initialize_battery2		; battery need to be initialised
+	bsf		initialize_battery1		; battery need to be initialised
 	
 	btfss	initialize_battery1		; battery need to be initialised?
 	bra		get_battery_no_init		; No, we have already valid values, just check for new extremas
 
-	btfss	initialize_battery2		; battery need to be initialised?
-	bra		get_battery_no_init		; No, we have already valid values, just check for new extremas
-
 get_battery_voltage_reset:	
 	; Init EEPROM for battery control
 	; Reset lowest battery seen
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Wed Nov 14 12:02:14 2012 +0100
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Wed Nov 14 12:39:39 2012 +0100
@@ -530,7 +530,7 @@
 #DEFINE	ignore_digit4			flag11,3	;=1: Ignores digits 4-5 in valconv
 #DEFINE	charge_done				flag11,4	;=1: Complete charge cycle done
 #DEFINE	initialize_battery1		flag11,5	;=1: Battery memory need to be initialised
-#DEFINE	initialize_battery2		flag11,6	;=1: Battery memory need to be initialised
+#DEFINE	decoplan_invalid    	flag11,6	;=1: Decoplan still invalid (After a gas change)
 #DEFINE	charge_started			flag11,7	;=1: Charger started in CC mode
 
 #DEFINE	setpoint_changed		flag12,0	;=1: Setpoint was changed in divemode, store in profile
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Wed Nov 14 12:02:14 2012 +0100
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Wed Nov 14 12:39:39 2012 +0100
@@ -604,6 +604,7 @@
     return                              ; Return is status <> 0
 
     ; Check if deco stops are necessary ?
+    bcf     decoplan_invalid            ; The decoplan is valid
 	movff	char_O_first_deco_depth,wait_temp	; copy ceiling to temp register
 	tstfsz	wait_temp							; Ceiling<0m?
 	bra		calc_deko_divemode3					; Yes!
@@ -1997,7 +1998,8 @@
 	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	
+	bcf		dekostop_active
+    bcf     decoplan_invalid
 	bcf		is_bailout					;=1: CC mode, but bailout active!		
 	bcf		better_gas_available        ;=1: A better gas is available and a gas change is advised in divemode
     bcf     tts_extra_time              ;=1: Compute TTS if extra time spent at current depth
--- a/code_part1/OSTC_code_asm_part1/divemode_menu.asm	Wed Nov 14 12:02:14 2012 +0100
+++ b/code_part1/OSTC_code_asm_part1/divemode_menu.asm	Wed Nov 14 12:39:39 2012 +0100
@@ -584,6 +584,7 @@
 	movff	EEDATA, char_I_N2_ratio		; = N2!
 	bsf		manual_gas_changed			; set event flag
 	bsf		event_occured				; set global event flag
+    bsf     decoplan_invalid            ; The decoplan needs to updated
     clrf    WREG
     movff   WREG,char_O_deco_status     ; Restart decoplan computation mH
     bsf		is_bailout					;=1: CC mode, but bailout active!		
@@ -700,6 +701,7 @@
 	bcf		display_set_setpoint		; Clear Display Flag
 	bsf		stored_gas_changed			; set event flag
 	bsf		event_occured				; set global event flag
+    bsf     decoplan_invalid            ; The decoplan needs to updated
     clrf    WREG
     movff   WREG,char_O_deco_status     ; Restart decoplan computation mH
 	bra		timeout_divemenu2			; quit menu!
@@ -740,6 +742,7 @@
 	movff	EEDATA, char_I_N2_ratio		; = N2!
 	bsf		stored_gas_changed			; set event flag
 	bsf		event_occured				; set global event flag
+    bsf     decoplan_invalid            ; The decoplan needs to updated
     clrf    WREG
     movff   WREG,char_O_deco_status     ; Restart decoplan computation mH
 
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Wed Nov 14 12:02:14 2012 +0100
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Wed Nov 14 12:39:39 2012 +0100
@@ -473,6 +473,8 @@
 	WIN_INVERT	.0                      ; Init new Wordprocessor
 	bcf     leftbind
 	PLED_color_code		warn_ceiling    ; Color-code Output
+    btfsc   decoplan_invalid            ; The decoplan needs to updated...
+    call    PLED_grey                   ; .. so set the color to grey
 	lfsr	FSR2,letter
 	movff	char_O_first_deco_depth,lo  ; Ceiling in m
 	output_99
@@ -490,11 +492,14 @@
 	WIN_INVERT	.0					    ; Init new Wordprocessor
 
 	call	PLED_standard_color
+    btfsc   decoplan_invalid            ; The decoplan needs to updated...
+    call    PLED_grey                   ; .. so set the color to grey
 	lfsr	FSR2,letter
 	movff	int_O_ascenttime+0,lo       ; TTS
 	movff	int_O_ascenttime+1,hi       ; on 16bits
 	output_16
 	STRCAT_PRINT    "'"
+	call	PLED_standard_color
 
 PLED_display_deko1:
 	rcall	PLED_display_gf				; Show GF (If GF > CF08)
@@ -1344,10 +1349,13 @@
 PLED_white_gas:
 	GETCUSTOM8	d'35'		            ;movlw	color_white	
 	goto	PLED_set_color	            ; grey out inactive gases!
+    ; return
 
 PLED_grey_gas:
+PLED_grey:
 	GETCUSTOM8	d'64'					;movlw	color_grey
 	goto	PLED_set_color	            ; grey out inactive gases!
+    ; return
 
 ;-----------------------------------------------------------------------------
 ; Display Pre-Dive Screen