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 ; Menu "Custom Functions", Custom Functions checker (Displays permanent warning if critical custom functions are altered)
|
|
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
|
|
21 ; written: 05/10/30
|
|
22 ; last updated: 08/08/31
|
|
23 ; known bugs:
|
|
24 ; ToDo:
|
|
25
|
|
26 ;First Bank of Custom Functions:
|
|
27 ; The custom functions are stored in the internal EEPROM after 0x80
|
|
28 ; any custom function occupies 4 byte:
|
|
29 ; 2 byte (low:high) store the default value, reset from menu "reset"
|
|
30 ; if bit16=1 then the custrom function is 15bit value, if not it's a 8bit value
|
|
31 ; 2 byte (low:high) store the actual value
|
|
32 ; defaults for custom functions are in menu "reset"
|
|
33 ; get values with GETCUSTOM8 .x with x=0...32 for 8 Bit values (stored in WREG)
|
|
34 ; or with GETCUSTOM15 .x with x=0...32 for 15 Bit values (stored in lo and hi)
|
|
35
|
|
36 ;Second Bank of Custom Functions:
|
|
37 ; The custom functions are stored in the internal EEPROM after 0x180
|
|
38 ; any custom function occupies 4 byte:
|
|
39 ; 2 byte (low:high) store the default value, reset from menu "reset"
|
|
40 ; if bit16=1 then the custrom function is 15bit value, if not it's a 8bit value
|
|
41 ; 2 byte (low:high) store the actual value
|
|
42 ; defaults for custom functions are in menu "reset"
|
|
43 ; get values with GETCUSTOM8 .x with x=0...32 for 8 Bit values (stored in WREG)
|
|
44 ; or with GETCUSTOM15 .x with x=0...32 for 15 Bit values (stored in lo and hi)
|
|
45
|
|
46
|
|
47 GETCUSTOM8 macro custom8
|
|
48 movlw custom8
|
|
49 call getcustom8_1
|
|
50 endm
|
|
51
|
|
52 getcustom8_1:
|
|
53 ; # number of requested custom function in wreg
|
|
54 movwf customfunction_temp2
|
|
55
|
|
56 movlw d'31'
|
|
57 cpfsgt customfunction_temp2
|
|
58 bra getcustom8_2 ; Lower bank
|
|
59
|
|
60 movlw d'1' ; Upper Bank
|
|
61 movwf EEADRH
|
|
62 movlw d'32'
|
|
63 subwf customfunction_temp2,F
|
|
64 bra getcustom8_3
|
|
65
|
|
66 getcustom8_2:
|
|
67 clrf EEADRH
|
|
68 getcustom8_3:
|
|
69 movf customfunction_temp2,W
|
|
70 mullw d'4'
|
|
71 movf PRODL,W ; x4 for adress
|
|
72 addlw d'130'
|
|
73 movwf EEADR ; +130 for LOW Byte of value
|
|
74 call read_eeprom ; Lowbyte
|
|
75 movf EEDATA,W ; copied into wreg
|
|
76 clrf EEADRH
|
|
77 return ; return
|
|
78
|
|
79 GETCUSTOM15 macro custom15
|
|
80 movlw custom15
|
|
81 call getcustom15_1
|
|
82 endm
|
|
83
|
|
84 getcustom15_1:
|
|
85 ; # number of requested custom function in wreg
|
|
86 movwf customfunction_temp2
|
|
87
|
|
88 movlw d'31'
|
|
89 cpfsgt customfunction_temp2
|
|
90 bra getcustom15_2 ; Lower bank
|
|
91
|
|
92 movlw d'1' ; Upper Bank
|
|
93 movwf EEADRH
|
|
94 movlw d'32'
|
|
95 subwf customfunction_temp2,F
|
|
96 bra getcustom15_3
|
|
97 getcustom15_2:
|
|
98 clrf EEADRH
|
|
99 getcustom15_3:
|
|
100 movf customfunction_temp2,W
|
|
101 mullw d'4'
|
|
102 movf PRODL,W ; x4 for adress
|
|
103 addlw d'130'
|
|
104 movwf EEADR ; +130 for LOW Byte of value
|
|
105 call read_eeprom ; Lowbyte
|
|
106 movff EEDATA,lo
|
|
107 incf EEADR,F
|
|
108 call read_eeprom ; Highbyte
|
|
109 movff EEDATA,hi
|
|
110 clrf EEADRH
|
|
111 return ; return
|
|
112
|
|
113 menu_custom_functions_page2:
|
|
114 movlw d'154' ; start of custom function descriptors
|
|
115 movwf customfunction_temp1
|
|
116 bsf customfunction_page ; Use Page I...
|
|
117 movlw d'1'
|
|
118 movwf EEADRH
|
|
119 bra menu_custom_functions0
|
|
120
|
|
121 menu_custom_functions:
|
|
122 movlw d'36' ; start of custom function descriptors
|
|
123 movwf customfunction_temp1
|
|
124 bcf customfunction_page ; Use Page I...
|
|
125 clrf EEADRH
|
|
126
|
|
127 menu_custom_functions0:
|
|
128 bsf leftbind
|
|
129 call PLED_ClearScreen
|
|
130 movlw d'1'
|
|
131 movwf menupos
|
|
132
|
|
133 bcf menubit4
|
|
134 bcf cursor
|
|
135 bcf sleepmode
|
|
136 clrf decodata+0 ; here: # of CustomFunction
|
|
137 clrf divemins+0 ; here: # of CustomFunction*4
|
|
138 bcf first_FA ; here: =1: -, =0: +
|
|
139 bcf second_FA ; here: =1: stepsize 1, =0: stepsize 10
|
|
140
|
|
141 call PLED_topline_box
|
|
142 WIN_INVERT .1 ; Init new Wordprocessor
|
|
143
|
|
144 btfss customfunction_page ;
|
|
145 bra menu_custom_functions10
|
|
146 DISPLAYTEXT .186 ; Custom FunctionsII
|
|
147 bra menu_custom_functions11
|
|
148
|
|
149 menu_custom_functions10:
|
|
150 DISPLAYTEXT .27 ; Custom FunctionsI
|
|
151
|
|
152 menu_custom_functions11:
|
|
153 WIN_INVERT .0 ; Init new Wordprocessor
|
|
154
|
|
155 menu_custom_functions1:
|
|
156 clrf timeout_counter2
|
|
157 bcf menubit2
|
|
158 bcf menubit3
|
|
159 WIN_LEFT .20
|
|
160 WIN_TOP .35
|
|
161 lfsr FSR2,letter
|
|
162 movff decodata+0,lo
|
|
163
|
|
164 movlw d'0'
|
|
165 btfsc customfunction_page ; Add offset for display
|
|
166 movlw d'32'
|
|
167 addwf lo,F
|
|
168 movff lo,apnoe_mins ; apnoe_mins used as temp for binary CFs
|
|
169
|
|
170 output_99x
|
|
171 movlw ':'
|
|
172 movwf POSTINC2
|
|
173 movlw ' '
|
|
174 movwf POSTINC2
|
|
175 call word_processor
|
|
176
|
|
177 ; movlw d'16'
|
|
178 ; movwf temp1
|
|
179 ; WIN_LEFT .40
|
|
180 ; WIN_TOP .35
|
|
181 ; call PLED_display_clear_common_y1
|
|
182 ;
|
|
183 movf customfunction_temp1,W ; start of custom function descriptors
|
|
184 addwf decodata+0,W ; add # of current custom function, place result in wreg
|
|
185 call displaytext1 ; shows descriptor
|
|
186
|
|
187 movlw binary_cf1
|
|
188 subwf apnoe_mins,W ; Binary cf?
|
|
189 btfsc STATUS,Z
|
|
190 bra menu_custom_functions10c ; Yes
|
|
191
|
|
192 movlw binary_cf2
|
|
193 subwf apnoe_mins,W ; Binary cf?
|
|
194 btfsc STATUS,Z
|
|
195 bra menu_custom_functions10c ; Yes
|
|
196
|
|
197 movlw binary_cf3
|
|
198 subwf apnoe_mins,W ; Binary cf?
|
|
199 btfsc STATUS,Z
|
|
200 bra menu_custom_functions10c ; Yes
|
|
201
|
|
202 movlw binary_cf4
|
|
203 subwf apnoe_mins,W ; Binary cf?
|
|
204 btfsc STATUS,Z
|
|
205 bra menu_custom_functions10c ; Yes
|
|
206
|
|
207 movlw binary_cf5
|
|
208 subwf apnoe_mins,W ; Binary cf?
|
|
209 btfsc STATUS,Z
|
|
210 bra menu_custom_functions10c ; Yes
|
|
211
|
|
212
|
|
213 bra menu_custom_functions10a ; Not a binary CF selected
|
|
214
|
|
215 menu_custom_functions10c:
|
|
216 movlw d'1'
|
|
217 movwf apnoe_mins ; Yes, set apnoe_mins to "1"
|
|
218 bra menu_custom_functions10b
|
|
219
|
|
220 menu_custom_functions10a:
|
|
221 clrf apnoe_mins ; Yes, clear apnoe_mins
|
|
222 menu_custom_functions10b:
|
|
223 WIN_LEFT .20
|
|
224 WIN_TOP .65
|
|
225 lfsr FSR2,letter
|
|
226 movlw '+'
|
|
227 movwf POSTINC2
|
|
228 movlw '/'
|
|
229 movwf POSTINC2
|
|
230 movlw '-'
|
|
231 movwf POSTINC2
|
|
232 movlw ':'
|
|
233 movwf POSTINC2
|
|
234 movlw ' '
|
|
235 movwf POSTINC2
|
|
236 movlw '+'
|
|
237 btfsc first_FA
|
|
238 movlw '-'
|
|
239 movwf POSTINC2
|
|
240 call word_processor
|
|
241
|
|
242 WIN_LEFT .20
|
|
243 WIN_TOP .95
|
|
244 lfsr FSR2,letter
|
|
245 movlw '1'
|
|
246 movwf POSTINC2
|
|
247 movlw '/'
|
|
248 movwf POSTINC2
|
|
249 movlw '1'
|
|
250 movwf POSTINC2
|
|
251 movlw '0'
|
|
252 movwf POSTINC2
|
|
253 movlw ':'
|
|
254 movwf POSTINC2
|
|
255 movlw ' '
|
|
256 movwf POSTINC2
|
|
257 movlw '1'
|
|
258 movwf POSTINC2
|
|
259 movlw '0'
|
|
260 btfsc second_FA
|
|
261 movwf POSTINC2
|
|
262 movlw ' '
|
|
263 movwf POSTINC2
|
|
264 call word_processor
|
|
265
|
|
266 WIN_LEFT .20
|
|
267 WIN_TOP .125
|
|
268 lfsr FSR2,letter
|
|
269 OUTPUTTEXT d'89' ;"Default:"
|
|
270
|
|
271 movf divemins+0,W
|
|
272 addlw 0x80
|
|
273 movwf EEADR
|
|
274 call read_eeprom ; Lowbyte
|
|
275 movff EEDATA,lo
|
|
276 movf divemins+0,W
|
|
277 addlw 0x81
|
|
278 movwf EEADR
|
|
279 call read_eeprom ; Highbyte
|
|
280 movff EEDATA,hi
|
|
281 bcf hi,7 ; clear Bit 7 of value
|
|
282 output_16
|
|
283 movlw '('
|
|
284 movwf POSTINC2
|
|
285
|
|
286 movlw '1'
|
|
287 btfss EEDATA,7 ; 15Bit?
|
|
288 movlw '8' ; 8Bit!
|
|
289 tstfsz apnoe_mins ; apnoe_mins=0?
|
|
290 movlw '1' ; No, 1Bit!
|
|
291 movwf POSTINC2
|
|
292
|
|
293 movlw '5'
|
|
294 btfsc EEDATA,7 ; 15Bit?
|
|
295 movwf POSTINC2
|
|
296
|
|
297 movlw 'B'
|
|
298 movwf POSTINC2
|
|
299 movlw ')'
|
|
300 movwf POSTINC2
|
|
301 movlw ' '
|
|
302 movwf POSTINC2
|
|
303 movlw ' '
|
|
304 movwf POSTINC2
|
|
305 movlw ' '
|
|
306 movwf POSTINC2
|
|
307 call word_processor
|
|
308
|
|
309 WIN_LEFT .20
|
|
310 WIN_TOP .155
|
|
311 lfsr FSR2,letter
|
|
312 OUTPUTTEXT d'97' ; "Current:"
|
|
313
|
|
314 movf divemins+0,W
|
|
315 addlw 0x82
|
|
316 movwf EEADR
|
|
317 call read_eeprom ; Lowbyte
|
|
318 movff EEDATA,lo
|
|
319 movf divemins+0,W
|
|
320 addlw 0x83
|
|
321 movwf EEADR
|
|
322 call read_eeprom ; Highbyte
|
|
323 movff EEDATA,hi
|
|
324 output_16
|
|
325 movlw ' '
|
|
326 movwf POSTINC2
|
|
327 movlw ' '
|
|
328 movwf POSTINC2
|
|
329 movlw ' '
|
|
330 movwf POSTINC2
|
|
331 call word_processor
|
|
332
|
|
333 menu_custom_functions1a:
|
|
334 DISPLAYTEXT .11 ; Exit
|
|
335
|
|
336 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
|
|
337 call PLED_menu_cursor
|
|
338
|
|
339 customfunctions_loop:
|
|
340 call check_switches_logbook
|
|
341
|
|
342 btfsc menubit3
|
|
343 bra customfunctions2 ; Move cursor or generate next page
|
|
344
|
|
345 btfsc menubit2
|
|
346 bra do_customfunction ; call subfunction
|
|
347
|
|
348 btfsc divemode
|
|
349 goto restart ; dive started during cf menu
|
|
350
|
|
351 btfsc onesecupdate
|
|
352 call timeout_surfmode
|
|
353
|
|
354 btfsc onesecupdate
|
|
355 call set_dive_modes
|
|
356
|
|
357 bcf onesecupdate ; end of 1sek. tasks
|
|
358
|
|
359 btfsc sleepmode
|
|
360 bra exit_customfunctions
|
|
361
|
|
362 bra customfunctions_loop
|
|
363
|
|
364 customfunctions2:
|
|
365 incf menupos,F
|
|
366 movlw d'7'
|
|
367 cpfseq menupos ; =7?
|
|
368 bra customfunctions3 ; No
|
|
369 movlw d'1'
|
|
370 movwf menupos
|
|
371
|
|
372 customfunctions3:
|
|
373 clrf timeout_counter2
|
|
374 call PLED_menu_cursor
|
|
375
|
|
376 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
|
|
377
|
|
378 bcf menubit3 ; clear flag
|
|
379 bra customfunctions_loop
|
|
380
|
|
381
|
|
382 do_customfunction:
|
|
383 CLRF EEADRH
|
|
384 movlw d'1'
|
|
385 btfsc customfunction_page
|
|
386 movwf EEADRH ; Reset EEADRH correct (Was adjusted in check_timeout...)
|
|
387
|
|
388 dcfsnz menupos,F
|
|
389 bra next_customfunction
|
|
390 dcfsnz menupos,F
|
|
391 bra toggle_plusminus
|
|
392 dcfsnz menupos,F
|
|
393 bra toggle_oneorten
|
|
394 dcfsnz menupos,F
|
|
395 bra restore_cfn_value
|
|
396 dcfsnz menupos,F
|
|
397 bra adjust_cfn_value
|
|
398 exit_customfunctions:
|
|
399 movlw d'2' ; Return to correct list entry
|
|
400 btfss customfunction_page
|
|
401 movlw d'1'
|
|
402 movwf menupos ;
|
|
403 clrf EEADRH ; Clear EEADRH !
|
|
404 goto setup_menu2 ; exit...
|
|
405
|
|
406
|
|
407 next_customfunction:
|
|
408 incf decodata+0
|
|
409 btfsc decodata+0,5 ;>31?
|
|
410 clrf decodata+0 ;Yes, so reset to zero
|
|
411
|
|
412 movf decodata+0,W
|
|
413 mullw d'4'
|
|
414 movff PRODL, divemins+0 ;divemins+0 for correct addressing
|
|
415
|
|
416 movlw d'1'
|
|
417 movwf menupos
|
|
418 bra menu_custom_functions1 ; also debounces switches
|
|
419
|
|
420 toggle_plusminus:
|
|
421 btg first_FA
|
|
422 movlw d'2'
|
|
423 movwf menupos
|
|
424 bra menu_custom_functions1 ; also debounces switches
|
|
425
|
|
426 toggle_oneorten:
|
|
427 btg second_FA
|
|
428 movlw d'3'
|
|
429 movwf menupos
|
|
430 bra menu_custom_functions1 ; also debounces switches
|
|
431
|
|
432 restore_cfn_value:
|
|
433 movf divemins+0,W ; read default value
|
|
434 addlw 0x80
|
|
435 movwf EEADR
|
|
436 call read_eeprom ; Lowbyte
|
|
437 movff EEDATA,lo
|
|
438 movf divemins+0,W
|
|
439 addlw 0x81
|
|
440 movwf EEADR
|
|
441 call read_eeprom ; Highbyte
|
|
442 movff EEDATA,hi
|
|
443 bcf hi,7 ; clear bit 7 of value
|
|
444
|
|
445 movf divemins+0,W ; store default value
|
|
446 addlw 0x82
|
|
447 movwf EEADR
|
|
448 movff lo,EEDATA
|
|
449 call write_eeprom ; Lowbyte
|
|
450 movf divemins+0,W
|
|
451 addlw 0x83
|
|
452 movwf EEADR
|
|
453 movff hi,EEDATA
|
|
454 call write_eeprom ; Highbyte
|
|
455
|
|
456 movlw d'4'
|
|
457 movwf menupos
|
|
458 bra menu_custom_functions1 ; also debounces switches
|
|
459
|
|
460 adjust_cfn_value:
|
|
461 movf divemins+0,W ; get current value
|
|
462 addlw 0x82
|
|
463 movwf EEADR
|
|
464 call read_eeprom ; Lowbyte
|
|
465 movff EEDATA,lo
|
|
466 movf divemins+0,W
|
|
467 addlw 0x83
|
|
468 movwf EEADR
|
|
469 call read_eeprom ; Highbyte
|
|
470 movff EEDATA,hi
|
|
471
|
|
472 movf divemins+0,W
|
|
473 addlw 0x81
|
|
474 movwf EEADR
|
|
475 call read_eeprom ; Highbyte
|
|
476 movff EEDATA,divemins+1 ; Highbyte of default value
|
|
477
|
|
478 movlw d'1'
|
|
479 cpfseq apnoe_mins ; If apnoe_mins=1 then CF is binary
|
|
480 bra adjust_cfn_value1 ; Not Binary
|
|
481
|
|
482 tstfsz lo ; =0?
|
|
483 setf lo ; No, Set to 255
|
|
484 incf lo,F ; Increase by one
|
|
485 clrf hi ; Delete hi byte (Not required but to make sure...)
|
|
486 bra adjust_cfn_value3 ; Store result
|
|
487
|
|
488 adjust_cfn_value1:
|
|
489 btfss first_FA ; Minus?
|
|
490 bra adjust_cfn_value2 ; No, Plus
|
|
491
|
|
492 movlw d'1'
|
|
493 btfsc second_FA ; -10?
|
|
494 movlw d'10'
|
|
495
|
|
496 subwf lo,F ; substract value
|
|
497 movlw d'0'
|
|
498 btfsc divemins+1,7 ; 8Bit value
|
|
499 subwfb hi,F
|
|
500
|
|
501 movlw b'01111111'
|
|
502 btfsc hi,7 ; >32768?
|
|
503 movwf hi
|
|
504
|
|
505 bra adjust_cfn_value3
|
|
506
|
|
507 adjust_cfn_value2:
|
|
508 movlw d'1'
|
|
509 btfsc second_FA ; +10?
|
|
510 movlw d'10'
|
|
511
|
|
512 addwf lo,F ; add value
|
|
513 movlw d'0'
|
|
514 btfsc divemins+1,7 ; 8Bit value?
|
|
515 addwfc hi,F
|
|
516
|
|
517 btfsc hi,7 ; >32768?
|
|
518 clrf hi
|
|
519
|
|
520 adjust_cfn_value3:
|
|
521 movf divemins+0,W ; Store current value
|
|
522 addlw 0x82
|
|
523 movwf EEADR
|
|
524 movff lo,EEDATA
|
|
525 call write_eeprom ; Lowbyte
|
|
526 movf divemins+0,W
|
|
527 addlw 0x83
|
|
528 movwf EEADR
|
|
529 movff hi,EEDATA
|
|
530 call write_eeprom ; Highbyte
|
|
531 movlw d'5'
|
|
532 movwf menupos
|
|
533 bra menu_custom_functions1 ; also debounces switches
|
|
534
|
|
535 getcustom15_default:
|
|
536 ; # number of requested custom function in wreg
|
|
537 movwf customfunction_temp2
|
|
538
|
|
539 movlw d'31'
|
|
540 cpfsgt customfunction_temp2
|
|
541 bra getcustom15_d2 ; Lower bank
|
|
542
|
|
543 movlw d'1' ; Upper Bank
|
|
544 movwf EEADRH
|
|
545 movlw d'32'
|
|
546 subwf customfunction_temp2,F
|
|
547 bra getcustom15_d3
|
|
548 getcustom15_d2:
|
|
549 clrf EEADRH
|
|
550 getcustom15_d3:
|
|
551 movf customfunction_temp2,W
|
|
552 mullw d'4'
|
|
553 movf PRODL,W ; x4 for adress
|
|
554 addlw d'128'
|
|
555 movwf EEADR ; +130 for LOW Byte of value
|
|
556 call read_eeprom ; Lowbyte
|
|
557 movff EEDATA,lo
|
|
558 incf EEADR,F
|
|
559 call read_eeprom ; Highbyte
|
|
560 movff EEDATA,hi
|
|
561 clrf EEADRH
|
|
562 return ; return
|
|
563
|
|
564 custom_functions_check_divemode: ;displays warning if a critical custom function is not set to default
|
|
565 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
|
|
566 bra check_cf11
|
|
567 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
|
|
568 bra check_cf12
|
|
569 return
|
|
570
|
|
571 custom_functions_check_surfmode: ;displays warning if a critical custom function is not set to default
|
|
572 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
|
|
573 bra check_cf11
|
|
574 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
|
|
575 bra check_cf12
|
|
576 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
|
|
577 bra check_cf17
|
|
578 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
|
|
579 bra check_cf18
|
|
580 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
|
|
581 bra check_cf19
|
|
582 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
|
|
583 bra check_cf29
|
|
584 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
|
|
585 bra check_cf32
|
|
586 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
|
|
587 bra check_cf33
|
|
588 return
|
|
589
|
|
590 check_cf11:
|
|
591 movlw d'11' ; saturation factor
|
|
592 rcall custom_function_check_low ; compares current with default value
|
|
593 call test_and_display_warning ; displays the warning if the custom function is not correct
|
|
594 movlw d'2' ; next in testing row
|
|
595 movwf cf_checker_counter ;
|
|
596 return
|
|
597
|
|
598 check_cf12:
|
|
599 movlw d'12' ; desaturation factor
|
|
600 rcall custom_function_check_high ; compares current with default value
|
|
601 call test_and_display_warning ; displays the warning if the custom function is not correct
|
|
602 movlw d'3' ; next in testing row
|
|
603 movwf cf_checker_counter ;
|
|
604 return
|
|
605
|
|
606 check_cf17:
|
|
607 movlw d'17' ; lower threshold ppO2
|
|
608 rcall custom_function_check_low ; compares current with default value
|
|
609 call test_and_display_warning ; displays the warning if the custom function is not correct
|
|
610 movlw d'4' ; next in testing row
|
|
611 movwf cf_checker_counter ;
|
|
612 return
|
|
613
|
|
614 check_cf18:
|
|
615 movlw d'18' ; upper threshold ppO2
|
|
616 rcall custom_function_check_high ; compares current with default value
|
|
617 call test_and_display_warning ; displays the warning if the custom function is not correct
|
|
618 movlw d'5' ; next in testing row
|
|
619 movwf cf_checker_counter ;
|
|
620 return
|
|
621
|
|
622 check_cf19:
|
|
623 movlw d'19' ; upper threshold ppO2 display
|
|
624 rcall custom_function_check_high ; compares current with default value
|
|
625 call test_and_display_warning ; displays the warning if the custom function is not correct
|
|
626 movlw d'6' ; next in testing row
|
|
627 movwf cf_checker_counter ;
|
|
628 return
|
|
629
|
|
630 check_cf29:
|
|
631 movlw d'6'
|
|
632 movwf cf_checker_counter ; upper limit for CF29, here: used as a temp variable
|
|
633 movlw d'29' ; last deco stop in [m]
|
|
634 rcall custom_function_check_high_limit ; compares current with default value
|
|
635 call test_and_display_warning ; displays the warning if the custom function is not correct
|
|
636 movlw d'7' ; next in testing row
|
|
637 movwf cf_checker_counter ;
|
|
638 return
|
|
639
|
|
640 check_cf32:
|
|
641 movlw d'32' ; GF LOW
|
|
642 rcall custom_function_check_high ; compares current with default value
|
|
643 call test_and_display_warning ; displays the warning if the custom function is not correct
|
|
644 movlw d'8' ; next in testing row
|
|
645 movwf cf_checker_counter ;
|
|
646 return
|
|
647
|
|
648 check_cf33:
|
|
649 movlw d'33' ; GF HIGH
|
|
650 rcall custom_function_check_high ; compares current with default value
|
|
651 call test_and_display_warning ; displays the warning if the custom function is not correct
|
|
652 movlw d'1' ; next in testing row
|
|
653 movwf cf_checker_counter ;
|
|
654 return
|
|
655
|
|
656
|
|
657 test_and_display_warning:
|
|
658 movwf lo ; copy result
|
|
659 tstfsz lo
|
|
660 return ; CF OK
|
|
661 goto custom_warn_surfmode
|
|
662
|
|
663 custom_function_check_low: ; Checks CF (#WREG)
|
|
664 ; Returns WREG=0 if CF is lower then default
|
|
665 movwf temp1 ; save for custom value
|
|
666 call getcustom15_1 ; Get Current Value stored in hi and lo
|
|
667 movff lo,sub_a+0
|
|
668 movff hi,sub_a+1 ; save value
|
|
669
|
|
670 movf temp1,w
|
|
671 call getcustom15_default ; Get Default value stored in hi and lo
|
|
672 movff lo,sub_b+0
|
|
673 movff hi,sub_b+1 ; save value
|
|
674 call sub16 ; sub_c = sub_a - sub_b with "neg_flag" bit set if sub_b > sub_a
|
|
675 btfss neg_flag ; negative?
|
|
676 retlw .255 ; no
|
|
677 retlw .0 ; yes
|
|
678
|
|
679 custom_function_check_high: ; Checks CF (#WREG)
|
|
680 ; Returns WREG=0 if CF is higher then default
|
|
681 movwf temp1 ; save for custom value
|
|
682 call getcustom15_1 ; Get Current Value stored in hi and lo
|
|
683 movff lo,sub_b+0
|
|
684 movff hi,sub_b+1 ; save value
|
|
685
|
|
686 movf temp1,w
|
|
687 call getcustom15_default ; Get Default value stored in hi and lo
|
|
688 movff lo,sub_a+0
|
|
689 movff hi,sub_a+1 ; save value
|
|
690 call sub16 ; sub_c = sub_a - sub_b with "neg_flag" bit set if sub_b > sub_a
|
|
691 btfss neg_flag ; negative?
|
|
692 retlw .255 ; no
|
|
693 retlw .0 ; yes
|
|
694
|
|
695 custom_function_check_high_limit: ; Checks if CF (#WREG) is lower then limit (#cf_checker_counter)
|
|
696 movwf temp1 ; save for custom value
|
|
697 call getcustom15_1 ; Get Current Value stored in hi and lo
|
|
698 movff lo,sub_b+0
|
|
699 movff hi,sub_b+1 ; save value
|
|
700 movff cf_checker_counter, sub_a+0
|
|
701 clrf sub_a+1
|
|
702 call sub16 ; sub_c = sub_a - sub_b with "neg_flag" bit set if sub_b > sub_a
|
|
703 btfss neg_flag ; negative?
|
|
704 retlw .255 ; no
|
|
705 retlw .0 ; yes
|
|
706
|