view src/customview.asm @ 586:06642f6ffe59

2.97 release
author heinrichsweikamp
date Thu, 01 Mar 2018 11:12:47 +0100
parents 6636cbe64c6d
children ca4556fb60b9
line wrap: on
line source

;=============================================================================
;
;   File customview.asm								REFACTORED VERSION V2.98
;
;   Customview in Surfacemode and Divemode
;
;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
;=============================================================================
; HISTORY
;  2011-08-10 : [mH] moving from OSTC code

;=============================================================================

#include "hwos.inc"						; Mandatory header
#include "tft_outputs.inc"
#include "strings.inc"
#include "tft.inc"
#include "isr.inc"
#include "wait.inc"
#include "surfmode.inc"
#include "convert.inc"
#include "divemode.inc"
#include "i2c.inc"
#include "start.inc"


	extern	gaslist_strcat_gas_mod
	extern	char_I_deco_model
	extern	TFT_sensor_mV
	extern	TFT_surface_compass_mask
	extern	TFT_dive_compass_mask


gui	CODE

;=============================================================================
; Do every-second tasks for the custom view area (Dive mode)

	global	customview_second
customview_second:
	movff	menupos3,WREG				; copy current view (1-...)
	dcfsnz	WREG,F
	goto	TFT_update_ppo2_sensors		; Update Sensor data ; and return
	dcfsnz	WREG,F
	goto	TFT_update_avr_stopwatch	; Update average depth and stopwatch; and return
	dcfsnz	WREG,F
	goto	TFT_decoplan				; Show decoplan ; and return
	dcfsnz	WREG,F
	goto	TFT_battinfo_tissues_clock	; Update Battery, Tissues and clock ; and return
	dcfsnz	WREG,F
	goto	TFT_gf_info					; Update GF informations ; and return
	dcfsnz	WREG,F
	return								; Compass updated separately (faster) in divemode;
	dcfsnz	WREG,F
	nop									; ex goto TFT_dyn_gaslist
	dcfsnz	WREG,F
	goto	TFT_CNS						; Show CNS values for end-of-dive, ex goto TFT_hud_voltages
	dcfsnz	WREG,F
	bra		customview_1sec_view9		; Make sure to change value in "check_ppo2_display:" when moving around custom views
	dcfsnz	WREG,F
	goto	TFT_sensor_check			; Show ppO2 of O2 and Diluent ; and return
	dcfsnz	WREG,F
	goto	TFT_ppo2_ead_end_cns		; Show ppO2, END/EAD and CNS; and return
	dcfsnz	WREG,F
	goto	TFT_pscr_info				; Show ppO2, drop and lung ratio; and return
	dcfsnz	WREG,F
	goto	TFT_gas_needs				; Show gas needs

	; Menupos3=0, do nothing
	return

customview_1sec_view9:					; Ceiling
	call	TFT_ceiling					; Show Ceiling
	call	TFT_display_pure_ppo2		; ppO2 value
	TSTOSS	char_I_deco_model			; 0 = ZH-L16, 1 = ZH-L16-GF
	return								; No GF info for non-GF modes
	goto	TFT_gf_info					; Update GF informations ; and return

	global	customview_alternative_second
customview_alternative_second:
	movff	menupos3,WREG				; copy current view (1-...)
	dcfsnz	WREG,F
	bra		customview_alt_second_view1	; View 1
	dcfsnz	WREG,F
	nop									; View 2

	; Menupos3=0, do nothing
	return

customview_alt_second_view1:
	bsf		FLAG_TFT_max_depth_alt
	bsf		FLAG_TFT_big_deco_alt
	return

;=============================================================================
; Do every-minute tasks for the custom view area

	global	customview_minute
customview_minute:
	return
