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