Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/menu_ppO2.asm @ 691:dc28ba4601ee
italian update
author | heinrichsweikamp |
---|---|
date | Thu, 31 Jan 2013 09:39:14 +0100 |
parents | aebb6d039249 |
children | 91ae251d379f |
rev | line source |
---|---|
0 | 1 |
2 ; OSTC - diving computer code | |
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR | |
4 | |
5 ; This program is free software: you can redistribute it and/or modify | |
6 ; it under the terms of the GNU General Public License as published by | |
7 ; the Free Software Foundation, either version 3 of the License, or | |
8 ; (at your option) any later version. | |
9 | |
10 ; This program is distributed in the hope that it will be useful, | |
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 ; GNU General Public License for more details. | |
14 | |
15 ; You should have received a copy of the GNU General Public License | |
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | |
18 | |
19 ; Constant ppO2 Setup menu | |
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
21 ; written: 08/04/04 | |
639 | 22 ; last updated: 120920 |
0 | 23 ; known bugs: |
24 ; ToDo: | |
639 | 25 ; |
647 | 26 ; New in 2.52 Diluents stored seperately in EEPROM Bank0 |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
27 ;Byte96-97: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
28 ;Diluent 1 Default (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
29 ;Byte98-99: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
30 ;Diluent 1 Current (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
31 ;Byte100-101: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
32 ;Diluent 2 Default (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
33 ;Byte102-103: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
34 ;Diluent 2 Current (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
35 ;Byte104-105: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
36 ;Diluent 3 Default (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
37 ;Byte106-107: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
38 ;Diluent 3 Current (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
39 ;Byte108-109: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
40 ;Diluent 4 Default (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
41 ;Byte110-111: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
42 ;Diluent 4 Current (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
43 ;Byte112-113: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
44 ;Diluent 5 Default (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
45 ;Byte114-115: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
46 ;Diluent 5 Current (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
47 ;Byte116: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
48 ;First Diluent (1-5) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
49 |
647 | 50 ; EEPROM BANK0 Byte96-97: |
639 | 51 ; Diluent 1 (%O2,%He) |
647 | 52 ; EEPROM BANK0 Byte98-99: |
639 | 53 ; Diluent 2 (%O2,%He) |
647 | 54 ; EEPROM BANK0 Byte100-101: |
639 | 55 ; Diluent 3 (%O2,%He) |
647 | 56 ; EEPROM BANK0 Byte102-103: |
639 | 57 ; Diluent 4 (%O2,%He) |
647 | 58 ; EEPROM BANK0 Byte104-105: |
639 | 59 ; Diluent 5 (%O2,%He) |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
60 ; EEPROM BANK0 Byte106: |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
61 ; First Diluent (1-5) |
639 | 62 |
0 | 63 |
64 menu_const_ppO2: | |
65 movlw d'1' | |
66 movwf menupos | |
639 | 67 menu_const_ppO2_return: |
681 | 68 call DISP_ClearScreen |
69 call DISP_ccr_setup_menu_mask | |
639 | 70 call refresh_cursor |
71 call menu_pre_loop_common | |
72 | |
73 menu_const_ppO2_preloop: | |
74 call check_switches_menu | |
75 movlw d'3' | |
76 cpfseq menupos | |
77 bra menu_const_ppO2_preloop2 ; Returns | |
78 movlw d'6' | |
79 movwf menupos | |
681 | 80 call DISP_menu_cursor |
639 | 81 |
82 menu_const_ppO2_preloop2: | |
83 btfsc menubit2 | |
84 bra do_ccr_pre_menu ; call submenu | |
85 btfss menubit | |
86 goto restart ; exit menu, restart | |
87 btfsc onesecupdate | |
88 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag | |
89 bcf onesecupdate ; End of one second tasks | |
90 btfsc sleepmode | |
91 goto restart | |
92 bra menu_const_ppO2_preloop | |
93 | |
94 do_ccr_pre_menu: | |
95 dcfsnz menupos,F | |
96 goto menu_diluentsetup | |
97 dcfsnz menupos,F | |
98 goto menu_const_ppO2_setpoints | |
99 dcfsnz menupos,F | |
100 goto exit_menu_const_ppO2 ; exit... | |
101 dcfsnz menupos,F | |
102 goto exit_menu_const_ppO2 ; exit... | |
103 dcfsnz menupos,F | |
104 goto exit_menu_const_ppO2 ; exit... | |
105 exit_menu_const_ppO2: ; exit... | |
106 movlw d'2' | |
107 movwf menupos | |
108 goto more_menu2 | |
109 | |
110 menu_diluentsetup: | |
111 movlw d'1' | |
112 movwf menupos | |
113 | |
114 menu_diluentsetup_prelist: | |
681 | 115 call DISP_ClearScreen |
639 | 116 call menu_pre_loop_common ; Clear some menu flags, timeout and switches |
681 | 117 call DISP_topline_box |
639 | 118 WIN_INVERT .1 ; Init new Wordprocessor |
642 | 119 DISPLAYTEXT .231 ; Dil. Setup - Gaslist |
639 | 120 WIN_INVERT .0 ; Init new Wordprocessor |
121 clrf decodata+0 ; Here: # of gas 0-4 | |
122 clrf divemins+0 ; Here: # of Gas * 4 | |
123 movlw d'5' | |
124 movwf waitms_temp ; here: stores row for gas list | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
125 movlw d'93' |
639 | 126 movwf wait_temp ; here: stores eeprom address for gas list |
127 | |
128 menu_diluentsetup_list: | |
129 WIN_LEFT .20 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
130 movlw d'4' |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
131 addwf wait_temp,F ; Increase eeprom address for diluent list |
639 | 132 movlw d'30' |
133 addwf waitms_temp,F ; Increase row | |
134 movf waitms_temp,W ; Load row into WREG | |
135 movff WREG,win_top | |
136 lfsr FSR2,letter | |
640 | 137 PUTC TXT_DIL_C |
639 | 138 movff decodata+0,lo |
139 incf lo,F | |
140 bsf leftbind | |
141 output_99 | |
142 PUTC ':' | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
143 call word_processor |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
144 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
145 WIN_LEFT .40 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
146 movf waitms_temp,W ; Load row into WREG |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
147 movff WREG,win_top |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
148 lfsr FSR2,letter |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
149 |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
150 movlw d'116' |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
151 movwf EEADR |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
152 call read_eeprom ; Get current startgas 1-5 # into EEDATA |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
153 decf EEDATA,W ; 0-4 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
154 cpfseq decodata+0 ; =current displayed gas #? |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
155 bra menu_diluentsetup_Tx; no, do not display * |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
156 PUTC '*' ; display * |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
157 call word_processor |
639 | 158 |
159 menu_diluentsetup_Tx: | |
160 WIN_LEFT .48 | |
161 movf waitms_temp,W ; Load row into WREG | |
162 movff WREG,win_top | |
163 lfsr FSR2,letter | |
164 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
165 movff wait_temp, EEADR ; Gas %He - Set address in internal EEPROM |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
166 incf EEADR,F ; Gas %He - Set address in internal EEPROM |
639 | 167 call read_eeprom ; Read He value from EEPROM |
168 movff EEDATA,lo ; Move EEDATA -> lo | |
169 movf lo,f ; Move lo -> f | |
170 movlw d'0' ; Move 0 -> WREG | |
171 cpfsgt lo ; He > 0? | |
172 bra menu_diluentsetup_Nx ; NO check o2 | |
173 | |
174 ; YES Write TX 15/55 | |
642 | 175 STRCAT TXT_TX3 |
639 | 176 movff wait_temp, EEADR ; Gas %O2 - Set address in internal EEPROM |
177 call read_eeprom ; O2 value | |
178 movff EEDATA,lo | |
179 output_8 | |
180 PUTC '/' | |
181 incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM | |
182 call read_eeprom ; He value | |
183 movff EEDATA,lo | |
184 output_8 | |
185 bra menu_diluentsetup_list0 | |
186 | |
187 ; New v1.44se | |
188 menu_diluentsetup_Nx: | |
189 movff wait_temp, EEADR ; Gas %O2 - Set address in internal EEPROM | |
190 call read_eeprom ; Read O2 value from EEPROM | |
191 movff EEDATA,lo ; Move EEDATA -> lo | |
192 movf lo,f ; Move lo -> f | |
193 movlw d'21' ; Move 21 -> WREG | |
194 cpfsgt lo ; o2 > 21% | |
195 bra menu_diluentsetup_Air ; NO AIR | |
196 movlw d'100' ; Move 100 -> WREG | |
197 cpfslt lo ; o2 < 100% | |
198 bra menu_diluentsetup_O2 ; NO write O2 | |
199 | |
200 ; YES Write NX 32 | |
642 | 201 STRCAT TXT_NX3 |
639 | 202 output_8 |
203 bra menu_diluentsetup_list0 | |
204 | |
205 menu_diluentsetup_O2: | |
206 STRCAT TXT_O2_3 | |
207 output_8 | |
208 bra menu_diluentsetup_list0 | |
209 | |
210 menu_diluentsetup_Air: | |
211 cpfseq lo ; o2 = 21% | |
642 | 212 bra menu_diluentsetup_Err |
639 | 213 |
214 STRCAT TXT_AIR4 | |
215 output_8 | |
216 bra menu_diluentsetup_list0 | |
217 | |
218 menu_diluentsetup_Err: | |
219 STRCAT TXT_ERR4 | |
220 output_8 | |
221 | |
222 menu_diluentsetup_list0: | |
223 call word_processor | |
224 | |
225 incf decodata+0,F | |
226 movlw d'5' | |
227 cpfseq decodata+0 | |
228 goto menu_diluentsetup_list | |
229 | |
230 DISPLAYTEXT .11 ; Exit | |
231 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
681 | 232 call DISP_menu_cursor |
639 | 233 |
234 menu_diluentsetup_loop: | |
235 call check_switches_logbook | |
236 | |
237 btfsc menubit3 | |
238 bra menu_diluentsetup_list2 ; move cursor | |
239 | |
240 btfsc menubit2 | |
241 bra do_diluentsetup_list ; call gas-specific submenu | |
242 | |
243 btfsc onesecupdate | |
244 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag | |
245 | |
246 bcf onesecupdate ; 1 sec. functions done | |
247 | |
248 btfsc sleepmode | |
249 bra menu_const_ppO2 | |
250 | |
251 bra menu_diluentsetup_loop | |
252 | |
253 menu_diluentsetup_list2: | |
254 incf menupos,F | |
255 movlw d'7' | |
256 cpfseq menupos ; =7? | |
257 bra menu_diluentsetup_list3 ; No | |
258 movlw d'1' | |
259 movwf menupos | |
260 | |
261 menu_diluentsetup_list3: | |
262 clrf timeout_counter2 | |
681 | 263 call DISP_menu_cursor |
639 | 264 |
265 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
266 | |
267 bcf menubit3 ; clear flag | |
268 bra menu_diluentsetup_loop | |
269 | |
270 | |
271 do_diluentsetup_list: | |
272 dcfsnz menupos,F | |
273 bra diluent_list_edit_gas1 | |
274 dcfsnz menupos,F | |
642 | 275 bra diluent_list_edit_gas2 |
639 | 276 dcfsnz menupos,F |
642 | 277 bra diluent_list_edit_gas3 |
639 | 278 dcfsnz menupos,F |
642 | 279 bra diluent_list_edit_gas4 |
639 | 280 dcfsnz menupos,F |
642 | 281 bra diluent_list_edit_gas5 |
639 | 282 bra menu_const_ppO2 ; Exit List |
283 | |
284 diluent_list_edit_gas1: | |
642 | 285 movlw d'0' ; Diluent Number 0-4 |
286 movwf decodata+0 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
287 movlw d'91' ; EEPROM address of %O2 |
642 | 288 movwf divemins+0 |
289 bra menu_diluentgas | |
639 | 290 diluent_list_edit_gas2: |
642 | 291 movlw d'1' ; Diluent Number 0-4 |
292 movwf decodata+0 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
293 movlw d'95' ; EEPROM address of %O2 |
642 | 294 movwf divemins+0 |
295 bra menu_diluentgas | |
639 | 296 diluent_list_edit_gas3: |
642 | 297 movlw d'2' ; Diluent Number 0-4 |
298 movwf decodata+0 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
299 movlw d'99' ; EEPROM address of %O2 |
642 | 300 movwf divemins+0 |
301 bra menu_diluentgas | |
639 | 302 diluent_list_edit_gas4: |
642 | 303 movlw d'3' ; Diluent Number 0-4 |
304 movwf decodata+0 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
305 movlw d'103' ; EEPROM address of %O2 |
642 | 306 movwf divemins+0 |
307 bra menu_diluentgas | |
639 | 308 diluent_list_edit_gas5: |
642 | 309 movlw d'4' ; Diluent Number 0-4 |
310 movwf decodata+0 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
311 movlw d'107' ; EEPROM address of %O2 |
642 | 312 movwf divemins+0 |
313 ; bra menu_diluentgas | |
314 menu_diluentgas: | |
315 movlw d'1' | |
316 movwf menupos | |
317 bcf menubit4 | |
318 bcf first_FA ; Here: =1: -, =0: + | |
319 | |
320 menu_diluentgas0: | |
681 | 321 call DISP_ClearScreen |
642 | 322 WIN_LEFT .20 |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
323 WIN_TOP .185 |
642 | 324 lfsr FSR2, letter |
325 OUTPUTTEXT .11 ; Exit | |
326 STRCAT_PRINT "" | |
327 | |
328 menu_diluentgas1: | |
329 call menu_pre_loop_common ; Clear some menu flags, timeout and switches | |
330 call diluent_title_bar2 ; Displays the title bar with the current Gas info | |
331 | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
332 WIN_TOP .35 |
642 | 333 WIN_LEFT .20 |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
334 lfsr FSR2,letter |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
335 OUTPUTTEXT .88 ; First Gas? |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
336 PUTC ' ' |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
337 |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
338 movlw d'116' |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
339 movwf EEADR |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
340 call read_eeprom ; Get current startgas 1-5 # into EEDATA |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
341 decf EEDATA,W ; 0-4 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
342 cpfseq decodata+0 ; =current displayed gas #? |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
343 bra menu_firstdil0 ; no, display three spaces |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
344 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
345 OUTPUTTEXT .96 ; Yes |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
346 bsf second_FA ; Is first gas |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
347 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
348 bra menu_firstdil1 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
349 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
350 menu_firstdil0: |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
351 bcf second_FA ; Is not first gas |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
352 STRCAT " " ; 3 spaces. |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
353 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
354 menu_firstdil1: |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
355 call word_processor |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
356 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
357 WIN_LEFT .20 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
358 WIN_TOP .65 |
642 | 359 STRCPY TXT_O2_4 |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
360 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
361 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
362 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
363 movwf EEADR |
642 | 364 call read_eeprom ; O2 value |
365 movff EEDATA,lo | |
366 output_8 | |
367 STRCAT_PRINT "% " | |
368 | |
369 ; Show MOD in m | |
370 WIN_LEFT .90 | |
371 lfsr FSR2, letter | |
372 OUTPUTTEXTH .297 ; MOD: | |
373 | |
374 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG | |
375 mullw d'10' | |
376 movff PRODL,xA+0 | |
377 movff PRODH,xA+1 ; ppO2 in [0.01bar] * 10 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
378 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
379 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
380 movwf EEADR |
642 | 381 call read_eeprom ; O2 value |
382 movff EEDATA,xB+0 | |
383 clrf xB+1 | |
384 call div16x16 ; xA/xB=xC with xA as remainder | |
385 movlw d'10' | |
386 subwf xC+0,F ; Subtract 10m... | |
387 movff xC+0,lo | |
388 movlw d'0' | |
389 subwfb xC+1,F | |
390 movff xC+1,hi | |
391 | |
392 output_16 | |
393 STRCAT_PRINT TXT_METER3 | |
394 | |
395 WIN_LEFT .20 | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
396 WIN_TOP .95 |
642 | 397 STRCPY TXT_HE4 |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
398 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
399 addlw 0x07 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
400 movwf EEADR |
642 | 401 call read_eeprom ; He value |
402 movff EEDATA,lo | |
403 output_8 | |
404 STRCAT_PRINT "% " | |
405 | |
406 ; Show END in m | |
407 lfsr FSR2, letter | |
408 WIN_LEFT .90 | |
409 OUTPUTTEXTH .298 ; END: | |
410 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG | |
411 mullw d'10' | |
412 movff PRODL,xA+0 | |
413 movff PRODH,xA+1 ; ppO2 in [0.01bar] * 10 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
414 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
415 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
416 movwf EEADR |
642 | 417 call read_eeprom ; O2 value |
418 movff EEDATA,xB+0 | |
419 clrf xB+1 | |
420 call div16x16 ; xA/xB=xC with xA as remainder | |
421 movlw d'10' | |
422 subwf xC+0,F ; Subtract 10m... | |
423 movff xC+0,lo | |
424 movlw d'0' | |
425 subwfb xC+1,F | |
426 movff xC+1,hi ; lo:hi holding MOD in meters | |
427 movlw d'10' | |
428 addwf lo,F | |
429 movlw d'0' | |
430 addwfc hi,F ; lo:hi holding MOD+10m | |
431 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
432 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
433 addlw 0x07 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
434 movwf EEADR |
642 | 435 call read_eeprom ; He value in % -> EEDATA |
436 movlw d'100' | |
437 movwf xA+0 | |
438 movf EEDATA,W ; He value in % -> EEDATA | |
439 subwf xA+0,F ; xA+0 = 100 - He Value in % | |
440 clrf xA+1 | |
441 movff lo,xB+0 | |
442 movff hi,xB+1 ; Copy MOD+10 | |
443 call mult16x16 ; xA*xB=xC | |
444 movff xC+0,xA+0 | |
445 movff xC+1,xA+1 | |
446 movlw d'100' | |
447 movwf xB+0 | |
448 clrf xB+1 | |
449 call div16x16 ; xA/xB=xC with xA as remainder | |
450 ; xC:2 = ((MOD+10) * 100 - HE Value in %) / 100 | |
451 movlw d'10' | |
452 subwf xC+0,F ; Subtract 10m... | |
453 movff xC+0,lo | |
454 movlw d'0' | |
455 subwfb xC+1,F | |
456 movff xC+1,hi | |
457 output_16 | |
458 STRCAT_PRINT TXT_METER3 | |
459 | |
460 WIN_LEFT .20 | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
461 WIN_TOP .125 |
642 | 462 STRCPY "+/-: " |
463 movlw '+' | |
464 btfsc first_FA | |
465 movlw '-' | |
466 movwf POSTINC2 | |
467 call word_processor | |
468 | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
469 WIN_TOP .155 |
642 | 470 lfsr FSR2,letter |
471 OUTPUTTEXT .89 ; Default: | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
472 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
473 addlw 0x04 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
474 movwf EEADR |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
475 call read_eeprom ; Default O2 value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
476 movff EEDATA,lo |
642 | 477 output_8 |
478 PUTC '/' | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
479 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
480 addlw 0x05 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
481 movwf EEADR |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
482 call read_eeprom ; Default He value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
483 movff EEDATA,lo |
642 | 484 output_8 |
485 STRCAT_PRINT " " | |
486 | |
487 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
681 | 488 call DISP_menu_cursor |
642 | 489 |
490 diluentgassetup_loop: | |
491 call check_switches_logbook | |
492 | |
493 btfsc menubit3 | |
494 bra diluentgassetup2 ; move cursor | |
495 | |
496 btfsc menubit2 | |
497 bra do_diluentgassetup ; call submenu | |
498 | |
499 btfsc onesecupdate | |
500 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag | |
501 | |
502 bcf onesecupdate ; 1 sec. functions done | |
503 | |
504 btfsc sleepmode | |
505 bra exit_menu_const_ppO2 | |
506 | |
507 bra diluentgassetup_loop | |
508 | |
509 diluentgassetup2: | |
510 incf menupos,F | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
511 movlw d'7' |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
512 cpfseq menupos ; =7? |
642 | 513 bra diluentgassetup3 ; No |
514 movlw d'1' | |
515 movwf menupos | |
516 | |
517 diluentgassetup3: | |
518 clrf timeout_counter2 | |
681 | 519 call DISP_menu_cursor |
642 | 520 |
521 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
522 | |
523 bcf menubit3 ; clear flag | |
524 bra diluentgassetup_loop | |
525 | |
526 do_diluentgassetup: | |
527 dcfsnz menupos,F | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
528 bra make_first_diluent |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
529 dcfsnz menupos,F |
642 | 530 bra adjust_o2_diluent |
531 dcfsnz menupos,F | |
532 bra adjust_he_diluent | |
533 dcfsnz menupos,F | |
534 bra toggle_plus_minus_diluentsetup | |
535 dcfsnz menupos,F | |
536 bra restore_gas_diluent | |
537 exit_diluentgassetup: ; exit... | |
538 movff decodata+0,menupos | |
539 incf menupos,F | |
540 bra menu_diluentsetup_prelist | |
541 | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
542 make_first_diluent: |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
543 movff decodata+0,EEDATA ; current gas (0-4) into EEDATA |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
544 incf EEDATA,F ; current gas (1-5) into EEDATA |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
545 movlw d'116' |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
546 movwf EEADR |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
547 call write_eeprom ; store in internal EEPROM |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
548 movlw d'1' |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
549 movwf menupos |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
550 bra menu_diluentgas1 ; return |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
551 |
642 | 552 toggle_plus_minus_diluentsetup: |
553 btg first_FA | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
554 movlw d'4' |
642 | 555 movwf menupos |
556 bra menu_diluentgas1 ; return | |
557 | |
558 adjust_o2_diluent: | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
559 movf divemins+0,W ; read current value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
560 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
561 movwf EEADR |
642 | 562 call read_eeprom ; Low-value |
563 movff EEDATA,lo | |
564 | |
565 btfsc first_FA ; Minus? | |
566 bra adjust_o2_1_diluent ; yes, minus! | |
567 | |
568 incf lo,F ; increase O2 | |
569 movlw d'101' | |
570 cpfseq lo | |
571 bra adjust_o2_2_diluent | |
572 movlw d'4' ; LOWER O2 Limit | |
573 movwf lo | |
574 bra adjust_o2_2_diluent | |
575 | |
576 adjust_o2_1_diluent: | |
577 decf lo,F ; decrease O2 | |
578 movlw d'3' | |
579 cpfseq lo | |
580 bra adjust_o2_2_diluent | |
581 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
582 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
583 addlw 0x07 |
642 | 584 movwf EEADR |
585 call read_eeprom ; read He value | |
586 | |
587 movlw d'100' | |
588 movwf lo | |
589 movf EEDATA,W ; He value | |
590 subwf lo,F ; lo=100% - He% | |
591 | |
592 adjust_o2_2_diluent: ; test if O2+He>100... | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
593 addlw 0x07 |
642 | 594 movwf EEADR |
595 call read_eeprom ; read He value | |
596 movf EEDATA,W ; He value | |
597 addwf lo,W ; add O2 value | |
598 movwf hi ; store in temp | |
599 movlw d'101' | |
600 cpfseq hi ; O2 and He > 100? | |
601 bra adjust_o2_3_diluent ; No! | |
602 | |
603 movlw d'4' ; LOWER O2 Limit | |
604 movwf lo | |
605 | |
606 adjust_o2_3_diluent: | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
607 movf divemins+0,W ; save current value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
608 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
609 movwf EEADR |
642 | 610 movff lo,EEDATA |
611 call write_eeprom ; Low-value | |
612 | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
613 movlw d'2' |
642 | 614 movwf menupos |
615 bra menu_diluentgas1 ; return | |
616 | |
617 adjust_he_diluent: | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
618 movf divemins+0,W ; read current value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
619 addlw 0x07 |
652 | 620 movwf EEADR ; read current value (He) |
642 | 621 call read_eeprom ; Low-value |
622 movff EEDATA,lo | |
623 | |
624 btfsc first_FA ; Minus? | |
625 bra adjust_he_1_diluent ; yes, minus! | |
626 | |
627 incf lo,F | |
652 | 628 movlw d'99' ; He limited to (useless) 99% |
642 | 629 cpfseq lo |
630 bra adjust_he_2_diluent | |
631 clrf lo | |
632 bra adjust_he_2_diluent | |
633 | |
634 adjust_he_1_diluent: | |
635 decf lo,F ; decrease He | |
636 movlw d'255' | |
637 cpfseq lo | |
638 bra adjust_he_2_diluent | |
652 | 639 clrf lo ; limit to zero |
642 | 640 |
652 | 641 adjust_he_2_diluent: ; test if O2+He>100... |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
642 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
643 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
644 movwf EEADR |
652 | 645 call read_eeprom ; Low-value |
646 movf EEDATA,W | |
647 addwf lo,W ; add He value | |
642 | 648 movwf hi ; store in temp |
649 movlw d'101' | |
652 | 650 cpfseq hi ; O2 and He > 100? |
651 bra adjust_he_3_diluent ; No! | |
642 | 652 ; clrf lo ; Yes, clear He to zero |
653 decf lo,F ; reduce He again = unchanged after operation | |
654 | |
655 adjust_he_3_diluent: | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
656 movf divemins+0,W ; save current value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
657 addlw 0x07 |
642 | 658 movwf EEADR |
659 movff lo,EEDATA | |
652 | 660 call write_eeprom ; Low-value |
642 | 661 |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
662 movlw d'3' |
642 | 663 movwf menupos |
652 | 664 bra menu_diluentgas1; |
642 | 665 |
666 restore_gas_diluent: | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
667 movf divemins+0,W ; read Default value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
668 addlw 0x04 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
669 movwf EEADR |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
670 call read_eeprom ; Low-value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
671 movff EEDATA,lo |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
672 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
673 addlw 0x05 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
674 movwf EEADR |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
675 call read_eeprom ; High-value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
676 movff EEDATA,hi |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
677 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
678 movf divemins+0,W ; save Default value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
679 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
680 movwf EEADR |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
681 movff lo,EEDATA |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
682 call write_eeprom ; Low-value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
683 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
684 addlw 0x07 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
685 movwf EEADR |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
686 movff hi,EEDATA |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
687 call write_eeprom ; High-value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
688 |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
689 movlw d'5' |
642 | 690 movwf menupos |
691 bra menu_diluentgas1 | |
692 | |
693 | |
694 diluent_title_bar2: | |
681 | 695 call DISP_topline_box |
642 | 696 WIN_INVERT .1 ; Init new Wordprocessor |
697 WIN_TOP .2 | |
698 WIN_LEFT .30 | |
699 lfsr FSR2,letter | |
700 STRCAT TXT_DIL5 ; Dil.# | |
701 movff decodata+0,lo | |
702 incf lo,F | |
703 bsf leftbind | |
704 output_99 | |
705 STRCAT_PRINT ": " | |
706 | |
707 WIN_TOP .2 | |
708 WIN_LEFT .80 | |
709 lfsr FSR2,letter | |
710 | |
711 ;He check | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
712 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
713 addlw 0x07 |
642 | 714 movwf EEADR |
715 call read_eeprom ; He value | |
716 movff EEDATA,lo ; Move EEData -> lo | |
717 movf lo,f ; Move lo -> f | |
718 movlw d'0' ; Move 0 -> WREG | |
719 cpfsgt lo ; He > 0? | |
720 bra diluent_title_bar3 ; NO check o2 | |
721 | |
722 ; YES Write TX 15/55 | |
723 STRCAT TXT_TX3 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
724 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
725 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
726 movwf EEADR |
642 | 727 call read_eeprom ; O2 value |
728 movff EEDATA,lo | |
729 output_8 ; Write O2 | |
730 PUTC '/' | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
731 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
732 addlw 0x07 |
642 | 733 movwf EEADR |
734 call read_eeprom ; He value | |
735 movff EEDATA,lo | |
736 output_8 ; Write He | |
737 bra diluent_title_bar7 | |
738 | |
739 ; New v1.44se | |
740 diluent_title_bar3: ; O2 Check | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
741 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
742 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
743 movwf EEADR |
642 | 744 call read_eeprom ; O2 value |
745 movff EEDATA,lo | |
746 movf lo,f ; Move lo -> f | |
747 movlw d'21' ; Move 21 -> WREG | |
748 cpfseq lo ; o2 = 21 | |
749 cpfsgt lo ; o2 > 21% | |
750 bra diluent_title_bar5 ; NO AIR | |
751 movlw d'100' ; Move 100 -> WREG | |
752 cpfslt lo ; o2 < 100% | |
753 bra diluent_title_bar4 ; NO write O2 | |
754 | |
755 ; YES Write NX 32 | |
756 STRCAT TXT_NX3 | |
757 output_8 | |
758 bra diluent_title_bar7 | |
759 | |
760 ; New v1.44se | |
761 diluent_title_bar4: | |
762 STRCAT TXT_O2_3 | |
763 output_8 | |
764 bra diluent_title_bar7 | |
765 | |
766 ; New v1.44se | |
767 diluent_title_bar5: | |
768 cpfseq lo ; o2 = 21% | |
769 bra diluent_title_bar6 | |
770 | |
771 STRCAT TXT_AIR4 | |
772 output_8 | |
773 bra diluent_title_bar7 | |
774 | |
775 ; New v1.44se | |
776 diluent_title_bar6: ; ERROR | |
777 STRCAT TXT_ERR4 | |
778 output_8 | |
779 ;bra diluent_title_bar7 | |
780 | |
781 diluent_title_bar7: | |
782 STRCAT_PRINT "" | |
783 WIN_INVERT .0 ; Init new Wordprocessor | |
784 return | |
785 | |
639 | 786 |
787 ; *** | |
788 | |
789 | |
790 | |
791 | |
792 | |
793 | |
794 | |
795 menu_const_ppO2_setpoints: ; Setpoint menu | |
796 movlw d'1' | |
797 movwf menupos | |
0 | 798 |
799 bcf menubit4 | |
800 clrf decodata+0 ; Here: # of SP | |
801 bcf first_FA ; Here: =1: -, =0: + | |
802 bcf second_FA ; Here: =1: 1, =0: 10 steps | |
803 | |
804 menu_const_ppO20: | |
681 | 805 call DISP_ClearScreen |
806 call DISP_topline_box | |
0 | 807 |
808 WIN_INVERT .1 ; Init new Wordprocessor | |
809 DISPLAYTEXT .111 ; Constant ppO2 Setup | |
810 WIN_INVERT .0 ; Init new Wordprocessor | |
811 | |
812 | |
813 menu_const_ppO21: | |
814 WIN_LEFT .20 | |
815 WIN_TOP .35 | |
816 lfsr FSR2,letter | |
817 OUTPUTTEXT .112 ; SP# | |
818 movff decodata+0,lo | |
819 incf lo,F | |
820 bsf leftbind | |
821 output_99 | |
123 | 822 STRCAT " (" |
0 | 823 |
824 OUTPUTTEXT d'192' ; Dil. | |
123 | 825 PUTC ' ' |
0 | 826 |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
827 rcall get_first_diluent ; Read first diluent into lo(O2) and hi(He) |
0 | 828 bsf leftbind |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
829 output_99 ; O2 |
123 | 830 PUTC '/' |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
831 movff hi,lo |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
832 output_99 ; He |
123 | 833 STRCAT_PRINT ")" |
0 | 834 |
835 WIN_LEFT .20 | |
836 WIN_TOP .65 | |
837 | |
838 lfsr FSR2,letter | |
839 OUTPUTTEXT .97 ; "Current: " | |
840 movf decodata+0,W | |
841 addlw d'36' ; offset in eeprom | |
842 movwf EEADR | |
843 call read_eeprom ; ppO2 value | |
844 movff EEDATA,lo | |
845 clrf hi | |
846 bsf leftbind | |
847 output_16dp d'3' | |
848 bcf leftbind | |
445 | 849 STRCAT_PRINT TXT_BAR4 |
0 | 850 |
851 WIN_LEFT .20 | |
852 WIN_TOP .95 | |
853 | |
854 lfsr FSR2,letter | |
855 OUTPUTTEXT d'190' ; ppO2 + | |
856 call word_processor | |
857 | |
858 WIN_LEFT .20 | |
859 WIN_TOP .125 | |
860 | |
861 lfsr FSR2,letter | |
862 OUTPUTTEXT d'191' ; ppO2 - | |
863 call word_processor | |
864 | |
865 WIN_LEFT .20 | |
866 WIN_TOP .155 | |
867 | |
868 lfsr FSR2,letter | |
869 OUTPUTTEXT .89 ; "Default: " | |
123 | 870 STRCAT_PRINT "1.00" |
0 | 871 |
872 DISPLAYTEXT .11 ; Exit | |
873 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
576 | 874 call menu_pre_loop_common ; Clear some menu flags, timeout and switches |
681 | 875 call DISP_menu_cursor |
0 | 876 |
877 menu_const_ppO2_loop: | |
878 call check_switches_logbook | |
879 | |
880 btfsc menubit3 | |
575 | 881 bra menu_const_ppO22 ; move cursor |
0 | 882 |
883 btfsc menubit2 | |
575 | 884 bra do_menu_const_ppO2 ; call submenu |
0 | 885 |
886 btfsc onesecupdate | |
575 | 887 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag |
0 | 888 |
889 bcf onesecupdate ; 1 sec. functions done | |
890 | |
891 btfsc sleepmode | |
575 | 892 bra exit_menu_const_ppO2 |
0 | 893 |
575 | 894 bra menu_const_ppO2_loop |
0 | 895 |
896 menu_const_ppO22: | |
897 incf menupos,F | |
898 | |
899 movlw d'2' | |
900 cpfseq menupos ; =2? | |
901 bra menu_const_ppO22a ; No | |
902 incf menupos,F ; Skip pos. 2 | |
903 | |
904 menu_const_ppO22a: | |
905 movlw d'7' | |
906 cpfseq menupos ; =7? | |
907 bra menu_const_ppO23 ; No | |
908 movlw d'1' | |
909 movwf menupos | |
910 | |
911 menu_const_ppO23: | |
576 | 912 call menu_pre_loop_common ; Clear some menu flags, timeout and switches |
681 | 913 call DISP_menu_cursor |
0 | 914 bra menu_const_ppO2_loop |
915 | |
916 do_menu_const_ppO2: | |
917 dcfsnz menupos,F | |
918 bra next_ppO2 | |
919 dcfsnz menupos,F | |
920 bra change_ppo2_plus | |
921 dcfsnz menupos,F | |
922 bra change_ppo2_plus | |
923 dcfsnz menupos,F | |
924 bra change_ppo2_minus | |
925 dcfsnz menupos,F | |
926 bra change_ppo2_reset | |
927 movlw d'2' | |
928 movwf menupos | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
929 goto menu_const_ppO2_return |
0 | 930 |
931 change_ppo2_plus: | |
932 movf decodata+0,W ; read current value | |
933 addlw d'36' ; offset in memory | |
934 movwf EEADR | |
935 call read_eeprom ; Low-value | |
936 movff EEDATA,lo | |
937 | |
938 incf lo,F ; increase depth | |
939 movlw d'251' | |
940 cpfseq lo | |
941 bra change_ppo2_plus2 | |
942 movlw d'250' | |
943 movwf lo | |
944 change_ppo2_plus2: | |
945 movff lo,EEDATA ; write result | |
946 call write_eeprom ; save result in EEPROM | |
947 movlw d'3' | |
948 movwf menupos | |
949 bra menu_const_ppO21 | |
950 | |
951 change_ppo2_minus: | |
952 movf decodata+0,W ; read current value | |
953 addlw d'36' ; offset in memory | |
954 movwf EEADR | |
955 call read_eeprom ; Low-value | |
956 movff EEDATA,lo | |
957 | |
958 decf lo,F ; decrease depth | |
959 movlw d'255' | |
960 cpfseq lo | |
961 bra change_ppo2_minus2 | |
962 movlw d'0' | |
963 movwf lo | |
964 | |
965 change_ppo2_minus2: | |
966 movff lo,EEDATA ; write result | |
967 call write_eeprom ; save result in EEPROM | |
968 | |
969 movlw d'4' | |
970 movwf menupos | |
576 | 971 bra menu_const_ppO21 |
0 | 972 |
973 change_ppo2_reset: ; reset to 1.00Bar | |
974 movf decodata+0,W ; read current value | |
975 addlw d'36' ; offset in memory | |
976 movwf EEADR | |
977 movlw d'100' | |
978 movwf EEDATA | |
979 call write_eeprom ; save result in EEPROM | |
980 movlw d'5' | |
981 movwf menupos | |
982 bra menu_const_ppO21 | |
983 | |
984 next_ppO2: | |
985 incf decodata+0,F | |
986 movlw d'3' | |
987 cpfseq decodata+0 ; =3? | |
988 bra next_ppO22 | |
989 clrf decodata+0 ; yes, so reset to zero | |
990 next_ppO22: | |
991 movlw d'1' | |
992 movwf menupos | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
993 bra menu_const_ppO21 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
994 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
995 get_first_diluent: ; Read first diluent into lo(O2) and hi(He) |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
996 read_int_eeprom d'116' ; Read First Diluent (1-5) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
997 movf EEDATA,W ; WREG: 0-4 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
998 mullw .4 ; PRODL: 0-16 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
999 movlw .93 ; Base address for O2 |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
1000 addwf PRODL,W |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
1001 movwf EEADR |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
1002 call read_eeprom ; Read O2 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
1003 movff EEDATA,lo |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
1004 incf EEADR,F |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
1005 call read_eeprom ; Read He |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
1006 movff EEDATA,hi |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
1007 return |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
1008 |