;	movff	menupos3,WREG				; copy
;	dcfsnz	WREG,F
;	bra		customview_1min_view1
;	dcfsnz	WREG,F
;	bra		customview_1min_view2
;	dcfsnz	WREG,F
;	bra		customview_1min_view3
;	dcfsnz	WREG,F
;	bra		customview_1min_view4
;	dcfsnz	WREG,F
;	bra		customview_1min_view5
;	dcfsnz	WREG,F
;	bra		customview_1min_view6
;	dcfsnz	WREG,F
;	bra		customview_1min_view7
;	dcfsnz	WREG,F
;	bra		customview_1min_view8
;	dcfsnz	WREG,F
;	bra		customview_1min_view9
;	dcfsnz	WREG,F
;	bra		customview_1min_view10
;	dcfsnz	WREG,F
;	bra		customview_1min_view11
;	; Menupos3=0, do nothing
;	return
;
;customview_1min_view1:
;customview_1min_view2:
;customview_1min_view3:
;customview_1min_view4:
;customview_1min_view5:
;customview_1min_view6:
;customview_1min_view7:
;customview_1min_view8:
;customview_1min_view9:
;customview_1min_view10:
;customview_1min_view11:
;return

	global	surf_customview_toggle
surf_customview_toggle:
	bcf		switch_right
	incf	menupos3,F					; Number of customview to show
	movlw	d'9'						; Max number of customsviews in surface mode
	cpfsgt	menupos3					; Max reached?
	bra		surf_customview_mask		; No, show
	movlw	.1
	movwf	menupos3					; Reset to one (Always one custom view visible)

	global	surf_customview_mask
surf_customview_mask:
	WIN_BOX_BLACK .50,surf_warning1_row-1, .0, surf_decotype_column-.1	; top, bottom, left, right
	; Prepare title
	WIN_TINY  surf_customview_title_column,surf_customview_title_row
	WIN_COLOR color_greenish
	movff	menupos3,WREG				; Menupos3 holds number of customview function
	dcfsnz	WREG,F
	bra		surf_customview_init_view1	; OC Gas list
	dcfsnz	WREG,F
	bra		surf_customview_init_view2	; CC Dil list
	dcfsnz	WREG,F
	bra		surf_customview_init_view3	; CC SP list
	dcfsnz	WREG,F
	bra		surf_customview_init_view4	; Custom Text
	dcfsnz	WREG,F
	bra		surf_customview_init_view5	; Tissue Diagram
	dcfsnz	WREG,F
	bra		surf_customview_init_view6	; Compass
	dcfsnz	WREG,F
	bra		surf_customview_init_view7	; Deco settings
	dcfsnz	WREG,F
	bra		surf_customview_init_view8	; Last Dive info
	dcfsnz	WREG,F
	bra		surf_customview_init_view9	; Sensor mV readings

	call	I2C_sleep_accelerometer		; Stop accelerometer
	call	I2C_sleep_compass			; Stop compass

	movlw	.1
	movwf	menupos3					; Reset to one (Always one custom view visible)

surf_customview_init_view1:				; View1: OC Gas list
	btfsc	FLAG_gauge_mode
	bra		surf_customview_toggle
	btfsc	FLAG_apnoe_mode
	bra		surf_customview_toggle
	btfsc	FLAG_ccr_mode
	bra		surf_customview_init_view1_bail ; Bailout version of "OC Gas List"
	btfsc	FLAG_pscr_mode
	bra		surf_customview_init_view1_bail ; Bailout version of "OC Gas List"
	STRCPY_TEXT_PRINT tGaslist			; Title of customview
	call	TFT_standard_color
	call	TFT_gaslist_surfmode		; Show gas list
	bra		customview_toggle_exit		; Done.

surf_customview_init_view1_bail:
	STRCPY_TEXT_PRINT tDiveBailout		; Title of customview
	call	TFT_standard_color
	call	TFT_gaslist_surfmode		; Show gas list
	bra		customview_toggle_exit		; Done.

surf_customview_init_view2:				; View2: CC Dil list
	btfsc	FLAG_pscr_mode
	bra		surf_customview_init_view2_2
	btfss	FLAG_ccr_mode
	bra		surf_customview_toggle
	btfsc	FLAG_gauge_mode
	bra		surf_customview_toggle
	btfsc	FLAG_apnoe_mode
	bra		surf_customview_toggle
surf_customview_init_view2_2:	
	STRCPY_TEXT_PRINT tGaslistCC		; Title of customview
	call	TFT_standard_color
	call	TFT_dillist_surfmode		; Show diluent list
	bra		customview_toggle_exit		; Done.

