Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/menu_ppO2.asm @ 724:03f8a8eec9ae
correct diluent store address
author | heinrichsweikamp |
---|---|
date | Wed, 29 May 2013 14:41:34 +0200 |
parents | 91ae251d379f |
children |
rev | line source |
---|---|
0 | 1 |
2 ; OSTC - diving computer code | |
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR | |
4 | |
5 ; This program is free software: you can redistribute it and/or modify | |
6 ; it under the terms of the GNU General Public License as published by | |
7 ; the Free Software Foundation, either version 3 of the License, or | |
8 ; (at your option) any later version. | |
9 | |
10 ; This program is distributed in the hope that it will be useful, | |
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 ; GNU General Public License for more details. | |
14 | |
15 ; You should have received a copy of the GNU General Public License | |
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | |
18 | |
19 ; Constant ppO2 Setup menu | |
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
21 ; written: 08/04/04 | |
639 | 22 ; last updated: 120920 |
0 | 23 ; known bugs: |
24 ; ToDo: | |
639 | 25 ; |
647 | 26 ; New in 2.52 Diluents stored seperately in EEPROM Bank0 |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
27 ;Byte96-97: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
28 ;Diluent 1 Default (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
29 ;Byte98-99: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
30 ;Diluent 1 Current (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
31 ;Byte100-101: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
32 ;Diluent 2 Default (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
33 ;Byte102-103: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
34 ;Diluent 2 Current (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
35 ;Byte104-105: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
36 ;Diluent 3 Default (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
37 ;Byte106-107: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
38 ;Diluent 3 Current (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
39 ;Byte108-109: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
40 ;Diluent 4 Default (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
41 ;Byte110-111: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
42 ;Diluent 4 Current (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
43 ;Byte112-113: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
44 ;Diluent 5 Default (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
45 ;Byte114-115: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
46 ;Diluent 5 Current (%O2,%He) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
47 ;Byte116: |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
48 ;First Diluent (1-5) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
49 |
0 | 50 menu_const_ppO2: |
51 movlw d'1' | |
52 movwf menupos | |
639 | 53 menu_const_ppO2_return: |
681 | 54 call DISP_ClearScreen |
55 call DISP_ccr_setup_menu_mask | |
639 | 56 call refresh_cursor |
57 call menu_pre_loop_common | |
58 | |
59 menu_const_ppO2_preloop: | |
60 call check_switches_menu | |
61 movlw d'3' | |
62 cpfseq menupos | |
63 bra menu_const_ppO2_preloop2 ; Returns | |
64 movlw d'6' | |
65 movwf menupos | |
681 | 66 call DISP_menu_cursor |
639 | 67 |
68 menu_const_ppO2_preloop2: | |
69 btfsc menubit2 | |
70 bra do_ccr_pre_menu ; call submenu | |
71 btfss menubit | |
72 goto restart ; exit menu, restart | |
73 btfsc onesecupdate | |
74 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag | |
75 bcf onesecupdate ; End of one second tasks | |
76 btfsc sleepmode | |
77 goto restart | |
78 bra menu_const_ppO2_preloop | |
79 | |
80 do_ccr_pre_menu: | |
81 dcfsnz menupos,F | |
82 goto menu_diluentsetup | |
83 dcfsnz menupos,F | |
84 goto menu_const_ppO2_setpoints | |
85 dcfsnz menupos,F | |
86 goto exit_menu_const_ppO2 ; exit... | |
87 dcfsnz menupos,F | |
88 goto exit_menu_const_ppO2 ; exit... | |
89 dcfsnz menupos,F | |
90 goto exit_menu_const_ppO2 ; exit... | |
91 exit_menu_const_ppO2: ; exit... | |
92 movlw d'2' | |
93 movwf menupos | |
94 goto more_menu2 | |
95 | |
96 menu_diluentsetup: | |
97 movlw d'1' | |
98 movwf menupos | |
99 | |
100 menu_diluentsetup_prelist: | |
681 | 101 call DISP_ClearScreen |
639 | 102 call menu_pre_loop_common ; Clear some menu flags, timeout and switches |
717 | 103 call DISP_divemask_color |
642 | 104 DISPLAYTEXT .231 ; Dil. Setup - Gaslist |
717 | 105 call DISP_standard_color |
639 | 106 clrf decodata+0 ; Here: # of gas 0-4 |
107 clrf divemins+0 ; Here: # of Gas * 4 | |
108 movlw d'5' | |
109 movwf waitms_temp ; here: stores row for gas list | |
724 | 110 movlw d'94' |
639 | 111 movwf wait_temp ; here: stores eeprom address for gas list |
112 | |
113 menu_diluentsetup_list: | |
114 WIN_LEFT .20 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
115 movlw d'4' |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
116 addwf wait_temp,F ; Increase eeprom address for diluent list |
639 | 117 movlw d'30' |
118 addwf waitms_temp,F ; Increase row | |
119 movf waitms_temp,W ; Load row into WREG | |
120 movff WREG,win_top | |
121 lfsr FSR2,letter | |
640 | 122 PUTC TXT_DIL_C |
639 | 123 movff decodata+0,lo |
124 incf lo,F | |
125 bsf leftbind | |
126 output_99 | |
127 PUTC ':' | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
128 call word_processor |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
129 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
130 WIN_LEFT .40 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
131 movf waitms_temp,W ; Load row into WREG |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
132 movff WREG,win_top |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
133 lfsr FSR2,letter |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
134 |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
135 movlw d'116' |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
136 movwf EEADR |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
137 call read_eeprom ; Get current startgas 1-5 # into EEDATA |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
138 decf EEDATA,W ; 0-4 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
139 cpfseq decodata+0 ; =current displayed gas #? |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
140 bra menu_diluentsetup_Tx; no, do not display * |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
141 PUTC '*' ; display * |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
142 call word_processor |
639 | 143 |
144 menu_diluentsetup_Tx: | |
145 WIN_LEFT .48 | |
146 movf waitms_temp,W ; Load row into WREG | |
147 movff WREG,win_top | |
148 lfsr FSR2,letter | |
149 | |
724 | 150 movff wait_temp, EEADR ; Gas %O2 - Set address in internal EEPROM |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
151 incf EEADR,F ; Gas %He - Set address in internal EEPROM |
639 | 152 call read_eeprom ; Read He value from EEPROM |
153 movff EEDATA,lo ; Move EEDATA -> lo | |
154 movf lo,f ; Move lo -> f | |
155 movlw d'0' ; Move 0 -> WREG | |
156 cpfsgt lo ; He > 0? | |
157 bra menu_diluentsetup_Nx ; NO check o2 | |
158 | |
159 ; YES Write TX 15/55 | |
642 | 160 STRCAT TXT_TX3 |
639 | 161 movff wait_temp, EEADR ; Gas %O2 - Set address in internal EEPROM |
162 call read_eeprom ; O2 value | |
163 movff EEDATA,lo | |
164 output_8 | |
165 PUTC '/' | |
166 incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM | |
167 call read_eeprom ; He value | |
168 movff EEDATA,lo | |
169 output_8 | |
170 bra menu_diluentsetup_list0 | |
171 | |
172 ; New v1.44se | |
173 menu_diluentsetup_Nx: | |
174 movff wait_temp, EEADR ; Gas %O2 - Set address in internal EEPROM | |
175 call read_eeprom ; Read O2 value from EEPROM | |
176 movff EEDATA,lo ; Move EEDATA -> lo | |
177 movf lo,f ; Move lo -> f | |
178 movlw d'21' ; Move 21 -> WREG | |
179 cpfsgt lo ; o2 > 21% | |
180 bra menu_diluentsetup_Air ; NO AIR | |
181 movlw d'100' ; Move 100 -> WREG | |
182 cpfslt lo ; o2 < 100% | |
183 bra menu_diluentsetup_O2 ; NO write O2 | |
184 | |
185 ; YES Write NX 32 | |
642 | 186 STRCAT TXT_NX3 |
639 | 187 output_8 |
188 bra menu_diluentsetup_list0 | |
189 | |
190 menu_diluentsetup_O2: | |
191 STRCAT TXT_O2_3 | |
192 output_8 | |
193 bra menu_diluentsetup_list0 | |
194 | |
195 menu_diluentsetup_Air: | |
196 cpfseq lo ; o2 = 21% | |
642 | 197 bra menu_diluentsetup_Err |
639 | 198 |
199 STRCAT TXT_AIR4 | |
200 output_8 | |
201 bra menu_diluentsetup_list0 | |
202 | |
203 menu_diluentsetup_Err: | |
204 STRCAT TXT_ERR4 | |
205 output_8 | |
206 | |
207 menu_diluentsetup_list0: | |
208 call word_processor | |
209 | |
210 incf decodata+0,F | |
211 movlw d'5' | |
212 cpfseq decodata+0 | |
213 goto menu_diluentsetup_list | |
214 | |
215 DISPLAYTEXT .11 ; Exit | |
216 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
681 | 217 call DISP_menu_cursor |
639 | 218 |
219 menu_diluentsetup_loop: | |
220 call check_switches_logbook | |
221 | |
222 btfsc menubit3 | |
223 bra menu_diluentsetup_list2 ; move cursor | |
224 | |
225 btfsc menubit2 | |
226 bra do_diluentsetup_list ; call gas-specific submenu | |
227 | |
228 btfsc onesecupdate | |
229 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag | |
230 | |
231 bcf onesecupdate ; 1 sec. functions done | |
232 | |
233 btfsc sleepmode | |
234 bra menu_const_ppO2 | |
235 | |
236 bra menu_diluentsetup_loop | |
237 | |
238 menu_diluentsetup_list2: | |
239 incf menupos,F | |
240 movlw d'7' | |
241 cpfseq menupos ; =7? | |
242 bra menu_diluentsetup_list3 ; No | |
243 movlw d'1' | |
244 movwf menupos | |
245 | |
246 menu_diluentsetup_list3: | |
247 clrf timeout_counter2 | |
681 | 248 call DISP_menu_cursor |
639 | 249 |
250 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
251 | |
252 bcf menubit3 ; clear flag | |
253 bra menu_diluentsetup_loop | |
254 | |
255 | |
256 do_diluentsetup_list: | |
257 dcfsnz menupos,F | |
258 bra diluent_list_edit_gas1 | |
259 dcfsnz menupos,F | |
642 | 260 bra diluent_list_edit_gas2 |
639 | 261 dcfsnz menupos,F |
642 | 262 bra diluent_list_edit_gas3 |
639 | 263 dcfsnz menupos,F |
642 | 264 bra diluent_list_edit_gas4 |
639 | 265 dcfsnz menupos,F |
642 | 266 bra diluent_list_edit_gas5 |
639 | 267 bra menu_const_ppO2 ; Exit List |
268 | |
269 diluent_list_edit_gas1: | |
642 | 270 movlw d'0' ; Diluent Number 0-4 |
271 movwf decodata+0 | |
724 | 272 movlw d'92' ; EEPROM address of Dil 1 %O2 default - 4 |
642 | 273 movwf divemins+0 |
274 bra menu_diluentgas | |
639 | 275 diluent_list_edit_gas2: |
642 | 276 movlw d'1' ; Diluent Number 0-4 |
277 movwf decodata+0 | |
724 | 278 movlw d'96' ; EEPROM address of Dil 2 %O2 default - 4 |
642 | 279 movwf divemins+0 |
280 bra menu_diluentgas | |
639 | 281 diluent_list_edit_gas3: |
642 | 282 movlw d'2' ; Diluent Number 0-4 |
283 movwf decodata+0 | |
724 | 284 movlw d'100' ; EEPROM address of Dil 3 %O2 default - 4 |
642 | 285 movwf divemins+0 |
286 bra menu_diluentgas | |
639 | 287 diluent_list_edit_gas4: |
642 | 288 movlw d'3' ; Diluent Number 0-4 |
289 movwf decodata+0 | |
724 | 290 movlw d'104' ; EEPROM address of Dil 4 %O2 default - 4 |
642 | 291 movwf divemins+0 |
292 bra menu_diluentgas | |
639 | 293 diluent_list_edit_gas5: |
642 | 294 movlw d'4' ; Diluent Number 0-4 |
295 movwf decodata+0 | |
724 | 296 movlw d'108' ; EEPROM address of Dil 5 %O2 default - 4 |
642 | 297 movwf divemins+0 |
298 ; bra menu_diluentgas | |
299 menu_diluentgas: | |
300 movlw d'1' | |
301 movwf menupos | |
302 bcf menubit4 | |
303 bcf first_FA ; Here: =1: -, =0: + | |
304 | |
305 menu_diluentgas0: | |
681 | 306 call DISP_ClearScreen |
642 | 307 WIN_LEFT .20 |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
308 WIN_TOP .185 |
642 | 309 lfsr FSR2, letter |
310 OUTPUTTEXT .11 ; Exit | |
311 STRCAT_PRINT "" | |
312 | |
313 menu_diluentgas1: | |
314 call menu_pre_loop_common ; Clear some menu flags, timeout and switches | |
315 call diluent_title_bar2 ; Displays the title bar with the current Gas info | |
316 | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
317 WIN_TOP .35 |
642 | 318 WIN_LEFT .20 |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
319 lfsr FSR2,letter |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
320 OUTPUTTEXT .88 ; First Gas? |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
321 PUTC ' ' |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
322 |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
323 movlw d'116' |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
324 movwf EEADR |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
325 call read_eeprom ; Get current startgas 1-5 # into EEDATA |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
326 decf EEDATA,W ; 0-4 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
327 cpfseq decodata+0 ; =current displayed gas #? |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
328 bra menu_firstdil0 ; no, display three spaces |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
329 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
330 OUTPUTTEXT .96 ; Yes |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
331 bsf second_FA ; Is first gas |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
332 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
333 bra menu_firstdil1 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
334 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
335 menu_firstdil0: |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
336 bcf second_FA ; Is not first gas |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
337 STRCAT " " ; 3 spaces. |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
338 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
339 menu_firstdil1: |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
340 call word_processor |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
341 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
342 WIN_LEFT .20 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
343 WIN_TOP .65 |
642 | 344 STRCPY TXT_O2_4 |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
345 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
346 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
347 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
348 movwf EEADR |
642 | 349 call read_eeprom ; O2 value |
350 movff EEDATA,lo | |
351 output_8 | |
352 STRCAT_PRINT "% " | |
353 | |
354 ; Show MOD in m | |
355 WIN_LEFT .90 | |
356 lfsr FSR2, letter | |
357 OUTPUTTEXTH .297 ; MOD: | |
358 | |
359 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG | |
360 mullw d'10' | |
361 movff PRODL,xA+0 | |
362 movff PRODH,xA+1 ; ppO2 in [0.01bar] * 10 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
363 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
364 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
365 movwf EEADR |
642 | 366 call read_eeprom ; O2 value |
367 movff EEDATA,xB+0 | |
368 clrf xB+1 | |
369 call div16x16 ; xA/xB=xC with xA as remainder | |
370 movlw d'10' | |
371 subwf xC+0,F ; Subtract 10m... | |
372 movff xC+0,lo | |
373 movlw d'0' | |
374 subwfb xC+1,F | |
375 movff xC+1,hi | |
376 | |
377 output_16 | |
378 STRCAT_PRINT TXT_METER3 | |
379 | |
380 WIN_LEFT .20 | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
381 WIN_TOP .95 |
642 | 382 STRCPY TXT_HE4 |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
383 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
384 addlw 0x07 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
385 movwf EEADR |
642 | 386 call read_eeprom ; He value |
387 movff EEDATA,lo | |
388 output_8 | |
389 STRCAT_PRINT "% " | |
390 | |
391 ; Show END in m | |
392 lfsr FSR2, letter | |
393 WIN_LEFT .90 | |
394 OUTPUTTEXTH .298 ; END: | |
395 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG | |
396 mullw d'10' | |
397 movff PRODL,xA+0 | |
398 movff PRODH,xA+1 ; ppO2 in [0.01bar] * 10 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
399 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
400 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
401 movwf EEADR |
642 | 402 call read_eeprom ; O2 value |
403 movff EEDATA,xB+0 | |
404 clrf xB+1 | |
405 call div16x16 ; xA/xB=xC with xA as remainder | |
406 movlw d'10' | |
407 subwf xC+0,F ; Subtract 10m... | |
408 movff xC+0,lo | |
409 movlw d'0' | |
410 subwfb xC+1,F | |
411 movff xC+1,hi ; lo:hi holding MOD in meters | |
412 movlw d'10' | |
413 addwf lo,F | |
414 movlw d'0' | |
415 addwfc hi,F ; lo:hi holding MOD+10m | |
416 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
417 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
418 addlw 0x07 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
419 movwf EEADR |
642 | 420 call read_eeprom ; He value in % -> EEDATA |
421 movlw d'100' | |
422 movwf xA+0 | |
423 movf EEDATA,W ; He value in % -> EEDATA | |
424 subwf xA+0,F ; xA+0 = 100 - He Value in % | |
425 clrf xA+1 | |
426 movff lo,xB+0 | |
427 movff hi,xB+1 ; Copy MOD+10 | |
428 call mult16x16 ; xA*xB=xC | |
429 movff xC+0,xA+0 | |
430 movff xC+1,xA+1 | |
431 movlw d'100' | |
432 movwf xB+0 | |
433 clrf xB+1 | |
434 call div16x16 ; xA/xB=xC with xA as remainder | |
435 ; xC:2 = ((MOD+10) * 100 - HE Value in %) / 100 | |
436 movlw d'10' | |
437 subwf xC+0,F ; Subtract 10m... | |
438 movff xC+0,lo | |
439 movlw d'0' | |
440 subwfb xC+1,F | |
441 movff xC+1,hi | |
442 output_16 | |
443 STRCAT_PRINT TXT_METER3 | |
444 | |
445 WIN_LEFT .20 | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
446 WIN_TOP .125 |
642 | 447 STRCPY "+/-: " |
448 movlw '+' | |
449 btfsc first_FA | |
450 movlw '-' | |
451 movwf POSTINC2 | |
452 call word_processor | |
453 | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
454 WIN_TOP .155 |
642 | 455 lfsr FSR2,letter |
456 OUTPUTTEXT .89 ; Default: | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
457 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
458 addlw 0x04 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
459 movwf EEADR |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
460 call read_eeprom ; Default O2 value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
461 movff EEDATA,lo |
642 | 462 output_8 |
463 PUTC '/' | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
464 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
465 addlw 0x05 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
466 movwf EEADR |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
467 call read_eeprom ; Default He value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
468 movff EEDATA,lo |
642 | 469 output_8 |
470 STRCAT_PRINT " " | |
471 | |
472 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
681 | 473 call DISP_menu_cursor |
642 | 474 |
475 diluentgassetup_loop: | |
476 call check_switches_logbook | |
477 | |
478 btfsc menubit3 | |
479 bra diluentgassetup2 ; move cursor | |
480 | |
481 btfsc menubit2 | |
482 bra do_diluentgassetup ; call submenu | |
483 | |
484 btfsc onesecupdate | |
485 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag | |
486 | |
487 bcf onesecupdate ; 1 sec. functions done | |
488 | |
489 btfsc sleepmode | |
490 bra exit_menu_const_ppO2 | |
491 | |
492 bra diluentgassetup_loop | |
493 | |
494 diluentgassetup2: | |
495 incf menupos,F | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
496 movlw d'7' |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
497 cpfseq menupos ; =7? |
642 | 498 bra diluentgassetup3 ; No |
499 movlw d'1' | |
500 movwf menupos | |
501 | |
502 diluentgassetup3: | |
503 clrf timeout_counter2 | |
681 | 504 call DISP_menu_cursor |
642 | 505 |
506 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
507 | |
508 bcf menubit3 ; clear flag | |
509 bra diluentgassetup_loop | |
510 | |
511 do_diluentgassetup: | |
512 dcfsnz menupos,F | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
513 bra make_first_diluent |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
514 dcfsnz menupos,F |
642 | 515 bra adjust_o2_diluent |
516 dcfsnz menupos,F | |
517 bra adjust_he_diluent | |
518 dcfsnz menupos,F | |
519 bra toggle_plus_minus_diluentsetup | |
520 dcfsnz menupos,F | |
521 bra restore_gas_diluent | |
522 exit_diluentgassetup: ; exit... | |
523 movff decodata+0,menupos | |
524 incf menupos,F | |
525 bra menu_diluentsetup_prelist | |
526 | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
527 make_first_diluent: |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
528 movff decodata+0,EEDATA ; current gas (0-4) into EEDATA |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
529 incf EEDATA,F ; current gas (1-5) into EEDATA |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
530 movlw d'116' |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
531 movwf EEADR |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
532 call write_eeprom ; store in internal EEPROM |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
533 movlw d'1' |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
534 movwf menupos |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
535 bra menu_diluentgas1 ; return |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
536 |
642 | 537 toggle_plus_minus_diluentsetup: |
538 btg first_FA | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
539 movlw d'4' |
642 | 540 movwf menupos |
541 bra menu_diluentgas1 ; return | |
542 | |
543 adjust_o2_diluent: | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
544 movf divemins+0,W ; read current value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
545 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
546 movwf EEADR |
642 | 547 call read_eeprom ; Low-value |
548 movff EEDATA,lo | |
549 | |
550 btfsc first_FA ; Minus? | |
551 bra adjust_o2_1_diluent ; yes, minus! | |
552 | |
553 incf lo,F ; increase O2 | |
554 movlw d'101' | |
555 cpfseq lo | |
556 bra adjust_o2_2_diluent | |
557 movlw d'4' ; LOWER O2 Limit | |
558 movwf lo | |
559 bra adjust_o2_2_diluent | |
560 | |
561 adjust_o2_1_diluent: | |
562 decf lo,F ; decrease O2 | |
563 movlw d'3' | |
564 cpfseq lo | |
565 bra adjust_o2_2_diluent | |
566 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
567 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
568 addlw 0x07 |
642 | 569 movwf EEADR |
570 call read_eeprom ; read He value | |
571 | |
572 movlw d'100' | |
573 movwf lo | |
574 movf EEDATA,W ; He value | |
575 subwf lo,F ; lo=100% - He% | |
576 | |
577 adjust_o2_2_diluent: ; test if O2+He>100... | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
578 addlw 0x07 |
642 | 579 movwf EEADR |
580 call read_eeprom ; read He value | |
581 movf EEDATA,W ; He value | |
582 addwf lo,W ; add O2 value | |
583 movwf hi ; store in temp | |
584 movlw d'101' | |
585 cpfseq hi ; O2 and He > 100? | |
586 bra adjust_o2_3_diluent ; No! | |
587 | |
588 movlw d'4' ; LOWER O2 Limit | |
589 movwf lo | |
590 | |
591 adjust_o2_3_diluent: | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
592 movf divemins+0,W ; save current value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
593 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
594 movwf EEADR |
642 | 595 movff lo,EEDATA |
596 call write_eeprom ; Low-value | |
597 | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
598 movlw d'2' |
642 | 599 movwf menupos |
600 bra menu_diluentgas1 ; return | |
601 | |
602 adjust_he_diluent: | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
603 movf divemins+0,W ; read current value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
604 addlw 0x07 |
652 | 605 movwf EEADR ; read current value (He) |
642 | 606 call read_eeprom ; Low-value |
607 movff EEDATA,lo | |
608 | |
609 btfsc first_FA ; Minus? | |
610 bra adjust_he_1_diluent ; yes, minus! | |
611 | |
612 incf lo,F | |
652 | 613 movlw d'99' ; He limited to (useless) 99% |
642 | 614 cpfseq lo |
615 bra adjust_he_2_diluent | |
616 clrf lo | |
617 bra adjust_he_2_diluent | |
618 | |
619 adjust_he_1_diluent: | |
620 decf lo,F ; decrease He | |
621 movlw d'255' | |
622 cpfseq lo | |
623 bra adjust_he_2_diluent | |
652 | 624 clrf lo ; limit to zero |
642 | 625 |
652 | 626 adjust_he_2_diluent: ; test if O2+He>100... |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
627 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
628 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
629 movwf EEADR |
652 | 630 call read_eeprom ; Low-value |
631 movf EEDATA,W | |
632 addwf lo,W ; add He value | |
642 | 633 movwf hi ; store in temp |
634 movlw d'101' | |
652 | 635 cpfseq hi ; O2 and He > 100? |
636 bra adjust_he_3_diluent ; No! | |
642 | 637 ; clrf lo ; Yes, clear He to zero |
638 decf lo,F ; reduce He again = unchanged after operation | |
639 | |
640 adjust_he_3_diluent: | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
641 movf divemins+0,W ; save current value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
642 addlw 0x07 |
642 | 643 movwf EEADR |
644 movff lo,EEDATA | |
652 | 645 call write_eeprom ; Low-value |
642 | 646 |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
647 movlw d'3' |
642 | 648 movwf menupos |
652 | 649 bra menu_diluentgas1; |
642 | 650 |
651 restore_gas_diluent: | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
652 movf divemins+0,W ; read Default value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
653 addlw 0x04 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
654 movwf EEADR |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
655 call read_eeprom ; Low-value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
656 movff EEDATA,lo |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
657 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
658 addlw 0x05 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
659 movwf EEADR |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
660 call read_eeprom ; High-value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
661 movff EEDATA,hi |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
662 |
724 | 663 movf divemins+0,W ; save current value |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
664 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
665 movwf EEADR |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
666 movff lo,EEDATA |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
667 call write_eeprom ; Low-value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
668 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
669 addlw 0x07 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
670 movwf EEADR |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
671 movff hi,EEDATA |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
672 call write_eeprom ; High-value |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
673 |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
674 movlw d'5' |
642 | 675 movwf menupos |
676 bra menu_diluentgas1 | |
677 | |
678 | |
679 diluent_title_bar2: | |
717 | 680 ; call DISP_topline_box |
681 call DISP_divemask_color | |
642 | 682 WIN_TOP .2 |
683 WIN_LEFT .30 | |
684 lfsr FSR2,letter | |
685 STRCAT TXT_DIL5 ; Dil.# | |
686 movff decodata+0,lo | |
687 incf lo,F | |
688 bsf leftbind | |
689 output_99 | |
690 STRCAT_PRINT ": " | |
691 | |
692 WIN_TOP .2 | |
693 WIN_LEFT .80 | |
694 lfsr FSR2,letter | |
695 | |
696 ;He check | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
697 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
698 addlw 0x07 |
642 | 699 movwf EEADR |
700 call read_eeprom ; He value | |
701 movff EEDATA,lo ; Move EEData -> lo | |
702 movf lo,f ; Move lo -> f | |
703 movlw d'0' ; Move 0 -> WREG | |
704 cpfsgt lo ; He > 0? | |
705 bra diluent_title_bar3 ; NO check o2 | |
706 | |
707 ; YES Write TX 15/55 | |
708 STRCAT TXT_TX3 | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
709 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
710 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
711 movwf EEADR |
642 | 712 call read_eeprom ; O2 value |
713 movff EEDATA,lo | |
714 output_8 ; Write O2 | |
715 PUTC '/' | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
716 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
717 addlw 0x07 |
642 | 718 movwf EEADR |
719 call read_eeprom ; He value | |
720 movff EEDATA,lo | |
721 output_8 ; Write He | |
722 bra diluent_title_bar7 | |
723 | |
724 ; New v1.44se | |
725 diluent_title_bar3: ; O2 Check | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
726 movf divemins+0,W |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
727 addlw 0x06 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
728 movwf EEADR |
642 | 729 call read_eeprom ; O2 value |
730 movff EEDATA,lo | |
731 movf lo,f ; Move lo -> f | |
732 movlw d'21' ; Move 21 -> WREG | |
733 cpfseq lo ; o2 = 21 | |
734 cpfsgt lo ; o2 > 21% | |
735 bra diluent_title_bar5 ; NO AIR | |
736 movlw d'100' ; Move 100 -> WREG | |
737 cpfslt lo ; o2 < 100% | |
738 bra diluent_title_bar4 ; NO write O2 | |
739 | |
740 ; YES Write NX 32 | |
741 STRCAT TXT_NX3 | |
742 output_8 | |
743 bra diluent_title_bar7 | |
744 | |
745 ; New v1.44se | |
746 diluent_title_bar4: | |
747 STRCAT TXT_O2_3 | |
748 output_8 | |
749 bra diluent_title_bar7 | |
750 | |
751 ; New v1.44se | |
752 diluent_title_bar5: | |
753 cpfseq lo ; o2 = 21% | |
754 bra diluent_title_bar6 | |
755 | |
756 STRCAT TXT_AIR4 | |
757 output_8 | |
758 bra diluent_title_bar7 | |
759 | |
760 ; New v1.44se | |
761 diluent_title_bar6: ; ERROR | |
762 STRCAT TXT_ERR4 | |
763 output_8 | |
764 ;bra diluent_title_bar7 | |
765 | |
766 diluent_title_bar7: | |
767 STRCAT_PRINT "" | |
717 | 768 call DISP_standard_color |
642 | 769 return |
770 | |
639 | 771 |
772 ; *** | |
773 | |
774 | |
775 | |
776 | |
777 | |
778 | |
779 | |
780 menu_const_ppO2_setpoints: ; Setpoint menu | |
781 movlw d'1' | |
782 movwf menupos | |
0 | 783 |
784 bcf menubit4 | |
785 clrf decodata+0 ; Here: # of SP | |
786 bcf first_FA ; Here: =1: -, =0: + | |
787 bcf second_FA ; Here: =1: 1, =0: 10 steps | |
788 | |
789 menu_const_ppO20: | |
681 | 790 call DISP_ClearScreen |
717 | 791 call DISP_divemask_color |
0 | 792 DISPLAYTEXT .111 ; Constant ppO2 Setup |
717 | 793 call DISP_standard_color |
794 | |
0 | 795 |
796 menu_const_ppO21: | |
797 WIN_LEFT .20 | |
798 WIN_TOP .35 | |
799 lfsr FSR2,letter | |
800 OUTPUTTEXT .112 ; SP# | |
801 movff decodata+0,lo | |
802 incf lo,F | |
803 bsf leftbind | |
804 output_99 | |
123 | 805 STRCAT " (" |
0 | 806 |
807 OUTPUTTEXT d'192' ; Dil. | |
123 | 808 PUTC ' ' |
0 | 809 |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
810 rcall get_first_diluent ; Read first diluent into lo(O2) and hi(He) |
0 | 811 bsf leftbind |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
812 output_99 ; O2 |
123 | 813 PUTC '/' |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
814 movff hi,lo |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
815 output_99 ; He |
123 | 816 STRCAT_PRINT ")" |
0 | 817 |
818 WIN_LEFT .20 | |
819 WIN_TOP .65 | |
820 | |
821 lfsr FSR2,letter | |
822 OUTPUTTEXT .97 ; "Current: " | |
823 movf decodata+0,W | |
824 addlw d'36' ; offset in eeprom | |
825 movwf EEADR | |
826 call read_eeprom ; ppO2 value | |
827 movff EEDATA,lo | |
828 clrf hi | |
829 bsf leftbind | |
830 output_16dp d'3' | |
831 bcf leftbind | |
445 | 832 STRCAT_PRINT TXT_BAR4 |
0 | 833 |
834 WIN_LEFT .20 | |
835 WIN_TOP .95 | |
836 | |
837 lfsr FSR2,letter | |
838 OUTPUTTEXT d'190' ; ppO2 + | |
839 call word_processor | |
840 | |
841 WIN_LEFT .20 | |
842 WIN_TOP .125 | |
843 | |
844 lfsr FSR2,letter | |
845 OUTPUTTEXT d'191' ; ppO2 - | |
846 call word_processor | |
847 | |
848 WIN_LEFT .20 | |
849 WIN_TOP .155 | |
850 | |
851 lfsr FSR2,letter | |
852 OUTPUTTEXT .89 ; "Default: " | |
123 | 853 STRCAT_PRINT "1.00" |
0 | 854 |
855 DISPLAYTEXT .11 ; Exit | |
856 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
576 | 857 call menu_pre_loop_common ; Clear some menu flags, timeout and switches |
681 | 858 call DISP_menu_cursor |
0 | 859 |
860 menu_const_ppO2_loop: | |
861 call check_switches_logbook | |
862 | |
863 btfsc menubit3 | |
575 | 864 bra menu_const_ppO22 ; move cursor |
0 | 865 |
866 btfsc menubit2 | |
575 | 867 bra do_menu_const_ppO2 ; call submenu |
0 | 868 |
869 btfsc onesecupdate | |
575 | 870 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag |
0 | 871 |
872 bcf onesecupdate ; 1 sec. functions done | |
873 | |
874 btfsc sleepmode | |
575 | 875 bra exit_menu_const_ppO2 |
0 | 876 |
575 | 877 bra menu_const_ppO2_loop |
0 | 878 |
879 menu_const_ppO22: | |
880 incf menupos,F | |
881 | |
882 movlw d'2' | |
883 cpfseq menupos ; =2? | |
884 bra menu_const_ppO22a ; No | |
885 incf menupos,F ; Skip pos. 2 | |
886 | |
887 menu_const_ppO22a: | |
888 movlw d'7' | |
889 cpfseq menupos ; =7? | |
890 bra menu_const_ppO23 ; No | |
891 movlw d'1' | |
892 movwf menupos | |
893 | |
894 menu_const_ppO23: | |
576 | 895 call menu_pre_loop_common ; Clear some menu flags, timeout and switches |
681 | 896 call DISP_menu_cursor |
0 | 897 bra menu_const_ppO2_loop |
898 | |
899 do_menu_const_ppO2: | |
900 dcfsnz menupos,F | |
901 bra next_ppO2 | |
902 dcfsnz menupos,F | |
903 bra change_ppo2_plus | |
904 dcfsnz menupos,F | |
905 bra change_ppo2_plus | |
906 dcfsnz menupos,F | |
907 bra change_ppo2_minus | |
908 dcfsnz menupos,F | |
909 bra change_ppo2_reset | |
910 movlw d'2' | |
911 movwf menupos | |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
912 goto menu_const_ppO2_return |
0 | 913 |
914 change_ppo2_plus: | |
915 movf decodata+0,W ; read current value | |
916 addlw d'36' ; offset in memory | |
917 movwf EEADR | |
918 call read_eeprom ; Low-value | |
919 movff EEDATA,lo | |
920 | |
921 incf lo,F ; increase depth | |
922 movlw d'251' | |
923 cpfseq lo | |
924 bra change_ppo2_plus2 | |
925 movlw d'250' | |
926 movwf lo | |
927 change_ppo2_plus2: | |
928 movff lo,EEDATA ; write result | |
929 call write_eeprom ; save result in EEPROM | |
930 movlw d'3' | |
931 movwf menupos | |
932 bra menu_const_ppO21 | |
933 | |
934 change_ppo2_minus: | |
935 movf decodata+0,W ; read current value | |
936 addlw d'36' ; offset in memory | |
937 movwf EEADR | |
938 call read_eeprom ; Low-value | |
939 movff EEDATA,lo | |
940 | |
941 decf lo,F ; decrease depth | |
942 movlw d'255' | |
943 cpfseq lo | |
944 bra change_ppo2_minus2 | |
945 movlw d'0' | |
946 movwf lo | |
947 | |
948 change_ppo2_minus2: | |
949 movff lo,EEDATA ; write result | |
950 call write_eeprom ; save result in EEPROM | |
951 | |
952 movlw d'4' | |
953 movwf menupos | |
576 | 954 bra menu_const_ppO21 |
0 | 955 |
956 change_ppo2_reset: ; reset to 1.00Bar | |
957 movf decodata+0,W ; read current value | |
958 addlw d'36' ; offset in memory | |
959 movwf EEADR | |
960 movlw d'100' | |
961 movwf EEDATA | |
962 call write_eeprom ; save result in EEPROM | |
963 movlw d'5' | |
964 movwf menupos | |
965 bra menu_const_ppO21 | |
966 | |
967 next_ppO2: | |
968 incf decodata+0,F | |
969 movlw d'3' | |
970 cpfseq decodata+0 ; =3? | |
971 bra next_ppO22 | |
972 clrf decodata+0 ; yes, so reset to zero | |
973 next_ppO22: | |
974 movlw d'1' | |
975 movwf menupos | |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
976 bra menu_const_ppO21 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
977 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
978 get_first_diluent: ; Read first diluent into lo(O2) and hi(He) |
685
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
979 read_int_eeprom d'116' ; Read First Diluent (1-5) |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
980 movf EEDATA,W ; WREG: 0-4 |
aebb6d039249
Use 4byte in EEPROM for diluents (Same as OC gases)
heinrichsweikamp
parents:
681
diff
changeset
|
981 mullw .4 ; PRODL: 0-16 |
724 | 982 movlw .94 ; Base address for O2 |
655
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
983 addwf PRODL,W |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
984 movwf EEADR |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
985 call read_eeprom ; Read O2 |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
986 movff EEDATA,lo |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
987 incf EEADR,F |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
988 call read_eeprom ; Read He |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
989 movff EEDATA,hi |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
990 return |
8c01edcf57fc
Allow any diluent to be "First gas" in CCR modes
heinrichsweikamp
parents:
652
diff
changeset
|
991 |