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