surf_customview_init_view3:				; View3: CC SP list
	btfss	FLAG_ccr_mode
	bra		surf_customview_toggle
	btfsc	FLAG_gauge_mode
	bra		surf_customview_toggle
	btfsc	FLAG_apnoe_mode
	bra	surf_customview_toggle
	STRCPY_TEXT_PRINT tFixedSetpoints	; Title of customview
	call	TFT_standard_color
	call	TFT_splist_surfmode			; Show Setpoint list
	bra		customview_toggle_exit		; Done.

surf_customview_init_view9:				; View 9: Sensor mV on the surface
	btfsc	FLAG_ccr_mode 
	bra		surf_customview_init_view9a	; we are in CCR mode 
	btfsc	FLAG_pscr_mode
	bra		surf_customview_init_view9a	; we are in PSCR mode 
	bra		surf_customview_toggle		; we are not in any rebreather mode, so skip 
surf_customview_init_view9a: 
	movff	opt_ccr_mode,WREG			; =0: Fixed SP, =1: Sensor, =2: Auto SP 
	sublw	.1							; opt_ccr_mode = 1 (Sensor)? 
	bnz		surf_customview_toggle		; sorry, no sensors, skip again 
	STRCPY_TEXT_PRINT tSensorMilliVolt	; Title of customview 
	call	TFT_standard_color 
	call	TFT_sensor_mV				; write sensor mV readings to screen 
	bra		customview_toggle_exit		; Done.

surf_customview_init_view4:				; View4: Custom text
	call	TFT_standard_color
	call	TFT_custom_text				; Show the custom text
	bra		customview_toggle_exit		; Done.

surf_customview_init_view5:				; View5: Tissue Diagram
	btfsc	FLAG_gauge_mode
	bra		surf_customview_toggle
	btfsc	FLAG_apnoe_mode
	bra		surf_customview_toggle
	call	TFT_standard_color
	call	TFT_surface_tissues			; Show Tissue diagram
	bra		customview_toggle_exit		; Done.

surf_customview_init_view6:				; View6: Compass
	call	I2C_init_accelerometer		; Start accelerometer
	call	I2C_init_compass			; Start compass
	call	TFT_surface_compass_mask	; Show compass
	bra		customview_toggle_exit		; Done.

surf_customview_init_view7:
	btfsc	FLAG_gauge_mode				; View7: Deco settings
	bra		surf_customview_toggle
	btfsc	FLAG_apnoe_mode
	bra		surf_customview_toggle

	call	TFT_surface_decosettings	; Show all deco settings
	bra		customview_toggle_exit		; Done.

surf_customview_init_view8:				; View8: Last dive info
	call	TFT_surface_lastdive		; Show last dive interval
	bra		customview_toggle_exit		; Done.


	global	menuview_toggle
menuview_toggle:						; Show Menu or the simulator tasks
	btfss	alternative_divelayout		; In alternative layout mode?
	bra		menuview_toggle2			; No
	; Switch back to normal mode for any menu tasks
	bcf		alternative_divelayout		; clear flag
	bsf		FLAG_TFT_divemode_mask		; Set flag for mask
	bsf		FLAG_TFT_max_depth			; set flag
	btfss	decostop_active				; deco?
	bsf		FLAG_TFT_display_ndl_mask	; NDL
	btfsc	decostop_active				; deco?
	bsf		FLAG_TFT_display_deko_mask	; Deco
	call	TFT_ClearScreen				; Clear screen
	rcall	customview_mask				; Re-Draw customview

menuview_toggle2:
	movlw	divemode_menuview_timeout
	movwf	timeout_counter2
	bsf		menuview
	bcf		switch_left
	incf	menupos2,F					; Number of options to show
	movlw	d'10'						; Max number of options in divemode
	cpfsgt	menupos2					; Max reached?
	bra		menuview_mask				; No, show
	global	menuview_toggle_reset
menuview_toggle_reset:					; Timeout occurred
	clrf	menupos2
	bcf		menuview
menuview_mask:
	WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column, dm_simtext_column+.49 ; top, bottom, left, right
	btfss	FLAG_gauge_mode
	bra		menuview_mask2
	; Clear some more in gauge mode -- "Reset Avg." text is longer than normal simtext
	WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column+.50, dm_simtext_column+.70 ; top, bottom, left, right
