Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/divemode_menu.asm @ 699:8b8c0dd0fa62
2.61beta release
author | heinrichsweikamp |
---|---|
date | Thu, 07 Mar 2013 11:04:04 +0100 |
parents | aebb6d039249 |
children | 03f8a8eec9ae b5ffde7e569e |
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 | |
576 | 35 |
36 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
0 | 37 |
38 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
|
39 |
46d1012d096a
Quick-access to menupos3 in divemode - ToDo: EAD and END in CCR mode
heinrichsweikamp
parents:
274
diff
changeset
|
40 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
|
41 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
|
42 |
46d1012d096a
Quick-access to menupos3 in divemode - ToDo: EAD and END in CCR mode
heinrichsweikamp
parents:
274
diff
changeset
|
43 test_switches_divemode_a: |
46d1012d096a
Quick-access to menupos3 in divemode - ToDo: EAD and END in CCR mode
heinrichsweikamp
parents:
274
diff
changeset
|
44 |
0 | 45 bsf premenu ; Set Flag for premenu |
46 bcf menubit | |
47 clrf timeout_counter3 ; timeout_divemenu | |
48 | |
49 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
50 bra test_switches_divemode1 ; Yes! | |
51 | |
52 WIN_INVERT .1 | |
53 DISPLAYTEXT .4 ;Menu? | |
54 WIN_INVERT .0 | |
55 return | |
56 | |
277
46d1012d096a
Quick-access to menupos3 in divemode - ToDo: EAD and END in CCR mode
heinrichsweikamp
parents:
274
diff
changeset
|
57 test_switches_divemode0: |
46d1012d096a
Quick-access to menupos3 in divemode - ToDo: EAD and END in CCR mode
heinrichsweikamp
parents:
274
diff
changeset
|
58 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
|
59 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
|
60 ; 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
|
61 movlw d'3' |
46d1012d096a
Quick-access to menupos3 in divemode - ToDo: EAD and END in CCR mode
heinrichsweikamp
parents:
274
diff
changeset
|
62 movwf menupos |
46d1012d096a
Quick-access to menupos3 in divemode - ToDo: EAD and END in CCR mode
heinrichsweikamp
parents:
274
diff
changeset
|
63 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
|
64 |
0 | 65 test_switches_divemode1: |
66 DISPLAYTEXT .141 ;Quit? | |
67 return | |
68 | |
69 test_switches_divemode2: | |
576 | 70 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! |
0 | 71 |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
72 btfsc premenu |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
73 bra test_switches_divemode2_2 |
109
6e635bf5b7a7
fixed double-effect of ENTER button in divemode
heinrichsweikamp
parents:
107
diff
changeset
|
74 btfsc menubit |
6e635bf5b7a7
fixed double-effect of ENTER button in divemode
heinrichsweikamp
parents:
107
diff
changeset
|
75 bra test_switches_divemode2_2 ; Not in Premenu or Menu... |
0 | 76 |
112 | 77 bsf toggle_customview ; Toggle customview (Cleared in customview.asm) |
78 | |
79 btfsc standalone_simulator ; Standalone Simualtor active? | |
80 bra divemode_menu_simulator ; Yes, Show simulator menu! | |
81 return | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
82 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
83 test_switches_divemode2_2: |
0 | 84 btfss FLAG_apnoe_mode ; In Apnoe mode? |
85 bra test_switches_divemode2a; No! | |
86 | |
87 ; Yes, so quit Apnoe mode at once... | |
88 bcf divemode ; Clear Divemode flag... | |
89 bcf premenu ; clear premenu flag | |
90 return | |
91 | |
92 test_switches_divemode2a: | |
277
46d1012d096a
Quick-access to menupos3 in divemode - ToDo: EAD and END in CCR mode
heinrichsweikamp
parents:
274
diff
changeset
|
93 movlw d'1' |
46d1012d096a
Quick-access to menupos3 in divemode - ToDo: EAD and END in CCR mode
heinrichsweikamp
parents:
274
diff
changeset
|
94 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
|
95 test_switches_divemode2b: |
0 | 96 bsf menubit ; Enter Divemode-Menu! |
97 bcf premenu ; clear premenu flag | |
681 | 98 call DISP_clear_divemode_menu ; Clear dive mode menu area |
99 call DISP_divemode_menu_mask_first ; Write Divemode menu1 mask | |
0 | 100 bcf display_set_simulator ; Clear Simulator-Menu flag |
681 | 101 call DISP_divemenu_cursor ; show cursor |
576 | 102 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! |
0 | 103 return |
104 | |
105 test_switches_divemode_menu: | |
337 | 106 btfsc uart_dump_screen ; Asked to dump screen contains ? |
107 call dump_screen ; Yes! | |
108 | |
0 | 109 btfsc switch_left |
110 bra test_switches_divemode_menu3 | |
111 btfss switch_right | |
112 return | |
113 | |
114 btfsc display_see_deco ; Is the Decoplan displayed? | |
115 bra divemenu_see_decoplan2 ; Yes, exit menu on left button press | |
116 | |
117 bcf switch_right ; Left button pressed | |
118 clrf timeout_counter3 ; timout_divemenu! | |
119 incf menupos,F | |
120 | |
121 ; Following routine configures the number of menu entries for the different modes | |
122 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
|
123 btfsc display_set_gas ; Are we in the "Gaslist" menu? |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
124 movlw d'7' ; Yes, Number of entries for this menu+1 = 7 |
0 | 125 btfsc display_set_setpoint ; In SetPoint Menu? |
647 | 126 movlw d'6' ; Number of entries for this menu+1 = 6 |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
127 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
|
128 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
|
129 btfsc display_set_xgas ; Are we in the Gas6 menu? |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
130 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
|
131 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
|
132 movlw d'7' ; Number of entries for this menu+1 = 7 |
647 | 133 btfsc display_set_diluent ; Are we in the "Diluent" list? |
134 movlw d'6' ; Number of entries for this menu+1 = 6 | |
0 | 135 cpfseq menupos ; =limit? |
136 bra test_switches_divemode_menu1; No! | |
137 movlw d'1' ; Yes, reset to position 1! | |
138 movwf menupos | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
139 |
0 | 140 test_switches_divemode_menu1: |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
141 ; 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
|
142 |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
143 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
|
144 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
|
145 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
|
146 bra test_switches_divemode_menu1a ; Skip test for sub menus |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
147 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
|
148 bra test_switches_divemode_menu1a ; Skip test for sub menus |
647 | 149 btfsc display_set_diluent ; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu? |
150 bra test_switches_divemode_menu1a ; Skip test for sub menus | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
151 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
152 movlw d'3' |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
153 cpfseq menupos ; At position 3? |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
154 bra test_switches_divemode_menu1a ; No |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
155 btfss menu3_active ; Menu position 3 has functionality? |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
156 incf menupos,F ; No, +1, skip to menuos=4 |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
157 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
158 test_switches_divemode_menu1a: |
681 | 159 call DISP_divemenu_cursor ; update cursor |
528
67ab3c028bc2
Show change gas depth below gaslist (in divemode)
heinrichsweikamp
parents:
525
diff
changeset
|
160 btfsc display_set_gas ; In Gaslist or Setpoint list menu? |
681 | 161 call DISP_show_change_depth ; Yes, show change depth for gas #menupos |
0 | 162 return |
163 | |
164 test_switches_divemode_menu3: | |
576 | 165 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! |
0 | 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 | |
647 | 185 btfsc display_set_diluent ; Are we in the "Diluent" List? |
186 goto divemode_set_diluent2 ; Yes, so choose diluent and exit | |
187 | |
0 | 188 ; Options for Menu 1 |
189 dcfsnz menupos,F | |
73
2227459e8ef2
Exchanged Decoplan and Gaslist in dive mode menu
heinrichsweikamp
parents:
71
diff
changeset
|
190 bra divemenu_set_gas ; Set gas sub-menu |
2227459e8ef2
Exchanged Decoplan and Gaslist in dive mode menu
heinrichsweikamp
parents:
71
diff
changeset
|
191 dcfsnz menupos,F |
0 | 192 bra divemenu_see_decoplan ; display the full decoplan |
193 dcfsnz menupos,F | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
194 bra divemode_menu3 ; Customview-function |
0 | 195 dcfsnz menupos,F |
681 | 196 bra divemode_toggle_brightness ; Toggle DISPLAY-Brightness |
0 | 197 dcfsnz menupos,F |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
198 bra timeout_divemenu2 ; Quit divemode menu |
119 | 199 bra timeout_divemenu2 ; Quit divemode menu |
0 | 200 |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
201 divemode_menu3: |
479
9fc8feff27a5
Enable reset in cave bailout prediction, by using chrono average depth.
JeanDo
parents:
407
diff
changeset
|
202 dcfsnz menupos3,W ; copy |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
203 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
|
204 dcfsnz WREG,F |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
205 bra set_marker ; Set Marker |
479
9fc8feff27a5
Enable reset in cave bailout prediction, by using chrono average depth.
JeanDo
parents:
407
diff
changeset
|
206 dcfsnz WREG,F |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
207 bra divemode_menu3_nothing ; clock... |
479
9fc8feff27a5
Enable reset in cave bailout prediction, by using chrono average depth.
JeanDo
parents:
407
diff
changeset
|
208 dcfsnz WREG,F |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
209 bra divemode_menu3_nothing ; leading tissue... |
479
9fc8feff27a5
Enable reset in cave bailout prediction, by using chrono average depth.
JeanDo
parents:
407
diff
changeset
|
210 dcfsnz WREG,F |
9fc8feff27a5
Enable reset in cave bailout prediction, by using chrono average depth.
JeanDo
parents:
407
diff
changeset
|
211 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
|
212 dcfsnz WREG,F |
9fc8feff27a5
Enable reset in cave bailout prediction, by using chrono average depth.
JeanDo
parents:
407
diff
changeset
|
213 bra divemode_menu3_nothing ; Graphs... |
9fc8feff27a5
Enable reset in cave bailout prediction, by using chrono average depth.
JeanDo
parents:
407
diff
changeset
|
214 dcfsnz WREG,F |
9fc8feff27a5
Enable reset in cave bailout prediction, by using chrono average depth.
JeanDo
parents:
407
diff
changeset
|
215 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
|
216 dcfsnz WREG,F |
525 | 217 bra divemode_menu3_nothing ; Future TTS... |
479
9fc8feff27a5
Enable reset in cave bailout prediction, by using chrono average depth.
JeanDo
parents:
407
diff
changeset
|
218 dcfsnz WREG,F |
9fc8feff27a5
Enable reset in cave bailout prediction, by using chrono average depth.
JeanDo
parents:
407
diff
changeset
|
219 bra toggle_stopwatch ; Cave bailout prediction. |
666 | 220 dcfsnz WREG,F |
221 bra divemode_menu3_nothing ; pSCR info | |
222 dcfsnz WREG,F | |
223 bra toggle_gradient_factors ; Toggle gradient factors | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
224 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
225 divemode_menu3_nothing: |
0 | 226 bra timeout_divemenu2 ; Quit divemode menu |
227 | |
666 | 228 toggle_gradient_factors: |
229 btg use_aGF ; Toggle GF selector bit | |
230 bsf decoplan_invalid ; The decoplan needs to updated | |
231 clrf WREG | |
232 movff WREG,char_O_deco_status ; Restart decoplan computation mH | |
233 btfss use_aGF | |
234 bra toggle_gradient_factors2 ; Use aGf | |
235 ; Use normal GF | |
236 ; Load GF values into RAM | |
237 GETCUSTOM8 d'32' ; GF low | |
238 movff EEDATA,char_I_GF_Low_percentage | |
239 GETCUSTOM8 d'33' ; GF high | |
240 movff EEDATA,char_I_GF_High_percentage | |
241 bra timeout_divemenu2 ; quit menu! | |
242 toggle_gradient_factors2: ; Use aGf | |
243 ; Load GF values into RAM | |
244 GETCUSTOM8 d'67' ; aGF low | |
245 movff EEDATA,char_I_GF_Low_percentage | |
246 GETCUSTOM8 d'68' ; aGF high | |
247 movff EEDATA,char_I_GF_High_percentage | |
248 bra timeout_divemenu2 ; quit menu! | |
249 | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
250 set_marker: |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
251 movlw d'6' ; Type of Alarm (Manual Marker) |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
252 movwf AlarmType ; Copy to Alarm Register |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
253 bsf event_occured ; Set Event Flag |
674 | 254 |
255 ; save snapshot of depth and time | |
256 SAFE_2BYTE_COPY rel_pressure,marker_depth | |
257 SAFE_2BYTE_COPY divemins,marker_time | |
258 movff divesecs,marker_time+2 | |
259 | |
260 bra timeout_divemenu2 ; quit menu! | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
261 |
0 | 262 toggle_stopwatch: |
111 | 263 bsf reset_average_depth ; Average Depth will be resetted in divemode.asm |
0 | 264 bra timeout_divemenu2 ; quit menu! |
265 | |
266 divemode_toggle_brightness: | |
267 read_int_eeprom d'90' ; Brightness offset? (Dim>0, Normal = 0) | |
268 tstfsz EEDATA ; Was dimmed? | |
269 bra divemode_toggle_brightness1 ; Yes... | |
270 | |
681 | 271 call DISP_brightness_low |
0 | 272 movlw d'1' |
273 movwf EEDATA ; Copy to EEDATA | |
274 write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0) | |
275 bra divemode_toggle_brightness3 | |
276 | |
277 divemode_toggle_brightness1: | |
681 | 278 call DISP_brightness_full |
0 | 279 movlw d'0' |
280 movwf EEDATA ; Copy to EEDATA | |
281 write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0) | |
282 | |
283 divemode_toggle_brightness3: | |
284 ; Now, redraw all outputs (All modes) | |
681 | 285 call DISP_active_gas_divemode ; Display gas, if required |
286 call DISP_temp_divemode ; Displays temperature | |
287 call DISP_depth ; Displays new depth... | |
288 call DISP_max_pressure ; ...and max. depth | |
0 | 289 |
290 bra timeout_divemenu2 ; quit menu! | |
291 | |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
292 divemenu_de_activate: |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
293 bsf display_set_active ; Set display flag |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
294 bcf display_set_xgas ; Clear Flag |
681 | 295 call DISP_clear_divemode_menu ; Clear Menu |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
296 |
681 | 297 call DISP_de_activelist ; show (de)active gaslist |
219
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 movlw d'1' |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
300 movwf menupos ; reset cursor |
681 | 301 call DISP_divemenu_cursor ; update cursor |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
302 return |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
303 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
304 divemenu_de_activate2: ; Toggle active flag |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
305 dcfsnz menupos,F |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
306 bra divemenu_de_activate2_exit ; Exit, Quit, Abort |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
307 dcfsnz menupos,F |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
308 bra divemenu_de_activate2_g1 ; Toggle Gas1 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
309 dcfsnz menupos,F |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
310 bra divemenu_de_activate2_g2 ; Toggle Gas2 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
311 dcfsnz menupos,F |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
312 bra divemenu_de_activate2_g3 ; Toggle Gas3 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
313 dcfsnz menupos,F |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
314 bra divemenu_de_activate2_g4 ; Toggle Gas4 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
315 dcfsnz menupos,F |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
316 bra divemenu_de_activate2_g5 ; Toggle Gas5 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
317 return ; should never be here |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
318 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
319 divemenu_de_activate2_exit: |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
320 bra timeout_divemenu2 ; quit underwater menu! |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
321 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
322 divemenu_de_activate2_g1: |
290
4dbff2aa31ee
Hunting for refusing to ignore disabled gas in list...
JeanDo
parents:
286
diff
changeset
|
323 btg gaslist_active,0 ; Toggle flag |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
324 movlw d'2' |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
325 movwf menupos ; reset cursor |
681 | 326 call DISP_de_activelist ; show (de)active gaslist |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
327 return |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
328 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
329 divemenu_de_activate2_g2: |
290
4dbff2aa31ee
Hunting for refusing to ignore disabled gas in list...
JeanDo
parents:
286
diff
changeset
|
330 btg gaslist_active,1 ; Toggle flag |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
331 movlw d'3' |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
332 movwf menupos ; reset cursor |
681 | 333 call DISP_de_activelist ; show (de)active gaslist |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
334 return |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
335 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
336 divemenu_de_activate2_g3: |
290
4dbff2aa31ee
Hunting for refusing to ignore disabled gas in list...
JeanDo
parents:
286
diff
changeset
|
337 btg gaslist_active,2 ; Toggle flag |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
338 movlw d'4' |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
339 movwf menupos ; reset cursor |
681 | 340 call DISP_de_activelist ; show (de)active gaslist |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
341 return |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
342 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
343 divemenu_de_activate2_g4: |
290
4dbff2aa31ee
Hunting for refusing to ignore disabled gas in list...
JeanDo
parents:
286
diff
changeset
|
344 btg gaslist_active,3 ; Toggle flag |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
345 movlw d'5' |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
346 movwf menupos ; reset cursor |
681 | 347 call DISP_de_activelist ; show (de)active gaslist |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
348 return |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
349 |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
350 divemenu_de_activate2_g5: |
290
4dbff2aa31ee
Hunting for refusing to ignore disabled gas in list...
JeanDo
parents:
286
diff
changeset
|
351 btg gaslist_active,4 ; Toggle flag |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
352 movlw d'6' |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
353 movwf menupos ; reset cursor |
681 | 354 call DISP_de_activelist ; show (de)active gaslist |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
355 return |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
356 |
0 | 357 divemode_set_xgas: ; Set the extra gas... |
358 bsf display_set_xgas ; Set Flag | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
359 bcf display_set_gas ; Clear Flag |
681 | 360 call DISP_clear_divemode_menu ; Clear Menu |
0 | 361 |
362 movff char_I_O2_ratio, EEDATA ; Reset Gas6 to current gas | |
363 write_int_eeprom d'24' | |
364 movff char_I_He_ratio, EEDATA | |
365 write_int_eeprom d'25' | |
366 | |
681 | 367 call DISP_divemode_set_xgas ; Show mask |
0 | 368 |
369 movlw d'1' | |
370 movwf menupos ; reset cursor | |
681 | 371 call DISP_divemenu_cursor ; update cursor |
0 | 372 return |
373 | |
374 divemode_menu_simulator: | |
375 bsf menubit ; Enter Divemode-Menu! | |
376 bcf premenu ; clear premenu flag | |
576 | 377 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! |
104 | 378 bsf display_set_simulator ; Set Flag |
379 bsf menu3_active ; So "+1" is accessible at all times | |
681 | 380 call DISP_clear_divemode_menu ; Clear Menu |
381 call DISP_divemode_simulator_mask; Show mask | |
0 | 382 movlw d'1' |
383 movwf menupos ; reset cursor | |
681 | 384 call DISP_divemenu_cursor ; update cursor |
0 | 385 return |
386 | |
387 divemode_menu_simulator2: | |
388 dcfsnz menupos,F | |
119 | 389 bra timeout_divemenu2 ; close underwater menu! |
0 | 390 dcfsnz menupos,F |
391 bra divemode_menu_simulator_p1 ; Adjust +1m | |
392 dcfsnz menupos,F | |
393 bra divemode_menu_simulator_m1 ; Adjust -1m | |
394 dcfsnz menupos,F | |
395 bra divemode_menu_simulator_p10 ; Adjust +10m | |
396 dcfsnz menupos,F | |
397 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
|
398 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
|
399 bra divemode_menu_simulator_quit; Adjust to zero m |
0 | 400 bra timeout_divemenu2 ; quit underwater menu! |
401 | |
402 divemode_menu_simulator_common: | |
681 | 403 call DISP_divemode_simulator_mask ; Redraw Simualtor mask |
0 | 404 |
119 | 405 ; Check limits (130m and 0m) |
236 | 406 movlw LOW d'14000' ; Compare to 14bar=14000mbar (130m). |
407 subwf sim_pressure+0,W | |
119 | 408 movlw HIGH d'14000' |
236 | 409 subwfb sim_pressure+1,W |
410 bnc divemode_menu_simulator_common2 ; No-carry = borrow = not deeper | |
411 | |
119 | 412 ; Too deep, limit to 130m |
413 movlw LOW d'14000' | |
0 | 414 movwf sim_pressure+0 |
119 | 415 movlw HIGH d'14000' |
0 | 416 movwf sim_pressure+1 |
417 return | |
418 divemode_menu_simulator_common2: | |
236 | 419 movlw LOW d'1000' ; Compare to 1bar == 0m == 1000 mbar. |
420 subwf sim_pressure+0,W | |
0 | 421 movlw HIGH d'1000' |
236 | 422 subwfb sim_pressure+1,W |
423 btfsc STATUS,C ; No-carry = borrow = not deeper. | |
424 return ; Deeper than 0m == Ok. | |
425 | |
0 | 426 ; Too shallow, limit to 1m |
427 movlw LOW d'1000' | |
428 movwf sim_pressure+0 | |
429 movlw HIGH d'1000' | |
430 movwf sim_pressure+1 | |
431 return | |
432 | |
433 divemode_menu_simulator_m10: | |
434 movlw LOW d'1000' | |
435 subwf sim_pressure+0,F | |
436 movlw HIGH d'1000' | |
437 subwfb sim_pressure+1,F | |
438 movlw d'5' | |
439 movwf menupos ; reset cursor | |
440 bra divemode_menu_simulator_common | |
441 | |
442 divemode_menu_simulator_p10: | |
443 movlw LOW d'1000' | |
444 addwf sim_pressure+0,F | |
445 movlw HIGH d'1000' | |
446 addwfc sim_pressure+1,F | |
236 | 447 |
0 | 448 movlw d'4' |
449 movwf menupos ; reset cursor | |
450 bra divemode_menu_simulator_common | |
451 | |
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
|
452 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
|
453 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
|
454 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
|
455 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
|
456 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
|
457 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
|
458 |
0 | 459 divemode_menu_simulator_p1: |
460 movlw d'100' | |
461 addwf sim_pressure+0,F | |
462 movlw d'0' | |
463 addwfc sim_pressure+1,F | |
464 movlw d'2' | |
465 movwf menupos ; reset cursor | |
466 bra divemode_menu_simulator_common | |
467 | |
468 divemode_menu_simulator_m1: | |
469 movlw d'100' | |
470 subwf sim_pressure+0,F | |
471 movlw d'0' | |
472 subwfb sim_pressure+1,F | |
473 movlw d'3' | |
474 movwf menupos ; reset cursor | |
475 bra divemode_menu_simulator_common | |
476 | |
477 divemenu_see_decoplan: | |
478 bsf display_see_deco ; set flag | |
681 | 479 call DISP_clear_divemode_menu ; Clear Menu |
0 | 480 |
64 | 481 bcf last_ceiling_gf_shown ; Clear flag |
124 | 482 clrf decoplan_page ; Starts on page 0 |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
483 bra divemenu_see_decoplan2_1 |
0 | 484 |
485 divemenu_see_decoplan2: | |
124 | 486 incf decoplan_page,F |
64 | 487 btfsc last_ceiling_gf_shown ; last ceiling shown? |
488 bra divemenu_see_decoplan2_0 ; All done, clear and return | |
489 | |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
490 divemenu_see_decoplan2_1: |
64 | 491 clrf timeout_counter3 ; Clear timeout Divemode menu |
681 | 492 call DISP_decoplan ; Display the new screen |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
493 return |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
494 |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
495 divemenu_see_decoplan2_0: |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
496 bcf display_see_deco ; clear flag |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
497 bra timeout_divemenu2 ; quit menu! |
64 | 498 |
0 | 499 divemenu_set_xgas2: |
500 dcfsnz menupos,F | |
501 bra divemenu_set_xgas2_exit ; Use the gas6 configured and exit | |
502 dcfsnz menupos,F | |
503 bra divemenu_set_xgas2_o2plus ; Adjust O2+ | |
504 dcfsnz menupos,F | |
505 bra divemenu_set_xgas2_o2minus ; Adjust O2- | |
506 dcfsnz menupos,F | |
507 bra divemenu_set_xgas2_heplus ; Adjust He+ | |
508 dcfsnz menupos,F | |
509 bra divemenu_set_xgas2_heminus ; Adjust He- | |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
510 dcfsnz menupos,F |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
511 bra divemenu_de_activate ; Goto (De)active gases underwater list |
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
512 return ; should never be here |
0 | 513 |
514 divemenu_set_xgas2_heminus: | |
515 read_int_eeprom d'25' ; He value | |
516 movff EEDATA,lo | |
517 decf lo,F ; decrease He | |
518 movlw d'255' | |
519 cpfseq lo | |
520 bra divemenu_set_xgas2_heminus2 | |
521 incf lo,F ; limit to min=0 | |
522 divemenu_set_xgas2_heminus2: | |
523 movff lo, EEDATA | |
524 write_int_eeprom d'25' ; He Value | |
525 | |
681 | 526 call DISP_divemode_set_xgas ; Redraw menu |
0 | 527 movlw d'5' |
528 movwf menupos ; reset cursor | |
529 return | |
530 | |
531 divemenu_set_xgas2_heplus: | |
532 read_int_eeprom d'25' ; He value | |
533 movff EEDATA,lo | |
534 incf lo,F ; increase He | |
535 movlw d'101' | |
536 cpfseq lo | |
537 bra divemenu_set_xgas2_heplus2 | |
538 movlw d'4' ; O2 Limit | |
539 movwf lo | |
540 divemenu_set_xgas2_heplus2: ; test if O2+He>100... | |
541 read_int_eeprom d'24' ; O2 value | |
542 movf EEDATA,W | |
543 addwf lo,W ; add He value | |
544 movwf hi ; store in temp | |
545 movlw d'101' | |
546 cpfseq hi ; O2 and He > 100? | |
547 bra divemenu_set_xgas2_heplus3 ; No! | |
548 decf lo,F ; reduce He again = unchanged after operation | |
549 divemenu_set_xgas2_heplus3: ; save current value | |
550 movff lo, EEDATA | |
551 write_int_eeprom d'25' ; He Value | |
552 | |
681 | 553 call DISP_divemode_set_xgas ; Redraw menu |
0 | 554 movlw d'4' |
555 movwf menupos ; reset cursor | |
556 return | |
557 | |
558 divemenu_set_xgas2_o2minus: | |
559 read_int_eeprom d'24' ; O2 value | |
560 movff EEDATA,lo | |
561 decf lo,F ; decrease O2 | |
643 | 562 movlw d'0' |
0 | 563 cpfseq lo |
564 bra divemenu_set_xgas2_o2minus2 | |
643 | 565 read_int_eeprom d'25' ; Read He ratio |
566 movf EEDATA,W ; into WREG | |
567 sublw .100 ; 100% total... | |
568 movwf lo ; Set to Max. value | |
0 | 569 divemenu_set_xgas2_o2minus2: |
570 movff lo, EEDATA | |
571 write_int_eeprom d'24' ; O2 Value | |
572 | |
681 | 573 call DISP_divemode_set_xgas ; Redraw menu |
0 | 574 movlw d'3' |
575 movwf menupos ; reset cursor | |
576 return | |
577 | |
578 divemenu_set_xgas2_o2plus: | |
579 read_int_eeprom d'24' ; O2 value | |
580 movff EEDATA,lo | |
581 incf lo,F ; increase O2 | |
582 movlw d'101' | |
583 cpfseq lo | |
584 bra divemenu_set_xgas2_o2plus2 | |
585 movlw d'5' ; O2 limit | |
586 movwf lo | |
587 divemenu_set_xgas2_o2plus2: ; test if O2+He>100... | |
588 read_int_eeprom d'25' ; He value | |
589 movf EEDATA,W | |
590 addwf lo,W ; add O2 value | |
591 movwf hi ; store in temp | |
643 | 592 movlw d'100' |
593 cpfsgt hi ; O2 and He > 100? | |
0 | 594 bra divemenu_set_xgas2_o2plus3 ; No! |
595 decf lo,F ; reduce O2 again = unchanged after operation | |
596 divemenu_set_xgas2_o2plus3: ; save current value | |
597 movff lo, EEDATA | |
598 write_int_eeprom d'24' ; O2 Value | |
599 | |
681 | 600 call DISP_divemode_set_xgas ; Redraw menu |
0 | 601 movlw d'2' |
602 movwf menupos ; reset cursor | |
603 return | |
604 | |
605 divemenu_set_xgas2_exit: | |
606 read_int_eeprom d'25' ; Read He ratio | |
607 movff EEDATA,char_I_He_ratio ; And copy into hold register | |
608 | |
609 read_int_eeprom d'24' ; Read O2 ratio | |
610 movff EEDATA, char_I_O2_ratio ; O2 ratio | |
611 movff char_I_He_ratio, wait_temp ; copy into bank1 register | |
612 bsf STATUS,C ; | |
613 movlw d'100' ; 100% | |
614 subfwb wait_temp,W ; minus He | |
615 subfwb EEDATA,F ; minus O2 | |
616 movff EEDATA, char_I_N2_ratio ; = N2! | |
617 bsf manual_gas_changed ; set event flag | |
618 bsf event_occured ; set global event flag | |
665
259e4c1bf3c2
grey-out TTS and ceiling after gas change (until new plan is ready)
heinrichsweikamp
parents:
663
diff
changeset
|
619 bsf decoplan_invalid ; The decoplan needs to updated |
663
64194a3c8d5b
Restart building decoplan after gas change
heinrichsweikamp
parents:
647
diff
changeset
|
620 clrf WREG |
64194a3c8d5b
Restart building decoplan after gas change
heinrichsweikamp
parents:
647
diff
changeset
|
621 movff WREG,char_O_deco_status ; Restart decoplan computation mH |
99 | 622 bsf is_bailout ;=1: CC mode, but bailout active! |
681 | 623 clrf lo ; clear Setpoint, DISP_const_ppO2_value now displayes "Bail" |
353
b5b030c1ae7e
Avoid spurious switch-depth stops with 3 or more gas.
JeanDo
parents:
337
diff
changeset
|
624 movff lo,char_I_const_ppO2 |
b5b030c1ae7e
Avoid spurious switch-depth stops with 3 or more gas.
JeanDo
parents:
337
diff
changeset
|
625 movlw 6 |
b5b030c1ae7e
Avoid spurious switch-depth stops with 3 or more gas.
JeanDo
parents:
337
diff
changeset
|
626 movff WREG,char_I_current_gas ; Current gas is Gas6 (manual setting). |
0 | 627 bra timeout_divemenu2 ; quit underwater menu! |
628 | |
629 divemenu_set_gas: | |
630 btfsc FLAG_const_ppO2_mode ; in ppO2 mode? | |
17 | 631 bra divemenu_set_setpoint ; Yes, display SetPoint list |
0 | 632 |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
633 divemenu_set_gas_2: |
0 | 634 bsf display_set_gas ; set flag |
681 | 635 call DISP_clear_divemode_menu ; Clear Menu |
636 call DISP_gas_list ; Display all 5 gases | |
629
e755ed869a3b
2.51beta release - remove of MPLAB 8 workspace. Use of MPLAB X IDE recommended
heinrichsweikamp
parents:
598
diff
changeset
|
637 |
e755ed869a3b
2.51beta release - remove of MPLAB 8 workspace. Use of MPLAB X IDE recommended
heinrichsweikamp
parents:
598
diff
changeset
|
638 movlw d'1' ; Reset cursor |
e755ed869a3b
2.51beta release - remove of MPLAB 8 workspace. Use of MPLAB X IDE recommended
heinrichsweikamp
parents:
598
diff
changeset
|
639 btfsc better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
e755ed869a3b
2.51beta release - remove of MPLAB 8 workspace. Use of MPLAB X IDE recommended
heinrichsweikamp
parents:
598
diff
changeset
|
640 movf better_gas_number,W ; better gas 1-5 |
0 | 641 movwf menupos ; reset cursor |
681 | 642 call DISP_divemenu_cursor ; update cursor |
643 call DISP_show_change_depth ; And show the first change depth | |
0 | 644 return |
645 | |
646 divemenu_set_setpoint: | |
647 bsf display_set_setpoint ; set flag | |
648 bsf display_set_gas ; set flag | |
649 | |
681 | 650 call DISP_clear_divemode_menu ; Clear Menu |
651 call DISP_splist_start ; Display SetPoints | |
647 | 652 DISPLAYTEXT d'137' ; Bailout (as a sub-menu) |
653 DISPLAYTEXT d'232' ; Diluent (as a sub-menu) | |
0 | 654 movlw d'1' |
655 movwf menupos ; reset cursor | |
681 | 656 call DISP_divemenu_cursor ; update cursor |
0 | 657 return |
658 | |
659 | |
660 divemenu_set_gas2: | |
661 btfsc select_bailoutgas ; Are we in the Bailout list? | |
662 bra divemenu_set_gas2a ; Yes, choose gas | |
663 | |
664 btfss FLAG_const_ppO2_mode ; are we in ppO2 mode? | |
665 bra divemenu_set_gas2a ; no, choose gas | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
666 ; Yes, so select SP 1-3 |
3 | 667 bcf is_bailout ;=1: CC mode, but bailout active! |
681 | 668 call DISP_show_ppO2_clear ; Clear ppO2 value |
3 | 669 |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
670 divemenu_set_gas1: |
525 | 671 movlw d'1' |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
672 cpfseq menupos ; At the "Bailout" position? |
647 | 673 bra divemenu_set_gas1b ; No, select SetPoint 1-3 or Diluent |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
674 bsf select_bailoutgas ; Set Flag |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
675 bcf display_set_setpoint ; Clear Flag |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
676 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
|
677 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
678 divemenu_set_gas1b: |
647 | 679 movlw d'5' |
680 cpfseq menupos ; At the "Diluent" position? | |
681 bra divemenu_set_gas1c ; No, select SetPoint 1-3 | |
682 ; Choose Diluent from list | |
683 bcf display_set_setpoint ; Clear Flag | |
684 bcf display_set_gas ; Clear Flag | |
685 bsf display_set_diluent ; Set Flag | |
681 | 686 call DISP_clear_divemode_menu ; Clear Menu |
687 call DISP_diluent_list ; Display all 5 diluents | |
647 | 688 movlw d'1' ; Reset cursor |
689 movwf menupos ; reset cursor | |
681 | 690 call DISP_divemenu_cursor ; update cursor |
647 | 691 return |
692 | |
693 divemode_set_diluent2: ; Choose diluent #menupos | |
694 movff menupos,active_diluent ; 1-5 | |
695 bra divemenu_set_gas1d ; Continue here... | |
696 | |
697 divemenu_set_gas1c: | |
525 | 698 decf menupos,F ; Adjust 1-3 to 0-2... |
0 | 699 movlw d'35' ; offset in memory |
700 addwf menupos,W ; add SP number 0-2 | |
701 movwf EEADR | |
702 call read_eeprom ; Read SetPoint | |
703 movff EEDATA, char_I_const_ppO2 ; Use SetPoint | |
4 | 704 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
|
705 bsf setpoint_changed |
407 | 706 bsf event_occured ; set global event flag |
647 | 707 |
708 divemenu_set_gas1d: ; (Re-)Set Diluent | |
709 decf active_diluent,W ; 0-4 -> WREG mH | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
710 mullw .4 |
647 | 711 movf PRODL,W |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
712 addlw d'98' |
647 | 713 movwf EEADR |
714 call read_eeprom ; Read He | |
715 movff EEDATA,char_I_He_ratio ; And copy into hold register | |
716 decf active_diluent,W ; 0-4 -> WREG | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
717 mullw .4 |
647 | 718 movf PRODL,W |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
719 addlw d'97' |
647 | 720 movwf EEADR |
721 call read_eeprom ; Read O2 | |
722 movff EEDATA, char_I_O2_ratio ; O2 ratio | |
723 movff char_I_He_ratio, wait_temp ; copy into bank1 register | |
724 bsf STATUS,C ; Borrow bit | |
725 movlw d'100' ; 100% | |
726 subfwb wait_temp,W ; minus He | |
727 bsf STATUS,C ; Borrow bit | |
728 subfwb EEDATA,W ; minus O2 | |
729 movff WREG, char_I_N2_ratio ; = N2! | |
407 | 730 bra timeout_divemenu2 ; quit menu! |
0 | 731 |
732 divemenu_set_gas1a: | |
733 bcf display_set_setpoint ; Clear Display Flag | |
734 bsf stored_gas_changed ; set event flag | |
735 bsf event_occured ; set global event flag | |
665
259e4c1bf3c2
grey-out TTS and ceiling after gas change (until new plan is ready)
heinrichsweikamp
parents:
663
diff
changeset
|
736 bsf decoplan_invalid ; The decoplan needs to updated |
663
64194a3c8d5b
Restart building decoplan after gas change
heinrichsweikamp
parents:
647
diff
changeset
|
737 clrf WREG |
64194a3c8d5b
Restart building decoplan after gas change
heinrichsweikamp
parents:
647
diff
changeset
|
738 movff WREG,char_O_deco_status ; Restart decoplan computation mH |
0 | 739 bra timeout_divemenu2 ; quit menu! |
740 | |
741 divemenu_set_gas2a: | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
742 movlw d'6' |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
743 cpfseq menupos ; At the "Gas 6.." position? |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
744 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
|
745 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
|
746 |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
747 divemenu_set_gas2b: |
3 | 748 bsf is_bailout ;=1: CC mode, but bailout active! |
681 | 749 clrf lo ; clear Setpoint, DISP_const_ppO2_value now displayes "Bail" |
0 | 750 movff lo,char_I_const_ppO2 |
751 | |
752 bcf display_set_gas ; clear flag | |
753 movff menupos,active_gas ; copy into active gas register | |
754 decf menupos,W ; # of selected gas (0-4) | |
755 mullw d'4' ; times 4... | |
756 movf PRODL,W ; | |
757 addlw d'7' ; +7 = address for He ratio | |
758 movwf EEADR | |
759 call read_eeprom ; Read He ratio | |
760 movff EEDATA,char_I_He_ratio ; And copy into hold register | |
761 | |
762 decf menupos,W ; # of selected gas (0-4) | |
763 mullw d'4' ; times 4... | |
764 movf PRODL,W ; | |
765 addlw d'6' ; +6 = address for O2 ratio | |
766 movwf EEADR | |
767 call read_eeprom ; Read O2 ratio | |
768 movff EEDATA, char_I_O2_ratio ; O2 ratio | |
769 movff char_I_He_ratio, wait_temp ; copy into bank1 register | |
770 bsf STATUS,C ; | |
771 movlw d'100' ; 100% | |
772 subfwb wait_temp,W ; minus He | |
773 subfwb EEDATA,F ; minus O2 | |
774 movff EEDATA, char_I_N2_ratio ; = N2! | |
775 bsf stored_gas_changed ; set event flag | |
776 bsf event_occured ; set global event flag | |
665
259e4c1bf3c2
grey-out TTS and ceiling after gas change (until new plan is ready)
heinrichsweikamp
parents:
663
diff
changeset
|
777 bsf decoplan_invalid ; The decoplan needs to updated |
663
64194a3c8d5b
Restart building decoplan after gas change
heinrichsweikamp
parents:
647
diff
changeset
|
778 clrf WREG |
64194a3c8d5b
Restart building decoplan after gas change
heinrichsweikamp
parents:
647
diff
changeset
|
779 movff WREG,char_O_deco_status ; Restart decoplan computation mH |
353
b5b030c1ae7e
Avoid spurious switch-depth stops with 3 or more gas.
JeanDo
parents:
337
diff
changeset
|
780 |
b5b030c1ae7e
Avoid spurious switch-depth stops with 3 or more gas.
JeanDo
parents:
337
diff
changeset
|
781 movff menupos,char_I_current_gas ; Inform deco code too. |
0 | 782 bra timeout_divemenu2 ; quit menu! |
783 | |
784 timeout_divemenu: | |
785 btfss menubit ; is the Dive mode menu displayed? | |
786 return ; No | |
787 | |
788 btfsc display_set_simulator ; Is the Simulator Mask active? | |
789 bra timeout_divemenu6 ; Yes, update Simulator mask | |
790 | |
791 btfss display_see_deco ; Is the decoplan active? | |
792 bra timeout_divemenu1 ; No, skip updating the decoplan | |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
793 bra timeout_divemenu3 ; Yes... |
0 | 794 |
795 timeout_divemenu1: | |
796 incf timeout_counter3,F ; increase timeout_counter3 | |
797 GETCUSTOM8 d'10' ; loads timeout_divemenu into WREG | |
798 cpfsgt timeout_counter3 ; ... longer then timeout_divemenu | |
799 return ; No! | |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
800 |
0 | 801 timeout_divemenu2: ; quit divemode menu |
802 ; Restore some outputs | |
124 | 803 clrf decoplan_page ; Page 0-1 of deco list |
681 | 804 call DISP_clear_divemode_menu; Clear dive mode menu |
115 | 805 |
806 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode | |
673 | 807 bra timeout_divemenu2b ; skip! |
115 | 808 btfsc gauge_mode ; Ignore in Gauge mode |
673 | 809 bra timeout_divemenu2b ; skip! |
115 | 810 |
280 | 811 bcf menubit |
0 | 812 btfsc dekostop_active |
681 | 813 call DISP_display_deko_mask ; clear nostop time, display decodata |
0 | 814 btfss dekostop_active |
681 | 815 call DISP_display_ndl_mask ; Clear deco data, display nostop time |
0 | 816 |
674 | 817 btfsc decoplan_invalid ; The decoplan needs to updated |
673 | 818 bra timeout_divemenu2a ; Yes, skip update |
819 | |
281 | 820 btfsc dekostop_active |
681 | 821 call DISP_display_deko ; Update deco display at once |
281 | 822 btfss dekostop_active |
681 | 823 call DISP_display_ndl ; Update NDL display at once |
281 | 824 |
673 | 825 timeout_divemenu2a: |
598
f3735da18809
NEW: CF65: Show a safety stop for no-deco dives
heinrichsweikamp
parents:
576
diff
changeset
|
826 btfsc safety_stop_active |
f3735da18809
NEW: CF65: Show a safety stop for no-deco dives
heinrichsweikamp
parents:
576
diff
changeset
|
827 bcf safety_stop_active ; Clear flag to rebuild the safety stop |
f3735da18809
NEW: CF65: Show a safety stop for no-deco dives
heinrichsweikamp
parents:
576
diff
changeset
|
828 |
673 | 829 timeout_divemenu2b: |
0 | 830 bcf menubit |
831 bcf premenu ; Yes, clear flags and menu, display dive time and mask again | |
681 | 832 call DISP_active_gas_divemode; Display gas, if required |
833 call DISP_divemode_mask ; Display mask | |
834 call DISP_divemins ; Display (new) divetime! | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
835 call customview_mask ; Redraw current customview mask |
0 | 836 clrf timeout_counter3 ; Also clear timeout |
837 bcf display_see_deco ; clear all display flags | |
838 bcf display_set_gas | |
839 bcf display_set_xgas | |
840 bcf display_set_setpoint | |
841 bcf display_set_simulator | |
219
b6dd54b3567c
NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
heinrichsweikamp
parents:
169
diff
changeset
|
842 bcf display_set_active |
647 | 843 bcf display_set_diluent |
286 | 844 bcf menu3_active |
576 | 845 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! |
0 | 846 return |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
847 |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
848 ; Re-Draw current page of decoplan (may have more stops) |
0 | 849 timeout_divemenu3: |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
850 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
|
851 iorwf WREG ; Is it zero ? |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
852 btfsc STATUS,Z |
681 | 853 call DISP_decoplan ; Yes: new data available. |
0 | 854 bra timeout_divemenu1 ; Check timeout |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
855 |
0 | 856 timeout_divemenu6: |
857 ; Update Simulator Mask | |
286 | 858 bsf menu3_active ; So "+1" is accessible at all times |
681 | 859 call DISP_divemode_simulator_mask; Show mask |
860 call DISP_divemenu_cursor ; update cursor | |
0 | 861 bra timeout_divemenu1 ; Check timeout |