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