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