annotate code_part1/OSTC_code_asm_part1/menu_custom.asm @ 27:29341afd2060

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