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