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