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