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