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
|
|
27 ; EEPROM BANK0 Byte96-97:
|
639
|
28 ; Diluent 1 (%O2,%He)
|
647
|
29 ; EEPROM BANK0 Byte98-99:
|
639
|
30 ; Diluent 2 (%O2,%He)
|
647
|
31 ; EEPROM BANK0 Byte100-101:
|
639
|
32 ; Diluent 3 (%O2,%He)
|
647
|
33 ; EEPROM BANK0 Byte102-103:
|
639
|
34 ; Diluent 4 (%O2,%He)
|
647
|
35 ; EEPROM BANK0 Byte104-105:
|
639
|
36 ; Diluent 5 (%O2,%He)
|
|
37
|
0
|
38
|
|
39 menu_const_ppO2:
|
|
40 movlw d'1'
|
|
41 movwf menupos
|
639
|
42 menu_const_ppO2_return:
|
|
43 call PLED_ClearScreen
|
|
44 call PLED_ccr_setup_menu_mask
|
|
45 call refresh_cursor
|
|
46 call menu_pre_loop_common
|
|
47
|
|
48 menu_const_ppO2_preloop:
|
|
49 call check_switches_menu
|
|
50 movlw d'3'
|
|
51 cpfseq menupos
|
|
52 bra menu_const_ppO2_preloop2 ; Returns
|
|
53 movlw d'6'
|
|
54 movwf menupos
|
|
55 call PLED_menu_cursor
|
|
56
|
|
57 menu_const_ppO2_preloop2:
|
|
58 btfsc menubit2
|
|
59 bra do_ccr_pre_menu ; call submenu
|
|
60 btfss menubit
|
|
61 goto restart ; exit menu, restart
|
|
62 btfsc onesecupdate
|
|
63 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag
|
|
64 bcf onesecupdate ; End of one second tasks
|
|
65 btfsc sleepmode
|
|
66 goto restart
|
|
67 bra menu_const_ppO2_preloop
|
|
68
|
|
69 do_ccr_pre_menu:
|
|
70 dcfsnz menupos,F
|
|
71 goto menu_diluentsetup
|
|
72 dcfsnz menupos,F
|
|
73 goto menu_const_ppO2_setpoints
|
|
74 dcfsnz menupos,F
|
|
75 goto exit_menu_const_ppO2 ; exit...
|
|
76 dcfsnz menupos,F
|
|
77 goto exit_menu_const_ppO2 ; exit...
|
|
78 dcfsnz menupos,F
|
|
79 goto exit_menu_const_ppO2 ; exit...
|
|
80 exit_menu_const_ppO2: ; exit...
|
|
81 movlw d'2'
|
|
82 movwf menupos
|
|
83 goto more_menu2
|
|
84
|
|
85 menu_diluentsetup:
|
|
86 movlw d'1'
|
|
87 movwf menupos
|
|
88
|
|
89 menu_diluentsetup_prelist:
|
|
90 call PLED_ClearScreen
|
|
91 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
|
|
92 call PLED_topline_box
|
|
93 WIN_INVERT .1 ; Init new Wordprocessor
|
642
|
94 DISPLAYTEXT .231 ; Dil. Setup - Gaslist
|
639
|
95 WIN_INVERT .0 ; Init new Wordprocessor
|
|
96 clrf decodata+0 ; Here: # of gas 0-4
|
|
97 clrf divemins+0 ; Here: # of Gas * 4
|
|
98 movlw d'5'
|
|
99 movwf waitms_temp ; here: stores row for gas list
|
|
100 movlw d'94'
|
|
101 movwf wait_temp ; here: stores eeprom address for gas list
|
|
102
|
|
103 menu_diluentsetup_list:
|
|
104 WIN_LEFT .20
|
|
105 movlw d'2'
|
|
106 addwf wait_temp,F ; Increase eeprom address for gas list
|
|
107 movlw d'30'
|
|
108 addwf waitms_temp,F ; Increase row
|
|
109 movf waitms_temp,W ; Load row into WREG
|
|
110 movff WREG,win_top
|
|
111 lfsr FSR2,letter
|
640
|
112 PUTC TXT_DIL_C
|
639
|
113 movff decodata+0,lo
|
|
114 incf lo,F
|
|
115 bsf leftbind
|
|
116 output_99
|
|
117 PUTC ':'
|
|
118
|
|
119 menu_diluentsetup_Tx:
|
|
120 call word_processor
|
|
121
|
|
122 WIN_LEFT .48
|
|
123 movf waitms_temp,W ; Load row into WREG
|
|
124 movff WREG,win_top
|
|
125 lfsr FSR2,letter
|
|
126
|
642
|
127 incf wait_temp, W ; Gas %O2
|
|
128 movwf EEADR ; Gas %He - Set address in internal EEPROM
|
639
|
129 call read_eeprom ; Read He value from EEPROM
|
|
130 movff EEDATA,lo ; Move EEDATA -> lo
|
|
131 movf lo,f ; Move lo -> f
|
|
132 movlw d'0' ; Move 0 -> WREG
|
|
133 cpfsgt lo ; He > 0?
|
|
134 bra menu_diluentsetup_Nx ; NO check o2
|
|
135
|
|
136 ; YES Write TX 15/55
|
642
|
137 STRCAT TXT_TX3
|
639
|
138 movff wait_temp, EEADR ; Gas %O2 - Set address in internal EEPROM
|
|
139 call read_eeprom ; O2 value
|
|
140 movff EEDATA,lo
|
|
141 output_8
|
|
142 PUTC '/'
|
|
143 incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM
|
|
144 call read_eeprom ; He value
|
|
145 movff EEDATA,lo
|
|
146 output_8
|
|
147 bra menu_diluentsetup_list0
|
|
148
|
|
149 ; New v1.44se
|
|
150 menu_diluentsetup_Nx:
|
|
151 movff wait_temp, EEADR ; Gas %O2 - Set address in internal EEPROM
|
|
152 call read_eeprom ; Read O2 value from EEPROM
|
|
153 movff EEDATA,lo ; Move EEDATA -> lo
|
|
154 movf lo,f ; Move lo -> f
|
|
155 movlw d'21' ; Move 21 -> WREG
|
|
156 cpfsgt lo ; o2 > 21%
|
|
157 bra menu_diluentsetup_Air ; NO AIR
|
|
158 movlw d'100' ; Move 100 -> WREG
|
|
159 cpfslt lo ; o2 < 100%
|
|
160 bra menu_diluentsetup_O2 ; NO write O2
|
|
161
|
|
162 ; YES Write NX 32
|
642
|
163 STRCAT TXT_NX3
|
639
|
164 output_8
|
|
165 bra menu_diluentsetup_list0
|
|
166
|
|
167 menu_diluentsetup_O2:
|
|
168 STRCAT TXT_O2_3
|
|
169 output_8
|
|
170 bra menu_diluentsetup_list0
|
|
171
|
|
172 menu_diluentsetup_Air:
|
|
173 cpfseq lo ; o2 = 21%
|
642
|
174 bra menu_diluentsetup_Err
|
639
|
175
|
|
176 STRCAT TXT_AIR4
|
|
177 output_8
|
|
178 bra menu_diluentsetup_list0
|
|
179
|
|
180 menu_diluentsetup_Err:
|
|
181 STRCAT TXT_ERR4
|
|
182 output_8
|
|
183
|
|
184 menu_diluentsetup_list0:
|
|
185 call word_processor
|
|
186
|
|
187 incf decodata+0,F
|
|
188 movlw d'5'
|
|
189 cpfseq decodata+0
|
|
190 goto menu_diluentsetup_list
|
|
191
|
|
192 DISPLAYTEXT .11 ; Exit
|
|
193 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
|
|
194 call PLED_menu_cursor
|
|
195
|
|
196 menu_diluentsetup_loop:
|
|
197 call check_switches_logbook
|
|
198
|
|
199 btfsc menubit3
|
|
200 bra menu_diluentsetup_list2 ; move cursor
|
|
201
|
|
202 btfsc menubit2
|
|
203 bra do_diluentsetup_list ; call gas-specific submenu
|
|
204
|
|
205 btfsc onesecupdate
|
|
206 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag
|
|
207
|
|
208 bcf onesecupdate ; 1 sec. functions done
|
|
209
|
|
210 btfsc sleepmode
|
|
211 bra menu_const_ppO2
|
|
212
|
|
213 bra menu_diluentsetup_loop
|
|
214
|
|
215 menu_diluentsetup_list2:
|
|
216 incf menupos,F
|
|
217 movlw d'7'
|
|
218 cpfseq menupos ; =7?
|
|
219 bra menu_diluentsetup_list3 ; No
|
|
220 movlw d'1'
|
|
221 movwf menupos
|
|
222
|
|
223 menu_diluentsetup_list3:
|
|
224 clrf timeout_counter2
|
|
225 call PLED_menu_cursor
|
|
226
|
|
227 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
|
|
228
|
|
229 bcf menubit3 ; clear flag
|
|
230 bra menu_diluentsetup_loop
|
|
231
|
|
232
|
|
233 do_diluentsetup_list:
|
|
234 dcfsnz menupos,F
|
|
235 bra diluent_list_edit_gas1
|
|
236 dcfsnz menupos,F
|
642
|
237 bra diluent_list_edit_gas2
|
639
|
238 dcfsnz menupos,F
|
642
|
239 bra diluent_list_edit_gas3
|
639
|
240 dcfsnz menupos,F
|
642
|
241 bra diluent_list_edit_gas4
|
639
|
242 dcfsnz menupos,F
|
642
|
243 bra diluent_list_edit_gas5
|
639
|
244 bra menu_const_ppO2 ; Exit List
|
|
245
|
|
246 diluent_list_edit_gas1:
|
642
|
247 movlw d'0' ; Diluent Number 0-4
|
|
248 movwf decodata+0
|
|
249 movlw d'96' ; EEPROM address of %O2
|
|
250 movwf divemins+0
|
|
251 bra menu_diluentgas
|
639
|
252 diluent_list_edit_gas2:
|
642
|
253 movlw d'1' ; Diluent Number 0-4
|
|
254 movwf decodata+0
|
|
255 movlw d'98' ; EEPROM address of %O2
|
|
256 movwf divemins+0
|
|
257 bra menu_diluentgas
|
639
|
258 diluent_list_edit_gas3:
|
642
|
259 movlw d'2' ; Diluent Number 0-4
|
|
260 movwf decodata+0
|
|
261 movlw d'100' ; EEPROM address of %O2
|
|
262 movwf divemins+0
|
|
263 bra menu_diluentgas
|
639
|
264 diluent_list_edit_gas4:
|
642
|
265 movlw d'3' ; Diluent Number 0-4
|
|
266 movwf decodata+0
|
|
267 movlw d'102' ; EEPROM address of %O2
|
|
268 movwf divemins+0
|
|
269 bra menu_diluentgas
|
639
|
270 diluent_list_edit_gas5:
|
642
|
271 movlw d'4' ; Diluent Number 0-4
|
|
272 movwf decodata+0
|
|
273 movlw d'104' ; EEPROM address of %O2
|
|
274 movwf divemins+0
|
|
275 ; bra menu_diluentgas
|
|
276 menu_diluentgas:
|
|
277 movlw d'1'
|
|
278 movwf menupos
|
|
279 bcf menubit4
|
|
280 bcf first_FA ; Here: =1: -, =0: +
|
|
281
|
|
282 menu_diluentgas0:
|
|
283 call PLED_ClearScreen
|
|
284 WIN_LEFT .20
|
|
285 WIN_TOP .155
|
|
286 lfsr FSR2, letter
|
|
287 OUTPUTTEXT .11 ; Exit
|
|
288 STRCAT_PRINT ""
|
|
289
|
|
290 menu_diluentgas1:
|
|
291 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
|
|
292
|
|
293 call diluent_title_bar2 ; Displays the title bar with the current Gas info
|
|
294
|
|
295 WIN_LEFT .20
|
|
296 WIN_TOP .35
|
|
297 STRCPY TXT_O2_4
|
|
298 movff divemins+0,EEADR
|
|
299 call read_eeprom ; O2 value
|
|
300 movff EEDATA,lo
|
|
301 output_8
|
|
302 STRCAT_PRINT "% "
|
|
303
|
|
304 ; Show MOD in m
|
|
305 WIN_LEFT .90
|
|
306 lfsr FSR2, letter
|
|
307 OUTPUTTEXTH .297 ; MOD:
|
|
308
|
|
309 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG
|
|
310 mullw d'10'
|
|
311 movff PRODL,xA+0
|
|
312 movff PRODH,xA+1 ; ppO2 in [0.01bar] * 10
|
|
313 movff divemins+0,EEADR
|
|
314 call read_eeprom ; O2 value
|
|
315 movff EEDATA,xB+0
|
|
316 clrf xB+1
|
|
317 call div16x16 ; xA/xB=xC with xA as remainder
|
|
318 movlw d'10'
|
|
319 subwf xC+0,F ; Subtract 10m...
|
|
320 movff xC+0,lo
|
|
321 movlw d'0'
|
|
322 subwfb xC+1,F
|
|
323 movff xC+1,hi
|
|
324
|
|
325 output_16
|
|
326 STRCAT_PRINT TXT_METER3
|
|
327
|
|
328 WIN_LEFT .20
|
|
329 WIN_TOP .65
|
|
330 STRCPY TXT_HE4
|
|
331 incf divemins+0,W
|
|
332 movwf EEADR
|
|
333 call read_eeprom ; He value
|
|
334 movff EEDATA,lo
|
|
335 output_8
|
|
336 STRCAT_PRINT "% "
|
|
337
|
|
338 ; Show END in m
|
|
339 lfsr FSR2, letter
|
|
340 WIN_LEFT .90
|
|
341 OUTPUTTEXTH .298 ; END:
|
|
342 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG
|
|
343 mullw d'10'
|
|
344 movff PRODL,xA+0
|
|
345 movff PRODH,xA+1 ; ppO2 in [0.01bar] * 10
|
|
346 movff divemins+0,EEADR
|
|
347 call read_eeprom ; O2 value
|
|
348 movff EEDATA,xB+0
|
|
349 clrf xB+1
|
|
350 call div16x16 ; xA/xB=xC with xA as remainder
|
|
351 movlw d'10'
|
|
352 subwf xC+0,F ; Subtract 10m...
|
|
353 movff xC+0,lo
|
|
354 movlw d'0'
|
|
355 subwfb xC+1,F
|
|
356 movff xC+1,hi ; lo:hi holding MOD in meters
|
|
357 movlw d'10'
|
|
358 addwf lo,F
|
|
359 movlw d'0'
|
|
360 addwfc hi,F ; lo:hi holding MOD+10m
|
|
361
|
|
362 incf divemins+0,W
|
|
363 movwf EEADR
|
|
364 call read_eeprom ; He value in % -> EEDATA
|
|
365 movlw d'100'
|
|
366 movwf xA+0
|
|
367 movf EEDATA,W ; He value in % -> EEDATA
|
|
368 subwf xA+0,F ; xA+0 = 100 - He Value in %
|
|
369 clrf xA+1
|
|
370 movff lo,xB+0
|
|
371 movff hi,xB+1 ; Copy MOD+10
|
|
372 call mult16x16 ; xA*xB=xC
|
|
373 movff xC+0,xA+0
|
|
374 movff xC+1,xA+1
|
|
375 movlw d'100'
|
|
376 movwf xB+0
|
|
377 clrf xB+1
|
|
378 call div16x16 ; xA/xB=xC with xA as remainder
|
|
379 ; xC:2 = ((MOD+10) * 100 - HE Value in %) / 100
|
|
380 movlw d'10'
|
|
381 subwf xC+0,F ; Subtract 10m...
|
|
382 movff xC+0,lo
|
|
383 movlw d'0'
|
|
384 subwfb xC+1,F
|
|
385 movff xC+1,hi
|
|
386 output_16
|
|
387 STRCAT_PRINT TXT_METER3
|
|
388
|
|
389 WIN_LEFT .20
|
|
390 WIN_TOP .95
|
|
391 STRCPY "+/-: "
|
|
392 movlw '+'
|
|
393 btfsc first_FA
|
|
394 movlw '-'
|
|
395 movwf POSTINC2
|
|
396 call word_processor
|
|
397
|
|
398 WIN_TOP .125
|
|
399 lfsr FSR2,letter
|
|
400 OUTPUTTEXT .89 ; Default:
|
|
401 movlw .21
|
|
402 movwf lo ; Default always Air
|
|
403 output_8
|
|
404 PUTC '/'
|
|
405 clrf lo ; Default He value
|
|
406 output_8
|
|
407 STRCAT_PRINT " "
|
|
408
|
|
409 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
|
|
410 call PLED_menu_cursor
|
|
411
|
|
412 diluentgassetup_loop:
|
|
413 call check_switches_logbook
|
|
414
|
|
415 btfsc menubit3
|
|
416 bra diluentgassetup2 ; move cursor
|
|
417
|
|
418 btfsc menubit2
|
|
419 bra do_diluentgassetup ; call submenu
|
|
420
|
|
421 btfsc onesecupdate
|
|
422 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag
|
|
423
|
|
424 bcf onesecupdate ; 1 sec. functions done
|
|
425
|
|
426 btfsc sleepmode
|
|
427 bra exit_menu_const_ppO2
|
|
428
|
|
429 bra diluentgassetup_loop
|
|
430
|
|
431 diluentgassetup2:
|
|
432 incf menupos,F
|
|
433 movlw d'6'
|
|
434 cpfseq menupos ; =6?
|
|
435 bra diluentgassetup3 ; No
|
|
436 movlw d'1'
|
|
437 movwf menupos
|
|
438
|
|
439 diluentgassetup3:
|
|
440 clrf timeout_counter2
|
|
441 call PLED_menu_cursor
|
|
442
|
|
443 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
|
|
444
|
|
445 bcf menubit3 ; clear flag
|
|
446 bra diluentgassetup_loop
|
|
447
|
|
448 do_diluentgassetup:
|
|
449 dcfsnz menupos,F
|
|
450 bra adjust_o2_diluent
|
|
451 dcfsnz menupos,F
|
|
452 bra adjust_he_diluent
|
|
453 dcfsnz menupos,F
|
|
454 bra toggle_plus_minus_diluentsetup
|
|
455 dcfsnz menupos,F
|
|
456 bra restore_gas_diluent
|
|
457 exit_diluentgassetup: ; exit...
|
|
458 movff decodata+0,menupos
|
|
459 incf menupos,F
|
|
460 bra menu_diluentsetup_prelist
|
|
461
|
|
462 toggle_plus_minus_diluentsetup:
|
|
463 btg first_FA
|
|
464 movlw d'3'
|
|
465 movwf menupos
|
|
466 bra menu_diluentgas1 ; return
|
|
467
|
|
468 adjust_o2_diluent:
|
|
469 movff divemins+0,EEADR ; read current value
|
|
470 call read_eeprom ; Low-value
|
|
471 movff EEDATA,lo
|
|
472
|
|
473 btfsc first_FA ; Minus?
|
|
474 bra adjust_o2_1_diluent ; yes, minus!
|
|
475
|
|
476 incf lo,F ; increase O2
|
|
477 movlw d'101'
|
|
478 cpfseq lo
|
|
479 bra adjust_o2_2_diluent
|
|
480 movlw d'4' ; LOWER O2 Limit
|
|
481 movwf lo
|
|
482 bra adjust_o2_2_diluent
|
|
483
|
|
484 adjust_o2_1_diluent:
|
|
485 decf lo,F ; decrease O2
|
|
486 movlw d'3'
|
|
487 cpfseq lo
|
|
488 bra adjust_o2_2_diluent
|
|
489
|
|
490 incf divemins+0,W
|
|
491 movwf EEADR
|
|
492 call read_eeprom ; read He value
|
|
493
|
|
494 movlw d'100'
|
|
495 movwf lo
|
|
496 movf EEDATA,W ; He value
|
|
497 subwf lo,F ; lo=100% - He%
|
|
498
|
|
499 adjust_o2_2_diluent: ; test if O2+He>100...
|
|
500 incf divemins+0,W
|
|
501 movwf EEADR
|
|
502 call read_eeprom ; read He value
|
|
503 movf EEDATA,W ; He value
|
|
504 addwf lo,W ; add O2 value
|
|
505 movwf hi ; store in temp
|
|
506 movlw d'101'
|
|
507 cpfseq hi ; O2 and He > 100?
|
|
508 bra adjust_o2_3_diluent ; No!
|
|
509
|
|
510 movlw d'4' ; LOWER O2 Limit
|
|
511 movwf lo
|
|
512
|
|
513 adjust_o2_3_diluent:
|
|
514 movff divemins+0,EEADR ; save current value
|
|
515 movff lo,EEDATA
|
|
516 call write_eeprom ; Low-value
|
|
517
|
|
518 movlw d'1'
|
|
519 movwf menupos
|
|
520 bra menu_diluentgas1 ; return
|
|
521
|
|
522 adjust_he_diluent:
|
|
523 incf divemins+0,W
|
652
|
524 movwf EEADR ; read current value (He)
|
642
|
525 call read_eeprom ; Low-value
|
|
526 movff EEDATA,lo
|
|
527
|
|
528 btfsc first_FA ; Minus?
|
|
529 bra adjust_he_1_diluent ; yes, minus!
|
|
530
|
|
531 incf lo,F
|
652
|
532 movlw d'99' ; He limited to (useless) 99%
|
642
|
533 cpfseq lo
|
|
534 bra adjust_he_2_diluent
|
|
535 clrf lo
|
|
536 bra adjust_he_2_diluent
|
|
537
|
|
538 adjust_he_1_diluent:
|
|
539 decf lo,F ; decrease He
|
|
540 movlw d'255'
|
|
541 cpfseq lo
|
|
542 bra adjust_he_2_diluent
|
652
|
543 clrf lo ; limit to zero
|
642
|
544
|
652
|
545 adjust_he_2_diluent: ; test if O2+He>100...
|
|
546 movff divemins+0,EEADR; read current O2 value
|
|
547 call read_eeprom ; Low-value
|
|
548 movf EEDATA,W
|
|
549 addwf lo,W ; add He value
|
642
|
550 movwf hi ; store in temp
|
|
551 movlw d'101'
|
652
|
552 cpfseq hi ; O2 and He > 100?
|
|
553 bra adjust_he_3_diluent ; No!
|
642
|
554 ; clrf lo ; Yes, clear He to zero
|
|
555 decf lo,F ; reduce He again = unchanged after operation
|
|
556
|
|
557 adjust_he_3_diluent:
|
652
|
558 incf divemins+0,W ; save current value
|
642
|
559 movwf EEADR
|
|
560 movff lo,EEDATA
|
652
|
561 call write_eeprom ; Low-value
|
642
|
562
|
|
563 movlw d'2'
|
|
564 movwf menupos
|
652
|
565 bra menu_diluentgas1;
|
642
|
566
|
|
567 restore_gas_diluent:
|
|
568 movff divemins+0,EEADR ; save Default value (O2)
|
|
569 movlw .21 ; Always Air
|
|
570 movwf EEDATA
|
|
571 call write_eeprom
|
|
572 incf EEADR,F ; Point to He
|
|
573 clrf EEDATA
|
|
574 call write_eeprom
|
|
575 movlw d'4'
|
|
576 movwf menupos
|
|
577 bra menu_diluentgas1
|
|
578
|
|
579
|
|
580 diluent_title_bar2:
|
|
581 call PLED_topline_box
|
|
582 WIN_INVERT .1 ; Init new Wordprocessor
|
|
583 WIN_TOP .2
|
|
584 WIN_LEFT .30
|
|
585 lfsr FSR2,letter
|
|
586 STRCAT TXT_DIL5 ; Dil.#
|
|
587 movff decodata+0,lo
|
|
588 incf lo,F
|
|
589 bsf leftbind
|
|
590 output_99
|
|
591 STRCAT_PRINT ": "
|
|
592
|
|
593 WIN_TOP .2
|
|
594 WIN_LEFT .80
|
|
595 lfsr FSR2,letter
|
|
596
|
|
597 ;He check
|
|
598 incf divemins+0,W
|
|
599 movwf EEADR
|
|
600 call read_eeprom ; He value
|
|
601 movff EEDATA,lo ; Move EEData -> lo
|
|
602 movf lo,f ; Move lo -> f
|
|
603 movlw d'0' ; Move 0 -> WREG
|
|
604 cpfsgt lo ; He > 0?
|
|
605 bra diluent_title_bar3 ; NO check o2
|
|
606
|
|
607 ; YES Write TX 15/55
|
|
608 STRCAT TXT_TX3
|
|
609 movff divemins+0,EEADR
|
|
610 call read_eeprom ; O2 value
|
|
611 movff EEDATA,lo
|
|
612 output_8 ; Write O2
|
|
613 PUTC '/'
|
|
614 incf divemins+0,W
|
|
615 movwf EEADR
|
|
616 call read_eeprom ; He value
|
|
617 movff EEDATA,lo
|
|
618 output_8 ; Write He
|
|
619 bra diluent_title_bar7
|
|
620
|
|
621 ; New v1.44se
|
|
622 diluent_title_bar3: ; O2 Check
|
|
623 movff divemins+0,EEADR
|
|
624 call read_eeprom ; O2 value
|
|
625 movff EEDATA,lo
|
|
626 movf lo,f ; Move lo -> f
|
|
627 movlw d'21' ; Move 21 -> WREG
|
|
628 cpfseq lo ; o2 = 21
|
|
629 cpfsgt lo ; o2 > 21%
|
|
630 bra diluent_title_bar5 ; NO AIR
|
|
631 movlw d'100' ; Move 100 -> WREG
|
|
632 cpfslt lo ; o2 < 100%
|
|
633 bra diluent_title_bar4 ; NO write O2
|
|
634
|
|
635 ; YES Write NX 32
|
|
636 STRCAT TXT_NX3
|
|
637 output_8
|
|
638 bra diluent_title_bar7
|
|
639
|
|
640 ; New v1.44se
|
|
641 diluent_title_bar4:
|
|
642 STRCAT TXT_O2_3
|
|
643 output_8
|
|
644 bra diluent_title_bar7
|
|
645
|
|
646 ; New v1.44se
|
|
647 diluent_title_bar5:
|
|
648 cpfseq lo ; o2 = 21%
|
|
649 bra diluent_title_bar6
|
|
650
|
|
651 STRCAT TXT_AIR4
|
|
652 output_8
|
|
653 bra diluent_title_bar7
|
|
654
|
|
655 ; New v1.44se
|
|
656 diluent_title_bar6: ; ERROR
|
|
657 STRCAT TXT_ERR4
|
|
658 output_8
|
|
659 ;bra diluent_title_bar7
|
|
660
|
|
661 diluent_title_bar7:
|
|
662 STRCAT_PRINT ""
|
|
663 WIN_INVERT .0 ; Init new Wordprocessor
|
|
664 return
|
|
665
|
639
|
666
|
|
667 ; ***
|
|
668
|
|
669
|
|
670
|
|
671
|
|
672
|
|
673
|
|
674
|
|
675 menu_const_ppO2_setpoints: ; Setpoint menu
|
|
676 movlw d'1'
|
|
677 movwf menupos
|
0
|
678
|
|
679 bcf menubit4
|
|
680 clrf decodata+0 ; Here: # of SP
|
|
681 bcf first_FA ; Here: =1: -, =0: +
|
|
682 bcf second_FA ; Here: =1: 1, =0: 10 steps
|
|
683
|
|
684 menu_const_ppO20:
|
|
685 call PLED_ClearScreen
|
|
686 call PLED_topline_box
|
|
687
|
|
688 WIN_INVERT .1 ; Init new Wordprocessor
|
|
689 DISPLAYTEXT .111 ; Constant ppO2 Setup
|
|
690 WIN_INVERT .0 ; Init new Wordprocessor
|
|
691
|
|
692
|
|
693 menu_const_ppO21:
|
|
694 WIN_LEFT .20
|
|
695 WIN_TOP .35
|
|
696 lfsr FSR2,letter
|
|
697 OUTPUTTEXT .112 ; SP#
|
|
698 movff decodata+0,lo
|
|
699 incf lo,F
|
|
700 bsf leftbind
|
|
701 output_99
|
123
|
702 STRCAT " ("
|
0
|
703
|
|
704 OUTPUTTEXT d'192' ; Dil.
|
123
|
705 PUTC ' '
|
0
|
706
|
643
|
707 movlw d'96' ; = address for O2 ratio
|
|
708 movwf EEADR
|
0
|
709 call read_eeprom ; Read O2 ratio
|
640
|
710 movff EEDATA, lo ; O2 ratio
|
0
|
711 bsf leftbind
|
|
712 output_99
|
123
|
713 PUTC '/'
|
643
|
714 movlw d'97' ; = address for He ratio
|
0
|
715 movwf EEADR
|
|
716 call read_eeprom ; Read He ratio
|
640
|
717 movff EEDATA,lo ; And copy into hold register
|
0
|
718 bsf leftbind
|
|
719 output_99
|
123
|
720 STRCAT_PRINT ")"
|
0
|
721
|
|
722
|
|
723 WIN_LEFT .20
|
|
724 WIN_TOP .65
|
|
725
|
|
726 lfsr FSR2,letter
|
|
727 OUTPUTTEXT .97 ; "Current: "
|
|
728 movf decodata+0,W
|
|
729 addlw d'36' ; offset in eeprom
|
|
730 movwf EEADR
|
|
731 call read_eeprom ; ppO2 value
|
|
732 movff EEDATA,lo
|
|
733 clrf hi
|
|
734 bsf leftbind
|
|
735 output_16dp d'3'
|
|
736 bcf leftbind
|
445
|
737 STRCAT_PRINT TXT_BAR4
|
0
|
738
|
|
739 WIN_LEFT .20
|
|
740 WIN_TOP .95
|
|
741
|
|
742 lfsr FSR2,letter
|
|
743 OUTPUTTEXT d'190' ; ppO2 +
|
|
744 call word_processor
|
|
745
|
|
746 WIN_LEFT .20
|
|
747 WIN_TOP .125
|
|
748
|
|
749 lfsr FSR2,letter
|
|
750 OUTPUTTEXT d'191' ; ppO2 -
|
|
751 call word_processor
|
|
752
|
|
753 WIN_LEFT .20
|
|
754 WIN_TOP .155
|
|
755
|
|
756 lfsr FSR2,letter
|
|
757 OUTPUTTEXT .89 ; "Default: "
|
123
|
758 STRCAT_PRINT "1.00"
|
0
|
759
|
|
760 DISPLAYTEXT .11 ; Exit
|
|
761 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
|
576
|
762 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
|
0
|
763 call PLED_menu_cursor
|
|
764
|
|
765 menu_const_ppO2_loop:
|
|
766 call check_switches_logbook
|
|
767
|
|
768 btfsc menubit3
|
575
|
769 bra menu_const_ppO22 ; move cursor
|
0
|
770
|
|
771 btfsc menubit2
|
575
|
772 bra do_menu_const_ppO2 ; call submenu
|
0
|
773
|
|
774 btfsc onesecupdate
|
575
|
775 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag
|
0
|
776
|
|
777 bcf onesecupdate ; 1 sec. functions done
|
|
778
|
|
779 btfsc sleepmode
|
575
|
780 bra exit_menu_const_ppO2
|
0
|
781
|
575
|
782 bra menu_const_ppO2_loop
|
0
|
783
|
|
784 menu_const_ppO22:
|
|
785 incf menupos,F
|
|
786
|
|
787 movlw d'2'
|
|
788 cpfseq menupos ; =2?
|
|
789 bra menu_const_ppO22a ; No
|
|
790 incf menupos,F ; Skip pos. 2
|
|
791
|
|
792 menu_const_ppO22a:
|
|
793 movlw d'7'
|
|
794 cpfseq menupos ; =7?
|
|
795 bra menu_const_ppO23 ; No
|
|
796 movlw d'1'
|
|
797 movwf menupos
|
|
798
|
|
799 menu_const_ppO23:
|
576
|
800 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
|
0
|
801 call PLED_menu_cursor
|
|
802 bra menu_const_ppO2_loop
|
|
803
|
|
804 do_menu_const_ppO2:
|
|
805 dcfsnz menupos,F
|
|
806 bra next_ppO2
|
|
807 dcfsnz menupos,F
|
|
808 bra change_ppo2_plus
|
|
809 dcfsnz menupos,F
|
|
810 bra change_ppo2_plus
|
|
811 dcfsnz menupos,F
|
|
812 bra change_ppo2_minus
|
|
813 dcfsnz menupos,F
|
|
814 bra change_ppo2_reset
|
|
815 movlw d'2'
|
|
816 movwf menupos
|
639
|
817 bra menu_const_ppO2_return
|
0
|
818
|
|
819 change_ppo2_plus:
|
|
820 movf decodata+0,W ; read current value
|
|
821 addlw d'36' ; offset in memory
|
|
822 movwf EEADR
|
|
823 call read_eeprom ; Low-value
|
|
824 movff EEDATA,lo
|
|
825
|
|
826 incf lo,F ; increase depth
|
|
827 movlw d'251'
|
|
828 cpfseq lo
|
|
829 bra change_ppo2_plus2
|
|
830 movlw d'250'
|
|
831 movwf lo
|
|
832 change_ppo2_plus2:
|
|
833 movff lo,EEDATA ; write result
|
|
834 call write_eeprom ; save result in EEPROM
|
|
835 movlw d'3'
|
|
836 movwf menupos
|
|
837 bra menu_const_ppO21
|
|
838
|
|
839 change_ppo2_minus:
|
|
840 movf decodata+0,W ; read current value
|
|
841 addlw d'36' ; offset in memory
|
|
842 movwf EEADR
|
|
843 call read_eeprom ; Low-value
|
|
844 movff EEDATA,lo
|
|
845
|
|
846 decf lo,F ; decrease depth
|
|
847 movlw d'255'
|
|
848 cpfseq lo
|
|
849 bra change_ppo2_minus2
|
|
850 movlw d'0'
|
|
851 movwf lo
|
|
852
|
|
853 change_ppo2_minus2:
|
|
854 movff lo,EEDATA ; write result
|
|
855 call write_eeprom ; save result in EEPROM
|
|
856
|
|
857 movlw d'4'
|
|
858 movwf menupos
|
576
|
859 bra menu_const_ppO21
|
0
|
860
|
|
861 change_ppo2_reset: ; reset to 1.00Bar
|
|
862 movf decodata+0,W ; read current value
|
|
863 addlw d'36' ; offset in memory
|
|
864 movwf EEADR
|
|
865 movlw d'100'
|
|
866 movwf EEDATA
|
|
867 call write_eeprom ; save result in EEPROM
|
|
868 movlw d'5'
|
|
869 movwf menupos
|
|
870 bra menu_const_ppO21
|
|
871
|
|
872 next_ppO2:
|
|
873 incf decodata+0,F
|
|
874 movlw d'3'
|
|
875 cpfseq decodata+0 ; =3?
|
|
876 bra next_ppO22
|
|
877 clrf decodata+0 ; yes, so reset to zero
|
|
878 next_ppO22:
|
|
879 movlw d'1'
|
|
880 movwf menupos
|
576
|
881 bra menu_const_ppO21 |