annotate src/divemenu_tree.asm @ 612:6dd6b37da7c8

TODO: screendump debug
author heinrichsweikamp
date Wed, 09 Jan 2019 21:53:02 +0100
parents ca4556fb60b9
children c40025d8e750
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
3 ; File divemenu_tree.asm REFACTORED VERSION V2.99e
0
heinrichsweikamp
parents:
diff changeset
4 ;
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 249
diff changeset
5 ; OSTC dive mode menu
0
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2013-02-02 : [mH] Made out of menu_tree.asm
heinrichsweikamp
parents:
diff changeset
11
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
12 #include "hwos.inc" ; Mandatory header
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
13 #include "menu_processor.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
14 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
15 #include "tft_outputs.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
16 #include "customview.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
17 #include "strings.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
18 #include "calibrate.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
19
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
20 extern timeout_divemode_menu2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
21 extern restart_deco_engine_wo_ceiling
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
22 extern diveloop_loop4
0
heinrichsweikamp
parents:
diff changeset
23
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
24
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
25 dmenu_tree CODE
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
26
0
heinrichsweikamp
parents:
diff changeset
27 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
28 ; Main Menu
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
29
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
30 do_return_main_divemenu:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
31 call menu_processor_double_pop ; drop exit line and back to last line
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
32 incf selected_item,W ; item numbers start with 0, menu positions with 1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
33 movwf menupos1 ; position cursor where we came from
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
34 bra do_main_divemenu_common
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
35
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
36 global do_main_divemenu
0
heinrichsweikamp
parents:
diff changeset
37 do_main_divemenu:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
38 call menu_processor_reset ; restart from first icon
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
39 movlw .1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
40 movwf menupos1 ; set to first option in divemode menu
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
41
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
42 do_main_divemenu_common:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
43 btfsc FLAG_ccr_mode
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
44 bra main_divemenu_loop ; goto CCR / pSCR Menu menu
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
45 btfsc FLAG_pscr_mode
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
46 bra main_divemenu_loop ; goto CCR / pSCR Menu menu
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
47
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
48 main_divemenu_OC:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
49 bcf FLAG_diluent_setup ; set to operations on OC gases
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
50 bcf is_bailout_menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
51
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
52 IFDEF _cave_mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
53 btfss FLAG_cave_mode ; in cave mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
54 bra main_divemenu_OC_no_cave ; NO - do OC menu without turn option
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
55
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
56 MENU_BEGIN tMainMenu, .6
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
57 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
58 MENU_CALL tDivemenu_ResetAvg, do_reset_average
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
59 MENU_DYNAMIC do_toggle_gf_label, do_toggle_gf
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
60 MENU_CALL tDivemenu_Marker, do_set_marker
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
61 MENU_DYNAMIC do_turn_dive_label, do_turn_dive
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
62 MENU_CALL tExit, do_exit_divemode_menu
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
63 MENU_END
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
64 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
65
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
66 main_divemenu_OC_no_cave:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
67 MENU_BEGIN tMainMenu, .5
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
68 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
69 MENU_CALL tDivemenu_ResetAvg, do_reset_average
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
70 MENU_DYNAMIC do_toggle_gf_label, do_toggle_gf
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
71 MENU_CALL tDivemenu_Marker, do_set_marker
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
72 MENU_CALL tExit, do_exit_divemode_menu
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
73 MENU_END
0
heinrichsweikamp
parents:
diff changeset
74
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
75
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
76 main_divemenu_loop:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
77 bsf FLAG_diluent_setup ; set to operations on diluents
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
78 bcf is_bailout_menu ; flag as none-bailout menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
79 btfsc FLAG_pscr_mode
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
80 bra main_divemenu_pscr ; pSCR menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
81
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
82 MENU_BEGIN tMainMenu, .6
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
83 MENU_CALL tDiveBailout, do_divemode_gaslist_bail
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
84 MENU_CALL tDivemenu_Setpoint, do_divemode_splist
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
85 MENU_CALL tDivemenu_Diluent, do_divemode_gaslist
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
86 MENU_CALL tDivemenu_Avg_Mkr, do_reset_avg_set_mkr
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
87 MENU_DYNAMIC do_toggle_gf_label, do_toggle_gf
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
88 MENU_CALL tExit, do_exit_divemode_menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
89 MENU_END
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
90
485
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
91 main_divemenu_pscr:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
92 btfsc analog_o2_input ; do we have an analog input (OSTC cR)?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
93 bra main_divemenu_pscr_sensors ; YES
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
94 btfsc optical_input ; do we have an optical input (OSTC 3)?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
95 bra main_divemenu_pscr_sensors ; YES
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
96
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
97 main_divemenu_pscr_no_sensors:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
98 MENU_BEGIN tMainMenu, .6
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
99 MENU_CALL tDiveBailout, do_divemode_gaslist_bail
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
100 MENU_CALL tDivemenu_Premix, do_divemode_gaslist
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
101 MENU_CALL tBackToLoop, do_switch_sp_calc
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
102 MENU_CALL tDivemenu_Avg_Mkr, do_reset_avg_set_mkr
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
103 MENU_DYNAMIC do_toggle_gf_label, do_toggle_gf
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
104 MENU_CALL tExit, do_exit_divemode_menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
105 MENU_END
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
106
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
107 main_divemenu_pscr_sensors:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
108 MENU_BEGIN tMainMenu, .6
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
109 MENU_CALL tDiveBailout, do_divemode_gaslist_bail
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
110 MENU_CALL tCCRSensor, do_divemode_setpoint_pscr
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
111 MENU_CALL tDivemenu_Premix, do_divemode_gaslist
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
112 MENU_CALL tDivemenu_Avg_Mkr, do_reset_avg_set_mkr
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
113 MENU_DYNAMIC do_toggle_gf_label, do_toggle_gf
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
114 MENU_CALL tExit, do_exit_divemode_menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
115 MENU_END
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
116
0
heinrichsweikamp
parents:
diff changeset
117
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
118 do_toggle_gf:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
119 TSTOSS char_I_deco_model ; toggle GF only in GF modes - in GF mode? (0 = ZH-L16, 1 = ZH-L16-GF)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
120 bra do_main_divemenu_common ; NO - do nothing and return
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
121 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
122 bra do_main_divemenu_common ; NO - do nothing and return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
123 movlw index_gf_factors-1 ; custom view number one below GF factors
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
124 movwf menupos3 ; set custom view number
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
125 bsf toggle_customview ; initiate toggle to desired custom view -> GF factors
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
126 movlw .1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
127 movwf menupos1 ; set to first option in dive mode menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
128
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
129 MENU_BEGIN tDivemenu_ToggleGF, .2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
130 MENU_CALL tDivemenu_ToggleGF, do_togglegf
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
131 MENU_CALL tBack, do_return_main_divemenu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
132 MENU_END
0
heinrichsweikamp
parents:
diff changeset
133
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
134 do_togglegf:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
135 bsf toggle_gf ; set command flag...
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
136 bra do_exit_divemode_menu ; continue with exiting menu code
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
137
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
138
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
139 do_reset_avg_set_mkr:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
140 movlw .1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
141 movwf menupos1 ; set to first option in dive mode menu
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
142
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
143 IFDEF _cave_mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
144 btfss FLAG_cave_mode ; in cave mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
145 bra do_reset_average_no_cave ; NO - do menu without turn option
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
146
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
147 MENU_BEGIN tDivemenu_Avg_Mkr, .4
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
148 MENU_CALL tDivemenu_ResetAvg, do_reset_average
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
149 MENU_CALL tDivemenu_Marker, do_set_marker
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
150 MENU_DYNAMIC do_turn_dive_label, do_turn_dive
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
151 MENU_CALL tBack, do_return_main_divemenu
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
152 MENU_END
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
153 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
154
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
155 do_reset_average_no_cave:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
156 MENU_BEGIN tDivemenu_Avg_Mkr, .3
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
157 MENU_CALL tDivemenu_ResetAvg, do_reset_average
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
158 MENU_CALL tDivemenu_Marker, do_set_marker
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
159 MENU_CALL tBack, do_return_main_divemenu
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
160 MENU_END
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
161
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
162
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
163 do_reset_average:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
164 bsf reset_average_depth ; set flag...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
165 bra do_exit_divemode_menu ; ... and exit
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
166
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
167 do_set_marker:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
168 bsf FLAG_set_marker ; set flag...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
169 bra do_exit_divemode_menu ; ... and exit
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
170
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
171 IFDEF _cave_mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
172 do_turn_dive:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
173 bsf toggle_turn_dive ; set flag...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
174 bra do_exit_divemode_menu ; ... and exit
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
175 ENDIF
0
heinrichsweikamp
parents:
diff changeset
176
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
177
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
178 do_switch_sensor: ; entry point when coming from switch to sensor
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
179 movlw .1 ; switch to sensor
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
180 movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
181 ; enable all sensors
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
182 bsf use_O2_sensor1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
183 bsf use_O2_sensor2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
184 bsf use_O2_sensor3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
185 bra do_switch_sp_com ; continue with common part
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
186
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
187 do_switch_sp: ; entry point when coming from manual setpoint selection (CCR)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
188 decf menupos1,W ; 1-5 -> 0-4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
189 lfsr FSR1,char_I_setpoint_cbar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
190 movff PLUSW1,char_I_const_ppO2 ; setup fixed setpoint
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
191 movff char_I_const_ppO2,WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
192 call transmit_setpoint ; transmit current setpoint from WREG (in cbar) to external electronics
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
193 bcf setpoint_fallback ; clear fallback condition (stops fallback warning)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
194 clrf WREG ; switch to fixed SP
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
195 movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
196 bra do_switch_sp_com
0
heinrichsweikamp
parents:
diff changeset
197
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
198 do_switch_sp_calc: ; entry point when coming from switch to calculated ppO2 (pSCR)
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
199 bcf setpoint_fallback ; clear fallback condition (stops fallback warning)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
200 clrf WREG ; Switch to fixed SP
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
201 movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
202 movff WREG,char_I_const_ppO2 ; set setpoint to 0, this forces deco engine to take the computed ppO2
97
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 53
diff changeset
203
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
204 do_switch_sp_com: ; merge point to common part
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
205 bsf event_occured ; set global event byte
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
206 bsf setpoint_changed ; set flag (for profile)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
207
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
208 ; Clear some flags in case we were in bailout before...
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
209 bcf FLAG_bailout_mode ; end bailout mode
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
210 ;bcf is_bailout_menu ; not needed
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
211 bcf better_gas_available ; =1: a better gas is available and a gas change is advised in dive mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
212 bcf better_dil_available ; =1: a better diluent is available and a gas change is advised in dive mode
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
213 bcf blinking_better_gas ; clear blinking flag
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
214 bcf blinking_better_dil ; clear blinking flag
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
215 bsf redraw_custview_mask ; request update of custom view mask to (eventually) rewrite "ppO2(Dil)" to "ppO2" or SAC label
0
heinrichsweikamp
parents:
diff changeset
216
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
217 bsf FLAG_back_to_loop ; indicate that it is a switchback from OC bailout to CCR/pSCR loop
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
218 bsf divemode_gaschange ; initiate reconfiguration to loop mode on last diluent
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
219
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
220 bra do_exit_divemode_menu ; continue with exiting menu code
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
221
0
heinrichsweikamp
parents:
diff changeset
222
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
223 do_divemode_gaslist_bail: ; entry point from CCR/pSCR to bailout to OC gases
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
224 bcf FLAG_diluent_setup ; switch to OC gases
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
225 bsf is_bailout_menu ; flag it is a bailout action
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
226 do_divemode_gaslist: ; entry point for switching: OC -> gases, loop -> diluents
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
227 btfsc FLAG_bailout_mode ; in bailout mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
228 bcf FLAG_diluent_setup ; yes - for safety reasons, redirect to OC (bailout) gases
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
229 bsf short_gas_decriptions ; do not show "Gas x" etc.
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
230 bsf better_gas_hint ; mark the gas which is the best gas/diluent
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
231 movf best_gas_number,W ; load number of best gas (1-5)into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
232 btfsc FLAG_diluent_setup ; in diluent selection?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
233 movf best_dil_number,W ; YES - overwrite with best diluent (1-5)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
234 bnz do_divemode_gaslist_1 ; best gas/dil number = 0 (none available) ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
235 movlw .1 ; YES - default to first gas/dil
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
236 btfsc WREG,7 ; best gas/dil number >= 128 (not computed yet) ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
237 movlw .1 ; YES - default to first gas/dil
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
238 do_divemode_gaslist_1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
239 movwf menupos1 ; position cursor to best gas/dil (or first option if none avail)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
240 MENU_BEGIN tGaslist, .6
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
241 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
242 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
243 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
244 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
245 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
246 MENU_CALL tMore, do_divemode_gaslist_more
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
247 MENU_END
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
248
0
heinrichsweikamp
parents:
diff changeset
249
heinrichsweikamp
parents:
diff changeset
250 do_divemode_gaslist_more:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
251 movlw .1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
252 movwf menupos1 ; set to first option in dive mode menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
253
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
254 movff char_I_O2_ratio,gas6_O2_ratio ; initialize gas6 with currently breathed gas - O2 ratio
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
255 movff char_I_He_ratio,gas6_He_ratio ; initialize gas6 with currently breathed gas - He ratio
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
256
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
257 do_divemode_gaslist_more_common:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
258 MENU_BEGIN tGaslist, .6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
259 MENU_CALL tO2Plus, do_dive_pO2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
260 MENU_CALL tO2Minus, do_dive_mO2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
261 MENU_CALL tHePlus, do_dive_pHe
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
262 MENU_CALL tHeMinus, do_dive_mHe
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
263 MENU_DYNAMIC gaslist_strcat_gas6, do_switch_gas6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
264 MENU_CALL tDivemenu_LostGas, do_lost_gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
265 MENU_END
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
266
403
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
267
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
268 do_lost_gas:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
269 movlw .1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
270 movwf menupos1 ; set to first option in dive mode menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
271 do_lost_gas_common:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
272 bsf short_gas_decriptions ; do not show "Gas x" etc.
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
273 bcf better_gas_hint ; do not mark the best gas/diluent
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
274 MENU_BEGIN tDivemenu_LostGas, .6
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
275 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_active ; toggle the gas (in)active
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
276 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_active ; toggle the gas (in)active
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
277 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_active ; toggle the gas (in)active
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
278 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_active ; toggle the gas (in)active
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
279 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_active ; toggle the gas (in)active
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
280 MENU_CALL tExit, do_exit_divemode_menu
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
281 MENU_END
0
heinrichsweikamp
parents:
diff changeset
282
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
283
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
284 do_switch_gas6:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
285 movlw .6 ; gas 6
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
286 movwf menupos1 ; transfer register for selected gas towards gas_switched_common
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
287 bsf gas6_changed ; set flag for profile recording
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
288 ;bra do_switch_gas ; continue with common gas-switched code
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
289
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
290 do_switch_gas:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
291 bsf divemode_gaschange ; set flag, will also trigger restart of deco_engine
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
292 btfss is_bailout_menu ; doing a bailout?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
293 bra do_switch_gas_1 ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
294 bsf FLAG_bailout_mode ; YES - begin bailout mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
295 IFDEF _cave_mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
296 btfsc FLAG_cave_mode ; - in cave mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
297 bsf FLAG_dive_turned ; YES - set dive as turned
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
298 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
299 do_switch_gas_1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
300 bcf setpoint_fallback ; eventually terminate fallback mode and get rid of its warning
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
301 bsf redraw_custview_mask ; request update of custom view mask to (eventually) rewrite "ppO2(Dil)" to "ppO2" or SAC label
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
302 ;bra do_exit_divemode_menu ; continue with exiting menu code
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
303
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
304 do_exit_divemode_menu:
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
305 call timeout_divemode_menu2
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
306 clrf STKPTR
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
307 goto diveloop_loop4
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
308
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
309
403
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
310 do_toggle_active:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
311 movlw .5
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
312 btfsc FLAG_diluent_setup ; operating on diluents?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
313 addwf menupos1,F ; YES - add offset of 5 to shift 1-5 -> 6-10
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
314 decf menupos1,W ; 1-10 -> 0-4 for gases / 5-9 for diluents
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
315 lfsr FSR1,opt_gas_type ; load base address of gas types
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
316 movff PLUSW1,lo ; get gas/dil type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
317 tstfsz lo ; already disabled?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
318 bra do_toggle_active_disable ; NO - disable now
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
319 do_toggle_active_enable ; YES - re-enable now
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
320 lfsr FSR1,opt_gas_type_backup ; load base address of backed-up gas types
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
321 movff PLUSW1,lo ; get backed-up gas/dil type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
322 lfsr FSR1,opt_gas_type ; load base address of gas types
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
323 movff lo,PLUSW1 ; restore gas type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
324 bra do_toggle_active_common
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
325 do_toggle_active_disable: ; disable gas / diluent
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
326 ;lfsr FSR1,opt_gas_type ; (still set)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
327 clrf PLUSW1 ; set type to disabled (0=disabled, 1=first, 2=travel/normal, 3=deco/-)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
328 do_toggle_active_common:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
329 movlw .5
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
330 btfsc FLAG_diluent_setup ; operating on diluents?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
331 subwf menupos1,F ; NO - back to 0-4 for gases 1-5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
332 bcf blinking_better_gas ; clear blinking flag for gases to avoid "leftovers"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
333 bcf blinking_better_dil ; clear blinking flag for diluents to avoid "leftovers"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
334 call restart_deco_engine_wo_ceiling ; invalidate deco data (but not the ceiling) and restart deco engine
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
335 bra do_lost_gas_common
0
heinrichsweikamp
parents:
diff changeset
336
heinrichsweikamp
parents:
diff changeset
337 do_dive_pO2:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
338 banksel gas6_O2_ratio
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
339 incf gas6_O2_ratio,F ; O2++
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
340 movf gas6_He_ratio,W
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
341 addwf gas6_O2_ratio,W
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
342 movwf gas6_temp
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
343 movlw .101
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
344 cpfslt gas6_temp ; O2 + He < 101 ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
345 decf gas6_O2_ratio,F ; O2-- (unchanged)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
346 banksel common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
347 bra do_divemode_gaslist_more_common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
348
0
heinrichsweikamp
parents:
diff changeset
349 do_dive_mO2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
350 banksel gas6_O2_ratio
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
351 decf gas6_O2_ratio,F ; O2--
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
352 movlw gaslist_min_o2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
353 cpfslt gas6_O2_ratio ; O2 < minimum allowed %O2?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
354 bra do_dive_mO2_done ; NO
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
355 movlw gaslist_min_o2 ; YES - restore minimum
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
356 movwf gas6_O2_ratio
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
357 do_dive_mO2_done:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
358 banksel common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
359 bra do_divemode_gaslist_more_common
0
heinrichsweikamp
parents:
diff changeset
360
heinrichsweikamp
parents:
diff changeset
361 do_dive_pHe:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
362 banksel gas6_O2_ratio
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
363 incf gas6_He_ratio,F ; He++
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
364 movf gas6_He_ratio,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
365 addwf gas6_O2_ratio,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
366 movwf lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
367 movlw .101
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
368 cpfslt lo ; O2 + He < 101 ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
369 decf gas6_He_ratio,F ; Yes, He-- (unchanged)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
370 banksel common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
371 bra do_divemode_gaslist_more_common
0
heinrichsweikamp
parents:
diff changeset
372
heinrichsweikamp
parents:
diff changeset
373 do_dive_mHe:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
374 banksel gas6_O2_ratio
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
375 decf gas6_He_ratio,F ; He--
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
376 bnn do_dive_mHe_done ; H2 < 0?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
377 clrf gas6_He_ratio ; YES - reset to 0
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
378 do_dive_mHe_done:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
379 banksel common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
380 bra do_divemode_gaslist_more_common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
381
0
heinrichsweikamp
parents:
diff changeset
382
heinrichsweikamp
parents:
diff changeset
383 do_divemode_splist:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
384 bsf short_gas_decriptions
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
385 movlw .1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
386 movwf menupos1 ; set to first option in dive mode menu
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
387
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
388 do_divemode_splist_common:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
389 btfsc analog_o2_input ; do we have an analog input (OSTC cR)?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
390 bra do_divemode_splist_sensor ; YES
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
391 ; btfsc s8_digital ; do we have a digital input?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
392 ; bra do_divemode_splist_sensor ; YES
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
393 btfsc optical_input ; do we have an optical input (OSTC 3)?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
394 bra do_divemode_splist_sensor ; YES
0
heinrichsweikamp
parents:
diff changeset
395
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
396 do_divemode_splist_no_sensor:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
397 MENU_BEGIN tGaslist, .5
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
398 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
399 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
400 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
401 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
402 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
403 MENU_END
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
404
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
405 do_divemode_splist_sensor:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
406 MENU_BEGIN tGaslist, .6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
407 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
408 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
409 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
410 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
411 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
412 MENU_CALL tCCRSensor, do_divemode_sensor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
413 MENU_END
249
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
414
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
415
0
heinrichsweikamp
parents:
diff changeset
416 do_divemode_sensor:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
417 movlw index_ppo2_sensors-1 ; custom view number one below ppO2 sensors
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
418 movwf menupos3 ; set custom view number
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
419 bsf toggle_customview ; initiate toggle to desired custom view -> ppO2 sensors
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
420 movlw .1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
421 movwf menupos1 ; set to 1st option: use sensors
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
422
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
423 do_return_divemode_sensor:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
424 MENU_BEGIN tGaslist, .6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
425 MENU_CALL tDivemenu_UseSensor, do_switch_sensor
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
426 MENU_CALL tBack, do_divemode_splist
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
427 MENU_CALL tExit, do_exit_divemode_menu
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
428 MENU_CALL tDiveHudMask1, do_toggle_sensor
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
429 MENU_CALL tDiveHudMask2, do_toggle_sensor
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
430 MENU_CALL tDiveHudMask3, do_toggle_sensor
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
431 MENU_END
0
heinrichsweikamp
parents:
diff changeset
432
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
433 do_divemode_setpoint_pscr:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
434 movlw .1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
435 movwf menupos1 ; set to 1st option: use calculated ppO2
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
436 MENU_BEGIN tGaslist, .6
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
437 MENU_CALL tCalculated, do_switch_sp_calc
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
438 MENU_CALL tDivemenu_UseSensor, do_switch_sensor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
439 MENU_CALL tExit, do_exit_divemode_menu
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
440 MENU_CALL tDiveHudMask1, do_toggle_sensor
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
441 MENU_CALL tDiveHudMask2, do_toggle_sensor
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
442 MENU_CALL tDiveHudMask3, do_toggle_sensor
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
443 MENU_END
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
444
0
heinrichsweikamp
parents:
diff changeset
445
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
446 do_toggle_sensor:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
447 movff menupos1,lo ; backup position
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
448 decf menupos1,f ; 4, 5, 6 -> 3, 4, 5
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
449 decf menupos1,f ; 3, 4, 5 -> 2, 3, 4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
450 decf menupos1,f ; 2, 3, 4 -> 1, 2, 3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
451 dcfsnz menupos1 ; 1, 2, 3 -> 0, 1, 2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
452 btg use_O2_sensor1 ; =
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
453 dcfsnz menupos1 ; 0, 1, 2 -> -1, 0, 1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
454 btg use_O2_sensor2 ; =
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
455 dcfsnz menupos1 ; -1,0, 1 -> -2,-1, 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
456 btg use_O2_sensor3 ; =
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
457 movff lo,menupos1 ; restore position
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
458 bra do_return_divemode_sensor
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
459
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
460 END