Mercurial > public > hwos_code
annotate src/tft_outputs.asm @ 256:5b4ef0b9090d
place compass display code into compass_ops.asm
author | heinrichsweikamp |
---|---|
date | Mon, 23 Mar 2015 18:02:40 +0100 |
parents | ad62dff7739a |
children | e1cd6848863d |
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... |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
234
diff
changeset
|
2463 btfsc rechargeable |
200 | 2464 bra TFT_serial2 |
2465 STRCAT "3 #" | |
2466 bra TFT_serial3 | |
2467 TFT_serial2: | |
2468 STRCAT " cR #" | |
2469 TFT_serial3: | |
0 | 2470 rcall TFT_cat_serial |
2471 | |
2472 STRCAT " v" | |
180 | 2473 WIN_COLOR color_greenish |
0 | 2474 rcall TFT_cat_firmware |
2475 | |
2476 ifdef __DEBUG | |
2477 movlw color_grey ; Write header in blue when | |
2478 call TFT_set_color ; compiled in DEBUG mode... | |
2479 STRCAT_PRINT "DEBUG" | |
2480 else | |
76 | 2481 STRCAT_PRINT "" |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
2482 bcf win_invert ; Reset invert flag |
0 | 2483 call TFT_standard_color |
76 | 2484 |
0 | 2485 movlw softwareversion_beta ; =1: Beta, =0: Release |
2486 decfsz WREG,F | |
2487 return ; Release version -> Return | |
2488 | |
2489 call TFT_warnings_color | |
2490 WIN_LEFT .160-4*9/2 ; Right pad. | |
2491 STRCPY_TEXT_PRINT tBeta | |
2492 endif | |
76 | 2493 call TFT_standard_color |
0 | 2494 return |
2495 | |
2496 | |
2497 | |
2498 ;============================================================================= | |
2499 ; For the Information menu: append firmware x.yy version. | |
2500 global info_menu_firmware | |
2501 extern tFirmware | |
2502 info_menu_firmware: | |
2503 lfsr FSR1,tFirmware | |
2504 call strcat_text | |
180 | 2505 rcall TFT_cat_firmware |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
2506 bcf win_invert ; Reset invert flag |
180 | 2507 return |
2508 | |
76 | 2509 global TFT_cat_firmware |
0 | 2510 TFT_cat_firmware: |
2511 movlw softwareversion_x | |
2512 movwf lo | |
2513 bsf leftbind | |
2514 output_8 | |
2515 PUTC '.' | |
2516 movlw softwareversion_y | |
2517 movwf lo | |
2518 output_99x | |
2519 bcf leftbind | |
180 | 2520 ; Check firmware date |
2521 movlw firmware_expire_year-.1 | |
2522 cpfsgt year ; > threshold? | |
2523 return | |
2524 movlw firmware_expire_month-.1 | |
2525 cpfsgt month ; > threshold? | |
2526 return | |
2527 movlw firmware_expire_day-.1 | |
2528 cpfsgt day ; > threshold? | |
2529 return | |
2530 | |
2531 ; Show in "change firmware" style | |
2532 movlw color_yellow | |
2533 call TFT_set_color | |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
2534 bsf win_invert ; Set invert flag |
0 | 2535 return |
2536 | |
2537 ;----------------------------------------------------------------------------- | |
2538 ; For the Information menu: append serial number ostc3#42. | |
2539 global info_menu_serial | |
2540 extern tSerial | |
2541 info_menu_serial: | |
2542 lfsr FSR1,tSerial | |
2543 call strcat_text | |
76 | 2544 global TFT_cat_serial |
0 | 2545 TFT_cat_serial: |
2546 clrf EEADRH | |
2547 clrf EEADR ; Get Serial number LOW | |
2548 call read_eeprom ; read byte | |
2549 movff EEDATA,lo | |
2550 incf EEADR,F ; Get Serial number HIGH | |
2551 call read_eeprom ; read byte | |
2552 movff EEDATA,hi | |
2553 | |
2554 bsf leftbind | |
2555 output_16 | |
2556 bcf leftbind | |
2557 return | |
2558 | |
2559 ;----------------------------------------------------------------------------- | |
2560 ; For the Information menu: Append total dives | |
2561 global info_menu_total_dives | |
2562 extern tTotalDives | |
2563 info_menu_total_dives: | |
2564 lfsr FSR1,tTotalDives | |
2565 call strcat_text | |
2566 TFT_cat_total_dives: | |
2567 read_int_eeprom .2 | |
2568 movff EEDATA,lo | |
2569 read_int_eeprom .3 | |
2570 movff EEDATA,hi | |
2571 bsf leftbind | |
2572 output_16 | |
2573 bcf leftbind | |
2574 return | |
2575 | |
62 | 2576 ; For the Information menu: Append battery voltage |
2577 global info_menu_battery_volts | |
2578 extern tBatteryV | |
2579 info_menu_battery_volts: | |
2580 lfsr FSR1,tBatteryV | |
2581 call strcat_text | |
2582 movff batt_voltage+1,hi | |
2583 movff batt_voltage+0,lo | |
2584 bsf leftbind | |
2585 output_16dp .2 ; x.xxx | |
2586 bcf leftbind | |
2587 PUTC "V" | |
2588 return | |
2589 | |
0 | 2590 ;----------------------------------------------------------------------------- |
2591 ; ppO2 menu | |
2592 global divesets_ppo2_max | |
2593 extern tPPO2Max | |
2594 extern tbar | |
2595 divesets_ppo2_max: | |
2596 lfsr FSR1,tPPO2Max | |
2597 call strcat_text | |
2598 movff opt_ppO2_max,lo | |
2599 movlw ppo2_warning_high | |
2600 divesets_ppo2_common: | |
2601 movwf up ; Save default value | |
2602 clrf hi | |
2603 bsf leftbind | |
2604 output_16dp d'3' | |
2605 bcf leftbind | |
2606 lfsr FSR1,tbar | |
2607 call strcat_text | |
2608 | |
2609 movf up,W ; Default value | |
2610 cpfseq lo ; Current value | |
2611 bra divesets_ppo2_common2 ; Not default, add * | |
2612 return ; Default, Done. | |
2613 divesets_ppo2_common2: | |
2614 PUTC "*" | |
2615 return ; Done. | |
2616 | |
2617 global divesets_ppo2_min | |
2618 extern tPPO2Min | |
2619 divesets_ppo2_min: | |
2620 lfsr FSR1,tPPO2Min | |
2621 call strcat_text | |
2622 movff opt_ppO2_min,lo | |
2623 movlw ppo2_warning_low | |
2624 bra divesets_ppo2_common | |
2625 | |
2626 ;============================================================================= | |
2627 | |
2628 global TFT_clear_warning_text | |
2629 TFT_clear_warning_text: | |
2630 btfss divemode ; in divemode? | |
2631 bra TFT_clear_warning_text2 ; No, setup for surface mode | |
2632 WIN_BOX_BLACK warning1_row, divemode_customview_row-3, warning1_column, warning_icon_column-3 ;top, bottom, left, right | |
2633 return | |
2634 TFT_clear_warning_text2: | |
2635 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ;top, bottom, left, right | |
2636 return | |
2637 | |
2638 global TFT_clear_warning_text_2nd_row | |
2639 TFT_clear_warning_text_2nd_row: | |
2640 btfss divemode ; in divemode? | |
2641 bra TFT_clear_warning_text_2nd_2 ; No, setup for surface mode | |
2642 WIN_BOX_BLACK warning2_row, divemode_customview_row-3, warning2_column, warning_icon_column-3 ;top, bottom, left, right | |
2643 return | |
2644 TFT_clear_warning_text_2nd_2: | |
2645 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ;top, bottom, left, right | |
2646 return | |
2647 | |
2648 global TFT_fillup_with_spaces | |
2649 TFT_fillup_with_spaces: ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2650 movwf lo ; save max. string length into lo | |
2651 movf FSR2L,W ; Get current string length | |
2652 subwf lo,F ; lo-WREG | |
2653 btfsc STATUS,N ; longer then #lo already? | |
2654 return ; Yes, done. | |
2655 tstfsz lo ; Zero? | |
2656 bra TFT_fillup_with_spaces2 ; No. | |
2657 return ; Yes, done. | |
2658 TFT_fillup_with_spaces2: | |
2659 PUTC " " ; Add one space | |
2660 decfsz lo,F ; All done? | |
2661 bra TFT_fillup_with_spaces2 ; No, loop | |
2662 return ; Done. | |
2663 | |
2664 global TFT_desaturation_time | |
2665 TFT_desaturation_time: | |
2666 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
2667 tstfsz WREG ; Is there room for the warning? | |
2668 return ; No | |
2669 STRCPY "Desat:" | |
2670 movff desaturation_time+0,lo ; divide by 60... | |
2671 movff desaturation_time+1,hi | |
2672 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
2673 bsf leftbind | |
2674 movf lo,W | |
2675 movff hi,lo | |
2676 movwf hi ; exchange lo and hi... | |
2677 output_8 ; Hours | |
2678 PUTC ':' | |
2679 movff hi,lo ; Minutes | |
2680 output_99x | |
2681 bcf leftbind | |
2682 movlw surf_warning_length ; Only use surface string length | |
2683 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
60 | 2684 movlw .0 |
2685 movff WREG,buffer+11 | |
0 | 2686 STRCAT_PRINT "" |
2687 return | |
2688 | |
2689 global TFT_nofly_time | |
2690 TFT_nofly_time: | |
2691 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
2692 tstfsz WREG ; Is there room for the warning? | |
2693 return ; No | |
2694 STRCPY "NoFly:" | |
2695 movff nofly_time+0,lo ; divide by 60... | |
2696 movff nofly_time+1,hi | |
2697 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
2698 bsf leftbind | |
2699 movf lo,W | |
2700 movff hi,lo | |
2701 movwf hi ; exchange lo and hi... | |
2702 output_8 ; Hours | |
2703 PUTC ':' | |
2704 movff hi,lo ; Minutes | |
2705 output_99x | |
2706 bcf leftbind | |
2707 movlw surf_warning_length ; Only use surface string length | |
2708 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
60 | 2709 movlw .0 |
2710 movff WREG,buffer+11 | |
0 | 2711 STRCAT_PRINT "" |
2712 return | |
2713 | |
2714 global TFT_warning_agf | |
2715 TFT_warning_agf: | |
2716 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
2717 tstfsz WREG ; Is there room for the warning? | |
2718 return ; No | |
2719 call TFT_warnings_color | |
2720 STRCPY_TEXT tDiveaGF_active ; "aGF!" | |
2721 movlw warning_length ; Divemode string length | |
2722 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2723 STRCAT_PRINT "" | |
2724 call TFT_standard_color | |
2725 return | |
2726 | |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2727 global TFT_warning_fallback |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2728 TFT_warning_fallback: ; Show fallback warning |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2729 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
|
2730 tstfsz WREG ; Is there room for the warning? |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2731 return ; No |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2732 call TFT_warnings_color |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2733 STRCPY_TEXT tDiveFallback ; "Fallback!" |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2734 movlw warning_length ; Divemode string length |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2735 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
|
2736 STRCAT_PRINT "" |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2737 call TFT_standard_color |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2738 return |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2739 |
0 | 2740 global TFT_warning_gf |
2741 TFT_warning_gf: ;GF | |
2742 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
2743 tstfsz WREG ; Is there room for the warning? | |
2744 return ; No | |
2745 TFT_color_code warn_gf ; Color-code Output | |
2746 STRCPY "GF:" | |
2747 movff char_O_gradient_factor,lo ; gradient factor | |
2748 bsf leftbind | |
2749 output_8 | |
2750 PUTC "%" | |
2751 movlw warning_length ; Divemode string length | |
2752 btfss divemode ; In Divemode? | |
2753 movlw surf_warning_length ; No, use surface string length | |
2754 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2755 STRCAT_PRINT "" | |
2756 bcf leftbind | |
2757 call TFT_standard_color | |
2758 return | |
2759 | |
2760 TFT_warning_set_window: ; Sets the row and column for the current warning | |
2761 ; ignore warning (now)? | |
2762 decf warning_counter,W ; -1 | |
2763 bcf STATUS,C | |
2764 rrcf WREG,W ; (warning_counter-1)/2 | |
2765 cpfseq warning_page | |
2766 retlw .255 ; WREG <> 0 -> Warning window not defined | |
2767 | |
2768 call TFT_standard_color | |
2769 | |
2770 btfss divemode ; in divemode? | |
2771 bra TFT_warning_set_window3 ; No, setup for surface mode | |
2772 | |
2773 btfss warning_counter,0 ; Toggle with each warning | |
2774 bra TFT_warning_set_window2 | |
2775 WIN_SMALL warning1_column,warning1_row | |
2776 bcf second_row_warning ; =1: The second row contains a warning | |
2777 retlw .0 ; WREG=0 -> Warning window defined | |
2778 TFT_warning_set_window2: | |
2779 WIN_SMALL warning2_column,warning2_row | |
2780 bsf second_row_warning ; =1: The second row contains a warning | |
2781 retlw .0 ; WREG=0 -> Warning window defined | |
2782 | |
2783 TFT_warning_set_window3: | |
2784 btfss warning_counter,0 ; Toggle with each warning | |
2785 bra TFT_warning_set_window4 | |
2786 WIN_SMALL surf_warning1_column,surf_warning1_row | |
2787 bcf second_row_warning ; =1: The second row contains a warning | |
2788 retlw .0 ; WREG=0 -> Warning window defined | |
2789 TFT_warning_set_window4: | |
2790 WIN_SMALL surf_warning2_column,surf_warning2_row | |
2791 bsf second_row_warning ; =1: The second row contains a warning | |
2792 retlw .0 ; WREG=0 -> Warning window defined | |
2793 | |
2794 | |
2795 global TFT_update_batt_percent_divemode | |
2796 TFT_update_batt_percent_divemode: | |
2797 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
2798 tstfsz WREG ; Is there room for the warning? | |
2799 return ; No | |
2800 movff batt_percent,lo ; Get battery percent | |
2801 TFT_color_code warn_battery; Color-code battery percent | |
2802 STRCPY "Batt:" | |
2803 bsf leftbind | |
2804 output_8 | |
2805 bcf leftbind | |
2806 PUTC "%" | |
2807 movlw warning_length ; Divemode string length | |
2808 btfss divemode ; In Divemode? | |
2809 movlw surf_warning_length ; No, use surface string length | |
2810 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2811 STRCAT_PRINT "" | |
2812 call TFT_standard_color | |
2813 return | |
2814 | |
2815 | |
2816 global TFT_gf_mask ; Setup Mask | |
2817 TFT_gf_mask: | |
2818 ; The mask | |
2819 call TFT_divemask_color | |
2820 WIN_TINY dive_gf_column1,dive_gf_text_row | |
2821 STRCPY_TEXT_PRINT tGFactors | |
2822 WIN_TINY dive_gf_column2,dive_gf_text_row | |
2823 STRCPY_TEXT_PRINT taGFactors | |
2824 WIN_TINY dive_gf_column3,dive_gf_text_row | |
2825 STRCPY_TEXT_PRINT tGFInfo | |
2826 | |
2827 ; Show GF (Static) | |
2828 call TFT_disabled_color | |
2829 btfss use_agf | |
2830 call TFT_standard_color | |
2831 | |
2832 WIN_STD dive_gf_column,dive_gf_row | |
2833 bsf leftbind | |
2834 movff opt_GF_low,lo | |
2835 output_8 | |
2836 PUTC "/" | |
2837 movff opt_GF_high,lo | |
2838 output_8 | |
2839 STRCAT_PRINT "" | |
2840 ; Show aGF (Static) | |
2841 call TFT_standard_color | |
2842 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater | |
2843 bra TFT_gf_mask2 ; Show "---" instead | |
2844 | |
2845 btfss use_agf | |
2846 call TFT_disabled_color | |
2847 | |
2848 WIN_STD dive_agf_column,dive_agf_row | |
2849 movff opt_aGF_low,lo | |
2850 output_8 | |
2851 PUTC "/" | |
2852 movff opt_aGF_high,lo | |
2853 output_8 | |
2854 STRCAT_PRINT "" | |
2855 bcf leftbind | |
2856 call TFT_standard_color | |
2857 return | |
2858 | |
2859 TFT_gf_mask2: | |
2860 WIN_STD dive_agf_column+.10,dive_agf_row | |
2861 STRCPY_PRINT "---" | |
2862 bcf leftbind | |
2863 return | |
2864 | |
2865 global TFT_gf_info ; Show GF informations | |
2866 TFT_gf_info: | |
2867 ; Show current GF | |
2868 movff char_O_gradient_factor,lo ; gradient factor absolute (Non-GF model) | |
2869 movff char_I_deco_model,hi | |
2870 decfsz hi,F ; jump over next line if char_I_deco_model == 1 | |
2871 movff char_O_relative_gradient_GF,lo ; gradient factor relative (GF model) | |
2872 WIN_STD dive_currentgf_column,dive_currentgf_row | |
2873 output_8 | |
2874 STRCAT_PRINT "%" | |
2875 return | |
2876 | |
2877 global TFT_ead_end_tissues_clock_mask ; Setup Mask | |
2878 TFT_ead_end_tissues_clock_mask: | |
2879 ; The mask | |
2880 call TFT_divemask_color | |
134
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2881 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2882 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
|
2883 btfsc FLAG_gauge_mode ; In Gauge mode? |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2884 bra TFT_ead_end_tissues_clock_mask2 ; Yes |
0 | 2885 ; Put three columns at HUD positions |
2886 WIN_TINY dive_custom_hud_column2,dive_custom_hud_row | |
2887 STRCPY_TEXT_PRINT tDiveEAD_END | |
2888 WIN_TINY dive_custom_hud_column3,dive_custom_hud_row | |
2889 STRCPY_TEXT_PRINT tDiveTissues | |
134
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2890 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
|
2891 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
|
2892 STRCPY_TEXT_PRINT tDiveClock |
0 | 2893 call TFT_standard_color |
2894 return | |
2895 | |
2896 global TFT_ead_end_tissues_clock ; Show EAD/END, Tissues and clock | |
2897 TFT_ead_end_tissues_clock: | |
2898 ; Update clock and date | |
2899 WIN_SMALL dive_clock_column,dive_clock_row | |
2900 call TFT_clock2 ; print clock | |
134
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2901 |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2902 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2903 return ; Yes, done. |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2904 btfsc FLAG_gauge_mode ; In Gauge mode? |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2905 return ; Yes, done. |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
2906 |
105 | 2907 ; WIN_SMALL dive_endtime_column,dive_endtime_row |
2908 ; | |
2909 ; btfss decostop_active ; Already in nodeco mode ? | |
2910 ; bra TFT_ead_end_tissues_clock2 ; No, overwrite with some spaces | |
2911 ; | |
2912 ; STRCPY 0x94 ; "End of dive" icon | |
2913 ; movff hours,WREG | |
2914 ; mullw .60 | |
2915 ; movf mins,W | |
2916 ; addwf PRODL | |
2917 ; movlw .0 | |
2918 ; addwfc PRODH | |
2919 ; movff PRODL, lo | |
2920 ; movff PRODH, hi | |
2921 ; | |
2922 ; ; Add TTS | |
2923 ; movff int_O_ascenttime+0,WREG ; TTS | |
2924 ; addwf lo,F | |
2925 ; movff int_O_ascenttime+1,WREG ; TTS is 16bits | |
2926 ; addwfc hi,F | |
2927 ; | |
2928 ; call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
2929 ; movf hi,W | |
2930 ; movff lo,hi | |
2931 ; movwf lo ; exchange lo and hi | |
2932 ; output_99x | |
2933 ; PUTC ':' | |
2934 ; movff hi,lo | |
2935 ; output_99x | |
2936 ; STRCAT_PRINT "" | |
2937 ; bra TFT_ead_end_tissues_clock3 | |
2938 ; | |
2939 ;TFT_ead_end_tissues_clock2: | |
2940 ; STRCPY_PRINT " " | |
2941 ;TFT_ead_end_tissues_clock3: | |
0 | 2942 |
2943 ; Show END/EAD | |
2944 WIN_SMALL dive_ead_column,dive_ead_row | |
2945 STRCPY_TEXT tEAD ; EAD: | |
2946 movff char_O_EAD,lo | |
2947 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | |
2948 WIN_SMALL dive_end_column,dive_end_row | |
2949 STRCPY_TEXT tEND ; END: | |
2950 movff char_O_END,lo | |
2951 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | |
2952 | |
2953 ; Show tissue diagram | |
2954 call TFT_divemask_color | |
2955 WIN_TINY dive_tissue_N2_column,dive_tissue_N2_row | |
2956 STRCPY_TEXT_PRINT tN2 | |
2957 WIN_TINY dive_tissue_He_column,dive_tissue_He_row | |
2958 STRCPY_TEXT_PRINT tHe | |
2959 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) | |
2960 movlb b'00000001' ; select ram bank 1 | |
2961 rcall DISP_tissue_saturation_graph ; Show char_O_tissue_N2_saturation and char_O_tissue_He_saturation | |
2962 return | |
2963 | |
2964 TFT_end_ead_common: ; print "lo m" (or ft) and limit to 8 chars | |
2965 bsf leftbind | |
2966 TSTOSS opt_units ; 0=Meters, 1=Feets | |
2967 bra TFT_end_ead_common_metric | |
2968 ;TFT_end_ead_common_imperial: | |
2969 ; With lo in m | |
2970 movf lo,W | |
2971 mullw .100 ; PRODL:PRODH = mbar/min | |
2972 movff PRODL,lo | |
2973 movff PRODH,hi | |
2974 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
2975 output_16_3 | |
2976 STRCAT_TEXT tFeets | |
2977 clrf WREG | |
2978 movff WREG,buffer+.8 ; limit string length to 8 | |
2979 bra TFT_end_ead_common_exit | |
2980 TFT_end_ead_common_metric: | |
2981 output_8 | |
2982 STRCAT_TEXT tMeters | |
2983 TFT_end_ead_common_exit: | |
2984 bcf leftbind | |
2985 movlw .8 | |
2986 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2987 STRCAT_PRINT "" | |
2988 return | |
2989 | |
2990 global TFT_surface_tissues | |
2991 TFT_surface_tissues: ; Show Tissue diagram in surface mode | |
2992 WIN_SMALL surf_tissue_N2_column,surf_tissue_N2_row | |
2993 STRCPY_TEXT_PRINT tN2 | |
2994 WIN_SMALL surf_tissue_He_column,surf_tissue_He_row | |
2995 STRCPY_TEXT_PRINT tHe | |
2996 | |
2997 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) | |
2998 movlb b'00000001' ; select ram bank 1 | |
2999 | |
3000 movlw color_deepblue | |
3001 call TFT_set_color ; Make this configurable? | |
3002 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.29,.29 | |
3003 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.37,.37 | |
3004 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.45,.45 | |
3005 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.53,.53 | |
3006 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.61,.61 | |
3007 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.69,.69 | |
3008 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.77,.77 | |
3009 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.85,.85 | |
3010 WIN_FRAME_STD surf_tissue_diagram_top, surf_tissue_diagram_bottom, surf_tissue_diagram_left, surf_tissue_diagram_right ; outer frame | |
3011 | |
3012 movlw .1 | |
3013 movff WREG,win_height ; row bottom (0-239) | |
3014 movlw surf_tissue_diagram_left+.4 ; Surface mode | |
3015 movff WREG,win_leftx2 ; column left (0-159) | |
3016 movlw surf_tissue_diagram_right-surf_tissue_diagram_left-4 ; Width | |
3017 movff WREG,win_width | |
3018 | |
3019 ;---- Draw N2 Tissues | |
3020 lfsr FSR2, char_O_tissue_N2_saturation | |
3021 movlw d'16' | |
3022 movwf wait_temp ; 16 tissues | |
3023 clrf waitms_temp ; Row offset | |
3024 surf_tissue_saturation_graph_N2: | |
3025 movlw surf_tissue_diagram_top+.23 ; surface mode | |
3026 addwf waitms_temp,W | |
3027 movff WREG,win_top ; row top (0-239) | |
3028 rcall surf_tissue_saturation_loop ; Show one tissue | |
3029 decfsz wait_temp,F | |
3030 bra surf_tissue_saturation_graph_N2 | |
3031 | |
3032 ;---- Draw He Tissues ---------------------------------------------------- | |
3033 lfsr FSR2, char_O_tissue_He_saturation | |
3034 movlw d'16' | |
3035 movwf wait_temp ; 16 tissues | |
3036 clrf waitms_temp ; Row offset | |
3037 surf_tissue_saturation_graph_He: | |
3038 movlw surf_tissue_diagram_top+.23+.56 ; surface mode | |
3039 addwf waitms_temp,W | |
3040 movff WREG,win_top ; row top (0-239) | |
3041 rcall surf_tissue_saturation_loop ; Show one tissue | |
3042 decfsz wait_temp,F | |
3043 bra surf_tissue_saturation_graph_He | |
3044 return | |
3045 | |
3046 surf_tissue_saturation_loop: | |
3047 call TFT_standard_color | |
3048 movlw .2 ; row spacing | |
3049 addwf waitms_temp,F | |
3050 movf POSTINC2,W ; Get tissue load | |
3051 bcf STATUS,C | |
3052 rrcf WREG ; And divide by 2 | |
3053 movwf temp1 | |
3054 movlw .20 | |
3055 subwf temp1,F ; Subtract some offset | |
3056 movff win_width,WREG ; Max width. | |
3057 cpfslt temp1 ; skip if WREG < win_width | |
3058 movwf temp1 | |
3059 movff temp1,win_bargraph | |
3060 call TFT_box | |
3061 return | |
3062 | |
3063 ;============================================================================= | |
3064 ; Draw saturation graph, is surface mode or in dive mode. | |
3065 DISP_tissue_saturation_graph: | |
3066 ;---- Draw Frame | |
50 | 3067 call TFT_standard_color |
3068 WIN_FRAME_COLOR16 tissue_diagram_top, tissue_diagram_bottom, tissue_diagram_left, .159 ; outer frame | |
0 | 3069 |
3070 movlw .1 | |
3071 movff WREG,win_height ; row bottom (0-239) | |
3072 movlw tissue_diagram_left+.3 ; divemode | |
3073 movff WREG,win_leftx2 ; column left (0-159) | |
3074 movlw .159-tissue_diagram_left-4 ; Width | |
3075 movff WREG,win_width | |
3076 | |
3077 ;---- Draw N2 Tissues | |
3078 lfsr FSR2, char_O_tissue_N2_saturation | |
3079 movlw d'16' | |
3080 movwf wait_temp ; 16 tissues | |
3081 clrf waitms_temp ; Row offset | |
3082 tissue_saturation_graph_N2: | |
3083 movlw tissue_diagram_top+3 ; divemode | |
3084 addwf waitms_temp,W | |
3085 movff WREG,win_top ; row top (0-239) | |
3086 rcall tissue_saturation_graph_loop ; Show one tissue | |
3087 decfsz wait_temp,F | |
3088 bra tissue_saturation_graph_N2 | |
3089 | |
3090 ;---- Draw He Tissues ---------------------------------------------------- | |
3091 lfsr FSR2, char_O_tissue_He_saturation | |
3092 movlw d'16' | |
3093 movwf wait_temp ; 16 tissues | |
3094 clrf waitms_temp ; Row offset | |
3095 tissue_saturation_graph_He: | |
3096 movlw tissue_diagram_top+3+.22 ; divemode | |
3097 addwf waitms_temp,W | |
3098 movff WREG,win_top ; row top (0-239) | |
3099 | |
3100 rcall tissue_saturation_graph_loop ; Show one tissue | |
3101 | |
3102 decfsz wait_temp,F | |
3103 bra tissue_saturation_graph_He | |
3104 return | |
3105 | |
3106 tissue_saturation_graph_loop: | |
3107 call TFT_standard_color | |
3108 incf waitms_temp,F | |
3109 movf POSTINC2,W | |
3110 bcf STATUS,C | |
3111 rrcf WREG | |
3112 bcf STATUS,C | |
3113 rrcf WREG ; And divide by 4 | |
3114 movwf temp1 | |
3115 movlw .12 | |
3116 subwf temp1,F ; Subtract some offset | |
3117 movff win_width,WREG ; Max width. | |
3118 cpfslt temp1 ; skip if WREG < win_width | |
3119 movwf temp1 | |
3120 movff temp1,win_bargraph | |
3121 call TFT_box | |
3122 return | |
3123 | |
55 | 3124 |
0 | 3125 global TFT_display_cns |
3126 TFT_display_cns: | |
3127 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3128 tstfsz WREG ; Is there room for the warning? | |
3129 return ; No | |
3130 TFT_color_code warn_cns ; Color-code CNS output | |
3131 STRCPY_TEXT tCNS2 ; CNS: | |
3132 movff int_O_CNS_fraction+0,lo | |
3133 movff int_O_CNS_fraction+1,hi | |
3134 bsf leftbind | |
3135 output_16_3 ;Displays only 0...999 | |
3136 bcf leftbind | |
3137 PUTC "%" | |
3138 movlw warning_length ; Divemode string length | |
3139 btfss divemode ; In Divemode? | |
3140 movlw surf_warning_length ; No, use surface string length | |
3141 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3142 STRCAT_PRINT "" | |
3143 call TFT_standard_color | |
3144 return | |
3145 | |
3146 global TFT_display_ppo2 | |
3147 TFT_display_ppo2: ; Show ppO2 (ppO2 stored in xC, in mbar!) | |
3148 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3149 tstfsz WREG ; Is there room for the warning? | |
3150 return ; No | |
3151 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
|
3152 STRCPY_TEXT tppO2 ; ppO2: |
0 | 3153 ; Check very high ppO2 manually |
3154 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | |
3155 bra TFT_show_ppO2_3 ; Yes, display fixed Value! | |
3156 movff xC+0,lo | |
3157 movff xC+1,hi | |
3158 bsf ignore_digit4 | |
3159 output_16dp d'1' | |
3160 TFT_show_ppO2_2: | |
3161 movlw warning_length ; Divemode string length | |
3162 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3163 STRCAT_PRINT "" | |
3164 call TFT_standard_color | |
3165 return | |
3166 | |
3167 TFT_show_ppO2_3: | |
3168 STRCAT ">6.6" | |
3169 bra TFT_show_ppO2_2 | |
3170 | |
3171 | |
3172 global TFT_LogOffset_Logtitle | |
3173 TFT_LogOffset_Logtitle: | |
3174 STRCPY_TEXT tLogOffset | |
3175 PUTC ":" | |
3176 call do_logoffset_common_read ; Offset into lo:hi | |
3177 bsf leftbind | |
3178 output_16 | |
3179 bcf leftbind | |
3180 PUTC " " | |
3181 return ; No "_PRINT" here... | |
3182 | |
3183 | |
3184 global adjust_depth_with_salinity | |
3185 adjust_depth_with_salinity: ; computes salinity setting into lo:hi [mbar] | |
3186 btfsc simulatormode_active ; Do apply salinity in Simulatormode | |
3187 return | |
3188 | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
3189 global adjust_depth_with_salinity_log |
0 | 3190 movff opt_salinity,WREG ; 0-5% |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
3191 adjust_depth_with_salinity_log: ; computes salinity setting (FROM WREG!) into lo:hi [mbar] |
0 | 3192 addlw d'100' ; 1.00kg/l |
3193 movwf wait_temp | |
3194 | |
3195 movlw d'105' ; 105% ? | |
3196 cpfslt wait_temp ; Salinity higher limit | |
3197 return ; Out of limit, do not adjust lo:hi | |
3198 movlw d'99' ; 99% ? | |
3199 cpfsgt wait_temp ; Salinity lower limit | |
3200 return ; Out of limit, do not adjust lo:hi | |
3201 | |
3202 movff lo,xA+0 | |
3203 movff hi,xA+1 | |
3204 | |
3205 movlw d'102' ; 0,98bar/10m | |
3206 movwf xB+0 | |
3207 clrf xB+1 | |
3208 call mult16x16 ;xA*xB=xC (lo:hi * 100) | |
3209 movff wait_temp,xB+0 ; Salinity | |
3210 clrf xB+1 | |
3211 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3212 movff xC+0,lo | |
3213 movff xC+1,hi ; restore lo and hi with updated value | |
3214 return | |
3215 | |
3216 global convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
3217 convert_mbar_to_feet: ; convert value in lo:hi from mbar to feet | |
3218 movff lo,xA+0 | |
3219 movff hi,xA+1 | |
3220 | |
3221 movlw LOW d'328' ; 328feet/100m | |
3222 movwf xB+0 | |
3223 movlw HIGH d'328' | |
3224 movwf xB+1 | |
3225 | |
3226 call mult16x16 ; xA*xB=xC (lo:hi * 328) | |
3227 | |
3228 movlw d'50' ; round up | |
3229 addwf xC+0,F | |
3230 movlw 0 | |
3231 addwfc xC+1,F | |
3232 addwfc xC+2,F | |
3233 addwfc xC+3,F | |
3234 | |
3235 movlw LOW .10000 | |
3236 movwf xB+0 | |
3237 movlw HIGH .10000 | |
3238 movwf xB+1 | |
3239 | |
3240 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3241 | |
3242 movff xC+0,lo | |
3243 movff xC+1,hi ; restore lo and hi with updated value | |
3244 return | |
3245 | |
3246 global convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit | |
3247 convert_celsius_to_fahrenheit: ; convert value in lo:hi from celsius to fahrenheit | |
3248 ; Does it work with signed temperature? mH | |
3249 movff lo,xA+0 | |
3250 movff hi,xA+1 | |
3251 | |
3252 movlw d'18' ; 1C = 1.8F | |
3253 movwf xB+0 | |
3254 clrf xB+1 | |
3255 | |
3256 call mult16x16 ;xA*xB=xC (lo:hi * 18) | |
3257 | |
3258 movlw d'10' | |
3259 movwf xB+0 | |
3260 clrf xB+1 | |
3261 | |
3262 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3263 | |
3264 movlw LOW d'320' ; 0C = 32F | |
3265 addwf xC+0,F | |
3266 movlw HIGH d'320' | |
3267 addwfc xC+1,F | |
3268 | |
3269 movff xC+0,lo | |
3270 movff xC+1,hi ; restore lo and hi with updated value | |
3271 return | |
3272 | |
3273 END |