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
|
|
524 movwf EEADR ; read current value
|
|
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
|
|
532 movlw d'92' ; He limited to (useless) 90%
|
|
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
|
|
543 clrf lo
|
|
544
|
|
545 adjust_he_2_diluent: ; test if O2+He>100...
|
|
546 incf divemins+0,W
|
|
547 movwf EEADR
|
|
548 call read_eeprom ; read He value
|
|
549 movf EEDATA,W ; He value
|
|
550 addwf lo,W ; add O2 value
|
|
551 movwf hi ; store in temp
|
|
552 movlw d'101'
|
|
553 cpfseq hi ; O2 and He > 100?
|
|
554 bra adjust_he_3_diluent ; No!
|
|
555 ; clrf lo ; Yes, clear He to zero
|
|
556 decf lo,F ; reduce He again = unchanged after operation
|
|
557
|
|
558 adjust_he_3_diluent:
|
|
559 incf divemins+0,W ; save current value
|
|
560 movwf EEADR
|
|
561 movff lo,EEDATA
|
|
562 call write_eeprom ; Low-value
|
|
563
|
|
564 movlw d'2'
|
|
565 movwf menupos
|
|
566 bra menu_diluentgas1 ;
|
|
567
|
|
568 restore_gas_diluent:
|
|
569 movff divemins+0,EEADR ; save Default value (O2)
|
|
570 movlw .21 ; Always Air
|
|
571 movwf EEDATA
|
|
572 call write_eeprom
|
|
573 incf EEADR,F ; Point to He
|
|
574 clrf EEDATA
|
|
575 call write_eeprom
|
|
576 movlw d'4'
|
|
577 movwf menupos
|
|
578 bra menu_diluentgas1
|
|
579
|
|
580
|
|
581 diluent_title_bar2:
|
|
582 call PLED_topline_box
|
|
583 WIN_INVERT .1 ; Init new Wordprocessor
|
|
584 WIN_TOP .2
|
|
585 WIN_LEFT .30
|
|
586 lfsr FSR2,letter
|
|
587 STRCAT TXT_DIL5 ; Dil.#
|
|
588 movff decodata+0,lo
|
|
589 incf lo,F
|
|
590 bsf leftbind
|
|
591 output_99
|
|
592 STRCAT_PRINT ": "
|
|
593
|
|
594 WIN_TOP .2
|
|
595 WIN_LEFT .80
|
|
596 lfsr FSR2,letter
|
|
597
|
|
598 ;He check
|
|
599 incf divemins+0,W
|
|
600 movwf EEADR
|
|
601 call read_eeprom ; He value
|
|
602 movff EEDATA,lo ; Move EEData -> lo
|
|
603 movf lo,f ; Move lo -> f
|
|
604 movlw d'0' ; Move 0 -> WREG
|
|
605 cpfsgt lo ; He > 0?
|
|
606 bra diluent_title_bar3 ; NO check o2
|
|
607
|
|
608 ; YES Write TX 15/55
|
|
609 STRCAT TXT_TX3
|
|
610 movff divemins+0,EEADR
|
|
611 call read_eeprom ; O2 value
|
|
612 movff EEDATA,lo
|
|
613 output_8 ; Write O2
|
|
614 PUTC '/'
|
|
615 incf divemins+0,W
|
|
616 movwf EEADR
|
|
617 call read_eeprom ; He value
|
|
618 movff EEDATA,lo
|
|
619 output_8 ; Write He
|
|
620 bra diluent_title_bar7
|
|
621
|
|
622 ; New v1.44se
|
|
623 diluent_title_bar3: ; O2 Check
|
|
624 movff divemins+0,EEADR
|
|
625 call read_eeprom ; O2 value
|
|
626 movff EEDATA,lo
|
|
627 movf lo,f ; Move lo -> f
|
|
628 movlw d'21' ; Move 21 -> WREG
|
|
629 cpfseq lo ; o2 = 21
|
|
630 cpfsgt lo ; o2 > 21%
|
|
631 bra diluent_title_bar5 ; NO AIR
|
|
632 movlw d'100' ; Move 100 -> WREG
|
|
633 cpfslt lo ; o2 < 100%
|
|
634 bra diluent_title_bar4 ; NO write O2
|
|
635
|
|
636 ; YES Write NX 32
|
|
637 STRCAT TXT_NX3
|
|
638 output_8
|
|
639 bra diluent_title_bar7
|
|
640
|
|
641 ; New v1.44se
|
|
642 diluent_title_bar4:
|
|
643 STRCAT TXT_O2_3
|
|
644 output_8
|
|
645 bra diluent_title_bar7
|
|
646
|
|
647 ; New v1.44se
|
|
648 diluent_title_bar5:
|
|
649 cpfseq lo ; o2 = 21%
|
|
650 bra diluent_title_bar6
|
|
651
|
|
652 STRCAT TXT_AIR4
|
|
653 output_8
|
|
654 bra diluent_title_bar7
|
|
655
|
|
656 ; New v1.44se
|
|
657 diluent_title_bar6: ; ERROR
|
|
658 STRCAT TXT_ERR4
|
|
659 output_8
|
|
660 ;bra diluent_title_bar7
|
|
661
|
|
662 diluent_title_bar7:
|
|
663 STRCAT_PRINT ""
|
|
664 WIN_INVERT .0 ; Init new Wordprocessor
|
|
665 return
|
|
666
|
639
|
667
|
|
668 ; ***
|
|
669
|
|
670
|
|
671
|
|
672
|
|
673
|
|
674
|
|
675
|
|
676 menu_const_ppO2_setpoints: ; Setpoint menu
|
|
677 movlw d'1'
|
|
678 movwf menupos
|
0
|
679
|
|
680 bcf menubit4
|
|
681 clrf decodata+0 ; Here: # of SP
|
|
682 bcf first_FA ; Here: =1: -, =0: +
|
|
683 bcf second_FA ; Here: =1: 1, =0: 10 steps
|
|
684
|
|
685 menu_const_ppO20:
|
|
686 call PLED_ClearScreen
|
|
687 call PLED_topline_box
|
|
688
|
|
689 WIN_INVERT .1 ; Init new Wordprocessor
|
|
690 DISPLAYTEXT .111 ; Constant ppO2 Setup
|
|
691 WIN_INVERT .0 ; Init new Wordprocessor
|
|
692
|
|
693
|
|
694 menu_const_ppO21:
|
|
695 WIN_LEFT .20
|
|
696 WIN_TOP .35
|
|
697 lfsr FSR2,letter
|
|
698 OUTPUTTEXT .112 ; SP#
|
|
699 movff decodata+0,lo
|
|
700 incf lo,F
|
|
701 bsf leftbind
|
|
702 output_99
|
123
|
703 STRCAT " ("
|
0
|
704
|
|
705 OUTPUTTEXT d'192' ; Dil.
|
123
|
706 PUTC ' '
|
0
|
707
|
643
|
708 movlw d'96' ; = address for O2 ratio
|
|
709 movwf EEADR
|
0
|
710 call read_eeprom ; Read O2 ratio
|
640
|
711 movff EEDATA, lo ; O2 ratio
|
0
|
712 bsf leftbind
|
|
713 output_99
|
123
|
714 PUTC '/'
|
643
|
715 movlw d'97' ; = address for He ratio
|
0
|
716 movwf EEADR
|
|
717 call read_eeprom ; Read He ratio
|
640
|
718 movff EEDATA,lo ; And copy into hold register
|
0
|
719 bsf leftbind
|
|
720 output_99
|
123
|
721 STRCAT_PRINT ")"
|
0
|
722
|
|
723
|
|
724 WIN_LEFT .20
|
|
725 WIN_TOP .65
|
|
726
|
|
727 lfsr FSR2,letter
|
|
728 OUTPUTTEXT .97 ; "Current: "
|
|
729 movf decodata+0,W
|
|
730 addlw d'36' ; offset in eeprom
|
|
731 movwf EEADR
|
|
732 call read_eeprom ; ppO2 value
|
|
733 movff EEDATA,lo
|
|
734 clrf hi
|
|
735 bsf leftbind
|
|
736 output_16dp d'3'
|
|
737 bcf leftbind
|
445
|
738 STRCAT_PRINT TXT_BAR4
|
0
|
739
|
|
740 WIN_LEFT .20
|
|
741 WIN_TOP .95
|
|
742
|
|
743 lfsr FSR2,letter
|
|
744 OUTPUTTEXT d'190' ; ppO2 +
|
|
745 call word_processor
|
|
746
|
|
747 WIN_LEFT .20
|
|
748 WIN_TOP .125
|
|
749
|
|
750 lfsr FSR2,letter
|
|
751 OUTPUTTEXT d'191' ; ppO2 -
|
|
752 call word_processor
|
|
753
|
|
754 WIN_LEFT .20
|
|
755 WIN_TOP .155
|
|
756
|
|
757 lfsr FSR2,letter
|
|
758 OUTPUTTEXT .89 ; "Default: "
|
123
|
759 STRCAT_PRINT "1.00"
|
0
|
760
|
|
761 DISPLAYTEXT .11 ; Exit
|
|
762 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
|
576
|
763 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
|
0
|
764 call PLED_menu_cursor
|
|
765
|
|
766 menu_const_ppO2_loop:
|
|
767 call check_switches_logbook
|
|
768
|
|
769 btfsc menubit3
|
575
|
770 bra menu_const_ppO22 ; move cursor
|
0
|
771
|
|
772 btfsc menubit2
|
575
|
773 bra do_menu_const_ppO2 ; call submenu
|
0
|
774
|
|
775 btfsc onesecupdate
|
575
|
776 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag
|
0
|
777
|
|
778 bcf onesecupdate ; 1 sec. functions done
|
|
779
|
|
780 btfsc sleepmode
|
575
|
781 bra exit_menu_const_ppO2
|
0
|
782
|
575
|
783 bra menu_const_ppO2_loop
|
0
|
784
|
|
785 menu_const_ppO22:
|
|
786 incf menupos,F
|
|
787
|
|
788 movlw d'2'
|
|
789 cpfseq menupos ; =2?
|
|
790 bra menu_const_ppO22a ; No
|
|
791 incf menupos,F ; Skip pos. 2
|
|
792
|
|
793 menu_const_ppO22a:
|
|
794 movlw d'7'
|
|
795 cpfseq menupos ; =7?
|
|
796 bra menu_const_ppO23 ; No
|
|
797 movlw d'1'
|
|
798 movwf menupos
|
|
799
|
|
800 menu_const_ppO23:
|
576
|
801 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
|
0
|
802 call PLED_menu_cursor
|
|
803 bra menu_const_ppO2_loop
|
|
804
|
|
805 do_menu_const_ppO2:
|
|
806 dcfsnz menupos,F
|
|
807 bra next_ppO2
|
|
808 dcfsnz menupos,F
|
|
809 bra change_ppo2_plus
|
|
810 dcfsnz menupos,F
|
|
811 bra change_ppo2_plus
|
|
812 dcfsnz menupos,F
|
|
813 bra change_ppo2_minus
|
|
814 dcfsnz menupos,F
|
|
815 bra change_ppo2_reset
|
|
816 movlw d'2'
|
|
817 movwf menupos
|
639
|
818 bra menu_const_ppO2_return
|
0
|
819
|
|
820 change_ppo2_plus:
|
|
821 movf decodata+0,W ; read current value
|
|
822 addlw d'36' ; offset in memory
|
|
823 movwf EEADR
|
|
824 call read_eeprom ; Low-value
|
|
825 movff EEDATA,lo
|
|
826
|
|
827 incf lo,F ; increase depth
|
|
828 movlw d'251'
|
|
829 cpfseq lo
|
|
830 bra change_ppo2_plus2
|
|
831 movlw d'250'
|
|
832 movwf lo
|
|
833 change_ppo2_plus2:
|
|
834 movff lo,EEDATA ; write result
|
|
835 call write_eeprom ; save result in EEPROM
|
|
836 movlw d'3'
|
|
837 movwf menupos
|
|
838 bra menu_const_ppO21
|
|
839
|
|
840 change_ppo2_minus:
|
|
841 movf decodata+0,W ; read current value
|
|
842 addlw d'36' ; offset in memory
|
|
843 movwf EEADR
|
|
844 call read_eeprom ; Low-value
|
|
845 movff EEDATA,lo
|
|
846
|
|
847 decf lo,F ; decrease depth
|
|
848 movlw d'255'
|
|
849 cpfseq lo
|
|
850 bra change_ppo2_minus2
|
|
851 movlw d'0'
|
|
852 movwf lo
|
|
853
|
|
854 change_ppo2_minus2:
|
|
855 movff lo,EEDATA ; write result
|
|
856 call write_eeprom ; save result in EEPROM
|
|
857
|
|
858 movlw d'4'
|
|
859 movwf menupos
|
576
|
860 bra menu_const_ppO21
|
0
|
861
|
|
862 change_ppo2_reset: ; reset to 1.00Bar
|
|
863 movf decodata+0,W ; read current value
|
|
864 addlw d'36' ; offset in memory
|
|
865 movwf EEADR
|
|
866 movlw d'100'
|
|
867 movwf EEDATA
|
|
868 call write_eeprom ; save result in EEPROM
|
|
869 movlw d'5'
|
|
870 movwf menupos
|
|
871 bra menu_const_ppO21
|
|
872
|
|
873 next_ppO2:
|
|
874 incf decodata+0,F
|
|
875 movlw d'3'
|
|
876 cpfseq decodata+0 ; =3?
|
|
877 bra next_ppO22
|
|
878 clrf decodata+0 ; yes, so reset to zero
|
|
879 next_ppO22:
|
|
880 movlw d'1'
|
|
881 movwf menupos
|
576
|
882 bra menu_const_ppO21 |