Mercurial > public > hwos_code
annotate src/tft_outputs.asm @ 261:08ced9cd144b
language update
author | heinrichsweikamp |
---|---|
date | Wed, 25 Mar 2015 18:07:46 +0100 |
parents | e1cd6848863d |
children | e2fd372a917a |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
3 ; File tft_outputs.asm | |
4 ; | |
5 ; Startup subroutines | |
6 ; | |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-08-07 : [mH] moving from OSTC code | |
11 | |
12 #include "ostc3.inc" ; Mandatory header | |
13 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c | |
14 #include "tft.inc" | |
15 #include "wait.inc" | |
16 #include "strings.inc" | |
17 #include "convert.inc" | |
18 #include "varargs.inc" | |
19 #include "math.inc" | |
20 #include "isr.inc" | |
21 #include "eeprom_rs232.inc" | |
22 #include "adc_lightsensor.inc" | |
23 #include "surfmode.inc" | |
24 #include "divemode.inc" | |
25 #include "external_flash.inc" | |
26 #include "ghostwriter.inc" | |
27 #include "customview.inc" | |
28 #include "i2c.inc" | |
50 | 29 #include "colorschemes.inc" |
229 | 30 #include "calibrate.inc" |
0 | 31 |
32 extern aa_wordprocessor | |
33 | |
34 ;============================================================================= | |
35 | |
36 gui CODE | |
37 ;============================================================================= | |
38 | |
39 global TFT_divemask_color | |
40 TFT_divemask_color: | |
50 | 41 movlw color_green |
42 btfsc divemode ; in Divemode? | |
43 rcall TFT_divemask_color_dive | |
44 bra TFT_standard_color0 | |
45 | |
46 TFT_divemask_color_dive: | |
47 movff opt_dive_color_scheme,WREG ; 0-3 | |
48 incf WREG | |
49 dcfsnz WREG | |
50 bra TFT_divemask_colordive0 ;0 | |
51 dcfsnz WREG | |
52 bra TFT_divemask_colordive1 ;1 | |
53 dcfsnz WREG | |
54 bra TFT_divemask_colordive2 ;2 | |
55 dcfsnz WREG | |
56 bra TFT_divemask_colordive3 ;3 | |
57 TFT_divemask_colordive0: | |
58 movlw color_scheme_divemode_mask1 | |
59 return | |
60 TFT_divemask_colordive1: | |
61 movlw color_scheme_divemode_mask2 | |
62 return | |
63 TFT_divemask_colordive2: | |
64 movlw color_scheme_divemode_mask3 | |
65 return | |
66 TFT_divemask_colordive3: | |
67 movlw color_scheme_divemode_mask4 | |
68 return | |
69 | |
70 | |
71 global TFT_attention_color | |
72 TFT_attention_color: | |
73 movlw color_yellow | |
0 | 74 bra TFT_standard_color0 |
75 | |
76 global TFT_warnings_color | |
77 TFT_warnings_color: | |
78 movlw color_red ; TODO | |
79 bra TFT_standard_color0 | |
80 | |
81 global TFT_disabled_color | |
82 TFT_disabled_color: | |
83 movlw color_grey ; Default to OSTC grey (dark blue) | |
87 | 84 btfsc divemode ; in Divemode? |
85 rcall TFT_disabled_color_dive | |
0 | 86 bra TFT_standard_color0 |
87 | 87 TFT_disabled_color_dive: |
88 movff opt_dive_color_scheme,WREG ; 0-3 | |
89 incf WREG | |
90 dcfsnz WREG | |
91 bra TFT_disabled_colordive0 ;0 | |
92 dcfsnz WREG | |
93 bra TFT_disabled_colordive1 ;1 | |
94 dcfsnz WREG | |
95 bra TFT_disabled_colordive2 ;2 | |
96 dcfsnz WREG | |
97 bra TFT_disabled_colordive3 ;3 | |
98 TFT_disabled_colordive0: | |
99 movlw color_scheme_divemode_dis1 | |
100 return | |
101 TFT_disabled_colordive1: | |
102 movlw color_scheme_divemode_dis2 | |
103 return | |
104 TFT_disabled_colordive2: | |
105 movlw color_scheme_divemode_dis3 | |
106 return | |
107 TFT_disabled_colordive3: | |
108 movlw color_scheme_divemode_dis4 | |
109 return | |
0 | 110 |
111 global TFT_standard_color | |
112 TFT_standard_color: | |
87 | 113 setf WREG ; Default white |
50 | 114 btfsc divemode ; in Divemode? |
115 rcall TFT_standard_color_dive | |
0 | 116 TFT_standard_color0: |
117 call TFT_set_color | |
118 return | |
50 | 119 TFT_standard_color_dive: |
120 movff opt_dive_color_scheme,WREG ; 0-3 | |
121 incf WREG | |
122 dcfsnz WREG | |
123 bra TFT_standard_colordive0 ;0 | |
124 dcfsnz WREG | |
125 bra TFT_standard_colordive1 ;1 | |
126 dcfsnz WREG | |
127 bra TFT_standard_colordive2 ;2 | |
128 dcfsnz WREG | |
129 bra TFT_standard_colordive3 ;3 | |
130 TFT_standard_colordive0: | |
131 movlw color_scheme_divemode_std1 | |
132 return | |
133 TFT_standard_colordive1: | |
134 movlw color_scheme_divemode_std2 | |
135 return | |
136 TFT_standard_colordive2: | |
137 movlw color_scheme_divemode_std3 | |
138 return | |
139 TFT_standard_colordive3: | |
140 movlw color_scheme_divemode_std4 | |
141 return | |
0 | 142 |
143 TFT_color_code macro color_code_temp | |
144 movlw color_code_temp | |
145 call TFT_color_code1 | |
146 endm | |
147 | |
148 global TFT_color_code1 | |
149 TFT_color_code1: ; Color-codes the output, if required | |
150 dcfsnz WREG | |
151 bra TFT_color_code_depth ; depth_warn_mbar [mbar], 16Bit | |
152 dcfsnz WREG | |
153 bra TFT_color_code_cns ; color_code_cns_high [%] | |
154 dcfsnz WREG | |
155 bra TFT_color_code_gf ; color_code_gf_warn_high [%] | |
156 dcfsnz WREG | |
157 bra TFT_color_code_ppo2 ; Color-code the OC ppO2 results [cbar], opt_ppO2_max as threshold | |
158 dcfsnz WREG | |
159 bra TFT_color_code_velocity ; color_code_velocity_warn_high [m/min] | |
160 dcfsnz WREG | |
161 bra TFT_color_code_ceiling ; Show warning if current depth>shown ceiling | |
162 dcfsnz WREG | |
163 bra TFT_color_code_gaslist ; Color-code current row in Gaslist (%O2 in hi), opt_ppO2_max as threshold | |
164 dcfsnz WREG | |
165 bra TFT_color_code_ppo2_hud ; Color-code the hud ppO2 readings [cbar], opt_ppO2_max as threshold | |
166 dcfsnz WREG | |
167 bra TFT_color_code_battery ; Color-code the battery display | |
168 | |
169 TFT_color_code_gaslist: ; %O2 in hi | |
170 ; Check very high ppO2 manually | |
171 SAFE_2BYTE_COPY amb_pressure,xA | |
172 movlw d'10' | |
173 movwf xB+0 | |
174 clrf xB+1 | |
175 call div16x16 ; xC=p_amb/10 | |
176 movff xC+0,xA+0 | |
177 movff xC+1,xA+1 | |
178 movff hi,xB+0 | |
179 clrf xB+1 | |
180 call mult16x16 ; lo * p_amb/10 | |
181 ; Check if ppO2>6,55bar | |
182 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
183 bra TFT_warnings_color ; Yes, warn in warning color |
0 | 184 ; Check if ppO2>3,30bar |
185 btfsc xC+1,7 | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
186 bra TFT_warnings_color ; Yes, warn in warning color |
0 | 187 |
188 ; Check for low ppo2 | |
189 movff xC+0,sub_a+0 | |
190 movff xC+1,sub_a+1 | |
191 movff opt_ppO2_min,WREG | |
192 mullw d'100' ; opt_ppO2_min*100 | |
193 movff PRODL,sub_b+0 | |
194 movff PRODH,sub_b+1 | |
195 call subU16 | |
196 btfsc neg_flag | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
197 bra TFT_warnings_color ; too low -> Warning Color! |
0 | 198 |
199 ; Check for high ppo2 | |
200 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode | |
201 mullw d'100' ; opt_ppO2_max*100 | |
202 movff PRODL,sub_b+0 | |
203 movff PRODH,sub_b+1 | |
204 call subU16 ; sub_c = sub_a - sub_b | |
205 btfss neg_flag | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
206 bra TFT_warnings_color ; too high -> Warning Color! |
0 | 207 return |
208 | |
209 TFT_color_code_ceiling: | |
210 SAFE_2BYTE_COPY rel_pressure, lo | |
211 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
212 movff hi,xA+1 | |
213 movff lo,xA+0 | |
214 movff char_O_first_deco_depth,lo ; Ceiling in m | |
215 decf lo,F ; -1 | |
216 movlw LOW d'100' | |
217 movwf xB+0 | |
218 clrf xB+1 ; Devide/100 -> xC+0 = Depth in m | |
219 call div16x16 ; xA/xB=xC with xA as remainder | |
220 movf xC+0,W ; Depth in m | |
221 subwf lo,W | |
222 btfsc STATUS,C | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
223 bra TFT_warnings_color ; Set to warning color |
0 | 224 call TFT_standard_color |
225 return | |
226 | |
227 TFT_color_code_depth: | |
228 movff hi,hi_temp | |
229 movff lo,lo_temp | |
230 SAFE_2BYTE_COPY rel_pressure, lo | |
231 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
232 movff lo,sub_a+0 | |
233 movff hi,sub_a+1 | |
234 movlw LOW depth_warn_mbar | |
235 movwf lo | |
236 movlw HIGH depth_warn_mbar | |
237 movwf hi | |
238 movff lo,sub_b+0 | |
239 movff hi,sub_b+1 | |
240 movff hi_temp,hi | |
241 movff lo_temp,lo ; Restore hi, lo | |
242 call subU16 ; sub_c = sub_a - sub_b | |
243 btfss neg_flag | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
244 bra TFT_warnings_color ; Set to warning color |
0 | 245 call TFT_standard_color |
246 return | |
247 | |
248 TFT_color_code_cns: | |
249 movff int_O_CNS_fraction+1,lo ; copy into bank1 | |
250 tstfsz lo ; >255% ? | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
251 bra TFT_warnings_color ; Yes |
0 | 252 movff int_O_CNS_fraction+0,lo |
253 movlw color_code_cns_high ; CNS Warn [%] | |
254 subwf lo,W | |
255 btfsc STATUS,C | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
256 bra TFT_warnings_color ; Set to warning color |
0 | 257 call TFT_standard_color |
258 return | |
259 | |
260 TFT_color_code_gf: | |
261 movff char_O_gradient_factor,lo ; gradient factor | |
262 movlw color_code_gf_warn_high ; GF Warn [%] | |
263 subwf lo,W | |
264 btfsc STATUS,C | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
265 bra TFT_warnings_color ; Set to warning color |
0 | 266 call TFT_standard_color |
267 return | |
268 | |
269 TFT_color_code_ppo2: | |
270 ; Check if ppO2>6,55bar | |
271 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
272 bra TFT_warnings_color ; Yes, warn in warning color |
0 | 273 ; Check if ppO2>3,30bar |
274 btfsc xC+1,7 | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
275 bra TFT_warnings_color ; Yes, warn in warning color |
0 | 276 |
277 movff xC+0,sub_a+0 | |
278 movff xC+1,sub_a+1 | |
279 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode | |
280 mullw d'100' | |
281 movff PRODL,sub_b+0 | |
282 movff PRODH,sub_b+1 | |
283 call subU16 ; sub_c = sub_a - sub_b | |
284 btfss neg_flag | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
285 bra TFT_warnings_color ; Set to warning color |
0 | 286 |
287 movff xC+0,sub_a+0 | |
288 movff xC+1,sub_a+1 | |
289 movff opt_ppO2_min,WREG ; PPO2 min for Sensors and color coding in divemode | |
290 mullw d'100' | |
291 movff PRODL,sub_b+0 | |
292 movff PRODH,sub_b+1 | |
293 call subU16 ; sub_c = sub_a - sub_b | |
294 btfsc neg_flag | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
295 bra TFT_warnings_color ; Set to warning color |
0 | 296 call TFT_standard_color |
297 return | |
298 | |
299 TFT_color_code_velocity: | |
52 | 300 btfss neg_flag ; Ignore for descent! |
0 | 301 bra TFT_color_code_velocity1 ; Skip check! |
302 movff divA+0,lo | |
303 movlw color_code_velocity_warn_high ; Velocity warn [m/min] | |
304 subwf lo,W | |
305 btfsc STATUS,C | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
306 bra TFT_warnings_color ; Set to warning color |
0 | 307 TFT_color_code_velocity1: |
308 call TFT_standard_color | |
309 return | |
310 | |
311 TFT_color_code_ppo2_hud: ; With ppO2 [cbar] in lo | |
312 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode | |
313 cpfsgt lo ; lo > opt_ppO2_max? | |
314 bra TFT_color_code_ppo2_hud1; No | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
315 bra TFT_warnings_color ; Yes |
0 | 316 TFT_color_code_ppo2_hud1: |
317 movff opt_ppO2_min,WREG ; PPO2 min for Sensors and color coding in divemode | |
318 cpfslt lo ; lo < opt_ppO2_min? | |
319 bra TFT_color_code_ppo2_hud2; No | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
320 bra TFT_warnings_color ; Yes |
0 | 321 TFT_color_code_ppo2_hud2: |
322 call TFT_standard_color | |
323 return | |
324 | |
325 TFT_color_code_battery: ; With battery percent in lo | |
326 movlw color_code_battery_low | |
327 cpfsgt lo ; lo < color_code_battery_low ? | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
328 bra TFT_warnings_color ; No |
0 | 329 call TFT_standard_color |
330 return | |
331 | |
332 ; **************************************************************************** | |
333 | |
234
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
334 global TFT_show_OC_startgas_surface |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
335 TFT_show_OC_startgas_surface: ; Show first gas and "OSTC2-like" active gases |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
336 ; Show first gas |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
337 WIN_SMALL surf_decotype_column+.1,surf_decotype_row+.30 |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
338 extern get_first_gas_to_WREG,gaslist_strcat_gas |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
339 call get_first_gas_to_WREG ; Gets first gas (0-4) into WREG |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
340 movwf PRODL |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
341 call gaslist_strcat_gas ; Input: PRODL : gas number (0..4), Output: Text appended into buffer pointed by FSR2. |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
342 STRCAT_PRINT "" |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
343 ; Show boxes |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
344 WIN_TOP surf_decotype_row+.30+.25 |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
345 WIN_LEFT surf_decotype_boxes_left1+.1 |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
346 rcall TFT_disabled_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
347 movff opt_gas_type+0,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
348 tstfsz hi |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
349 rcall TFT_standard_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
350 STRCPY_PRINT "1" |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
351 decfsz hi,F ; Type = 1 (First)? |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
352 bra DISP_active_gas_surfmode3 ; No, skip box |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
353 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left1, surf_decotype_boxes_left1+.8 ;top, bottom, left, right |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
354 DISP_active_gas_surfmode3: |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
355 rcall TFT_disabled_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
356 movff opt_gas_type+1,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
357 tstfsz hi |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
358 rcall TFT_standard_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
359 WIN_LEFT surf_decotype_boxes_left2+.1 |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
360 STRCPY_PRINT "2" |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
361 decfsz hi,F ; Type = 1 (First)? |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
362 bra DISP_active_gas_surfmode4 ; No, skip box |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
363 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left2, surf_decotype_boxes_left2+.8 ;top, bottom, left, right |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
364 DISP_active_gas_surfmode4: |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
365 rcall TFT_disabled_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
366 movff opt_gas_type+2,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
367 tstfsz hi |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
368 rcall TFT_standard_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
369 WIN_LEFT surf_decotype_boxes_left3+.1 |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
370 STRCPY_PRINT "3" |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
371 decfsz hi,F ; Type = 1 (First)? |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
372 bra DISP_active_gas_surfmode5 ; No, skip box |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
373 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left3, surf_decotype_boxes_left3+.8 ;top, bottom, left, right |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
374 DISP_active_gas_surfmode5: |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
375 rcall TFT_disabled_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
376 movff opt_gas_type+3,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
377 tstfsz hi |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
378 rcall TFT_standard_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
379 WIN_LEFT surf_decotype_boxes_left4+.1 |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
380 STRCPY_PRINT "4" |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
381 decfsz hi,F ; Type = 1 (First)? |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
382 bra DISP_active_gas_surfmode6 ; No, skip box |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
383 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left4, surf_decotype_boxes_left4+.8 ;top, bottom, left, right |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
384 DISP_active_gas_surfmode6: |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
385 call TFT_disabled_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
386 movff opt_gas_type+4,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
387 tstfsz hi |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
388 rcall TFT_standard_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
389 WIN_LEFT surf_decotype_boxes_left5+.1 |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
390 STRCPY_PRINT "5" |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
391 rcall TFT_standard_color ; Reset color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
392 decfsz hi,F ; Type = 1 (First)? |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
393 return ; no, Done. |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
394 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left5, surf_decotype_boxes_left5+.8 ;top, bottom, left, right |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
395 return ; Done. |
50 | 396 |
397 global TFT_show_color_schemes | |
398 TFT_show_color_schemes: ; update the color schemes | |
399 bsf divemode ; put in divemode | |
400 call TFT_divemask_color | |
401 WIN_TINY divemode_mask_depth_column,divemode_mask_depth_row+.40 | |
402 STRCAT_TEXT_PRINT tDepth | |
403 WIN_TINY divemode_mask_maxdepth_column,divemode_mask_maxdepth_row+.40 | |
404 STRCAT_TEXT_PRINT tMaxDepth | |
405 WIN_TINY divemode_mask_divetime_column,divemode_mask_divetime_row+.40 | |
406 STRCAT_TEXT_PRINT tDivetime | |
407 | |
408 ; Show some demo screen | |
409 | |
410 ; Depth demo | |
411 call TFT_standard_color | |
412 WIN_MEDIUM depth_column+.3,depth_row+.40 | |
413 movlw LOW .5172 | |
414 movwf lo | |
415 movlw HIGH .5172 | |
416 movwf hi | |
417 bsf leftbind | |
418 bsf ignore_digit4 | |
419 output_16 ; Full meters in Big font | |
420 bcf leftbind | |
421 STRCAT_PRINT "" ; Display full meters | |
422 WIN_SMALL depth_dm_column-.15,max_depth_dm_row+.40 | |
423 movlw LOW .5172 | |
424 movwf lo | |
425 movlw HIGH .5172 | |
426 movwf hi | |
427 PUTC "." | |
428 movlw d'4' | |
429 movwf ignore_digits | |
430 bsf ignore_digit5 | |
431 output_16dp d'0' ; .1m in SMALL font | |
432 STRCAT_PRINT "" ; Display decimeters | |
433 WIN_FONT FT_SMALL | |
434 | |
435 ; Max. Depth demo | |
436 WIN_MEDIUM max_depth_column,max_depth_row+.40 | |
437 bsf ignore_digit4 ; no 0.1m | |
438 bsf leftbind | |
439 movlw LOW .6349 | |
440 movwf lo | |
441 movlw HIGH .6349 | |
442 movwf hi | |
443 output_16 | |
444 STRCAT_PRINT "" ; Display full meters | |
445 bcf leftbind | |
446 ; .1m in SMALL font | |
447 WIN_SMALL max_depth_dm_column,max_depth_dm_row+.40 | |
448 PUTC "." | |
449 movlw d'4' | |
450 movwf ignore_digits | |
451 bsf ignore_digit5 | |
452 bsf leftbind | |
453 movlw LOW .6349 | |
454 movwf lo | |
455 movlw HIGH .6349 | |
456 movwf hi | |
457 output_16dp d'0' | |
458 STRCAT_PRINT "" ; Display decimeters | |
459 bcf leftbind | |
460 | |
461 ; Divetime demo | |
462 movff mins,lo | |
463 clrf hi | |
464 WIN_MEDIUM divetime_column, divetime_row+.40 | |
225
31088352ee32
BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents:
220
diff
changeset
|
465 output_16_3 ; limit to 999 and display only (0-999) |
50 | 466 STRCAT_PRINT "" ; Show minutes in large font |
467 WIN_SMALL divetime_secs_column, divetime_secs_row+.40 ; left position for two sec figures | |
468 PUTC ':' | |
469 bsf leftbind | |
470 movff secs,lo | |
471 output_99x | |
472 bcf leftbind | |
473 STRCAT_PRINT "" ; Show seconds in small font | |
474 | |
475 bcf divemode ; don't stay in divemode | |
476 return | |
477 | |
0 | 478 global TFT_divemode_mask |
479 TFT_divemode_mask: ; Displays mask in Dive-Mode | |
480 call TFT_divemask_color | |
481 WIN_TINY divemode_mask_depth_column,divemode_mask_depth_row | |
482 STRCAT_TEXT_PRINT tDepth | |
483 WIN_TINY divemode_mask_maxdepth_column,divemode_mask_maxdepth_row | |
484 STRCAT_TEXT_PRINT tMaxDepth | |
485 WIN_TINY divemode_mask_divetime_column,divemode_mask_divetime_row | |
486 STRCAT_TEXT_PRINT tDivetime | |
487 | |
488 call TFT_standard_color | |
489 return | |
490 | |
491 global TFT_clear_customview_divemode | |
492 TFT_clear_customview_divemode: | |
493 WIN_BOX_BLACK divemode_customview_row, .163, .0, .159 ; top, bottom, left, right | |
494 return | |
495 | |
496 global TFT_display_velocity | |
497 TFT_display_velocity: ; With divA+0 = m/min | |
498 TFT_color_code warn_velocity ; Color-code Output (With divA+0 = m/min) | |
499 WIN_SMALL velocity_text_column,velocity_text_row | |
500 | |
501 TSTOSS opt_units ; 0=Meters, 1=Feets | |
502 bra TFT_display_velocity_metric | |
503 ;TFT_display_velocity_imperial: | |
504 movff divA+0,WREG ; divA+0 = m/min | |
505 mullw .100 ; PRODL:PRODH = mbar/min | |
506 movff PRODL,lo | |
507 movff PRODH,hi | |
508 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
509 movlw '-' | |
510 btfsc neg_flag | |
511 movlw '+' | |
512 movwf POSTINC2 | |
513 bsf leftbind | |
514 output_16 | |
515 bcf leftbind | |
516 STRCAT_TEXT_PRINT tVelImperial ; Unit switch | |
517 call TFT_standard_color | |
518 return | |
519 | |
520 TFT_display_velocity_metric: | |
521 movff divA+0,lo ; divA+0 = m/min | |
522 movlw '-' | |
523 btfsc neg_flag | |
524 movlw '+' | |
525 movwf POSTINC2 | |
526 output_99 | |
527 STRCAT_TEXT_PRINT tVelMetric ; Unit switch | |
528 call TFT_standard_color | |
529 return | |
530 | |
531 global TFT_display_velocity_clear | |
532 TFT_display_velocity_clear: | |
533 ; Clear Text | |
534 WIN_BOX_BLACK velocity_text_row, velocity_text_row+.22, velocity_text_column, (velocity_text_column+.7*.8)-1 ; top, bottom, left, right | |
535 return | |
536 | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
537 global TFT_clear_decoarea |
0 | 538 TFT_clear_decoarea: |
539 WIN_BOX_BLACK decostop_1st_stop_row, .239, decostop_1st_stop_column ,.159 ; top, bottom, left, right | |
540 return | |
541 | |
542 global TFT_clear_divemode_menu | |
543 TFT_clear_divemode_menu: | |
544 WIN_BOX_BLACK divemode_menu_row, divemode_menu_lower, divemode_menu_left ,divemode_menu_right ; top, bottom, left, right | |
545 return | |
546 | |
547 global TFT_display_ndl_mask | |
548 TFT_display_ndl_mask: | |
549 btfsc divemode_menu ; Is the dive mode menu shown? | |
550 return ; Yes, return | |
551 rcall TFT_clear_decoarea ; Clear Dekostop and Dekosum | |
552 call TFT_divemask_color | |
553 WIN_STD ndl_text_column,ndl_text_row | |
554 STRCPY_TEXT_PRINT tNDL ; NDL | |
555 call TFT_standard_color | |
556 return | |
557 | |
558 global TFT_show_TTS_divemode | |
559 TFT_show_TTS_divemode: | |
560 btfsc divemode_menu ; Is the dive mode menu shown? | |
561 return ; Yes, return | |
562 call TFT_standard_color | |
563 movff int_O_ascenttime+0,lo ; TTS | |
564 movff int_O_ascenttime+1,hi ; on 16bits | |
565 WIN_MEDIUM tts_value_column,tts_value_row | |
566 output_16_3 ;Displays only 0...999 | |
567 STRCAT_PRINT "'" | |
568 return | |
569 | |
570 global TFT_display_ndl | |
571 TFT_display_ndl: | |
572 btfsc divemode_menu ; Is the dive mode menu shown? | |
573 return ; Yes, return | |
574 WIN_MEDIUM ndl_value_column,ndl_value_row | |
575 call TFT_standard_color | |
576 movff char_O_nullzeit,lo ; Get NDL from C-code | |
577 output_8 | |
578 STRCAT_PRINT "'" | |
579 return | |
580 | |
581 global TFT_divemode_warning | |
582 TFT_divemode_warning: | |
583 bsf dive_warning_displayed ; =1: The warning sign is shown | |
584 WIN_TOP warning_icon_row | |
585 WIN_LEFT warning_icon_column | |
252 | 586 TFT_WRITE_PROM_IMAGE dive_warning2_block ; Show Warning icon |
587 return | |
0 | 588 |
589 global TFT_divemode_warning_clear | |
590 TFT_divemode_warning_clear: | |
591 btfss dive_warning_displayed ; =1: The warning sign is shown | |
592 return | |
593 bcf dive_warning_displayed ; clear only once | |
594 WIN_BOX_BLACK warning_icon_row, warning_icon_row+.38, warning_icon_column, warning_icon_column+.21; top, bottom, left, right | |
595 return | |
596 | |
597 global TFT_display_deko_mask | |
598 TFT_display_deko_mask: | |
599 rcall TFT_clear_decoarea | |
600 WIN_STD tts_text_column,tts_text_row | |
601 call TFT_divemask_color | |
602 STRCPY_TEXT_PRINT tTTS ; TTS | |
603 call TFT_standard_color | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
604 bcf show_safety_stop ; Clear safety stop flag |
0 | 605 return |
606 | |
607 TFT_display_deko_output_depth: ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
608 TSTOSS opt_units ; 0=m, 1=ft | |
609 bra TFT_display_deko_output_metric | |
610 ;TFT_display_deko_output_imperial: | |
611 movf lo,W ; lo = m | |
612 mullw .100 ; PRODL:PRODH = mbar | |
613 movff PRODL,lo | |
614 movff PRODH,hi | |
615 ; Convert with 334feet/100m to have 10ft, 20ft, 30ft stops... | |
616 movff lo,xA+0 | |
617 movff hi,xA+1 | |
618 movlw LOW d'334' ; 334feet/100m | |
619 movwf xB+0 | |
620 movlw HIGH d'334' | |
621 movwf xB+1 | |
622 call mult16x16 ; xA*xB=xC (lo:hi * 328) | |
623 movlw d'50' ; round up | |
624 addwf xC+0,F | |
625 movlw 0 | |
626 addwfc xC+1,F | |
627 addwfc xC+2,F | |
628 addwfc xC+3,F | |
629 movlw d'100' | |
630 movwf xB+0 | |
631 clrf xB+1 | |
632 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
633 movff xC+0,lo | |
634 movff xC+1,hi ; restore lo and hi with updated value | |
635 bcf leftbind | |
636 bsf ignore_digit4 ; Only full feet | |
637 output_16 | |
638 STRCAT_TEXT tFeets1 | |
639 return | |
640 | |
641 TFT_display_deko_output_metric: | |
642 output_99 | |
643 STRCAT_TEXT tMeters | |
644 PUTC ' ' | |
645 return | |
646 | |
647 global TFT_display_deko | |
648 TFT_display_deko: | |
649 btfsc divemode_menu ; Is the dive mode menu shown? | |
650 return ; Yes, return | |
651 WIN_MEDIUM decostop_1st_stop_column,decostop_1st_stop_row | |
652 TFT_color_code warn_ceiling ; Color-code Output | |
653 movff char_O_first_deco_depth,lo ; Ceiling in m | |
654 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
655 movff char_O_first_deco_time,lo ; length of first stop in min | |
656 output_99 | |
657 STRCAT_PRINT "'" | |
658 call TFT_standard_color | |
659 return | |
660 | |
661 global TFT_decoplan | |
662 TFT_decoplan: | |
663 call TFT_divemask_color | |
664 WIN_TINY decoplan_title_column,decoplan_title_row | |
665 STRCPY_TEXT_PRINT tDiveDecoplan | |
666 call TFT_standard_color | |
667 | |
668 movff char_O_deco_depth+1,lo | |
669 tstfsz lo ; Show another stop? | |
670 bra TFT_display_deko2 ; Yes | |
671 ; No, clear output and return | |
672 call TFT_standard_color | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
96
diff
changeset
|
673 WIN_SMALL decostop_4th_stop_column,decostop_4th_stop_row |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
96
diff
changeset
|
674 STRCPY_PRINT " --- " |
0 | 675 WIN_BOX_BLACK decostop_2nd_stop_row, divemode_simtext_row-1, decostop_2nd_stop_column, decostop_4th_stop_column ; top, bottom, left, right |
676 WIN_BOX_BLACK decostop_5th_stop_row, divemode_simtext_row-1, decostop_5th_stop_column, decostop_6th_stop_column ; top, bottom, left, right | |
677 WIN_BOX_BLACK decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159 ; top, bottom, left, right | |
678 return | |
679 TFT_display_deko2: | |
680 WIN_SMALL decostop_2nd_stop_column,decostop_2nd_stop_row | |
681 movff char_O_deco_depth+1,lo ; stop in m | |
682 bcf lo,7 ; Clear GAS_SWITCH bit | |
683 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
684 movff char_O_deco_time+1,lo ; length of stop in min | |
685 output_99 | |
686 STRCAT_PRINT "'" | |
687 movff char_O_deco_depth+2,lo | |
688 tstfsz lo ; Show another stop? | |
689 bra TFT_display_deko3 ; Yes | |
690 ; No, clear output and return | |
691 WIN_BOX_BLACK decostop_3rd_stop_row, divemode_simtext_row-1, decostop_2nd_stop_column, decostop_4th_stop_column ; top, bottom, left, right | |
692 WIN_BOX_BLACK decostop_4th_stop_row, divemode_simtext_row-1, decostop_4th_stop_column, .159 ; top, bottom, left, right | |
693 return | |
694 | |
695 TFT_display_deko3: | |
696 WIN_SMALL decostop_3rd_stop_column,decostop_3rd_stop_row | |
697 movff char_O_deco_depth+2,lo ; stop in m | |
698 bcf lo,7 ; Clear GAS_SWITCH bit | |
699 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
700 movff char_O_deco_time+2,lo ; length of stop in min | |
701 output_99 | |
702 STRCAT_PRINT "'" | |
703 | |
704 movff char_O_deco_depth+3,lo | |
705 tstfsz lo ; Show another stop? | |
706 bra TFT_display_deko4 ; Yes | |
707 ; No, clear output and return | |
708 WIN_BOX_BLACK decostop_4th_stop_row, divemode_simtext_row-1, decostop_4th_stop_column, .159 ; top, bottom, left, right | |
709 return ; Done. | |
710 | |
711 TFT_display_deko4: | |
712 WIN_SMALL decostop_4th_stop_column,decostop_4th_stop_row | |
713 movff char_O_deco_depth+3,lo ; stop in m | |
714 bcf lo,7 ; Clear GAS_SWITCH bit | |
715 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
716 movff char_O_deco_time+3,lo ; length of stop in min | |
717 output_99 | |
718 STRCAT_PRINT "'" | |
719 | |
720 movff char_O_deco_depth+4,lo | |
721 tstfsz lo ; Show another stop? | |
722 bra TFT_display_deko5 ; Yes | |
723 ; No, clear output and return | |
724 WIN_BOX_BLACK decostop_5th_stop_row, divemode_simtext_row-1, decostop_5th_stop_column, decostop_6th_stop_column ; top, bottom, left, right | |
725 WIN_BOX_BLACK decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159 ; top, bottom, left, right | |
726 return ; Done. | |
727 | |
728 TFT_display_deko5: | |
729 WIN_SMALL decostop_5th_stop_column,decostop_5th_stop_row | |
730 movff char_O_deco_depth+4,lo ; stop in m | |
731 bcf lo,7 ; Clear GAS_SWITCH bit | |
732 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
733 movff char_O_deco_time+4,lo ; length of stop in min | |
734 output_99 | |
735 STRCAT_PRINT "'" | |
736 movff char_O_deco_depth+5,lo | |
737 tstfsz lo ; Show another stop? | |
738 bra TFT_display_deko6 ; Yes | |
739 ; No, clear output and return | |
740 WIN_BOX_BLACK decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159 ; top, bottom, left, right | |
741 return ; Done. | |
742 TFT_display_deko6: | |
743 WIN_SMALL decostop_6th_stop_column,decostop_6th_stop_row | |
744 movff char_O_deco_depth+5,lo ; stop in m | |
745 bcf lo,7 ; Clear GAS_SWITCH bit | |
746 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
747 movff char_O_deco_time+5,lo ; length of stop in min | |
748 output_99 | |
749 STRCAT_PRINT "'" | |
750 movff char_O_deco_depth+6,lo | |
751 tstfsz lo ; Show another stop? | |
752 bra TFT_display_deko7 ; Yes | |
753 ; No, clear output and return | |
754 WIN_BOX_BLACK decostop_7th_stop_row, divemode_simtext_row-1, decostop_7th_stop_column, .159 ; top, bottom, left, right | |
755 return ; Done. | |
756 TFT_display_deko7: | |
757 WIN_SMALL decostop_7th_stop_column,decostop_7th_stop_row | |
758 movff char_O_deco_depth+6,lo ; stop in m | |
759 bcf lo,7 ; Clear GAS_SWITCH bit | |
760 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
761 movff char_O_deco_time+6,lo ; length of stop in min | |
762 output_99 | |
763 STRCAT_PRINT "'" | |
764 return ; Done. | |
765 | |
766 ;TFT_display_deko1: | |
767 ; movff char_O_gradient_factor,lo ; gradient factor | |
768 ; movlw gf_display_threshold ; threshold for display | |
769 ; cpfslt lo ; show value? | |
770 ; bra TFT_display_deko2 ; Yes | |
771 ; ; No | |
772 ; bra TFT_display_ndl_mask2 ; Clear gradient factor | |
773 ; | |
774 | |
131 | 775 global TFT_clear_safety_stop |
776 TFT_clear_safety_stop: | |
777 WIN_BOX_BLACK safetystop_text_row, ndl_text_row-.4, safetystop_text_column, .159 ; top, bottom, left, right | |
778 return | |
779 | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
780 global TFT_show_safety_stop |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
781 TFT_show_safety_stop: |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
782 tstfsz safety_stop_countdown ; Countdown at zero? |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
783 bra TFT_show_safety_stop2 ; No, show stop |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
784 |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
785 bcf show_safety_stop ; Clear flag |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
786 |
131 | 787 btfss safety_stop_active ; Displayed? |
788 return ; No | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
789 bcf safety_stop_active ; Clear flag |
131 | 790 btfsc divemode_menu ; Is the dive mode menu shown? |
791 return ; Yes, return | |
792 rcall TFT_clear_safety_stop ; Yes, Clear stop | |
793 return | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
794 |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
795 TFT_show_safety_stop2: |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
796 bsf safety_stop_active ; Set flag |
131 | 797 decf safety_stop_countdown,F ; Reduce countdown |
798 | |
799 btfsc divemode_menu ; Is the dive mode menu shown? | |
800 return ; Yes, return | |
801 btfsc menuview | |
802 bra TFT_show_safety_stop3 ; No room when menuview=1... | |
803 | |
804 rcall TFT_divemask_color | |
805 WIN_STD safetystop_text_column,safetystop_text_row | |
806 STRCPY_TEXT_PRINT tDiveSafetyStop | |
807 TFT_show_safety_stop3: | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
808 rcall TFT_attention_color ; show in yellow |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
809 WIN_MEDIUM safetystop_column,safetystop_row |
131 | 810 lfsr FSR2,buffer |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
811 movff safety_stop_countdown,lo |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
812 clrf hi |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
813 call convert_time ; converts hi:lo in seconds to mins (hi) and seconds (lo) |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
814 movf hi,W |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
815 movff lo,hi |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
816 movwf lo ; exchange lo and hi |
131 | 817 bsf leftbind |
818 output_8 | |
819 bcf leftbind | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
820 PUTC ':' |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
821 movff hi,lo |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
822 output_99x |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
823 STRCAT_PRINT "" |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
824 WIN_FONT FT_SMALL |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
825 rcall TFT_standard_color |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
826 return |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
827 |
0 | 828 global TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch |
829 TFT_mask_avr_stopwatch: | |
830 ; The mask | |
831 call TFT_divemask_color | |
832 WIN_TINY dive_custom_avr_stop_column1,dive_custom_avr_stop_row | |
833 STRCPY_TEXT_PRINT tDiveTotalAvr | |
834 WIN_TINY dive_custom_avr_stop_column2,dive_custom_avr_stop_row | |
835 STRCPY_TEXT_PRINT tDiveStopwatch | |
836 WIN_TINY dive_custom_avr_stop_column3,dive_custom_avr_stop_row | |
837 STRCPY_TEXT_PRINT tDiveStopAvr | |
838 call TFT_standard_color | |
839 return | |
840 | |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
841 global TFT_dyn_gaslist |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
842 TFT_dyn_gaslist: ; Show the dynamic gaslist |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
843 ; The mask |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
844 call TFT_divemask_color |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
845 WIN_TINY dive_custom_dyn_mask_column,dive_custom_dyn_mask_row |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
846 STRCPY_TEXT_PRINT tGaslist |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
847 call TFT_standard_color |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
848 |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
849 WIN_SMALL dive_custom_dyn_mask_column1,dive_custom_dyn_mask_row1 |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
850 movlw .1 |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
234
diff
changeset
|
851 movwf temp1 |
139 | 852 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint |
54 | 853 rcall TFT_dyn_gaslist_common |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
854 WIN_SMALL dive_custom_dyn_mask_column1,dive_custom_dyn_mask_row2 |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
234
diff
changeset
|
855 incf temp1,F ; +1 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
234
diff
changeset
|
856 movf temp1,W ; into W |
54 | 857 rcall TFT_dyn_gaslist_common |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
858 WIN_SMALL dive_custom_dyn_mask_column2,dive_custom_dyn_mask_row1 |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
234
diff
changeset
|
859 incf temp1,F ; +1 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
234
diff
changeset
|
860 movf temp1,W ; into W |
54 | 861 rcall TFT_dyn_gaslist_common |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
862 WIN_SMALL dive_custom_dyn_mask_column2,dive_custom_dyn_mask_row2 |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
234
diff
changeset
|
863 incf temp1,F ; +1 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
234
diff
changeset
|
864 movf temp1,W ; into W |
54 | 865 rcall TFT_dyn_gaslist_common |
866 call TFT_standard_color | |
867 return | |
868 | |
869 TFT_dyn_gaslist_common: | |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
870 cpfseq active_gas ;1-5 |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
871 bra $+4 |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
234
diff
changeset
|
872 incf temp1,F ; +1 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
234
diff
changeset
|
873 movff temp1,lo |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
234
diff
changeset
|
874 movff temp1,PRODL |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
875 decf PRODL,F ;-1 to have 0-4 |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
876 bsf leftbind |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
877 output_8 ; Gas number |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
878 bcf leftbind |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
879 PUTC ":" |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
880 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
881 PUTC " " ; Clearing space |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
882 movlw 0x00 |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
883 movff WREG,buffer+.11 ; limit to 11 chars |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
884 STRCAT_PRINT "" |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
885 return |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
886 |
54 | 887 |
0 | 888 global TFT_update_avr_stopwatch ; Update average depth and stopwatch |
889 TFT_update_avr_stopwatch: | |
890 call TFT_standard_color | |
891 SAFE_2BYTE_COPY average_divesecs,lo | |
892 call convert_time ; lo=secs, hi=mins | |
893 WIN_MEDIUM dive_avr_stop_column2,dive_avr_stop_row | |
894 bsf leftbind | |
895 movf hi,W | |
896 movff lo,hi | |
897 movwf lo ; exchange lo and hi | |
898 output_8 | |
899 PUTC ':' | |
900 movff hi,lo | |
901 output_99x | |
902 movlw .5 | |
903 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
904 clrf WREG | |
905 movff WREG,buffer+.5 ; limit to 5 chars | |
906 STRCAT_PRINT "" | |
907 | |
908 TSTOSS opt_units ; 0=m, 1=ft | |
909 bra TFT_update_avr_stopwatch_metric | |
910 ;TFT_update_avr_stopwatch_imperial | |
911 movff avr_rel_pressure_total+0,lo | |
912 movff avr_rel_pressure_total+1,hi | |
913 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
914 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
915 WIN_MEDIUM dive_avr_stop_column1,dive_avr_stop_row | |
916 bsf leftbind | |
917 output_16 ; yxz | |
918 STRCAT_PRINT " " | |
919 ; Stopped average depth | |
920 movff avr_rel_pressure+0,lo | |
921 movff avr_rel_pressure+1,hi | |
922 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
923 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
924 WIN_MEDIUM dive_avr_stop_column3,dive_avr_stop_row | |
925 output_16 ; yxz | |
926 bcf leftbind | |
927 STRCAT_PRINT " " | |
928 return | |
929 | |
930 TFT_update_avr_stopwatch_metric: | |
931 ; Non-resettable average depth | |
932 movff avr_rel_pressure_total+0,lo | |
933 movff avr_rel_pressure_total+1,hi | |
934 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
935 WIN_MEDIUM dive_avr_stop_column1,dive_avr_stop_row | |
936 bsf ignore_digit5 ; no cm | |
937 output_16dp .3 ; yxz.a | |
231
834e1c35160c
BUGFIX: Show average depth with one decimal digit only
mh@mh-THINK
parents:
229
diff
changeset
|
938 STRCAT_PRINT " " |
0 | 939 ; Stopped average depth |
940 movff avr_rel_pressure+0,lo | |
941 movff avr_rel_pressure+1,hi | |
942 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
943 WIN_MEDIUM dive_avr_stop_column3,dive_avr_stop_row | |
944 bsf ignore_digit5 ; no cm | |
945 output_16dp .3 ; yxz.a | |
946 bcf leftbind | |
947 bcf ignore_digit5 | |
231
834e1c35160c
BUGFIX: Show average depth with one decimal digit only
mh@mh-THINK
parents:
229
diff
changeset
|
948 STRCAT_PRINT " " |
0 | 949 return |
950 | |
123 | 951 global TFT_ceiling_mask ; The ceiling mask |
952 TFT_ceiling_mask: | |
953 call TFT_divemask_color | |
954 WIN_TINY dive_ceiling_text_column,dive_ceiling_text_row | |
955 STRCPY_TEXT_PRINT tCeiling | |
956 call TFT_standard_color | |
957 return | |
958 | |
959 global TFT_ceiling ; Ceiling | |
960 TFT_ceiling: | |
961 call TFT_standard_color | |
962 WIN_MEDIUM dive_ceiling_value_column,dive_ceiling_value_row | |
963 movff int_O_ceiling+0,lo | |
964 movff int_O_ceiling+1,hi | |
965 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
966 bsf leftbind | |
967 TSTOSS opt_units ; 0=m, 1=ft | |
968 bra TFT_ceiling_metric | |
969 ;TFT_ceiling_imperial | |
970 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
971 output_16 ; yxz | |
972 bcf leftbind | |
973 STRCAT_PRINT " " | |
974 return | |
975 | |
976 TFT_ceiling_metric: | |
977 bsf ignore_digit5 ; no cm | |
978 output_16dp .3 ; yxz.a | |
979 bcf leftbind | |
980 bcf ignore_digit5 | |
981 STRCAT_PRINT " " | |
982 return | |
983 | |
0 | 984 global TFT_hud_mask ; The HUD mask |
985 TFT_hud_mask: | |
986 call TFT_divemask_color | |
987 WIN_TINY dive_custom_hud_column1,dive_custom_hud_row | |
988 STRCPY_TEXT_PRINT tDiveHudMask1 | |
989 WIN_TINY dive_custom_hud_column2,dive_custom_hud_row | |
990 STRCPY_TEXT_PRINT tDiveHudMask2 | |
991 WIN_TINY dive_custom_hud_column3,dive_custom_hud_row | |
992 STRCPY_TEXT_PRINT tDiveHudMask3 | |
993 call TFT_standard_color | |
994 return | |
995 | |
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
996 global TFT_hud_voltages |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
997 TFT_hud_voltages: ; Show HUD details |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
998 WIN_SMALL .5,dive_hud_data_row |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
999 call TFT_standard_color |
192 | 1000 btfss use_O2_sensor1 |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1001 call TFT_warnings_color |
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1002 movff o2_mv_sensor1+0,lo |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1003 movff o2_mv_sensor1+1,hi |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1004 bsf leftbind |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1005 output_16dp .4 ; x.xx |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1006 bcf leftbind |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1007 STRCAT_PRINT "mV " |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1008 WIN_SMALL .55,dive_hud_data_row |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1009 call TFT_standard_color |
192 | 1010 btfss use_O2_sensor2 |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1011 call TFT_warnings_color |
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1012 movff o2_mv_sensor2+0,lo |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1013 movff o2_mv_sensor2+1,hi |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1014 bsf leftbind |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1015 output_16dp .4 ; x.xx |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1016 bcf leftbind |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1017 STRCAT_PRINT "mV " |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1018 WIN_SMALL .105,dive_hud_data_row |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1019 call TFT_standard_color |
192 | 1020 btfss use_O2_sensor3 |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1021 call TFT_warnings_color |
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1022 movff o2_mv_sensor3+0,lo |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1023 movff o2_mv_sensor3+1,hi |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1024 bsf leftbind |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1025 output_16dp .4 ; x.xx |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1026 bcf leftbind |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1027 STRCAT_PRINT "mV " |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1028 call TFT_standard_color |
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1029 return |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1030 |
192 | 1031 global TFT_update_ppo2_sensors ; Update Sensor data |
1032 TFT_update_ppo2_sensors: | |
0 | 1033 ; show three sensors |
1034 bsf leftbind | |
192 | 1035 btfsc use_O2_sensor1 ; Use Sensor 1? |
1036 bra TFT_update_hud1 ; Yes | |
0 | 1037 btfss dive_hud1_displayed ; Was the sensor shown? |
1038 bra TFT_update_hud2 ; Yes, skip clear | |
1039 bcf dive_hud1_displayed ; No, clear display flag | |
192 | 1040 WIN_BOX_BLACK dive_hud_data_row, dive_hud_data_row+.31, dive_hud_sensor1_column, dive_hud_sensor2_column ; top, bottom, left, right |
0 | 1041 WIN_STD dive_hud_sensor1_column+.7,dive_hud_data_row+.5 |
1042 call TFT_standard_color | |
1043 STRCPY_PRINT "---" | |
1044 bra TFT_update_hud2 ; Skip Sensor 1 | |
1045 TFT_update_hud1: | |
1046 WIN_MEDIUM dive_hud_sensor1_column,dive_hud_data_row | |
192 | 1047 movff o2_ppo2_sensor1,lo |
0 | 1048 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
192 | 1049 btfss voting_logic_sensor1 ; Sensor within voting logic? |
1050 bsf win_invert ; No, invert output... | |
1051 btfss voting_logic_sensor1 | |
1052 call TFT_warnings_color ; ... and draw in red | |
0 | 1053 clrf hi |
1054 output_16dp .3 ; x.xx bar | |
1055 STRCAT_PRINT "" | |
192 | 1056 bcf win_invert |
0 | 1057 bsf dive_hud1_displayed ; Set display flag |
1058 TFT_update_hud2: | |
192 | 1059 btfsc use_O2_sensor2 ; Use Sensor 2? |
1060 bra TFT_update_hud3 ; Yes | |
0 | 1061 btfss dive_hud2_displayed ; Was the sensor shown? |
1062 bra TFT_update_hud4 ; Yes, skip clear | |
1063 bcf dive_hud2_displayed ; No, clear display flag | |
192 | 1064 WIN_BOX_BLACK dive_hud_data_row, dive_hud_data_row+.31, dive_hud_sensor2_column, dive_hud_sensor3_column ; top, bottom, left, right |
0 | 1065 WIN_STD dive_hud_sensor2_column+.7,dive_hud_data_row+.5 |
1066 call TFT_standard_color | |
1067 STRCPY_PRINT "---" | |
1068 bra TFT_update_hud4 ; Skip Sensor 2 | |
1069 TFT_update_hud3: | |
1070 WIN_MEDIUM dive_hud_sensor2_column,dive_hud_data_row | |
192 | 1071 movff o2_ppo2_sensor2,lo |
0 | 1072 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
192 | 1073 btfss voting_logic_sensor2 ; Sensor within voting logic? |
1074 bsf win_invert ; No, invert output... | |
1075 btfss voting_logic_sensor2 | |
1076 call TFT_warnings_color ; ... and draw in red | |
0 | 1077 clrf hi |
1078 output_16dp .3 ; x.xx bar | |
1079 STRCAT_PRINT "" | |
192 | 1080 bcf win_invert |
0 | 1081 bsf dive_hud2_displayed ; Set display flag |
1082 TFT_update_hud4: | |
192 | 1083 btfsc use_O2_sensor3 ; Use Sensor 3? |
1084 bra TFT_update_hud5 ; Yes | |
0 | 1085 btfss dive_hud3_displayed ; Was the sensor shown? |
1086 bra TFT_update_hud6 ; Yes, skip clear | |
1087 bcf dive_hud3_displayed ; No, clear display flag | |
192 | 1088 WIN_BOX_BLACK dive_hud_data_row, dive_hud_data_row+.31, dive_hud_sensor3_column, .159 ; top, bottom, left, right |
0 | 1089 WIN_STD dive_hud_sensor3_column+.7,dive_hud_data_row+.5 |
1090 call TFT_standard_color | |
1091 STRCPY_PRINT "---" | |
1092 bra TFT_update_hud6 ; Skip Sensor 3 | |
1093 TFT_update_hud5: | |
1094 WIN_MEDIUM dive_hud_sensor3_column,dive_hud_data_row | |
192 | 1095 movff o2_ppo2_sensor3,lo |
0 | 1096 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
192 | 1097 btfss voting_logic_sensor3 ; Sensor within voting logic? |
1098 bsf win_invert ; No, invert output... | |
1099 btfss voting_logic_sensor3 | |
1100 call TFT_warnings_color ; ... and draw in red | |
0 | 1101 clrf hi |
1102 output_16dp .3 ; x.xx bar | |
1103 STRCAT_PRINT "" | |
192 | 1104 bcf win_invert |
0 | 1105 bsf dive_hud3_displayed ; Set display flag |
1106 TFT_update_hud6: | |
1107 bcf leftbind | |
1108 call TFT_standard_color | |
1109 return | |
1110 | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1111 global TFT_surface_sensor ; Update Sensor data in surface mode |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1112 TFT_surface_sensor: |
249 | 1113 movf hardware_flag,W |
1114 sublw 0x11 ; 2 with BLE | |
1115 btfsc STATUS,Z | |
1116 return ; Ignore for 0x11 | |
1117 | |
0 | 1118 ; show three sensors |
1119 bsf leftbind | |
1120 WIN_SMALL surf_hud_sensor1_column,surf_hud_sensor1_row | |
192 | 1121 btfsc use_O2_sensor1 ; Use Sensor 1? |
1122 bra TFT_surface_sensor1 ; Yes | |
0 | 1123 call TFT_standard_color |
1124 STRCPY_PRINT "--- " | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1125 bra TFT_surface_sensor2 ; Skip Sensor 1 |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1126 TFT_surface_sensor1: |
192 | 1127 movff o2_ppo2_sensor1,lo |
0 | 1128 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
1129 clrf hi | |
1130 output_16dp .3 ; x.xx bar | |
1131 STRCAT_PRINT "" | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1132 TFT_surface_sensor2: |
0 | 1133 WIN_SMALL surf_hud_sensor2_column,surf_hud_sensor2_row |
192 | 1134 btfsc use_O2_sensor2 ; Use Sensor 2? |
1135 bra TFT_surface_sensor3 ; Yes | |
0 | 1136 call TFT_standard_color |
1137 STRCPY_PRINT "--- " | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1138 bra TFT_surface_sensor4 ; Skip Sensor 2 |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1139 TFT_surface_sensor3: |
192 | 1140 movff o2_ppo2_sensor2,lo |
0 | 1141 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
1142 clrf hi | |
1143 output_16dp .3 ; x.xx bar | |
1144 STRCAT_PRINT "" | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1145 TFT_surface_sensor4: |
0 | 1146 WIN_SMALL surf_hud_sensor3_column,surf_hud_sensor3_row |
192 | 1147 btfsc use_O2_sensor3 ; Use Sensor 3? |
1148 bra TFT_surface_sensor5 ; Yes | |
0 | 1149 call TFT_standard_color |
1150 STRCPY_PRINT "--- " | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1151 bra TFT_surface_sensor6 ; Skip Sensor 3 |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1152 TFT_surface_sensor5: |
192 | 1153 movff o2_ppo2_sensor3,lo |
0 | 1154 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
1155 clrf hi | |
1156 output_16dp .3 ; x.xx bar | |
1157 STRCAT_PRINT "" | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1158 TFT_surface_sensor6: |
0 | 1159 bcf leftbind |
1160 call TFT_standard_color | |
1161 return | |
1162 | |
1163 global TFT_menu_hud | |
1164 TFT_menu_hud: ; Yes, update HUD data | |
247
5968af2839a4
BUGFIX: Always update CCR sensor data in Sensor-Menu
heinrichsweikamp
parents:
239
diff
changeset
|
1165 call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays |
50 | 1166 call TFT_attention_color ; show in yellow |
0 | 1167 bsf leftbind |
1168 WIN_SMALL surf_menu_sensor1_column,surf_menu_sensor1_row | |
1169 movff o2_ppo2_sensor1,lo | |
1170 clrf hi | |
1171 output_16dp .3 ; x.xx bar | |
1172 PUTC "," | |
1173 movff o2_mv_sensor1+0,lo ; in 0.1mV steps | |
1174 movff o2_mv_sensor1+1,hi ; in 0.1mV steps | |
1175 output_16dp .4 ; xxx.y mV | |
1176 STRCAT_PRINT "mV " | |
1177 WIN_SMALL surf_menu_sensor2_column,surf_menu_sensor2_row | |
1178 movff o2_ppo2_sensor2,lo | |
1179 clrf hi | |
1180 output_16dp .3 ; x.xx bar | |
1181 PUTC "," | |
1182 movff o2_mv_sensor2+0,lo ; in 0.1mV steps | |
1183 movff o2_mv_sensor2+1,hi ; in 0.1mV steps | |
1184 output_16dp .4 ; xxx.y mV | |
1185 STRCAT_PRINT "mV " | |
1186 WIN_SMALL surf_menu_sensor3_column,surf_menu_sensor3_row | |
1187 movff o2_ppo2_sensor3,lo | |
1188 clrf hi | |
1189 output_16dp .3 ; x.xx bar | |
1190 PUTC "," | |
1191 movff o2_mv_sensor3+0,lo ; in 0.1mV steps | |
1192 movff o2_mv_sensor3+1,hi ; in 0.1mV steps | |
1193 output_16dp .4 ; xxx.y mV | |
1194 STRCAT_PRINT "mV " | |
1195 WIN_SMALL surf_menu_sensor4_column,surf_menu_sensor4_row | |
113 | 1196 |
236 | 1197 btfss analog_o2_input |
113 | 1198 bra TFT_menu_hud_2 ; always for normal OSTC3 |
1199 btfss s8_digital | |
1200 return ; Not for analog | |
1201 TFT_menu_hud_2: | |
0 | 1202 STRCPY "Batt:" |
1203 movff hud_battery_mv+0,lo ; in mV | |
1204 movff hud_battery_mv+1,hi ; in mV | |
1205 output_16dp .2 ; x.yyy V | |
1206 STRCAT_PRINT "V" | |
1207 call TFT_standard_color | |
1208 bcf leftbind | |
1209 return | |
1210 | |
187
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1211 global TFT_menu_calibrate |
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1212 TFT_menu_calibrate: ; update mV data in calibration menu |
229 | 1213 call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays |
113 | 1214 call TFT_attention_color ; show in yellow |
1215 bsf leftbind | |
1216 WIN_SMALL surf_menu_sensor1_column,surf_menu2_sensor1_row | |
1217 movff o2_mv_sensor1+0,lo ; in 0.1mV steps | |
1218 movff o2_mv_sensor1+1,hi ; in 0.1mV steps | |
1219 output_16dp .4 ; xxx.y mV | |
1220 STRCAT_PRINT "mV " | |
1221 WIN_SMALL surf_menu_sensor2_column,surf_menu2_sensor2_row | |
1222 movff o2_mv_sensor2+0,lo ; in 0.1mV steps | |
1223 movff o2_mv_sensor2+1,hi ; in 0.1mV steps | |
1224 output_16dp .4 ; xxx.y mV | |
1225 STRCAT_PRINT "mV " | |
1226 WIN_SMALL surf_menu_sensor3_column,surf_menu2_sensor3_row | |
1227 movff o2_mv_sensor3+0,lo ; in 0.1mV steps | |
1228 movff o2_mv_sensor3+1,hi ; in 0.1mV steps | |
1229 output_16dp .4 ; xxx.y mV | |
1230 STRCAT_PRINT "mV " | |
187
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1231 ; WIN_SMALL surf_menu2_ambient_column,surf_menu2_ambient_row |
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1232 ; PUTC "@" |
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1233 ; SAFE_2BYTE_COPY amb_pressure, lo |
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1234 ; output_16 |
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1235 ; STRCAT_TEXT tMBAR ; mbar |
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1236 ; STRCAT_PRINT " " |
113 | 1237 call TFT_standard_color |
1238 bcf leftbind | |
1239 return | |
1240 | |
0 | 1241 global TFT_clock |
1242 TFT_clock: | |
48 | 1243 WIN_SMALL surf_clock_column,surf_clock_row |
0 | 1244 TFT_clock2: ; called from divemode clock |
1245 call TFT_standard_color | |
1246 movff hours,lo | |
1247 output_99 | |
1248 movlw ':' | |
1249 btfss secs,0 ; blinking every second | |
1250 movlw ' ' | |
1251 movwf POSTINC2 | |
1252 movff mins,lo | |
1253 output_99x | |
1254 STRCAT_PRINT "" | |
1255 return | |
1256 | |
1257 global TFT_show_time_date_menu | |
1258 TFT_show_time_date_menu: | |
1259 call speed_fastest | |
1260 WIN_SMALL .15,.30 | |
1261 call TFT_standard_color | |
1262 movff hours,lo | |
1263 output_99 | |
1264 PUTC ':' | |
1265 movff mins,lo | |
1266 output_99x | |
1267 PUTC ':' | |
1268 movff secs,lo | |
1269 output_99x | |
1270 STRCAT " - " | |
1271 movff month,convert_value_temp+0 | |
1272 movff day,convert_value_temp+1 | |
1273 movff year,convert_value_temp+2 | |
1274 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
1275 STRCAT_PRINT " " | |
1276 return | |
1277 ;============================================================================= | |
1278 | |
1279 global TFT_interval | |
1280 TFT_interval: | |
1281 call TFT_warning_set_window ; Sets the row and column for the current warning | |
1282 tstfsz WREG ; Is there room for the warning? | |
1283 return ; No | |
1284 STRCPY "Int:" | |
1285 movff surface_interval+0,lo | |
1286 movff surface_interval+1,hi | |
1287 call convert_time ; lo=mins, hi=hours | |
1288 movf hi,W | |
1289 movff lo,hi | |
1290 movwf lo ; exchange lo and hi | |
1291 output_99x | |
1292 PUTC ':' | |
1293 movff hi,lo | |
1294 output_99x | |
1295 movlw surf_warning_length ; No, use surface string length | |
1296 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
1297 STRCAT_PRINT "" | |
1298 return | |
1299 | |
41 | 1300 global TFT_surface_decosettings ; Show all deco settings |
1301 TFT_surface_decosettings: | |
1302 ; Deco Mode | |
1303 call TFT_standard_color | |
1304 movff char_I_deco_model,WREG | |
1305 iorwf WREG | |
1306 bnz TFT_surface_decosettings1 | |
1307 | |
1308 ; Display ZH-L16 sat/desat model. | |
1309 TEXT_SMALL surf_gaslist_column,surf_gaslist_row, tZHL16 | |
122
3e84e2a64188
Show %'s for non-GF deco model in surface mode
heinrichsweikamp
parents:
118
diff
changeset
|
1310 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.1) |
41 | 1311 lfsr FSR2,buffer |
1312 movff char_I_desaturation_multiplier,lo | |
1313 bsf leftbind | |
1314 output_8 | |
1315 STRCAT "%/" | |
1316 movff char_I_saturation_multiplier,lo | |
1317 output_8 | |
1318 STRCAT_PRINT "%" | |
1319 bra TFT_surface_decosettings2 | |
1320 | |
1321 ; Display ZH-L16-GF low/high model. | |
1322 TFT_surface_decosettings1: | |
1323 TEXT_SMALL surf_gaslist_column,surf_gaslist_row, tZHL16GF | |
1324 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.1) | |
42 | 1325 STRCPY_TEXT tGF ; GF: |
41 | 1326 movff char_I_GF_Low_percentage,lo |
1327 output_99x | |
42 | 1328 STRCAT "/" |
41 | 1329 movff char_I_GF_High_percentage,lo |
1330 output_99x | |
42 | 1331 STRCAT_PRINT "" |
41 | 1332 ;bra TFT_surface_decosettings2 |
1333 TFT_surface_decosettings2: | |
1334 ; FTTS | |
1335 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.2) | |
1336 STRCPY_TEXT tFTTSMenu | |
1337 movff char_I_extra_time,lo | |
1338 bsf leftbind | |
1339 output_8 | |
1340 STRCAT_TEXT_PRINT tMinutes | |
1341 | |
1342 ; Last Stop | |
1343 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.3) | |
1344 STRCPY_TEXT tLastDecostop | |
1345 movff char_I_depth_last_deco,lo | |
1346 output_8 | |
1347 STRCAT_TEXT_PRINT tMeters | |
1348 | |
1349 ; Salinity | |
1350 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.4) | |
1351 STRCPY_TEXT tDvSalinity | |
1352 movff opt_salinity,lo | |
1353 output_8 | |
1354 bcf leftbind | |
1355 STRCAT_TEXT_PRINT tPercent | |
1356 return ; Done. | |
0 | 1357 |
1358 global TFT_debug_output | |
1359 TFT_debug_output: | |
117 | 1360 return |
113 | 1361 WIN_TINY .80,.0 |
1362 call TFT_standard_color | |
1363 lfsr FSR2,buffer | |
248
afe73e1a0181
support hardware_flag for all possible hardware combinations
heinrichsweikamp
parents:
247
diff
changeset
|
1364 movff hardware_flag,lo |
203 | 1365 output_8 |
0 | 1366 STRCAT_PRINT "" |
123 | 1367 return |
0 | 1368 |
55 | 1369 global TFT_divetimeout ; Show timeout counter |
1370 TFT_divetimeout: | |
1371 call TFT_warning_set_window ; Sets the row and column for the current warning | |
1372 tstfsz WREG ; Is there room for the warning? | |
1373 return ; No | |
1374 | |
1375 call TFT_standard_color | |
1376 STRCPY 0x94 ; "End of dive" icon | |
1377 movlw LOW divemode_timeout | |
1378 movwf sub_a+0 | |
1379 movlw HIGH divemode_timeout | |
1380 movwf sub_a+1 | |
1381 movff timeout_counter,sub_b+0 | |
1382 movff timeout_counter2,sub_b+1 | |
1383 call subU16 ; sub_c = sub_a - sub_b (with UNSIGNED values) | |
1384 movff sub_c+0, lo | |
1385 movff sub_c+1, hi | |
1386 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
1387 movf hi,W | |
1388 movff lo,hi | |
1389 movwf lo ; exchange lo and hi | |
1390 output_99x | |
1391 PUTC ':' | |
1392 movff hi,lo | |
1393 output_99x | |
1394 movlw warning_length ; Divemode string length | |
1395 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
1396 STRCAT_PRINT "" | |
1397 return | |
1398 | |
0 | 1399 global TFT_ftts |
1400 TFT_ftts: | |
1401 movff char_I_extra_time,lo | |
1402 tstfsz lo | |
1403 bra $+4 | |
1404 return ; char_I_extra_time=0, return. | |
1405 incf warning_counter,F ; increase counter | |
1406 call TFT_warning_set_window ; Sets the row and column for the current warning | |
1407 tstfsz WREG ; Is there room for the warning? | |
1408 return ; No | |
1409 movff char_I_extra_time,lo | |
1410 STRCPY "@+" | |
1411 bsf leftbind | |
1412 output_8 | |
1413 PUTC ":" | |
1414 movff int_O_extra_ascenttime+0,lo | |
1415 movff int_O_extra_ascenttime+1,hi | |
1416 movf lo,W | |
1417 iorwf hi,W ; extra_ascenttime == 0 ? | |
1418 bz TFT_ftts2 ; No deco | |
1419 movf lo,W ; extra_ascenttime == 0xFFFF ? | |
1420 andwf hi,W | |
1421 incf WREG,w | |
1422 bz TFT_ftts2 ; Wait... | |
1423 output_16 | |
1424 bcf leftbind | |
1425 PUTC "'" | |
1426 movlw warning_length ; Divemode string length | |
1427 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
1428 STRCAT_PRINT "" | |
1429 return | |
1430 | |
1431 TFT_ftts2: | |
1432 STRCAT "---" | |
1433 bcf leftbind | |
1434 movlw warning_length ; Divemode string length | |
1435 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
1436 STRCAT_PRINT "" | |
1437 return | |
1438 | |
1439 | |
1440 ;============================================================================= | |
1441 | |
1442 global TFT_temp_surfmode | |
1443 TFT_temp_surfmode: | |
1444 WIN_SMALL surf_temp_column,surf_temp_row | |
1445 call TFT_standard_color | |
1446 | |
1447 SAFE_2BYTE_COPY temperature, lo | |
1448 | |
1449 TSTOSS opt_units ; 0=°C, 1=°F | |
1450 bra TFT_temp_surfmode_metric | |
1451 | |
1452 ;TFT_temp_surfmode_imperial: | |
214 | 1453 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
0 | 1454 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit |
1455 lfsr FSR2,buffer ; Overwrite "-" | |
1456 bsf ignore_digit5 ; Full degrees only | |
1457 output_16 | |
1458 STRCAT_PRINT "" | |
1459 call TFT_divemask_color | |
1460 WIN_SMALL surf_temp_column+4*8,surf_temp_row | |
1461 STRCPY_PRINT "°F" | |
1462 return | |
1463 | |
1464 TFT_temp_surfmode_metric: | |
214 | 1465 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
0 | 1466 movlw d'3' |
1467 movwf ignore_digits | |
1468 bsf ignore_digit5 ; Full degrees only | |
1469 output_16 | |
1470 | |
13
2af021c66b0d
fix negative temperature display in surfacemode
heinrichsweikamp
parents:
11
diff
changeset
|
1471 ; read-back the buffer+4 |
2af021c66b0d
fix negative temperature display in surfacemode
heinrichsweikamp
parents:
11
diff
changeset
|
1472 movff buffer+4,lo |
0 | 1473 movlw " " ; Space |
1474 cpfseq lo ; Was it a space (between +1°C and -1°C)? | |
1475 bra TFT_temp_surfmode1 ; No. | |
1476 movlw "0" ; Yes, print manual zero | |
1477 movff WREG,buffer+3 | |
1478 bra TFT_temp_surfmode2 | |
1479 TFT_temp_surfmode1: | |
1480 ; Test if output was negative (Flag set in TFT_convert_signed_16bit) | |
1481 btfss neg_flag ; Negative temperature? | |
1482 bra TFT_temp_surfmode3 ; No, continue | |
1483 ; Yes, negative temperature! | |
1484 movff buffer+3,buffer+2 ; remove two spaces manually | |
1485 movff buffer+4,buffer+3 | |
1486 TFT_temp_surfmode2: | |
1487 movlw 0x00 | |
1488 movff WREG,buffer+4 | |
1489 TFT_temp_surfmode3: | |
1490 STRCAT_PRINT "" | |
1491 call TFT_divemask_color | |
1492 WIN_SMALL surf_temp_column+4*8,surf_temp_row | |
1493 STRCPY_PRINT "°C" | |
1494 return | |
1495 | |
1496 ;============================================================================= | |
1497 global TFT_divemode_menu_cursor | |
1498 TFT_divemode_menu_cursor: | |
1499 WIN_BOX_BLACK divemode_menu_item1_row,divemode_menu_item3_row+.24,divemode_menu_item1_column-.8,divemode_menu_item1_column-.1 | |
1500 WIN_BOX_BLACK divemode_menu_item4_row,divemode_menu_item6_row+.24,divemode_menu_item4_column-.8,divemode_menu_item4_column-.1 | |
1501 call TFT_standard_color | |
1502 | |
1503 movlw divemode_menu_item1_column-.8 | |
1504 btfsc menupos,2 ; >3? | |
1505 movlw divemode_menu_item4_column-.8 ; Yes | |
1506 movff WREG,win_leftx2 | |
1507 | |
1508 movff menupos,lo ; Copy menu pos | |
1509 movlw divemode_menu_item6_row | |
1510 dcfsnz lo,F | |
1511 movlw divemode_menu_item1_row | |
1512 dcfsnz lo,F | |
1513 movlw divemode_menu_item2_row | |
1514 dcfsnz lo,F | |
1515 movlw divemode_menu_item3_row | |
1516 dcfsnz lo,F | |
1517 movlw divemode_menu_item4_row | |
1518 dcfsnz lo,F | |
1519 movlw divemode_menu_item5_row | |
1520 movff WREG,win_top | |
1521 movlw FT_SMALL | |
1522 movff WREG,win_font | |
1523 STRCPY_PRINT "\xb7" ; print cursor | |
1524 return | |
1525 | |
1526 global TFT_temp_divemode | |
1527 TFT_temp_divemode: | |
1528 btfsc divemode_menu ; Is the dive mode menu shown? | |
1529 return ; Yes, return | |
1530 btfsc blinking_better_gas ; blinking better Gas? | |
1531 return ; Yes, no update of temperature now | |
1532 ; temperature | |
1533 WIN_SMALL dive_temp_column,dive_temp_row | |
1534 call TFT_standard_color | |
1535 bsf leftbind | |
1536 | |
1537 SAFE_2BYTE_COPY temperature, lo | |
1538 TSTOSS opt_units ; 0=°C, 1=°F | |
1539 bra TFT_temp_divemode_metric | |
1540 | |
1541 ;TFT_temp_divemode_imperial: | |
214 | 1542 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
0 | 1543 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit |
1544 lfsr FSR2,buffer ; Overwrite "-" (There won't be less then -18°C underwater...) | |
1545 bsf ignore_digit5 ; Full degrees only | |
1546 output_16 | |
1547 STRCAT_TEXT tLogTunitF | |
1548 TFT_temp_divemode_common: | |
1549 bcf leftbind | |
1550 movlw .4 ; limit to three chars | |
1551 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
1552 STRCAT_PRINT "" | |
1553 return ; Done. | |
1554 | |
1555 TFT_temp_divemode_metric: | |
214 | 1556 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
0 | 1557 movlw d'3' |
1558 movwf ignore_digits | |
1559 bsf ignore_digit5 ; Full degrees only | |
1560 output_16 | |
1561 STRCAT_TEXT tLogTunitC | |
1562 bra TFT_temp_divemode_common ; Done. | |
1563 | |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1564 TFT_active_setpoint2: |
0 | 1565 movff char_I_const_ppO2,lo |
1566 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo | |
1567 clrf hi | |
1568 bsf leftbind | |
1569 output_16dp d'3' | |
1570 bcf leftbind | |
1571 STRCAT_TEXT tbar | |
1572 TSTOSS opt_ccr_mode ; =0: Fixed SP, =1: Sensor | |
1573 bra $+4 | |
1574 PUTC "*" | |
1575 STRCAT_PRINT "" | |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1576 return |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1577 |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1578 TFT_active_setpoint: ; Show setpoint |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1579 WIN_STD active_gas_column,active_gas_row |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1580 call TFT_standard_color |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1581 btfsc is_bailout ; =1: Bailout |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1582 bra TFT_active_setpoint_bail ; Show "Bailout" instead of Setpoint |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1583 |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1584 rcall TFT_active_setpoint2 ; show setpoint (Non-Inverted in all cases) |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1585 |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1586 btfss setpoint_fallback ; =1: Fallback to SP1 due to external O2 sensor failure |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1587 bra TFT_active_setpoint_diluent ; Done. |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1588 btg blinking_setpoint ; Toggle blink bit... |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1589 btfss blinking_setpoint ; blink now? |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1590 bra TFT_active_setpoint_diluent ; Done. |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1591 |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1592 movlw color_yellow ; Blink in yellow |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1593 call TFT_set_color |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1594 bsf win_invert ; Set invert flag |
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1595 WIN_STD active_gas_column,active_gas_row |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1596 movff char_I_const_ppO2,lo |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1597 clrf hi |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1598 bsf leftbind |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1599 output_16dp d'3' |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1600 bcf leftbind |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1601 STRCAT_TEXT tbar |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1602 TSTOSS opt_ccr_mode ; =0: Fixed SP, =1: Sensor |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1603 bra $+4 |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1604 PUTC "*" |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1605 STRCAT_PRINT "" |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1606 bcf win_invert ; Reset invert flag |
0 | 1607 |
1608 TFT_active_setpoint_diluent: | |
1609 call TFT_standard_color | |
1610 WIN_SMALL active_dil_column,active_dil_row | |
1611 movff char_I_O2_ratio,lo ; lo now stores O2 in % | |
1612 movff char_I_He_ratio,hi ; hi now stores He in % | |
1613 rcall TFT_show_dil_divemode2 ; Show diluent (Non-Inverted in all cases) | |
1614 | |
1615 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode | |
1616 return ; Done. | |
1617 btg blinking_better_gas ; Toggle blink bit... | |
1618 btfss blinking_better_gas ; blink now? | |
1619 return ; No, Done. | |
1620 | |
1621 movlw color_yellow ; Blink in yellow | |
1622 call TFT_set_color | |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1623 bsf win_invert ; Set invert flag |
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1624 WIN_SMALL active_dil_column,active_dil_row |
0 | 1625 movff char_I_O2_ratio,lo ; lo now stores O2 in % |
1626 movff char_I_He_ratio,hi ; hi now stores He in % | |
1627 rcall TFT_show_dil_divemode2 ; Show gas | |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1628 bcf win_invert ; Reset invert flag |
0 | 1629 call TFT_standard_color |
1630 return ; Done. | |
1631 | |
1632 TFT_show_dil_divemode2: | |
1633 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | |
1634 STRCAT_PRINT "" | |
1635 return | |
1636 | |
1637 TFT_active_setpoint_bail: | |
1638 STRCPY_TEXT_PRINT tDiveBailout ; Bailout | |
1639 bra TFT_active_setpoint_diluent | |
1640 | |
1641 global TFT_active_gas_divemode | |
1642 TFT_active_gas_divemode: ; Display gas/Setpoint | |
1643 btfsc divemode_menu ; Is the dive mode menu shown? | |
1644 return ; Yes, return | |
1645 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode | |
1646 return | |
1647 btfsc FLAG_ccr_mode ; in CCR mode | |
1648 bra TFT_active_setpoint ; Yes, show setpoint | |
1649 | |
1650 call TFT_standard_color | |
1651 WIN_STD active_gas_column,active_gas_row | |
1652 movff char_I_O2_ratio,lo ; lo now stores O2 in % | |
1653 movff char_I_He_ratio,hi ; hi now stores He in % | |
1654 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases) | |
1655 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode | |
1656 return ; Done. | |
1657 | |
1658 btg blinking_better_gas ; Toggle blink bit... | |
1659 btfss blinking_better_gas ; blink now? | |
1660 return ; No, Done. | |
50 | 1661 call TFT_attention_color ; blink in yellow |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1662 bsf win_invert ; Set invert flag |
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1663 WIN_STD active_gas_column,active_gas_row |
0 | 1664 movff char_I_O2_ratio,lo ; lo now stores O2 in % |
1665 movff char_I_He_ratio,hi ; hi now stores He in % | |
1666 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases) | |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1667 bcf win_invert ; Reset invert flag |
0 | 1668 call TFT_standard_color |
1669 return ; Done. | |
1670 | |
1671 TFT_active_gas_divemode2: | |
1672 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | |
1673 STRCAT_PRINT "" | |
1674 return | |
1675 | |
1676 global TFT_display_decotype_surface | |
1677 TFT_display_decotype_surface: | |
1678 WIN_STD surf_decotype_column,surf_decotype_row | |
1679 WIN_COLOR color_lightblue | |
1680 movff opt_dive_mode,lo ; 0=OC, 1=CC, 2=Gauge, 3=Apnea | |
1681 tstfsz lo | |
1682 bra TFT_display_decotype_surface2 | |
116
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1683 TFT_display_decotype_surface0: |
0 | 1684 STRCAT_TEXT_PRINT tDvOC ; OC |
1685 bra TFT_display_decotype_exit | |
1686 TFT_display_decotype_surface2: | |
1687 decfsz lo,F | |
1688 bra TFT_display_decotype_surface3 | |
113 | 1689 STRCAT_TEXT_PRINT tDvCC ; CC |
1690 call TFT_standard_color | |
1691 WIN_TINY surf_decotype_column+.18,surf_decotype_row+.12 | |
1692 | |
1693 TSTOSS opt_ccr_mode ; =0: Fixed SP, =1: Sensor | |
1694 bra TFT_display_decotype_cc_fixed | |
1695 ; Sensor mode | |
1696 STRCPY_TEXT tCCRModeSensor ; Sensor | |
1697 bra TFT_display_decotype_cc_common | |
1698 TFT_display_decotype_cc_fixed: | |
1699 STRCPY_TEXT tCCRModeFixedSP ; Fixed | |
1700 TFT_display_decotype_cc_common: | |
1701 STRCAT_PRINT "" | |
0 | 1702 bra TFT_display_decotype_exit |
1703 TFT_display_decotype_surface3: | |
1704 decfsz lo,F | |
1705 bra TFT_display_decotype_surface4 | |
116
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1706 TFT_display_decotype_surface3_1: |
0 | 1707 STRCAT_TEXT_PRINT tDvGauge ; Gauge |
1708 bra TFT_display_decotype_exit | |
1709 TFT_display_decotype_surface4: | |
1710 STRCAT_TEXT_PRINT tDvApnea ; Apnea | |
1711 TFT_display_decotype_exit: | |
1712 call TFT_standard_color | |
1713 return | |
40 | 1714 |
116
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1715 global TFT_display_decotype_surface1 ; Used from logbook! |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1716 TFT_display_decotype_surface1: ; Used from logbook! |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1717 tstfsz lo |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1718 bra TFT_display_decotype_surface1_2 |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1719 bra TFT_display_decotype_surface0 ;OC |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1720 TFT_display_decotype_surface1_2: |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1721 decfsz lo,F |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1722 bra TFT_display_decotype_surface1_3 |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1723 STRCAT_TEXT_PRINT tDvCC ; CC (w/o Sensor/Fixed Display) |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1724 TFT_display_decotype_surface1_3: |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1725 decfsz lo,F |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1726 bra TFT_display_decotype_surface4 ; Apnea |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1727 bra TFT_display_decotype_surface3_1 ; Gauge |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1728 |
0 | 1729 ;============================================================================= |
1730 | |
1731 global TFT_splist_surfmode ; Show Setpoint list | |
1732 extern gaslist_strcat_setpoint | |
1733 TFT_splist_surfmode: | |
1734 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
1735 ;SP 1 | |
1736 WIN_SMALL surf_gaslist_column,surf_gaslist_row | |
1737 clrf PRODL | |
1738 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
1739 STRCAT_PRINT "" | |
1740 ;SP 2 | |
1741 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
1742 movlw .1 | |
1743 movwf PRODL | |
1744 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
1745 STRCAT_PRINT "" | |
1746 ;SP 3 | |
1747 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) | |
1748 movlw .2 | |
1749 movwf PRODL | |
1750 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
1751 STRCAT_PRINT "" | |
1752 ;SP 4 | |
1753 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3) | |
1754 movlw .3 | |
1755 movwf PRODL | |
1756 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
1757 STRCAT_PRINT "" | |
1758 ;SP 5 | |
1759 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) | |
1760 movlw .4 | |
1761 movwf PRODL | |
1762 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
1763 STRCAT_PRINT "" | |
1764 bcf leftbind | |
1765 return | |
1766 | |
1767 global TFT_gaslist_surfmode | |
1768 TFT_gaslist_surfmode: ; Displays Gas List | |
1769 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
1770 extern gaslist_strcat_gas_mod | |
1771 ;Gas 1 | |
1772 WIN_SMALL surf_gaslist_column,surf_gaslist_row | |
1773 movlw .0 | |
1774 movwf PRODL | |
1775 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
1776 STRCAT_PRINT "" | |
1777 ;Gas 2 | |
1778 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
1779 movlw .1 | |
1780 movwf PRODL | |
1781 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
1782 STRCAT_PRINT "" | |
1783 ;Gas 3 | |
1784 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) | |
1785 movlw .2 | |
1786 movwf PRODL | |
1787 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
1788 STRCAT_PRINT "" | |
1789 ;Gas 4 | |
1790 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3) | |
1791 movlw .3 | |
1792 movwf PRODL | |
1793 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
1794 STRCAT_PRINT "" | |
1795 ;Gas 5 | |
1796 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) | |
1797 movlw .4 | |
1798 movwf PRODL | |
1799 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
1800 STRCAT_PRINT "" | |
1801 bcf leftbind | |
1802 return | |
1803 | |
1804 global TFT_dillist_surfmode | |
1805 TFT_dillist_surfmode: ; Displays Diluent List | |
1806 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
175
d097e10b383b
CHANGE: Draw a frame around the dive mode menu
heinrichsweikamp
parents:
170
diff
changeset
|
1807 bsf ccr_diluent_setup ; Use CCR Diluents... |
d097e10b383b
CHANGE: Draw a frame around the dive mode menu
heinrichsweikamp
parents:
170
diff
changeset
|
1808 rcall TFT_gaslist_surfmode ; Use OC/BAIL routine |
d097e10b383b
CHANGE: Draw a frame around the dive mode menu
heinrichsweikamp
parents:
170
diff
changeset
|
1809 bcf ccr_diluent_setup ; Clear flag |
0 | 1810 return |
1811 | |
1812 global TFT_depth | |
1813 TFT_depth: | |
1814 SAFE_2BYTE_COPY rel_pressure, lo | |
1815 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
1816 | |
1817 TSTOSS opt_units ; 0=m, 1=ft | |
1818 bra TFT_depth_metric | |
1819 ;TFT_depth_imperial | |
1820 WIN_LARGE depth_feet_column,depth_feet_row | |
1821 TFT_color_code warn_depth ; Color-code the output | |
1822 | |
1823 clrf sub_a+1 ; Display 0ft if lower then 30cm | |
1824 movlw d'30' | |
1825 movwf sub_a+0 | |
1826 movff hi,sub_b+1 | |
1827 movff lo,sub_b+0 | |
1828 call subU16 ; sub_c = sub_a - sub_b | |
1829 btfss neg_flag ; Depth lower then 0.4m? | |
1830 bra depth_less_0.3mtr_feet ; Yes, Show 0ft manually | |
1831 | |
1832 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
1833 bsf leftbind | |
1834 output_16 ; feet in Big font | |
1835 bcf leftbind | |
1836 movlw .3 ; limit to three chars | |
1837 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
1838 STRCAT_PRINT "" ; Display feet | |
1839 return | |
126 | 1840 |
0 | 1841 depth_less_0.3mtr_feet: |
1842 STRCAT_PRINT "0 " ; manual zero | |
1843 return | |
1844 | |
1845 TFT_depth_metric: | |
1846 WIN_LARGE depth_column,depth_row | |
1847 TFT_color_code warn_depth ; Color-code the output | |
1848 | |
1849 movlw .039 | |
1850 cpfslt hi | |
1851 bra depth_greater_99_84mtr | |
1852 | |
1853 btfsc depth_greater_100m ; Was depth>100m during last call | |
11 | 1854 rcall TFT_clear_depth ; Yes, clear depth area |
0 | 1855 bcf depth_greater_100m ; Do this once only... |
1856 | |
11 | 1857 movlw .039 |
1858 cpfslt hi | |
1859 bra depth_greater_99_84mtr | |
1860 | |
0 | 1861 movlw HIGH d'1000' |
1862 movwf sub_a+1 | |
1863 movlw LOW d'1000' | |
1864 movwf sub_a+0 | |
1865 movff hi,sub_b+1 | |
1866 movff lo,sub_b+0 | |
1867 incf sub_b+0,F | |
1868 movlw d'0' | |
1869 addwfc sub_b+1,F ; Add 1mbar offset | |
1870 call sub16 ; sub_c = sub_a - sub_b | |
1871 movlw ' ' | |
1872 btfss neg_flag ; Depth lower then 10m? | |
1873 movwf POSTINC2 ; Yes, add extra space | |
1874 | |
1875 clrf sub_a+1 | |
1876 movlw d'99' | |
1877 movwf sub_a+0 | |
1878 movff hi,sub_b+1 | |
1879 movff lo,sub_b+0 | |
1880 call subU16 ; sub_c = sub_a - sub_b | |
1881 btfss neg_flag ; Depth lower then 1m? | |
1882 bra tft_depth2 ; Yes, display manual Zero | |
1883 | |
1884 bsf leftbind | |
1885 bsf ignore_digit4 | |
1886 output_16 ; Full meters in Big font | |
1887 bcf leftbind | |
1888 bra tft_depth3 | |
1889 | |
1890 tft_depth2: | |
153 | 1891 STRCAT "0" ; manual zero |
0 | 1892 |
1893 tft_depth3: | |
1894 STRCAT_PRINT "" ; Display full meters | |
1895 | |
1896 ; .1m in MEDIUM font | |
1897 WIN_MEDIUM depth_dm_column,depth_dm_row | |
1898 TFT_color_code warn_depth ; Color-code the output | |
1899 | |
1900 SAFE_2BYTE_COPY rel_pressure, lo | |
1901 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
126 | 1902 |
0 | 1903 PUTC "." |
1904 movlw HIGH d'30' ; Display 0.0m if lower then 30cm | |
1905 movwf sub_a+1 | |
1906 movlw LOW d'30' | |
1907 movwf sub_a+0 | |
1908 movff hi,sub_b+1 | |
1909 movff lo,sub_b+0 | |
1910 call subU16 ; sub_c = sub_a - sub_b | |
1911 btfss neg_flag ; Depth lower then 0.3m? | |
1912 bra depth_less_0.3mtr ; Yes, Show ".0" manually | |
1913 | |
1914 movlw d'4' | |
1915 movwf ignore_digits | |
1916 bsf ignore_digit5 | |
1917 output_16dp d'0' | |
1918 STRCAT_PRINT "" ; Display decimeters | |
1919 WIN_FONT FT_SMALL | |
1920 return | |
1921 | |
1922 depth_less_0.3mtr: | |
1923 STRCAT_PRINT "0" ; Display 0.0m manually | |
1924 WIN_FONT FT_SMALL | |
1925 return | |
1926 | |
1927 depth_greater_99_84mtr: ; Display only in full meters | |
1928 btfss depth_greater_100m ; Is depth>100m already? | |
1929 rcall TFT_clear_depth ; No, clear depth area and set flag | |
1930 ; Depth is already in hi:lo | |
1931 ; Show depth in Full meters | |
1932 ; That means ignore figure 4 and 5 | |
1933 lfsr FSR2,buffer | |
1934 bsf ignore_digit4 | |
1935 bsf leftbind | |
1936 output_16 | |
1937 bcf leftbind | |
1938 STRCAT_PRINT "" ; Display full meters only | |
1939 WIN_FONT FT_SMALL | |
1940 return | |
1941 | |
1942 TFT_clear_depth: ; No, clear depth area and set flag | |
1943 WIN_BOX_BLACK depth_row, .77,.0, max_depth_column-.1 ;top, bottom, left, right | |
1944 bsf depth_greater_100m ; Set Flag | |
1945 return | |
1946 | |
1947 ;============================================================================= | |
1948 | |
1949 global TFT_custom_text | |
1950 TFT_custom_text: ; Show the custom text | |
1951 lfsr FSR0, opt_name ; Source | |
1952 WIN_SMALL surf_customtext_column,surf_customtext_row1 ; First row | |
1953 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
1954 incfsz lo,F ; Was lo=255? | |
1955 return ; No, all done. | |
1956 lfsr FSR0, opt_name+.12 ; Source | |
1957 WIN_SMALL surf_customtext_column,surf_customtext_row2 ; Second row | |
1958 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
1959 incfsz lo,F ; Was lo=255? | |
1960 return ; No, all done. | |
1961 lfsr FSR0, opt_name+.24 ; Source | |
1962 WIN_SMALL surf_customtext_column,surf_customtext_row3 ; Third row | |
1963 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
1964 incfsz lo,F ; Was lo=255? | |
1965 return ; No, all done. | |
1966 lfsr FSR0, opt_name+.36 ; Source | |
1967 WIN_SMALL surf_customtext_column,surf_customtext_row4 ; Forth row | |
1968 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
1969 incfsz lo,F ; Was lo=255? | |
1970 return ; No, all done. | |
1971 lfsr FSR0, opt_name+.48 ; Source | |
1972 WIN_SMALL surf_customtext_column,surf_customtext_row5 ; Fifth row | |
1973 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
1974 return ; Done. | |
1975 | |
1976 TFT_custom_text_2: | |
1977 lfsr FSR2, buffer ; destination | |
1978 movlw .12 | |
1979 movwf lo ; length/line | |
1980 TFT_custom_text_3: | |
1981 movf POSTINC0,W ; Get byte | |
1982 bz TFT_custom_text_4 ; End if NULL | |
1983 movwf POSTINC2 ; NO: copy | |
1984 decfsz lo,F ; Max len reached ? | |
1985 bra TFT_custom_text_3 ; NO: loop | |
1986 setf lo ; lo=255 -> more to come | |
1987 TFT_custom_text_4: | |
1988 clrf POSTINC2 ; Mark end of string | |
1989 goto aa_wordprocessor ; print and return | |
1990 | |
1991 | |
1992 ;============================================================================= | |
1993 global TFT_update_surf_press | |
1994 TFT_update_surf_press: | |
1995 WIN_SMALL surf_press_column,surf_press_row | |
1996 call TFT_standard_color | |
1997 SAFE_2BYTE_COPY amb_pressure, lo | |
1998 movff lo,sub_a+0 | |
1999 movff hi,sub_a+1 | |
2000 movff last_surfpressure_30min+0,sub_b+0 | |
2001 movff last_surfpressure_30min+1,sub_b+1 | |
2002 call subU16 ; sub_c = sub_a - sub_b | |
2003 btfsc neg_flag ; Pressure lower? | |
2004 rcall update_surf_press2 ; Yes, test threshold | |
2005 | |
2006 tstfsz sub_c+1 ; >255mbar difference? | |
2007 bra update_surf_press_common; Yes, display! | |
2008 movlw d'10' ; 10mbar noise suppression | |
2009 subwf sub_c+0,W | |
2010 btfsc STATUS,C | |
2011 bra update_surf_press_common; Yes, display! | |
2012 SAFE_2BYTE_COPY last_surfpressure_30min, lo ; Overwrite with stable value... | |
2013 | |
2014 update_surf_press_common: | |
2015 output_16 | |
2016 ; Show only 4 figures | |
2017 movff buffer+1,buffer+0 | |
2018 movff buffer+2,buffer+1 | |
2019 movff buffer+3,buffer+2 | |
2020 movff buffer+4,buffer+3 | |
2021 movlw 0x00 | |
2022 movff WREG,buffer+4 | |
2023 STRCAT_PRINT "" | |
2024 call TFT_divemask_color | |
2025 WIN_SMALL surf_press_column+4*8,surf_press_row | |
207 | 2026 STRCPY_TEXT_PRINT tMBAR ; mbar |
0 | 2027 return |
2028 | |
2029 update_surf_press2: | |
2030 movff lo,sub_b+0 | |
2031 movff hi,sub_b+1 | |
2032 movff last_surfpressure_30min+0,sub_a+0 | |
2033 movff last_surfpressure_30min+1,sub_a+1 | |
2034 call subU16 ; sub_c = sub_a - sub_b | |
2035 return | |
2036 | |
2037 ;============================================================================= | |
2038 | |
2039 global TFT_update_batt_voltage | |
2040 TFT_update_batt_voltage: | |
2041 movff batt_percent,lo ; Get battery percent | |
2042 TFT_color_code warn_battery; Color-code battery percent | |
207 | 2043 |
2044 ; Setup charge indicator | |
2045 btfsc cc_active | |
2046 bsf win_invert | |
2047 btfsc cc_active | |
2048 movlw color_yellow | |
2049 btfsc cv_active | |
2050 movlw color_green | |
2051 btfsc cc_active | |
2052 call TFT_set_color | |
2053 | |
0 | 2054 WIN_TINY batt_percent_column,batt_percent_row |
2055 bsf leftbind | |
2056 output_8 | |
2057 bcf leftbind | |
88 | 2058 STRCAT "% " |
2059 movlw 0x00 | |
2060 movff WREG,buffer+4 ; Only "xxx%" | |
2061 STRCAT_PRINT "" | |
207 | 2062 bcf win_invert |
0 | 2063 call TFT_standard_color |
2064 WIN_TINY batt_voltage_column,batt_voltage_row | |
2065 movff batt_voltage+0,lo | |
2066 movff batt_voltage+1,hi | |
2067 bsf leftbind | |
2068 output_16dp .2 | |
2069 bcf leftbind | |
2070 PUTC 'V' | |
2071 movff buffer+5,buffer+3 | |
2072 movlw 0x00 | |
2073 movff WREG,buffer+4 ; Only "x.yV" | |
24 | 2074 STRCAT_PRINT "" |
0 | 2075 return |
2076 | |
2077 ;update_battery_debug: | |
2078 ; call TFT_standard_color | |
2079 ; WIN_TINY .70,.0 | |
2080 ; movff battery_gauge+5,xC+3 | |
2081 ; movff battery_gauge+4,xC+2 | |
2082 ; movff battery_gauge+3,xC+1 | |
2083 ; movff battery_gauge+2,xC+0 | |
2084 ; ; battery_gauge:6 is nAs | |
2085 ; ; devide through 65536 | |
2086 ; ; devide through 152 | |
2087 ; ; Result is 0.01Ah in xC+1:xC+0 | |
2088 ; movlw LOW .152 | |
2089 ; movwf xB+0 | |
2090 ; movlw HIGH .152 | |
2091 ; movwf xB+1 | |
2092 ; call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
2093 ; bsf leftbind | |
2094 ; movff xC+0,lo | |
2095 ; movff xC+1,hi | |
2096 ; output_16 | |
2097 ; STRCAT_PRINT "x.01Ah" | |
2098 ; WIN_FONT FT_SMALL | |
2099 ; bcf leftbind | |
2100 ; return | |
2101 | |
2102 ;============================================================================= | |
2103 | |
2104 global TFT_convert_signed_16bit | |
2105 TFT_convert_signed_16bit: | |
2106 bcf neg_flag ; Positive temperature | |
2107 btfss hi,7 ; Negative temperature ? | |
2108 return ; No, return | |
2109 ; Yes, negative temperature! | |
2110 bsf neg_flag ; Negative temperature | |
2111 PUTC '-' ; Display "-" | |
2112 comf hi ; Then, 16bit sign changes. | |
2113 negf lo | |
2114 btfsc STATUS,C | |
2115 incf hi | |
2116 return ; and return | |
2117 | |
2118 ;============================================================================= | |
2119 | |
2120 global TFT_convert_date | |
2121 TFT_convert_date: ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
2122 movff opt_dateformat,WREG ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD | |
2123 movwf EEDATA ; used as temp here | |
2124 tstfsz EEDATA | |
2125 bra TFT_convert_date1 | |
2126 ; EEDATA was 0 | |
2127 ; Use MMDDYY | |
2128 movff convert_value_temp+0,lo ;month | |
2129 bsf leftbind | |
2130 output_99x | |
2131 PUTC '.' | |
2132 movff convert_value_temp+1,lo ;day | |
2133 bra TFT_convert_date1_common ;year | |
2134 | |
2135 TFT_convert_date1: ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) | |
2136 decfsz EEDATA,F | |
2137 bra TFT_convert_date2 ; EEDATA was 2 | |
2138 ; EEDATA was 1 | |
2139 ; Use DDMMYY | |
2140 movff convert_value_temp+1,lo ;day | |
2141 bsf leftbind | |
2142 output_99x | |
2143 PUTC '.' | |
2144 movff convert_value_temp+0,lo ;month | |
2145 | |
2146 TFT_convert_date1_common: | |
2147 bsf leftbind | |
2148 output_99x | |
2149 PUTC '.' | |
2150 movff convert_value_temp+2,lo ;year | |
2151 output_99x | |
2152 bcf leftbind | |
2153 return | |
2154 | |
2155 TFT_convert_date2: | |
2156 ; Use YYMMDD | |
2157 movff convert_value_temp+2,lo ;year | |
2158 bsf leftbind | |
2159 output_99x | |
2160 PUTC '.' | |
2161 movff convert_value_temp+0,lo ;month | |
2162 output_99x | |
2163 PUTC '.' | |
2164 movff convert_value_temp+1,lo ;day | |
2165 output_99x | |
2166 bcf leftbind | |
2167 return | |
2168 | |
2169 ;============================================================================= | |
2170 | |
2171 global TFT_convert_date_short | |
2172 TFT_convert_date_short: ; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2 | |
2173 movff opt_dateformat,WREG ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD | |
2174 movwf EEDATA ; used as temp here | |
2175 tstfsz EEDATA | |
2176 bra TFT_convert_date_short1 | |
2177 ; EEDATA was 0 | |
2178 ; Use MMDDYY | |
2179 TFT_convert_date_short_common: | |
2180 movff convert_value_temp+0,lo ;month | |
2181 bsf leftbind | |
2182 output_99x | |
2183 PUTC '.' | |
2184 movff convert_value_temp+1,lo ;day | |
2185 output_99x | |
2186 bcf leftbind | |
2187 return | |
2188 | |
2189 TFT_convert_date_short1: | |
2190 decfsz EEDATA,F | |
2191 bra TFT_convert_date_short_common ; EEDATA was 2 -> Use YYMMDD | |
2192 ; EEDATA was 1 | |
2193 ; Use DDMMYY | |
2194 movff convert_value_temp+1,lo ;day | |
2195 bsf leftbind | |
2196 output_99x | |
2197 PUTC '.' | |
2198 movff convert_value_temp+0,lo ;month | |
2199 output_99x | |
2200 bcf leftbind | |
2201 return | |
2202 | |
2203 ;============================================================================= | |
2204 | |
2205 global TFT_date | |
2206 TFT_date: | |
48 | 2207 WIN_SMALL surf_date_column,surf_date_row ; Init new Wordprocessor |
0 | 2208 call TFT_standard_color |
2209 movff month,convert_value_temp+0 | |
2210 movff day,convert_value_temp+1 | |
2211 movff year,convert_value_temp+2 | |
2212 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
2213 STRCAT_PRINT "" | |
2214 return | |
2215 | |
2216 ;============================================================================= | |
2217 | |
2218 global TFT_max_pressure | |
2219 TFT_max_pressure: | |
2220 btfsc FLAG_apnoe_mode ; different display in apnoe mode | |
2221 bra TFT_max_pressure_apnoe | |
2222 TFT_max_pressure2: | |
2223 SAFE_2BYTE_COPY max_pressure, lo | |
2224 TFT_max_pressure3: | |
2225 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2226 TSTOSS opt_units ; 0=m, 1=ft | |
2227 bra TFT_max_pressure2_metric | |
2228 ;TFT_max_pressure2_imperial | |
2229 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
2230 WIN_MEDIUM max_depth_feet_column,max_depth_feet_row | |
2231 call TFT_standard_color | |
2232 output_16_3 | |
2233 STRCAT_PRINT "" | |
2234 return | |
2235 | |
2236 TFT_max_pressure2_metric: | |
11 | 2237 WIN_MEDIUM max_depth_column,max_depth_row |
2238 | |
2239 movlw .039 | |
2240 cpfslt hi | |
2241 bra max_depth_greater_99_84mtr | |
2242 | |
2243 btfsc max_depth_greater_100m ; Was depth>100m during last call | |
2244 rcall TFT_clear_max_depth ; Yes, clear depth area | |
2245 bcf max_depth_greater_100m ; Do this once only... | |
2246 | |
2247 movlw .039 | |
2248 cpfslt hi | |
2249 bra max_depth_greater_99_84mtr | |
2250 | |
2251 movlw HIGH d'1000' | |
2252 movwf sub_a+1 | |
2253 movlw LOW d'1000' | |
2254 movwf sub_a+0 | |
2255 movff hi,sub_b+1 | |
2256 movff lo,sub_b+0 | |
2257 incf sub_b+0,F | |
2258 movlw d'0' | |
2259 addwfc sub_b+1,F ; Add 1mbar offset | |
2260 call sub16 ; sub_c = sub_a - sub_b | |
2261 movlw ' ' | |
2262 btfss neg_flag ; Depth lower then 10m? | |
2263 movwf POSTINC2 ; Yes, add extra space | |
2264 | |
2265 clrf sub_a+1 | |
2266 movlw d'99' | |
2267 movwf sub_a+0 | |
2268 movff hi,sub_b+1 | |
2269 movff lo,sub_b+0 | |
2270 call subU16 ; sub_c = sub_a - sub_b | |
2271 btfss neg_flag ; Depth lower then 1m? | |
2272 bra tft_max_depth2 ; Yes, display manual Zero | |
2273 | |
2274 bsf ignore_digit4 ; no 0.1m | |
2275 bsf leftbind | |
2276 output_16 | |
2277 bra tft_max_depth3 | |
2278 | |
2279 tft_max_depth2: | |
0 | 2280 WIN_MEDIUM max_depth_column,max_depth_row |
11 | 2281 STRCAT "0" |
2282 | |
2283 tft_max_depth3: | |
0 | 2284 call TFT_standard_color |
11 | 2285 STRCAT_PRINT "" ; Display full meters |
2286 bcf leftbind | |
2287 | |
2288 ; .1m in SMALL font | |
2289 WIN_SMALL max_depth_dm_column,max_depth_dm_row | |
2290 | |
2291 SAFE_2BYTE_COPY max_pressure, lo | |
2292 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2293 | |
2294 PUTC "." | |
2295 | |
2296 movlw d'4' | |
2297 movwf ignore_digits | |
2298 bsf ignore_digit5 | |
2299 bsf leftbind | |
2300 output_16dp d'0' | |
2301 STRCAT_PRINT "" ; Display decimeters | |
2302 bcf leftbind | |
2303 return | |
2304 | |
2305 max_depth_greater_99_84mtr: ; Display only in full meters | |
2306 btfss max_depth_greater_100m ; Is max depth>100m already? | |
2307 rcall TFT_clear_max_depth ; No, clear max depth area and set flag | |
2308 ; Max. Depth is already in hi:lo | |
2309 ; Show max. depth in Full meters | |
2310 ; That means ignore figure 4 and 5 | |
2311 lfsr FSR2,buffer | |
2312 bsf ignore_digit4 | |
2313 bsf leftbind | |
0 | 2314 output_16 |
11 | 2315 bcf leftbind |
2316 STRCAT_PRINT "" ; Display full meters only | |
2317 WIN_FONT FT_SMALL | |
0 | 2318 return |
2319 | |
11 | 2320 TFT_clear_max_depth: ; No, clear max. depth area and set flag |
2321 WIN_BOX_BLACK max_depth_row,.49,max_depth_column, max_depth_dm_column+.13 ;top, bottom, left, right | |
2322 bsf max_depth_greater_100m ; Set Flag | |
2323 return | |
2324 | |
2325 | |
0 | 2326 TFT_max_pressure_apnoe: |
2327 btfss FLAG_active_descent ; Are we descending? | |
2328 bra TFT_max_pressure2 ; Yes, show normal max. | |
2329 SAFE_2BYTE_COPY apnoe_max_pressure, lo | |
2330 bra TFT_max_pressure3 ; Show apnoe_max_pressure as max. depth | |
2331 | |
2332 global TFT_display_apnoe_last_max | |
2333 TFT_display_apnoe_last_max: | |
2334 call TFT_divemask_color | |
2335 WIN_TINY last_max_apnoe_text_column,last_max_apnoe_text_row | |
2336 STRCPY_TEXT_PRINT tApnoeMax | |
2337 | |
2338 call TFT_standard_color | |
2339 SAFE_2BYTE_COPY max_pressure, lo | |
2340 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2341 TSTOSS opt_units ; 0=m, 1=ft | |
2342 bra TFT_display_apnoe_last_m_metric | |
2343 ;TFT_display_apnoe_last_max_imperial | |
2344 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
2345 WIN_MEDIUM apnoe_last_max_depth_column,apnoe_last_max_depth_row | |
2346 output_16 | |
2347 STRCAT_PRINT "" | |
2348 return | |
2349 | |
2350 TFT_display_apnoe_last_m_metric: | |
2351 WIN_MEDIUM apnoe_last_max_depth_column,apnoe_last_max_depth_row | |
2352 bsf ignore_digit5 ; do not display 1cm depth | |
2353 output_16dp d'3' | |
2354 STRCAT_PRINT "" | |
2355 return | |
2356 | |
2357 ;============================================================================= | |
2358 global TFT_divemins | |
2359 TFT_divemins: | |
2360 movff divemins+0,lo | |
2361 movff divemins+1,hi | |
98 | 2362 bcf leftbind |
0 | 2363 |
2364 btfsc no_more_divesecs ; Ignore seconds? | |
2365 bra TFT_divemins2 ; Show minutes only | |
2366 | |
2367 movlw .99 | |
2368 cpfsgt lo ; bigger then 99? | |
2369 bra TFT_divemins1 ; No show mins:secs | |
2370 ; Yes, remove second display for the rest of the dive and clear seconds | |
2371 bsf no_more_divesecs ; Set flag | |
2372 ; Clear rest of seconds | |
2373 WIN_BOX_BLACK divetime_row, warning1_row,divetime_column,.159 ;top, bottom, left, right | |
2374 bra TFT_divemins2 ; Show minutes only | |
2375 | |
2376 TFT_divemins1: | |
2377 WIN_MEDIUM divetime_column, divetime_row | |
2378 output_16_3 ; displays only last three figures from a 16Bit value (0-999) | |
2379 call TFT_standard_color | |
2380 STRCAT_PRINT "" ; Show minutes in large font | |
2381 | |
2382 WIN_SMALL divetime_secs_column, divetime_secs_row ; left position for two sec figures | |
2383 PUTC ':' | |
2384 bsf leftbind | |
2385 movff divesecs,lo | |
2386 output_99x | |
2387 bcf leftbind | |
2388 STRCAT_PRINT "" ; Show seconds in small font | |
2389 return | |
2390 | |
2391 TFT_divemins2: | |
2392 WIN_MEDIUM divetime_minsonly_column, divetime_row | |
2393 output_16 | |
2394 call TFT_standard_color | |
2395 STRCAT_PRINT "" ; Show minutes in large font | |
2396 return | |
2397 | |
2398 ;============================================================================= | |
2399 global TFT_display_apnoe_surface | |
2400 TFT_display_apnoe_surface: | |
2401 call TFT_divemask_color | |
2402 WIN_TINY surface_apnoe_text_column,surface_apnoe_text_row | |
2403 STRCPY_TEXT_PRINT tApnoeSurface | |
2404 | |
2405 call TFT_standard_color | |
2406 WIN_MEDIUM surface_time_apnoe_column, surface_time_apnoe_row | |
2407 movff apnoe_surface_mins,lo | |
2408 output_8 | |
2409 PUTC ':' | |
2410 movff apnoe_surface_secs,lo | |
2411 output_99x | |
2412 STRCAT_PRINT "" | |
2413 return | |
2414 | |
2415 global TFT_apnoe_clear_surface | |
2416 TFT_apnoe_clear_surface: | |
2417 ; Clear Surface timer.... | |
2418 WIN_BOX_BLACK surface_apnoe_text_row, .239, surface_apnoe_text_column, .159 ;top, bottom, left, right | |
2419 return | |
2420 | |
2421 global TFT_display_apnoe_descent | |
2422 TFT_display_apnoe_descent: ; Descent divetime | |
2423 movff apnoe_mins,lo | |
2424 clrf hi | |
2425 WIN_MEDIUM divetime_column, divetime_row | |
2426 output_16_3 ; displays only last three figures from a 16Bit value (0-999) | |
2427 call TFT_standard_color | |
2428 STRCAT_PRINT "" ; Show minutes in large font | |
2429 WIN_SMALL divetime_secs_column, divetime_secs_row ; left position for two sec figures | |
2430 PUTC ':' | |
2431 bsf leftbind | |
2432 movff apnoe_secs,lo | |
2433 output_99x | |
2434 bcf leftbind | |
2435 STRCAT_PRINT "" ; Show seconds in small font | |
38 | 2436 |
2437 call TFT_divemask_color | |
2438 WIN_TINY total_apnoe_text_column,total_apnoe_text_row | |
2439 STRCPY_TEXT_PRINT tApnoeTotal | |
2440 call TFT_standard_color | |
2441 movff divemins,lo | |
2442 clrf hi | |
2443 WIN_MEDIUM apnoe_total_divetime_column, apnoe_total_divetime_row | |
2444 output_16_3 ; displays only last three figures from a 16Bit value (0-999) | |
2445 call TFT_standard_color | |
2446 STRCAT_PRINT "" ; Show minutes in large font | |
2447 WIN_SMALL apnoe_total_divetime_secs_column, apnoe_total_divetime_secs_row ; left position for two sec figures | |
2448 PUTC ':' | |
2449 bsf leftbind | |
2450 movff divesecs,lo | |
2451 output_99x | |
2452 bcf leftbind | |
2453 STRCAT_PRINT "" ; Show seconds in small font | |
0 | 2454 return |
2455 | |
2456 ;============================================================================= | |
2457 ; Writes ostc3 #Serial and Firmware version in splash screen | |
2458 ; | |
2459 global TFT_serial | |
2460 TFT_serial: | |
213 | 2461 WIN_TINY .5,.225 |
200 | 2462 STRCPY "OSTC" ; Won't translate that... |
260 | 2463 |
2464 movlw 0x0A | |
2465 cpfseq hardware_flag | |
200 | 2466 bra TFT_serial2 |
2467 STRCAT "3 #" | |
260 | 2468 bra TFT_serial_common |
2469 TFT_serial2: | |
2470 movlw 0x05 | |
2471 cpfseq hardware_flag | |
200 | 2472 bra TFT_serial3 |
2473 STRCAT " cR #" | |
260 | 2474 bra TFT_serial_common |
200 | 2475 TFT_serial3: |
260 | 2476 movlw 0x11 |
2477 cpfseq hardware_flag | |
2478 bra TFT_serial4 | |
2479 STRCAT "2 #" | |
2480 bra TFT_serial_common | |
2481 TFT_serial4: | |
2482 movlw 0x1A | |
2483 cpfseq hardware_flag | |
2484 bra TFT_serial5 | |
2485 STRCAT "3 #" | |
2486 ; bra TFT_serial_common | |
2487 TFT_serial5: | |
2488 TFT_serial_common: | |
0 | 2489 rcall TFT_cat_serial |
2490 STRCAT " v" | |
180 | 2491 WIN_COLOR color_greenish |
0 | 2492 rcall TFT_cat_firmware |
2493 | |
2494 ifdef __DEBUG | |
2495 movlw color_grey ; Write header in blue when | |
2496 call TFT_set_color ; compiled in DEBUG mode... | |
2497 STRCAT_PRINT "DEBUG" | |
2498 else | |
76 | 2499 STRCAT_PRINT "" |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
2500 bcf win_invert ; Reset invert flag |
0 | 2501 call TFT_standard_color |
76 | 2502 |
0 | 2503 movlw softwareversion_beta ; =1: Beta, =0: Release |
2504 decfsz WREG,F | |
2505 return ; Release version -> Return | |
2506 | |
2507 call TFT_warnings_color | |
2508 WIN_LEFT .160-4*9/2 ; Right pad. | |
2509 STRCPY_TEXT_PRINT tBeta | |
2510 endif | |
76 | 2511 call TFT_standard_color |
0 | 2512 return |
2513 | |
2514 | |
2515 | |
2516 ;============================================================================= | |
2517 ; For the Information menu: append firmware x.yy version. | |
2518 global info_menu_firmware | |
2519 extern tFirmware | |
2520 info_menu_firmware: | |
2521 lfsr FSR1,tFirmware | |
2522 call strcat_text | |
180 | 2523 rcall TFT_cat_firmware |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
2524 bcf win_invert ; Reset invert flag |
180 | 2525 return |
2526 | |
76 | 2527 global TFT_cat_firmware |
0 | 2528 TFT_cat_firmware: |
2529 movlw softwareversion_x | |
2530 movwf lo | |
2531 bsf leftbind | |
2532 output_8 | |
2533 PUTC '.' | |
2534 movlw softwareversion_y | |
2535 movwf lo | |
2536 output_99x | |
2537 bcf leftbind | |
180 | 2538 ; Check firmware date |
2539 movlw firmware_expire_year-.1 | |
2540 cpfsgt year ; > threshold? | |
2541 return | |
2542 movlw firmware_expire_month-.1 | |
2543 cpfsgt month ; > threshold? | |
2544 return | |
2545 movlw firmware_expire_day-.1 | |
2546 cpfsgt day ; > threshold? | |
2547 return | |
2548 | |
2549 ; Show in "change firmware" style | |
2550 movlw color_yellow | |
2551 call TFT_set_color | |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
2552 bsf win_invert ; Set invert flag |
0 | 2553 return |
2554 | |
2555 ;----------------------------------------------------------------------------- | |
2556 ; For the Information menu: append serial number ostc3#42. | |
2557 global info_menu_serial | |
2558 extern tSerial | |
2559 info_menu_serial: | |
2560 lfsr FSR1,tSerial | |
2561 call strcat_text | |
76 | 2562 global TFT_cat_serial |
0 | 2563 TFT_cat_serial: |
2564 clrf EEADRH | |
2565 clrf EEADR ; Get Serial number LOW | |
2566 call read_eeprom ; read byte | |
2567 movff EEDATA,lo | |
2568 incf EEADR,F ; Get Serial number HIGH | |
2569 call read_eeprom ; read byte | |
2570 movff EEDATA,hi | |
2571 | |
2572 bsf leftbind | |
2573 output_16 | |
2574 bcf leftbind | |
2575 return | |
2576 | |
2577 ;----------------------------------------------------------------------------- | |
2578 ; For the Information menu: Append total dives | |
2579 global info_menu_total_dives | |
2580 extern tTotalDives | |
2581 info_menu_total_dives: | |
2582 lfsr FSR1,tTotalDives | |
2583 call strcat_text | |
2584 TFT_cat_total_dives: | |
2585 read_int_eeprom .2 | |
2586 movff EEDATA,lo | |
2587 read_int_eeprom .3 | |
2588 movff EEDATA,hi | |
2589 bsf leftbind | |
2590 output_16 | |
2591 bcf leftbind | |
2592 return | |
2593 | |
62 | 2594 ; For the Information menu: Append battery voltage |
2595 global info_menu_battery_volts | |
2596 extern tBatteryV | |
2597 info_menu_battery_volts: | |
2598 lfsr FSR1,tBatteryV | |
2599 call strcat_text | |
2600 movff batt_voltage+1,hi | |
2601 movff batt_voltage+0,lo | |
2602 bsf leftbind | |
2603 output_16dp .2 ; x.xxx | |
2604 bcf leftbind | |
2605 PUTC "V" | |
2606 return | |
2607 | |
0 | 2608 ;----------------------------------------------------------------------------- |
2609 ; ppO2 menu | |
2610 global divesets_ppo2_max | |
2611 extern tPPO2Max | |
2612 extern tbar | |
2613 divesets_ppo2_max: | |
2614 lfsr FSR1,tPPO2Max | |
2615 call strcat_text | |
2616 movff opt_ppO2_max,lo | |
2617 movlw ppo2_warning_high | |
2618 divesets_ppo2_common: | |
2619 movwf up ; Save default value | |
2620 clrf hi | |
2621 bsf leftbind | |
2622 output_16dp d'3' | |
2623 bcf leftbind | |
2624 lfsr FSR1,tbar | |
2625 call strcat_text | |
2626 | |
2627 movf up,W ; Default value | |
2628 cpfseq lo ; Current value | |
2629 bra divesets_ppo2_common2 ; Not default, add * | |
2630 return ; Default, Done. | |
2631 divesets_ppo2_common2: | |
2632 PUTC "*" | |
2633 return ; Done. | |
2634 | |
2635 global divesets_ppo2_min | |
2636 extern tPPO2Min | |
2637 divesets_ppo2_min: | |
2638 lfsr FSR1,tPPO2Min | |
2639 call strcat_text | |
2640 movff opt_ppO2_min,lo | |
2641 movlw ppo2_warning_low | |
2642 bra divesets_ppo2_common | |
2643 | |
2644 ;============================================================================= | |
2645 | |
2646 global TFT_clear_warning_text | |
2647 TFT_clear_warning_text: | |
2648 btfss divemode ; in divemode? | |
2649 bra TFT_clear_warning_text2 ; No, setup for surface mode | |
2650 WIN_BOX_BLACK warning1_row, divemode_customview_row-3, warning1_column, warning_icon_column-3 ;top, bottom, left, right | |
2651 return | |
2652 TFT_clear_warning_text2: | |
2653 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ;top, bottom, left, right | |
2654 return | |
2655 | |
2656 global TFT_clear_warning_text_2nd_row | |
2657 TFT_clear_warning_text_2nd_row: | |
2658 btfss divemode ; in divemode? | |
2659 bra TFT_clear_warning_text_2nd_2 ; No, setup for surface mode | |
2660 WIN_BOX_BLACK warning2_row, divemode_customview_row-3, warning2_column, warning_icon_column-3 ;top, bottom, left, right | |
2661 return | |
2662 TFT_clear_warning_text_2nd_2: | |
2663 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ;top, bottom, left, right | |
2664 return | |
2665 | |
2666 global TFT_fillup_with_spaces | |
2667 TFT_fillup_with_spaces: ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2668 movwf lo ; save max. string length into lo | |
2669 movf FSR2L,W ; Get current string length | |
2670 subwf lo,F ; lo-WREG | |
2671 btfsc STATUS,N ; longer then #lo already? | |
2672 return ; Yes, done. | |
2673 tstfsz lo ; Zero? | |
2674 bra TFT_fillup_with_spaces2 ; No. | |
2675 return ; Yes, done. | |
2676 TFT_fillup_with_spaces2: | |
2677 PUTC " " ; Add one space | |
2678 decfsz lo,F ; All done? | |
2679 bra TFT_fillup_with_spaces2 ; No, loop | |
2680 return ; Done. | |
2681 | |
2682 global TFT_desaturation_time | |
2683 TFT_desaturation_time: | |
2684 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
2685 tstfsz WREG ; Is there room for the warning? | |
2686 return ; No | |
2687 STRCPY "Desat:" | |
2688 movff desaturation_time+0,lo ; divide by 60... | |
2689 movff desaturation_time+1,hi | |
2690 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
2691 bsf leftbind | |
2692 movf lo,W | |
2693 movff hi,lo | |
2694 movwf hi ; exchange lo and hi... | |
2695 output_8 ; Hours | |
2696 PUTC ':' | |
2697 movff hi,lo ; Minutes | |
2698 output_99x | |
2699 bcf leftbind | |
2700 movlw surf_warning_length ; Only use surface string length | |
2701 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
60 | 2702 movlw .0 |
2703 movff WREG,buffer+11 | |
0 | 2704 STRCAT_PRINT "" |
2705 return | |
2706 | |
2707 global TFT_nofly_time | |
2708 TFT_nofly_time: | |
2709 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
2710 tstfsz WREG ; Is there room for the warning? | |
2711 return ; No | |
2712 STRCPY "NoFly:" | |
2713 movff nofly_time+0,lo ; divide by 60... | |
2714 movff nofly_time+1,hi | |
2715 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
2716 bsf leftbind | |
2717 movf lo,W | |
2718 movff hi,lo | |
2719 movwf hi ; exchange lo and hi... | |
2720 output_8 ; Hours | |
2721 PUTC ':' | |
2722 movff hi,lo ; Minutes | |
2723 output_99x | |
2724 bcf leftbind | |
2725 movlw surf_warning_length ; Only use surface string length | |
2726 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
60 | 2727 movlw .0 |
2728 movff WREG,buffer+11 | |
0 | 2729 STRCAT_PRINT "" |
2730 return | |
2731 | |
2732 global TFT_warning_agf | |
2733 TFT_warning_agf: | |
2734 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
2735 tstfsz WREG ; Is there room for the warning? | |
2736 return ; No | |
2737 call TFT_warnings_color | |
2738 STRCPY_TEXT tDiveaGF_active ; "aGF!" | |
2739 movlw warning_length ; Divemode string length | |
2740 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2741 STRCAT_PRINT "" | |
2742 call TFT_standard_color | |
2743 return | |
2744 | |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2745 global TFT_warning_fallback |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2746 TFT_warning_fallback: ; Show fallback warning |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2747 rcall TFT_warning_set_window ; Sets the row and column for the current warning |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2748 tstfsz WREG ; Is there room for the warning? |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2749 return ; No |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2750 call TFT_warnings_color |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2751 STRCPY_TEXT tDiveFallback ; "Fallback!" |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2752 movlw warning_length ; Divemode string length |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2753 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2754 STRCAT_PRINT "" |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2755 call TFT_standard_color |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2756 return |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2757 |
0 | 2758 global TFT_warning_gf |
2759 TFT_warning_gf: ;GF | |
2760 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
2761 tstfsz WREG ; Is there room for the warning? | |
2762 return ; No | |
2763 TFT_color_code warn_gf ; Color-code Output | |
2764 STRCPY "GF:" | |
2765 movff char_O_gradient_factor,lo ; gradient factor | |
2766 bsf leftbind | |
2767 output_8 | |
2768 PUTC "%" | |
2769 movlw warning_length ; Divemode string length | |
2770 btfss divemode ; In Divemode? | |
2771 movlw surf_warning_length ; No, use surface string length | |
2772 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2773 STRCAT_PRINT "" | |
2774 bcf leftbind | |
2775 call TFT_standard_color | |
2776 return | |
2777 | |
2778 TFT_warning_set_window: ; Sets the row and column for the current warning | |
2779 ; ignore warning (now)? | |
2780 decf warning_counter,W ; -1 | |
2781 bcf STATUS,C | |
2782 rrcf WREG,W ; (warning_counter-1)/2 | |
2783 cpfseq warning_page | |
2784 retlw .255 ; WREG <> 0 -> Warning window not defined | |
2785 | |
2786 call TFT_standard_color | |
2787 | |
2788 btfss divemode ; in divemode? | |
2789 bra TFT_warning_set_window3 ; No, setup for surface mode | |
2790 | |
2791 btfss warning_counter,0 ; Toggle with each warning | |
2792 bra TFT_warning_set_window2 | |
2793 WIN_SMALL warning1_column,warning1_row | |
2794 bcf second_row_warning ; =1: The second row contains a warning | |
2795 retlw .0 ; WREG=0 -> Warning window defined | |
2796 TFT_warning_set_window2: | |
2797 WIN_SMALL warning2_column,warning2_row | |
2798 bsf second_row_warning ; =1: The second row contains a warning | |
2799 retlw .0 ; WREG=0 -> Warning window defined | |
2800 | |
2801 TFT_warning_set_window3: | |
2802 btfss warning_counter,0 ; Toggle with each warning | |
2803 bra TFT_warning_set_window4 | |
2804 WIN_SMALL surf_warning1_column,surf_warning1_row | |
2805 bcf second_row_warning ; =1: The second row contains a warning | |
2806 retlw .0 ; WREG=0 -> Warning window defined | |
2807 TFT_warning_set_window4: | |
2808 WIN_SMALL surf_warning2_column,surf_warning2_row | |
2809 bsf second_row_warning ; =1: The second row contains a warning | |
2810 retlw .0 ; WREG=0 -> Warning window defined | |
2811 | |
2812 | |
2813 global TFT_update_batt_percent_divemode | |
2814 TFT_update_batt_percent_divemode: | |
2815 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
2816 tstfsz WREG ; Is there room for the warning? | |
2817 return ; No | |
2818 movff batt_percent,lo ; Get battery percent | |
2819 TFT_color_code warn_battery; Color-code battery percent | |
2820 STRCPY "Batt:" | |
2821 bsf leftbind | |
2822 output_8 | |
2823 bcf leftbind | |
2824 PUTC "%" | |
2825 movlw warning_length ; Divemode string length | |
2826 btfss divemode ; In Divemode? | |
2827 movlw surf_warning_length ; No, use surface string length | |
2828 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2829 STRCAT_PRINT "" | |
2830 call TFT_standard_color | |
2831 return | |
2832 | |
2833 | |
2834 global TFT_gf_mask ; Setup Mask | |
2835 TFT_gf_mask: | |
2836 ; The mask | |
2837 call TFT_divemask_color | |
2838 WIN_TINY dive_gf_column1,dive_gf_text_row | |
2839 STRCPY_TEXT_PRINT tGFactors | |
2840 WIN_TINY dive_gf_column2,dive_gf_text_row | |
2841 STRCPY_TEXT_PRINT taGFactors | |
2842 WIN_TINY dive_gf_column3,dive_gf_text_row | |
2843 STRCPY_TEXT_PRINT tGFInfo | |
2844 | |
2845 ; Show GF (Static) | |
2846 call TFT_disabled_color | |
2847 btfss use_agf | |
2848 call TFT_standard_color | |
2849 | |
2850 WIN_STD dive_gf_column,dive_gf_row | |
2851 bsf leftbind | |
2852 movff opt_GF_low,lo | |
2853 output_8 | |
2854 PUTC "/" | |
2855 movff opt_GF_high,lo | |
2856 output_8 | |
2857 STRCAT_PRINT "" | |
2858 ; Show aGF (Static) | |
2859 call TFT_standard_color | |
2860 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater | |
2861 bra TFT_gf_mask2 ; Show "---" instead | |
2862 | |
2863 btfss use_agf | |
2864 call TFT_disabled_color | |
2865 | |
2866 WIN_STD dive_agf_column,dive_agf_row | |
2867 movff opt_aGF_low,lo | |
2868 output_8 | |
2869 PUTC "/" | |
2870 movff opt_aGF_high,lo | |
2871 output_8 | |
2872 STRCAT_PRINT "" | |
2873 bcf leftbind | |
2874 call TFT_standard_color | |
2875 return | |
2876 | |
2877 TFT_gf_mask2: | |
2878 WIN_STD dive_agf_column+.10,dive_agf_row | |
2879 STRCPY_PRINT "---" | |
2880 bcf leftbind | |
2881 return | |
2882 | |
2883 global TFT_gf_info ; Show GF informations | |
2884 TFT_gf_info: | |
2885 ; Show current GF | |
2886 movff char_O_gradient_factor,lo ; gradient factor absolute (Non-GF model) | |
2887 movff char_I_deco_model,hi | |
2888 decfsz hi,F ; jump over next line if char_I_deco_model == 1 | |
2889 movff char_O_relative_gradient_GF,lo ; gradient factor relative (GF model) | |
2890 WIN_STD dive_currentgf_column,dive_currentgf_row | |
2891 output_8 | |
2892 STRCAT_PRINT "%" | |
2893 return | |
2894 | |
2895 global TFT_ead_end_tissues_clock_mask ; Setup Mask | |
2896 TFT_ead_end_tissues_clock_mask: | |
2897 ; The mask | |
2898 call TFT_divemask_color | |
134
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2899 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2900 bra TFT_ead_end_tissues_clock_mask2 ; Yes |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2901 btfsc FLAG_gauge_mode ; In Gauge mode? |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2902 bra TFT_ead_end_tissues_clock_mask2 ; Yes |
0 | 2903 ; Put three columns at HUD positions |
2904 WIN_TINY dive_custom_hud_column2,dive_custom_hud_row | |
2905 STRCPY_TEXT_PRINT tDiveEAD_END | |
2906 WIN_TINY dive_custom_hud_column3,dive_custom_hud_row | |
2907 STRCPY_TEXT_PRINT tDiveTissues | |
134
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2908 TFT_ead_end_tissues_clock_mask2: ; Show only clock |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2909 WIN_TINY dive_custom_hud_column1,dive_custom_hud_row |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2910 STRCPY_TEXT_PRINT tDiveClock |
0 | 2911 call TFT_standard_color |
2912 return | |
2913 | |
2914 global TFT_ead_end_tissues_clock ; Show EAD/END, Tissues and clock | |
2915 TFT_ead_end_tissues_clock: | |
2916 ; Update clock and date | |
2917 WIN_SMALL dive_clock_column,dive_clock_row | |
2918 call TFT_clock2 ; print clock | |
134
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2919 |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2920 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2921 return ; Yes, done. |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2922 btfsc FLAG_gauge_mode ; In Gauge mode? |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2923 return ; Yes, done. |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2924 |
105 | 2925 ; WIN_SMALL dive_endtime_column,dive_endtime_row |
2926 ; | |
2927 ; btfss decostop_active ; Already in nodeco mode ? | |
2928 ; bra TFT_ead_end_tissues_clock2 ; No, overwrite with some spaces | |
2929 ; | |
2930 ; STRCPY 0x94 ; "End of dive" icon | |
2931 ; movff hours,WREG | |
2932 ; mullw .60 | |
2933 ; movf mins,W | |
2934 ; addwf PRODL | |
2935 ; movlw .0 | |
2936 ; addwfc PRODH | |
2937 ; movff PRODL, lo | |
2938 ; movff PRODH, hi | |
2939 ; | |
2940 ; ; Add TTS | |
2941 ; movff int_O_ascenttime+0,WREG ; TTS | |
2942 ; addwf lo,F | |
2943 ; movff int_O_ascenttime+1,WREG ; TTS is 16bits | |
2944 ; addwfc hi,F | |
2945 ; | |
2946 ; call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
2947 ; movf hi,W | |
2948 ; movff lo,hi | |
2949 ; movwf lo ; exchange lo and hi | |
2950 ; output_99x | |
2951 ; PUTC ':' | |
2952 ; movff hi,lo | |
2953 ; output_99x | |
2954 ; STRCAT_PRINT "" | |
2955 ; bra TFT_ead_end_tissues_clock3 | |
2956 ; | |
2957 ;TFT_ead_end_tissues_clock2: | |
2958 ; STRCPY_PRINT " " | |
2959 ;TFT_ead_end_tissues_clock3: | |
0 | 2960 |
2961 ; Show END/EAD | |
2962 WIN_SMALL dive_ead_column,dive_ead_row | |
2963 STRCPY_TEXT tEAD ; EAD: | |
2964 movff char_O_EAD,lo | |
2965 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | |
2966 WIN_SMALL dive_end_column,dive_end_row | |
2967 STRCPY_TEXT tEND ; END: | |
2968 movff char_O_END,lo | |
2969 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | |
2970 | |
2971 ; Show tissue diagram | |
2972 call TFT_divemask_color | |
2973 WIN_TINY dive_tissue_N2_column,dive_tissue_N2_row | |
2974 STRCPY_TEXT_PRINT tN2 | |
2975 WIN_TINY dive_tissue_He_column,dive_tissue_He_row | |
2976 STRCPY_TEXT_PRINT tHe | |
2977 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) | |
2978 movlb b'00000001' ; select ram bank 1 | |
2979 rcall DISP_tissue_saturation_graph ; Show char_O_tissue_N2_saturation and char_O_tissue_He_saturation | |
2980 return | |
2981 | |
2982 TFT_end_ead_common: ; print "lo m" (or ft) and limit to 8 chars | |
2983 bsf leftbind | |
2984 TSTOSS opt_units ; 0=Meters, 1=Feets | |
2985 bra TFT_end_ead_common_metric | |
2986 ;TFT_end_ead_common_imperial: | |
2987 ; With lo in m | |
2988 movf lo,W | |
2989 mullw .100 ; PRODL:PRODH = mbar/min | |
2990 movff PRODL,lo | |
2991 movff PRODH,hi | |
2992 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
2993 output_16_3 | |
2994 STRCAT_TEXT tFeets | |
2995 clrf WREG | |
2996 movff WREG,buffer+.8 ; limit string length to 8 | |
2997 bra TFT_end_ead_common_exit | |
2998 TFT_end_ead_common_metric: | |
2999 output_8 | |
3000 STRCAT_TEXT tMeters | |
3001 TFT_end_ead_common_exit: | |
3002 bcf leftbind | |
3003 movlw .8 | |
3004 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3005 STRCAT_PRINT "" | |
3006 return | |
3007 | |
3008 global TFT_surface_tissues | |
3009 TFT_surface_tissues: ; Show Tissue diagram in surface mode | |
3010 WIN_SMALL surf_tissue_N2_column,surf_tissue_N2_row | |
3011 STRCPY_TEXT_PRINT tN2 | |
3012 WIN_SMALL surf_tissue_He_column,surf_tissue_He_row | |
3013 STRCPY_TEXT_PRINT tHe | |
3014 | |
3015 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) | |
3016 movlb b'00000001' ; select ram bank 1 | |
3017 | |
3018 movlw color_deepblue | |
3019 call TFT_set_color ; Make this configurable? | |
3020 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.29,.29 | |
3021 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.37,.37 | |
3022 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.45,.45 | |
3023 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.53,.53 | |
3024 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.61,.61 | |
3025 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.69,.69 | |
3026 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.77,.77 | |
3027 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.85,.85 | |
3028 WIN_FRAME_STD surf_tissue_diagram_top, surf_tissue_diagram_bottom, surf_tissue_diagram_left, surf_tissue_diagram_right ; outer frame | |
3029 | |
3030 movlw .1 | |
3031 movff WREG,win_height ; row bottom (0-239) | |
3032 movlw surf_tissue_diagram_left+.4 ; Surface mode | |
3033 movff WREG,win_leftx2 ; column left (0-159) | |
3034 movlw surf_tissue_diagram_right-surf_tissue_diagram_left-4 ; Width | |
3035 movff WREG,win_width | |
3036 | |
3037 ;---- Draw N2 Tissues | |
3038 lfsr FSR2, char_O_tissue_N2_saturation | |
3039 movlw d'16' | |
3040 movwf wait_temp ; 16 tissues | |
3041 clrf waitms_temp ; Row offset | |
3042 surf_tissue_saturation_graph_N2: | |
3043 movlw surf_tissue_diagram_top+.23 ; surface mode | |
3044 addwf waitms_temp,W | |
3045 movff WREG,win_top ; row top (0-239) | |
3046 rcall surf_tissue_saturation_loop ; Show one tissue | |
3047 decfsz wait_temp,F | |
3048 bra surf_tissue_saturation_graph_N2 | |
3049 | |
3050 ;---- Draw He Tissues ---------------------------------------------------- | |
3051 lfsr FSR2, char_O_tissue_He_saturation | |
3052 movlw d'16' | |
3053 movwf wait_temp ; 16 tissues | |
3054 clrf waitms_temp ; Row offset | |
3055 surf_tissue_saturation_graph_He: | |
3056 movlw surf_tissue_diagram_top+.23+.56 ; surface mode | |
3057 addwf waitms_temp,W | |
3058 movff WREG,win_top ; row top (0-239) | |
3059 rcall surf_tissue_saturation_loop ; Show one tissue | |
3060 decfsz wait_temp,F | |
3061 bra surf_tissue_saturation_graph_He | |
3062 return | |
3063 | |
3064 surf_tissue_saturation_loop: | |
3065 call TFT_standard_color | |
3066 movlw .2 ; row spacing | |
3067 addwf waitms_temp,F | |
3068 movf POSTINC2,W ; Get tissue load | |
3069 bcf STATUS,C | |
3070 rrcf WREG ; And divide by 2 | |
3071 movwf temp1 | |
3072 movlw .20 | |
3073 subwf temp1,F ; Subtract some offset | |
3074 movff win_width,WREG ; Max width. | |
3075 cpfslt temp1 ; skip if WREG < win_width | |
3076 movwf temp1 | |
3077 movff temp1,win_bargraph | |
3078 call TFT_box | |
3079 return | |
3080 | |
3081 ;============================================================================= | |
3082 ; Draw saturation graph, is surface mode or in dive mode. | |
3083 DISP_tissue_saturation_graph: | |
3084 ;---- Draw Frame | |
50 | 3085 call TFT_standard_color |
3086 WIN_FRAME_COLOR16 tissue_diagram_top, tissue_diagram_bottom, tissue_diagram_left, .159 ; outer frame | |
0 | 3087 |
3088 movlw .1 | |
3089 movff WREG,win_height ; row bottom (0-239) | |
3090 movlw tissue_diagram_left+.3 ; divemode | |
3091 movff WREG,win_leftx2 ; column left (0-159) | |
3092 movlw .159-tissue_diagram_left-4 ; Width | |
3093 movff WREG,win_width | |
3094 | |
3095 ;---- Draw N2 Tissues | |
3096 lfsr FSR2, char_O_tissue_N2_saturation | |
3097 movlw d'16' | |
3098 movwf wait_temp ; 16 tissues | |
3099 clrf waitms_temp ; Row offset | |
3100 tissue_saturation_graph_N2: | |
3101 movlw tissue_diagram_top+3 ; divemode | |
3102 addwf waitms_temp,W | |
3103 movff WREG,win_top ; row top (0-239) | |
3104 rcall tissue_saturation_graph_loop ; Show one tissue | |
3105 decfsz wait_temp,F | |
3106 bra tissue_saturation_graph_N2 | |
3107 | |
3108 ;---- Draw He Tissues ---------------------------------------------------- | |
3109 lfsr FSR2, char_O_tissue_He_saturation | |
3110 movlw d'16' | |
3111 movwf wait_temp ; 16 tissues | |
3112 clrf waitms_temp ; Row offset | |
3113 tissue_saturation_graph_He: | |
3114 movlw tissue_diagram_top+3+.22 ; divemode | |
3115 addwf waitms_temp,W | |
3116 movff WREG,win_top ; row top (0-239) | |
3117 | |
3118 rcall tissue_saturation_graph_loop ; Show one tissue | |
3119 | |
3120 decfsz wait_temp,F | |
3121 bra tissue_saturation_graph_He | |
3122 return | |
3123 | |
3124 tissue_saturation_graph_loop: | |
3125 call TFT_standard_color | |
3126 incf waitms_temp,F | |
3127 movf POSTINC2,W | |
3128 bcf STATUS,C | |
3129 rrcf WREG | |
3130 bcf STATUS,C | |
3131 rrcf WREG ; And divide by 4 | |
3132 movwf temp1 | |
3133 movlw .12 | |
3134 subwf temp1,F ; Subtract some offset | |
3135 movff win_width,WREG ; Max width. | |
3136 cpfslt temp1 ; skip if WREG < win_width | |
3137 movwf temp1 | |
3138 movff temp1,win_bargraph | |
3139 call TFT_box | |
3140 return | |
3141 | |
55 | 3142 |
0 | 3143 global TFT_display_cns |
3144 TFT_display_cns: | |
3145 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3146 tstfsz WREG ; Is there room for the warning? | |
3147 return ; No | |
3148 TFT_color_code warn_cns ; Color-code CNS output | |
3149 STRCPY_TEXT tCNS2 ; CNS: | |
3150 movff int_O_CNS_fraction+0,lo | |
3151 movff int_O_CNS_fraction+1,hi | |
3152 bsf leftbind | |
3153 output_16_3 ;Displays only 0...999 | |
3154 bcf leftbind | |
3155 PUTC "%" | |
3156 movlw warning_length ; Divemode string length | |
3157 btfss divemode ; In Divemode? | |
3158 movlw surf_warning_length ; No, use surface string length | |
3159 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3160 STRCAT_PRINT "" | |
3161 call TFT_standard_color | |
3162 return | |
3163 | |
3164 global TFT_display_ppo2 | |
3165 TFT_display_ppo2: ; Show ppO2 (ppO2 stored in xC, in mbar!) | |
3166 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3167 tstfsz WREG ; Is there room for the warning? | |
3168 return ; No | |
3169 TFT_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) | |
154
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
153
diff
changeset
|
3170 STRCPY_TEXT tppO2 ; ppO2: |
0 | 3171 ; Check very high ppO2 manually |
3172 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | |
3173 bra TFT_show_ppO2_3 ; Yes, display fixed Value! | |
3174 movff xC+0,lo | |
3175 movff xC+1,hi | |
3176 bsf ignore_digit4 | |
3177 output_16dp d'1' | |
3178 TFT_show_ppO2_2: | |
3179 movlw warning_length ; Divemode string length | |
3180 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3181 STRCAT_PRINT "" | |
3182 call TFT_standard_color | |
3183 return | |
3184 | |
3185 TFT_show_ppO2_3: | |
3186 STRCAT ">6.6" | |
3187 bra TFT_show_ppO2_2 | |
3188 | |
3189 | |
3190 global TFT_LogOffset_Logtitle | |
3191 TFT_LogOffset_Logtitle: | |
3192 STRCPY_TEXT tLogOffset | |
3193 PUTC ":" | |
3194 call do_logoffset_common_read ; Offset into lo:hi | |
3195 bsf leftbind | |
3196 output_16 | |
3197 bcf leftbind | |
3198 PUTC " " | |
3199 return ; No "_PRINT" here... | |
3200 | |
3201 | |
3202 global adjust_depth_with_salinity | |
3203 adjust_depth_with_salinity: ; computes salinity setting into lo:hi [mbar] | |
3204 btfsc simulatormode_active ; Do apply salinity in Simulatormode | |
3205 return | |
3206 | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
3207 global adjust_depth_with_salinity_log |
0 | 3208 movff opt_salinity,WREG ; 0-5% |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
3209 adjust_depth_with_salinity_log: ; computes salinity setting (FROM WREG!) into lo:hi [mbar] |
0 | 3210 addlw d'100' ; 1.00kg/l |
3211 movwf wait_temp | |
3212 | |
3213 movlw d'105' ; 105% ? | |
3214 cpfslt wait_temp ; Salinity higher limit | |
3215 return ; Out of limit, do not adjust lo:hi | |
3216 movlw d'99' ; 99% ? | |
3217 cpfsgt wait_temp ; Salinity lower limit | |
3218 return ; Out of limit, do not adjust lo:hi | |
3219 | |
3220 movff lo,xA+0 | |
3221 movff hi,xA+1 | |
3222 | |
3223 movlw d'102' ; 0,98bar/10m | |
3224 movwf xB+0 | |
3225 clrf xB+1 | |
3226 call mult16x16 ;xA*xB=xC (lo:hi * 100) | |
3227 movff wait_temp,xB+0 ; Salinity | |
3228 clrf xB+1 | |
3229 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3230 movff xC+0,lo | |
3231 movff xC+1,hi ; restore lo and hi with updated value | |
3232 return | |
3233 | |
3234 global convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
3235 convert_mbar_to_feet: ; convert value in lo:hi from mbar to feet | |
3236 movff lo,xA+0 | |
3237 movff hi,xA+1 | |
3238 | |
3239 movlw LOW d'328' ; 328feet/100m | |
3240 movwf xB+0 | |
3241 movlw HIGH d'328' | |
3242 movwf xB+1 | |
3243 | |
3244 call mult16x16 ; xA*xB=xC (lo:hi * 328) | |
3245 | |
3246 movlw d'50' ; round up | |
3247 addwf xC+0,F | |
3248 movlw 0 | |
3249 addwfc xC+1,F | |
3250 addwfc xC+2,F | |
3251 addwfc xC+3,F | |
3252 | |
3253 movlw LOW .10000 | |
3254 movwf xB+0 | |
3255 movlw HIGH .10000 | |
3256 movwf xB+1 | |
3257 | |
3258 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3259 | |
3260 movff xC+0,lo | |
3261 movff xC+1,hi ; restore lo and hi with updated value | |
3262 return | |
3263 | |
3264 global convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit | |
3265 convert_celsius_to_fahrenheit: ; convert value in lo:hi from celsius to fahrenheit | |
3266 ; Does it work with signed temperature? mH | |
3267 movff lo,xA+0 | |
3268 movff hi,xA+1 | |
3269 | |
3270 movlw d'18' ; 1C = 1.8F | |
3271 movwf xB+0 | |
3272 clrf xB+1 | |
3273 | |
3274 call mult16x16 ;xA*xB=xC (lo:hi * 18) | |
3275 | |
3276 movlw d'10' | |
3277 movwf xB+0 | |
3278 clrf xB+1 | |
3279 | |
3280 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3281 | |
3282 movlw LOW d'320' ; 0C = 32F | |
3283 addwf xC+0,F | |
3284 movlw HIGH d'320' | |
3285 addwfc xC+1,F | |
3286 | |
3287 movff xC+0,lo | |
3288 movff xC+1,hi ; restore lo and hi with updated value | |
3289 return | |
3290 | |
3291 END |