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