Mercurial > public > hwos_code
annotate src/gaslist.asm @ 550:5ac0733d550a
2.26 stable release (DE_EN)
author | heinrichsweikamp |
---|---|
date | Wed, 27 Sep 2017 09:55:15 +0200 |
parents | 9a17b1db095b |
children | b7eb98dbd800 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
3 ; File gaslist.asm | |
4 ; | |
275 | 5 ; Managing OSTC gas list |
0 | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-08-11 : [jDG] Creation. | |
11 | |
275 | 12 #include "hwos.inc" ; Mandatory header |
0 | 13 #include "convert.inc" |
14 #include "math.inc" ; div16x16 for MOD calculations | |
15 #include "strings.inc" | |
16 #include "tft.inc" | |
17 #include "tft_outputs.inc" | |
18 | |
19 #include "shared_definitions.h" | |
20 | |
21 CBLOCK tmp+0x40 ; Keep space for menu processor | |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
160
diff
changeset
|
22 gaslist_gas ; Check ram position in menu_tree.asm, too! |
0 | 23 gaslist_O2 |
24 gaslist_He | |
25 gaslist_depth | |
26 gaslist_Type | |
27 ; Reserved to tmp+0x5F | |
28 ENDC | |
29 | |
30 extern convert_mbar_to_feet | |
31 | |
32 gui CODE | |
33 ;============================================================================= | |
34 ; Append gas description to current string. | |
35 ; Input: PRODL : gas number (0..4) | |
36 ; FSR2 : Current string position. | |
37 ; Output: Text appended into buffer pointed by FSR2. | |
38 extern customview_show_mix | |
39 global gaslist_strcat_gas | |
40 gaslist_strcat_gas: | |
41 rcall gaslist_setgas ; Sets gaslist_gas (0-4 for OC/Bailout, 5-9 for Diluents) | |
42 ; Retrieve gas definition: | |
43 gaslist_strcat_gas_0: | |
44 movf gaslist_gas,W | |
45 lfsr FSR1,opt_gas_O2_ratio ; Read opt_gas_O2_ratio[WREG] | |
46 movff PLUSW1,gaslist_O2 | |
47 movf gaslist_gas,W | |
48 lfsr FSR1,opt_gas_He_ratio ; Read opt_gas_He_ratio[WREG] | |
49 movff PLUSW1,gaslist_He | |
50 | |
51 movff gaslist_O2,lo | |
52 movff gaslist_He,hi | |
540
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
53 goto customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2, and RETURN |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
54 |
0 | 55 |
56 | |
57 ;============================================================================= | |
58 ; Append current mix to current string (For divemode) | |
59 ; Input: FSR2 : Current string position. | |
60 ; Output: Text appended into buffer pointed by FSR2. | |
61 global gaslist_strcat_gasx | |
62 gaslist_strcat_gasx: ; Show current O2/He mix | |
63 STRCAT_TEXT tGas | |
64 STRCAT ": " | |
65 movff char_I_O2_ratio,lo | |
66 movff char_I_He_ratio,hi | |
540
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
67 goto customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2, and RETURN |
0 | 68 |
69 global gaslist_show_type | |
70 extern tGasDisabled | |
71 extern tDilDisabled | |
72 gaslist_show_type: | |
73 movf gaslist_gas,W | |
74 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG] | |
75 movff PLUSW1,gaslist_Type | |
76 STRCAT_TEXT tType | |
77 lfsr FSR1,tGasDisabled ; Base text number | |
78 btfsc ccr_diluent_setup ; In CCR setup? | |
79 lfsr FSR1,tDilDisabled ; Base text number | |
80 movff gaslist_Type,WREG ; 0-3 | |
81 rlncf WREG ; x2 | |
82 addwf FSR1L,F | |
83 movlw .0 | |
84 addwfc FSR1H,F | |
85 call strcat_text | |
86 return | |
87 | |
88 global gaslist_toggle_type | |
89 gaslist_toggle_type: | |
90 movf gaslist_gas,W | |
91 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG] | |
92 movff PLUSW1,gaslist_Type | |
93 incf gaslist_Type,F ; 0-3/0-2 | |
94 btfsc ccr_diluent_setup ; In CCR setup? | |
95 bra gaslist_toggle_type2 ; Yes | |
96 btfsc gaslist_Type,2 ; >3? | |
97 clrf gaslist_Type ; Clear to zero | |
98 movff gaslist_Type,PLUSW1 ; Copy back result | |
99 return | |
100 | |
101 gaslist_toggle_type2: | |
102 movlw .3 | |
103 cpfslt gaslist_Type ; >2? | |
104 clrf gaslist_Type ; Clear to zero | |
105 movf gaslist_gas,W | |
106 movff gaslist_Type,PLUSW1 ; Copy back result | |
107 return | |
108 | |
109 global gaslist_setSP | |
110 gaslist_setSP: | |
111 movff PRODL,gaslist_gas ; 0-4 | |
112 return | |
113 | |
114 extern tbar | |
115 global gaslist_strcat_setpoint | |
116 global gaslist_strcat_setpoint_0 | |
117 gaslist_strcat_setpoint: | |
118 call gaslist_setSP | |
119 gaslist_strcat_setpoint_0: | |
120 bsf leftbind | |
121 btfsc short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
122 bra gaslist_strcat_setpoint2 ; Short version | |
123 STRCAT_TEXT tSP | |
124 incf gaslist_gas,W | |
125 movwf lo | |
126 output_8 | |
127 bcf leftbind | |
128 PUTC ":" | |
129 gaslist_strcat_setpoint2: ; Short version | |
130 btfsc divemode | |
131 bra gaslist_strcat_setpoint4 ; no "*" in divemode | |
95
3dfc2b7ced6d
BUGFIX: Show "*" always in front of the initial Setpoint 1
heinrichsweikamp
parents:
50
diff
changeset
|
132 movf gaslist_gas,W ; Number-1 into WREG |
3dfc2b7ced6d
BUGFIX: Show "*" always in front of the initial Setpoint 1
heinrichsweikamp
parents:
50
diff
changeset
|
133 bnz gaslist_strcat_setpoint3 ; Not SP1 |
0 | 134 PUTC "*" |
135 bra gaslist_strcat_setpoint4 | |
136 gaslist_strcat_setpoint3: | |
137 PUTC " " | |
138 gaslist_strcat_setpoint4: | |
139 movf gaslist_gas,W | |
140 lfsr FSR1,char_I_setpoint_cbar | |
141 movf PLUSW1,W | |
142 movwf lo | |
143 clrf hi | |
144 bsf leftbind | |
145 output_16dp d'3' | |
146 btfsc divemode | |
147 bra gaslist_strcat_setpoint5 ; Skip text in divemode | |
148 STRCAT_TEXT tbar | |
149 gaslist_strcat_setpoint5: | |
150 PUTC " " | |
151 ; Read switch depth | |
152 movf gaslist_gas,W | |
153 lfsr FSR1,char_I_setpoint_change | |
154 movff PLUSW1,lo | |
534 | 155 |
156 bsf ccr_diluent_setup ; inhibit output of "----" for depth | |
157 call gaslist_strcat_5 | |
158 bcf ccr_diluent_setup | |
159 return | |
0 | 160 |
161 ;---------------------------------------------------------------------------- | |
162 ; Append gas description to current string. | |
163 ; Input: PRODL : gas number (0..4) | |
164 ; FSR2 : Current string position. | |
165 ; Output: Text appended into buffer pointed by FSR2. | |
166 ; | |
167 ; NOTE: used in the menu-tree for the MENU_CALLBACK entry. | |
168 | |
169 gaslist_strcat_gas_better: ; Yes, check if this is a "better gas" | |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
174
diff
changeset
|
170 bcf win_invert |
160
99ac325586ce
BUGFIX: Fast diluent (w/o dive mode menu) change did not work correctly
heinrichsweikamp
parents:
154
diff
changeset
|
171 decf better_gas_number,W ; better_gas_number-1 -> WREG |
99ac325586ce
BUGFIX: Fast diluent (w/o dive mode menu) change did not work correctly
heinrichsweikamp
parents:
154
diff
changeset
|
172 btfsc ccr_diluent_setup ; in CCR menus? |
99ac325586ce
BUGFIX: Fast diluent (w/o dive mode menu) change did not work correctly
heinrichsweikamp
parents:
154
diff
changeset
|
173 addlw .5 ; Yes, offset to gases 5-9 |
99ac325586ce
BUGFIX: Fast diluent (w/o dive mode menu) change did not work correctly
heinrichsweikamp
parents:
154
diff
changeset
|
174 cpfseq gaslist_gas ; 0-4 for OC/Bailout, 5-9 for Diluents |
0 | 175 return |
50 | 176 call TFT_attention_color ; show in yellow |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
174
diff
changeset
|
177 bsf win_invert ; And invert |
0 | 178 return |
179 | |
180 global gaslist_strcat_gas_mod | |
181 gaslist_strcat_gas_mod: | |
182 rcall gaslist_setgas ; Sets gaslist_gas (0-4 for OC/Bailout, 5-9 for Diluents) | |
183 | |
184 global gaslist_gastitle | |
185 gaslist_gastitle: | |
186 btfsc short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
187 bra gaslist_gastitle2 ; Short version | |
188 STRCAT_TEXT tGas | |
189 incf gaslist_gas,W | |
190 movwf lo | |
191 bsf leftbind | |
192 output_8 | |
193 bcf leftbind | |
194 PUTC ":" | |
195 | |
196 gaslist_gastitle2: ; Short version | |
197 lfsr FSR1,opt_gas_type | |
198 btfsc divemode | |
199 bra gaslist_gastitle3 ; no "*" in divemode | |
200 movf gaslist_gas,W | |
201 decf PLUSW1,W ; Type-1 into WREG | |
202 bnz gaslist_gastitle1 ; Not "First" | |
203 PUTC "*" | |
204 bra gaslist_gastitle3 | |
205 gaslist_gastitle1: | |
206 PUTC " " | |
207 gaslist_gastitle3: ; Short version | |
208 call TFT_standard_color | |
209 | |
210 btfsc divemode ; In divemode? | |
211 rcall gaslist_strcat_gas_better ; Yes, check if this is a "better gas" | |
212 | |
213 movf gaslist_gas,W ; (0-4 for OC/Bailout, 5-9 for Diluents) | |
214 movf PLUSW1,W | |
215 bnz gaslist_strcat_3 | |
216 call TFT_disabled_color | |
540
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
217 bra gaslist_strcat_4 ; NEW ; No MOD-check and red color for disabled gases |
0 | 218 gaslist_strcat_3: |
521
06e9370c6d75
CHANGE: Apply safety margin parameters to both models (GF and non-GF)
heinrichsweikamp
parents:
518
diff
changeset
|
219 rcall gaslist_strcat_gas_0 |
06e9370c6d75
CHANGE: Apply safety margin parameters to both models (GF and non-GF)
heinrichsweikamp
parents:
518
diff
changeset
|
220 PUTC " " |
0 | 221 ; Read switch depth |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
222 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents-5 |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
223 movlw .4 |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
224 cpfsgt gaslist_gas ; >4? (-> Diluents) |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
225 lfsr FSR1,opt_OC_bail_gas_change ; Setup OC Gases |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
226 |
0 | 227 movf gaslist_gas,W ; (0-4 for OC/Bailout, 5-9 for Diluents) |
228 movff PLUSW1,lo | |
229 rcall gaslist_calc_mod ; Compute MOD into WREG | |
230 cpfsgt lo | |
521
06e9370c6d75
CHANGE: Apply safety margin parameters to both models (GF and non-GF)
heinrichsweikamp
parents:
518
diff
changeset
|
231 bra gaslist_strcat_5 |
540
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
232 call TFT_warnings_color ; Turn red if bigger |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
233 bra gaslist_strcat_5 ; skip gaslist_strcat_gas_0 here |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
234 gaslist_strcat_4: |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
235 rcall gaslist_strcat_gas_0 |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
236 PUTC " " |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
237 |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
238 ; Dummy code, needs some cleanup somedays... |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
239 ; Read switch depth |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
240 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents-5 |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
241 movlw .4 |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
242 cpfsgt gaslist_gas ; >4? (-> Diluents) |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
243 lfsr FSR1,opt_OC_bail_gas_change ; Setup OC Gases |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
244 |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
245 movf gaslist_gas,W ; (0-4 for OC/Bailout, 5-9 for Diluents) |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
246 movff PLUSW1,lo |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
247 ;rcall gaslist_calc_mod ; Compute MOD into WREG |
521
06e9370c6d75
CHANGE: Apply safety margin parameters to both models (GF and non-GF)
heinrichsweikamp
parents:
518
diff
changeset
|
248 |
06e9370c6d75
CHANGE: Apply safety margin parameters to both models (GF and non-GF)
heinrichsweikamp
parents:
518
diff
changeset
|
249 gaslist_strcat_5: |
518
72f6cb65ca4a
BUGFIX: Do not check ppO2 for disabled gases
heinrichsweikamp
parents:
507
diff
changeset
|
250 TSTOSS opt_units ; 0=Meters, 1=Feets |
540
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
251 bra gaslist_strcat_3_metric |
0 | 252 ;gaslist_strcat_3_imperial: |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
160
diff
changeset
|
253 btfsc ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") |
540
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
254 bra gaslist_imperial_non_travel |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
160
diff
changeset
|
255 movf gaslist_gas,W |
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
160
diff
changeset
|
256 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG] |
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
160
diff
changeset
|
257 movff PLUSW1,gaslist_Type |
540
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
258 movlw .2 ; 2=Travel |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
259 cpfseq gaslist_Type |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
260 bra gaslist_imperial_non_travel ; Non-Travel Gas |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
261 bra gaslist_strcat_depth_travel ; Show "---" instead of "0m"... |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
160
diff
changeset
|
262 |
540
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
263 gaslist_imperial_non_travel: |
0 | 264 movf lo,W |
265 mullw .100 ; convert meters to mbar | |
266 movff PRODL,lo | |
267 movff PRODH,hi | |
540
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
268 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
0 | 269 bsf leftbind |
225
31088352ee32
BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents:
189
diff
changeset
|
270 output_16_3 ; limit to 999 and display only (0-999) |
0 | 271 STRCAT_TEXT tFeets ; "ft" |
272 return | |
273 | |
274 gaslist_strcat_3_metric: | |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
160
diff
changeset
|
275 btfsc ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") |
540
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
276 bra gaslist_metric_non_travel |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
160
diff
changeset
|
277 movf gaslist_gas,W |
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
160
diff
changeset
|
278 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG] |
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
160
diff
changeset
|
279 movff PLUSW1,gaslist_Type |
540
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
280 movlw .2 ; 2=Travel |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
281 cpfseq gaslist_Type |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
282 bra gaslist_metric_non_travel ; Non-Travel Gas |
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
283 gaslist_strcat_depth_travel: ; Show "---" instead of "0m"... |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
160
diff
changeset
|
284 STRCAT "---" |
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
160
diff
changeset
|
285 return |
540
9a17b1db095b
Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents:
534
diff
changeset
|
286 gaslist_metric_non_travel: |
0 | 287 output_99 |
288 STRCAT_TEXT tMeters ; "m" | |
289 return | |
290 | |
291 ;---------------------------------------------------------------------------- | |
292 ; Store current menu item, and display gas description later. | |
293 ; Input: PRODL : gas number (0..4) | |
294 ; NOTE: used in the menu-tree for the MENU_CALLBACK entry. | |
295 global gaslist_setgas | |
296 gaslist_setgas: | |
297 movff PRODL,gaslist_gas | |
298 movlw .5 | |
299 btfsc ccr_diluent_setup ; in CCR menus? | |
300 addwf gaslist_gas,F ; Yes, offset to gases 5-9 | |
301 return | |
302 | |
303 | |
304 global gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth | |
305 gaslist_cleanup_list: | |
306 bcf ignore_last_edited_gas | |
307 movlw .0 | |
308 btfsc ccr_diluent_setup ; In CCR-Menu? | |
309 addlw .5 ; Yes, adjust offset | |
310 subwf gaslist_gas,F | |
311 gaslist_cleanup_list1: | |
312 clrf lo | |
313 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG] | |
314 movlw .5 ; Check 5 gases | |
315 movwf hi | |
316 gaslist_cleanup_list2: | |
317 decf hi,w ; 0-4 | |
318 btfsc ccr_diluent_setup ; In CCR-Menu? | |
319 addlw .5 ; Yes, adjust offset | |
320 movff PLUSW1,hi_temp | |
321 movlw .1 | |
322 cpfseq hi_temp ; gas = first ? | |
323 bra gaslist_cleanup_list3 ; No | |
324 incf lo,F ; Yes, count "first gases" | |
325 | |
326 btfss ignore_last_edited_gas ; If we are not in the second-pass mode | |
327 bra gaslist_cleanup_list2b | |
328 | |
329 decf hi,w ; 0-4 | |
330 cpfseq gaslist_gas ; Do not disable last edited gas | |
331 gaslist_cleanup_list2b: | |
332 movff hi,lo_temp ; Keep the last "first gas" found | |
333 gaslist_cleanup_list3: | |
334 decfsz hi,F | |
335 bra gaslist_cleanup_list2 ; Loop | |
336 | |
337 tstfsz lo ; No gas active? | |
338 bra gaslist_cleanup_list4 ; No, at least one is active | |
339 | |
340 btfsc ccr_diluent_setup ; In CCR-Menu? | |
341 bra gaslist_cleanup_list3a ; Yes. | |
342 ; make gas1 first and zero | |
343 movlw .1 ; First | |
344 movwf lo_temp | |
345 movwf INDF1 | |
346 bra gaslist_cleanup_list5 ; Set change depth to zero | |
347 | |
348 gaslist_cleanup_list3a: | |
349 movlw .5 | |
350 addwf FSR1L,F | |
351 movlw .0 | |
352 addwfc FSR1H,F ; Setup to Diluents | |
353 ; make dil1 first and zero | |
354 movlw .1 ; First | |
355 movwf lo_temp | |
356 movwf INDF1 | |
357 bra gaslist_cleanup_list5 ; Set change depth to zero | |
358 | |
359 gaslist_cleanup_list4: | |
360 movlw .1 | |
361 cpfsgt lo ; More then one "first gas"? | |
362 bra gaslist_cleanup_list5 ; No, done. | |
363 ; More then one Gas is "first gas" | |
364 ; Disable last found "first gas" but keep it's change depth | |
365 decf lo_temp,W ; 0-4 | |
366 cpfseq gaslist_gas ; Do not disable last edited gas | |
367 bra gaslist_cleanup_list4b | |
368 ; Do not disable last edited gas | |
369 ; search again but ignore last edited gas | |
370 bsf ignore_last_edited_gas | |
371 bra gaslist_cleanup_list1 ; Loop until only one "first gas" is left | |
372 | |
373 gaslist_cleanup_list4b: | |
374 btfsc ccr_diluent_setup ; In CCR-Menu? | |
375 addlw .5 ; Yes, adjust offset | |
376 clrf PLUSW1 ; Disable gas | |
377 bra gaslist_cleanup_list ; Loop until only one "first gas" is left | |
378 | |
379 gaslist_cleanup_list5: | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
380 ; Read switch depth |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
381 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents-5 |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
382 btfss ccr_diluent_setup ; In CCR-Menu? |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
383 lfsr FSR1,opt_OC_bail_gas_change ; No, setup OC Gases |
0 | 384 decf lo_temp,W |
385 btfsc ccr_diluent_setup ; In CCR-Menu? | |
386 addlw .5 ; Yes, adjust offset | |
387 clrf PLUSW1 ; Set First gas to zero m | |
388 return | |
389 | |
390 ;---------------------------------------------------------------------------- | |
391 ; Increment/Decrement O2 ratio | |
392 global gaslist_pO2 | |
393 gaslist_pO2: | |
394 movf gaslist_gas,W | |
395 lfsr FSR1,opt_gas_He_ratio ; Read opt_gas_He_ratio[WREG] | |
396 movff PLUSW1,gaslist_He | |
397 lfsr FSR1,opt_gas_O2_ratio ; Read opt_gas_O2_ratio[WREG] | |
398 movff PLUSW1,gaslist_O2 | |
399 | |
400 incf gaslist_O2,F ; O2++ | |
401 movf gaslist_He,W | |
402 addwf gaslist_O2,W | |
403 movwf lo | |
404 movlw .101 | |
405 cpfslt lo ; O2+He<101? | |
406 decf gaslist_O2,F ; O2-- (Unchanged) | |
407 | |
408 movf gaslist_gas,W | |
409 movff gaslist_O2,PLUSW1 ; And write back to opt_gas_O2_ratio[WREG] | |
410 return | |
411 | |
412 global gaslist_mO2 | |
413 gaslist_mO2: | |
414 movf gaslist_gas,W | |
415 lfsr FSR1,opt_gas_O2_ratio ; Read opt_gas_O2_ratio[WREG] | |
416 movff PLUSW1,gaslist_O2 | |
417 | |
418 decf gaslist_O2,F | |
419 movlw gaslist_min_o2 | |
420 cpfslt gaslist_O2 | |
421 bra gaslist_mO2_1 | |
422 movlw gaslist_min_o2 | |
423 movwf gaslist_O2 | |
424 gaslist_mO2_1: | |
425 movf gaslist_gas,W | |
426 movff gaslist_O2,PLUSW1 ; And write back to opt_gas_O2_ratio[WREG] | |
427 return | |
428 | |
429 ;---------------------------------------------------------------------------- | |
430 ; Increment/Decrement He ratio | |
431 global gaslist_pHe | |
432 gaslist_pHe: | |
433 movf gaslist_gas,W | |
434 lfsr FSR1,opt_gas_O2_ratio ; Read opt_gas_O2_ratio[WREG] | |
435 movff PLUSW1,gaslist_O2 | |
436 lfsr FSR1,opt_gas_He_ratio ; Read opt_gas_He_ratio[WREG] | |
437 movff PLUSW1,gaslist_He | |
438 | |
439 incf gaslist_He,F ; He++ | |
440 movf gaslist_He,W | |
441 addwf gaslist_O2,W | |
442 movwf lo | |
443 movlw .101 | |
444 cpfslt lo ; O2+He<101? | |
445 decf gaslist_He,F ; Yes, He-- (Unchanged) | |
446 | |
447 movf gaslist_gas,W | |
448 movff gaslist_He,PLUSW1 ; And write back to opt_gas_He_ratio[WREG] | |
449 return | |
450 | |
451 global gaslist_mHe | |
452 gaslist_mHe: | |
453 movf gaslist_gas,W | |
454 lfsr FSR1,opt_gas_He_ratio ; Read opt_gas_He_ratio[WREG] | |
455 movff PLUSW1,gaslist_He | |
456 | |
457 decf gaslist_He,F | |
458 bnn gaslist_mHe_1 | |
459 clrf gaslist_He | |
460 gaslist_mHe_1: | |
461 movf gaslist_gas,W | |
462 movff gaslist_He,PLUSW1 ; And write back to opt_gas_He_ratio[WREG] | |
463 return | |
464 | |
465 ;---------------------------------------------------------------------------- | |
466 ; Increment/Decrement switch depth | |
467 global gaslist_pDepth | |
468 gaslist_pDepth: | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
469 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents-5 |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
470 movlw .4 |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
471 cpfsgt gaslist_gas ; >4? (-> Diluents) |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
472 lfsr FSR1,opt_OC_bail_gas_change ; Setup OC Gases |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
473 |
0 | 474 movf gaslist_gas,W |
475 movff PLUSW1,gaslist_O2 ; Read char_I_deco_gas_change[WREG] | |
476 | |
477 incf gaslist_O2,F | |
478 movlw gaslist_max_change_depth | |
479 cpfsgt gaslist_O2 | |
480 bra gaslist_pDepth_1 | |
481 movlw gaslist_max_change_depth | |
482 movwf gaslist_O2 | |
483 gaslist_pDepth_1: | |
484 movf gaslist_gas,W | |
485 movff gaslist_O2,PLUSW1 ; Write back to char_I_deco_gas_change[WREG] | |
486 return | |
487 | |
488 global gaslist_mDepth | |
489 gaslist_mDepth: | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
490 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents-5 |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
491 movlw .4 |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
492 cpfsgt gaslist_gas ; >4? (-> Diluents) |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
493 lfsr FSR1,opt_OC_bail_gas_change ; Setup OC Gases |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
494 |
0 | 495 movf gaslist_gas,W |
496 movff PLUSW1,gaslist_O2 ; Read char_I_deco_gas_change[WREG] | |
497 | |
498 decf gaslist_O2,F | |
499 btfsc STATUS,N | |
500 clrf gaslist_O2 | |
501 | |
502 movf gaslist_gas,W | |
503 movff gaslist_O2,PLUSW1 ; And write back to char_I_deco_gas_change[WREG] | |
504 return | |
505 | |
506 global gaslist_spplus | |
507 gaslist_spplus: | |
508 movf gaslist_gas,W | |
509 lfsr FSR1,char_I_setpoint_cbar | |
510 movff PLUSW1,lo ; Read char_I_setpoint_cbar[WREG] | |
511 movlw gaslist_sp_stepsize | |
512 addwf lo,F | |
513 movlw gaslist_sp_max | |
514 cpfsgt lo | |
515 bra gaslist_spplus2 | |
516 movlw gaslist_sp_min | |
517 movwf lo | |
518 gaslist_spplus2: | |
519 movf gaslist_gas,W | |
520 movff lo,PLUSW1 ; Write back to char_I_setpoint_cbar | |
521 return | |
522 | |
523 global gaslist_spdepthplus | |
524 gaslist_spdepthplus: | |
525 movf gaslist_gas,W | |
526 bz gaslist_spdepthplus3 ; Setpoint 1 is always 0m | |
527 lfsr FSR1,char_I_setpoint_change | |
528 movff PLUSW1,gaslist_O2 ; Read char_I_deco_gas_change[WREG] | |
529 incf gaslist_O2,F | |
530 movlw gaslist_max_change_depth | |
531 cpfsgt gaslist_O2 | |
532 bra gaslist_spdepthplus_1 | |
533 movlw gaslist_max_change_depth | |
534 movwf gaslist_O2 | |
535 gaslist_spdepthplus_1: | |
536 movf gaslist_gas,W | |
537 movff gaslist_O2,PLUSW1 ; Write back to char_I_deco_gas_change[WREG] | |
538 return | |
539 | |
540 gaslist_spdepthplus3: | |
541 movlw .0 | |
542 movff WREG,char_I_setpoint_change+0 ; Reset to 0m | |
543 return | |
544 | |
545 global gaslist_spdepthminus | |
546 gaslist_spdepthminus: | |
547 movf gaslist_gas,W | |
548 bz gaslist_spdepthplus3 ; Setpoint 1 is always 0m | |
549 lfsr FSR1,char_I_setpoint_change | |
550 movff PLUSW1,gaslist_O2 ; Read opt_gas_O2_ratio[WREG] | |
551 decf gaslist_O2,F | |
552 btfsc STATUS,N | |
553 clrf gaslist_O2 | |
554 movf gaslist_gas,W | |
555 movff gaslist_O2,PLUSW1 ; And write back to opt_gas_O2_ratio[WREG] | |
556 return | |
557 | |
558 ;---------------------------------------------------------------------------- | |
507
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
559 ; Compute MOD from opt_ppO2_max/opt_ppO2_max_deco and current O2 Ratio. |
0 | 560 ; |
561 ; Input: gaslist_gas = current gas index. | |
562 ; opt_gas_O2_ratio[gaslist_gas] = current O2 ratio | |
563 ; Output: WREG = MOD [m] | |
564 ; | |
565 gaslist_calc_mod: | |
507
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
566 movff gaslist_gas,gaslist_gas_global ; copy for color coding |
0 | 567 movf gaslist_gas,W ; Read current gas O2 ratio |
568 lfsr FSR1,opt_gas_O2_ratio ; Read opt_gas_O2_ratio[WREG] | |
569 movf PLUSW1,W | |
570 | |
571 btfsc divemode ; In divemode? | |
572 bra gaslist_calc_mod_divemode ; Yes. | |
573 | |
574 ; Pamb max = ppO2 Max / O2 ratio | |
575 movwf xB+0 | |
576 | |
507
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
577 movf gaslist_gas,W ; Read current gas O2 ratio |
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
578 lfsr FSR1,opt_gas_type ; 0=Disabled, 1=First, 2=Travel, 3=Deco for OC gases and 0=Disabled, 1=First, 2=Normal for diluents |
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
579 movff PLUSW1,xA+0 ; xA+0 used as temp here -> holds type |
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
580 |
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
581 movff opt_ppO2_max_deco,xB+1 ; xB+1 used as temp here |
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
582 movlw .3 |
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
583 cpfseq xA+0 ; Deco? |
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
584 movff opt_ppO2_max,xB+1 ; No, overwrite with travel/bottom max |
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
585 movf xB+1,W ; Result in WREG |
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
586 |
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
587 clrf xB+1 ; Clear for div16x16 |
0 | 588 mullw .10 |
589 movff PRODL,xA+0 | |
590 movff PRODH,xA+1 | |
591 call div16x16 | |
592 | |
593 ; Prof = Pamb - 1bar. | |
594 movf xC+0,W | |
595 addlw -.10 | |
596 return | |
597 | |
598 gaslist_calc_mod_divemode: | |
599 extern TFT_color_code1 | |
600 movwf hi ; Copy O2% | |
601 movlw warn_gas_in_gaslist | |
507
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
602 call TFT_color_code1 ; Color-code current row in Gaslist (%O2 in hi), opt_ppO2_max/opt_ppO2_max_deco as threshold |
0 | 603 return |
604 ;---------------------------------------------------------------------------- | |
154
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
605 |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
606 global gaslist_ppo2 |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
607 gaslist_ppo2: |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
608 STRCAT_TEXT tppO2 ; ppO2: |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
609 movf gaslist_gas,W |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
610 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
611 btfss ccr_diluent_setup ; In CCR-Menu? |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
612 lfsr FSR1,opt_OC_bail_gas_change ; No, setup OC/Bailout Gases |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
613 movf PLUSW1,W |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
614 mullw .10 ; PROD=Depth in mbar/10 (100 = 1.00 bar) |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
615 movlw .100 |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
616 addwf PRODL,F |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
617 movlw .0 |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
618 addwfc PRODH,F ; add 1bar |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
619 movff PRODL,xA+0 |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
620 movff PRODH,xA+1 |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
621 movf gaslist_gas,W ; Read current gas O2 ratio |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
622 lfsr FSR1,opt_dil_O2_ratio-.5 ; Read dil_gas_O2_ratio[WREG] |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
623 btfss ccr_diluent_setup ; In CCR-Menu? |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
624 lfsr FSR1,opt_gas_O2_ratio ; No, read opt_gas_O2_ratio[WREG] |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
625 movff PLUSW1,xB+0 |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
626 clrf xB+1 |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
627 call mult16x16 ; char_I_O2_ratio * (p_amb/10) |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
628 movff xC+0,xA+0 |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
629 movff xC+1,xA+1 |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
630 movlw d'100' |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
631 movwf xB+0 |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
632 clrf xB+1 |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
633 call div16x16 ; xC=(char_I_O2_ratio * p_amb/10)/100 |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
634 ; Check very high ppO2 manually |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
635 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
636 bra gaslist_ppo2_2 ; Yes, display fixed Value! |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
637 movff xC+0,lo |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
638 movff xC+1,hi |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
639 bcf ignore_digit4 |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
640 bsf leftbind |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
641 output_16dp d'3' ; x.xx |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
642 STRCAT_TEXT tbar ; bar |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
643 return |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
644 gaslist_ppo2_2: |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
645 STRCAT ">6.6" |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
646 return |
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
97
diff
changeset
|
647 |
0 | 648 global gaslist_MOD_END |
649 gaslist_MOD_END: | |
650 rcall gaslist_calc_mod ; Compute MOD into WREG | |
651 movwf lo ; Copy to lo | |
14 | 652 STRCAT_TEXT tMOD ; MOD: |
0 | 653 TSTOSS opt_units ; 0=Meters, 1=Feets |
654 bra gaslist_MOD_metric | |
655 ;gaslist_MOD_imperial: | |
656 movf lo,W | |
657 mullw .100 ; convert meters to mbar | |
658 movff PRODL,lo | |
659 movff PRODH,hi | |
660 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
661 bsf leftbind | |
225
31088352ee32
BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents:
189
diff
changeset
|
662 output_16_3 ; limit to 999 and display only (0-999) |
0 | 663 STRCAT_TEXT tFeets ; "ft" |
664 bra gaslist_MOD_common | |
665 gaslist_MOD_metric: | |
666 output_8 | |
667 STRCAT_TEXT tMeters ; m | |
668 gaslist_MOD_common: | |
669 PUTC "/" | |
670 STRCAT_TEXT tEND ; END: | |
671 rcall gaslist_calc_mod ; Output: WREG = MOD [m] | |
672 addlw .10 ; MOD=MOD+10m | |
673 movwf xB+0 | |
674 clrf xB+1 | |
675 movlw d'100' | |
676 movwf xA+0 | |
677 movf gaslist_He,W ; He value in % -> WREG | |
678 subwf xA+0,F ; xA+0 = 100 - He Value in % | |
679 clrf xA+1 | |
680 call mult16x16 ; xA*xB=xC | |
681 movff xC+0,xA+0 | |
682 movff xC+1,xA+1 | |
683 movlw d'100' | |
684 movwf xB+0 | |
685 clrf xB+1 | |
686 call div16x16 ; xA/xB=xC with xA as remainder | |
687 ; xC:2 = ((MOD+10) * 100 - HE Value in %) / 100 | |
688 movlw d'10' | |
689 subwf xC+0,F ; Subtract 10m... | |
690 movff xC+0,lo | |
691 ; END 8Bit only | |
692 ; movlw d'0' | |
693 ; subwfb xC+1,F | |
694 ; movff xC+1,hi | |
695 TSTOSS opt_units ; 0=Meters, 1=Feets | |
696 bra gaslist_END_metric | |
697 ;gaslist_END_imperial: | |
698 movf lo,W | |
699 mullw .100 ; convert meters to mbar | |
700 movff PRODL,lo | |
701 movff PRODH,hi | |
702 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
703 bsf leftbind | |
225
31088352ee32
BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents:
189
diff
changeset
|
704 output_16_3 ; limit to 999 and display only (0-999) |
0 | 705 STRCAT_TEXT tFeets ; "ft" |
706 return | |
707 gaslist_END_metric: | |
708 output_8 | |
709 STRCAT_TEXT tMeters ; m | |
710 return | |
711 | |
712 ;---------------------------------------------------------------------------- | |
713 global gaslist_reset_mod_title | |
714 gaslist_reset_mod_title: | |
715 STRCAT_TEXT tDepthReset | |
716 | |
717 gaslist_reset_mod_title2: | |
718 rcall gaslist_calc_mod ; Compute MOD into WREG | |
719 movwf lo ; Copy to lo | |
720 | |
721 movf gaslist_gas,W ; Compare to switch depth | |
505
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
275
diff
changeset
|
722 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
723 btfss ccr_diluent_setup ; In CCR-Menu? |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
724 lfsr FSR1,opt_OC_bail_gas_change ; No, setup OC Gases |
0 | 725 movf PLUSW1,W |
726 cpfslt lo | |
521
06e9370c6d75
CHANGE: Apply safety margin parameters to both models (GF and non-GF)
heinrichsweikamp
parents:
518
diff
changeset
|
727 bra gaslist_strcat_5 ; And return... |
50 | 728 call TFT_warnings_color ; Turn red if bigger ! |
521
06e9370c6d75
CHANGE: Apply safety margin parameters to both models (GF and non-GF)
heinrichsweikamp
parents:
518
diff
changeset
|
729 bra gaslist_strcat_5 ; And return... |
0 | 730 |
731 ;---------------------------------------------------------------------------- | |
732 global gaslist_reset_mod | |
733 gaslist_reset_mod: | |
734 rcall gaslist_calc_mod ; Compute MOD | |
735 movwf gaslist_depth | |
736 | |
737 movf gaslist_gas,W ; Read current gas O2 ratio | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
738 |
505
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
275
diff
changeset
|
739 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
740 btfss ccr_diluent_setup ; In CCR-Menu? |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
741 lfsr FSR1,opt_OC_bail_gas_change ; No, setup OC Gases |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
95
diff
changeset
|
742 |
0 | 743 movff gaslist_depth,PLUSW1 ; And save new change depth |
744 return | |
745 ;---------------------------------------------------------------------------- | |
746 END |