menuview_mask2:
	call	TFT_draw_gassep_line
	movlw	color_yellow
	call	TFT_set_color
	bsf		win_invert					; Set invert flag
	WIN_SMALL dm_simtext_column,dm_simtext_row
	movff	menupos2,WREG				; Menupos2 holds number of menu option to show
	dcfsnz	WREG,F
	bra		menuview_view_gaschange		; If a better gas is indicated
	dcfsnz	WREG,F
	bra		menuview_view1				; "Menu?" (Not in Gauge and Anpnoe)
	dcfsnz	WREG,F
	bra		menuview_view2				; "Quit Simulation?" (Sim only)
	dcfsnz	WREG,F
	bra		menuview_view3				; "Descent 1m" (Sim only)
	dcfsnz	WREG,F
	bra		menuview_view4				; "Ascend 1m" (Sim only)
	dcfsnz	WREG,F
	bra		menuview_view5				; "Quit Apnea mode?" (Apnea only)
	dcfsnz	WREG,F
	bra		menuview_view6				; "Reset Avr." (Gauge only)
	dcfsnz	WREG,F
	bra		menuview_view7				; "Sim:+5mins" (Sim only)
	dcfsnz	WREG,F
	bra		menuview_view8				; "Heading" (When compass is shown)
	dcfsnz	WREG,F
	bra		menuview_view9				; "Layout" (Alternative Layout, aka Blind mode)

menuview_exit:
	call	TFT_standard_color
	bcf		win_invert					; Reset invert flag
	return								; Menupos2 = 0, Show nothing


menuview_view_gaschange:
	btfss	better_gas_available		; =1: A better gas is available
	bra		menuview_toggle				; No, call next option
	btfsc	divemode_gaschange			; Skip if the last gas change is not done yet.
	bra		menuview_toggle
	bsf		short_gas_decriptions		; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
	movff	better_gas_number,PRODL		; number (1-5) of the "better gas" in divemode, =0: no better gas available
	decf	PRODL,F
	call	gaslist_strcat_gas_mod		; Append gas description of gas #PRODL (0-4) to current string
	movlw	.5
	movwf	FSR2L						; Point to char 6 (5 chars gas description only)
	STRCAT_PRINT "?"
	bra		menuview_exit				; Done.
menuview_view1:
	btfsc	FLAG_apnoe_mode				; In Apnoe mode?
	bra		menuview_toggle				; Call next option
	btfsc	FLAG_gauge_mode				; In Gauge mode?
	bra		menuview_toggle				; Call next option
	STRCPY_TEXT_PRINT tDivePreMenu		; "Menu?"
	bra		menuview_exit				; Done.
menuview_view2:
	btfss	simulatormode_active		; View only for simulator mode
	bra		menuview_toggle				; Call next option
	STRCPY_TEXT_PRINT tQuitSim			; "Quit Simulation?"
	bra		menuview_exit				; Done.
menuview_view3:
	btfss	simulatormode_active		; View only for simulator mode
	bra		menuview_toggle				; Call next option
	STRCPY_PRINT "Sim-1m"				; "-" for going down
	bra	menuview_exit					; Done.
menuview_view4:
	btfss	simulatormode_active		; View only for simulator mode
	bra		menuview_toggle				; Call next option
	STRCPY_PRINT "Sim+1m"				; "+" for going up
	bra		menuview_exit				; Done.
menuview_view5:
	btfss	FLAG_apnoe_mode				; In Apnoe mode?
	bra		menuview_toggle				; No, call next option
	btfss	FLAG_active_descent			; Are we descending?
	bra		menuview_toggle				; Yes
; We are at the surface:
	STRCPY_TEXT_PRINT tQuitSim			; "Quit Apnea mode?"
	bra		menuview_exit				; Done.
menuview_view6:
	btfss	FLAG_gauge_mode				; In Gauge mode?
	bra		menuview_toggle				; No, call next option
	STRCPY_TEXT_PRINT tDivemenu_ResetAvg; "Reset Avg."
	bra		menuview_exit				; Done.
menuview_view7:
	btfss	simulatormode_active		; View only for simulator mode
	bra		menuview_toggle				; Call next option
	btfsc	FLAG_gauge_mode				; In Gauge mode?
	bra		menuview_toggle				; Yes, call next option
	btfsc	FLAG_apnoe_mode				; In Apnoe mode?
	bra		menuview_toggle				; Yes, call next option
	STRCPY_PRINT "Sim+5'"
	bra		menuview_exit				; Done.
