Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/divemode_menu.asm @ 230:9406a5b0ba5e
BUGFIX Clear bottom stops when display gas usage (bug BB23)
author | JeanDo |
---|---|
date | Tue, 15 Mar 2011 18:44:16 +0100 |
parents | 448478ceccea |
children | 3dbeacf42e9e |
rev | line source |
---|---|
0 | 1 ; OSTC - diving computer code |
2 ; Copyright (C) 2008 HeinrichsWeikamp GbR | |
3 | |
4 ; This program is free software: you can redistribute it and/or modify | |
5 ; it under the terms of the GNU General Public License as published by | |
6 ; the Free Software Foundation, either version 3 of the License, or | |
7 ; (at your option) any later version. | |
8 | |
9 ; This program is distributed in the hope that it will be useful, | |
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 ; GNU General Public License for more details. | |
13 | |
14 ; You should have received a copy of the GNU General Public License | |
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | |
17 | |
18 ; Underwater Menu (Set Gas, Decoplan, etc.) | |
19 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
20 ; written: 11/11/05 | |
21 ; last updated: 090305 | |
22 ; known bugs: | |
23 ; ToDo: | |
24 | |
25 | |
112 | 26 test_switches_divemode: ; checks switches in divemode |
0 | 27 btfsc switch_left |
28 bra test_switches_divemode2 | |
29 | |
30 btfss switch_right | |
31 return | |
32 | |
33 bcf switch_left ; Left button pressed! | |
34 bcf switch_right | |
35 | |
36 bcf select_bailoutgas ; Clear Flag for Bailout list | |
37 bsf premenu ; Set Flag for premenu | |
38 bcf menubit | |
39 clrf timeout_counter3 ; timeout_divemenu | |
40 | |
41 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
42 bra test_switches_divemode1 ; Yes! | |
43 | |
44 test_switches_divemode0: | |
45 WIN_INVERT .1 | |
46 DISPLAYTEXT .4 ;Menu? | |
47 WIN_INVERT .0 | |
48 return | |
49 | |
50 test_switches_divemode1: | |
51 DISPLAYTEXT .141 ;Quit? | |
52 return | |
53 | |
54 test_switches_divemode2: | |
55 bcf switch_left ; Also reactivate left button if there was a right press without prior left press | |
56 bcf switch_right ; enable right button again | |
57 | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
58 btfsc premenu |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
59 bra test_switches_divemode2_2 |
109
6e635bf5b7a7
fixed double-effect of ENTER button in divemode
heinrichsweikamp
parents:
107
diff
changeset
|
60 btfsc menubit |
6e635bf5b7a7
fixed double-effect of ENTER button in divemode
heinrichsweikamp
parents:
107
diff
changeset
|
61 bra test_switches_divemode2_2 ; Not in Premenu or Menu... |
0 | 62 |
112 | 63 bsf toggle_customview ; Toggle customview (Cleared in customview.asm) |
64 | |
65 btfsc standalone_simulator ; Standalone Simualtor active? | |
66 bra divemode_menu_simulator ; Yes, Show simulator menu! | |
67 return | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
68 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
69 test_switches_divemode2_2: |
0 | 70 btfss FLAG_apnoe_mode ; In Apnoe mode? |
71 bra test_switches_divemode2a; No! | |
72 | |
73 ; Yes, so quit Apnoe mode at once... | |
74 bcf divemode ; Clear Divemode flag... | |
75 bcf premenu ; clear premenu flag | |
76 return | |
77 | |
78 test_switches_divemode2a: | |
79 bsf menubit ; Enter Divemode-Menu! | |
80 bcf premenu ; clear premenu flag | |
81 call PLED_clear_divemode_menu ; Clear dive mode menu area | |
82 call PLED_divemode_menu_mask_first ; Write Divemode menu1 mask | |
83 bcf display_set_simulator ; Clear Simulator-Menu flag | |
84 movlw d'1' | |
85 movwf menupos ; reset cursor in divemode menu | |
86 call PLED_divemenu_cursor ; show cursor | |
87 bcf switch_right | |
88 bcf switch_left ; Left button pressed! | |
89 return | |
90 | |
91 test_switches_divemode_menu: | |
92 btfsc switch_left | |
93 bra test_switches_divemode_menu3 | |
94 btfss switch_right | |
95 return | |
96 | |
97 btfsc display_see_deco ; Is the Decoplan displayed? | |
98 bra divemenu_see_decoplan2 ; Yes, exit menu on left button press | |
99 | |
100 bcf switch_right ; Left button pressed | |
101 clrf timeout_counter3 ; timout_divemenu! | |
102 incf menupos,F | |
103 | |
104 ; Following routine configures the number of menu entries for the different modes | |
105 movlw d'6' ; number of available gases+1, ; number of menu options+1 | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
106 btfsc display_set_gas ; Are we in the "Gaslist" menu? |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
107 movlw d'7' ; Yes, Number of entries for this menu+1 = 7 |
0 | 108 btfsc display_set_setpoint ; In SetPoint Menu? |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
109 movlw d'5' ; Number of entries for this menu+1 = 5 |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
110 btfsc display_set_active ; De/Activate gases underwater menu is visible? |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
111 movlw d'7' ; Number of entries for this menu+1 = 7 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
112 btfsc display_set_xgas ; Are we in the Gas6 menu? |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
113 movlw d'7' ; Number of entries for this menu+1 = 7 |
0 | 114 cpfseq menupos ; =limit? |
115 bra test_switches_divemode_menu1; No! | |
116 movlw d'1' ; Yes, reset to position 1! | |
117 movwf menupos | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
118 |
0 | 119 test_switches_divemode_menu1: |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
120 ; Finally, check if menuposition 3 should be skipped (No customview with function displayed) |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
121 |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
122 btfsc display_set_gas ; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu? |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
123 bra test_switches_divemode_menu1a ; Skip test for sub menus |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
124 btfsc display_set_xgas ; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu? |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
125 bra test_switches_divemode_menu1a ; Skip test for sub menus |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
126 btfsc display_set_active ; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu? |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
127 bra test_switches_divemode_menu1a ; Skip test for sub menus |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
128 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
129 movlw d'3' |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
130 cpfseq menupos ; At position 3? |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
131 bra test_switches_divemode_menu1a ; No |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
132 btfss menu3_active ; Menu position 3 has functionality? |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
133 incf menupos,F ; No, +1, skip to menuos=4 |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
134 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
135 test_switches_divemode_menu1a: |
0 | 136 call PLED_divemenu_cursor ; update cursor |
137 return | |
138 | |
139 test_switches_divemode_menu3: | |
140 bcf switch_left | |
141 bcf switch_right | |
142 bsf menubit ; Enter Divemode-Menu! | |
143 bcf premenu ; clear premenu flag | |
144 clrf timeout_counter3 | |
145 | |
146 btfsc display_set_gas ; Are we in the "Gaslist" or "SetPoint" menu? | |
147 bra divemenu_set_gas2 ; Yes, so set gas and exit menu | |
148 | |
149 btfsc display_see_deco ; Is the Decoplan displayed? | |
150 bra divemenu_see_decoplan2 ; Yes, exit menu on right button press | |
151 | |
152 btfsc display_set_xgas ; Are we in the "Set Gas" menu? | |
153 bra divemenu_set_xgas2 ; Yes, so configure gas or set menu and exit menu | |
154 | |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
155 btfsc display_set_active ; Are we in the "De/Activate gases menu?" menu? |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
156 bra divemenu_de_activate2 ; Yes, so toggle active flag |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
157 |
0 | 158 btfsc display_set_simulator ; Are we in the Divemode Simulator menu? |
159 goto divemode_menu_simulator2 ; Yes, so adjust depth or set and exit | |
160 | |
161 ; Options for Menu 1 | |
162 dcfsnz menupos,F | |
73
2227459e8ef2
Exchanged Decoplan and Gaslist in dive mode menu
heinrichsweikamp
parents:
71
diff
changeset
|
163 bra divemenu_set_gas ; Set gas sub-menu |
2227459e8ef2
Exchanged Decoplan and Gaslist in dive mode menu
heinrichsweikamp
parents:
71
diff
changeset
|
164 dcfsnz menupos,F |
0 | 165 bra divemenu_see_decoplan ; display the full decoplan |
166 dcfsnz menupos,F | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
167 bra divemode_menu3 ; Customview-function |
0 | 168 dcfsnz menupos,F |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
169 bra divemode_toggle_brightness ; Toggle OLED-Brightness |
0 | 170 dcfsnz menupos,F |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
171 bra timeout_divemenu2 ; Quit divemode menu |
119 | 172 bra timeout_divemenu2 ; Quit divemode menu |
0 | 173 |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
174 divemode_menu3: |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
175 movff menupos3,temp1 ; copy |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
176 dcfsnz temp1,F |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
177 bra toggle_stopwatch ; Toggle Stopwatch/Average register |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
178 dcfsnz temp1,F |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
179 bra set_marker ; Set Marker |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
180 dcfsnz temp1,F |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
181 bra divemode_menu3_nothing ; clock... |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
182 dcfsnz temp1,F |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
183 bra divemode_menu3_nothing ; leading tissue... |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
184 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
185 divemode_menu3_nothing: |
0 | 186 bra timeout_divemenu2 ; Quit divemode menu |
187 | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
188 set_marker: |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
189 movlw d'6' ; Type of Alarm (Manual Marker) |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
190 movwf AlarmType ; Copy to Alarm Register |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
191 bsf event_occured ; Set Event Flag |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
192 bra timeout_divemenu2 ; quit menu! |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
193 |
0 | 194 toggle_stopwatch: |
111 | 195 bsf reset_average_depth ; Average Depth will be resetted in divemode.asm |
0 | 196 bra timeout_divemenu2 ; quit menu! |
197 | |
198 divemode_toggle_brightness: | |
199 read_int_eeprom d'90' ; Brightness offset? (Dim>0, Normal = 0) | |
200 tstfsz EEDATA ; Was dimmed? | |
201 bra divemode_toggle_brightness1 ; Yes... | |
202 | |
203 call PLED_brightness_low | |
204 movlw d'1' | |
205 movwf EEDATA ; Copy to EEDATA | |
206 write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0) | |
207 bra divemode_toggle_brightness3 | |
208 | |
209 divemode_toggle_brightness1: | |
210 call PLED_brightness_full | |
211 movlw d'0' | |
212 movwf EEDATA ; Copy to EEDATA | |
213 write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0) | |
214 | |
215 divemode_toggle_brightness3: | |
216 ; Now, redraw all outputs (All modes) | |
217 call PLED_active_gas_divemode ; Display gas, if required | |
218 call PLED_temp_divemode ; Displays temperature | |
219 call PLED_depth ; Displays new depth... | |
220 call PLED_max_pressure ; ...and max. depth | |
221 | |
222 bra timeout_divemenu2 ; quit menu! | |
223 | |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
224 divemenu_de_activate: |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
225 bsf display_set_active ; Set display flag |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
226 bcf display_set_xgas ; Clear Flag |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
227 call PLED_clear_divemode_menu ; Clear Menu |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
228 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
229 call PLED_de_activelist ; show (de)active gaslist |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
230 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
231 movlw d'1' |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
232 movwf menupos ; reset cursor |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
233 call PLED_divemenu_cursor ; update cursor |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
234 return |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
235 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
236 divemenu_de_activate2: ; Toggle active flag |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
237 dcfsnz menupos,F |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
238 bra divemenu_de_activate2_exit ; Exit, Quit, Abort |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
239 dcfsnz menupos,F |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
240 bra divemenu_de_activate2_g1 ; Toggle Gas1 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
241 dcfsnz menupos,F |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
242 bra divemenu_de_activate2_g2 ; Toggle Gas2 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
243 dcfsnz menupos,F |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
244 bra divemenu_de_activate2_g3 ; Toggle Gas3 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
245 dcfsnz menupos,F |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
246 bra divemenu_de_activate2_g4 ; Toggle Gas4 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
247 dcfsnz menupos,F |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
248 bra divemenu_de_activate2_g5 ; Toggle Gas5 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
249 return ; should never be here |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
250 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
251 divemenu_de_activate2_exit: |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
252 bra timeout_divemenu2 ; quit underwater menu! |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
253 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
254 divemenu_de_activate2_g1: |
221 | 255 btg sorted_gaslist_active,0 ; Toggle flag |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
256 movlw d'2' |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
257 movwf menupos ; reset cursor |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
258 call PLED_de_activelist ; show (de)active gaslist |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
259 return |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
260 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
261 divemenu_de_activate2_g2: |
221 | 262 btg sorted_gaslist_active,1 ; Toggle flag |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
263 movlw d'3' |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
264 movwf menupos ; reset cursor |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
265 call PLED_de_activelist ; show (de)active gaslist |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
266 return |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
267 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
268 divemenu_de_activate2_g3: |
221 | 269 btg sorted_gaslist_active,2 ; Toggle flag |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
270 movlw d'4' |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
271 movwf menupos ; reset cursor |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
272 call PLED_de_activelist ; show (de)active gaslist |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
273 return |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
274 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
275 divemenu_de_activate2_g4: |
221 | 276 btg sorted_gaslist_active,3 ; Toggle flag |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
277 movlw d'5' |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
278 movwf menupos ; reset cursor |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
279 call PLED_de_activelist ; show (de)active gaslist |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
280 return |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
281 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
282 divemenu_de_activate2_g5: |
221 | 283 btg sorted_gaslist_active,4 ; Toggle flag |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
284 movlw d'6' |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
285 movwf menupos ; reset cursor |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
286 call PLED_de_activelist ; show (de)active gaslist |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
287 return |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
288 |
0 | 289 divemode_set_xgas: ; Set the extra gas... |
290 bsf display_set_xgas ; Set Flag | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
291 bcf display_set_gas ; Clear Flag |
0 | 292 call PLED_clear_divemode_menu ; Clear Menu |
293 | |
294 movff char_I_O2_ratio, EEDATA ; Reset Gas6 to current gas | |
295 write_int_eeprom d'24' | |
296 movff char_I_He_ratio, EEDATA | |
297 write_int_eeprom d'25' | |
298 | |
299 call PLED_divemode_set_xgas ; Show mask | |
300 | |
301 movlw d'1' | |
302 movwf menupos ; reset cursor | |
303 call PLED_divemenu_cursor ; update cursor | |
304 return | |
305 | |
306 divemode_menu_simulator: | |
307 bsf menubit ; Enter Divemode-Menu! | |
308 bcf premenu ; clear premenu flag | |
309 bcf switch_right | |
310 bcf switch_left ; Left button pressed! | |
104 | 311 bsf display_set_simulator ; Set Flag |
312 bsf menu3_active ; So "+1" is accessible at all times | |
0 | 313 call PLED_clear_divemode_menu ; Clear Menu |
314 call PLED_divemode_simulator_mask; Show mask | |
315 movlw d'1' | |
316 movwf menupos ; reset cursor | |
317 call PLED_divemenu_cursor ; update cursor | |
318 return | |
319 | |
320 divemode_menu_simulator2: | |
321 dcfsnz menupos,F | |
119 | 322 bra timeout_divemenu2 ; close underwater menu! |
0 | 323 dcfsnz menupos,F |
324 bra divemode_menu_simulator_p1 ; Adjust +1m | |
325 dcfsnz menupos,F | |
326 bra divemode_menu_simulator_m1 ; Adjust -1m | |
327 dcfsnz menupos,F | |
328 bra divemode_menu_simulator_p10 ; Adjust +10m | |
329 dcfsnz menupos,F | |
330 bra divemode_menu_simulator_m10 ; Adjust -10m | |
331 bra timeout_divemenu2 ; quit underwater menu! | |
332 | |
333 divemode_menu_simulator_common: | |
334 call PLED_divemode_simulator_mask ; Redraw Simualtor mask | |
335 | |
119 | 336 ; Check limits (130m and 0m) |
337 movlw LOW d'14000' | |
0 | 338 movwf sub_a+0 |
119 | 339 movlw HIGH d'14000' |
0 | 340 movwf sub_a+1 |
341 movff sim_pressure+0,sub_b+0 | |
342 movff sim_pressure+1,sub_b+1 | |
343 call sub16 ; sub_c = sub_a - sub_b | |
344 btfss neg_flag | |
345 bra divemode_menu_simulator_common2 | |
119 | 346 ; Too deep, limit to 130m |
347 movlw LOW d'14000' | |
0 | 348 movwf sim_pressure+0 |
119 | 349 movlw HIGH d'14000' |
0 | 350 movwf sim_pressure+1 |
351 return | |
352 | |
353 divemode_menu_simulator_common2: | |
354 movlw LOW d'1000' | |
355 movwf sub_a+0 | |
356 movlw HIGH d'1000' | |
357 movwf sub_a+1 | |
358 movff sim_pressure+0,sub_b+0 | |
359 movff sim_pressure+1,sub_b+1 | |
360 call sub16 ; sub_c = sub_a - sub_b | |
361 btfsc neg_flag | |
362 return | |
363 ; Too shallow, limit to 1m | |
364 movlw LOW d'1000' | |
365 movwf sim_pressure+0 | |
366 movlw HIGH d'1000' | |
367 movwf sim_pressure+1 | |
368 return | |
369 | |
370 divemode_menu_simulator_m10: | |
371 movlw LOW d'1000' | |
372 subwf sim_pressure+0,F | |
373 movlw HIGH d'1000' | |
374 subwfb sim_pressure+1,F | |
375 movlw d'5' | |
376 movwf menupos ; reset cursor | |
377 bra divemode_menu_simulator_common | |
378 | |
379 divemode_menu_simulator_p10: | |
380 movlw LOW d'1000' | |
381 addwf sim_pressure+0,F | |
382 movlw HIGH d'1000' | |
383 addwfc sim_pressure+1,F | |
384 movlw d'4' | |
385 movwf menupos ; reset cursor | |
386 bra divemode_menu_simulator_common | |
387 | |
388 divemode_menu_simulator_p1: | |
389 movlw d'100' | |
390 addwf sim_pressure+0,F | |
391 movlw d'0' | |
392 addwfc sim_pressure+1,F | |
393 movlw d'2' | |
394 movwf menupos ; reset cursor | |
395 bra divemode_menu_simulator_common | |
396 | |
397 divemode_menu_simulator_m1: | |
398 movlw d'100' | |
399 subwf sim_pressure+0,F | |
400 movlw d'0' | |
401 subwfb sim_pressure+1,F | |
402 movlw d'3' | |
403 movwf menupos ; reset cursor | |
404 bra divemode_menu_simulator_common | |
405 | |
406 divemenu_see_decoplan: | |
407 bsf display_see_deco ; set flag | |
64 | 408 call PLED_clear_divemode_menu ; Clear Menu |
0 | 409 |
64 | 410 bcf last_ceiling_gf_shown ; Clear flag |
124 | 411 clrf decoplan_page ; Starts on page 0 |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
412 bra divemenu_see_decoplan2_1 |
0 | 413 |
414 divemenu_see_decoplan2: | |
124 | 415 incf decoplan_page,F |
64 | 416 btfsc last_ceiling_gf_shown ; last ceiling shown? |
417 bra divemenu_see_decoplan2_0 ; All done, clear and return | |
418 | |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
419 divemenu_see_decoplan2_1: |
64 | 420 clrf timeout_counter3 ; Clear timeout Divemode menu |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
421 call PLED_decoplan ; Display the new screen |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
422 return |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
423 |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
424 divemenu_see_decoplan2_0: |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
425 bcf display_see_deco ; clear flag |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
426 bra timeout_divemenu2 ; quit menu! |
64 | 427 |
0 | 428 divemenu_set_xgas2: |
429 dcfsnz menupos,F | |
430 bra divemenu_set_xgas2_exit ; Use the gas6 configured and exit | |
431 dcfsnz menupos,F | |
432 bra divemenu_set_xgas2_o2plus ; Adjust O2+ | |
433 dcfsnz menupos,F | |
434 bra divemenu_set_xgas2_o2minus ; Adjust O2- | |
435 dcfsnz menupos,F | |
436 bra divemenu_set_xgas2_heplus ; Adjust He+ | |
437 dcfsnz menupos,F | |
438 bra divemenu_set_xgas2_heminus ; Adjust He- | |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
439 dcfsnz menupos,F |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
440 bra divemenu_de_activate ; Goto (De)active gases underwater list |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
441 return ; should never be here |
0 | 442 |
443 divemenu_set_xgas2_heminus: | |
444 read_int_eeprom d'25' ; He value | |
445 movff EEDATA,lo | |
446 decf lo,F ; decrease He | |
447 movlw d'255' | |
448 cpfseq lo | |
449 bra divemenu_set_xgas2_heminus2 | |
450 incf lo,F ; limit to min=0 | |
451 divemenu_set_xgas2_heminus2: | |
452 movff lo, EEDATA | |
453 write_int_eeprom d'25' ; He Value | |
454 | |
455 call PLED_divemode_set_xgas ; Redraw menu | |
456 movlw d'5' | |
457 movwf menupos ; reset cursor | |
458 return | |
459 | |
460 divemenu_set_xgas2_heplus: | |
461 read_int_eeprom d'25' ; He value | |
462 movff EEDATA,lo | |
463 incf lo,F ; increase He | |
464 movlw d'101' | |
465 cpfseq lo | |
466 bra divemenu_set_xgas2_heplus2 | |
467 movlw d'4' ; O2 Limit | |
468 movwf lo | |
469 divemenu_set_xgas2_heplus2: ; test if O2+He>100... | |
470 read_int_eeprom d'24' ; O2 value | |
471 movf EEDATA,W | |
472 addwf lo,W ; add He value | |
473 movwf hi ; store in temp | |
474 movlw d'101' | |
475 cpfseq hi ; O2 and He > 100? | |
476 bra divemenu_set_xgas2_heplus3 ; No! | |
477 decf lo,F ; reduce He again = unchanged after operation | |
478 divemenu_set_xgas2_heplus3: ; save current value | |
479 movff lo, EEDATA | |
480 write_int_eeprom d'25' ; He Value | |
481 | |
482 call PLED_divemode_set_xgas ; Redraw menu | |
483 movlw d'4' | |
484 movwf menupos ; reset cursor | |
485 return | |
486 | |
487 divemenu_set_xgas2_o2minus: | |
488 read_int_eeprom d'24' ; O2 value | |
489 movff EEDATA,lo | |
490 decf lo,F ; decrease O2 | |
491 movlw d'3' ; Limit-1 | |
492 cpfseq lo | |
493 bra divemenu_set_xgas2_o2minus2 | |
494 incf lo,F ; limit to min=9 | |
495 divemenu_set_xgas2_o2minus2: | |
496 movff lo, EEDATA | |
497 write_int_eeprom d'24' ; O2 Value | |
498 | |
499 call PLED_divemode_set_xgas ; Redraw menu | |
500 movlw d'3' | |
501 movwf menupos ; reset cursor | |
502 return | |
503 | |
504 divemenu_set_xgas2_o2plus: | |
505 read_int_eeprom d'24' ; O2 value | |
506 movff EEDATA,lo | |
507 incf lo,F ; increase O2 | |
508 movlw d'101' | |
509 cpfseq lo | |
510 bra divemenu_set_xgas2_o2plus2 | |
511 movlw d'5' ; O2 limit | |
512 movwf lo | |
513 divemenu_set_xgas2_o2plus2: ; test if O2+He>100... | |
514 read_int_eeprom d'25' ; He value | |
515 movf EEDATA,W | |
516 addwf lo,W ; add O2 value | |
517 movwf hi ; store in temp | |
518 movlw d'101' | |
519 cpfseq hi ; O2 and He > 100? | |
520 bra divemenu_set_xgas2_o2plus3 ; No! | |
521 decf lo,F ; reduce O2 again = unchanged after operation | |
522 divemenu_set_xgas2_o2plus3: ; save current value | |
523 movff lo, EEDATA | |
524 write_int_eeprom d'24' ; O2 Value | |
525 | |
526 call PLED_divemode_set_xgas ; Redraw menu | |
527 movlw d'2' | |
528 movwf menupos ; reset cursor | |
529 return | |
530 | |
531 divemenu_set_xgas2_exit: | |
532 read_int_eeprom d'25' ; Read He ratio | |
533 movff EEDATA,char_I_He_ratio ; And copy into hold register | |
534 | |
535 read_int_eeprom d'24' ; Read O2 ratio | |
536 movff EEDATA, char_I_O2_ratio ; O2 ratio | |
537 movff char_I_He_ratio, wait_temp ; copy into bank1 register | |
538 bsf STATUS,C ; | |
539 movlw d'100' ; 100% | |
540 subfwb wait_temp,W ; minus He | |
541 subfwb EEDATA,F ; minus O2 | |
542 movff EEDATA, char_I_N2_ratio ; = N2! | |
543 bsf manual_gas_changed ; set event flag | |
544 bsf event_occured ; set global event flag | |
99 | 545 bsf is_bailout ;=1: CC mode, but bailout active! |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
546 clrf lo ; clear Setpoint, PLED_const_ppO2_value now displayes "Bail" |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
547 movff lo,char_I_const_ppO2 |
0 | 548 bra timeout_divemenu2 ; quit underwater menu! |
549 | |
550 divemenu_set_gas: | |
551 btfsc FLAG_const_ppO2_mode ; in ppO2 mode? | |
17 | 552 bra divemenu_set_setpoint ; Yes, display SetPoint list |
0 | 553 |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
554 divemenu_set_gas_2: |
0 | 555 bsf display_set_gas ; set flag |
556 call PLED_clear_divemode_menu ; Clear Menu | |
557 call PLED_gas_list ; Display all 5 gases | |
558 movlw d'1' | |
559 movwf menupos ; reset cursor | |
560 call PLED_divemenu_cursor ; update cursor | |
561 return | |
562 | |
563 divemenu_set_setpoint: | |
564 bsf display_set_setpoint ; set flag | |
565 bsf display_set_gas ; set flag | |
566 | |
567 call PLED_clear_divemode_menu ; Clear Menu | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
568 call PLED_splist_start ; Display SetPoints |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
569 DISPLAYTEXT d'137' ; Bailout (as a sub-menu) |
0 | 570 movlw d'1' |
571 movwf menupos ; reset cursor | |
572 call PLED_divemenu_cursor ; update cursor | |
573 return | |
574 | |
575 | |
576 divemenu_set_gas2: | |
577 btfsc select_bailoutgas ; Are we in the Bailout list? | |
578 bra divemenu_set_gas2a ; Yes, choose gas | |
579 | |
580 btfss FLAG_const_ppO2_mode ; are we in ppO2 mode? | |
581 bra divemenu_set_gas2a ; no, choose gas | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
582 ; Yes, so select SP 1-3 |
3 | 583 bcf is_bailout ;=1: CC mode, but bailout active! |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
584 call PLED_show_ppO2_clear ; Clear ppO2 value |
3 | 585 |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
586 divemenu_set_gas1: |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
587 movlw d'4' |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
588 cpfseq menupos ; At the "Bailout" position? |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
589 bra divemenu_set_gas1b ; No, select SetPoint 1-3 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
590 bsf select_bailoutgas ; Set Flag |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
591 bcf display_set_setpoint ; Clear Flag |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
592 bra divemenu_set_gas_2 ; Configure the extra gas / Select Bailout |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
593 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
594 divemenu_set_gas1b: |
0 | 595 movlw d'35' ; offset in memory |
596 addwf menupos,W ; add SP number 0-2 | |
597 movwf EEADR | |
598 call read_eeprom ; Read SetPoint | |
599 movff EEDATA, char_I_const_ppO2 ; Use SetPoint | |
4 | 600 movff EEDATA, ppO2_setpoint_store ; Store also in this byte... |
0 | 601 |
602 divemenu_set_gas1a: | |
603 bcf display_set_setpoint ; Clear Display Flag | |
604 bsf stored_gas_changed ; set event flag | |
605 bsf event_occured ; set global event flag | |
606 bra timeout_divemenu2 ; quit menu! | |
607 | |
608 divemenu_set_gas2a: | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
609 movlw d'6' |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
610 cpfseq menupos ; At the "Gas 6.." position? |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
611 bra divemenu_set_gas2b ; No, select Gas1-5 (Stored in Menupos) |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
612 bra divemode_set_xgas ; Configure the extra gas |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
613 divemenu_set_gas2b: |
3 | 614 bsf is_bailout ;=1: CC mode, but bailout active! |
0 | 615 clrf lo ; clear Setpoint, PLED_const_ppO2_value now displayes "Bail" |
616 movff lo,char_I_const_ppO2 | |
617 | |
618 bcf display_set_gas ; clear flag | |
619 movff menupos,active_gas ; copy into active gas register | |
620 decf menupos,W ; # of selected gas (0-4) | |
621 mullw d'4' ; times 4... | |
622 movf PRODL,W ; | |
623 addlw d'7' ; +7 = address for He ratio | |
624 movwf EEADR | |
625 call read_eeprom ; Read He ratio | |
626 movff EEDATA,char_I_He_ratio ; And copy into hold register | |
627 | |
628 decf menupos,W ; # of selected gas (0-4) | |
629 mullw d'4' ; times 4... | |
630 movf PRODL,W ; | |
631 addlw d'6' ; +6 = address for O2 ratio | |
632 movwf EEADR | |
633 call read_eeprom ; Read O2 ratio | |
634 movff EEDATA, char_I_O2_ratio ; O2 ratio | |
635 movff char_I_He_ratio, wait_temp ; copy into bank1 register | |
636 bsf STATUS,C ; | |
637 movlw d'100' ; 100% | |
638 subfwb wait_temp,W ; minus He | |
639 subfwb EEDATA,F ; minus O2 | |
640 movff EEDATA, char_I_N2_ratio ; = N2! | |
641 bsf stored_gas_changed ; set event flag | |
642 bsf event_occured ; set global event flag | |
643 bra timeout_divemenu2 ; quit menu! | |
644 | |
645 timeout_divemenu: | |
646 btfss menubit ; is the Dive mode menu displayed? | |
647 return ; No | |
648 | |
649 btfsc display_set_simulator ; Is the Simulator Mask active? | |
650 bra timeout_divemenu6 ; Yes, update Simulator mask | |
651 | |
652 btfss display_see_deco ; Is the decoplan active? | |
653 bra timeout_divemenu1 ; No, skip updating the decoplan | |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
654 bra timeout_divemenu3 ; Yes... |
0 | 655 |
656 timeout_divemenu1: | |
657 incf timeout_counter3,F ; increase timeout_counter3 | |
658 GETCUSTOM8 d'10' ; loads timeout_divemenu into WREG | |
659 cpfsgt timeout_counter3 ; ... longer then timeout_divemenu | |
660 return ; No! | |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
661 |
0 | 662 timeout_divemenu2: ; quit divemode menu |
663 ; Restore some outputs | |
124 | 664 clrf decoplan_page ; Page 0-1 of deco list |
119 | 665 call PLED_clear_divemode_menu; Clear dive mode menu |
115 | 666 |
667 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode | |
668 bra timeout_divemenu2a ; skip! | |
669 btfsc gauge_mode ; Ignore in Gauge mode | |
670 bra timeout_divemenu2a ; skip! | |
671 | |
0 | 672 btfsc dekostop_active |
66 | 673 call PLED_display_deko_mask ; clear nostop time, display decodata |
0 | 674 btfss dekostop_active |
66 | 675 call PLED_display_ndl_mask ; Clear deco data, display nostop time |
0 | 676 |
677 timeout_divemenu2a: | |
678 bcf menubit | |
679 bcf premenu ; Yes, clear flags and menu, display dive time and mask again | |
66 | 680 call PLED_active_gas_divemode; Display gas, if required |
0 | 681 call PLED_divemode_mask ; Display mask |
682 call PLED_divemins ; Display (new) divetime! | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
683 call customview_mask ; Redraw current customview mask |
0 | 684 clrf timeout_counter3 ; Also clear timeout |
685 bcf display_see_deco ; clear all display flags | |
686 bcf display_set_gas | |
687 bcf display_set_xgas | |
688 bcf display_set_setpoint | |
689 bcf display_set_simulator | |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
690 bcf display_set_active |
0 | 691 bcf switch_left ; and debounce switches |
692 bcf switch_right | |
693 return | |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
694 |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
695 ; Re-Draw current page of decoplan (may have more stops) |
0 | 696 timeout_divemenu3: |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
697 movff char_O_deco_status,WREG ; Get last computation state (BANK safe) |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
698 iorwf WREG ; Is it zero ? |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
699 btfsc STATUS,Z |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
700 call PLED_decoplan ; Yes: new data available. |
0 | 701 bra timeout_divemenu1 ; Check timeout |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
702 |
0 | 703 timeout_divemenu6: |
704 ; Update Simulator Mask | |
705 call PLED_divemode_simulator_mask; Show mask | |
706 call PLED_divemenu_cursor ; update cursor | |
707 bra timeout_divemenu1 ; Check timeout |