changeset 605:5ce603c29750

gas color coding fixed
author heinrichsweikamp
date Sun, 25 Nov 2018 13:21:52 +0100
parents ca4556fb60b9
children 8b250afb8bdd
files src/divemode.asm src/tft_outputs.asm
diffstat 2 files changed, 19 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/divemode.asm	Thu Nov 22 19:47:26 2018 +0100
+++ b/src/divemode.asm	Sun Nov 25 13:21:52 2018 +0100
@@ -174,7 +174,7 @@
 diveloop_loop1_deco1:
  ENDIF
 
-	call	calc_deko_divemode			; calculate decompression and set resulting display flags
+	call	calc_deco_divemode			; calculate decompression and set resulting display flags
 
 	btfss	alternative_divelayout
 	rcall	TFT_output2_normal
@@ -392,7 +392,7 @@
 
 	; --------------------------------------------------------------------------------------
 
-calc_deko_divemode:
+calc_deco_divemode:
 	btfss	FLAG_gauge_mode				; in gauge mode?
 	rcall	calc_deko_engine			; NO - do deco calculations
 
@@ -552,6 +552,9 @@
 	call	deco_calc_hauptroutine		; invoke the deco engine (p2_deco.c)
 	banksel	common
 
+	; the displayed gas may need a different color-coding
+	bsf		FLAG_TFT_active_gas_divemode; redraw gas/setpoint/diluent
+
 	; check if display shall be updated due to deco engine restart
 	btfsc	FLAG_TFT_display_ndl_or_deko; shall update immediately?
 	bra		calc_deko_engine_update		; YES
@@ -560,6 +563,7 @@
 	movff	char_O_main_status,WREG		; get deco status of deco engine
 	btfss	WREG,DECO_COMPLETED_NORM	; new calculation results for normal plan available?
 	return								; NO  - done
+
 calc_deko_engine_update:
 	bcf		FLAG_TFT_display_ndl_or_deko; YES - reset flag for immediate update
 	movff	char_O_deco_info,WREG		;     - get deco info vector
@@ -1444,8 +1448,14 @@
 	rcall	setup_gas_registers			; with WREG = Gas 1-6
 	rcall	deco_setup_oc_gases			; with WREG = Gas 1-6
 gas_switched_common3:
-	bsf		FLAG_TFT_active_gas_divemode	; redraw gas/setpoint/diluent
-	call	restart_deco_engine_wo_ceiling	; abort any running deco calculations and restart the deco engine
+	banksel	int_O_breathed_ppO2
+	bcf		int_O_breathed_ppO2+1,int_low_flag			; | clear all flags that control color-coding
+	bcf		int_O_breathed_ppO2+1,int_high_flag			; | to have the new gas initially displayed in
+	bcf		int_O_breathed_ppO2+1,int_attention_flag	; | memo color instead of a warning or attention
+	bcf		int_O_breathed_ppO2+1,int_warning_flag		; | color that belonged to the previous gas
+	banksel	common
+	bsf		FLAG_TFT_active_gas_divemode				; redraw gas/setpoint/diluent
+	call	restart_deco_engine_wo_ceiling				; abort any running deco calculations and restart the deco engine
 	; set flags for profile recording
 	bsf		event_occured				; set event flag
 	btfsc	FLAG_bailout_mode			; choose OC Bailouts (OC Gases)
--- a/src/tft_outputs.asm	Thu Nov 22 19:47:26 2018 +0100
+++ b/src/tft_outputs.asm	Sun Nov 25 13:21:52 2018 +0100
@@ -81,11 +81,10 @@
 
 	global	TFT_memo_color
 TFT_memo_color:							; information, values within normal range, things without a need to react upon
-    bra	TFT_standard_color  ; mH (Color schemes!)
 	movlw	color_white
 	bra		TFT_standard_color0
-;TFT_memo_color_dive:
-;	retlw	color_white
+TFT_memo_color_dive:
+	retlw	color_white
 
 	global	TFT_advice_color
 TFT_advice_color:						; advices to do something, but without essential need to actually do it
@@ -2052,7 +2051,7 @@
 	tstfsz	menupos2					; any option shown?
 	bra		TFT_active_gas_divemode_oc	; YES - do not overwrite with bailout text
 	WIN_SMALL dm_active_dil_column, dm_active_dil_row
-	call	TFT_attention_color			; print plaint in yellow
+	call	TFT_attention_color			; print in yellow
 	STRCPY_TEXT_PRINT tDiveBailout		; "Bailout"
 TFT_active_gas_divemode_oc:				; common part for OC and bailout
 	movff	int_O_breathed_ppO2+0,lo	; color-code the output of the gas by the ppO2 it yields
@@ -4274,14 +4273,14 @@
 
 	global	TFT_surface_lastdive
 TFT_surface_lastdive:
-	call	TFT_divemask_color
+	call	TFT_standard_color
 	WIN_TINY surf_gaslist_column,surf_gaslist_row+.5
 	STRCAT_TEXT_PRINT	tLastDive			; "Last Dive:"
 	WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1)+.5
 	STRCAT_TEXT_PRINT	tDivetime			; "Divetime:"
 	WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)+.5
 	STRCAT_TEXT_PRINT	tMaxDepth			; "Max. Depth"
-	call	TFT_standard_color
+
 	WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row
 	movff	int_O_desaturation_time+0,lo	; bank-safe copies
 	movff	int_O_desaturation_time+1,WREG