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