menuview_view8:
	movlw	.6
	cpfseq	menupos3					; in compass view?
	bra		menuview_toggle				; No, call next option
	STRCPY_TEXT_PRINT	tSetHeading		; "Heading"
	bra		menuview_exit				; Done.
menuview_view9:
    	btfsc	FLAG_apnoe_mode				; In Apnoe mode?
	bra		menuview_toggle				; Yes, call next option
	btfsc	FLAG_gauge_mode				; In Gauge mode?
	bra		menuview_toggle				; Yes, call next option
	STRCPY_PRINT "Layout"
	bra		menuview_exit				; Done.

;=============================================================================

customview_toggle_alternative:
	movlw	d'1'						; Max number of customviews in divemode, alternative layout
	cpfsgt	menupos3					; Max reached?
	bra		customview_mask_alternative	; No, show
	movlw	.1
	movwf	menupos3					; Reset to one, always one customview visible in alternative layout
customview_mask_alternative:	
	; Clear custom view area in divemode
	WIN_BOX_BLACK	dm_customview_row, .239, .0, .159	; top, bottom, left, right
	call	TFT_standard_color
	movff	menupos3,WREG				; Menupos3 holds number of customview function
	dcfsnz	WREG,F
	bra		customview_alt_init_view1	; View 1: Big deco/ndl and max. depth
	dcfsnz	WREG,F
	bra		customview_alt_init_view2	; View 2: 

	;bra	customview_alternative_toggle_exit	; No view (menupos3=0)

customview_alt_toggle_exit:
	call	TFT_standard_color
	bcf		toggle_customview			; Clear flag
	return

customview_alt_init_view1:				; View 1: Big deco/ndl and max. depth
	call	TFT_max_depth_alternative
	call	TFT_big_deco_alt
	bra		customview_alt_toggle_exit

customview_alt_init_view2:
	; /* Just for test...
	call	TFT_mask_avr_stopwatch		; Show mask for average depth and stopwatch
	call	TFT_update_avr_stopwatch	; Update average depth and stopwatch
	; ...Just for test */
	bra		customview_alt_toggle_exit


; Show next customview (and delete this flag)
	global	customview_toggle
customview_toggle:
	bcf	switch_right
	incf	menupos3,F					; Number of customview to show

	btfsc	alternative_divelayout			; In alternative layout mode?
	bra		customview_toggle_alternative	; Yes, use the big ones instead

	movlw	d'13'						; Max number of customviews in divemode
	cpfsgt	menupos3					; Max reached?
	bra		customview_mask				; No, show
	clrf	menupos3					; Reset to zero (Zero=no custom view)

	global	customview_mask
customview_mask:	
	; Clear custom view area in divemode
	WIN_BOX_BLACK dm_customview_row, dm_customview_bot-.2, dm_customview_column, dm_customview_rgt	; top, bottom, left, right
	WIN_SMALL     dm_customview_column,dm_customview_row
	call	TFT_standard_color
	movff	menupos3,WREG				; Menupos3 holds number of customview function
	dcfsnz	WREG,F
	bra		customview_init_view1		; Update Sensor data
	dcfsnz	WREG,F
	bra		customview_init_view2		; average depth and stopwatch
	dcfsnz	WREG,F
	bra		customview_init_view3		; Decoplan
	dcfsnz	WREG,F
	bra		customview_init_view4		; Battery info, Tissues and clock
	dcfsnz	WREG,F
	bra		customview_init_view5		; GF informations
	dcfsnz	WREG,F
	bra		customview_init_view6		; Compass
	dcfsnz	WREG,F
	bra		customview_init_view7		; Dynamic gaslist
	dcfsnz	WREG,F
	bra		customview_init_view8		; CNS
	dcfsnz	WREG,F
	bra		customview_init_view9		; ppO2, Ceiling and current GF
	dcfsnz	WREG,F
	bra		customview_init_view10		; Sensor check
	dcfsnz	WREG,F
	bra		customview_init_view11		; ppO2, END/EAD and CNS
	dcfsnz	WREG,F
	bra		customview_init_view12		; PSCR Info
	dcfsnz	WREG,F
	bra		customview_init_view13		; Gas needs

