annotate src/gaslist.asm @ 184:faa06c58e977

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