customview_init_nocustomview:
	call	I2C_sleep_accelerometer		; Stop accelerometer
	call	I2C_sleep_compass			; Stop compass
	bra		customview_toggle_exit

customview_init_view1:
	btfsc	FLAG_apnoe_mode				; In Apnoe mode?
	bra		customview_toggle			; yes, Call next view...
	btfsc	FLAG_pscr_mode				; In PSCR mode?
	bra		customview_init_view1a		; Yes
	btfss	FLAG_ccr_mode				; In CC mode?
	bra		customview_toggle			; no, Call next view...

customview_init_view1a:
	btfsc	analog_o2_input				; do we have an analog input?
	bra		customview_init_view1b		; YES - show this view
	btfsc	s8_digital				; NO  - do we have a digital input?
	bra		customview_init_view1b		; YES - show this view
	btfss	optical_input				; NO  - do we have an optical input?
	bra		customview_toggle		; NO  - call next view...

	;       YES - show this view
customview_init_view1b:
	call	TFT_hud_mask				; Setup HUD mask
	call	TFT_update_ppo2_sensors		; Update Sensor data
	bra		customview_toggle_exit

customview_init_view2:
	btfsc	FLAG_apnoe_mode				; In Apnoe mode?
	bra		customview_toggle			; Yes, Call next view...
	call	TFT_mask_avr_stopwatch		; Show mask for average depth and stopwatch
	call	TFT_update_avr_stopwatch	; Update average depth and stopwatch
	bra		customview_toggle_exit

customview_init_view3:
	btfsc	FLAG_apnoe_mode				; In Apnoe mode?
	bra		customview_toggle			; Yes, Call next view...
	btfsc	FLAG_gauge_mode				; In Gauge mode?
	bra		customview_toggle			; Yes, Call next view...
	call	TFT_decoplan				; Show decoplan
	bra		customview_toggle_exit

customview_init_view4:
	call	TFT_battinfo_tissues_clock_mask	; Setup Mask
	call	TFT_battinfo_tissues_clock		; Show Battery info, Tissues and clock
	bra		customview_toggle_exit

customview_init_view5:
	btfsc	FLAG_apnoe_mode				; In Apnoe mode?
	bra		customview_toggle			; Yes, Call next view...
	btfsc	FLAG_gauge_mode				; In Gauge mode?
	bra		customview_toggle			; Yes, Call next view...

	TSTOSS	char_I_deco_model			; 0 = ZH-L16, 1 = ZH-L16-GF
	bra		customview_toggle			; No GF info for non-GF modes

	call	TFT_gf_mask					; Setup Mask
	call	TFT_gf_info					; Show GF informations
	bra		customview_toggle_exit

customview_init_view6:					; Compass (View 6)
	call	I2C_init_accelerometer		; Start accelerometer
	call	I2C_init_compass			; Start compass
	call	TFT_dive_compass_mask		; Show compass
	bra		customview_toggle_exit

customview_init_view7:					; view disabled
	bra		customview_toggle

customview_init_view8:					; CNS at end of dive
	btfsc	FLAG_gauge_mode				; In Gauge mode?
	bra		customview_toggle			; Yes, Call next view...
	btfsc	FLAG_apnoe_mode				; In Apnoe mode?
	bra		customview_toggle			; yes, Call next view...
	call	TFT_CNS_mask
	call	TFT_CNS
	goto	customview_toggle_exit

customview_init_view9:					; ppO2, Ceiling and current GF
	btfsc	FLAG_apnoe_mode				; In Apnoe mode?
	bra		customview_toggle			; yes, Call next view...
	btfsc	FLAG_gauge_mode				; In Gauge mode?
	bra		customview_toggle			; Yes, Call next view...
	call	TFT_ceiling_mask			; Setup mask
	call	TFT_ceiling					; Show Ceiling

	; ppO2 value
	call	TFT_mask_ppo2
	call	TFT_display_pure_ppo2

	; current GF value
	TSTOSS	char_I_deco_model			; 0 = ZH-L16, 1 = ZH-L16-GF
	bra		customview_toggle_exit		; No GF info for non-GF modes
	; current GF value
	call	TFT_gf_mask_cGF				; Setup Mask - current GF only
	call	TFT_gf_info					; Show GF informations
	bra		customview_toggle_exit

customview_init_view10:					; Sensor check
	btfsc	FLAG_apnoe_mode				; In Apnoe mode?
	bra		customview_toggle			; yes, Call next view...
	btfsc	FLAG_gauge_mode				; In Gauge mode?
	bra		customview_toggle			; Yes, Call next view...
	btfss	FLAG_ccr_mode				; In CC mode?
	bra		customview_toggle			; no, Call next view...

	call	TFT_sensor_check_mask		; Show ppO2 of O2 and Diluent mask
	call	TFT_sensor_check			; Show ppO2 of O2 and Diluent
	bra		customview_toggle_exit

customview_init_view11:					; ppO2, END/EAD and CNS
	btfsc	FLAG_apnoe_mode				; In Apnoe mode?
	bra		customview_toggle			; yes, Call next view...
	btfsc	FLAG_gauge_mode				; In Gauge mode?
	bra		customview_toggle			; Yes, Call next view...

	call	TFT_ppo2_ead_end_cns_mask	; Show ppO2, END/EAD and CNS mask
	call	TFT_ppo2_ead_end_cns		; Show ppO2, END/EAD and CNS
	goto	customview_toggle_exit

customview_init_view12:					; PSCR Info	
	btfss	FLAG_pscr_mode				; In PSCR mode?
	bra		customview_toggle			; No, Call next view...
	
	call	TFT_pscr_info_mask			; Show ppO2, drop and lung ratio
	call	TFT_pscr_info				; Show ppO2, drop and lung ratio
	bra		customview_toggle_exit

customview_init_view13:					; Gas Needs
	TSTOSS	opt_calc_asc_gasvolume		; check if gas volume calculations is switched on
	bra		customview_toggle			; NO  - Call next view...
	call	TFT_gas_needs_mask			; YES - Show the mask for gas needs
	call	TFT_gas_needs				;       Show the gas needs
	bra		customview_toggle_exit

customview_toggle_exit:
	btfsc	divemode					; In Dive Mode?
	bsf		FLAG_TFT_temp_divemode		; Set flag to redraw temp
	call	TFT_standard_color
	bcf		toggle_customview			; Clear flag
	return

	global	customview_show_change_depth
customview_show_change_depth:			; Put " lom" or " loft" into Postinc2
	PUTC	" "
	TSTOSS	opt_units					; 0=m, 1=ft
	bra		customview_show_mix_metric
	movf	lo,W
	mullw	.100						; convert meters to mbar
	movff	PRODL,lo
	movff	PRODH,hi
	call	convert_mbar_to_feet		; convert value in lo:hi from mbar to feet
	bsf		leftbind
	output_16							; Change depth in lo:hi
	bcf		leftbind
	STRCAT_TEXT tFeets
	return
customview_show_mix_metric:
	output_99							; Change depth in lo
	STRCAT_TEXT tMeters
	return


	global	customview_show_mix
customview_show_mix:					; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2
	tstfsz	hi							; He=0?
	bra		customview_show_mix5		; No, Show a TX
	movlw	.21
	cpfseq	lo							; Air?
	bra		customview_show_mix2		; No
	STRCAT_TEXT tSelectAir				; Yes, show "Air"
	bra		customview_show_mix4b
customview_show_mix2:
	movlw	.100
	cpfseq	lo							; O2?
	bra		customview_show_mix3		; No
	STRCAT_TEXT tSelectO2				; Yes, show "O2"
	bra		customview_show_mix4b

customview_show_mix3:
	movlw	.21
	cpfslt	lo							; < Nx21?
	bra		customview_show_mix4		; No
	STRCAT_TEXT tGasErr					; Yes, show "Err"
	output_99							; O2 ratio is still in "lo"
	bra	 customview_show_mix4c

customview_show_mix4:
	STRCAT_TEXT tSelectNx				; Show "Nx"
	output_99							; O2 ratio is still in "lo"
customview_show_mix4b:
	STRCAT	" "
customview_show_mix4c:
	btfsc	divemode					; In divemode
	return								; Yes
	STRCAT	"  "
	return

customview_show_mix5:
	btfsc	divemode
	bra		customview_show_mix6
	STRCAT_TEXT tSelectTx				; Show "Tx"
customview_show_mix6:
	output_99							; O2 ratio is still in "lo"
	PUTC	"/"
	movff	hi,lo
	output_99							; He ratio
	return

	END