Mercurial > public > hwos_code
comparison src/tft_outputs.asm @ 560:b7eb98dbd800
bump to 2.96beta (REFACTORED VERSION)
author | heinrichsweikamp |
---|---|
date | Wed, 31 Jan 2018 19:39:37 +0100 |
parents | 2e70700774b9 |
children | 54346c651b6a |
comparison
equal
deleted
inserted
replaced
559:9cb967d844f0 | 560:b7eb98dbd800 |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File tft_outputs.asm | 3 ; File tft_outputs.asm REFACTORED VERSION V2.95a1 |
4 ; | 4 ; |
5 ; Startup subroutines | 5 ; Startup subroutines |
6 ; | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
10 ; 2011-08-07 : [mH] moving from OSTC code | 10 ; 2011-08-07 : [mH] moving from OSTC code |
11 | 11 |
12 #include "hwos.inc" ; Mandatory header | 12 #include "hwos.inc" ; Mandatory header |
13 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c | 13 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c |
14 #include "tft.inc" | 14 #include "tft.inc" |
15 #include "start.inc" | |
15 #include "wait.inc" | 16 #include "wait.inc" |
16 #include "strings.inc" | 17 #include "strings.inc" |
17 #include "convert.inc" | 18 #include "convert.inc" |
18 #include "varargs.inc" | 19 #include "varargs.inc" |
19 #include "math.inc" | 20 #include "math.inc" |
27 #include "customview.inc" | 28 #include "customview.inc" |
28 #include "i2c.inc" | 29 #include "i2c.inc" |
29 #include "colorschemes.inc" | 30 #include "colorschemes.inc" |
30 #include "calibrate.inc" | 31 #include "calibrate.inc" |
31 | 32 |
33 | |
32 extern aa_wordprocessor | 34 extern aa_wordprocessor |
33 | 35 |
34 ;============================================================================= | 36 ;============================================================================= |
35 | 37 |
36 gui CODE | 38 gui CODE |
37 ;============================================================================= | 39 ;============================================================================= |
38 | 40 |
39 global TFT_divemask_color | 41 global TFT_divemask_color |
40 TFT_divemask_color: | 42 TFT_divemask_color: |
41 movlw color_green | 43 movlw color_green |
42 btfsc divemode ; in Divemode? | 44 btfsc divemode ; in Divemode? |
43 rcall TFT_divemask_color_dive | 45 rcall TFT_divemask_color_dive |
44 bra TFT_standard_color0 | 46 bra TFT_standard_color0 |
45 | 47 |
46 TFT_divemask_color_dive: | 48 TFT_divemask_color_dive: |
47 movff opt_dive_color_scheme,WREG ; 0-3 | 49 movff opt_dive_color_scheme,WREG ; 0-3 |
48 incf WREG | 50 incf WREG |
49 dcfsnz WREG | 51 dcfsnz WREG |
50 retlw color_scheme_divemode_mask1 ;0 | 52 retlw color_scheme_divemode_mask1 ;0 |
51 dcfsnz WREG | 53 dcfsnz WREG |
52 retlw color_scheme_divemode_mask2 ;1 | 54 retlw color_scheme_divemode_mask2 ;1 |
53 dcfsnz WREG | 55 dcfsnz WREG |
54 retlw color_scheme_divemode_mask3 ;2 | 56 retlw color_scheme_divemode_mask3 ;2 |
55 retlw color_scheme_divemode_mask4 ;3 | 57 retlw color_scheme_divemode_mask4 ;3 |
56 | 58 |
57 | 59 |
58 global TFT_attention_color | 60 global TFT_attention_color |
59 TFT_attention_color: | 61 TFT_attention_color: |
60 movlw color_yellow ; TODO | 62 movlw color_yellow ; TODO |
61 bra TFT_standard_color0 | 63 bra TFT_standard_color0 |
62 TFT_attention_color_dive: | 64 TFT_attention_color_dive: |
63 retlw color_yellow ; TODO | 65 retlw color_yellow ; TODO |
64 | 66 |
65 global TFT_warnings_color | 67 global TFT_warnings_color |
66 TFT_warnings_color: | 68 TFT_warnings_color: |
67 movlw color_red ; TODO | 69 movlw color_red ; TODO |
68 bra TFT_standard_color0 | 70 bra TFT_standard_color0 |
69 TFT_warnings_color_dive: | 71 TFT_warnings_color_dive: |
70 retlw color_red ; TODO | 72 retlw color_red ; TODO |
71 | 73 |
72 global TFT_disabled_color | 74 global TFT_disabled_color |
73 TFT_disabled_color: | 75 TFT_disabled_color: |
74 movlw color_grey ; Default to OSTC grey (dark blue) | 76 movlw color_grey ; Default to OSTC grey (dark blue) |
75 btfsc divemode ; in Divemode? | 77 btfsc divemode ; in Divemode? |
76 rcall TFT_disabled_color_dive | 78 rcall TFT_disabled_color_dive |
77 bra TFT_standard_color0 | 79 bra TFT_standard_color0 |
78 TFT_disabled_color_dive: | 80 TFT_disabled_color_dive: |
79 movff opt_dive_color_scheme,WREG ; 0-3 | 81 movff opt_dive_color_scheme,WREG ; 0-3 |
80 incf WREG | 82 incf WREG |
81 dcfsnz WREG | 83 dcfsnz WREG |
82 retlw color_scheme_divemode_dis1 ;0 | 84 retlw color_scheme_divemode_dis1 ;0 |
83 dcfsnz WREG | 85 dcfsnz WREG |
84 retlw color_scheme_divemode_dis2 ;1 | 86 retlw color_scheme_divemode_dis2 ;1 |
85 dcfsnz WREG | 87 dcfsnz WREG |
86 retlw color_scheme_divemode_dis3 ;2 | 88 retlw color_scheme_divemode_dis3 ;2 |
87 retlw color_scheme_divemode_dis4 ;3 | 89 retlw color_scheme_divemode_dis4 ;3 |
88 | 90 |
89 global TFT_standard_color | 91 global TFT_standard_color |
90 TFT_standard_color: | 92 TFT_standard_color: |
91 setf WREG ; Default white | 93 setf WREG ; Default white |
92 btfsc divemode ; in Divemode? | 94 btfsc divemode ; in Divemode? |
93 rcall TFT_standard_color_dive | 95 rcall TFT_standard_color_dive |
94 TFT_standard_color0: | 96 TFT_standard_color0: |
95 goto TFT_set_color ; and return... | 97 goto TFT_set_color ; and return... |
96 TFT_standard_color_dive: | 98 TFT_standard_color_dive: |
97 movff opt_dive_color_scheme,WREG ; 0-3 | 99 movff opt_dive_color_scheme,WREG ; 0-3 |
98 incf WREG | 100 incf WREG |
99 dcfsnz WREG | 101 dcfsnz WREG |
100 retlw color_scheme_divemode_std1 ;0 | 102 retlw color_scheme_divemode_std1 ;0 |
101 dcfsnz WREG | 103 dcfsnz WREG |
102 retlw color_scheme_divemode_std2 ;1 | 104 retlw color_scheme_divemode_std2 ;1 |
103 dcfsnz WREG | 105 dcfsnz WREG |
104 retlw color_scheme_divemode_std3 ;2 | 106 retlw color_scheme_divemode_std3 ;2 |
105 retlw color_scheme_divemode_std4 ;3 | 107 retlw color_scheme_divemode_std4 ;3 |
106 | 108 |
107 TFT_color_code macro color_code_temp | 109 TFT_color_code macro color_code_temp |
108 movlw color_code_temp | 110 movlw color_code_temp |
109 call TFT_color_code1 | 111 call TFT_color_code1 |
110 endm | 112 endm |
111 | 113 |
112 global TFT_color_code1 | 114 global TFT_color_code1 |
113 TFT_color_code1: ; Color-codes the output, if required | 115 TFT_color_code1: ; Color-codes the output, if required |
114 dcfsnz WREG | 116 dcfsnz WREG |
115 bra TFT_color_code_depth ; depth_warn_mbar [mbar], 16Bit | 117 bra TFT_color_code_depth ; depth_warn_mbar [mbar], 16Bit |
116 dcfsnz WREG | 118 dcfsnz WREG |
117 bra TFT_color_code_cns ; color_code_cns_high [%] | 119 bra TFT_color_code_cns ; color-code CNS values (CNS in hi:lo [%]) |
118 dcfsnz WREG | 120 dcfsnz WREG |
119 bra TFT_color_code_gf ; color_code_gf_warn_high [%] | 121 bra TFT_color_code_gf ; color-code GF value [%] |
120 dcfsnz WREG | 122 dcfsnz WREG |
121 bra TFT_color_code_ppo2 ; Color-code the OC ppO2 results [cbar], opt_ppO2_max as threshold | 123 bra TFT_color_code_ppo2 ; Color-code ppO2 values (ppO2 in hi:lo [cbar]) by its warning flags |
122 dcfsnz WREG | 124 dcfsnz WREG |
123 bra TFT_color_code_ceiling ; Show warning if current depth>shown ceiling | 125 bra TFT_color_code_ceiling ; Color-code the ceiling depth |
124 dcfsnz WREG | 126 dcfsnz WREG |
125 bra TFT_color_code_gaslist ; Color-code current row in Gaslist (%O2 in hi), opt_ppO2_max as threshold | 127 bra TFT_color_code_gaslist ; Color-code current row in Gaslist (%O2 in hi) according to current amb_pressure |
126 dcfsnz WREG | 128 dcfsnz WREG |
127 bra TFT_color_code_ppo2_hud ; Color-code the hud ppO2 readings [cbar], opt_ppO2_max as threshold | 129 bra TFT_color_code_ppo2_hud ; Color-code ppO2 values (ppO2 in --:lo [cbar]) by its value |
128 dcfsnz WREG | 130 dcfsnz WREG |
129 bra TFT_color_code_battery ; Color-code the battery display | 131 bra TFT_color_code_battery ; Color-code the battery display |
130 | 132 dcfsnz WREG |
131 TFT_color_code_gaslist: ; %O2 in hi | 133 bra TFT_color_code_stop ; Color-code the stop depth |
134 | |
135 | |
136 TFT_color_code_gaslist: ; %O2 in hi | |
132 ; Check very high ppO2 manually | 137 ; Check very high ppO2 manually |
133 SAFE_2BYTE_COPY amb_pressure,xA | 138 SAFE_2BYTE_COPY amb_pressure,xA |
134 movlw d'10' | 139 movlw d'10' |
135 movwf xB+0 | 140 movwf xB+0 |
136 clrf xB+1 | 141 clrf xB+1 |
137 call div16x16 ; xC=p_amb/10 | 142 call div16x16 ; xC=p_amb/10 |
138 movff xC+0,xA+0 | 143 movff xC+0,xA+0 |
139 movff xC+1,xA+1 | 144 movff xC+1,xA+1 |
140 movff hi,xB+0 | 145 movff hi,xB+0 |
141 clrf xB+1 | 146 clrf xB+1 |
142 call mult16x16 ; hi * p_amb/10 | 147 call mult16x16 ; hi * p_amb/10 |
143 ; Check if ppO2>6,55bar | 148 ; Check if ppO2>6,55bar |
144 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | 149 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? |
145 bra TFT_warnings_color ; Yes, warn in warning color | 150 bra TFT_warnings_color ; Yes, warn in warning color |
146 ; Check if ppO2>3,30bar | 151 ; Check if ppO2>3,30bar |
147 btfsc xC+1,7 | 152 btfsc xC+1,7 |
148 bra TFT_warnings_color ; Yes, warn in warning color | 153 bra TFT_warnings_color ; Yes, warn in warning color |
149 | |
150 ; Check for low ppo2 | 154 ; Check for low ppo2 |
151 movff xC+0,sub_a+0 | 155 movff xC+0,sub_a+0 |
152 movff xC+1,sub_a+1 | 156 movff xC+1,sub_a+1 |
153 movff opt_ppO2_min,WREG | 157 movff char_I_ppO2_min,WREG |
154 mullw d'100' ; opt_ppO2_min*100 | 158 mullw d'100' ; char_I_ppO2_min*100 |
155 movff PRODL,sub_b+0 | 159 movff PRODL,sub_b+0 |
156 movff PRODH,sub_b+1 | 160 movff PRODH,sub_b+1 |
157 call subU16 | 161 call subU16 |
158 btfsc neg_flag | 162 btfsc neg_flag |
159 bra TFT_warnings_color ; too low -> Warning Color! | 163 bra TFT_warnings_color ; too low -> Warning Color! |
160 | |
161 ; Check for high ppo2 | 164 ; Check for high ppo2 |
162 movff gaslist_gas_global,WREG ; Read current gas O2 ratio | 165 movff gaslist_gas_global,WREG ; Read current gas O2 ratio |
163 lfsr FSR1,opt_gas_type ; 0=Disabled, 1=First, 2=Travel, 3=Deco for OC gases and 0=Disabled, 1=First, 2=Normal for diluents | 166 lfsr FSR1,opt_gas_type ; 0=Disabled, 1=First, 2=Travel, 3=Deco for OC gases and 0=Disabled, 1=First, 2=Normal for diluents |
164 movff PLUSW1,xA+0 ; xA+0 used as temp here -> holds type | 167 movff PLUSW1,xA+0 ; xA+0 used as temp here -> holds type |
165 | 168 movff char_I_ppO2_max_deco,xB+1 ; xB+1 used as temp here |
166 movff opt_ppO2_max_deco,xB+1 ; xB+1 used as temp here | |
167 movlw .3 | 169 movlw .3 |
168 cpfseq xA+0 ; Deco? | 170 cpfseq xA+0 ; Deco? |
169 movff opt_ppO2_max,xB+1 ; No, overwrite with travel/bottom max | 171 movff char_I_ppO2_max,xB+1 ; No, overwrite with travel/bottom max |
170 movf xB+1,W ; Result in WREG | 172 movf xB+1,W ; Result in WREG |
171 mullw d'100' ; opt_ppO2_max*100 | 173 mullw d'100' ; char_I_ppO2_max*100 |
172 movff PRODL,sub_b+0 | 174 movff PRODL,sub_b+0 |
173 movff PRODH,sub_b+1 | 175 movff PRODH,sub_b+1 |
174 infsnz sub_a+0,F | 176 infsnz sub_a+0,F |
175 incf sub_a+1,F ; add 1mbar to avoid warning on equal | 177 incf sub_a+1,F ; add 1mbar to avoid warning on equal |
176 call subU16 ; sub_c = sub_a - sub_b | 178 call subU16 ; sub_c = sub_a - sub_b |
177 btfss neg_flag | 179 btfss neg_flag |
178 bra TFT_warnings_color ; too high -> Warning Color! | 180 bra TFT_warnings_color ; too high -> Warning Color! |
179 return | 181 return |
180 | 182 |
183 | |
181 TFT_color_code_ceiling: | 184 TFT_color_code_ceiling: |
182 SAFE_2BYTE_COPY rel_pressure, lo | 185 btfsc hi,char_invalid_flag ; is the invalid flag set? (bit 7 here) |
183 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 186 bra TFT_color_code_ceiling_1 ; YES |
184 movff hi,xA+1 | 187 SAFE_2BYTE_COPY rel_pressure,sub_a ; NO |
185 movff lo,xA+0 | 188 movff lo,sub_b+0 |
186 movff char_O_first_deco_depth,lo ; Ceiling in m | 189 movff hi,sub_b+1 |
187 decf lo,F ; -1 | 190 call subU16 ; sub_c = sub_a - sub_b : sub_c = rel_pressure [cm] - int_O_ceiling [mbar => cm] |
188 movlw LOW d'100' | 191 btfsc neg_flag ; is ceiling > current depth? |
192 bra TFT_warnings_color ; YES - set to warning color and return | |
193 bra TFT_standard_color ; NO - set to standard color and return | |
194 TFT_color_code_ceiling_1: | |
195 bcf hi,char_invalid_flag ; clear the invalid flag (bit 7 here) | |
196 bra TFT_disabled_color ; set to disabled color and return | |
197 | |
198 | |
199 TFT_color_code_stop: | |
200 movff char_O_deco_gas+0,WREG ; get flag for invalid deco data | |
201 btfsc WREG,char_invalid_flag ; is the invalid flag set? | |
202 bra TFT_disabled_color ; set to disabled color and return | |
203 SAFE_2BYTE_COPY rel_pressure,xA ; get current pressure in mbar = cm | |
204 movlw LOW d'100' | |
189 movwf xB+0 | 205 movwf xB+0 |
190 clrf xB+1 ; Devide/100 -> xC+0 = Depth in m | 206 clrf xB+1 |
191 call div16x16 ; xA/xB=xC with xA as remainder | 207 call div16x16 ; xA/xB=xC with xA as remainder: Divide/100 => xC+0 = current depth in meters |
192 movf xC+0,W ; Depth in m | 208 movff char_O_first_deco_depth,WREG; get stop depth in m into WREG |
193 subwf lo,W | 209 subwf xC+0,W ; compute current depth - stop depth |
194 btfsc STATUS,C | 210 btfsc STATUS,C ; result negative? |
195 bra TFT_warnings_color ; Set to warning color | 211 bra TFT_standard_color ; NO - set to standard color and return |
196 bra TFT_standard_color ; and return... | 212 bra TFT_warnings_color ; YES - set to warning color and return |
197 | 213 |
198 TFT_color_code_depth: | 214 |
199 movff hi,hi_temp | 215 |
200 movff lo,lo_temp | 216 TFT_color_code_depth: ; with depth as rel_pressure in [mbar] in hi:lo |
201 SAFE_2BYTE_COPY rel_pressure, lo | |
202 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
203 movff lo,sub_a+0 | 217 movff lo,sub_a+0 |
204 movff hi,sub_a+1 | 218 movff hi,sub_a+1 |
205 movlw LOW depth_warn_mbar | 219 movlw LOW depth_warn_mbar |
206 movwf lo | 220 movwf sub_b+0 |
207 movlw HIGH depth_warn_mbar | 221 movlw HIGH depth_warn_mbar |
208 movwf hi | 222 movwf sub_b+1 |
209 movff lo,sub_b+0 | 223 call subU16 ; sub_c = sub_a - sub_b |
210 movff hi,sub_b+1 | 224 TSTOSS opt_modwarning ; 0=standard, 1=blink |
211 movff hi_temp,hi | |
212 movff lo_temp,lo ; Restore hi, lo | |
213 | |
214 TSTOSS opt_modwarning ; 0=standard, 1=blink | |
215 bra TFT_color_code_depth_std | 225 bra TFT_color_code_depth_std |
216 ;TFT_color_code_depth_blink: | |
217 call subU16 ; sub_c = sub_a - sub_b | |
218 btfss neg_flag | 226 btfss neg_flag |
219 bra TFT_color_code_depth_warn ; Set to warning color | 227 bra TFT_color_code_depth_warn ; set to warning color |
220 bra TFT_color_code_ppo2_depth ; check depth against MOD ; and return... | 228 bra TFT_color_code_depth_ppO2 ; check depth against MOD and return... |
221 | |
222 | |
223 TFT_color_code_depth_std: | 229 TFT_color_code_depth_std: |
224 call subU16 ; sub_c = sub_a - sub_b | |
225 btfss neg_flag | 230 btfss neg_flag |
226 bra TFT_warnings_color ; Set to warning color | 231 bra TFT_warnings_color ; set to warning color and return |
227 bra TFT_standard_color ; and return... | 232 bra TFT_standard_color ; set to standard color and return... |
228 | 233 TFT_color_code_depth_ppO2: |
229 | 234 movff opt_dive_mode,WREG ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR |
230 TFT_color_code_ppo2_depth: | 235 decfsz WREG,F ; are we in CCR mode? |
231 movff opt_dive_mode,WREG ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR | 236 bra TFT_color_code_depth_no_ccr ; NO - continue checking for ppO2 |
232 decfsz WREG,F | 237 btfsc is_bailout ; YES - check if in bailout |
233 bra TFT_color_code_ppo2_depth_no_ccr ; Not CCR... | 238 bra TFT_color_code_depth_no_ccr ; YES - continue checking for ppO2 |
234 | 239 ; no warning by depth for all CCR modes when not in bailout ## V2.94 |
240 ;movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP | |
241 ;decfsz WREG,F | |
242 ;bra TFT_color_code_ppo2_depth_no_ccr ; Not Sensor | |
243 bcf blinking_depth_warning ; reset warning | |
244 bra TFT_standard_color ; no color coding, return. | |
245 TFT_color_code_depth_no_ccr: | |
246 movff int_O_breathed_ppO2+1,WREG ; get upper byte of currently breathed ppO2 | |
247 btfsc WREG,int_warning_flag ; is the warning flag set? | |
248 bra TFT_color_code_depth_warn ; YES - animate in warning design | |
249 bcf blinking_depth_warning ; NO - reset warning | |
250 bra TFT_standard_color ; set standard color and return | |
251 TFT_color_code_depth_warn: | |
252 bsf blinking_depth_warning ; set warning | |
253 bra TFT_warnings_color ; set to warning color and return... | |
254 | |
255 | |
256 TFT_color_code_cns: ; with CNS% in hi:lo | |
257 btfss hi,int_invalid_flag ; is the invalid flag set? | |
258 bra TFT_color_code_cns_1 ; NO | |
259 bcf hi,int_invalid_flag ; YES - clear invalid flag ## Todo: use ~bitmask and AND | |
260 bcf hi,int_warning_flag ; clear warning flag (it may be set) | |
261 bcf hi,int_prewarning_flag ; clear pre-warning flag (it may be set) | |
262 bra TFT_disabled_color ; set to disabled color and return | |
263 TFT_color_code_cns_1 | |
264 btfss hi,int_warning_flag ; is the warning flag set? | |
265 bra TFT_color_code_cns_2 ; NO | |
266 bcf hi,int_warning_flag ; YES - clear warning ## Todo: use ~bitmask and AND | |
267 bcf hi,int_prewarning_flag ; clear pre-warning flag (it may be set) | |
268 bra TFT_warnings_color ; set to warning color and return | |
269 TFT_color_code_cns_2: | |
270 bcf hi,int_prewarning_flag ; clear pre-warning flag (it may be set) | |
271 bra TFT_standard_color ; set to standard color and return | |
272 | |
273 | |
274 TFT_color_code_gf: | |
275 btfsc hi,int_warning_flag ; is the warning flag set? | |
276 bra TFT_warnings_color ; YES - set to warning color and return | |
277 btfsc hi,int_prewarning_flag ; is the attention flag set? | |
278 bra TFT_attention_color ; YES - set to attention color and return | |
279 bra TFT_standard_color ; NO - set to normal color and return | |
280 | |
281 | |
282 TFT_color_code_ppo2: | |
283 btfss hi,int_warning_flag ; is the warning flag set? | |
284 bra TFT_color_code_ppo2_1 ; NO | |
285 bcf hi,int_warning_flag ; YES - clear warning flag ## Todo: use ~bitmask and AND | |
286 bcf hi,int_prewarning_flag ; clear pre-warning flag (it may be set) | |
287 bcf hi,int_high_flag ; clear high warning flag (it may be set) | |
288 bcf hi,int_low_flag ; clear low warning flag (it may be set) | |
289 bra TFT_warnings_color ; warn in warning color | |
290 TFT_color_code_ppo2_1: | |
291 bcf hi,int_prewarning_flag ; clear pre-warning flag (it may be set) ## Todo: use ~bitmask and AND | |
292 bcf hi,int_high_flag ; clear high warning flag (it may be set) | |
293 bcf hi,int_low_flag ; clear low warning flag (it may be set) | |
294 bra TFT_standard_color ; set to standard color and return | |
295 | |
296 | |
297 TFT_color_code_ppo2_hud: ; With ppO2 [cbar] in --:lo | |
298 movff char_O_deco_warnings,WREG ; get the deco warnings vector | |
299 btfss WREG,deco_flag ; are we in deco? | |
300 bra TFT_color_code_ppo2_hud_a ; NO - load normal max value as threshold | |
301 movff char_I_ppO2_max_deco,WREG ; YES - load deco value as threshold | |
302 bra TFT_color_code_ppo2_hud_b | |
303 TFT_color_code_ppo2_hud_a: | |
304 movff char_I_ppO2_max,WREG ; ppO2 max while not in deco | |
305 TFT_color_code_ppo2_hud_b: | |
306 cpfsgt lo ; lo > threshold? | |
307 bra TFT_color_code_ppo2_hud1 ; NO - continue with checking for ppO2 low | |
308 bra TFT_warnings_color ; YES - set warning color and return | |
309 TFT_color_code_ppo2_hud1: | |
310 movff opt_dive_mode,WREG ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR | |
311 decfsz WREG,F ; now: 0=CC, 1=Gauge, 2=Apnea, 3=PSCR | |
312 bra TFT_color_code_ppo2_hud_nocc; not CCR... | |
235 btfsc is_bailout | 313 btfsc is_bailout |
236 bra TFT_color_code_ppo2_depth_no_ccr ; Is bailout -> Test for MOD warning | 314 bra TFT_color_code_ppo2_hud_nocc; is bailout, hence not loop mode... |
237 | 315 movff char_I_ppO2_min_loop,WREG ; ppO2 min loop mode color coding |
238 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP | 316 bra TFT_color_code_ppo2_hud_cont |
239 decfsz WREG,F | 317 TFT_color_code_ppo2_hud_nocc: |
240 bra TFT_color_code_ppo2_depth_no_ccr ; Not Sensor | 318 movff char_I_ppO2_min,WREG ; PPO2 min for all other modes |
241 ; -> CCR and Sensor: Skip this test | 319 TFT_color_code_ppo2_hud_cont: |
242 return | 320 cpfslt lo ; lo < char_I_ppO2_min? |
243 TFT_color_code_ppo2_depth_no_ccr: | 321 bra TFT_standard_color ; NO - set standard color and return... |
244 SAFE_2BYTE_COPY amb_pressure, xA | 322 bra TFT_warnings_color ; Yes - set warning color and return |
245 movlw d'10' | 323 |
246 movwf xB+0 | 324 |
247 clrf xB+1 | 325 TFT_color_code_battery: ; With battery percent in lo |
248 call div16x16 ; xC=p_amb/10 | 326 movlw color_code_battery_low ; get warning threshold |
249 | 327 cpfsgt lo ; is battery percent < threshold? |
250 movff xC+0,xA+0 | 328 bra TFT_warnings_color ; YES - set to warning color and return |
251 movff xC+1,xA+1 | 329 bra TFT_standard_color ; NO - set to standard color and return |
252 movff char_I_O2_ratio,xB+0 ; =O2 ratio | |
253 clrf xB+1 | |
254 call mult16x16 ; char_I_O2_ratio * p_amb/10 | |
255 | |
256 ; Check if ppO2>6,55bar | |
257 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | |
258 ;bra TFT_color_code_warn ; Yes, warn in warning color | |
259 bra TFT_color_code_depth_warn | |
260 ; Check if ppO2>3,30bar | |
261 btfsc xC+1,7 | |
262 bra TFT_color_code_depth_warn | |
263 | |
264 movff xC+0,sub_a+0 | |
265 movff xC+1,sub_a+1 | |
266 ;active_gas_type -> 0=Disabled, 1=First, 2=Travel, 3=Deco for OC gases and 0=Disabled, 1=First, 2=Normal for diluents | |
267 movff active_gas_type,xA+0 ; xA+0 used as temp here -> holds type | |
268 movff opt_ppO2_max_deco,xB+1 ; xB+1 used as temp here | |
269 movlw .3 | |
270 cpfseq xA+0 ; Deco? | |
271 movff opt_ppO2_max,xB+1 ; No, overwrite with travel/bottom max | |
272 movf xB+1,W ; Result in WREG | |
273 mullw d'100' | |
274 movff PRODL,sub_b+0 | |
275 movff PRODH,sub_b+1 | |
276 infsnz sub_a+0,F | |
277 incf sub_a+1,F ; add 1mbar to avoid warning on equal | |
278 call subU16 ; sub_c = sub_a - sub_b | |
279 btfss neg_flag | |
280 bra TFT_color_code_depth_warn | |
281 | |
282 movff xC+0,sub_a+0 | |
283 movff xC+1,sub_a+1 | |
284 movff opt_ppO2_min,WREG ; PPO2 min for Sensors and color coding in divemode | |
285 mullw d'100' | |
286 movff PRODL,sub_b+0 | |
287 movff PRODH,sub_b+1 | |
288 call subU16 ; sub_c = sub_a - sub_b | |
289 btfsc neg_flag | |
290 bra TFT_color_code_depth_warn | |
291 if dm_offset != 0 | |
292 call TFT_standard_color | |
293 else | |
294 movlw color_green | |
295 call TFT_set_color | |
296 endif | |
297 bcf blinking_depth_warning ; reset warning | |
298 return | |
299 | |
300 TFT_color_code_depth_warn: | |
301 bsf blinking_depth_warning ; Set warning | |
302 bra TFT_warnings_color ; Set to warning color | |
303 | |
304 TFT_color_code_cns: | |
305 movff int_O_CNS_fraction+1,lo ; copy into bank1 | |
306 tstfsz lo ; >255% ? | |
307 bra TFT_warnings_color ; Yes | |
308 movff int_O_CNS_fraction+0,lo | |
309 movlw color_code_cns_high ; CNS Warn [%] | |
310 subwf lo,W | |
311 btfsc STATUS,C | |
312 bra TFT_warnings_color ; Set to warning color | |
313 bra TFT_standard_color ; and return... | |
314 | |
315 TFT_color_code_gf: | |
316 movff char_O_gradient_factor,lo ; gradient factor | |
317 movlw color_code_gf_warn_high ; GF Warn [%] | |
318 subwf lo,W | |
319 btfsc STATUS,C | |
320 bra TFT_warnings_color ; Set to warning color | |
321 bra TFT_standard_color ; and return... | |
322 | |
323 TFT_color_code_ppo2: | |
324 ; Check if ppO2>6,55bar | |
325 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | |
326 bra TFT_warnings_color ; Yes, warn in warning color | |
327 ; Check if ppO2>3,30bar | |
328 btfsc xC+1,7 | |
329 bra TFT_warnings_color ; Yes, warn in warning color | |
330 | |
331 movff xC+0,sub_a+0 | |
332 movff xC+1,sub_a+1 | |
333 | |
334 ;active_gas_type -> 0=Disabled, 1=First, 2=Travel, 3=Deco for OC gases and 0=Disabled, 1=First, 2=Normal for diluents | |
335 movff active_gas_type,xA+0 ; xA+0 used as temp here -> holds type | |
336 movff opt_ppO2_max_deco,xB+1 ; xB+1 used as temp here | |
337 movlw .3 | |
338 cpfseq xA+0 ; Deco? | |
339 movff opt_ppO2_max,xB+1 ; No, overwrite with travel/bottom max | |
340 movf xB+1,W ; Result in WREG | |
341 | |
342 mullw d'100' | |
343 movff PRODL,sub_b+0 | |
344 movff PRODH,sub_b+1 | |
345 infsnz sub_a+0,F | |
346 incf sub_a+1,F ; add 1mbar to avoid warning on equal | |
347 call subU16 ; sub_c = sub_a - sub_b | |
348 btfss neg_flag | |
349 bra TFT_warnings_color ; Set to warning color | |
350 | |
351 movff xC+0,sub_a+0 | |
352 movff xC+1,sub_a+1 | |
353 movff opt_ppO2_min,WREG ; PPO2 min for Sensors and color coding in divemode | |
354 mullw d'100' | |
355 movff PRODL,sub_b+0 | |
356 movff PRODH,sub_b+1 | |
357 call subU16 ; sub_c = sub_a - sub_b | |
358 btfsc neg_flag | |
359 bra TFT_warnings_color ; Set to warning color | |
360 bra TFT_standard_color ; and return... | |
361 | |
362 TFT_color_code_ppo2_hud: ; With ppO2 [cbar] in lo | |
363 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode | |
364 cpfsgt lo ; lo > opt_ppO2_max? | |
365 bra TFT_color_code_ppo2_hud1; No | |
366 bra TFT_warnings_color ; Yes | |
367 TFT_color_code_ppo2_hud1: | |
368 movff opt_ppO2_min,WREG ; PPO2 min for Sensors and color coding in divemode | |
369 cpfslt lo ; lo < opt_ppO2_min? | |
370 bra TFT_color_code_ppo2_hud2; No | |
371 bra TFT_warnings_color ; Yes | |
372 TFT_color_code_ppo2_hud2: | |
373 bra TFT_standard_color ; and return... | |
374 | |
375 TFT_color_code_battery: ; With battery percent in lo | |
376 movlw color_code_battery_low | |
377 cpfsgt lo ; lo < color_code_battery_low ? | |
378 bra TFT_warnings_color ; No | |
379 bra TFT_standard_color ; and return... | |
380 | 330 |
381 ; **************************************************************************** | 331 ; **************************************************************************** |
382 | 332 |
383 global TFT_show_OC_startgas_surface | 333 global TFT_show_OC_startgas_surface |
384 TFT_show_OC_startgas_surface: ; Show first gas and "OSTC2-like" active gases | 334 TFT_show_OC_startgas_surface: ; Show first gas and "OSTC2-like" active gases |
385 ; Show first gas | 335 ; Show first gas |
386 WIN_SMALL surf_decotype_column+.1,surf_decotype_row+.30 | 336 WIN_SMALL surf_decotype_column+.1,surf_decotype_row+.30 |
387 extern get_first_gas_to_WREG,gaslist_strcat_gas | 337 extern get_first_gas_to_WREG,gaslist_strcat_gas |
388 call get_first_gas_to_WREG ; Gets first gas (0-4) into WREG | 338 call get_first_gas_to_WREG ; Gets first gas (1-5) into WREG |
339 decf WREG,W ; 1-5 -> 0-4 | |
389 movwf PRODL | 340 movwf PRODL |
390 call gaslist_strcat_gas ; Input: PRODL : gas number (0..4), Output: Text appended into buffer pointed by FSR2. | 341 call gaslist_strcat_gas ; Input: PRODL : gas number (0..4), Output: Text appended into buffer pointed by FSR2. |
391 STRCAT_PRINT "" | 342 STRCAT_PRINT "" |
392 ; Show boxes | 343 ; Show boxes |
393 WIN_TOP surf_decotype_row+.30+.25 | 344 WIN_TOP surf_decotype_row+.30+.25 |
400 decfsz hi,F ; Type = 1 (First)? | 351 decfsz hi,F ; Type = 1 (First)? |
401 bra DISP_active_gas_surfmode3 ; No, skip box | 352 bra DISP_active_gas_surfmode3 ; No, skip box |
402 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left1, surf_decotype_boxes_left1+.8 ;top, bottom, left, right | 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 |
403 DISP_active_gas_surfmode3: | 354 DISP_active_gas_surfmode3: |
404 rcall TFT_disabled_color | 355 rcall TFT_disabled_color |
405 movff opt_gas_type+1,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco | 356 movff opt_gas_type+1,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
406 tstfsz hi | 357 tstfsz hi |
407 rcall TFT_standard_color | 358 rcall TFT_standard_color |
408 WIN_LEFT surf_decotype_boxes_left2+.1 | 359 WIN_LEFT surf_decotype_boxes_left2+.1 |
409 STRCPY_PRINT "2" | 360 STRCPY_PRINT "2" |
410 decfsz hi,F ; Type = 1 (First)? | 361 decfsz hi,F ; Type = 1 (First)? |
411 bra DISP_active_gas_surfmode4 ; No, skip box | 362 bra DISP_active_gas_surfmode4 ; No, skip box |
412 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left2, surf_decotype_boxes_left2+.8 ;top, bottom, left, right | 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 |
413 DISP_active_gas_surfmode4: | 364 DISP_active_gas_surfmode4: |
414 rcall TFT_disabled_color | 365 rcall TFT_disabled_color |
415 movff opt_gas_type+2,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco | 366 movff opt_gas_type+2,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
416 tstfsz hi | 367 tstfsz hi |
417 rcall TFT_standard_color | 368 rcall TFT_standard_color |
418 WIN_LEFT surf_decotype_boxes_left3+.1 | 369 WIN_LEFT surf_decotype_boxes_left3+.1 |
419 STRCPY_PRINT "3" | 370 STRCPY_PRINT "3" |
420 decfsz hi,F ; Type = 1 (First)? | 371 decfsz hi,F ; Type = 1 (First)? |
421 bra DISP_active_gas_surfmode5 ; No, skip box | 372 bra DISP_active_gas_surfmode5 ; No, skip box |
422 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left3, surf_decotype_boxes_left3+.8 ;top, bottom, left, right | 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 |
423 DISP_active_gas_surfmode5: | 374 DISP_active_gas_surfmode5: |
424 rcall TFT_disabled_color | 375 rcall TFT_disabled_color |
425 movff opt_gas_type+3,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco | 376 movff opt_gas_type+3,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
426 tstfsz hi | 377 tstfsz hi |
427 rcall TFT_standard_color | 378 rcall TFT_standard_color |
428 WIN_LEFT surf_decotype_boxes_left4+.1 | 379 WIN_LEFT surf_decotype_boxes_left4+.1 |
429 STRCPY_PRINT "4" | 380 STRCPY_PRINT "4" |
430 decfsz hi,F ; Type = 1 (First)? | 381 decfsz hi,F ; Type = 1 (First)? |
431 bra DISP_active_gas_surfmode6 ; No, skip box | 382 bra DISP_active_gas_surfmode6 ; No, skip box |
432 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left4, surf_decotype_boxes_left4+.8 ;top, bottom, left, right | 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 |
433 DISP_active_gas_surfmode6: | 384 DISP_active_gas_surfmode6: |
434 rcall TFT_disabled_color | 385 rcall TFT_disabled_color |
435 movff opt_gas_type+4,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco | 386 movff opt_gas_type+4,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
436 tstfsz hi | 387 tstfsz hi |
437 rcall TFT_standard_color | 388 rcall TFT_standard_color |
438 WIN_LEFT surf_decotype_boxes_left5+.1 | 389 WIN_LEFT surf_decotype_boxes_left5+.1 |
439 STRCPY_PRINT "5" | 390 STRCPY_PRINT "5" |
440 rcall TFT_standard_color ; Reset color | 391 rcall TFT_standard_color ; Reset color |
441 decfsz hi,F ; Type = 1 (First)? | 392 decfsz hi,F ; Type = 1 (First)? |
442 return ; no, Done. | 393 return ; no, Done. |
443 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left5, surf_decotype_boxes_left5+.8 ;top, bottom, left, right | 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 |
444 return ; Done. | 395 return ; Done. |
445 | 396 |
397 | |
446 global TFT_show_color_schemes | 398 global TFT_show_color_schemes |
447 TFT_show_color_schemes: ; update the color schemes | 399 TFT_show_color_schemes: ; update the color schemes |
448 bsf divemode ; put in divemode | 400 bsf divemode ; put in divemode |
449 call TFT_divemask_color | 401 call TFT_divemask_color |
450 WIN_TINY .12,.40 | 402 WIN_TINY .12,.40 |
451 STRCAT_TEXT_PRINT tDepth | 403 STRCAT_TEXT_PRINT tDepth |
452 WIN_TINY .62,.40 | 404 WIN_TINY .62,.40 |
453 STRCAT_TEXT_PRINT tMaxDepth | 405 STRCAT_TEXT_PRINT tMaxDepth |
463 movwf lo | 415 movwf lo |
464 movlw HIGH .5172 | 416 movlw HIGH .5172 |
465 movwf hi | 417 movwf hi |
466 bsf leftbind | 418 bsf leftbind |
467 bsf ignore_digit4 | 419 bsf ignore_digit4 |
468 output_16 ; Full meters in Big font | 420 output_16 ; Full meters in Big font |
469 bcf leftbind | 421 bcf leftbind |
470 STRCAT_PRINT "" ; Display full meters | 422 STRCAT_PRINT "" ; Display full meters |
471 WIN_SMALL .25,.66 | 423 WIN_SMALL .25,.66 |
472 movlw LOW .5172 | 424 movlw LOW .5172 |
473 movwf lo | 425 movwf lo |
474 movlw HIGH .5172 | 426 movlw HIGH .5172 |
475 movwf hi | 427 movwf hi |
476 PUTC "." | 428 PUTC "." |
477 movlw d'4' | 429 movlw d'4' |
478 movwf ignore_digits | 430 movwf ignore_digits |
479 bsf ignore_digit5 | 431 bsf ignore_digit5 |
480 output_16dp d'0' ; .1m in SMALL font | 432 output_16dp d'0' ; .1m in SMALL font |
481 STRCAT_PRINT "" ; Display decimeters | 433 STRCAT_PRINT "" ; Display decimeters |
482 WIN_FONT FT_SMALL | 434 WIN_FONT FT_SMALL |
483 | 435 |
484 ; Max. Depth demo | 436 ; Max. Depth demo |
485 WIN_MEDIUM .64,.54 | 437 WIN_MEDIUM .64,.54 |
486 bsf ignore_digit4 ; no 0.1m | 438 bsf ignore_digit4 ; no 0.1m |
487 bsf leftbind | 439 bsf leftbind |
488 movlw LOW .6349 | 440 movlw LOW .6349 |
489 movwf lo | 441 movwf lo |
490 movlw HIGH .6349 | 442 movlw HIGH .6349 |
491 movwf hi | 443 movwf hi |
492 output_16 | 444 output_16 |
493 STRCAT_PRINT "" ; Display full meters | 445 STRCAT_PRINT "" ; Display full meters |
494 bcf leftbind | 446 bcf leftbind |
495 ; .1m in SMALL font | 447 ; .1m in SMALL font |
496 WIN_SMALL .87,.66 | 448 WIN_SMALL .87,.66 |
497 PUTC "." | 449 PUTC "." |
498 movlw d'4' | 450 movlw d'4' |
502 movlw LOW .6349 | 454 movlw LOW .6349 |
503 movwf lo | 455 movwf lo |
504 movlw HIGH .6349 | 456 movlw HIGH .6349 |
505 movwf hi | 457 movwf hi |
506 output_16dp d'0' | 458 output_16dp d'0' |
507 STRCAT_PRINT "" ; Display decimeters | 459 STRCAT_PRINT "" ; Display decimeters |
508 bcf leftbind | 460 bcf leftbind |
509 | 461 |
510 ; Divetime demo | 462 ; Divetime demo |
511 movff mins,lo | 463 movff mins,lo |
512 clrf hi | 464 clrf hi |
513 WIN_MEDIUM .103, .54 | 465 WIN_MEDIUM .103, .54 |
514 output_16_3 ; limit to 999 and display only (0-999) | 466 output_16_3 ; limit to 999 and display only (0-999) |
515 STRCAT_PRINT "" ; Show minutes in large font | 467 STRCAT_PRINT "" ; Show minutes in large font |
516 WIN_SMALL .139, .66 ; left position for two sec figures | 468 WIN_SMALL .139, .66 ; left position for two sec figures |
517 PUTC ':' | 469 PUTC ':' |
518 bsf leftbind | 470 bsf leftbind |
519 movff secs,lo | 471 movff secs,lo |
520 output_99x | 472 output_99x |
521 bcf leftbind | 473 bcf leftbind |
522 STRCAT_PRINT "" ; Show seconds in small font | 474 STRCAT_PRINT "" ; Show seconds in small font |
523 | 475 |
524 bcf divemode ; don't stay in divemode | 476 bcf divemode ; don't stay in divemode |
525 return | 477 return |
526 | 478 |
527 global TFT_divemode_mask | 479 global TFT_divemode_mask |
528 TFT_divemode_mask: ; Displays mask in Dive-Mode | 480 TFT_divemode_mask: ; Displays mask in divemode |
529 if dm_offset != 0 | 481 bcf FLAG_TFT_divemode_mask |
530 call TFT_divemask_color | 482 call TFT_divemask_color |
531 WIN_TINY dm_mask_depth_column,dm_mask_depth_row | 483 WIN_TINY dm_mask_depth_column,dm_mask_depth_row |
532 STRCAT_TEXT_PRINT tDepth | 484 STRCAT_TEXT_PRINT tDepth |
533 WIN_TINY dm_mask_maxdepth_column,dm_mask_maxdepth_row | 485 WIN_TINY dm_mask_maxdepth_column,dm_mask_maxdepth_row |
534 TSTOSS opt_vsigraph ; 0=skip, 1=draw | 486 TSTOSS opt_vsigraph ; 0=skip, 1=draw |
535 WIN_TINY dm_mask_maxdepth_column_nvsi,dm_mask_maxdepth_row | 487 WIN_TINY dm_mask_maxdepth_column_nvsi,dm_mask_maxdepth_row |
536 STRCAT_TEXT_PRINT tMaxDepth | 488 STRCAT_TEXT_PRINT tMaxDepth |
537 WIN_TINY dm_mask_divetime_column,dm_mask_divetime_row | 489 WIN_TINY dm_mask_divetime_column,dm_mask_divetime_row |
538 STRCAT_TEXT_PRINT tDivetime | 490 STRCAT_TEXT_PRINT tDivetime |
539 endif | 491 bra TFT_standard_color ; and return... |
540 | 492 |
541 if dm_offset == 0 | 493 global TFT_divemode_mask_alternative |
542 movlw color_dark_red | 494 TFT_divemode_mask_alternative: ; Alt. mask for divemode |
543 call TFT_set_color | 495 bcf FLAG_TFT_divemode_mask_alt |
544 TSTOSS opt_vsigraph ; 0=skip, 1=draw | 496 call TFT_divemask_color |
545 bra $+4 | 497 WIN_TINY dm_mask_depth_column,dm_mask_depth_row |
546 WIN_FRAME_COLOR16 dm_velobar_top, dm_velobar_bot, dm_velobar_lft, dm_velobar_rgt ;top, bottom, left, right | 498 STRCAT_TEXT_PRINT tDepth |
547 WIN_FRAME_COLOR16 dm_sep_1_2_row, dm_sep_1_2_row, .0, .159 ;top, bottom, left, right | 499 WIN_TINY dm_mask_divetime_column-.30,dm_mask_divetime_row |
548 WIN_FRAME_COLOR16 dm_sep_2_3_row, dm_sep_2_3_row, .0, .159 ;top, bottom, left, right | 500 STRCAT_TEXT_PRINT tDivetime |
549 WIN_FRAME_COLOR16 dm_warning_row-.1, dm_warning_row-.1, dm_warning_column, .159 ;top, bottom, left, right | 501 bra TFT_standard_color ; and return... |
550 TSTOSS opt_vsigraph ; 0=skip, 1=draw | 502 |
551 bra $+4 | |
552 WIN_FRAME_COLOR16 dm_warning_row-.1, dm_warning_row-.1, dm_max_depth_column_nvsi, .159 ;top, bottom, left, right | |
553 call TFT_draw_gassep_line | |
554 endif | |
555 | |
556 bra TFT_standard_color ; and return... | |
557 | |
558 global TFT_draw_gassep_line | 503 global TFT_draw_gassep_line |
559 TFT_draw_gassep_line: | 504 TFT_draw_gassep_line: |
560 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode | 505 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode |
561 return | 506 return |
562 btfsc divemode_menu ; Is the dive mode menu shown? | 507 btfsc divemode_menu ; Is the dive mode menu shown? |
563 return ; Yes, return | 508 return ; Yes, return |
564 if dm_offset == 0 | 509 bra TFT_standard_color ; and return... |
565 movlw color_dark_red | |
566 call TFT_set_color | |
567 WIN_FRAME_COLOR16 dm_gassep_row, dm_gassep_bot, dm_gassep_column, dm_gassep_column | |
568 endif | |
569 bra TFT_standard_color ; and return... | |
570 | 510 |
571 ;========================================================================= | 511 ;========================================================================= |
572 | 512 |
573 global TFT_display_velocity | 513 global TFT_display_velocity |
574 TFT_display_velocity: ; With divA+0 = m/min, neg_flag_velocity: ascend=1, descend=0 | 514 TFT_display_velocity: ; With divA+0 = m/min, neg_flag_velocity: ascend=1, descend=0 |
575 bcf STATUS,C | 515 bcf STATUS,C |
576 movlw velocity_display_threshold_1 ; lowest threshold for display vertical velocity | 516 movlw velocity_display_threshold_1 ; lowest threshold for display vertical velocity |
577 subwf divA+0,W | 517 subwf divA+0,W |
578 btfss STATUS,C | 518 btfss STATUS,C |
579 bra TFT_velocity_clear ; lower then threshold. Clear text and graph (If active) | 519 bra TFT_velocity_clear ; lower then threshold. Clear text and graph (If active) |
580 | 520 |
581 ; We have something to display | 521 ; We have something to display |
582 bsf display_velocity ; Set flag | 522 bsf display_velocity ; Set flag |
583 ; check if descending: no warning color if descending | 523 ; check if descending: no warning color if descending |
584 call TFT_standard_color | 524 rcall TFT_standard_color |
585 btfsc neg_flag_velocity ; Ignore for descent! | 525 btfsc neg_flag_velocity ; Ignore for descent! |
586 rcall TFT_velocity_set_color ; Set color for text and set threshold for graph | 526 rcall TFT_velocity_set_color ; Set color for text and set threshold for graph |
587 | 527 |
588 rcall TFT_velocity_disp ; Show the text | 528 rcall TFT_velocity_disp ; Show the text |
589 | 529 |
590 TSTOSS opt_vsigraph ; =1: draw the graphical VSI bar | 530 TSTOSS opt_vsigraph ; =1: draw the graphical VSI bar |
591 bra TFT_display_velocity_done ; No graph | 531 bra TFT_display_velocity_done ; No graph |
592 | 532 |
593 btfsc neg_flag_velocity ; Ignore for descent! | 533 btfsc alternative_divelayout ; Alternative layout? |
594 rcall TFT_velocity_graph ; Show the graph | 534 bra TFT_display_velocity_done ; Yes, no graph! (no room when divetime minutes is three figures) |
595 btfss neg_flag_velocity ; Ignore for descent! | 535 |
596 rcall TFT_velocity_clear_graph ; Clear the graph for descent | 536 btfsc neg_flag_velocity ; Ignore for descent! |
537 rcall TFT_velocity_graph ; Show the graph | |
538 btfss neg_flag_velocity ; Ignore for descent! | |
539 rcall TFT_velocity_clear_graph ; Clear the graph for descent | |
597 | 540 |
598 TFT_display_velocity_done: | 541 TFT_display_velocity_done: |
599 bra TFT_standard_color ; and return! | 542 bra TFT_standard_color ; and return! |
600 | 543 |
601 TFT_speed_table: | 544 TFT_speed_table: |
602 ; use a depth-dependent ascent rate warning | 545 ; use a depth-dependent ascent rate warning |
603 ; depth(ft): <20 >20 >40 >60 >75 >88 >101 >115 >128 >144 >164 | 546 ; depth(ft): <20 >20 >40 >60 >75 >88 >101 >115 >128 >144 >164 |
604 ; speed(ft/min): 23 26 29 33 36 43 49 56 59 62 66 | 547 ; speed(ft/min): 23 26 29 33 36 43 49 56 59 62 66 |
617 DB .39,.17,.13,.0 | 560 DB .39,.17,.13,.0 |
618 DB .44,.18,.14,.0 | 561 DB .44,.18,.14,.0 |
619 DB .50,.19,.15,.0 | 562 DB .50,.19,.15,.0 |
620 DB .200,.20,.15,.0 | 563 DB .200,.20,.15,.0 |
621 | 564 |
622 TFT_velocity_set_color: ; Set color based on speed table or use static thresholds, with divA+0 = m/min | 565 TFT_velocity_set_color: ; Set color based on speed table or use static thresholds, with divA+0 = m/min |
623 ; check if old/new ascend logic is used | 566 ; check if old/new ascend logic is used |
624 TSTOSS opt_vsitextv2 ; 0=standard, 1=dynamic | 567 TSTOSS opt_vsitextv2 ; 0=standard, 1=dynamic |
625 bra TFT_velocity_set_color_static ; static ascend rate limit | 568 bra TFT_velocity_set_color_static ; static ascend rate limit |
626 | 569 |
627 ; get the actual depth in m | 570 ; get the actual depth in m |
628 SAFE_2BYTE_COPY rel_pressure, lo | 571 SAFE_2BYTE_COPY rel_pressure, lo |
629 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 572 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
630 movff hi,xA+1 | 573 movff hi,xA+1 |
631 movff lo,xA+0 | 574 movff lo,xA+0 |
632 movlw LOW d'100' | 575 movlw LOW d'100' |
633 movwf xB+0 | 576 movwf xB+0 |
634 clrf xB+1 ; Devide/100 -> xC+0 = Depth in m | 577 clrf xB+1 ; Devide/100 -> xC+0 = Depth in m |
635 call div16x16 ; xA/xB=xC with xA as remainder | 578 call div16x16 ; xA/xB=xC with xA as remainder |
636 ;movf xC+0,W ; Depth in m | 579 ;movf xC+0,W ; Depth in m |
637 | 580 |
638 ; point to speed table | 581 ; point to speed table |
639 movlw LOW (TFT_speed_table-.3) | 582 movlw LOW (TFT_speed_table-.3) |
640 movwf TBLPTRL | 583 movwf TBLPTRL |
641 movlw HIGH (TFT_speed_table-.3) | 584 movlw HIGH (TFT_speed_table-.3) |
642 movwf TBLPTRH | 585 movwf TBLPTRH |
643 movlw UPPER (TFT_speed_table-.3) | 586 movlw UPPER (TFT_speed_table-.3) |
644 movwf TBLPTRU | 587 movwf TBLPTRU |
645 | 588 |
646 TFT_velocity_set_color_skip: | 589 TFT_velocity_set_color_skip: |
647 TBLRD*+ ; 3 dummy reads | 590 TBLRD*+ ; 3 dummy reads |
648 TBLRD*+ | 591 TBLRD*+ |
649 TBLRD*+ | 592 TBLRD*+ |
650 | 593 |
651 TBLRD*+ ; Get speed threshold | 594 TBLRD*+ ; Get speed threshold |
652 movf xC+0,W ; Depth in m | 595 movf xC+0,W ; Depth in m |
653 cpfsgt TABLAT ; Threshold > current depth ? | 596 cpfsgt TABLAT ; Threshold > current depth ? |
654 bra TFT_velocity_set_color_skip ; No | 597 bra TFT_velocity_set_color_skip ; No |
655 | 598 |
656 TBLRD*+ ; Get warning speed threshold | 599 TBLRD*+ ; Get warning speed threshold |
657 movf TABLAT,W | 600 movf TABLAT,W |
658 movwf divA+1 ; Copy for graph routine | 601 movwf divA+1 ; Copy for graph routine |
659 cpfslt divA+0 ; smaller then actual value (in m/min)? | 602 cpfslt divA+0 ; smaller then actual value (in m/min)? |
660 bra TFT_warnings_color ; Set Warning color (And return) | 603 bra TFT_warnings_color ; Set Warning color (And return) |
661 TBLRD*+ ; Get attention speed threshold | 604 TBLRD*+ ; Get attention speed threshold |
662 movf TABLAT,W | 605 movf TABLAT,W |
663 cpfslt divA+0 ; smaller then actual value (in m/min)? | 606 cpfslt divA+0 ; smaller then actual value (in m/min)? |
664 bra TFT_attention_color ; Set Attention color (And return) | 607 bra TFT_attention_color ; Set Attention color (And return) |
665 bra TFT_standard_color ; ...and return | 608 bra TFT_standard_color ; ...and return |
666 | 609 |
674 bra TFT_attention_color ; Set Attention color (And return) | 617 bra TFT_attention_color ; Set Attention color (And return) |
675 bra TFT_standard_color ; ...and return | 618 bra TFT_standard_color ; ...and return |
676 | 619 |
677 TFT_velocity_disp: | 620 TFT_velocity_disp: |
678 WIN_SMALL dm_velocity_text_column, dm_velocity_text_row | 621 WIN_SMALL dm_velocity_text_column, dm_velocity_text_row |
679 TSTOSS opt_units ; 0=Meters, 1=Feets | 622 TSTOSS opt_units ; 0=Meters, 1=Feets |
680 bra TFT_velocity_metric | 623 bra TFT_velocity_metric |
681 ;TFT_velocity_imperial: | 624 ;TFT_velocity_imperial: |
682 movff divA+0,WREG ; divA+0 = m/min | 625 movff divA+0,WREG ; divA+0 = m/min |
683 mullw .100 ; PRODL:PRODH = mbar/min | 626 mullw .100 ; PRODL:PRODH = mbar/min |
684 movff PRODL,lo | 627 movff PRODL,lo |
690 movwf POSTINC2 | 633 movwf POSTINC2 |
691 bsf leftbind | 634 bsf leftbind |
692 output_16 | 635 output_16 |
693 bcf leftbind | 636 bcf leftbind |
694 STRCAT_TEXT_PRINT tVelImperial ; Unit switch | 637 STRCAT_TEXT_PRINT tVelImperial ; Unit switch |
695 return | 638 return |
696 | 639 |
697 TFT_velocity_metric: | 640 TFT_velocity_metric: |
698 movff divA+0,lo ; divA+0 = m/min | 641 movff divA+0,lo ; divA+0 = m/min |
699 movlw '-' | 642 movlw '-' |
700 btfsc neg_flag_velocity | 643 btfsc neg_flag_velocity |
701 movlw '+' | 644 movlw '+' |
702 movwf POSTINC2 | 645 movwf POSTINC2 |
703 output_99 | 646 output_99 |
704 STRCAT_TEXT_PRINT tVelMetric ; Unit switch | 647 STRCAT_TEXT_PRINT tVelMetric ; Unit switch |
705 return | 648 return |
706 | 649 |
707 TFT_velocity_graph: ; divA+0 = m/min | 650 TFT_velocity_graph: ; divA+0 = m/min |
708 ; divA+0 holding the ascend speed in m/min | 651 ; divA+0 holding the ascend speed in m/min |
709 movff divA+0,hi ; Copy | 652 movff divA+0,hi ; Copy |
710 WIN_BOX_BLACK dm_velobar_top, dm_velobar_bot, dm_velobar_lft, dm_velobar_rgt ;top, bottom, left, right -> outer frame | 653 WIN_BOX_BLACK dm_velobar_top, dm_velobar_bot, dm_velobar_lft, dm_velobar_rgt ;top, bottom, left, right -> outer frame |
711 rcall TFT_divemask_color_dive ; Color -> WREG | 654 rcall TFT_divemask_color_dive ; Color -> WREG |
712 WIN_FRAME_COLOR dm_velobar_top, dm_velobar_bot, dm_velobar_lft, dm_velobar_rgt ;inner frame | 655 WIN_FRAME_COLOR dm_velobar_top, dm_velobar_bot, dm_velobar_lft, dm_velobar_rgt ;inner frame |
713 rcall TFT_divemask_color_dive ; Color -> WREG | 656 rcall TFT_divemask_color_dive ; Color -> WREG |
714 WIN_FRAME_COLOR dm_velobar_top+.10, dm_velobar_bot-.10, dm_velobar_lft, dm_velobar_rgt ;inner frame | 657 WIN_FRAME_COLOR dm_velobar_top+.10, dm_velobar_bot-.10, dm_velobar_lft, dm_velobar_rgt ;inner frame |
729 movff xC+0,xB+0 ; Step size | 672 movff xC+0,xB+0 ; Step size |
730 clrf xB+1 | 673 clrf xB+1 |
731 call div16x16 ;xA/xB=xC with xA as remainder | 674 call div16x16 ;xA/xB=xC with xA as remainder |
732 ; xC+0 now holds amount of segments to show | 675 ; xC+0 now holds amount of segments to show |
733 | 676 |
734 movff hi,divA+0 ; Copy back for numeric output | 677 movff hi,divA+0 ; Copy back for numeric output |
735 movlw d'7' | 678 movlw d'7' |
736 cpfslt xC+0 | 679 cpfslt xC+0 |
737 bra DISP_graph_vel_7 | 680 bra DISP_graph_vel_7 |
738 movlw d'6' | 681 movlw d'6' |
739 cpfslt xC+0 | 682 cpfslt xC+0 |
775 WIN_BOX_COLOR dm_velobar_top+.52, dm_velobar_top+.58, dm_velobar_lft+.2, dm_velobar_rgt-.2 ;top, bottom, left, right | 718 WIN_BOX_COLOR dm_velobar_top+.52, dm_velobar_top+.58, dm_velobar_lft+.2, dm_velobar_rgt-.2 ;top, bottom, left, right |
776 DISP_graph_vel_1: | 719 DISP_graph_vel_1: |
777 rcall TFT_standard_color_dive ; Color -> WREG | 720 rcall TFT_standard_color_dive ; Color -> WREG |
778 WIN_BOX_COLOR dm_velobar_top+.62, dm_velobar_top+.68, dm_velobar_lft+.2, dm_velobar_rgt-.2 ;top, bottom, left, right | 721 WIN_BOX_COLOR dm_velobar_top+.62, dm_velobar_top+.68, dm_velobar_lft+.2, dm_velobar_rgt-.2 ;top, bottom, left, right |
779 DISP_graph_vel_0: | 722 DISP_graph_vel_0: |
780 return ; Done. | 723 return ; Done. |
781 | 724 |
782 global TFT_velocity_clear | 725 global TFT_velocity_clear |
783 TFT_velocity_clear: | 726 TFT_velocity_clear: |
784 btfss display_velocity ; Velocity was not displayed, do not delete | 727 btfss display_velocity ; Velocity was not displayed, do not delete |
785 return | 728 return |
799 global TFT_clear_decoarea | 742 global TFT_clear_decoarea |
800 TFT_clear_decoarea: | 743 TFT_clear_decoarea: |
801 WIN_BOX_BLACK dm_decostop_1st_stop_row, .239, dm_decostop_1st_stop_column, .159 ; top, bottom, left, right | 744 WIN_BOX_BLACK dm_decostop_1st_stop_row, .239, dm_decostop_1st_stop_column, .159 ; top, bottom, left, right |
802 return | 745 return |
803 | 746 |
747 | |
804 global TFT_clear_divemode_menu | 748 global TFT_clear_divemode_menu |
805 TFT_clear_divemode_menu: | 749 TFT_clear_divemode_menu: |
806 if dm_offset != 0 | 750 WIN_BOX_BLACK dm_menu_row, dm_menu_lower, dm_menu_left, dm_menu_right ; top, bottom, left, right |
807 WIN_BOX_BLACK dm_menu_row, dm_menu_lower, dm_menu_left, dm_menu_right ; top, bottom, left, right | 751 return |
808 else | 752 |
809 WIN_BOX_BLACK dm_3rdrow_top, dm_3rdrow_bot, dm_3rdrow_lft, dm_3rdrow_rgt ; top, bottom, left, right | |
810 endif | |
811 return | |
812 | 753 |
813 global TFT_display_ndl_mask | 754 global TFT_display_ndl_mask |
814 TFT_display_ndl_mask: | 755 TFT_display_ndl_mask: |
756 bcf FLAG_TFT_display_ndl_mask | |
815 btfsc divemode_menu ; Is the dive mode menu shown? | 757 btfsc divemode_menu ; Is the dive mode menu shown? |
816 return ; Yes, return | 758 return ; Yes, return |
817 rcall TFT_clear_decoarea ; Clear Dekostop and Dekosum | 759 call TFT_clear_decoarea ; Clear Dekostop and Dekosum |
818 if dm_offset != 0 | 760 call TFT_divemask_color |
819 call TFT_divemask_color | 761 WIN_STD dm_ndl_text_column, dm_ndl_text_row |
820 else | |
821 call TFT_attention_color | |
822 endif | |
823 WIN_STD dm_ndl_text_column, dm_ndl_text_row | |
824 STRCPY_TEXT_PRINT tNDL ; NDL | 762 STRCPY_TEXT_PRINT tNDL ; NDL |
825 bra TFT_standard_color ; and return... | 763 bra TFT_standard_color ; and return... |
826 | 764 |
827 global TFT_show_TTS_divemode | 765 |
828 TFT_show_TTS_divemode: | 766 global TFT_display_tts |
767 TFT_display_tts: | |
768 bcf FLAG_TFT_display_tts | |
829 btfsc divemode_menu ; Is the dive mode menu shown? | 769 btfsc divemode_menu ; Is the dive mode menu shown? |
830 return ; Yes, return | 770 return ; Yes, return |
831 call TFT_standard_color | 771 call TFT_standard_color |
832 movff int_O_ascenttime+0,lo ; TTS | 772 movff int_O_ascenttime+0,lo ; TTS |
833 movff int_O_ascenttime+1,hi ; on 16bits | 773 movff int_O_ascenttime+1,hi ; on 16bits |
774 btfss hi,int_invalid_flag ; is the invalid flag set? | |
775 bra TFT_display_tts_1 ; NO | |
776 bcf hi,int_invalid_flag ; YES - clear flag | |
777 call TFT_disabled_color ; switch to disabled color | |
778 TFT_display_tts_1: | |
834 WIN_MEDIUM dm_tts_value_column, dm_tts_value_row | 779 WIN_MEDIUM dm_tts_value_column, dm_tts_value_row |
835 output_16_3 ;Displays only 0...999 | 780 output_16_3 ; Displays only 0...999 |
836 STRCAT_PRINT "'" | 781 STRCAT_PRINT "'" |
837 return | 782 return |
783 | |
838 | 784 |
839 global TFT_display_ndl | 785 global TFT_display_ndl |
840 TFT_display_ndl: | 786 TFT_display_ndl: |
787 bcf FLAG_TFT_display_ndl | |
841 btfsc divemode_menu ; Is the dive mode menu shown? | 788 btfsc divemode_menu ; Is the dive mode menu shown? |
842 return ; Yes, return | 789 return ; Yes, return |
843 WIN_MEDIUM dm_ndl_value_column, dm_ndl_value_row | 790 WIN_MEDIUM dm_ndl_value_column, dm_ndl_value_row |
844 call TFT_standard_color | 791 call TFT_standard_color |
845 movff char_O_nullzeit,lo ; Get NDL from C-code | 792 movff char_O_nullzeit,lo ; Get NDL from C-code |
793 output_8 | |
794 STRCAT_PRINT "'" | |
795 return | |
796 | |
797 | |
798 global TFT_big_deco_alt ; The big deco | |
799 TFT_big_deco_alt: | |
800 bcf FLAG_TFT_big_deco_alt | |
801 | |
802 btfss decostop_active ; deco? | |
803 bra TFT_big_deco_ndl_alt ; NDL | |
804 | |
805 ; Deco | |
806 bcf FLAG_TFT_display_deko | |
807 call TFT_divemask_color | |
808 WIN_STD .70,.165 | |
809 STRCPY_TEXT_PRINT tTTS ; TTS | |
810 rcall TFT_standard_color | |
811 | |
812 ; TTS | |
813 WIN_LARGE .97,.170 | |
814 movff int_O_ascenttime+0,lo ; TTS | |
815 movff int_O_ascenttime+1,hi ; on 16bits | |
816 btfss hi,int_invalid_flag ; is the invalid flag set? | |
817 bra TFT_display_tts_alt_1 ; NO | |
818 bcf hi,int_invalid_flag ; YES - clear flag | |
819 call TFT_disabled_color ; switch to disabled color | |
820 TFT_display_tts_alt_1: | |
821 output_16_3 ; Displays only 0...999 | |
822 STRCAT_PRINT "" | |
823 | |
824 ; 1st Stop | |
825 call TFT_divemask_color | |
826 WIN_STD .25,dm_customview_row | |
827 STRCPY_TEXT_PRINT tDiveSafetyStop ; "Stop" | |
828 | |
829 WIN_LARGE .60,.95 | |
830 TFT_color_code warn_stop ; Color-code Output | |
831 movff char_O_first_deco_depth,lo ; stop depth in m | |
832 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
833 STRCAT_PRINT "" | |
834 | |
835 ; m or ft after the stop depth | |
836 WIN_MEDIUM .100,.118 | |
837 TSTOSS opt_units ; 0=m, 1=ft | |
838 bra TFT_display_tts_alt_1_metric | |
839 STRCAT_TEXT_PRINT tFeets1 | |
840 bra TFT_display_tts_alt_1_com | |
841 TFT_display_tts_alt_1_metric: | |
842 STRCAT_TEXT_PRINT tMeters | |
843 TFT_display_tts_alt_1_com: | |
844 WIN_LARGE .117,.95 | |
845 movff char_O_first_deco_time,lo ; length of first stop in min | |
846 bcf leftbind | |
847 output_99 | |
848 STRCAT_PRINT "" | |
849 goto TFT_standard_color ; and return... | |
850 | |
851 TFT_big_deco_ndl_alt: | |
852 ; NDL | |
853 bcf FLAG_TFT_display_ndl | |
854 bcf decostop_active ; clear flag (again) | |
855 call TFT_divemask_color | |
856 WIN_STD .70,.165 | |
857 STRCPY_TEXT_PRINT tNDL ; NDL | |
858 call TFT_standard_color | |
859 WIN_LARGE .97,.170 | |
860 call TFT_standard_color | |
861 movff char_O_nullzeit,lo ; Get NDL from C-code | |
862 output_8 | |
863 STRCAT_PRINT "" | |
864 | |
865 btfsc FLAG_TFT_show_safety_stop | |
866 bra TFT_show_safety_stop_alt ; Show safety stop (And return) | |
867 ; Clear any safety stop or Decostop | |
868 TFT_no_more_safety_stop_alt: | |
869 WIN_BOX_BLACK dm_customview_row, .150, .0, .159 ; top, bottom, left, right | |
870 WIN_BOX_BLACK dm_customview_row, .164, .60, .159 ; top, bottom, left, right | |
871 return | |
872 | |
873 TFT_show_safety_stop_alt: | |
874 bcf FLAG_TFT_show_safety_stop | |
875 tstfsz safety_stop_countdown ; Countdown at zero? | |
876 bra TFT_show_safety_stop_alt2 ; No, show stop | |
877 bcf show_safety_stop ; Clear flag | |
878 btfss safety_stop_active ; Displayed? | |
879 return ; No | |
880 bcf safety_stop_active ; Clear flag | |
881 bra TFT_no_more_safety_stop_alt ; Yes, Clear stop ; and return... | |
882 | |
883 TFT_show_safety_stop_alt2: | |
884 bsf safety_stop_active ; Set flag | |
885 decf safety_stop_countdown,F ; Reduce countdown | |
886 | |
887 call TFT_divemask_color | |
888 WIN_STD .50,dm_customview_row | |
889 STRCPY_TEXT_PRINT tDiveSafetyStop | |
890 call TFT_attention_color ; show in yellow | |
891 WIN_LARGE .90,.95 | |
892 movff safety_stop_countdown,lo | |
893 clrf hi | |
894 call convert_time ; converts hi:lo in seconds to mins (hi) and seconds (lo) | |
895 movf hi,W | |
896 movff lo,hi | |
897 movwf lo ; exchange lo and hi | |
898 bsf leftbind | |
846 output_8 | 899 output_8 |
847 STRCAT_PRINT "'" | 900 STRCAT_PRINT "" |
848 return | 901 WIN_MEDIUM .112,.120 |
902 STRCAT_PRINT ":" | |
903 WIN_LARGE .117,.95 | |
904 bcf leftbind | |
905 movff hi,lo | |
906 output_99x | |
907 STRCAT_PRINT "" | |
908 WIN_FONT FT_SMALL | |
909 goto TFT_standard_color ; and return... | |
910 | |
849 | 911 |
850 global TFT_divemode_warning | 912 global TFT_divemode_warning |
851 TFT_divemode_warning: | 913 TFT_divemode_warning: |
852 bsf dive_warning_displayed ; =1: The warning sign is shown | 914 bcf FLAG_TFT_divemode_warning |
853 WIN_TOP dm_warning_icon_row | 915 bsf dive_warning_displayed ; =1: The warning sign is shown |
854 WIN_LEFT dm_warning_icon_column | 916 WIN_TOP dm_warning_icon_row |
855 TFT_WRITE_PROM_IMAGE dive_warning2_block ; Show Warning icon | 917 WIN_LEFT dm_warning_icon_column |
856 return | 918 TFT_WRITE_PROM_IMAGE dive_warning2_block ; Show Warning icon |
919 return | |
857 | 920 |
858 global TFT_divemode_warning_clear | 921 global TFT_divemode_warning_clear |
859 TFT_divemode_warning_clear: | 922 TFT_divemode_warning_clear: |
860 btfss dive_warning_displayed ; =1: The warning sign is shown | 923 bcf FLAG_TFT_divemode_warning_clear |
861 return | 924 btfss dive_warning_displayed ; =1: The warning sign is shown |
862 bcf dive_warning_displayed ; clear only once | 925 return |
863 WIN_BOX_BLACK dm_warning_icon_row, dm_warning_icon_bot, dm_warning_icon_column, dm_warning_icon_rgt ; top, bottom, left, right | 926 bcf dive_warning_displayed ; clear only once |
864 return | 927 WIN_BOX_BLACK dm_warning_icon_row, dm_warning_icon_bot, dm_warning_icon_column, dm_warning_icon_rgt ; top, bottom, left, right |
928 return | |
929 | |
865 | 930 |
866 global TFT_display_deko_mask | 931 global TFT_display_deko_mask |
867 TFT_display_deko_mask: | 932 TFT_display_deko_mask: |
868 btfsc divemode_menu ; Is the dive mode menu shown? | 933 bcf FLAG_TFT_display_deko_mask |
869 return ; Yes, return | 934 btfsc divemode_menu ; Is the dive mode menu shown? |
870 | 935 return ; Yes, return |
871 rcall TFT_clear_decoarea | 936 rcall TFT_clear_decoarea ; Clear Dekostop and Dekosum (and NDL in this case) |
872 WIN_STD dm_tts_text_column, dm_tts_text_row | 937 WIN_STD dm_tts_text_column, dm_tts_text_row |
873 if dm_offset != 0 | 938 call TFT_divemask_color |
874 call TFT_divemask_color | 939 STRCPY_TEXT_PRINT tTTS ; TTS |
875 else | 940 call TFT_standard_color |
876 call TFT_attention_color | 941 bcf show_safety_stop ; Clear safety stop flag |
877 endif | |
878 STRCPY_TEXT_PRINT tTTS ; TTS | |
879 call TFT_standard_color | |
880 bcf show_safety_stop ; Clear safety stop flag | |
881 return | 942 return |
882 | 943 |
883 TFT_display_deko_output_depth: ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | 944 |
945 TFT_display_deko_output_depth: ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (for ft) | |
884 TSTOSS opt_units ; 0=m, 1=ft | 946 TSTOSS opt_units ; 0=m, 1=ft |
885 bra TFT_display_deko_output_metric | 947 bra TFT_display_deko_output_metric |
886 ;TFT_display_deko_output_imperial: | 948 ;TFT_display_deko_output_imperial: |
887 movf lo,W ; lo = m | 949 movf lo,W ; lo = m |
888 mullw .100 ; PRODL:PRODH = mbar | 950 mullw .100 ; PRODL:PRODH = mbar |
889 movff PRODL,lo | 951 movff PRODL,lo |
890 movff PRODH,hi | 952 movff PRODH,hi |
907 clrf xB+1 | 969 clrf xB+1 |
908 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | 970 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder |
909 movff xC+0,lo | 971 movff xC+0,lo |
910 movff xC+1,hi ; restore lo and hi with updated value | 972 movff xC+1,hi ; restore lo and hi with updated value |
911 bcf leftbind | 973 bcf leftbind |
974 btfsc alternative_divelayout | |
975 bsf leftbind ; left for alternative layout mode | |
912 bsf ignore_digit4 ; Only full feet | 976 bsf ignore_digit4 ; Only full feet |
913 output_16 | 977 output_16 |
978 btfsc alternative_divelayout | |
979 return ; Not for alternative layout mode | |
914 STRCAT_TEXT tFeets1 | 980 STRCAT_TEXT tFeets1 |
915 return | 981 return |
916 | 982 |
917 TFT_display_deko_output_metric: | 983 TFT_display_deko_output_metric: |
918 output_99 | 984 output_99 |
985 btfsc alternative_divelayout | |
986 return ; Not for alternative layout mode | |
919 STRCAT_TEXT tMeters | 987 STRCAT_TEXT tMeters |
920 PUTC ' ' | 988 PUTC ' ' |
921 return | 989 return |
922 | 990 |
991 | |
923 global TFT_display_deko | 992 global TFT_display_deko |
924 TFT_display_deko: | 993 TFT_display_deko: |
994 bcf FLAG_TFT_display_deko | |
925 btfsc divemode_menu ; Is the dive mode menu shown? | 995 btfsc divemode_menu ; Is the dive mode menu shown? |
926 return ; Yes, return | 996 return ; Yes, return |
927 WIN_MEDIUM dm_decostop_1st_stop_column, dm_decostop_1st_stop_row | 997 WIN_MEDIUM dm_decostop_1st_stop_column, dm_decostop_1st_stop_row |
928 TFT_color_code warn_ceiling ; Color-code Output | 998 TFT_color_code warn_stop ; Color-code Output |
929 movff char_O_first_deco_depth,lo ; Ceiling in m | 999 movff char_O_first_deco_depth,lo ; stop depth in m |
930 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | 1000 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) |
931 movff char_O_first_deco_time,lo ; length of first stop in min | 1001 movff char_O_first_deco_time,lo ; length of first stop in min |
932 output_99 | 1002 output_99 |
933 STRCAT_PRINT "'" | 1003 STRCAT_PRINT "'" |
934 goto TFT_standard_color ; and return... | 1004 goto TFT_standard_color ; and return... |
1005 | |
935 | 1006 |
936 global TFT_decoplan | 1007 global TFT_decoplan |
937 TFT_decoplan: | 1008 TFT_decoplan: |
938 call TFT_divemask_color | 1009 call TFT_divemask_color |
939 WIN_TINY dm_custom_decoplan_title_column, dm_custom_decoplan_title_row | 1010 WIN_TINY dm_custom_decoplan_title_column, dm_custom_decoplan_title_row |
940 STRCPY_TEXT_PRINT tDiveDecoplan | 1011 STRCPY_TEXT_PRINT tDiveDecoplan |
941 call TFT_standard_color | 1012 call TFT_standard_color |
942 | |
943 movff char_O_deco_depth+1,lo | 1013 movff char_O_deco_depth+1,lo |
944 tstfsz lo ; Show another stop? | 1014 tstfsz lo ; Show another stop? |
945 bra TFT_display_deko2 ; Yes | 1015 bra TFT_display_deko2 ; Yes |
946 ; No, clear output and return | 1016 ; No, clear output and return |
947 call TFT_standard_color | 1017 call TFT_standard_color |
948 WIN_SMALL dm_cust_dstop_4th_stop_column,dm_cust_dstop_4th_stop_row | 1018 WIN_SMALL dm_cust_dstop_4th_stop_column,dm_cust_dstop_4th_stop_row |
949 STRCPY_PRINT " --- " | 1019 STRCPY_PRINT " --- " |
950 WIN_BOX_BLACK dm_cust_dstop_2nd_stop_row, dm_customview_bot-.1, dm_cust_dstop_2nd_stop_column, dm_cust_dstop_4th_stop_column ; top, bottom, left, right | 1020 WIN_BOX_BLACK dm_cust_dstop_2nd_stop_row, dm_customview_bot-.2, dm_cust_dstop_2nd_stop_column, dm_cust_dstop_4th_stop_column ; top, bottom, left, right |
951 WIN_BOX_BLACK dm_cust_dstop_5th_stop_row, dm_customview_bot, dm_cust_dstop_5th_stop_column, dm_cust_dstop_6th_stop_column ; top, bottom, left, right | 1021 WIN_BOX_BLACK dm_cust_dstop_5th_stop_row, dm_customview_bot, dm_cust_dstop_5th_stop_column, dm_cust_dstop_6th_stop_column ; top, bottom, left, right |
952 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right | 1022 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right |
953 return | 1023 goto TFT_standard_color ; and return... |
1024 | |
954 TFT_display_deko2: | 1025 TFT_display_deko2: |
1026 movff char_O_deco_gas+0,lo ; get flag for invalid deco data | |
1027 btfsc lo,char_invalid_flag ; is the invalid flag set? | |
1028 call TFT_disabled_color ; YES - set to disabled color | |
955 WIN_SMALL dm_cust_dstop_2nd_stop_column, dm_cust_dstop_2nd_stop_row | 1029 WIN_SMALL dm_cust_dstop_2nd_stop_column, dm_cust_dstop_2nd_stop_row |
956 movff char_O_deco_depth+1,lo ; stop in m | 1030 movff char_O_deco_depth+1,lo ; stop in m |
957 bcf lo,7 ; Clear GAS_SWITCH bit | 1031 bcf lo,7 ; Clear GAS_SWITCH bit |
958 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | 1032 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) |
959 movff char_O_deco_time+1,lo ; length of stop in min | 1033 movff char_O_deco_time+1,lo ; length of stop in min |
961 STRCAT_PRINT "'" | 1035 STRCAT_PRINT "'" |
962 movff char_O_deco_depth+2,lo | 1036 movff char_O_deco_depth+2,lo |
963 tstfsz lo ; Show another stop? | 1037 tstfsz lo ; Show another stop? |
964 bra TFT_display_deko3 ; Yes | 1038 bra TFT_display_deko3 ; Yes |
965 ; No, clear output and return | 1039 ; No, clear output and return |
966 WIN_BOX_BLACK dm_cust_dstop_3rd_stop_row, dm_customview_bot-.1, dm_cust_dstop_2nd_stop_column, dm_cust_dstop_4th_stop_column ; top, bottom, left, right | 1040 WIN_BOX_BLACK dm_cust_dstop_3rd_stop_row, dm_customview_bot-.2, dm_cust_dstop_2nd_stop_column, dm_cust_dstop_4th_stop_column ; top, bottom, left, right |
967 WIN_BOX_BLACK dm_cust_dstop_4th_stop_row, dm_customview_bot, dm_cust_dstop_4th_stop_column, .159 ; top, bottom, left, right | 1041 WIN_BOX_BLACK dm_cust_dstop_4th_stop_row, dm_customview_bot, dm_cust_dstop_4th_stop_column, .159 ; top, bottom, left, right |
968 return | 1042 goto TFT_standard_color ; and return... |
969 | 1043 |
970 TFT_display_deko3: | 1044 TFT_display_deko3: |
971 WIN_SMALL dm_cust_dstop_3rd_stop_column, dm_cust_dstop_3rd_stop_row | 1045 WIN_SMALL dm_cust_dstop_3rd_stop_column, dm_cust_dstop_3rd_stop_row |
972 movff char_O_deco_depth+2,lo ; stop in m | 1046 movff char_O_deco_depth+2,lo ; stop in m |
973 bcf lo,7 ; Clear GAS_SWITCH bit | 1047 bcf lo,7 ; Clear GAS_SWITCH bit |
974 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | 1048 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) |
975 movff char_O_deco_time+2,lo ; length of stop in min | 1049 movff char_O_deco_time+2,lo ; length of stop in min |
976 output_99 | 1050 output_99 |
977 STRCAT_PRINT "'" | 1051 STRCAT_PRINT "'" |
978 | |
979 movff char_O_deco_depth+3,lo | 1052 movff char_O_deco_depth+3,lo |
980 tstfsz lo ; Show another stop? | 1053 tstfsz lo ; Show another stop? |
981 bra TFT_display_deko4 ; Yes | 1054 bra TFT_display_deko4 ; Yes |
982 ; No, clear output and return | 1055 ; No, clear output and return |
983 WIN_BOX_BLACK dm_cust_dstop_4th_stop_row, dm_customview_bot, dm_cust_dstop_4th_stop_column, .159 ; top, bottom, left, right | 1056 WIN_BOX_BLACK dm_cust_dstop_4th_stop_row, dm_customview_bot, dm_cust_dstop_4th_stop_column, .159 ; top, bottom, left, right |
984 return ; Done. | 1057 goto TFT_standard_color ; and return... |
985 | 1058 |
986 TFT_display_deko4: | 1059 TFT_display_deko4: |
987 WIN_SMALL dm_cust_dstop_4th_stop_column, dm_cust_dstop_4th_stop_row | 1060 WIN_SMALL dm_cust_dstop_4th_stop_column, dm_cust_dstop_4th_stop_row |
988 movff char_O_deco_depth+3,lo ; stop in m | 1061 movff char_O_deco_depth+3,lo ; stop in m |
989 bcf lo,7 ; Clear GAS_SWITCH bit | 1062 bcf lo,7 ; Clear GAS_SWITCH bit |
996 tstfsz lo ; Show another stop? | 1069 tstfsz lo ; Show another stop? |
997 bra TFT_display_deko5 ; Yes | 1070 bra TFT_display_deko5 ; Yes |
998 ; No, clear output and return | 1071 ; No, clear output and return |
999 WIN_BOX_BLACK dm_cust_dstop_5th_stop_row, dm_customview_bot, dm_cust_dstop_5th_stop_column, dm_cust_dstop_6th_stop_column ; top, bottom, left, right | 1072 WIN_BOX_BLACK dm_cust_dstop_5th_stop_row, dm_customview_bot, dm_cust_dstop_5th_stop_column, dm_cust_dstop_6th_stop_column ; top, bottom, left, right |
1000 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right | 1073 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right |
1001 return ; Done. | 1074 goto TFT_standard_color ; and return... |
1002 | 1075 |
1003 TFT_display_deko5: | 1076 TFT_display_deko5: |
1004 WIN_SMALL dm_cust_dstop_5th_stop_column, dm_cust_dstop_5th_stop_row | 1077 WIN_SMALL dm_cust_dstop_5th_stop_column, dm_cust_dstop_5th_stop_row |
1005 movff char_O_deco_depth+4,lo ; stop in m | 1078 movff char_O_deco_depth+4,lo ; stop in m |
1006 bcf lo,7 ; Clear GAS_SWITCH bit | 1079 bcf lo,7 ; Clear GAS_SWITCH bit |
1011 movff char_O_deco_depth+5,lo | 1084 movff char_O_deco_depth+5,lo |
1012 tstfsz lo ; Show another stop? | 1085 tstfsz lo ; Show another stop? |
1013 bra TFT_display_deko6 ; Yes | 1086 bra TFT_display_deko6 ; Yes |
1014 ; No, clear output and return | 1087 ; No, clear output and return |
1015 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right | 1088 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right |
1016 return ; Done. | 1089 goto TFT_standard_color ; and return... |
1090 | |
1017 TFT_display_deko6: | 1091 TFT_display_deko6: |
1018 WIN_SMALL dm_cust_dstop_6th_stop_column, dm_cust_dstop_6th_stop_row | 1092 WIN_SMALL dm_cust_dstop_6th_stop_column, dm_cust_dstop_6th_stop_row |
1019 movff char_O_deco_depth+5,lo ; stop in m | 1093 movff char_O_deco_depth+5,lo ; stop in m |
1020 bcf lo,7 ; Clear GAS_SWITCH bit | 1094 bcf lo,7 ; Clear GAS_SWITCH bit |
1021 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | 1095 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) |
1025 movff char_O_deco_depth+6,lo | 1099 movff char_O_deco_depth+6,lo |
1026 tstfsz lo ; Show another stop? | 1100 tstfsz lo ; Show another stop? |
1027 bra TFT_display_deko7 ; Yes | 1101 bra TFT_display_deko7 ; Yes |
1028 ; No, clear output and return | 1102 ; No, clear output and return |
1029 WIN_BOX_BLACK dm_cust_dstop_7th_stop_row, dm_customview_bot, dm_cust_dstop_7th_stop_column, .159 ; top, bottom, left, right | 1103 WIN_BOX_BLACK dm_cust_dstop_7th_stop_row, dm_customview_bot, dm_cust_dstop_7th_stop_column, .159 ; top, bottom, left, right |
1030 return ; Done. | 1104 goto TFT_standard_color ; and return... |
1105 | |
1031 TFT_display_deko7: | 1106 TFT_display_deko7: |
1032 WIN_SMALL dm_cust_dstop_7th_stop_column, dm_cust_dstop_7th_stop_row | 1107 WIN_SMALL dm_cust_dstop_7th_stop_column, dm_cust_dstop_7th_stop_row |
1033 movff char_O_deco_depth+6,lo ; stop in m | 1108 movff char_O_deco_depth+6,lo ; stop in m |
1034 bcf lo,7 ; Clear GAS_SWITCH bit | 1109 bcf lo,7 ; Clear GAS_SWITCH bit |
1035 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | 1110 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) |
1036 movff char_O_deco_time+6,lo ; length of stop in min | 1111 movff char_O_deco_time+6,lo ; length of stop in min |
1037 output_99 | 1112 output_99 |
1038 STRCAT_PRINT "'" | 1113 STRCAT_PRINT "'" |
1039 return ; Done. | 1114 goto TFT_standard_color ; and return... |
1040 | 1115 |
1041 ;TFT_display_deko1: | |
1042 ; movff char_O_gradient_factor,lo ; gradient factor | |
1043 ; movlw gf_display_threshold ; threshold for display | |
1044 ; cpfslt lo ; show value? | |
1045 ; bra TFT_display_deko2 ; Yes | |
1046 ; ; No | |
1047 ; bra TFT_display_ndl_mask2 ; Clear gradient factor | |
1048 ; | |
1049 | 1116 |
1050 global TFT_clear_safety_stop | 1117 global TFT_clear_safety_stop |
1051 TFT_clear_safety_stop: | 1118 TFT_clear_safety_stop: |
1119 bcf FLAG_TFT_clear_safety_stop ; clear flag | |
1052 WIN_BOX_BLACK dm_safetystop_row, dm_safetystop_bot, dm_safetystop_text_column, .159 ; top, bottom, left, right | 1120 WIN_BOX_BLACK dm_safetystop_row, dm_safetystop_bot, dm_safetystop_text_column, .159 ; top, bottom, left, right |
1053 return | 1121 return |
1054 | 1122 |
1055 global TFT_show_safety_stop | 1123 global TFT_show_safety_stop |
1056 TFT_show_safety_stop: | 1124 TFT_show_safety_stop: |
1125 bcf FLAG_TFT_show_safety_stop | |
1057 tstfsz safety_stop_countdown ; Countdown at zero? | 1126 tstfsz safety_stop_countdown ; Countdown at zero? |
1058 bra TFT_show_safety_stop2 ; No, show stop | 1127 bra TFT_show_safety_stop2 ; No, show stop |
1059 | |
1060 bcf show_safety_stop ; Clear flag | 1128 bcf show_safety_stop ; Clear flag |
1061 | |
1062 btfss safety_stop_active ; Displayed? | 1129 btfss safety_stop_active ; Displayed? |
1063 return ; No | 1130 return ; No |
1064 bcf safety_stop_active ; Clear flag | 1131 bcf safety_stop_active ; Clear flag |
1065 btfsc divemode_menu ; Is the dive mode menu shown? | 1132 btfsc divemode_menu ; Is the dive mode menu shown? |
1066 return ; Yes, return | 1133 return ; Yes, return |
1067 bra TFT_clear_safety_stop ; Yes, Clear stop ; and return... | 1134 bra TFT_clear_safety_stop ; Yes, Clear stop ; and return... |
1068 | |
1069 TFT_show_safety_stop2: | 1135 TFT_show_safety_stop2: |
1070 bsf safety_stop_active ; Set flag | 1136 bsf safety_stop_active ; Set flag |
1071 decf safety_stop_countdown,F ; Reduce countdown | 1137 decf safety_stop_countdown,F ; Reduce countdown |
1072 | |
1073 btfsc divemode_menu ; Is the dive mode menu shown? | 1138 btfsc divemode_menu ; Is the dive mode menu shown? |
1074 return ; Yes, return | 1139 return ; Yes, return |
1075 ;btfsc menuview | 1140 ;btfsc menuview |
1076 ;bra TFT_show_safety_stop3 ; No room when menuview=1... | 1141 ;bra TFT_show_safety_stop3 ; No room when menuview=1... |
1077 if dm_offset != 0 | 1142 call TFT_divemask_color |
1078 call TFT_divemask_color | |
1079 else | |
1080 call TFT_standard_color | |
1081 endif | |
1082 WIN_STD dm_safetystop_text_column, dm_safetystop_text_row | 1143 WIN_STD dm_safetystop_text_column, dm_safetystop_text_row |
1083 STRCPY_TEXT_PRINT tDiveSafetyStop | 1144 STRCPY_TEXT_PRINT tDiveSafetyStop |
1084 TFT_show_safety_stop3: | 1145 TFT_show_safety_stop3: |
1085 call TFT_attention_color ; show in yellow | 1146 call TFT_attention_color ; show in yellow |
1086 WIN_MEDIUM dm_safetystop_column, dm_safetystop_row | 1147 WIN_MEDIUM dm_safetystop_column, dm_safetystop_row |
1087 lfsr FSR2,buffer | |
1088 movff safety_stop_countdown,lo | 1148 movff safety_stop_countdown,lo |
1089 clrf hi | 1149 clrf hi |
1090 call convert_time ; converts hi:lo in seconds to mins (hi) and seconds (lo) | 1150 call convert_time ; converts hi:lo in seconds to mins (hi) and seconds (lo) |
1091 movf hi,W | 1151 movf hi,W |
1092 movff lo,hi | 1152 movff lo,hi |
1097 PUTC ':' | 1157 PUTC ':' |
1098 movff hi,lo | 1158 movff hi,lo |
1099 output_99x | 1159 output_99x |
1100 STRCAT_PRINT "" | 1160 STRCAT_PRINT "" |
1101 WIN_FONT FT_SMALL | 1161 WIN_FONT FT_SMALL |
1102 goto TFT_standard_color; and return... | 1162 goto TFT_standard_color ; and return... |
1103 | 1163 |
1104 global TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch | 1164 |
1165 global TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch | |
1105 TFT_mask_avr_stopwatch: | 1166 TFT_mask_avr_stopwatch: |
1106 ; The mask | 1167 ; The mask |
1107 call TFT_divemask_color | 1168 call TFT_divemask_color |
1108 WIN_TINY dm_custom_avr_stop_title_column1,dm_custom_avr_stop_title_row | 1169 WIN_TINY dm_custom_avr_stop_title_column1,dm_custom_avr_stop_title_row |
1109 STRCPY_TEXT_PRINT tDiveTotalAvg | 1170 STRCPY_TEXT_PRINT tDiveTotalAvg |
1110 WIN_TINY dm_custom_avr_stop_title_column2,dm_custom_avr_stop_title_row | 1171 WIN_TINY dm_custom_avr_stop_title_column2,dm_custom_avr_stop_title_row |
1111 STRCPY_TEXT_PRINT tDiveStopwatch | 1172 STRCPY_TEXT_PRINT tDiveStopwatch |
1112 WIN_TINY dm_custom_avr_stop_title_column3,dm_custom_avr_stop_title_row | 1173 WIN_TINY dm_custom_avr_stop_title_column3,dm_custom_avr_stop_title_row |
1113 STRCPY_TEXT_PRINT tDiveStopAvg | 1174 STRCPY_TEXT_PRINT tDiveStopAvg |
1114 goto TFT_standard_color ; and return... | 1175 goto TFT_standard_color ; and return... |
1115 | 1176 |
1116 global TFT_dyn_gaslist | 1177 global TFT_update_avr_stopwatch ; Update average depth and stopwatch |
1117 TFT_dyn_gaslist: ; Show the dynamic gaslist | |
1118 ; The mask | |
1119 call TFT_divemask_color | |
1120 WIN_TINY dm_custom_dyn_gas_mask_column,dm_custom_dyn_gas_mask_row | |
1121 STRCPY_TEXT_PRINT tGaslist | |
1122 ; call TFT_standard_color | |
1123 | |
1124 WIN_SMALL dm_custom_dyn_gas_column1,dm_custom_dyn_gas_row1 | |
1125 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
1126 clrf uart1_temp | |
1127 rcall TFT_dyn_gaslist_common | |
1128 WIN_SMALL dm_custom_dyn_gas_column1,dm_custom_dyn_gas_row2 | |
1129 rcall TFT_dyn_gaslist_common | |
1130 WIN_SMALL dm_custom_dyn_gas_column2,dm_custom_dyn_gas_row1 | |
1131 rcall TFT_dyn_gaslist_common | |
1132 WIN_SMALL dm_custom_dyn_gas_column2,dm_custom_dyn_gas_row2 | |
1133 rcall TFT_dyn_gaslist_common | |
1134 goto TFT_standard_color ; and return... | |
1135 | |
1136 TFT_dyn_gaslist_common: | |
1137 incf uart1_temp,F ; +1 | |
1138 movf uart1_temp,W ; into W | |
1139 cpfseq active_gas ;1-5 | |
1140 bra TFT_dyn_gaslist_common2 | |
1141 incf uart1_temp,F ; +1 | |
1142 TFT_dyn_gaslist_common2: | |
1143 movff uart1_temp,lo ; gas number 1-5 | |
1144 movff uart1_temp,PRODL | |
1145 decf PRODL,F ;-1 to have 0-4 | |
1146 bsf leftbind | |
1147 output_8 ; Gas number | |
1148 bcf leftbind | |
1149 PUTC ":" | |
1150 bcf ccr_diluent_setup | |
1151 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
1152 PUTC " " ; Clearing space | |
1153 movlw 0x00 | |
1154 movff WREG,buffer+.11 ; limit to 11 chars | |
1155 STRCAT_PRINT "" | |
1156 bcf win_invert | |
1157 return | |
1158 | |
1159 | |
1160 global TFT_update_avr_stopwatch ; Update average depth and stopwatch | |
1161 TFT_update_avr_stopwatch: | 1178 TFT_update_avr_stopwatch: |
1162 call TFT_standard_color | 1179 call TFT_standard_color |
1163 SAFE_2BYTE_COPY average_divesecs,lo | 1180 SAFE_2BYTE_COPY average_divesecs,lo |
1164 call convert_time ; lo=secs, hi=mins | 1181 call convert_time ; lo=secs, hi=mins |
1165 WIN_MEDIUM dm_custom_avr_stop_column2,dm_custom_avr_stop_row | 1182 WIN_MEDIUM dm_custom_avr_stop_column2,dm_custom_avr_stop_row |
1166 bsf leftbind | 1183 bsf leftbind |
1167 movf hi,W | 1184 movf hi,W |
1168 movff lo,hi | 1185 movff lo,hi |
1169 movwf lo ; exchange lo and hi | 1186 movwf lo ; exchange lo and hi |
1170 output_8 | 1187 output_8 |
1171 PUTC ':' | 1188 PUTC ':' |
1172 movff hi,lo | 1189 movff hi,lo |
1173 output_99x | 1190 output_99x |
1174 movlw .5 | 1191 movlw .5 |
1175 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | 1192 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
1176 clrf WREG | 1193 clrf WREG |
1177 movff WREG,buffer+.5 ; limit to 5 chars | 1194 movff WREG,buffer+.5 ; limit to 5 chars |
1178 STRCAT_PRINT "" | 1195 STRCAT_PRINT "" |
1179 | 1196 |
1180 TSTOSS opt_units ; 0=m, 1=ft | 1197 TSTOSS opt_units ; 0=m, 1=ft |
1181 bra TFT_update_avr_stopwatch_metric | 1198 bra TFT_update_avr_stopwatch_metric |
1182 ;TFT_update_avr_stopwatch_imperial | 1199 ;TFT_update_avr_stopwatch_imperial |
1183 movff avg_rel_pressure_total+0,lo | 1200 movff avg_rel_pressure_total+0,lo |
1184 movff avg_rel_pressure_total+1,hi | 1201 movff avg_rel_pressure_total+1,hi |
1185 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 1202 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
1186 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | 1203 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
1187 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row | 1204 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row |
1188 bsf leftbind | 1205 bsf leftbind |
1189 output_16 ; yxz | 1206 output_16 ; yxz |
1190 STRCAT_PRINT " " | 1207 STRCAT_PRINT " " |
1191 ; Stopped average depth | 1208 ; Stopped average depth |
1192 movff avg_rel_pressure+0,lo | 1209 movff avg_rel_pressure+0,lo |
1193 movff avg_rel_pressure+1,hi | 1210 movff avg_rel_pressure+1,hi |
1194 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 1211 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
1195 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | 1212 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
1196 WIN_MEDIUM dm_custom_avr_stop_column3,dm_custom_avr_stop_row | 1213 WIN_MEDIUM dm_custom_avr_stop_column3,dm_custom_avr_stop_row |
1197 output_16 ; yxz | 1214 output_16 ; yxz |
1198 bcf leftbind | 1215 bcf leftbind |
1199 PUTC " " | 1216 PUTC " " |
1200 clrf WREG | 1217 clrf WREG |
1201 movff WREG,buffer+.3 ; limit string length to 3 | 1218 movff WREG,buffer+.3 ; limit string length to 3 |
1202 STRCAT_PRINT "" | 1219 STRCAT_PRINT "" |
1203 return | 1220 return |
1204 | 1221 |
1205 TFT_update_avr_stopwatch_metric: | 1222 TFT_update_avr_stopwatch_metric: |
1206 ; Non-resettable average depth | 1223 ; Non-resettable average depth |
1207 movff avg_rel_pressure_total+0,lo | 1224 movff avg_rel_pressure_total+0,lo |
1208 movff avg_rel_pressure_total+1,hi | 1225 movff avg_rel_pressure_total+1,hi |
1209 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 1226 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
1210 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row | 1227 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row |
1211 bsf ignore_digit5 ; no cm | 1228 bsf ignore_digit5 ; no cm |
1212 output_16dp .3 ; yxz.a | 1229 output_16dp .3 ; yxz.a |
1213 STRCAT_PRINT " " | 1230 STRCAT_PRINT " " |
1214 ; Stopped average depth | 1231 ; Stopped average depth |
1215 movff avg_rel_pressure+0,lo | 1232 movff avg_rel_pressure+0,lo |
1216 movff avg_rel_pressure+1,hi | 1233 movff avg_rel_pressure+1,hi |
1217 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 1234 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
1218 WIN_MEDIUM dm_custom_avr_stop_column3,dm_custom_avr_stop_row | 1235 WIN_MEDIUM dm_custom_avr_stop_column3,dm_custom_avr_stop_row |
1219 bsf ignore_digit5 ; no cm | 1236 bsf ignore_digit5 ; no cm |
1220 output_16dp .3 ; yxz.a | 1237 output_16dp .3 ; yxz.a |
1221 bcf leftbind | 1238 bcf leftbind |
1222 bcf ignore_digit5 | 1239 bcf ignore_digit5 |
1223 clrf WREG | 1240 clrf WREG |
1224 movff WREG,buffer+.4 ; limit string length to 4 | 1241 movff WREG,buffer+.4 ; limit string length to 4 |
1225 STRCAT_PRINT "" | 1242 STRCAT_PRINT "" |
1226 return | 1243 return |
1227 | 1244 |
1228 global TFT_ceiling_mask ; The ceiling mask | 1245 |
1246 global TFT_ceiling_mask ; The ceiling mask | |
1229 TFT_ceiling_mask: | 1247 TFT_ceiling_mask: |
1230 call TFT_divemask_color | 1248 call TFT_divemask_color |
1231 WIN_TINY dm_custom_ceiling_text_column,dm_custom_ceiling_text_row | 1249 WIN_TINY dm_custom_ceiling_text_column,dm_custom_ceiling_text_row |
1232 STRCPY_TEXT_PRINT tCeiling | 1250 STRCPY_TEXT_PRINT tCeiling |
1233 goto TFT_standard_color ; and return... | 1251 goto TFT_standard_color ; and return... |
1234 | 1252 |
1235 global TFT_ceiling ; Ceiling | 1253 global TFT_ceiling ; Ceiling |
1236 TFT_ceiling: | 1254 TFT_ceiling: |
1237 call TFT_standard_color | |
1238 WIN_MEDIUM dm_custom_ceiling_value_column,dm_custom_ceiling_value_row | 1255 WIN_MEDIUM dm_custom_ceiling_value_column,dm_custom_ceiling_value_row |
1239 movff int_O_ceiling+0,lo | 1256 movff int_O_ceiling+0,lo |
1240 movff int_O_ceiling+1,hi | 1257 movff int_O_ceiling+1,hi |
1241 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 1258 TFT_color_code warn_ceiling ; color-code the output |
1259 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
1242 bsf leftbind | 1260 bsf leftbind |
1243 TSTOSS opt_units ; 0=m, 1=ft | 1261 TSTOSS opt_units ; 0=m, 1=ft |
1244 bra TFT_ceiling_metric | 1262 bra TFT_ceiling_metric |
1245 ;TFT_ceiling_imperial | 1263 ;TFT_ceiling_imperial |
1246 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | 1264 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
1247 output_16 ; yxz | 1265 output_16 ; yxz |
1248 bcf leftbind | 1266 bcf leftbind |
1249 STRCAT_PRINT " " | 1267 STRCAT_PRINT " " |
1250 return | 1268 goto TFT_standard_color |
1251 | 1269 |
1252 TFT_ceiling_metric: | 1270 TFT_ceiling_metric: |
1253 bsf ignore_digit5 ; no cm | 1271 bsf ignore_digit5 ; no cm |
1254 output_16dp .3 ; yxz.a | 1272 output_16dp .3 ; yxz.a |
1255 bcf leftbind | 1273 bcf leftbind |
1256 bcf ignore_digit5 | 1274 bcf ignore_digit5 |
1257 STRCAT_PRINT " " | 1275 STRCAT_PRINT " " |
1258 return | 1276 goto TFT_standard_color |
1259 | 1277 |
1260 global TFT_hud_mask ; The HUD mask | 1278 |
1279 global TFT_CNS_mask | |
1280 TFT_CNS_mask: | |
1281 call TFT_divemask_color | |
1282 WIN_TINY dm_custom_gf_title_col1, dm_custom_gf_title_row | |
1283 STRCPY_TEXT_PRINT tCNSsurf | |
1284 WIN_TINY dm_custom_gf_title_col2, dm_custom_gf_title_row | |
1285 btfsc FLAG_ccr_mode ; in CCR mode? | |
1286 bra TFT_CNS_mask_1 ; YES - proceed with checking for bailout | |
1287 btfsc FLAG_pscr_mode ; NO - in pSCR mode? | |
1288 bra TFT_CNS_mask_1 ; YES - proceed with checking for bailout | |
1289 bra TFT_CNS_mask_2 ; NO - must be OC then | |
1290 TFT_CNS_mask_1: ; in CCR or pSCR mode | |
1291 btfsc is_bailout ; in bailout? | |
1292 bra TFT_CNS_mask_2 ; YES - print fTTS label (label will be printed, but a fTTS will actually not be calculated) | |
1293 TSTOSS opt_calc_asc_gasvolume ; NO - bailout volume calculation requested? | |
1294 bra TFT_CNS_mask_2 ; NO - print fTTS label | |
1295 STRCPY_TEXT_PRINT tCNSBO ; YES - print bailout label | |
1296 bra TFT_CNS_mask_3 | |
1297 TFT_CNS_mask_2: ; OC or bailout | |
1298 STRCPY_TEXT_PRINT tCNSfTTS ; print fTTS label | |
1299 TFT_CNS_mask_3: | |
1300 WIN_TINY dm_custom_gf_title_col3, dm_custom_gf_title_row | |
1301 STRCPY_TEXT_PRINT tCNSnow | |
1302 goto TFT_standard_color ; and return... | |
1303 | |
1304 global TFT_CNS | |
1305 TFT_CNS: | |
1306 ; CNS at end of normal dive | |
1307 WIN_STD dm_custom_hud_sensor1_column+.5,dm_custom_hud_data_row | |
1308 movff int_O_normal_CNS_fraction+0,lo | |
1309 movff int_O_normal_CNS_fraction+1,hi | |
1310 TFT_color_code warn_cns | |
1311 bsf leftbind | |
1312 output_16_3 ; output as xxx | |
1313 bcf leftbind | |
1314 STRCAT_PRINT "% " | |
1315 ; fTTS / Bailout CNS, if enabled | |
1316 WIN_STD dm_custom_hud_sensor2_column+.2,dm_custom_hud_data_row | |
1317 btfsc is_bailout ; in bailout? | |
1318 bra TFT_CNS_3 ; YES - show "---" | |
1319 TSTOSS opt_calc_asc_gasvolume ; NO - bailout volume calculation requested? | |
1320 bra TFT_CNS_1 ; NO - continue checking fTTS extra time | |
1321 btfsc FLAG_ccr_mode ; YES - in CCR mode? | |
1322 bra TFT_CNS_2 ; YES - skip test for fTTS extra time and show CNS% | |
1323 btfsc FLAG_pscr_mode ; in pSCR mode? | |
1324 bra TFT_CNS_2 ; YES - skip test for fTTS extra time and show CNS% | |
1325 TFT_CNS_1: ; not in bailout, no volume calculation | |
1326 TSTOSS char_I_extra_time ; fTTS extra time fTTS configured? | |
1327 bra TFT_CNS_3 ; NO - show "---" | |
1328 TFT_CNS_2: | |
1329 movff int_O_alternate_CNS_fraction+0,lo ; YES - show CNS% | |
1330 movff int_O_alternate_CNS_fraction+1,hi | |
1331 TFT_color_code warn_cns | |
1332 bsf leftbind | |
1333 output_16_3 ; output as xxx | |
1334 bcf leftbind | |
1335 STRCAT_PRINT "% " | |
1336 bra TFT_CNS_4 | |
1337 TFT_CNS_3: | |
1338 call TFT_standard_color | |
1339 STRCPY_PRINT "--- " | |
1340 TFT_CNS_4: | |
1341 ; current CNS | |
1342 WIN_STD dm_custom_hud_sensor3_column,dm_custom_hud_data_row | |
1343 movff int_O_CNS_fraction+0,lo | |
1344 movff int_O_CNS_fraction+1,hi | |
1345 TFT_color_code warn_cns | |
1346 bsf leftbind | |
1347 output_16_3 ; output as xxx | |
1348 bcf leftbind | |
1349 STRCAT_PRINT "%" | |
1350 bcf leftbind | |
1351 goto TFT_standard_color ; and return... | |
1352 | |
1353 | |
1354 global TFT_hud_mask ; The HUD mask | |
1261 TFT_hud_mask: | 1355 TFT_hud_mask: |
1262 call TFT_divemask_color | 1356 call TFT_divemask_color |
1263 WIN_TINY dm_custom_hud_column1,dm_custom_hud_row | 1357 WIN_TINY dm_custom_hud_column1,dm_custom_hud_row |
1264 STRCPY_TEXT_PRINT tDiveHudMask1 | 1358 STRCPY_TEXT_PRINT tDiveHudMask1 |
1265 WIN_TINY dm_custom_hud_column2,dm_custom_hud_row | 1359 WIN_TINY dm_custom_hud_column2,dm_custom_hud_row |
1266 STRCPY_TEXT_PRINT tDiveHudMask2 | 1360 STRCPY_TEXT_PRINT tDiveHudMask2 |
1267 WIN_TINY dm_custom_hud_column3,dm_custom_hud_row | 1361 WIN_TINY dm_custom_hud_column3,dm_custom_hud_row |
1268 STRCPY_TEXT_PRINT tDiveHudMask3 | 1362 STRCPY_TEXT_PRINT tDiveHudMask3 |
1269 goto TFT_standard_color ; and return... | 1363 goto TFT_standard_color ; and return... |
1270 | 1364 |
1271 global TFT_hud_voltages | |
1272 TFT_hud_voltages: ; Show HUD details | |
1273 WIN_SMALL dm_custom_hud_sensor1_column,dm_custom_hud_data_row | |
1274 call TFT_standard_color | |
1275 btfss use_O2_sensor1 | |
1276 call TFT_warnings_color | |
1277 movff o2_mv_sensor1+0,lo | |
1278 movff o2_mv_sensor1+1,hi | |
1279 bsf leftbind | |
1280 output_16dp .4 ; x.xx | |
1281 bcf leftbind | |
1282 STRCAT_PRINT "mV " | |
1283 WIN_SMALL dm_custom_hud_sensor2_column,dm_custom_hud_data_row | |
1284 call TFT_standard_color | |
1285 btfss use_O2_sensor2 | |
1286 call TFT_warnings_color | |
1287 movff o2_mv_sensor2+0,lo | |
1288 movff o2_mv_sensor2+1,hi | |
1289 bsf leftbind | |
1290 output_16dp .4 ; x.xx | |
1291 bcf leftbind | |
1292 STRCAT_PRINT "mV " | |
1293 WIN_SMALL dm_custom_hud_sensor3_column,dm_custom_hud_data_row | |
1294 call TFT_standard_color | |
1295 btfss use_O2_sensor3 | |
1296 call TFT_warnings_color | |
1297 movff o2_mv_sensor3+0,lo | |
1298 movff o2_mv_sensor3+1,hi | |
1299 bsf leftbind | |
1300 output_16dp .4 ; x.xx | |
1301 bcf leftbind | |
1302 STRCAT "mV " | |
1303 clrf WREG | |
1304 movff WREG,buffer+.6 ; limit string length to 6 | |
1305 STRCAT_PRINT "" | |
1306 goto TFT_standard_color ; and return... | |
1307 | 1365 |
1308 global TFT_update_ppo2_sensors ; Update Sensor data | 1366 global TFT_update_ppo2_sensors ; Update Sensor data |
1309 TFT_update_ppo2_sensors: | 1367 TFT_update_ppo2_sensors: |
1310 ; show three sensors | 1368 ; |
1369 ; Definition of the output: | |
1370 ; | |
1371 ; sensorX use voting o2 | |
1372 ; _calibrated _O2 _logic _ppo2 Output Color | |
1373 ; _ok _sensorX _sensorX _sensorX | |
1374 ;----------------------------------------------------------------------------------------------- | |
1375 ; 0 -/- -/- -/- "----" TFT_standard_color | |
1376 ; 1 0 -/- = 0 o2_ppo2_sensorX TFT_attention_color | |
1377 ; 1 0 -/- > 0 o2_ppo2_sensorX TFT_disabled_color | |
1378 ; 1 1 0 -/- o2_ppo2_sensorX TFT_color_code warn_ppo2_hud + win_invert | |
1379 ; 1 1 1 -/- o2_ppo2_sensorX TFT_color_code warn_ppo2_hud | |
1380 ; | |
1311 bsf leftbind | 1381 bsf leftbind |
1312 btfsc use_O2_sensor1 ; Use Sensor 1? | 1382 ; sensor 1 |
1313 bra TFT_update_hud1 ; Yes | 1383 btfsc sensor1_calibrated_ok ; valid calibration? |
1314 btfss dive_hud1_displayed ; Was the sensor shown? | 1384 bra TFT_update_hud1b ; yes |
1315 bra TFT_update_hud2 ; Yes, skip clear | 1385 ; no valid calibration |
1316 bcf dive_hud1_displayed ; No, clear display flag | 1386 WIN_STD dm_custom_hud_sensor1_column+.7, dm_custom_hud_data_row+.5 |
1317 WIN_BOX_BLACK dm_custom_hud_data_row, dm_customview_bot, dm_custom_hud_sensor1_column, dm_custom_hud_sensor2_column ; top, bottom, left, right | 1387 call TFT_standard_color |
1318 WIN_STD dm_custom_hud_sensor1_column+.7, dm_custom_hud_data_row+.5 | |
1319 call TFT_standard_color | |
1320 STRCPY_PRINT "---" | 1388 STRCPY_PRINT "---" |
1321 bra TFT_update_hud2 ; Skip Sensor 1 | 1389 bra TFT_update_hud2a ; continue with sensor 2 |
1322 TFT_update_hud1: | 1390 TFT_update_hud1b: |
1323 WIN_MEDIUM dm_custom_hud_sensor1_column,dm_custom_hud_data_row | 1391 ; sensor has a valid calibration |
1324 movff o2_ppo2_sensor1,lo | 1392 WIN_MEDIUM dm_custom_hud_sensor1_column,dm_custom_hud_data_row |
1325 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo | 1393 movff o2_ppo2_sensor1,lo ; load ppO2 value into transfer storage for output |
1326 btfss voting_logic_sensor1 ; Sensor within voting logic? ; Make this configurable? | 1394 clrf hi ; |
1327 bsf win_invert ; No, invert output... ; Make this configurable? | 1395 btfsc use_O2_sensor1 ; in use? |
1328 btfss voting_logic_sensor1 | 1396 bra TFT_update_hud1d ; yes |
1329 call TFT_warnings_color ; ... and draw in red | 1397 ; valid calibration, but not in use |
1330 clrf hi | 1398 tstfsz o2_ppo2_sensor1 ; sensor value = 0? |
1331 output_16dp .3 ; x.xx bar | 1399 bra TFT_update_hud1c ; no |
1400 ; valid calibration, not in use and value = 0 | |
1401 call TFT_attention_color ; output in yellow | |
1402 bra TFT_update_hud1e | |
1403 TFT_update_hud1c: | |
1404 ; sensor has valid calibration, is not in use and has a value > 0 | |
1405 call TFT_disabled_color ; output in light blue | |
1406 bra TFT_update_hud1e | |
1407 TFT_update_hud1d: | |
1408 ; sensor has valid calibration and is in use | |
1409 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo | |
1410 btfsc voting_logic_sensor1 ; sensor value agrees with other sensor's values? | |
1411 bra TFT_update_hud1e ; yes | |
1412 ; valid calibration, in use, but value does not agree with other sensors | |
1413 bsf win_invert ; invert output | |
1414 TFT_update_hud1e: | |
1415 ; all coloring is set up now, let's write the value to the display! | |
1416 bsf leftbind | |
1417 output_16dp .3 ; x.xx bar | |
1418 bcf leftbind | |
1332 STRCAT_PRINT "" | 1419 STRCAT_PRINT "" |
1333 bcf win_invert | 1420 bcf win_invert |
1334 bsf dive_hud1_displayed ; Set display flag | 1421 |
1335 TFT_update_hud2: | 1422 TFT_update_hud2a: ; sensor 2 |
1336 btfsc use_O2_sensor2 ; Use Sensor 2? | 1423 btfsc sensor2_calibrated_ok ; valid calibration? |
1337 bra TFT_update_hud3 ; Yes | 1424 bra TFT_update_hud2b ; yes |
1338 btfss dive_hud2_displayed ; Was the sensor shown? | 1425 ; no valid calibration |
1339 bra TFT_update_hud4 ; Yes, skip clear | 1426 WIN_STD dm_custom_hud_sensor2_column+.7, dm_custom_hud_data_row+.5 |
1340 bcf dive_hud2_displayed ; No, clear display flag | 1427 call TFT_standard_color |
1341 WIN_BOX_BLACK dm_custom_hud_data_row, dm_customview_bot, dm_custom_hud_sensor2_column, dm_custom_hud_sensor3_column ; top, bottom, left, right | |
1342 WIN_STD dm_custom_hud_sensor2_column+.7, dm_custom_hud_data_row+.5 | |
1343 call TFT_standard_color | |
1344 STRCPY_PRINT "---" | 1428 STRCPY_PRINT "---" |
1345 bra TFT_update_hud4 ; Skip Sensor 2 | 1429 bra TFT_update_hud3a ; continue with sensor 3 |
1346 TFT_update_hud3: | 1430 TFT_update_hud2b: |
1347 WIN_MEDIUM dm_custom_hud_sensor2_column,dm_custom_hud_data_row | 1431 ; sensor has a valid calibration |
1348 movff o2_ppo2_sensor2,lo | 1432 WIN_MEDIUM dm_custom_hud_sensor2_column,dm_custom_hud_data_row |
1349 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo | 1433 movff o2_ppo2_sensor2,lo ; load ppO2 value into transfer storage for output |
1350 btfss voting_logic_sensor2 ; Sensor within voting logic? ; Make this configurable? | 1434 clrf hi ; |
1351 bsf win_invert ; No, invert output... ; Make this configurable? | 1435 btfsc use_O2_sensor2 ; in use? |
1352 btfss voting_logic_sensor2 | 1436 bra TFT_update_hud2d ; yes |
1353 call TFT_warnings_color ; ... and draw in red | 1437 ; valid calibration, but not in use |
1354 clrf hi | 1438 tstfsz o2_ppo2_sensor2 ; sensor value = 0? |
1355 output_16dp .3 ; x.xx bar | 1439 bra TFT_update_hud2c ; no |
1440 ; valid calibration, not in use and value = 0 | |
1441 call TFT_attention_color ; output in yellow | |
1442 bra TFT_update_hud2e | |
1443 TFT_update_hud2c: | |
1444 ; sensor has valid calibration, is not in use and has a value > 0 | |
1445 call TFT_disabled_color ; output in light blue | |
1446 bra TFT_update_hud2e | |
1447 TFT_update_hud2d: | |
1448 ; sensor has valid calibration and is in use | |
1449 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo | |
1450 btfsc voting_logic_sensor2 ; sensor value agrees with other sensor's vlaues? | |
1451 bra TFT_update_hud2e ; yes | |
1452 ; valid calibration, in use, but value does not agree with other sensors | |
1453 bsf win_invert ; invert output | |
1454 TFT_update_hud2e: | |
1455 ; all coloring is set up now, let's write the value to the display! | |
1456 bsf leftbind | |
1457 output_16dp .3 ; x.xx bar | |
1458 bcf leftbind | |
1356 STRCAT_PRINT "" | 1459 STRCAT_PRINT "" |
1357 bcf win_invert | 1460 bcf win_invert |
1358 bsf dive_hud2_displayed ; Set display flag | 1461 |
1359 TFT_update_hud4: | 1462 TFT_update_hud3a: ; sensor 3 |
1360 btfsc use_O2_sensor3 ; Use Sensor 3? | 1463 btfsc sensor3_calibrated_ok ; valid calibration? |
1361 bra TFT_update_hud5 ; Yes | 1464 bra TFT_update_hud3b ; yes |
1362 btfss dive_hud3_displayed ; Was the sensor shown? | 1465 ; no valid calibration |
1363 bra TFT_update_hud6 ; Yes, skip clear | 1466 WIN_STD dm_custom_hud_sensor3_column+.7, dm_custom_hud_data_row+.5 |
1364 bcf dive_hud3_displayed ; No, clear display flag | 1467 call TFT_standard_color |
1365 WIN_BOX_BLACK dm_custom_hud_data_row, dm_customview_bot, dm_custom_hud_sensor3_column, .159 ; top, bottom, left, right | |
1366 WIN_STD dm_custom_hud_sensor3_column+.7, dm_custom_hud_data_row+.5 | |
1367 call TFT_standard_color | |
1368 STRCPY_PRINT "---" | 1468 STRCPY_PRINT "---" |
1369 bra TFT_update_hud6 ; Skip Sensor 3 | 1469 bra TFT_update_hud4 ; done |
1370 TFT_update_hud5: | 1470 TFT_update_hud3b: |
1371 WIN_MEDIUM dm_custom_hud_sensor3_column,dm_custom_hud_data_row | 1471 ; sensor has a valid calibration |
1372 movff o2_ppo2_sensor3,lo | 1472 WIN_MEDIUM dm_custom_hud_sensor3_column,dm_custom_hud_data_row |
1373 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo | 1473 movff o2_ppo2_sensor3,lo ; load ppO2 value into transfer storage for output |
1374 btfss voting_logic_sensor3 ; Sensor within voting logic? ; Make this configurable? | 1474 clrf hi ; |
1375 bsf win_invert ; No, invert output... ; Make this configurable? | 1475 btfsc use_O2_sensor3 ; in use? |
1376 btfss voting_logic_sensor3 | 1476 bra TFT_update_hud3d ; yes |
1377 call TFT_warnings_color ; ... and draw in red | 1477 ; valid calibration, but not in use |
1378 clrf hi | 1478 tstfsz o2_ppo2_sensor3 ; sensor value = 0? |
1379 output_16dp .3 ; x.xx bar | 1479 bra TFT_update_hud3c ; no |
1480 ; valid calibration, not in use and value = 0 | |
1481 call TFT_attention_color ; output in yellow | |
1482 bra TFT_update_hud3e | |
1483 TFT_update_hud3c: | |
1484 ; sensor has valid calibration, is not in use and has a value > 0 | |
1485 call TFT_disabled_color ; output in light blue | |
1486 bra TFT_update_hud3e | |
1487 TFT_update_hud3d: | |
1488 ; sensor has valid calibration and is in use | |
1489 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo | |
1490 btfsc voting_logic_sensor3 ; sensor value agrees with other sensor's vlaues? | |
1491 bra TFT_update_hud3e ; yes | |
1492 ; valid calibration, in use, but value does not agree with other sensors | |
1493 bsf win_invert ; invert output | |
1494 TFT_update_hud3e: | |
1495 ; all coloring is set up now, let's write the value to the display! | |
1496 bsf leftbind | |
1497 output_16dp .3 ; x.xx bar | |
1498 bcf leftbind | |
1380 STRCAT_PRINT "" | 1499 STRCAT_PRINT "" |
1381 bcf win_invert | 1500 bcf win_invert |
1382 bsf dive_hud3_displayed ; Set display flag | 1501 |
1383 TFT_update_hud6: | 1502 TFT_update_hud4: ; closure |
1384 bcf leftbind | 1503 bcf leftbind |
1385 goto TFT_standard_color ; and return... | 1504 goto TFT_standard_color ; and return... |
1386 | 1505 |
1387 | 1506 |
1388 global TFT_surface_sensor ; Update Sensor data in surface mode | 1507 global TFT_surface_sensor ; Update Sensor data in surface mode |
1389 TFT_surface_sensor: | 1508 TFT_surface_sensor: |
1390 movf hardware_flag,W | 1509 movf hardware_flag,W |
1391 sublw 0x11 ; 2 with BLE | 1510 sublw 0x11 ; 2 with BLE |
1392 btfsc STATUS,Z | 1511 btfsc STATUS,Z |
1393 return ; Ignore for 0x11 | 1512 return ; Ignore for 0x11 |
1394 | |
1395 ; show three sensors | 1513 ; show three sensors |
1396 bsf leftbind | 1514 bsf leftbind |
1397 WIN_SMALL surf_hud_sensor1_column,surf_hud_sensor1_row | 1515 WIN_SMALL surf_hud_sensor1_column,surf_hud_sensor1_row |
1398 btfsc use_O2_sensor1 ; Use Sensor 1? | 1516 btfsc sensor1_calibrated_ok |
1399 bra TFT_surface_sensor1 ; Yes | 1517 bra TFT_surface_sensor1 ; Yes |
1400 call TFT_standard_color | 1518 call TFT_standard_color |
1401 STRCPY_PRINT "--- " | 1519 STRCPY_PRINT "--- " |
1402 bra TFT_surface_sensor2 ; Skip Sensor 1 | 1520 bra TFT_surface_sensor2 ; Skip Sensor 1 |
1403 TFT_surface_sensor1: | 1521 TFT_surface_sensor1: |
1404 movff o2_ppo2_sensor1,lo | 1522 movff o2_ppo2_sensor1,lo |
1405 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo | 1523 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
1406 clrf hi | 1524 clrf hi |
1407 output_16dp .3 ; x.xx bar | 1525 bsf leftbind |
1526 output_16dp .3 ; x.xx bar | |
1527 bcf leftbind | |
1408 STRCAT_PRINT "" | 1528 STRCAT_PRINT "" |
1409 TFT_surface_sensor2: | 1529 TFT_surface_sensor2: |
1410 WIN_SMALL surf_hud_sensor2_column,surf_hud_sensor2_row | 1530 WIN_SMALL surf_hud_sensor2_column,surf_hud_sensor2_row |
1411 btfsc use_O2_sensor2 ; Use Sensor 2? | 1531 btfsc sensor2_calibrated_ok |
1412 bra TFT_surface_sensor3 ; Yes | 1532 bra TFT_surface_sensor3 ; Yes |
1413 call TFT_standard_color | 1533 call TFT_standard_color |
1414 STRCPY_PRINT "--- " | 1534 STRCPY_PRINT "--- " |
1415 bra TFT_surface_sensor4 ; Skip Sensor 2 | 1535 bra TFT_surface_sensor4 ; Skip Sensor 2 |
1416 TFT_surface_sensor3: | 1536 TFT_surface_sensor3: |
1417 movff o2_ppo2_sensor2,lo | 1537 movff o2_ppo2_sensor2,lo |
1418 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo | 1538 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
1419 clrf hi | 1539 clrf hi |
1420 output_16dp .3 ; x.xx bar | 1540 bsf leftbind |
1541 output_16dp .3 ; x.xx bar | |
1542 bcf leftbind | |
1421 STRCAT_PRINT "" | 1543 STRCAT_PRINT "" |
1422 TFT_surface_sensor4: | 1544 TFT_surface_sensor4: |
1423 WIN_SMALL surf_hud_sensor3_column,surf_hud_sensor3_row | 1545 WIN_SMALL surf_hud_sensor3_column,surf_hud_sensor3_row |
1424 btfsc use_O2_sensor3 ; Use Sensor 3? | 1546 btfsc sensor3_calibrated_ok |
1425 bra TFT_surface_sensor5 ; Yes | 1547 bra TFT_surface_sensor5 ; Yes |
1426 call TFT_standard_color | 1548 call TFT_standard_color |
1427 STRCPY_PRINT "--- " | 1549 STRCPY_PRINT "--- " |
1428 bra TFT_surface_sensor6 ; Skip Sensor 3 | 1550 bra TFT_surface_sensor6 ; Skip Sensor 3 |
1429 TFT_surface_sensor5: | 1551 TFT_surface_sensor5: |
1430 movff o2_ppo2_sensor3,lo | 1552 movff o2_ppo2_sensor3,lo |
1431 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo | 1553 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
1432 clrf hi | 1554 clrf hi |
1433 output_16dp .3 ; x.xx bar | 1555 bsf leftbind |
1556 output_16dp .3 ; x.xx bar | |
1557 bcf leftbind | |
1434 STRCAT_PRINT "" | 1558 STRCAT_PRINT "" |
1435 TFT_surface_sensor6: | 1559 TFT_surface_sensor6: |
1436 bcf leftbind | 1560 bcf leftbind |
1437 goto TFT_standard_color; and return... | 1561 goto TFT_standard_color; and return... |
1438 | 1562 |
1563 | |
1439 global TFT_sensor_mV | 1564 global TFT_sensor_mV |
1440 TFT_sensor_mV: | 1565 TFT_sensor_mV: |
1441 call TFT_standard_color | 1566 call TFT_standard_color |
1442 bsf leftbind | 1567 bsf leftbind |
1443 WIN_SMALL surf_mV_sensor_column,surf_mV_sensor1_row | 1568 WIN_SMALL surf_mV_sensor_column,surf_mV_sensor1_row |
1444 movff o2_mv_sensor1+0,lo ; in 0.1mV steps | 1569 movff o2_mv_sensor1+0,lo ; in 0.1mV steps |
1445 movff o2_mv_sensor1+1,hi ; in 0.1mV steps | 1570 movff o2_mv_sensor1+1,hi ; in 0.1mV steps |
1446 STRCAT "1: " | 1571 STRCAT "1: " |
1447 output_16dp .4 ; xxx.y mV | 1572 output_16dp .4 ; xxx.y mV |
1448 STRCAT_PRINT "mV " | 1573 STRCAT_PRINT "mV " |
1449 | 1574 |
1450 WIN_SMALL surf_mV_sensor_column,surf_mV_sensor2_row | 1575 WIN_SMALL surf_mV_sensor_column,surf_mV_sensor2_row |
1451 movff o2_mv_sensor2+0,lo ; in 0.1mV steps | 1576 movff o2_mv_sensor2+0,lo ; in 0.1mV steps |
1452 movff o2_mv_sensor2+1,hi ; in 0.1mV steps | 1577 movff o2_mv_sensor2+1,hi ; in 0.1mV steps |
1453 STRCAT "2: " | 1578 STRCAT "2: " |
1454 output_16dp .4 ; xxx.y mV | 1579 output_16dp .4 ; xxx.y mV |
1455 STRCAT_PRINT "mV " | 1580 STRCAT_PRINT "mV " |
1456 | 1581 |
1457 WIN_SMALL surf_mV_sensor_column,surf_mV_sensor3_row | 1582 WIN_SMALL surf_mV_sensor_column,surf_mV_sensor3_row |
1458 movff o2_mv_sensor3+0,lo ; in 0.1mV steps | 1583 movff o2_mv_sensor3+0,lo ; in 0.1mV steps |
1459 movff o2_mv_sensor3+1,hi ; in 0.1mV steps | 1584 movff o2_mv_sensor3+1,hi ; in 0.1mV steps |
1460 STRCAT "3: " | 1585 STRCAT "3: " |
1461 output_16dp .4 ; xxx.y mV | 1586 output_16dp .4 ; xxx.y mV |
1462 STRCAT_PRINT "mV " | 1587 STRCAT_PRINT "mV " |
1463 bcf leftbind | 1588 bcf leftbind |
1464 goto TFT_standard_color ; and return... | 1589 goto TFT_standard_color ; and return... |
1590 | |
1465 | 1591 |
1466 global TFT_sensor_surface_warning | 1592 global TFT_sensor_surface_warning |
1467 TFT_sensor_surface_warning: | 1593 TFT_sensor_surface_warning: |
1468 call TFT_warnings_color | 1594 call TFT_warnings_color |
1469 movff opt_x_s1+1,lo ; into bank1 | 1595 btfss sensor1_calibrated_ok ; do not show end of lifetime arrow if sensor failed calibration at all |
1470 movf lo,W ; when opt_x_s1 > 255 the sensor will just give 8 mV at a ppO2 of 0,21 any more | 1596 bra TFT_sensor_mV2 |
1471 bz TFT_sensor_mV2 ; the sensor is not too bad yet for a warning | 1597 movff opt_x_s1+1,lo ; into bank1 |
1598 movf lo,W ; when opt_x_s1 > 255 the sensor will just give 8 mV at a ppO2 of 0,21 any more | |
1599 bz TFT_sensor_mV2 ; the sensor is not too bad yet for a warning | |
1472 WIN_SMALL surf_mV_sensor_status_column,surf_mV_sensor1_row-.5 | 1600 WIN_SMALL surf_mV_sensor_status_column,surf_mV_sensor1_row-.5 |
1473 STRCPY_PRINT "\xb8" ; mark sensor as beeing at end of lifetime | 1601 STRCPY_PRINT "\xb8" ; mark sensor as being at end of lifetime |
1474 TFT_sensor_mV2: | 1602 TFT_sensor_mV2: |
1475 movff opt_x_s2+1,lo ; into bank1 | 1603 btfss sensor2_calibrated_ok ; do not show end of lifetime arrow if sensor failed calibration at all |
1476 movf lo,W ; when opt_x_s2 > 255 the sensor will just give 8 mV at a ppO2 of 0,21 any more | 1604 bra TFT_sensor_mV3 |
1477 bz TFT_sensor_mV3 ; the sensor is not too bad yet for a warning | 1605 movff opt_x_s2+1,lo ; into bank1 |
1606 movf lo,W ; when opt_x_s2 > 255 the sensor will just give 8 mV at a ppO2 of 0,21 any more | |
1607 bz TFT_sensor_mV3 ; the sensor is not too bad yet for a warning | |
1478 WIN_SMALL surf_mV_sensor_status_column,surf_mV_sensor2_row-.5 | 1608 WIN_SMALL surf_mV_sensor_status_column,surf_mV_sensor2_row-.5 |
1479 STRCPY_PRINT "\xb8" ; mark sensor as beeing at end of lifetime | 1609 STRCPY_PRINT "\xb8" ; mark sensor as being at end of lifetime |
1480 TFT_sensor_mV3: | 1610 TFT_sensor_mV3: |
1481 movff opt_x_s3+1,lo ; into bank1 | 1611 btfss sensor3_calibrated_ok ; do not show end of lifetime arrow if sensor failed calibration at all |
1482 movf lo,W ; when opt_x_s3 > 255 the sensor will just give 8 mV at a ppO2 of 0,21 any more | 1612 bra TFT_sensor_mV4 |
1483 bz TFT_sensor_mV4 ; the sensor is not too bad yet for a warning | 1613 movff opt_x_s3+1,lo ; into bank1 |
1614 movf lo,W ; when opt_x_s3 > 255 the sensor will just give 8 mV at a ppO2 of 0,21 any more | |
1615 bz TFT_sensor_mV4 ; the sensor is not too bad yet for a warning | |
1484 WIN_SMALL surf_mV_sensor_status_column,surf_mV_sensor3_row-.5 | 1616 WIN_SMALL surf_mV_sensor_status_column,surf_mV_sensor3_row-.5 |
1485 STRCPY_PRINT "\xb8" ; mark sensor as beeing at end of lifetime | 1617 STRCPY_PRINT "\xb8" ; mark sensor as beeing at end of lifetime |
1486 TFT_sensor_mV4: | 1618 TFT_sensor_mV4: |
1487 goto TFT_standard_color ; (And return) Done. | 1619 goto TFT_standard_color ; ...and return |
1488 | 1620 |
1489 global TFT_menu_hud | |
1490 TFT_menu_hud: ; Yes, update HUD data | |
1491 call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays | |
1492 call TFT_attention_color ; show in yellow | |
1493 bsf leftbind | |
1494 WIN_SMALL surf_menu_sensor1_column,surf_menu_sensor1_row | |
1495 movff o2_ppo2_sensor1,lo | |
1496 clrf hi | |
1497 output_16dp .3 ; x.xx bar | |
1498 PUTC "," | |
1499 movff o2_mv_sensor1+0,lo ; in 0.1mV steps | |
1500 movff o2_mv_sensor1+1,hi ; in 0.1mV steps | |
1501 output_16dp .4 ; xxx.y mV | |
1502 STRCAT "mV " | |
1503 clrf WREG | |
1504 movff WREG,buffer+.10 ; limit string length to 10 | |
1505 STRCAT_PRINT "" | |
1506 WIN_SMALL surf_menu_sensor2_column,surf_menu_sensor2_row | |
1507 movff o2_ppo2_sensor2,lo | |
1508 clrf hi | |
1509 output_16dp .3 ; x.xx bar | |
1510 PUTC "," | |
1511 movff o2_mv_sensor2+0,lo ; in 0.1mV steps | |
1512 movff o2_mv_sensor2+1,hi ; in 0.1mV steps | |
1513 output_16dp .4 ; xxx.y mV | |
1514 STRCAT "mV " | |
1515 clrf WREG | |
1516 movff WREG,buffer+.10 ; limit string length to 10 | |
1517 STRCAT_PRINT "" | |
1518 WIN_SMALL surf_menu_sensor3_column,surf_menu_sensor3_row | |
1519 movff o2_ppo2_sensor3,lo | |
1520 clrf hi | |
1521 output_16dp .3 ; x.xx bar | |
1522 PUTC "," | |
1523 movff o2_mv_sensor3+0,lo ; in 0.1mV steps | |
1524 movff o2_mv_sensor3+1,hi ; in 0.1mV steps | |
1525 output_16dp .4 ; xxx.y mV | |
1526 STRCAT "mV " | |
1527 clrf WREG | |
1528 movff WREG,buffer+.10 ; limit string length to 10 | |
1529 STRCAT_PRINT "" | |
1530 WIN_SMALL surf_menu_sensor4_column,surf_menu_sensor4_row | |
1531 | |
1532 btfss analog_o2_input | |
1533 bra TFT_menu_hud_2 ; always for normal OSTC3 | |
1534 btfss s8_digital | |
1535 return ; Not for analog | |
1536 TFT_menu_hud_2: | |
1537 STRCPY "Batt:" | |
1538 movff hud_battery_mv+0,lo ; in mV | |
1539 movff hud_battery_mv+1,hi ; in mV | |
1540 output_16dp .2 ; x.yyy V | |
1541 STRCAT_PRINT "V" | |
1542 call TFT_standard_color | |
1543 bcf leftbind | |
1544 return | |
1545 | 1621 |
1546 global TFT_menu_calibrate | 1622 global TFT_menu_calibrate |
1547 TFT_menu_calibrate: ; update mV data in calibration menu | 1623 TFT_menu_calibrate: ; update mV data in calibration menu |
1548 call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays | 1624 btfss s8_digital ; =1: Digital I/O |
1625 bra TFT_menu_calibrate_analog ; use analog | |
1626 TFT_menu_calibrate_wait: | |
1627 btfss new_s8_data_available ; =1: New data frame recieved | |
1628 bra TFT_menu_calibrate_wait | |
1629 call compute_mvolts_for_all_sensors | |
1630 bra TFT_menu_calibrate_common | |
1631 TFT_menu_calibrate_analog: | |
1632 call get_analog_inputs | |
1633 TFT_menu_calibrate_common: | |
1549 call TFT_attention_color ; show in yellow | 1634 call TFT_attention_color ; show in yellow |
1550 bsf leftbind | 1635 bsf leftbind |
1551 WIN_SMALL surf_menu_sensor1_column,surf_menu2_sensor1_row | 1636 WIN_SMALL surf_menu_sensor1_column,surf_menu2_sensor1_row |
1552 movff o2_mv_sensor1+0,lo ; in 0.1mV steps | 1637 movff o2_mv_sensor1+0,lo ; in 0.1mV steps |
1553 movff o2_mv_sensor1+1,hi ; in 0.1mV steps | 1638 movff o2_mv_sensor1+1,hi ; in 0.1mV steps |
1554 output_16dp .4 ; xxx.y mV | 1639 output_16dp .4 ; xxx.y mV |
1555 STRCAT_PRINT "mV " | 1640 STRCAT_PRINT "mV " |
1556 WIN_SMALL surf_menu_sensor2_column,surf_menu2_sensor2_row | 1641 WIN_SMALL surf_menu_sensor2_column,surf_menu2_sensor2_row |
1557 movff o2_mv_sensor2+0,lo ; in 0.1mV steps | 1642 movff o2_mv_sensor2+0,lo ; in 0.1mV steps |
1558 movff o2_mv_sensor2+1,hi ; in 0.1mV steps | 1643 movff o2_mv_sensor2+1,hi ; in 0.1mV steps |
1559 output_16dp .4 ; xxx.y mV | 1644 output_16dp .4 ; xxx.y mV |
1560 STRCAT_PRINT "mV " | 1645 STRCAT_PRINT "mV " |
1561 WIN_SMALL surf_menu_sensor3_column,surf_menu2_sensor3_row | 1646 WIN_SMALL surf_menu_sensor3_column,surf_menu2_sensor3_row |
1562 movff o2_mv_sensor3+0,lo ; in 0.1mV steps | 1647 movff o2_mv_sensor3+0,lo ; in 0.1mV steps |
1563 movff o2_mv_sensor3+1,hi ; in 0.1mV steps | 1648 movff o2_mv_sensor3+1,hi ; in 0.1mV steps |
1564 output_16dp .4 ; xxx.y mV | 1649 output_16dp .4 ; xxx.y mV |
1565 STRCAT_PRINT "mV " | 1650 STRCAT_PRINT "mV " |
1566 ; WIN_SMALL surf_menu2_ambient_column,surf_menu2_ambient_row | |
1567 ; PUTC "@" | |
1568 ; SAFE_2BYTE_COPY amb_pressure, lo | |
1569 ; output_16 | |
1570 ; STRCAT_TEXT tMBAR ; mbar | |
1571 ; STRCAT_PRINT " " | |
1572 bcf leftbind | 1651 bcf leftbind |
1573 goto TFT_standard_color ; and return... | 1652 goto TFT_standard_color ; ...and return |
1574 | 1653 |
1575 global TFT_clock | 1654 |
1655 global TFT_clock | |
1576 TFT_clock: | 1656 TFT_clock: |
1577 WIN_SMALL surf_clock_column,surf_clock_row | 1657 WIN_SMALL surf_clock_column,surf_clock_row |
1578 TFT_clock2: ; called from divemode clock | 1658 TFT_clock2: ; called from divemode clock |
1579 call TFT_standard_color | 1659 call TFT_standard_color |
1580 movff hours,lo | 1660 movff hours,lo |
1606 movff day,convert_value_temp+1 | 1686 movff day,convert_value_temp+1 |
1607 movff year,convert_value_temp+2 | 1687 movff year,convert_value_temp+2 |
1608 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | 1688 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 |
1609 STRCAT_PRINT " " | 1689 STRCAT_PRINT " " |
1610 return | 1690 return |
1691 | |
1611 ;============================================================================= | 1692 ;============================================================================= |
1612 | |
1613 global TFT_interval | |
1614 TFT_interval: | |
1615 call TFT_warning_set_window ; Sets the row and column for the current warning | |
1616 tstfsz WREG ; Is there room for the warning? | |
1617 return ; No | |
1618 call TFT_warning_set_window_com | |
1619 STRCPY "Int:" | |
1620 movff surface_interval+0,lo | |
1621 movff surface_interval+1,hi | |
1622 call convert_time ; lo=mins, hi=hours | |
1623 movf hi,W | |
1624 movff lo,hi | |
1625 movwf lo ; exchange lo and hi | |
1626 output_99x | |
1627 PUTC ':' | |
1628 movff hi,lo | |
1629 output_99x | |
1630 movlw surf_warning_length ; No, use surface string length | |
1631 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
1632 STRCAT_PRINT "" | |
1633 bcf win_invert | |
1634 return | |
1635 | 1693 |
1636 global TFT_surface_decosettings ; Show all deco settings | 1694 global TFT_surface_decosettings ; Show all deco settings |
1637 TFT_surface_decosettings: | 1695 TFT_surface_decosettings: |
1638 ; Deco Mode | 1696 ; Deco Mode |
1639 call TFT_standard_color | 1697 call TFT_standard_color |
1698 WIN_SMALL surf_gaslist_column,surf_gaslist_row | |
1699 STRCAT_PRINT "ZH-L16" | |
1640 movff char_I_deco_model,WREG | 1700 movff char_I_deco_model,WREG |
1641 iorwf WREG | 1701 iorwf WREG |
1642 bnz TFT_surface_decosettings1 | 1702 bnz TFT_surface_decosettings1 |
1643 | 1703 ; Display ZH-L16 sat/desat model |
1644 ; Display ZH-L16 sat/desat model. | 1704 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) |
1645 TEXT_SMALL surf_gaslist_column,surf_gaslist_row, tZHL16 | |
1646 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.1) | |
1647 lfsr FSR2,buffer | 1705 lfsr FSR2,buffer |
1648 movff char_I_desaturation_multiplier,lo | 1706 movff char_I_desaturation_multiplier,lo |
1649 bsf leftbind | 1707 bsf leftbind |
1650 output_8 | 1708 output_8 |
1651 STRCAT "%/" | 1709 STRCAT "%/" |
1652 movff char_I_saturation_multiplier,lo | 1710 movff char_I_saturation_multiplier,lo |
1653 output_8 | 1711 output_8 |
1654 STRCAT_PRINT "%" | 1712 STRCAT_PRINT "%" |
1655 bra TFT_surface_decosettings2 | 1713 bra TFT_surface_decosettings2 |
1656 | 1714 ; Display ZH-L16-GF low/high model |
1657 ; Display ZH-L16-GF low/high model. | |
1658 TFT_surface_decosettings1: | 1715 TFT_surface_decosettings1: |
1659 TEXT_SMALL surf_gaslist_column,surf_gaslist_row, tZHL16GF | 1716 TEXT_SMALL surf_gaslist_column+.43,surf_gaslist_row,tZHL16GF |
1660 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.1) | 1717 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) |
1661 STRCPY_TEXT tGF ; GF: | 1718 STRCPY_TEXT tGF ; GF: |
1662 movff char_I_GF_Low_percentage,lo | 1719 movff opt_GF_low,lo |
1663 output_99x | 1720 output_99x |
1664 STRCAT "/" | 1721 STRCAT "/" |
1665 movff char_I_GF_High_percentage,lo | 1722 movff opt_GF_high,lo |
1666 output_99x | 1723 output_99x |
1667 STRCAT_PRINT "" | 1724 STRCAT_PRINT "" |
1668 ;bra TFT_surface_decosettings2 | 1725 TFT_surface_decosettings2: ; fTTS |
1669 TFT_surface_decosettings2: | 1726 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) |
1670 ; FTTS | |
1671 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.2) | |
1672 STRCPY_TEXT tFTTSMenu | 1727 STRCPY_TEXT tFTTSMenu |
1673 movff char_I_extra_time,lo | 1728 movff char_I_extra_time,lo |
1674 bsf leftbind | 1729 bsf leftbind |
1675 output_8 | 1730 output_8 |
1676 STRCAT_TEXT_PRINT tMinutes | 1731 STRCAT_TEXT_PRINT tMinutes |
1677 | |
1678 ; Last Stop | 1732 ; Last Stop |
1679 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.3) | 1733 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3) |
1680 STRCPY_TEXT tLastDecostop | 1734 STRCPY_TEXT tLastDecostop |
1681 movff char_I_depth_last_deco,lo | 1735 movff opt_last_stop,lo |
1682 output_8 | 1736 output_8 |
1683 STRCAT_TEXT_PRINT tMeters | 1737 STRCAT_TEXT_PRINT tMeters |
1684 | |
1685 ; Salinity | 1738 ; Salinity |
1686 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.4) | 1739 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) |
1687 STRCPY_TEXT tDvSalinity | 1740 STRCPY_TEXT tDvSalinity |
1688 movff opt_salinity,lo | 1741 movff opt_salinity,lo |
1689 output_8 | 1742 output_8 |
1690 bcf leftbind | 1743 bcf leftbind |
1691 STRCAT_TEXT_PRINT tPercent | 1744 STRCAT_TEXT_PRINT tPercent |
1692 return ; Done. | 1745 return |
1693 | 1746 |
1694 global TFT_debug_output | 1747 global TFT_debug_output |
1695 TFT_debug_output: | 1748 TFT_debug_output: |
1696 return | 1749 return |
1697 WIN_TINY .80,.0 | 1750 WIN_TINY .80,.0 |
1703 movff analog_sw2,lo | 1756 movff analog_sw2,lo |
1704 output_8 | 1757 output_8 |
1705 STRCAT_PRINT "" | 1758 STRCAT_PRINT "" |
1706 return | 1759 return |
1707 | 1760 |
1708 global TFT_divetimeout ; Show timeout counter | 1761 global TFT_divetimeout ; Show timeout counter |
1709 TFT_divetimeout: | 1762 TFT_divetimeout: |
1710 call TFT_warning_set_window ; Sets the row and column for the current warning | 1763 call TFT_warning_set_window ; Sets the row and column for the current warning |
1711 tstfsz WREG ; Is there room for the warning? | 1764 tstfsz WREG ; Is there room for the warning? |
1712 return ; No | 1765 return ; No |
1713 call TFT_warning_set_window_com | |
1714 call TFT_standard_color | 1766 call TFT_standard_color |
1715 STRCPY 0x94 ; "End of dive" icon | 1767 STRCPY 0x94 ; "End of dive" icon |
1716 movff opt_diveTimeout,WREG ; in [min] | 1768 movff opt_diveTimeout,WREG ; in [min] |
1717 mullw .60 | 1769 mullw .60 |
1718 movff PRODL,sub_a+0 | 1770 movff PRODL,sub_a+0 |
1719 movff PRODH,sub_a+1 ; in [s] | 1771 movff PRODH,sub_a+1 ; in [s] |
1720 movff timeout_counter,sub_b+0 | 1772 movff timeout_counter,sub_b+0 |
1721 movff timeout_counter2,sub_b+1 | 1773 movff timeout_counter2,sub_b+1 |
1722 call subU16 ; sub_c = sub_a - sub_b (with UNSIGNED values) | 1774 call subU16 ; sub_c = sub_a - sub_b (with UNSIGNED values) |
1723 movff sub_c+0, lo | 1775 movff sub_c+0, lo |
1724 movff sub_c+1, hi | 1776 movff sub_c+1, hi |
1725 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | 1777 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) |
1726 movf hi,W | 1778 movf hi,W |
1727 movff lo,hi | 1779 movff lo,hi |
1728 movwf lo ; exchange lo and hi | 1780 movwf lo ; exchange lo and hi |
1729 output_99x | 1781 output_99x |
1730 PUTC ':' | 1782 PUTC ':' |
1731 movff hi,lo | 1783 movff hi,lo |
1732 output_99x | 1784 output_99x |
1733 movlw dm_warning_length ; Divemode string length | 1785 movlw dm_warning_length ; Divemode string length |
1734 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | 1786 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
1735 STRCAT_PRINT "" | 1787 STRCAT_PRINT "" |
1736 bcf win_invert | 1788 bcf win_invert |
1737 return | 1789 return |
1738 | 1790 |
1739 global TFT_ftts | 1791 global TFT_display_ftts |
1740 TFT_ftts: | 1792 TFT_display_ftts: |
1741 movff char_I_extra_time,lo | 1793 movff char_I_extra_time,lo |
1742 tstfsz lo | 1794 tstfsz lo |
1743 bra $+4 | 1795 bra TFT_display_ftts_a |
1744 return ; char_I_extra_time=0, return. | 1796 return ; char_I_extra_time=0, return. |
1745 | 1797 TFT_display_ftts_a: |
1746 if dm_offset !=0 | 1798 movff int_O_alternate_ascenttime+0,WREG |
1747 incf warning_counter,F ; increase counter | 1799 movff int_O_alternate_ascenttime+1,hi |
1748 call TFT_warning_set_window ; Sets the row and column for the current warning | 1800 iorwf hi,W ; int_O_alternate_ascenttime:2 == 0 ? |
1749 tstfsz WREG ; Is there room for the warning? | 1801 bnz TFT_display_ftts_b |
1750 return ; No | 1802 return ; No deco, do nothing |
1751 call TFT_warning_set_window_com | 1803 TFT_display_ftts_b: |
1752 else | 1804 btfsc is_bailout ; check if we are in bailout mode |
1753 btfsc divemode_menu ; Is the dive mode menu shown? | 1805 return ; YES - in bailout no fTTS will be computed, so nothing to display |
1754 return ; Yes, return | 1806 incf warning_counter,F ; increase counter |
1755 call TFT_standard_color | 1807 call TFT_warning_set_window ; sets the row and column for the current warning |
1756 WIN_SMALL dm_ftts_value_column, dm_ftts_value_row | 1808 tstfsz WREG ; is there room for the warning? |
1757 endif | 1809 return ; NO |
1758 | 1810 btfsc FLAG_ccr_mode ; in CCR mode? |
1759 movff char_I_extra_time,lo | 1811 bra TFT_display_ftts_1 ; YES - print fTTS label |
1760 STRCPY "@+" | 1812 btfsc FLAG_pscr_mode ; NO - in pSCR mode? |
1813 bra TFT_display_ftts_1 ; YES - print fTTS label | |
1814 bra TFT_display_ftts_2 ; NO - must be OC then | |
1815 TFT_display_ftts_1: ; in CCR or pSCR mode | |
1816 btfsc is_bailout ; in bailout? | |
1817 bra TFT_display_ftts_2 ; YES - print fTTS label | |
1818 TSTOSS opt_calc_asc_gasvolume ; NO - bailout volume calculation requested? | |
1819 bra TFT_display_ftts_2 ; NO - print fTTS label | |
1820 STRCPY "B/O" ; YES - print bailout label | |
1821 bra TFT_display_ftts_3 | |
1822 TFT_display_ftts_2: ; OC or bailout | |
1823 STRCPY "@+" ; print fTTS label | |
1824 TFT_display_ftts_3: | |
1825 movff char_I_extra_time,lo | |
1761 bsf leftbind | 1826 bsf leftbind |
1762 output_8 | 1827 output_8 |
1763 PUTC ":" | 1828 PUTC ":" |
1764 movff int_O_extra_ascenttime+0,lo | 1829 movff int_O_alternate_ascenttime+0,lo |
1765 movff int_O_extra_ascenttime+1,hi | 1830 movff int_O_alternate_ascenttime+1,hi |
1766 movf lo,W | 1831 btfss hi,int_invalid_flag ; is the invalid flag set? |
1767 iorwf hi,W ; extra_ascenttime == 0 ? | 1832 bra TFT_display_ftts1 ; NO |
1768 bz TFT_ftts2 ; No deco | 1833 bcf hi,int_invalid_flag ; YES - clear flag |
1769 movf lo,W ; extra_ascenttime == 0xFFFF ? | 1834 call TFT_disabled_color ; switch to disabled color |
1770 andwf hi,W | 1835 TFT_display_ftts1: |
1771 incf WREG,w | 1836 movf lo,W |
1772 bz TFT_ftts2 ; Wait... | 1837 iorwf hi,W ; extra_ascenttime == 0 ? |
1773 output_16 | 1838 bz TFT_display_ftts2 ; YES - show dashes |
1774 bcf leftbind | 1839 btfsc hi,int_not_yet_computed ; is the not-computed-yet flag set? |
1840 bra TFT_display_ftts2 ; YES | |
1841 output_16 ; NO | |
1842 bcf leftbind | |
1775 PUTC "'" | 1843 PUTC "'" |
1776 movlw dm_warning_length ; Divemode string length | 1844 movlw dm_warning_length ; Divemode string length |
1777 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | 1845 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
1778 STRCAT_PRINT "" | 1846 STRCAT_PRINT "" |
1779 bcf win_invert | 1847 bcf win_invert |
1780 return | 1848 goto TFT_standard_color ; ...and return |
1781 | 1849 TFT_display_ftts2: |
1782 TFT_ftts2: | |
1783 STRCAT "---" | 1850 STRCAT "---" |
1784 bcf leftbind | 1851 bcf leftbind |
1785 movlw dm_warning_length ; Divemode string length | 1852 movlw dm_warning_length ; Divemode string length |
1786 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | 1853 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
1787 STRCAT_PRINT "" | 1854 STRCAT_PRINT "" |
1788 bcf win_invert | 1855 bcf win_invert |
1789 return | 1856 goto TFT_standard_color ; ...and return |
1790 | 1857 |
1791 | 1858 |
1792 ;============================================================================= | 1859 ;============================================================================= |
1793 | 1860 |
1794 global TFT_temp_surfmode | 1861 global TFT_temp_surfmode |
1795 TFT_temp_surfmode: | 1862 TFT_temp_surfmode: |
1796 call TFT_divemask_color | 1863 call TFT_divemask_color |
1797 WIN_SMALL surf_temp_column+3*8,surf_temp_row | 1864 WIN_SMALL surf_temp_column+3*8,surf_temp_row |
1798 TSTOSS opt_units ; 0=°C, 1=°F | 1865 TSTOSS opt_units ; 0=°C, 1=°F |
1799 bra TFT_temp_surfmode_metric | 1866 bra TFT_temp_surfmode_metric |
1800 STRCAT_TEXT tLogTunitF ; °F | 1867 STRCAT_TEXT tLogTunitF ; °F |
1801 bra TFT_temp_surfmode_common | 1868 bra TFT_temp_surfmode_common |
1802 TFT_temp_surfmode_metric: | 1869 TFT_temp_surfmode_metric: |
1803 STRCAT_TEXT tLogTunitC ; °C | 1870 STRCAT_TEXT tLogTunitC ; °C |
1804 TFT_temp_surfmode_common: | 1871 TFT_temp_surfmode_common: |
1805 STRCAT_PRINT "" | 1872 STRCAT_PRINT "" |
1806 WIN_SMALL surf_temp_column,surf_temp_row | 1873 WIN_SMALL surf_temp_column,surf_temp_row |
1807 bra TFT_temp_common | 1874 bra TFT_temp_common |
1808 | 1875 |
1809 global TFT_temp_divemode | 1876 global TFT_temp_divemode |
1810 TFT_temp_divemode: | 1877 TFT_temp_divemode: |
1811 btfsc divemode_menu ; Is the dive mode menu shown? | 1878 bcf FLAG_TFT_temp_divemode |
1812 return ; Yes, no update of temperature now | 1879 btfsc divemode_menu ; Is the dive mode menu shown? |
1813 btfsc blinking_better_gas ; blinking better Gas? | 1880 return ; Yes, no update of temperature now |
1814 return ; Yes, no update of temperature now | 1881 btfsc blinking_better_gas ; blinking better Gas? |
1815 WIN_SMALL dm_temp_column,dm_temp_row | 1882 return ; Yes, no update of temperature now |
1816 | 1883 WIN_SMALL dm_temp_column,dm_temp_row |
1817 TFT_temp_common: | 1884 TFT_temp_common: |
1818 call TFT_standard_color | 1885 call TFT_standard_color |
1819 SAFE_2BYTE_COPY temperature, lo ; get current temperature | 1886 SAFE_2BYTE_COPY temperature,lo ; get current temperature |
1820 TSTOSS opt_units ; 0=°C, 1=°F | 1887 TSTOSS opt_units ; 0=°C, 1=°F |
1821 bra TFT_temp_common_1 | 1888 bra TFT_temp_common_1 |
1822 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit | 1889 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit |
1823 TFT_temp_common_1: | 1890 TFT_temp_common_1: |
1824 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | 1891 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
1825 btfsc neg_flag ; is the temperature negative? | 1892 btfsc neg_flag ; is the temperature negative? |
1826 bra TFT_temp_common_2 ; YES - the minus sign has already been written | 1893 bra TFT_temp_common_2 ; YES - the minus sign has already been written |
1827 ; temp is positive, is it less then 10°C? | 1894 ; temp is positive, is it less then 10°C? |
1828 tstfsz hi | 1895 tstfsz hi |
1829 bra TFT_temp_common_1a ; >25,5°C, skip here | 1896 bra TFT_temp_common_1a ; >25.5°C, skip here |
1830 movlw .100 | 1897 movlw .100 |
1831 cpfslt lo | 1898 cpfslt lo |
1832 bra TFT_temp_common_1a ; >10,0°C, skip here | 1899 bra TFT_temp_common_1a ; >10.0°C, skip here |
1833 bsf leftbind | 1900 bsf leftbind |
1834 output_16dp d'4' ; x.y°C | 1901 output_16dp d'4' ; x.y°C |
1835 bcf leftbind | 1902 bcf leftbind |
1836 bra TFT_temp_common_3 ; Done. | 1903 bra TFT_temp_common_3 ; Done. |
1837 TFT_temp_common_1a: | 1904 TFT_temp_common_1a: |
1838 PUTC " " ; NO - write a space instead of the minus sign | 1905 PUTC " " ; NO - write a space instead of the minus sign |
1839 TFT_temp_common_2: | 1906 TFT_temp_common_2: |
1840 bsf ignore_digit5 ; ignore decimal | 1907 bsf ignore_digit5 ; ignore decimal |
1841 output_16_3 ; output 0-999 without decimal -> writes ' ' - 99 | 1908 output_16_3 ; output 0-999 without decimal -> writes ' ' - 99 |
1842 bcf ignore_digit5 | 1909 bcf ignore_digit5 |
1843 movff buffer+2,lo ; get output from unit position | 1910 movff buffer+2,lo ; get output from unit position |
1844 movlw " " ; load code of the space character | 1911 movlw " " ; load code of the space character |
1845 cpfseq lo ; is there a space sign on the unit position? (happens between +1 and -1) | 1912 cpfseq lo ; is there a space sign on the unit position? (happens between +1 and -1) |
1846 bra TFT_temp_common_3 ; NO | 1913 bra TFT_temp_common_3 ; NO |
1847 movff WREG,buffer+0 ; YES - replace potential minus sign with a space (temps from -0.9° to -0.1° else would appear as '- 0') | 1914 movff WREG,buffer+0 ; YES - replace potential minus sign with a space (temps from -0.9° to -0.1° else would appear as '- 0') |
1848 movlw "0" ; load code of the zero character | 1915 movlw "0" ; load code of the zero character |
1849 movff WREG,buffer+2 ; replace space with a zero | 1916 movff WREG,buffer+2 ; replace space with a zero |
1850 TFT_temp_common_3: | 1917 TFT_temp_common_3: |
1851 btfss divemode ; are we in dive mode? | 1918 btfss divemode ; are we in dive mode? |
1852 bra TFT_temp_common_5 ; NO - no unit to append | 1919 bra TFT_temp_common_5 ; NO - no unit to append |
1853 TSTOSS opt_units ; YES - check unit type: 0=°C, 1=°F | 1920 TSTOSS opt_units ; YES - check unit type: 0=°C, 1=°F |
1854 bra TFT_temp_common_4 ; go metric | 1921 bra TFT_temp_common_4 ; go metric |
1855 STRCAT_TEXT tLogTunitF ; append °F | 1922 STRCAT_TEXT tLogTunitF ; append °F |
1856 bra TFT_temp_common_5 | 1923 bra TFT_temp_common_5 |
1857 TFT_temp_common_4: | 1924 TFT_temp_common_4: |
1858 STRCAT_TEXT tLogTunitC ; append °C | 1925 STRCAT_TEXT tLogTunitC ; append °C |
1859 TFT_temp_common_5: | 1926 TFT_temp_common_5: |
1860 STRCAT_PRINT "" ; output to screen | 1927 STRCAT_PRINT "" ; output to screen |
1861 return | 1928 return |
1862 | 1929 |
1863 ;============================================================================= | 1930 ;============================================================================= |
1931 | |
1864 global TFT_divemode_menu_cursor | 1932 global TFT_divemode_menu_cursor |
1865 TFT_divemode_menu_cursor: | 1933 TFT_divemode_menu_cursor: |
1866 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item1_column-.8, dm_menu_item1_column-.1 | 1934 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item1_column-.8, dm_menu_item1_column-.1 |
1867 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item4_column-.8, dm_menu_item4_column-.1 | 1935 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item4_column-.8, dm_menu_item4_column-.1 |
1868 call TFT_standard_color | 1936 call TFT_standard_color |
1869 | 1937 |
1870 movlw dm_menu_item1_column-.8 | 1938 movlw dm_menu_item1_column-.8 |
1871 btfsc menupos,2 ; >3? | 1939 btfsc menupos,2 ; >3? |
1872 movlw dm_menu_item4_column-.8 ; Yes | 1940 movlw dm_menu_item4_column-.8 ; Yes |
1873 movff WREG,win_leftx2 | 1941 movff WREG,win_leftx2 |
1874 | 1942 |
1875 movff menupos,lo ; Copy menu pos | 1943 movff menupos,lo ; Copy menu pos |
1876 movlw dm_menu_item6_row | 1944 movlw dm_menu_item6_row |
1877 dcfsnz lo,F | 1945 dcfsnz lo,F |
1878 movlw dm_menu_item1_row | 1946 movlw dm_menu_item1_row |
1879 dcfsnz lo,F | 1947 dcfsnz lo,F |
1880 movlw dm_menu_item2_row | 1948 movlw dm_menu_item2_row |
1885 dcfsnz lo,F | 1953 dcfsnz lo,F |
1886 movlw dm_menu_item5_row | 1954 movlw dm_menu_item5_row |
1887 movff WREG,win_top | 1955 movff WREG,win_top |
1888 movlw FT_SMALL | 1956 movlw FT_SMALL |
1889 movff WREG,win_font | 1957 movff WREG,win_font |
1890 STRCPY_PRINT "\xb7" ; print cursor | 1958 STRCPY_PRINT "\xb7" ; print cursor |
1891 return | 1959 return |
1892 | 1960 |
1893 TFT_active_setpoint2: | |
1894 movff char_I_const_ppO2,lo | |
1895 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo | |
1896 clrf hi | |
1897 bsf leftbind | |
1898 output_16dp d'3' | |
1899 bcf leftbind | |
1900 STRCAT_TEXT tbar | |
1901 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP | |
1902 sublw .1 ; opt_ccr_mode = 1 (Sensor)? | |
1903 bnz TFT_active_setpoint2_a ; No, skip | |
1904 PUTC "*" | |
1905 TFT_active_setpoint2_a: | |
1906 STRCAT_PRINT "" | |
1907 return | |
1908 | |
1909 TFT_active_setpoint: ; Show setpoint | |
1910 WIN_STD dm_active_gas_column, dm_active_gas_row | |
1911 call TFT_standard_color | |
1912 btfsc is_bailout ; =1: Bailout | |
1913 bra TFT_active_setpoint_bail ; Show "Bailout" instead of Setpoint | |
1914 | |
1915 rcall TFT_active_setpoint2 ; show setpoint (Non-Inverted in all cases) | |
1916 | |
1917 ; ****** new from R.L.****** | |
1918 btg blinking_setpoint ; Toggle blink bit... | |
1919 | |
1920 btfss blinking_setpoint ; blink now? | |
1921 bra TFT_active_setpoint_diluent ; no - Done. If no blink now, no need to do all checks | |
1922 | |
1923 btfsc setpoint_fallback ; =1: Fallback to SP1 due to external O2 sensor failure | |
1924 bra TFT_active_setpoint_b ; not clear, so process fallback case | |
1925 | |
1926 movff char_I_const_ppO2, lo ; get current ppO2 | |
1927 movff opt_ppO2_max, WREG ; PPO2 Max for MOD calculation and color coding | |
1928 cpfsgt lo ; lo > opt_ppO2_max? | |
1929 Bra TFT_active_setpoint_d ; No ? continue with checking for low ppO2 condition | |
1930 Bra TFT_active_setpoint_e ; Yes ? set up blinking for ppO2 problem case | |
1931 | |
1932 TFT_active_setpoint_d: | |
1933 movff opt_ppO2_min, WREG ; PPO2 min for Sensors and color coding | |
1934 cpfslt lo ; lo < opt_ppO2_min? | |
1935 bra TFT_active_setpoint_diluent ; No ? ppO2 is ok, continue with displaying diluent | |
1936 ;bra TFT_active_setpoint_e ; Yes ? set up blinking for ppO2 problem case | |
1937 | |
1938 TFT_active_setpoint_e: ; set up blinking for ppO2 problem case | |
1939 movlw color_red ; blink in red | |
1940 call TFT_set_color | |
1941 bra TFT_active_setpoint_c ; continue with blinking common part | |
1942 TFT_active_setpoint_b: ; set up blinking for fallback case | |
1943 movlw color_yellow ; blink in yellow | |
1944 call TFT_set_color | |
1945 ; bra TFT_active_setpoint_c ; just for clarity in the code | |
1946 TFT_active_setpoint_c: ; blinking common part | |
1947 ; ****** new from R.L.****** | |
1948 | |
1949 bsf win_invert ; Set invert flag | |
1950 WIN_STD dm_active_gas_column, dm_active_gas_row | |
1951 movff char_I_const_ppO2,lo | |
1952 clrf hi | |
1953 bsf leftbind | |
1954 output_16dp d'3' | |
1955 bcf leftbind | |
1956 STRCAT_TEXT tbar | |
1957 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP | |
1958 sublw .1 ; opt_ccr_mode = 1 (Sensor)? | |
1959 bnz TFT_active_setpoint_a ; No, skip | |
1960 PUTC "*" | |
1961 TFT_active_setpoint_a: | |
1962 STRCAT_PRINT "" | |
1963 bcf win_invert ; Reset invert flag | |
1964 | |
1965 TFT_active_setpoint_diluent: | |
1966 call TFT_standard_color | |
1967 if dm_offset != 0 | |
1968 WIN_SMALL dm_active_dil_column, dm_active_dil_row | |
1969 else | |
1970 WIN_STD dm_active_dil_column, dm_active_dil_row | |
1971 endif | |
1972 movff char_I_O2_ratio,lo ; lo now stores O2 in % | |
1973 movff char_I_He_ratio,hi ; hi now stores He in % | |
1974 rcall TFT_show_dil_divemode2 ; Show diluent (Non-Inverted in all cases) | |
1975 | |
1976 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode | |
1977 return ; Done. | |
1978 btg blinking_better_gas ; Toggle blink bit... | |
1979 btfss blinking_better_gas ; blink now? | |
1980 return ; No, Done. | |
1981 | |
1982 movlw color_yellow ; Blink in yellow | |
1983 call TFT_set_color | |
1984 bsf win_invert ; Set invert flag | |
1985 if dm_offset != 0 | |
1986 WIN_SMALL dm_active_dil_column, dm_active_dil_row | |
1987 else | |
1988 WIN_STD dm_active_dil_column, dm_active_dil_row | |
1989 endif | |
1990 movff char_I_O2_ratio,lo ; lo now stores O2 in % | |
1991 movff char_I_He_ratio,hi ; hi now stores He in % | |
1992 rcall TFT_show_dil_divemode2 ; Show gas | |
1993 bcf win_invert ; Reset invert flag | |
1994 goto TFT_standard_color; and return... | |
1995 | |
1996 TFT_show_dil_divemode2: | |
1997 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | |
1998 STRCAT_PRINT "" | |
1999 return | |
2000 | |
2001 TFT_active_setpoint_bail: | |
2002 WIN_SMALL dm_active_gas_column, dm_active_gas_row+.3 ; colides with diluent in FT_MEDIUM | |
2003 STRCPY_TEXT_PRINT tDiveBailout ; Bailout | |
2004 bra TFT_active_setpoint_diluent | |
2005 | |
2006 TFT_show_pscr_mode_divemode: | |
2007 WIN_TINY dm_active_dil_column, dm_active_dil_row+.1 | |
2008 btfsc is_bailout ; =1: Bailout | |
2009 bra TFT_show_pscr_mode_divemode_bail ; Show "Bailout" instead of PSCR | |
2010 STRCPY_TEXT_PRINT tDvPSCR ; PSCR | |
2011 return | |
2012 | |
2013 TFT_show_pscr_mode_divemode_bail: | |
2014 STRCPY_TEXT_PRINT tDiveBailout ; Bailout | |
2015 return | |
2016 | |
2017 global TFT_active_gas_divemode | 1961 global TFT_active_gas_divemode |
2018 TFT_active_gas_divemode: ; Display gas/Setpoint | 1962 TFT_active_gas_divemode: ; Display gas/Setpoint |
1963 bcf FLAG_TFT_active_gas_divemode | |
2019 btfsc divemode_menu ; Is the dive mode menu shown? | 1964 btfsc divemode_menu ; Is the dive mode menu shown? |
2020 return ; Yes, return | 1965 return ; Yes, return |
2021 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode | 1966 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode |
2022 return | 1967 return |
2023 btfsc FLAG_ccr_mode ; in CCR mode? | 1968 btfsc FLAG_ccr_mode ; in CCR mode? |
2024 bra TFT_active_setpoint ; Yes, show setpoint | 1969 bra TFT_active_setpoint ; Yes, show setpoint and gas mix |
2025 | 1970 btfsc FLAG_pscr_mode ; in PSCR mode? |
2026 call TFT_standard_color | 1971 bra TFT_active_setpoint ; Yes, show setpoint and gas mix |
2027 | 1972 call TFT_standard_color |
2028 btfsc FLAG_pscr_mode ; in PSCR mode? | 1973 btfss better_gas_available ; check if a better gas is available and a gas change is advised in divemode |
2029 rcall TFT_show_pscr_mode_divemode ; Yes, show "PSCR" | 1974 bra TFT_active_gas_divemode2 ; NO - print in normal rendering |
2030 | 1975 btg blinking_better_gas ; YES - toggle blink bit |
2031 WIN_STD dm_active_gas_column, dm_active_gas_row | 1976 btfss blinking_better_gas ; blink now? |
2032 movff char_I_O2_ratio,lo ; lo now stores O2 in % | 1977 bra TFT_active_gas_divemode2 ; NO - print in normal rendering |
2033 movff char_I_He_ratio,hi ; hi now stores He in % | 1978 call TFT_attention_color ; YES - blink in yellow |
2034 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases) | 1979 bsf win_invert ; set invert flag |
2035 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode | 1980 TFT_active_gas_divemode2: |
2036 return ; Done. | |
2037 | |
2038 btg blinking_better_gas ; Toggle blink bit... | |
2039 btfss blinking_better_gas ; blink now? | |
2040 return ; No, Done. | |
2041 call TFT_attention_color ; blink in yellow | |
2042 bsf win_invert ; Set invert flag | |
2043 WIN_STD dm_active_gas_column, dm_active_gas_row | 1981 WIN_STD dm_active_gas_column, dm_active_gas_row |
2044 movff char_I_O2_ratio,lo ; lo now stores O2 in % | 1982 movff char_I_O2_ratio,lo ; lo now stores O2 in % |
2045 movff char_I_He_ratio,hi ; hi now stores He in % | 1983 movff char_I_He_ratio,hi ; hi now stores He in % |
2046 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases) | 1984 call customview_show_mix ; put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 |
2047 bcf win_invert ; Reset invert flag | 1985 STRCAT_PRINT "" |
1986 bcf win_invert ; reset invert flag | |
1987 goto TFT_standard_color ; ...and return | |
1988 | |
1989 TFT_active_setpoint: ; Show setpoint | |
1990 btfsc is_bailout ; are we in bailout? | |
1991 bra TFT_active_setpoint_bail ; YES - show "Bailout" instead of setpoint | |
1992 movff int_O_breathed_ppO2+0,lo | |
1993 movff int_O_breathed_ppO2+1,hi | |
1994 TFT_color_code warn_ppo2 ; with ppO2 [cbar] in hi:lo | |
1995 btg blinking_setpoint ; toggle blink bit... | |
1996 btfss blinking_setpoint ; blink now? | |
1997 bra TFT_active_setpoint_print ; NO - print ppO2 with normal rendering | |
1998 btfsc setpoint_fallback ; YES - check if we are in fallback condition | |
1999 bra TFT_active_setpoint_fallb ; YES - process fallback case | |
2000 movff int_O_breathed_ppO2+1,WREG ; NO - get flags again (have been cleared in hi:lo by TFT_color_code meanwhile) | |
2001 btfss WREG,int_warning_flag ; warning flag set? | |
2002 bra TFT_active_setpoint_print ; NO - ppO2 is ok, print ppO2 with normal rendering | |
2003 bra TFT_active_setpoint_com ; YES - continue with blinking common part | |
2004 TFT_active_setpoint_fallb: ; set up fallback case | |
2005 movlw color_yellow ; text in yellow | |
2006 call TFT_set_color ; overwrite setting done by TFT_color_code warn_ppo2 | |
2007 TFT_active_setpoint_com: ; blinking common part | |
2008 bsf win_invert ; set invert flag | |
2009 TFT_active_setpoint_print: | |
2010 WIN_STD dm_active_gas_column, dm_active_gas_row | |
2011 bsf leftbind | |
2012 output_16dp .3 ; x.xx bar | |
2013 bcf leftbind | |
2014 STRCAT_TEXT tbar | |
2015 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP | |
2016 sublw .1 ; opt_ccr_mode = 1 (Sensor)? | |
2017 bnz TFT_active_setpoint2_a ; NO - skip | |
2018 PUTC "*" ; YES - add an astrix | |
2019 TFT_active_setpoint2_a: | |
2020 STRCAT_PRINT "" | |
2021 bcf win_invert ; reset invert flag | |
2022 call TFT_standard_color ; revert to standard color | |
2023 bra TFT_active_setpoint_diluent ; continue with showing diluent | |
2024 TFT_active_setpoint_bail: | |
2025 WIN_SMALL dm_active_gas_column, dm_active_gas_row+.3 ; collides with diluent in FT_MEDIUM | |
2048 call TFT_standard_color | 2026 call TFT_standard_color |
2049 return ; Done. | 2027 STRCPY_TEXT_PRINT tDiveBailout ; Bailout |
2050 | 2028 TFT_active_setpoint_diluent: |
2051 TFT_active_gas_divemode2: | 2029 btfss better_gas_available ; check if a better gas is available and a gas change is advised in divemode |
2052 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | 2030 bra TFT_active_setpoint_diluent_show ; NO - print in normal rendering |
2031 btg blinking_better_gas ; YES - toggle blink bit... | |
2032 btfss blinking_better_gas ; blink now? | |
2033 bra TFT_active_setpoint_diluent_show ; NO - print in normal rendering | |
2034 movlw color_yellow ; YES - blink in yellow | |
2035 call TFT_set_color ; set text color | |
2036 bsf win_invert ; set invert flag | |
2037 TFT_active_setpoint_diluent_show: | |
2038 WIN_SMALL dm_active_dil_column, dm_active_dil_row | |
2039 movff char_I_O2_ratio,lo ; lo now stores O2 in % | |
2040 movff char_I_He_ratio,hi ; hi now stores He in % | |
2041 call customview_show_mix ; put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | |
2053 STRCAT_PRINT "" | 2042 STRCAT_PRINT "" |
2054 return | 2043 bcf win_invert ; reset invert flag |
2044 goto TFT_standard_color ; ...and return | |
2045 | |
2046 | |
2047 global TFT_show_mode_divemode | |
2048 TFT_show_mode_divemode: | |
2049 WIN_TINY dm_active_dil_column+.45, dm_active_dil_row+.3 | |
2050 btfsc is_bailout ; in bailout? | |
2051 return ; YES | |
2052 btfsc FLAG_ccr_mode ; NO - in CCR mode? | |
2053 bra TFT_show_mode_divemode_ccr ; YES - write CCR label | |
2054 btfsc FLAG_pscr_mode ; NO - in pSCR mode? | |
2055 bra TFT_show_mode_divemode_pscr ; YES - write pSCR label | |
2056 return ; NO - done | |
2057 TFT_show_mode_divemode_ccr: | |
2058 call TFT_standard_color ; set standard color | |
2059 STRCPY_TEXT_PRINT tDvCCR ; print "CCR" | |
2060 return ; done | |
2061 TFT_show_mode_divemode_pscr: | |
2062 call TFT_standard_color ; set standard color | |
2063 STRCPY_TEXT_PRINT tDvPSCR ; print "PSCR" | |
2064 return | |
2065 | |
2055 | 2066 |
2056 global TFT_display_decotype_surface | 2067 global TFT_display_decotype_surface |
2057 TFT_display_decotype_surface: | 2068 TFT_display_decotype_surface: |
2058 WIN_STD surf_decotype_column,surf_decotype_row | 2069 WIN_STD surf_decotype_column,surf_decotype_row |
2059 WIN_COLOR color_lightblue | 2070 WIN_COLOR color_lightblue |
2060 movff opt_dive_mode,lo ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR | 2071 movff opt_dive_mode,lo ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR |
2061 tstfsz lo | 2072 tstfsz lo |
2062 bra TFT_display_decotype_surface2 | 2073 bra TFT_display_decotype_surface2 |
2063 TFT_display_decotype_surface0: | 2074 TFT_display_decotype_surface0: |
2064 STRCAT_TEXT_PRINT tDvOC ; OC | 2075 STRCAT_TEXT_PRINT tDvOC ; OC |
2065 bra TFT_display_decotype_exit | 2076 bra TFT_display_decotype_exit |
2066 TFT_display_decotype_surface2: | 2077 TFT_display_decotype_surface2: |
2067 decfsz lo,F | 2078 decfsz lo,F |
2068 bra TFT_display_decotype_surface3 | 2079 bra TFT_display_decotype_surface3 |
2069 STRCAT_TEXT_PRINT tDvCC ; CC | 2080 STRCAT_TEXT_PRINT tDvCC ; CC |
2070 call TFT_standard_color | 2081 call TFT_standard_color |
2071 WIN_TINY surf_decotype_column+.18,surf_decotype_row+.12 | 2082 WIN_TINY surf_decotype_column+.18,surf_decotype_row+.12 |
2072 | 2083 TSTOSS opt_ccr_mode ; =0: Fixed SP, =1: Sensor, =2: Auto SP |
2073 TSTOSS opt_ccr_mode ; =0: Fixed SP, =1: Sensor, =2: Auto SP | |
2074 bra TFT_display_decotype_cc_fixed | 2084 bra TFT_display_decotype_cc_fixed |
2075 ; Sensor mode or Auto | 2085 ; Sensor mode or Auto |
2076 movff opt_ccr_mode,WREG | 2086 movff opt_ccr_mode,WREG |
2077 sublw .2 | 2087 sublw .2 |
2078 bz TFT_display_decotype_cc_auto | 2088 bz TFT_display_decotype_cc_auto |
2079 STRCPY_TEXT tCCRModeSensor ; Sensor | 2089 STRCPY_TEXT tCCRModeSensor ; Sensor |
2080 bra TFT_display_decotype_cc_common | 2090 bra TFT_display_decotype_cc_common |
2081 TFT_display_decotype_cc_auto: | 2091 TFT_display_decotype_cc_auto: |
2082 STRCPY_TEXT tCCRModeAutoSP ; Auto SP | 2092 STRCPY_TEXT tCCRModeAutoSP ; Auto SP |
2083 bra TFT_display_decotype_cc_common | 2093 bra TFT_display_decotype_cc_common |
2084 TFT_display_decotype_cc_fixed: | 2094 TFT_display_decotype_cc_fixed: |
2085 STRCPY_TEXT tCCRModeFixedSP ; Fixed SP | 2095 STRCPY_TEXT tCCRModeFixedSP ; Fixed SP |
2086 TFT_display_decotype_cc_common: | 2096 TFT_display_decotype_cc_common: |
2097 clrf WREG | |
2098 movff WREG,buffer+.8 ; limit string length to 8 | |
2087 STRCAT_PRINT "" | 2099 STRCAT_PRINT "" |
2088 bra TFT_display_decotype_exit | 2100 bra TFT_display_decotype_exit |
2089 | |
2090 TFT_display_decotype_surface3: | 2101 TFT_display_decotype_surface3: |
2091 decfsz lo,F | 2102 decfsz lo,F |
2092 bra TFT_display_decotype_surface4 | 2103 bra TFT_display_decotype_surface4 |
2093 TFT_display_decotype_surface3_1: | 2104 TFT_display_decotype_surface3_1: |
2094 STRCAT_TEXT_PRINT tDvGauge ; Gauge | 2105 STRCAT_TEXT_PRINT tDvGauge ; Gauge |
2095 bra TFT_display_decotype_exit | 2106 bra TFT_display_decotype_exit |
2096 TFT_display_decotype_surface4: | 2107 TFT_display_decotype_surface4: |
2097 decfsz lo,F | 2108 decfsz lo,F |
2098 bra TFT_display_decotype_surface5 | 2109 bra TFT_display_decotype_surface5 |
2099 TFT_display_decotype_surface4_1: | 2110 TFT_display_decotype_surface4_1: |
2100 STRCAT_TEXT_PRINT tDvApnea ; Apnea | 2111 STRCAT_TEXT_PRINT tDvApnea ; Apnea |
2101 bra TFT_display_decotype_exit | 2112 bra TFT_display_decotype_exit |
2102 TFT_display_decotype_surface5: | 2113 TFT_display_decotype_surface5: |
2103 STRCAT_TEXT_PRINT tDvPSCR ; PSCR | 2114 STRCAT_TEXT_PRINT tDvPSCR ; PSCR |
2104 TFT_display_decotype_exit: | 2115 TFT_display_decotype_exit: |
2105 goto TFT_standard_color ; and return... | 2116 goto TFT_standard_color ; and return... |
2117 | |
2106 | 2118 |
2107 global TFT_display_decotype_surface1 ; Used from logbook! | 2119 global TFT_display_decotype_surface1 ; Used from logbook! |
2108 TFT_display_decotype_surface1: ; Used from logbook! | 2120 TFT_display_decotype_surface1: ; Used from logbook! |
2109 tstfsz lo | 2121 tstfsz lo |
2110 bra TFT_display_decotype_surface1_2 | 2122 bra TFT_display_decotype_surface1_2 |
2111 bra TFT_display_decotype_surface0 ;OC | 2123 bra TFT_display_decotype_surface0 ;OC |
2112 TFT_display_decotype_surface1_2: | 2124 TFT_display_decotype_surface1_2: |
2113 decfsz lo,F | 2125 decfsz lo,F |
2122 bra TFT_display_decotype_surface4_1 ; Apnea | 2134 bra TFT_display_decotype_surface4_1 ; Apnea |
2123 bra TFT_display_decotype_surface5 ; PSCR | 2135 bra TFT_display_decotype_surface5 ; PSCR |
2124 | 2136 |
2125 ;============================================================================= | 2137 ;============================================================================= |
2126 | 2138 |
2127 global TFT_splist_surfmode ; Show Setpoint list | 2139 global TFT_splist_surfmode ; Show Setpoint list |
2128 extern gaslist_strcat_setpoint | 2140 extern gaslist_strcat_setpoint |
2129 TFT_splist_surfmode: | 2141 TFT_splist_surfmode: |
2130 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | 2142 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint |
2131 ;SP 1 | 2143 ;SP 1 |
2132 WIN_SMALL surf_gaslist_column,surf_gaslist_row | 2144 WIN_SMALL surf_gaslist_column,surf_gaslist_row |
2133 clrf PRODL | 2145 clrf PRODL |
2134 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | 2146 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# |
2135 STRCAT_PRINT "" | 2147 STRCAT_PRINT "" |
2206 | 2218 |
2207 ;================================================================== | 2219 ;================================================================== |
2208 | 2220 |
2209 global TFT_depth | 2221 global TFT_depth |
2210 TFT_depth: | 2222 TFT_depth: |
2223 bcf FLAG_TFT_depth | |
2211 SAFE_2BYTE_COPY rel_pressure, lo | 2224 SAFE_2BYTE_COPY rel_pressure, lo |
2212 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 2225 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
2213 | 2226 |
2214 TFT_color_code warn_depth ; Color-code the output | 2227 TFT_color_code warn_depth ; Color-code the output |
2215 call TFT_depth_blink | 2228 rcall TFT_depth_blink |
2216 WIN_LARGE dm_depth_column, dm_depth_row | 2229 WIN_LARGE dm_depth_column, dm_depth_row |
2217 | 2230 |
2218 TSTOSS opt_units ; 0=m, 1=ft | 2231 TSTOSS opt_units ; 0=m, 1=ft |
2219 bra TFT_depth_metric | 2232 bra TFT_depth_metric |
2220 ;TFT_depth_imperial | 2233 ;TFT_depth_imperial |
2221 clrf sub_a+1 ; Display 0ft if lower then 30cm | 2234 clrf sub_a+1 ; Display 0ft if lower then 30cm |
2222 movlw d'30' | 2235 movlw d'30' |
2223 movwf sub_a+0 | 2236 movwf sub_a+0 |
2224 movff hi,sub_b+1 | 2237 movff hi,sub_b+1 |
2225 movff lo,sub_b+0 | 2238 movff lo,sub_b+0 |
2226 call subU16 ; sub_c = sub_a - sub_b | 2239 call subU16 ; sub_c = sub_a - sub_b |
2237 bcf win_invert ; Reset invert flag | 2250 bcf win_invert ; Reset invert flag |
2238 return | 2251 return |
2239 | 2252 |
2240 depth_less_0.3mtr_feet: | 2253 depth_less_0.3mtr_feet: |
2241 STRCAT_PRINT "0 " ; manual zero | 2254 STRCAT_PRINT "0 " ; manual zero |
2242 bcf win_invert ; Reset invert flag | 2255 bcf win_invert ; Reset invert flag |
2243 return | 2256 return |
2244 | 2257 |
2245 TFT_depth_metric: | 2258 TFT_depth_metric: |
2246 movlw .039 | 2259 movlw .039 |
2247 cpfslt hi | 2260 cpfslt hi |
2248 bra depth_greater_99_84mtr | 2261 bra depth_greater_99_84mtr |
2249 | 2262 |
2250 btfsc depth_greater_100m ; Was depth>100m during last call | 2263 btfsc depth_greater_100m ; Was depth>100m during last call |
2251 rcall TFT_clear_depth ; Yes, clear depth area | 2264 rcall TFT_clear_depth ; Yes, clear depth area |
2252 bcf depth_greater_100m ; Do this once only... | 2265 bcf depth_greater_100m ; Do this once only... |
2253 | 2266 |
2254 movlw .039 | 2267 movlw .039 |
2255 cpfslt hi | 2268 cpfslt hi |
2256 bra depth_greater_99_84mtr | 2269 bra depth_greater_99_84mtr |
2257 | 2270 |
2290 tft_depth3: | 2303 tft_depth3: |
2291 STRCAT_PRINT "" ; Display full meters | 2304 STRCAT_PRINT "" ; Display full meters |
2292 | 2305 |
2293 ; .1m in MEDIUM font | 2306 ; .1m in MEDIUM font |
2294 WIN_MEDIUM dm_depth_dm_column, dm_depth_dm_row | 2307 WIN_MEDIUM dm_depth_dm_column, dm_depth_dm_row |
2295 TFT_color_code warn_depth ; Color-code the output | 2308 |
2296 | 2309 ; TODO - check if needed, depth should still be in hi:lo |
2297 SAFE_2BYTE_COPY rel_pressure, lo | 2310 SAFE_2BYTE_COPY rel_pressure, lo |
2298 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 2311 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
2299 | 2312 |
2313 TFT_color_code warn_depth ; Color-code the output | |
2314 | |
2300 PUTC "." | 2315 PUTC "." |
2301 movlw HIGH d'30' ; Display 0.0m if lower then 30cm | 2316 movlw HIGH d'30' ; Display 0.0m if lower then 30cm |
2302 movwf sub_a+1 | 2317 movwf sub_a+1 |
2303 movlw LOW d'30' | 2318 movlw LOW d'30' |
2304 movwf sub_a+0 | 2319 movwf sub_a+0 |
2311 movlw d'4' | 2326 movlw d'4' |
2312 movwf ignore_digits | 2327 movwf ignore_digits |
2313 bsf ignore_digit5 | 2328 bsf ignore_digit5 |
2314 output_16dp d'0' | 2329 output_16dp d'0' |
2315 STRCAT_PRINT "" ; Display decimeters | 2330 STRCAT_PRINT "" ; Display decimeters |
2316 bcf win_invert ; Reset invert flag | 2331 bcf win_invert ; Reset invert flag |
2317 WIN_FONT FT_SMALL | 2332 WIN_FONT FT_SMALL |
2318 return | 2333 return |
2319 | 2334 |
2320 depth_less_0.3mtr: | 2335 depth_less_0.3mtr: |
2321 STRCAT_PRINT "0" ; Display 0.0m manually | 2336 STRCAT_PRINT "0" ; Display 0.0m manually |
2322 bcf win_invert ; Reset invert flag | 2337 bcf win_invert ; Reset invert flag |
2323 WIN_FONT FT_SMALL | 2338 WIN_FONT FT_SMALL |
2324 return | 2339 return |
2325 | 2340 |
2326 depth_greater_99_84mtr: ; Display only in full meters | 2341 depth_greater_99_84mtr: ; Display only in full meters |
2327 btfss depth_greater_100m ; Is depth>100m already? | 2342 btfss depth_greater_100m ; Is depth>100m already? |
2328 rcall TFT_clear_depth ; No, clear depth area and set flag | 2343 rcall TFT_clear_depth ; No, clear depth area and set flag |
2329 TFT_color_code warn_depth | 2344 TFT_color_code warn_depth |
2330 ; Depth is already in hi:lo | 2345 ; Depth is already in hi:lo |
2331 ; Show depth in Full meters | 2346 ; Show depth in Full meters |
2332 ; That means ignore figure 4 and 5 | 2347 ; That means ignore digit 4 and 5 |
2333 lfsr FSR2,buffer | 2348 lfsr FSR2,buffer |
2334 bsf ignore_digit4 | 2349 bsf ignore_digit4 |
2335 bsf leftbind | 2350 bsf leftbind |
2336 output_16 | 2351 output_16 |
2337 bcf leftbind | 2352 bcf leftbind |
2338 STRCAT_PRINT "" ; Display full meters only | 2353 STRCAT_PRINT "" ; Display full meters only |
2339 bcf win_invert ; Reset invert flag | 2354 bcf win_invert ; Reset invert flag |
2340 WIN_FONT FT_SMALL | 2355 WIN_FONT FT_SMALL |
2341 return | 2356 return |
2342 | 2357 |
2343 TFT_clear_depth: ; No, clear depth area and set flag | 2358 TFT_clear_depth: ; No, clear depth area and set flag |
2344 WIN_BOX_BLACK dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right | 2359 WIN_BOX_BLACK dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right |
2345 bsf depth_greater_100m ; Set Flag | 2360 bsf depth_greater_100m ; Set Flag |
2346 return | 2361 return |
2347 | 2362 |
2348 TFT_depth_blink: | 2363 TFT_depth_blink: |
2349 TSTOSS opt_modwarning ; 0=standard, 1=blink | 2364 TSTOSS opt_modwarning ; 0=standard, 1=blink |
2350 return | 2365 return |
2351 | 2366 |
2352 ; check if previous cycle had the blinking warning or not | 2367 ; check if previous cycle had the blinking warning or not |
2353 btfsc blinking_depth_prev ; did we have warning prev? | 2368 btfsc blinking_depth_prev ; did we have warning prev? |
2354 bra TFT_depth_blink_prevwarn ; Yes | 2369 bra TFT_depth_blink_prevwarn ; Yes |
2371 | 2386 |
2372 ; we still have the warning, set previous flag for next cycle... | 2387 ; we still have the warning, set previous flag for next cycle... |
2373 bsf blinking_depth_prev ; set prev flag | 2388 bsf blinking_depth_prev ; set prev flag |
2374 ; and set toggle and invert if required | 2389 ; and set toggle and invert if required |
2375 btfss blinking_depth_toggle ; do we have the toggle set? | 2390 btfss blinking_depth_toggle ; do we have the toggle set? |
2376 bra TFT_depth_blink_set ; No: set inverse, do color_box, set flag | 2391 bra TFT_depth_blink_set ; No: set inverse, do color_box, set flag |
2377 bra TFT_depth_blink_reset ; Yes: clear inverse, do black box, reset flag | 2392 bra TFT_depth_blink_reset ; Yes: clear inverse, do black box, reset flag |
2378 | 2393 |
2379 TFT_depth_blink_prevwarn_nowarn: | 2394 TFT_depth_blink_prevwarn_nowarn: |
2380 ; we had warning, but not now... (e.g. ascended or switched to better gas) | 2395 ; we had warning, but not now... (e.g. ascended or switched to better gas) |
2381 ; reset the previous cycle flag for the next cycle... | 2396 ; reset the previous cycle flag for the next cycle... |
2382 bcf blinking_depth_prev ; reset prev flag | 2397 bcf blinking_depth_prev ; reset prev flag |
2383 ; clear it - just in case if we had a blinked before | 2398 ; clear it - just in case if we had a blinked before |
2384 bra TFT_depth_blink_reset ; Yes: clear inverse, do black box, reset flag | 2399 bra TFT_depth_blink_reset ; Yes: clear inverse, do black box, reset flag |
2385 | 2400 |
2386 TFT_depth_blink_warn: | 2401 TFT_depth_blink_warn: |
2387 ; new blinking warning activated (had no warning in previous cycle) | 2402 ; new blinking warning activated (had no warning in previous cycle) |
2414 return | 2429 return |
2415 | 2430 |
2416 ;============================================================================= | 2431 ;============================================================================= |
2417 | 2432 |
2418 global TFT_custom_text | 2433 global TFT_custom_text |
2419 TFT_custom_text: ; Show the custom text | 2434 TFT_custom_text: ; Show the custom text |
2420 lfsr FSR0, opt_name ; Source | 2435 lfsr FSR0, opt_name ; Source |
2421 WIN_SMALL surf_customtext_column,surf_customtext_row1 ; First row | 2436 WIN_SMALL surf_customtext_column,surf_customtext_row1 ; First row |
2422 rcall TFT_custom_text_2 ; Show up to 12 chars and print | 2437 rcall TFT_custom_text_2 ; Show up to 12 chars and print |
2423 incfsz lo,F ; Was lo=255? | 2438 incfsz lo,F ; Was lo=255? |
2424 return ; No, all done. | 2439 return ; No, all done. |
2437 rcall TFT_custom_text_2 ; Show up to 12 chars and print | 2452 rcall TFT_custom_text_2 ; Show up to 12 chars and print |
2438 incfsz lo,F ; Was lo=255? | 2453 incfsz lo,F ; Was lo=255? |
2439 return ; No, all done. | 2454 return ; No, all done. |
2440 lfsr FSR0, opt_name+.48 ; Source | 2455 lfsr FSR0, opt_name+.48 ; Source |
2441 WIN_SMALL surf_customtext_column,surf_customtext_row5 ; Fifth row | 2456 WIN_SMALL surf_customtext_column,surf_customtext_row5 ; Fifth row |
2442 bra TFT_custom_text_2 ; Show up to 12 chars and print ; and return... | 2457 bra TFT_custom_text_2 ; Show up to 12 chars and print ; and return... |
2443 | 2458 |
2444 | 2459 |
2445 TFT_custom_text_2: | 2460 TFT_custom_text_2: |
2446 lfsr FSR2, buffer ; destination | 2461 lfsr FSR2, buffer ; destination |
2447 movlw .12 | 2462 movlw .12 |
2448 movwf lo ; length/line | 2463 movwf lo ; length/line |
2457 clrf POSTINC2 ; Mark end of string | 2472 clrf POSTINC2 ; Mark end of string |
2458 goto aa_wordprocessor ; print and return | 2473 goto aa_wordprocessor ; print and return |
2459 | 2474 |
2460 | 2475 |
2461 ;============================================================================= | 2476 ;============================================================================= |
2477 | |
2462 global TFT_update_surf_press | 2478 global TFT_update_surf_press |
2463 TFT_update_surf_press: | 2479 TFT_update_surf_press: |
2464 WIN_SMALL surf_press_column,surf_press_row | 2480 WIN_SMALL surf_press_column,surf_press_row |
2465 call TFT_standard_color | 2481 call TFT_standard_color |
2466 SAFE_2BYTE_COPY amb_pressure, lo | 2482 SAFE_2BYTE_COPY amb_pressure, lo |
2467 movff lo,sub_a+0 | 2483 movff lo,sub_a+0 |
2468 movff hi,sub_a+1 | 2484 movff hi,sub_a+1 |
2469 movff last_surfpressure_30min+0,sub_b+0 | 2485 movff last_surfpressure_30min+0,sub_b+0 |
2470 movff last_surfpressure_30min+1,sub_b+1 | 2486 movff last_surfpressure_30min+1,sub_b+1 |
2471 call subU16 ; sub_c = sub_a - sub_b | 2487 call subU16 ; sub_c = sub_a - sub_b |
2472 btfsc neg_flag ; Pressure lower? | 2488 btfsc neg_flag ; Pressure lower? |
2473 rcall update_surf_press2 ; Yes, test threshold | 2489 rcall update_surf_press2 ; Yes, test threshold |
2474 | 2490 tstfsz sub_c+1 ; >255mbar difference? |
2475 tstfsz sub_c+1 ; >255mbar difference? | 2491 bra update_surf_press_common ; Yes, display! |
2476 bra update_surf_press_common; Yes, display! | 2492 movlw d'11' ; 10mbar noise suppression |
2477 movlw d'10' ; 10mbar noise suppression | |
2478 subwf sub_c+0,W | 2493 subwf sub_c+0,W |
2479 btfsc STATUS,C | 2494 btfsc STATUS,C |
2480 bra update_surf_press_common; Yes, display! | 2495 bra update_surf_press_common ; Yes, display! |
2481 SAFE_2BYTE_COPY last_surfpressure_30min, lo ; Overwrite with stable value... | 2496 SAFE_2BYTE_COPY last_surfpressure_30min, lo ; Overwrite with stable value... |
2482 | |
2483 update_surf_press_common: | 2497 update_surf_press_common: |
2498 movff lo,int_I_pres_surface+0 ; copy displayed value to C code to have pressure displayed | |
2499 movff hi,int_I_pres_surface+1 ; and pressure used for desaturation & no-fly time in sync | |
2484 output_16 | 2500 output_16 |
2485 ; Show only 4 figures | 2501 ; Show only 4 digits |
2486 movff buffer+1,buffer+0 | 2502 movff buffer+1,buffer+0 |
2487 movff buffer+2,buffer+1 | 2503 movff buffer+2,buffer+1 |
2488 movff buffer+3,buffer+2 | 2504 movff buffer+3,buffer+2 |
2489 movff buffer+4,buffer+3 | 2505 movff buffer+4,buffer+3 |
2490 movlw 0x00 | 2506 movlw 0x00 |
2491 movff WREG,buffer+4 | 2507 movff WREG,buffer+4 |
2492 STRCAT_PRINT "" | 2508 STRCAT_PRINT "" |
2493 call TFT_divemask_color | 2509 call TFT_divemask_color |
2494 WIN_SMALL surf_press_column+4*8,surf_press_row | 2510 WIN_SMALL surf_press_column+4*8,surf_press_row |
2495 STRCPY_TEXT_PRINT tMBAR ; mbar | 2511 STRCPY_TEXT_PRINT tMBAR ; mbar |
2496 return | 2512 return |
2497 | 2513 |
2498 update_surf_press2: | 2514 update_surf_press2: |
2499 movff lo,sub_b+0 | 2515 movff lo,sub_b+0 |
2500 movff hi,sub_b+1 | 2516 movff hi,sub_b+1 |
2501 movff last_surfpressure_30min+0,sub_a+0 | 2517 movff last_surfpressure_30min+0,sub_a+0 |
2502 movff last_surfpressure_30min+1,sub_a+1 | 2518 movff last_surfpressure_30min+1,sub_a+1 |
2503 goto subU16 ; sub_c = sub_a - sub_b ; and return... | 2519 goto subU16 ; sub_c = sub_a - sub_b ; and return... |
2504 | |
2505 | 2520 |
2506 ;============================================================================= | 2521 ;============================================================================= |
2507 | 2522 |
2508 global TFT_update_batt_voltage | 2523 global TFT_update_batt_voltage |
2509 TFT_update_batt_voltage: | 2524 TFT_update_batt_voltage: |
2510 movff batt_percent,lo ; Get battery percent | 2525 movff batt_percent,lo ; Get battery percent |
2511 TFT_color_code warn_battery; Color-code battery percent | 2526 TFT_color_code warn_battery ; Color-code battery percent |
2512 | |
2513 ; Setup charge indicator | 2527 ; Setup charge indicator |
2514 btfsc cc_active | 2528 btfsc cc_active |
2515 bsf win_invert | 2529 bsf win_invert |
2516 btfsc cc_active | 2530 btfsc cc_active |
2517 movlw color_yellow | 2531 movlw color_yellow |
2518 btfsc cv_active | 2532 btfsc cv_active |
2519 movlw color_green | 2533 movlw color_green |
2520 btfsc cc_active | 2534 btfsc cc_active |
2521 call TFT_set_color | 2535 call TFT_set_color |
2522 | |
2523 WIN_TINY batt_percent_column,batt_percent_row | 2536 WIN_TINY batt_percent_column,batt_percent_row |
2524 bsf leftbind | 2537 bsf leftbind |
2525 output_8 | 2538 output_8 |
2526 bcf leftbind | 2539 bcf leftbind |
2527 STRCAT "% " | 2540 STRCAT "% " |
2529 movff WREG,buffer+4 ; Only "xxx%" | 2542 movff WREG,buffer+4 ; Only "xxx%" |
2530 STRCAT_PRINT "" | 2543 STRCAT_PRINT "" |
2531 bcf win_invert | 2544 bcf win_invert |
2532 call TFT_standard_color | 2545 call TFT_standard_color |
2533 WIN_TINY batt_voltage_column,batt_voltage_row | 2546 WIN_TINY batt_voltage_column,batt_voltage_row |
2534 movff battery_type,lo ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah | 2547 movff battery_type,lo ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah |
2535 PUTC "T" | 2548 PUTC "T" |
2536 bsf leftbind | 2549 bsf leftbind |
2537 output_8 | 2550 output_8 |
2538 PUTC ":" | 2551 PUTC ":" |
2539 movff batt_voltage+0,lo | 2552 movff batt_voltage+0,lo |
2540 movff batt_voltage+1,hi | 2553 movff batt_voltage+1,hi |
2541 output_16dp .2 | 2554 output_16dp .2 |
2542 bcf leftbind | 2555 bcf leftbind |
2543 PUTC 'V' | 2556 PUTC 'V' |
2675 | 2688 |
2676 ;============================================================================= | 2689 ;============================================================================= |
2677 | 2690 |
2678 global TFT_date | 2691 global TFT_date |
2679 TFT_date: | 2692 TFT_date: |
2680 WIN_SMALL surf_date_column,surf_date_row ; Init new Wordprocessor | 2693 WIN_SMALL surf_date_column,surf_date_row ; Init new Wordprocessor |
2681 call TFT_standard_color | 2694 call TFT_standard_color |
2682 movff month,convert_value_temp+0 | 2695 movff month,convert_value_temp+0 |
2683 movff day,convert_value_temp+1 | 2696 movff day,convert_value_temp+1 |
2684 movff year,convert_value_temp+2 | 2697 movff year,convert_value_temp+2 |
2685 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | 2698 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 |
2686 STRCAT_PRINT "" | 2699 STRCAT_PRINT "" |
2687 return | 2700 return |
2688 | 2701 |
2689 ;============================================================================= | 2702 ;============================================================================= |
2690 | 2703 |
2691 global TFT_max_pressure | 2704 global TFT_max_depth_alternative |
2692 TFT_max_pressure: | 2705 TFT_max_depth_alternative: |
2693 btfsc FLAG_apnoe_mode ; different display in apnoe mode | 2706 bcf FLAG_TFT_max_depth_alt |
2694 bra TFT_max_pressure_apnoe | 2707 ; The "mask" |
2695 TFT_max_pressure2: | 2708 call TFT_divemask_color |
2709 WIN_TINY dm_mask_depth_column, dm_max_alt_row-.14 | |
2710 STRCPY_TEXT_PRINT tMaxDepth | |
2711 | |
2712 ; The max. depth | |
2713 SAFE_2BYTE_COPY max_pressure, lo | |
2714 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2715 call TFT_standard_color | |
2716 TSTOSS opt_units ; 0=m, 1=ft | |
2717 bra TFT_max_depth_alt_metric | |
2718 ;TFT_max_depth_alt_imperial: | |
2719 TFT_max_depth_alt_metric: | |
2720 WIN_LARGE dm_max_alt_column,dm_max_alt_row | |
2721 bsf ignore_digit4 ; no 0.1m | |
2722 output_16 | |
2723 STRCAT_PRINT "" | |
2724 | |
2725 WIN_MEDIUM dm_max_dm_alt_column,dm_max_alt_row+.25 | |
2726 SAFE_2BYTE_COPY max_pressure, lo | |
2727 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2728 PUTC "." | |
2729 movlw d'4' | |
2730 movwf ignore_digits | |
2731 bsf ignore_digit5 | |
2732 bsf leftbind | |
2733 output_16dp d'0' | |
2734 STRCAT_PRINT "" ; Display decimeters | |
2735 bcf leftbind | |
2736 return | |
2737 | |
2738 | |
2739 global TFT_max_depth | |
2740 TFT_max_depth: | |
2741 bcf FLAG_TFT_max_depth | |
2742 btfsc FLAG_apnoe_mode ; different display in apnoe mode | |
2743 bra TFT_max_depth_apnoe | |
2744 TFT_max_depth2: | |
2696 SAFE_2BYTE_COPY max_pressure, lo | 2745 SAFE_2BYTE_COPY max_pressure, lo |
2697 TFT_max_pressure3: | 2746 TFT_max_depth3: |
2698 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 2747 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
2699 TSTOSS opt_units ; 0=m, 1=ft | 2748 TSTOSS opt_units ; 0=m, 1=ft |
2700 bra TFT_max_pressure2_metric | 2749 bra TFT_max_depth2_metric |
2701 ;TFT_max_pressure2_imperial | 2750 ;TFT_max_depth2_imperial: |
2702 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | 2751 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
2703 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row | 2752 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row |
2704 TSTOSS opt_vsigraph ; 0=skip, 1=draw | 2753 TSTOSS opt_vsigraph ; 0=skip, 1=draw |
2705 WIN_MEDIUM dm_max_depth_column_nvsi, dm_max_depth_row | 2754 WIN_MEDIUM dm_max_depth_column_nvsi, dm_max_depth_row |
2706 call TFT_standard_color | 2755 call TFT_standard_color |
2707 output_16_3 | 2756 output_16_3 |
2708 STRCAT_PRINT "" | 2757 STRCAT_PRINT "" |
2709 return | 2758 return |
2710 | 2759 |
2711 TFT_max_pressure2_metric: | 2760 TFT_max_depth2_metric: |
2712 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row | 2761 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row |
2713 TSTOSS opt_vsigraph ; 0=skip, 1=draw | 2762 TSTOSS opt_vsigraph ; 0=skip, 1=draw |
2714 WIN_MEDIUM dm_max_depth_column_nvsi, dm_max_depth_row | 2763 WIN_MEDIUM dm_max_depth_column_nvsi, dm_max_depth_row |
2715 call TFT_standard_color | 2764 call TFT_standard_color |
2716 | 2765 |
2717 movlw .039 | 2766 movlw .039 |
2718 cpfslt hi | 2767 cpfslt hi |
2719 bra max_depth_greater_99_84mtr | 2768 bra max_depth_greater_99_84mtr |
2720 | 2769 |
2721 btfsc max_depth_greater_100m ; Was depth>100m during last call | 2770 btfsc max_depth_greater_100m ; Was depth>100m during last call |
2722 rcall TFT_clear_max_depth ; Yes, clear depth area | 2771 rcall TFT_clear_max_depth ; Yes, clear depth area |
2723 bcf max_depth_greater_100m ; Do this once only... | 2772 bcf max_depth_greater_100m ; Do this once only... |
2724 | 2773 |
2725 movlw .039 | 2774 movlw .039 |
2726 cpfslt hi | 2775 cpfslt hi |
2727 bra max_depth_greater_99_84mtr | 2776 bra max_depth_greater_99_84mtr |
2728 | 2777 |
2769 WIN_SMALL dm_max_depth_dm_column, dm_max_depth_dm_row | 2818 WIN_SMALL dm_max_depth_dm_column, dm_max_depth_dm_row |
2770 TSTOSS opt_vsigraph ; 0=skip, 1=draw | 2819 TSTOSS opt_vsigraph ; 0=skip, 1=draw |
2771 WIN_SMALL dm_max_depth_dm_column_nvsi, dm_max_depth_dm_row | 2820 WIN_SMALL dm_max_depth_dm_column_nvsi, dm_max_depth_dm_row |
2772 | 2821 |
2773 SAFE_2BYTE_COPY max_pressure, lo | 2822 SAFE_2BYTE_COPY max_pressure, lo |
2774 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 2823 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
2775 | 2824 |
2776 PUTC "." | 2825 PUTC "." |
2777 | 2826 |
2778 movlw d'4' | 2827 movlw d'4' |
2779 movwf ignore_digits | 2828 movwf ignore_digits |
2780 bsf ignore_digit5 | 2829 bsf ignore_digit5 |
2781 bsf leftbind | 2830 bsf leftbind |
2782 output_16dp d'0' | 2831 output_16dp d'0' |
2783 STRCAT_PRINT "" ; Display decimeters | 2832 STRCAT_PRINT "" ; Display decimeters |
2784 bcf leftbind | 2833 bcf leftbind |
2785 return | 2834 return |
2786 | 2835 |
2787 max_depth_greater_99_84mtr: ; Display only in full meters | 2836 max_depth_greater_99_84mtr: ; Display only in full meters |
2788 btfss max_depth_greater_100m ; Is max depth>100m already? | 2837 btfss max_depth_greater_100m ; Is max depth>100m already? |
2793 lfsr FSR2,buffer | 2842 lfsr FSR2,buffer |
2794 bsf ignore_digit4 | 2843 bsf ignore_digit4 |
2795 bsf leftbind | 2844 bsf leftbind |
2796 output_16 | 2845 output_16 |
2797 bcf leftbind | 2846 bcf leftbind |
2798 STRCAT_PRINT "" ; Display full meters only | 2847 STRCAT_PRINT "" ; Display full meters only |
2799 WIN_FONT FT_SMALL | 2848 WIN_FONT FT_SMALL |
2800 return | 2849 return |
2801 | 2850 |
2802 TFT_clear_max_depth: ; No, clear max. depth area and set flag | 2851 TFT_clear_max_depth: ; No, clear max. depth area and set flag |
2803 WIN_BOX_BLACK dm_max_depth_row, dm_max_depth_bot, dm_max_depth_column, dm_max_depth_rgt ;top, bottom, left, right | 2852 WIN_BOX_BLACK dm_max_depth_row, dm_max_depth_bot, dm_max_depth_column, dm_max_depth_rgt ;top, bottom, left, right |
2804 bsf max_depth_greater_100m ; Set Flag | 2853 bsf max_depth_greater_100m ; Set Flag |
2805 return | 2854 return |
2806 | 2855 |
2807 | 2856 |
2808 TFT_max_pressure_apnoe: | 2857 TFT_max_depth_apnoe: |
2809 btfss FLAG_active_descent ; Are we descending? | 2858 btfss FLAG_active_descent ; Are we descending? |
2810 bra TFT_max_pressure2 ; Yes, show normal max. | 2859 bra TFT_max_depth2 ; Yes, show normal max. |
2811 SAFE_2BYTE_COPY apnoe_max_pressure, lo | 2860 SAFE_2BYTE_COPY apnoe_max_pressure, lo |
2812 bra TFT_max_pressure3 ; Show apnoe_max_pressure as max. depth | 2861 bra TFT_max_depth3 ; Show apnoe_max_pressure as max. depth |
2813 | 2862 |
2814 global TFT_display_apnoe_last_max | 2863 global TFT_display_apnoe_last_max |
2815 TFT_display_apnoe_last_max: | 2864 TFT_display_apnoe_last_max: |
2816 call TFT_divemask_color | 2865 call TFT_divemask_color |
2817 WIN_TINY dm_apnoe_last_max_depth_text_col, dm_apnoe_last_max_depth_text_row | 2866 WIN_TINY dm_apnoe_last_max_depth_text_col, dm_apnoe_last_max_depth_text_row |
2818 STRCPY_TEXT_PRINT tApnoeMax | 2867 STRCPY_TEXT_PRINT tApnoeMax |
2819 | 2868 |
2820 call TFT_standard_color | 2869 call TFT_standard_color |
2821 SAFE_2BYTE_COPY max_pressure, lo | 2870 SAFE_2BYTE_COPY max_pressure, lo |
2822 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 2871 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
2823 TSTOSS opt_units ; 0=m, 1=ft | 2872 TSTOSS opt_units ; 0=m, 1=ft |
2824 bra TFT_display_apnoe_last_m_metric | 2873 bra TFT_display_apnoe_last_m_metric |
2825 ;TFT_display_apnoe_last_max_imperial | 2874 ;TFT_display_apnoe_last_max_imperial |
2826 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | 2875 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
2827 WIN_MEDIUM dm_apnoe_last_max_depth_column, dm_apnoe_last_max_depth_row | 2876 WIN_MEDIUM dm_apnoe_last_max_depth_column, dm_apnoe_last_max_depth_row |
2828 output_16 | 2877 output_16 |
2829 STRCAT_PRINT "" | 2878 STRCAT_PRINT "" |
2830 return | 2879 return |
2831 | 2880 |
2835 output_16dp d'3' | 2884 output_16dp d'3' |
2836 STRCAT_PRINT "" | 2885 STRCAT_PRINT "" |
2837 return | 2886 return |
2838 | 2887 |
2839 ;============================================================================= | 2888 ;============================================================================= |
2889 | |
2840 global TFT_divemins | 2890 global TFT_divemins |
2841 TFT_divemins: | 2891 TFT_divemins: |
2892 bcf FLAG_TFT_divemins ; Clear flag | |
2842 movff divemins+0,lo | 2893 movff divemins+0,lo |
2843 movff divemins+1,hi | 2894 movff divemins+1,hi |
2844 | |
2845 | 2895 |
2846 ; Already showing divemins > 99min | 2896 ; Already showing divemins > 99min |
2847 btfsc no_more_divesecs ; Ignore seconds? | 2897 btfsc no_more_divesecs ; Ignore seconds? |
2848 bra TFT_divemins2 ; Show minutes only | 2898 bra TFT_divemins2 ; Show minutes only |
2849 | 2899 |
2850 tstfsz hi ; hi = 0? | 2900 tstfsz hi ; hi = 0? |
2851 bra TFT_divemins_clr ; No, show mins only | 2901 bra TFT_divemins_clr ; No, show mins only |
2852 | 2902 |
2853 movlw .99 | 2903 movlw .99 |
2854 cpfsgt lo ; bigger than 99? | 2904 cpfsgt lo ; bigger than 99? |
2855 bra TFT_divemins1 ; No show mins:secs | 2905 bra TFT_divemins1 ; No show mins:secs |
2856 | 2906 |
2857 TFT_divemins_clr: | 2907 TFT_divemins_clr: |
2858 ; Yes, remove second display for the rest of the dive and clear seconds | 2908 ; Yes, remove second display for the rest of the dive and clear seconds |
2859 bsf no_more_divesecs ; Set flag | 2909 bsf no_more_divesecs ; Set flag |
2860 ; Clear rest of seconds | 2910 ; Clear rest of seconds |
2863 | 2913 |
2864 TFT_divemins1: | 2914 TFT_divemins1: |
2865 ; Print out the minutes, up to 99min, only 2chars ! | 2915 ; Print out the minutes, up to 99min, only 2chars ! |
2866 call TFT_standard_color | 2916 call TFT_standard_color |
2867 WIN_MEDIUM dm_divetime_column, dm_divetime_row | 2917 WIN_MEDIUM dm_divetime_column, dm_divetime_row |
2868 bcf leftbind | |
2869 output_99 ; displays only last two figures from a 8Bit value (0-99) | 2918 output_99 ; displays only last two figures from a 8Bit value (0-99) |
2870 bcf leftbind | |
2871 STRCAT_PRINT "" ; Show minutes in large font | 2919 STRCAT_PRINT "" ; Show minutes in large font |
2872 | 2920 |
2873 ; Print out the seconds | 2921 ; Print out the seconds |
2874 WIN_SMALL dm_divetime_secs_column, dm_divetime_secs_row ; left position for two sec figures | 2922 WIN_SMALL dm_divetime_secs_column, dm_divetime_secs_row ; left position for two sec figures |
2875 PUTC ':' | 2923 PUTC ':' |
2876 bsf leftbind | 2924 bsf leftbind |
2877 movff divesecs,lo | 2925 movff divesecs,lo |
2878 output_99x ; displays only last two figures from a 8Bit value with leading zero (00-99) | 2926 output_99x ; displays only last two figures from a 8Bit value with leading zero (00-99) |
2879 bcf leftbind | 2927 bcf leftbind |
2880 STRCAT_PRINT "" ; Show seconds in small font | 2928 STRCAT_PRINT "" ; Show seconds in small font |
2881 return | 2929 return |
2882 | 2930 |
2883 TFT_divemins2: | 2931 TFT_divemins2: |
2884 ; Full minutes only | 2932 ; Full minutes only |
2885 call TFT_standard_color | 2933 call TFT_standard_color |
2886 WIN_MEDIUM dm_divetime_minsonly_column, dm_divetime_row | 2934 WIN_MEDIUM dm_divetime_minsonly_column, dm_divetime_row |
2887 bcf leftbind | 2935 bcf leftbind |
2888 output_16_4 | 2936 output_16_4 |
2889 STRCAT_PRINT "" ; Show minutes in large font | 2937 STRCAT_PRINT "" ; Show minutes in large font |
2890 return | 2938 return |
2939 | |
2940 global TFT_divemins_alternative | |
2941 TFT_divemins_alternative: | |
2942 bcf FLAG_TFT_divemins ; Clear flag | |
2943 call TFT_standard_color | |
2944 ; Print out the minutes (0-999) in large | |
2945 WIN_LARGE dm_divetime_alt_column, dm_divetime_alt_row | |
2946 movff divemins+0,lo | |
2947 movff divemins+1,hi | |
2948 output_16_3 ; limit to 999 and display only (0-999) | |
2949 STRCAT_PRINT "" ; Show minutes | |
2950 ; Print out the seconds in medium | |
2951 WIN_MEDIUM dm_divetime_alt_column+.60, dm_divetime_alt_row+.25 | |
2952 PUTC ":" | |
2953 bsf leftbind | |
2954 movff divesecs,lo | |
2955 output_99x ; displays only last two figures from a 8Bit value with leading zero (00-99) | |
2956 bcf leftbind | |
2957 STRCAT_PRINT "" ; Show seconds in small font | |
2958 return | |
2891 | 2959 |
2892 ;============================================================================= | 2960 ;============================================================================= |
2961 | |
2893 global TFT_display_apnoe_surface | 2962 global TFT_display_apnoe_surface |
2894 TFT_display_apnoe_surface: | 2963 TFT_display_apnoe_surface: |
2895 call TFT_divemask_color | 2964 call TFT_divemask_color |
2896 WIN_TINY dm_apnoe_surface_time_text_col, dm_apnoe_surface_time_text_row | 2965 WIN_TINY dm_apnoe_surface_time_text_col, dm_apnoe_surface_time_text_row |
2897 STRCPY_TEXT_PRINT tApnoeSurface | 2966 STRCPY_TEXT_PRINT tApnoeSurface |
2907 return | 2976 return |
2908 | 2977 |
2909 global TFT_apnoe_clear_surface | 2978 global TFT_apnoe_clear_surface |
2910 TFT_apnoe_clear_surface: | 2979 TFT_apnoe_clear_surface: |
2911 ; Clear Surface timer.... | 2980 ; Clear Surface timer.... |
2912 WIN_BOX_BLACK dm_apnoe_surface_time_text_row, .239, dm_apnoe_surface_time_text_col, .159 ;top, bottom, left, right | 2981 WIN_BOX_BLACK dm_apnoe_surface_time_text_row, .239, dm_apnoe_surface_time_text_col, .159 ;top, bottom, left, right |
2913 return | 2982 return |
2914 | 2983 |
2915 global TFT_display_apnoe_descent | 2984 global TFT_display_apnoe_descent |
2916 TFT_display_apnoe_descent: ; Descent divetime | 2985 TFT_display_apnoe_descent: ; Descent divetime |
2917 movff apnoe_mins,lo | 2986 movff apnoe_mins,lo |
2918 clrf hi | 2987 clrf hi |
2919 WIN_MEDIUM dm_divetime_apnoe_column, dm_divetime_apnoe_row | 2988 WIN_MEDIUM dm_divetime_apnoe_column, dm_divetime_apnoe_row |
2920 output_16_3 ; displays only last three figures from a 16Bit value (0-999) | 2989 output_16_3 ; displays only last three figures from a 16Bit value (0-999) |
2921 call TFT_standard_color | 2990 call TFT_standard_color |
2922 STRCAT_PRINT "" ; Show minutes in large font | 2991 STRCAT_PRINT "" ; Show minutes in large font |
2923 WIN_SMALL dm_divetime_apnoe_secs_column, dm_divetime_apnoe_secs_row ; left position for two sec figures | 2992 WIN_SMALL dm_divetime_apnoe_secs_column, dm_divetime_apnoe_secs_row ; left position for two sec figures |
2924 PUTC ':' | 2993 PUTC ':' |
2925 bsf leftbind | 2994 bsf leftbind |
2926 movff apnoe_secs,lo | 2995 movff apnoe_secs,lo |
2927 output_99x | 2996 output_99x |
2928 bcf leftbind | 2997 bcf leftbind |
2947 STRCAT_PRINT "" ; Show seconds in small font | 3016 STRCAT_PRINT "" ; Show seconds in small font |
2948 return | 3017 return |
2949 | 3018 |
2950 ;============================================================================= | 3019 ;============================================================================= |
2951 ; Writes ostc #Serial and Firmware version in splash screen | 3020 ; Writes ostc #Serial and Firmware version in splash screen |
2952 ; | 3021 |
2953 global TFT_serial | 3022 global TFT_serial |
2954 TFT_serial: | 3023 TFT_serial: |
2955 WIN_TINY .5,.225 | 3024 WIN_TINY .5,.225 |
2956 STRCPY "OSTC" ; Won't translate that... | 3025 STRCPY "OSTC" ; Won't translate that... |
2957 | 3026 |
2958 movlw 0x0A | 3027 movlw 0x0A |
2959 cpfseq hardware_flag | 3028 cpfseq hardware_flag |
2960 bra TFT_serial2 | 3029 bra TFT_serial2 |
2961 STRCAT "3 #" | 3030 STRCAT "3 #" |
3000 | 3069 |
3001 call TFT_warnings_color | 3070 call TFT_warnings_color |
3002 WIN_LEFT .160-4*9/2 ; Right pad. | 3071 WIN_LEFT .160-4*9/2 ; Right pad. |
3003 STRCPY_TEXT_PRINT tBeta | 3072 STRCPY_TEXT_PRINT tBeta |
3004 endif | 3073 endif |
3005 call TFT_standard_color | 3074 call TFT_standard_color |
3006 bcf win_invert | 3075 bcf win_invert |
3007 return | 3076 return |
3008 | |
3009 | |
3010 | 3077 |
3011 | 3078 |
3012 ;============================================================================= | 3079 ;============================================================================= |
3013 ; For the Information menu: append firmware x.yy version. | 3080 ; For the Information menu: append firmware x.yy version. |
3081 | |
3014 global info_menu_firmware | 3082 global info_menu_firmware |
3015 extern tFirmware | 3083 extern tFirmware |
3016 info_menu_firmware: | 3084 info_menu_firmware: |
3017 lfsr FSR1,tFirmware | 3085 lfsr FSR1,tFirmware |
3018 call strcat_text | 3086 call strcat_text |
3053 bcf win_invert | 3121 bcf win_invert |
3054 goto TFT_set_color ; and return... | 3122 goto TFT_set_color ; and return... |
3055 | 3123 |
3056 ;----------------------------------------------------------------------------- | 3124 ;----------------------------------------------------------------------------- |
3057 ; For the Information menu: append serial number | 3125 ; For the Information menu: append serial number |
3126 | |
3058 global info_menu_serial | 3127 global info_menu_serial |
3059 extern tSerial | 3128 extern tSerial |
3060 info_menu_serial: | 3129 info_menu_serial: |
3061 lfsr FSR1,tSerial | 3130 lfsr FSR1,tSerial |
3062 call strcat_text | 3131 call strcat_text |
3075 bcf leftbind | 3144 bcf leftbind |
3076 return | 3145 return |
3077 | 3146 |
3078 ;----------------------------------------------------------------------------- | 3147 ;----------------------------------------------------------------------------- |
3079 ; For the Information menu: Append total dives | 3148 ; For the Information menu: Append total dives |
3149 | |
3080 global info_menu_total_dives | 3150 global info_menu_total_dives |
3081 extern tTotalDives | 3151 extern tTotalDives |
3082 info_menu_total_dives: | 3152 info_menu_total_dives: |
3083 lfsr FSR1,tTotalDives | 3153 lfsr FSR1,tTotalDives |
3084 call strcat_text | 3154 call strcat_text |
3099 lfsr FSR1,tBatteryV | 3169 lfsr FSR1,tBatteryV |
3100 call strcat_text | 3170 call strcat_text |
3101 movff batt_voltage+1,hi | 3171 movff batt_voltage+1,hi |
3102 movff batt_voltage+0,lo | 3172 movff batt_voltage+0,lo |
3103 bsf leftbind | 3173 bsf leftbind |
3104 output_16dp .2 ; x.xxx | 3174 output_16dp .2 ; x.xxx |
3105 STRCAT "V (T" | 3175 STRCAT "V(T" |
3106 movff battery_type,lo ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah | 3176 movff battery_type,lo ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah |
3107 output_8 | 3177 output_8 |
3108 bcf leftbind | 3178 bcf leftbind |
3109 PUTC ")" | 3179 PUTC ")" |
3110 return | 3180 return |
3120 movff uptime+2,xC+2 | 3190 movff uptime+2,xC+2 |
3121 movff uptime+3,xC+3 | 3191 movff uptime+3,xC+3 |
3122 movlw LOW .3600 | 3192 movlw LOW .3600 |
3123 movwf xB+0 | 3193 movwf xB+0 |
3124 movlw HIGH .3600 | 3194 movlw HIGH .3600 |
3125 movwf xB+1 ; One day = 3600s | 3195 movwf xB+1 ; One day = 3600s |
3126 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | 3196 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder |
3127 ;xC+0:xC+1 -> Full hours | 3197 ;xC+0:xC+1 -> Full hours |
3128 movff xC+1,xA+1 | 3198 movff xC+1,xA+1 |
3129 movff xC+0,xA+0 | 3199 movff xC+0,xA+0 |
3130 clrf xB+1 | 3200 clrf xB+1 |
3131 movlw .24 | 3201 movlw .24 |
3132 movwf xB+0 | 3202 movwf xB+0 |
3133 call div16x16 ;xA/xB=xC with xA+0 as remainder | 3203 call div16x16 ; xA/xB=xC with xA+0 as remainder |
3134 movff xC+0,lo | 3204 movff xC+0,lo |
3135 movff xC+1,hi ; Full days | 3205 movff xC+1,hi ; Full days |
3136 bsf leftbind | 3206 bsf leftbind |
3137 output_16 | 3207 output_16 |
3138 PUTC "d" | 3208 PUTC "d" |
3180 return | 3250 return |
3181 | 3251 |
3182 | 3252 |
3183 ;----------------------------------------------------------------------------- | 3253 ;----------------------------------------------------------------------------- |
3184 ; ppO2 menu | 3254 ; ppO2 menu |
3255 | |
3185 global divesets_ppo2_max | 3256 global divesets_ppo2_max |
3186 extern tPPO2Max | 3257 extern tPPO2Max |
3187 extern tbar | 3258 extern tbar |
3188 divesets_ppo2_max: | 3259 divesets_ppo2_max: |
3189 lfsr FSR1,tPPO2Max | 3260 lfsr FSR1,tPPO2Max |
3190 call strcat_text | 3261 call strcat_text |
3191 movff opt_ppO2_max,lo | 3262 movff char_I_ppO2_max,lo |
3192 movlw ppo2_warning_high | 3263 movlw ppo2_warning_high |
3264 | |
3193 divesets_ppo2_common: | 3265 divesets_ppo2_common: |
3194 movwf up ; Save default value | 3266 movwf up ; Save default value |
3195 clrf hi | 3267 clrf hi |
3196 bsf leftbind | 3268 bsf leftbind |
3197 output_16dp d'3' | 3269 output_16dp d'3' |
3198 bcf leftbind | 3270 bcf leftbind |
3199 lfsr FSR1,tbar | 3271 lfsr FSR1,tbar |
3200 call strcat_text | 3272 call strcat_text |
3201 | 3273 movf up,W ; Default value |
3202 movf up,W ; Default value | 3274 cpfseq lo ; Current value |
3203 cpfseq lo ; Current value | 3275 bra divesets_ppo2_common2 ; Not default, add * |
3204 bra divesets_ppo2_common2 ; Not default, add * | 3276 return ; Default, Done. |
3205 return ; Default, Done. | |
3206 divesets_ppo2_common2: | 3277 divesets_ppo2_common2: |
3207 PUTC "*" | 3278 PUTC "*" |
3208 return ; Done. | 3279 return ; Done. |
3280 | |
3209 | 3281 |
3210 global divesets_ppo2_min | 3282 global divesets_ppo2_min |
3211 extern tPPO2MIN | 3283 extern tPPO2MIN |
3212 divesets_ppo2_min: | 3284 divesets_ppo2_min: |
3213 lfsr FSR1,tPPO2MIN | 3285 lfsr FSR1,tPPO2MIN |
3214 call strcat_text | 3286 call strcat_text |
3215 movff opt_ppO2_min,lo | 3287 movff char_I_ppO2_min,lo |
3216 movlw ppo2_warning_low | 3288 movlw ppo2_warning_low |
3217 bra divesets_ppo2_common | 3289 bra divesets_ppo2_common |
3290 | |
3218 | 3291 |
3219 global divesets_ppo2_max_deco | 3292 global divesets_ppo2_max_deco |
3220 extern tPPO2DECO | 3293 extern tPPO2DECO |
3221 divesets_ppo2_max_deco: | 3294 divesets_ppo2_max_deco: |
3222 lfsr FSR1,tPPO2DECO | 3295 lfsr FSR1,tPPO2DECO |
3223 call strcat_text | 3296 call strcat_text |
3224 movff opt_ppO2_max_deco,lo | 3297 movff char_I_ppO2_max_deco,lo |
3225 movlw ppo2_warning_high_deco | 3298 movlw ppo2_warning_high_deco |
3226 bra divesets_ppo2_common | 3299 bra divesets_ppo2_common |
3227 | 3300 |
3301 | |
3302 global divesets_ppo2_min_cc | |
3303 extern tPPO2MINCC | |
3304 divesets_ppo2_min_cc: | |
3305 lfsr FSR1,tPPO2MINCC | |
3306 call strcat_text | |
3307 movff char_I_ppO2_min_loop,lo | |
3308 movlw ppo2_warning_low_cc | |
3309 bra divesets_ppo2_common | |
3228 | 3310 |
3229 ;============================================================================= | 3311 ;============================================================================= |
3230 | 3312 |
3231 global TFT_clear_warning_text | 3313 global TFT_clear_warning_text |
3232 TFT_clear_warning_text: | 3314 TFT_clear_warning_text: |
3233 btfss divemode ; in divemode? | 3315 btfss divemode ; in divemode? |
3234 bra TFT_clear_warning_text2 ; No, setup for surface mode | 3316 bra TFT_clear_warning_text2 ; No, setup for surface mode |
3235 WIN_BOX_BLACK dm_warning_row, dm_warning_bot, dm_warning_column, dm_warning_rgt ;top, bottom, left, right | 3317 bcf FLAG_TFT_dive_warning_text_clear ; Clear flag |
3318 btfsc alternative_divelayout | |
3319 bra TFT_clear_warning_text_2nd_row ; In Alt mode, clear only row 2 | |
3320 WIN_BOX_BLACK dm_warning_row, dm_warning_bot, dm_warning_column, dm_warning_rgt ; top, bottom, left, right | |
3236 return | 3321 return |
3237 TFT_clear_warning_text2: | 3322 TFT_clear_warning_text2: |
3238 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ;top, bottom, left, right | 3323 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ; top, bottom, left, right |
3239 return | 3324 return |
3240 | 3325 |
3241 global TFT_clear_warning_text_2nd_row | 3326 global TFT_clear_warning_text_2nd_row |
3242 TFT_clear_warning_text_2nd_row: | 3327 TFT_clear_warning_text_2nd_row: |
3243 btfss divemode ; in divemode? | 3328 btfss divemode ; in divemode? |
3244 bra TFT_clear_warning_text_2nd_2 ; No, setup for surface mode | 3329 bra TFT_clear_warning_text_2nd_2 ; No, setup for surface mode |
3245 WIN_BOX_BLACK dm_warning2_row, dm_warning2_bot, dm_warning2_column, dm_warning2_rgt ;top, bottom, left, right | 3330 bcf FLAG_TFT_dive_warning_text_clr2 ; Clear flag |
3331 WIN_BOX_BLACK dm_warning2_row, dm_warning2_bot, dm_warning2_column, dm_warning2_rgt ; top, bottom, left, right | |
3246 return | 3332 return |
3247 TFT_clear_warning_text_2nd_2: | 3333 TFT_clear_warning_text_2nd_2: |
3248 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ;top, bottom, left, right | 3334 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ; top, bottom, left, right |
3249 return | 3335 return |
3250 | 3336 |
3251 global TFT_fillup_with_spaces | 3337 global TFT_fillup_with_spaces |
3252 TFT_fillup_with_spaces: ; Fillup FSR2 with spaces (Total string length in #WREG) | 3338 TFT_fillup_with_spaces: ; Fillup FSR2 with spaces (Total string length in #WREG) |
3253 movwf lo ; save max. string length into lo | 3339 movwf lo ; save max. string length into lo |
3254 movf FSR2L,W ; Get current string length | 3340 movf FSR2L,W ; Get current string length |
3255 subwf lo,F ; lo-WREG | 3341 subwf lo,F ; lo-WREG |
3256 btfsc STATUS,N ; longer then #lo already? | 3342 btfsc STATUS,N ; longer then #lo already? |
3257 return ; Yes, done. | 3343 return ; Yes, done. |
3258 tstfsz lo ; Zero? | 3344 tstfsz lo ; Zero? |
3259 bra TFT_fillup_with_spaces2 ; No. | 3345 bra TFT_fillup_with_spaces2 ; No. |
3260 return ; Yes, done. | 3346 return ; Yes, done. |
3261 TFT_fillup_with_spaces2: | 3347 TFT_fillup_with_spaces2: |
3262 PUTC " " ; Add one space | 3348 PUTC " " ; Add one space |
3263 decfsz lo,F ; All done? | 3349 decfsz lo,F ; All done? |
3264 bra TFT_fillup_with_spaces2 ; No, loop | 3350 bra TFT_fillup_with_spaces2 ; No, loop |
3265 return ; Done. | 3351 return ; Done. |
3266 | 3352 |
3353 ;============================================================================= | |
3354 | |
3267 global TFT_desaturation_time | 3355 global TFT_desaturation_time |
3268 TFT_desaturation_time: | 3356 TFT_desaturation_time: |
3269 rcall TFT_warning_set_window ; Sets the row and column for the current warning | 3357 rcall TFT_warning_set_window ; Sets the row and column for the current warning |
3270 tstfsz WREG ; Is there room for the warning? | 3358 tstfsz WREG ; Is there room for the warning? |
3271 return ; No | 3359 return ; No |
3272 call TFT_warning_set_window_com | |
3273 STRCPY "Desat:" | 3360 STRCPY "Desat:" |
3274 movff desaturation_time+0,lo ; divide by 60... | 3361 movff int_O_desaturation_time+0,lo |
3275 movff desaturation_time+1,hi | 3362 movff int_O_desaturation_time+1,hi |
3276 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | 3363 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) |
3277 bsf leftbind | 3364 bsf leftbind |
3278 movf lo,W | 3365 movf lo,W |
3279 movff hi,lo | 3366 movff hi,lo |
3280 movwf hi ; exchange lo and hi... | 3367 movwf hi ; exchange lo and hi... |
3281 output_8 ; Hours | 3368 output_8 ; Hours |
3282 PUTC ':' | 3369 PUTC ':' |
3283 movff hi,lo ; Minutes | 3370 movff hi,lo ; Minutes |
3284 output_99x | 3371 output_99x |
3285 bcf leftbind | 3372 bcf leftbind |
3286 movlw surf_warning_length ; Only use surface string length | 3373 movlw surf_warning_length ; Only use surface string length |
3287 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | 3374 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
3288 movlw .0 | 3375 movlw .0 ; TODO - needed? |
3289 movff WREG,buffer+11 | 3376 movff WREG,buffer+11 ; TODO - needed? |
3290 STRCAT_PRINT "" | 3377 STRCAT_PRINT "" |
3291 bcf win_invert | 3378 bcf win_invert |
3292 return | 3379 return |
3380 | |
3293 | 3381 |
3294 global TFT_nofly_time | 3382 global TFT_nofly_time |
3295 TFT_nofly_time: | 3383 TFT_nofly_time: |
3296 rcall TFT_warning_set_window ; Sets the row and column for the current warning | 3384 rcall TFT_warning_set_window ; Sets the row and column for the current warning |
3297 tstfsz WREG ; Is there room for the warning? | 3385 tstfsz WREG ; Is there room for the warning? |
3298 return ; No | 3386 return ; No |
3299 call TFT_warning_set_window_com | 3387 movff char_I_altitude_wait,WREG |
3388 tstfsz WREG | |
3389 bra TFT_nofly_time_1 | |
3300 STRCPY "NoFly:" | 3390 STRCPY "NoFly:" |
3301 movff nofly_time+0,lo ; divide by 60... | 3391 bra TFT_nofly_time_2 |
3302 movff nofly_time+1,hi | 3392 TFT_nofly_time_1: |
3303 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | 3393 STRCPY "NoAlt:" |
3304 bsf leftbind | 3394 TFT_nofly_time_2: |
3305 movf lo,W | 3395 movff int_O_nofly_time+0,lo |
3306 movff hi,lo | 3396 movff int_O_nofly_time+1,hi |
3307 movwf hi ; exchange lo and hi... | 3397 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) |
3308 output_8 ; Hours | 3398 bsf leftbind |
3309 PUTC ':' | 3399 movf lo,W |
3310 movff hi,lo ; Minutes | 3400 movff hi,lo |
3401 movwf hi ; exchange lo and hi... | |
3402 output_8 ; Hours | |
3403 PUTC ':' | |
3404 movff hi,lo ; Minutes | |
3311 output_99x | 3405 output_99x |
3312 bcf leftbind | 3406 bcf leftbind |
3313 movlw surf_warning_length ; Only use surface string length | 3407 movlw surf_warning_length ; Only use surface string length |
3314 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | 3408 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
3315 movlw .0 | 3409 movlw .0 ; TODO - needed? |
3316 movff WREG,buffer+11 | 3410 movff WREG,buffer+11 ; TODO - needed? |
3317 STRCAT_PRINT "" | 3411 STRCAT_PRINT "" |
3318 bcf win_invert | 3412 bcf win_invert |
3319 return | 3413 return |
3414 | |
3415 ;============================================================================= | |
3320 | 3416 |
3321 global TFT_warning_agf | 3417 global TFT_warning_agf |
3322 TFT_warning_agf: | 3418 TFT_warning_agf: |
3323 rcall TFT_warning_set_window ; Sets the row and column for the current warning | 3419 rcall TFT_warning_set_window ; Sets the row and column for the current warning |
3324 tstfsz WREG ; Is there room for the warning? | 3420 tstfsz WREG ; Is there room for the warning? |
3325 return ; No | 3421 return ; No |
3326 call TFT_warning_set_window_com | |
3327 call TFT_warnings_color | 3422 call TFT_warnings_color |
3328 STRCPY_TEXT tDiveaGF_active ; "aGF!" | 3423 STRCPY_TEXT tDiveaGF_active ; "aGF!" |
3329 movlw dm_warning_length ; Divemode string length | 3424 movlw dm_warning_length ; Divemode string length |
3330 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | 3425 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
3331 STRCAT_PRINT "" | 3426 STRCAT_PRINT "" |
3332 call TFT_standard_color | 3427 ;bcf win_invert |
3333 bcf win_invert | 3428 ;return |
3334 return | 3429 goto TFT_standard_color |
3335 | 3430 |
3336 global TFT_warning_fallback | 3431 global TFT_warning_fallback |
3337 TFT_warning_fallback: ; Show fallback warning | 3432 TFT_warning_fallback: ; Show fallback warning |
3433 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3434 tstfsz WREG ; Is there room for the warning? | |
3435 return ; No | |
3436 call TFT_warnings_color | |
3437 STRCPY_TEXT tDiveFallback ; "Fallback!" | |
3438 movlw dm_warning_length ; Divemode string length | |
3439 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3440 STRCAT_PRINT "" | |
3441 goto TFT_standard_color ; and return... | |
3442 | |
3443 | |
3444 global TFT_info_deco | |
3445 TFT_info_deco ; show info when in decompression | |
3446 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3447 tstfsz WREG ; Is there room for the warning? | |
3448 return ; NO - return | |
3449 movlw color_green ; YES - select green text color | |
3450 call TFT_set_color ; set color | |
3451 STRCPY_TEXT tDecoInfo ; write "Deco Zone" | |
3452 movlw dm_warning_length ; select Divemode string length | |
3453 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3454 STRCAT_PRINT "" ; print buffer | |
3455 goto TFT_standard_color ; and return... | |
3456 | |
3457 | |
3458 global TFT_warning_gf | |
3459 TFT_warning_gf: ; GF | |
3460 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3461 tstfsz WREG ; Is there room for the warning? | |
3462 return ; No | |
3463 movff int_O_gradient_factor+0,lo ; bank-safe copy gradient factor | |
3464 movff int_O_gradient_factor+1,hi ; | |
3465 TFT_color_code warn_gf ; Color-code Output | |
3466 STRCPY "GF: " ; the two spaces are on purpose to align the output with other warnings' outputs | |
3467 bsf leftbind | |
3468 output_8 ; print value of lo only, int_O_gradient_factor is limited to 255 | |
3469 PUTC "%" | |
3470 movlw dm_warning_length ; Divemode string length | |
3471 btfss divemode ; In Divemode? | |
3472 movlw surf_warning_length ; No, use surface string length | |
3473 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3474 STRCAT_PRINT "" | |
3475 bcf leftbind | |
3476 bcf win_invert | |
3477 goto TFT_standard_color ; and return... | |
3478 | |
3479 | |
3480 global TFT_warning_mbubbles | |
3481 TFT_warning_mbubbles: | |
3482 rcall TFT_warning_set_window ; sets the row and column for the current warning | |
3483 tstfsz WREG ; Is there room for the warning? | |
3484 return ; NO | |
3485 call TFT_attention_color ; set attention color as default | |
3486 movff char_O_deco_warnings,WREG ; bank-safe copy for deco warnings | |
3487 btfsc WREG,mbubble_warning ; are we in the microbubbles zone right now? | |
3488 call TFT_warnings_color ; YES - reconfigure to warning color | |
3489 STRCPY_TEXT tMicroBubbles | |
3490 movlw dm_warning_length ; divemode string length | |
3491 btfss divemode ; in Divemode? | |
3492 movlw surf_warning_length ; NO - use surface string length | |
3493 rcall TFT_fillup_with_spaces ; fillup FSR2 with spaces (total string length in #WREG) | |
3494 STRCAT_PRINT "" | |
3495 goto TFT_standard_color ; and return... | |
3496 | |
3497 | |
3498 global TFT_warning_outside | |
3499 TFT_warning_outside: | |
3500 rcall TFT_warning_set_window ; sets the row and column for the current warning | |
3501 tstfsz WREG ; is there room for the warning? | |
3502 return ; NO | |
3503 call TFT_attention_color | |
3504 movff char_O_deco_warnings,WREG ; bank-safe copy for deco warnings | |
3505 btfsc WREG,outside_warning ; are we outside the ZH-L16 model right now? | |
3506 call TFT_warnings_color ; YES - reconfigure to warning color | |
3507 STRCPY "X-ZHL16-X" | |
3508 movlw dm_warning_length ; divemode string length | |
3509 btfss divemode ; in Divemode? | |
3510 movlw surf_warning_length ; NO - use surface string length | |
3511 rcall TFT_fillup_with_spaces ; fillup FSR2 with spaces (total string length in #WREG) | |
3512 STRCAT_PRINT "" | |
3513 goto TFT_standard_color ; and return... | |
3514 | |
3515 | |
3516 global TFT_warning_gas_needs_warn | |
3517 global TFT_warning_gas_needs_att | |
3518 TFT_warning_gas_needs_warn: | |
3519 rcall TFT_warning_gas_needs_war_helper | |
3520 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3521 tstfsz WREG ; Is there room for the warning? | |
3522 return ; No | |
3523 call TFT_warnings_color | |
3524 bra TFT_warning_gas_needs_com | |
3525 TFT_warning_gas_needs_att: | |
3526 rcall TFT_warning_gas_needs_att_helper | |
3527 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3528 tstfsz WREG ; Is there room for the warning? | |
3529 return ; No | |
3530 call TFT_attention_color | |
3531 TFT_warning_gas_needs_com: | |
3532 STRCPY_TEXT tGasNeedsWarn ; "Gas Needs" | |
3533 movlw dm_warning_length ; Divemode string length | |
3534 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3535 STRCAT_PRINT "" | |
3536 goto TFT_standard_color ; and return... | |
3537 | |
3538 TFT_warning_gas_needs_war_helper: | |
3539 incf warning_counter,F ; increase counter | |
3540 btfsc gas_needs_warning ; is it a new warning? | |
3541 return ; NO - do not show the gas needs custom view again | |
3542 bsf gas_needs_warning ; YES - memorise it's an old now | |
3543 bra TFT_warning_gas_needs_helper_com | |
3544 TFT_warning_gas_needs_att_helper: | |
3545 incf warning_counter,F ; increase counter | |
3546 btfsc gas_needs_attention ; is it a new attention? | |
3547 return ; NO - do not show the gas needs custom view again | |
3548 bsf gas_needs_attention ; YES - memorise it's an old now | |
3549 TFT_warning_gas_needs_helper_com: | |
3550 movlw .12 ; customview number one below gas needs view | |
3551 movwf menupos3 ; set fake current view number | |
3552 bsf toggle_customview ; initiate toggle of customview -> gas needs view will be shown | |
3553 return | |
3554 | |
3555 | |
3556 global TFT_warning_IBCD | |
3557 TFT_warning_IBCD: | |
3558 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3559 tstfsz WREG ; Is there room for the warning? | |
3560 return ; No | |
3561 call TFT_attention_color ; select attention color as default | |
3562 STRCPY_TEXT tIBCD ; "IBCD N2He" | |
3563 movlw dm_warning_length ; Divemode string length | |
3564 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3565 STRCAT_PRINT "" | |
3566 goto TFT_standard_color ; and return... | |
3567 | |
3568 | |
3569 global TFT_warning_sensor_disagree | |
3570 TFT_warning_sensor_disagree: ; Show sensor disagree warning | |
3571 rcall TFT_warning_sensor_dis_helper | |
3338 rcall TFT_warning_set_window ; Sets the row and column for the current warning | 3572 rcall TFT_warning_set_window ; Sets the row and column for the current warning |
3339 tstfsz WREG ; Is there room for the warning? | 3573 tstfsz WREG ; Is there room for the warning? |
3340 return ; No | 3574 return ; No |
3341 call TFT_warnings_color | 3575 call TFT_warnings_color |
3342 STRCPY_TEXT tDiveFallback ; "Fallback!" | 3576 STRCPY_TEXT tSensorDisagree ; "Sensors<>" |
3343 movlw dm_warning_length ; Divemode string length | 3577 movlw dm_warning_length ; Divemode string length |
3344 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | 3578 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
3345 STRCAT_PRINT "" | 3579 STRCAT_PRINT "" |
3346 goto TFT_standard_color ; and return... | 3580 goto TFT_standard_color ; and return... |
3347 | 3581 |
3348 global TFT_warning_gf | 3582 TFT_warning_sensor_dis_helper: |
3349 TFT_warning_gf: ;GF | 3583 btfsc sensor_warning ; is it a new warning? |
3350 rcall TFT_warning_set_window ; Sets the row and column for the current warning | 3584 return ; NO - do not show the gas needs custom view again |
3351 tstfsz WREG ; Is there room for the warning? | 3585 bsf sensor_warning ; YES - memories it's an old warning now |
3352 return ; No | 3586 clrf menupos3 ; set fake current view number |
3353 call TFT_warning_set_window_com | 3587 bsf toggle_customview ; initiate toggle of customview -> sensor view will be shown |
3354 TFT_color_code warn_gf ; Color-code Output | 3588 return |
3355 STRCPY "GF:" | 3589 |
3356 movff char_O_gradient_factor,lo ; gradient factor | 3590 ;============================================================================= |
3357 bsf leftbind | 3591 |
3358 output_8 | |
3359 PUTC "%" | |
3360 movlw dm_warning_length ; Divemode string length | |
3361 btfss divemode ; In Divemode? | |
3362 movlw surf_warning_length ; No, use surface string length | |
3363 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3364 STRCAT_PRINT "" | |
3365 bcf leftbind | |
3366 bcf win_invert | |
3367 goto TFT_standard_color ; and return... | |
3368 | |
3369 TFT_warning_set_window: ; Sets the row and column for the current warning | 3592 TFT_warning_set_window: ; Sets the row and column for the current warning |
3370 ; ignore warning (now)? | 3593 ; ignore warning (now)? |
3371 decf warning_counter,W ; -1 | 3594 decf warning_counter,W ; -1 |
3372 bcf STATUS,C | 3595 bcf STATUS,C |
3596 btfss alternative_divelayout ; In alt mode, do not divide... | |
3373 rrcf WREG,W ; (warning_counter-1)/2 | 3597 rrcf WREG,W ; (warning_counter-1)/2 |
3374 cpfseq warning_page | 3598 cpfseq warning_page |
3375 retlw .255 ; WREG <> 0 -> Warning window not defined | 3599 retlw .255 ; WREG <> 0 -> Warning window not defined |
3376 | |
3377 call TFT_standard_color | 3600 call TFT_standard_color |
3378 | |
3379 btfss divemode ; in divemode? | 3601 btfss divemode ; in divemode? |
3380 bra TFT_warning_set_window3 ; No, setup for surface mode | 3602 bra TFT_warning_set_window3 ; No, setup for surface mode |
3381 | 3603 btfss alternative_divelayout |
3604 bra TFT_warning_set_window3a ; standard layout | |
3605 bra TFT_warning_set_window2a ; alternative layout (Only lower row used) | |
3606 TFT_warning_set_window3a: | |
3382 btfss warning_counter,0 ; Toggle with each warning | 3607 btfss warning_counter,0 ; Toggle with each warning |
3383 bra TFT_warning_set_window2 | 3608 bra TFT_warning_set_window2 |
3384 WIN_SMALL dm_warning1_column, dm_warning1_row | 3609 WIN_SMALL dm_warning1_column, dm_warning1_row |
3385 bcf second_row_warning ; =1: The second row contains a warning | 3610 bcf second_row_warning ; =1: The second row contains a warning |
3386 retlw .0 ; WREG=0 -> Warning window defined | 3611 retlw .0 ; WREG=0 -> Warning window defined |
3387 TFT_warning_set_window2: | 3612 TFT_warning_set_window2: |
3388 WIN_SMALL dm_warning2_column, dm_warning2_row | |
3389 bsf second_row_warning ; =1: The second row contains a warning | 3613 bsf second_row_warning ; =1: The second row contains a warning |
3390 retlw .0 ; WREG=0 -> Warning window defined | 3614 TFT_warning_set_window2a: |
3391 | 3615 WIN_SMALL dm_warning2_column, dm_warning2_row |
3616 retlw .0 ; WREG=0 -> Warning window defined | |
3392 TFT_warning_set_window3: | 3617 TFT_warning_set_window3: |
3393 btfss warning_counter,0 ; Toggle with each warning | 3618 btfss warning_counter,0 ; Toggle with each warning |
3394 bra TFT_warning_set_window4 | 3619 bra TFT_warning_set_window4 |
3395 WIN_SMALL surf_warning1_column,surf_warning1_row | 3620 WIN_SMALL surf_warning1_column,surf_warning1_row |
3396 bcf second_row_warning ; =1: The second row contains a warning | 3621 bcf second_row_warning ; =1: The second row contains a warning |
3397 retlw .0 ; WREG=0 -> Warning window defined | 3622 retlw .0 ; WREG=0 -> Warning window defined |
3398 TFT_warning_set_window4: | 3623 TFT_warning_set_window4: |
3399 WIN_SMALL surf_warning2_column,surf_warning2_row | 3624 WIN_SMALL surf_warning2_column,surf_warning2_row |
3400 bsf second_row_warning ; =1: The second row contains a warning | 3625 bsf second_row_warning ; =1: The second row contains a warning |
3401 retlw .0 ; WREG=0 -> Warning window defined | 3626 retlw .0 ; WREG=0 -> Warning window defined |
3402 | 3627 |
3403 TFT_warning_set_window_com: | |
3404 if dm_offset == 0 | |
3405 bsf win_invert | |
3406 endif | |
3407 return | |
3408 | 3628 |
3409 global TFT_update_batt_percent_divemode | 3629 global TFT_update_batt_percent_divemode |
3410 TFT_update_batt_percent_divemode: | 3630 TFT_update_batt_percent_divemode: |
3411 rcall TFT_warning_set_window ; Sets the row and column for the current warning | 3631 rcall TFT_warning_set_window ; Sets the row and column for the current warning |
3412 tstfsz WREG ; Is there room for the warning? | 3632 tstfsz WREG ; Is there room for the warning? |
3413 return ; No | 3633 return ; No |
3414 call TFT_warning_set_window_com | 3634 movff batt_percent,lo ; Get battery percent |
3415 movff batt_percent,lo ; Get battery percent | 3635 TFT_color_code warn_battery ; Color-code battery percent |
3416 TFT_color_code warn_battery; Color-code battery percent | |
3417 STRCPY "Batt:" | 3636 STRCPY "Batt:" |
3418 bsf leftbind | 3637 bsf leftbind |
3419 output_8 | 3638 output_8 |
3420 bcf leftbind | 3639 bcf leftbind |
3421 PUTC "%" | 3640 PUTC "%" |
3422 movlw dm_warning_length ; Divemode string length | 3641 movlw dm_warning_length ; Divemode string length |
3423 btfss divemode ; In Divemode? | 3642 btfss divemode ; In Divemode? |
3424 movlw surf_warning_length ; No, use surface string length | 3643 movlw surf_warning_length ; No, use surface string length |
3425 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | 3644 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
3426 STRCAT_PRINT "" | 3645 STRCAT_PRINT "" |
3427 bcf win_invert | 3646 bcf win_invert |
3428 goto TFT_standard_color ; and return... | 3647 goto TFT_standard_color ; and return... |
3429 | 3648 |
3430 global TFT_gf_mask ; Setup Mask | 3649 |
3650 global TFT_gf_mask ; Setup Mask | |
3431 TFT_gf_mask: | 3651 TFT_gf_mask: |
3432 ; The mask | 3652 ; The mask |
3433 call TFT_divemask_color | 3653 call TFT_divemask_color |
3434 WIN_TINY dm_custom_gf_title_col1, dm_custom_gf_title_row | 3654 WIN_TINY dm_custom_gf_title_col1, dm_custom_gf_title_row |
3435 STRCPY_TEXT_PRINT tGFactors | 3655 STRCPY_TEXT_PRINT tGFactors |
3436 WIN_TINY dm_custom_gf_title_col2, dm_custom_gf_title_row | 3656 WIN_TINY dm_custom_gf_title_col2, dm_custom_gf_title_row |
3437 STRCPY_TEXT_PRINT taGFactors | 3657 STRCPY_TEXT_PRINT taGFactors |
3438 WIN_TINY dm_custom_gf_title_col3, dm_custom_gf_title_row | 3658 WIN_TINY dm_custom_gf_title_col3, dm_custom_gf_title_row |
3439 STRCPY_TEXT_PRINT tGFInfo | 3659 STRCPY_TEXT_PRINT tGFInfo |
3440 | |
3441 ; Show GF (Static) | 3660 ; Show GF (Static) |
3442 call TFT_disabled_color | 3661 call TFT_disabled_color |
3443 btfss use_agf | 3662 btfss use_agf |
3444 call TFT_standard_color | 3663 call TFT_standard_color |
3445 | |
3446 WIN_STD dm_custom_gf_column, dm_custom_gf_row | 3664 WIN_STD dm_custom_gf_column, dm_custom_gf_row |
3447 bsf leftbind | 3665 bsf leftbind |
3448 movff opt_GF_low,lo | 3666 movff opt_GF_low,lo |
3449 output_8 | 3667 output_8 |
3450 PUTC "/" | 3668 PUTC "/" |
3453 STRCAT_PRINT "" | 3671 STRCAT_PRINT "" |
3454 ; Show aGF (Static) | 3672 ; Show aGF (Static) |
3455 call TFT_standard_color | 3673 call TFT_standard_color |
3456 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater | 3674 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater |
3457 bra TFT_gf_mask2 ; Show "---" instead | 3675 bra TFT_gf_mask2 ; Show "---" instead |
3458 | |
3459 btfss use_agf | 3676 btfss use_agf |
3460 call TFT_disabled_color | 3677 call TFT_disabled_color |
3461 | |
3462 WIN_STD dm_custom_agf_column, dm_custom_agf_row | 3678 WIN_STD dm_custom_agf_column, dm_custom_agf_row |
3463 movff opt_aGF_low,lo | 3679 movff opt_aGF_low,lo |
3464 output_8 | 3680 output_8 |
3465 PUTC "/" | 3681 PUTC "/" |
3466 movff opt_aGF_high,lo | 3682 movff opt_aGF_high,lo |
3473 WIN_STD dm_custom_agf_column+.10, dm_custom_agf_row | 3689 WIN_STD dm_custom_agf_column+.10, dm_custom_agf_row |
3474 STRCPY_PRINT "---" | 3690 STRCPY_PRINT "---" |
3475 bcf leftbind | 3691 bcf leftbind |
3476 return | 3692 return |
3477 | 3693 |
3694 | |
3478 global TFT_gf_mask_cGF ; Setup Mask | 3695 global TFT_gf_mask_cGF ; Setup Mask |
3479 TFT_gf_mask_cGF: | 3696 TFT_gf_mask_cGF: |
3480 ; The mask | 3697 ; The mask |
3481 call TFT_divemask_color | 3698 call TFT_divemask_color |
3482 WIN_TINY dm_custom_gf_title_col3, dm_custom_gf_title_row | 3699 WIN_TINY dm_custom_gf_title_col3, dm_custom_gf_title_row |
3483 STRCPY_TEXT_PRINT tGFInfo | 3700 STRCPY_TEXT_PRINT tGFInfo |
3484 goto TFT_standard_color; and return... | 3701 goto TFT_standard_color; and return... |
3485 | 3702 |
3486 global TFT_gf_info ; Show GF informations | 3703 global TFT_gf_info ; Show GF informations |
3487 TFT_gf_info: | 3704 TFT_gf_info: |
3488 call TFT_standard_color | |
3489 ; Show current GF | |
3490 movff char_O_gradient_factor,lo ; gradient factor absolute (Non-GF model) | |
3491 movff char_I_deco_model,hi | |
3492 WIN_STD dm_custom_currentgf_column, dm_custom_currentgf_row | 3705 WIN_STD dm_custom_currentgf_column, dm_custom_currentgf_row |
3493 output_8 | 3706 movff int_O_gradient_factor+0,lo ; gradient factor absolute (Non-GF model) |
3707 movff int_O_gradient_factor+1,hi | |
3708 TFT_color_code warn_gf ; Color-code Output | |
3709 output_8 ; print lo only, int_O_gradient_factor is limited to 255 | |
3494 STRCAT_PRINT "%" | 3710 STRCAT_PRINT "%" |
3495 return | 3711 return |
3712 | |
3496 | 3713 |
3497 global TFT_battinfo_tissues_clock_mask ; Setup Mask | 3714 global TFT_battinfo_tissues_clock_mask ; Setup Mask |
3498 TFT_battinfo_tissues_clock_mask: | 3715 TFT_battinfo_tissues_clock_mask: |
3499 ; The mask | 3716 ; The mask |
3500 ; Put three columns at HUD positions | 3717 ; Put three columns at HUD positions |
3501 call TFT_divemask_color | 3718 call TFT_divemask_color |
3502 btfsc FLAG_apnoe_mode ; In Apnoe mode? | 3719 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
3503 bra TFT_battinfo_tissues_clock_mask2 ; Yes | 3720 bra TFT_battinfo_tissues_clock_mask2 ; Yes |
3504 btfsc FLAG_gauge_mode ; In Gauge mode? | 3721 btfsc FLAG_gauge_mode ; In Gauge mode? |
3505 bra TFT_battinfo_tissues_clock_mask2 ; Yes | 3722 bra TFT_battinfo_tissues_clock_mask2 ; Yes |
3506 WIN_TINY dm_custom_tissue_title_column, dm_custom_tissue_title_row | 3723 WIN_TINY dm_custom_tissue_title_column, dm_custom_tissue_title_row |
3507 STRCPY_TEXT_PRINT tDiveTissues | 3724 STRCPY_TEXT_PRINT tDiveTissues |
3508 TFT_battinfo_tissues_clock_mask2: ; Show only clock | 3725 TFT_battinfo_tissues_clock_mask2: ; Show only clock |
3509 WIN_TINY dm_custom_ead_column, dm_custom_eadend_title_row | 3726 WIN_TINY dm_custom_ead_column, dm_custom_eadend_title_row |
3510 STRCPY_TEXT_PRINT tBatteryV ; "Battery: " | 3727 STRCPY_TEXT_PRINT tBatteryV ; "Battery: " |
3511 WIN_TINY dm_custom_clock_column, dm_custom_clock_title_row | 3728 WIN_TINY dm_custom_clock_column, dm_custom_clock_title_row |
3512 STRCPY_TEXT_PRINT tDiveClock | 3729 STRCPY_TEXT_PRINT tDiveClock |
3513 goto TFT_standard_color; and return... | 3730 goto TFT_standard_color ; and return... |
3514 | 3731 |
3515 global TFT_battinfo_tissues_clock ; Show EAD/END, Tissues and clock | 3732 global TFT_battinfo_tissues_clock ; Show EAD/END, Tissues and clock |
3516 TFT_battinfo_tissues_clock: | 3733 TFT_battinfo_tissues_clock: |
3517 ; Update clock and date | 3734 ; Update clock and date |
3518 WIN_SMALL dm_custom_clock_column, dm_custom_clock_row | 3735 WIN_SMALL dm_custom_clock_column, dm_custom_clock_row |
3519 call TFT_clock2 ; print clock | 3736 call TFT_clock2 ; print clock |
3520 | 3737 |
3521 ; Show Battery info | 3738 ; Show Battery info |
3522 WIN_SMALL dm_custom_ead_column, dm_custom_ead_row | 3739 WIN_SMALL dm_custom_ead_column, dm_custom_ead_row |
3523 movff batt_percent,lo ; Get battery percent | 3740 movff batt_percent,lo ; Get battery percent |
3524 TFT_color_code warn_battery; Color-code battery percent | 3741 TFT_color_code warn_battery ; Color-code battery percent |
3525 bsf leftbind | 3742 bsf leftbind |
3526 output_8 | 3743 output_8 |
3527 bcf leftbind | 3744 bcf leftbind |
3528 STRCAT "% " | 3745 STRCAT "% " |
3529 movlw 0x00 | 3746 movlw 0x00 |
3530 movff WREG,buffer+4 ; Only "xxx%" | 3747 movff WREG,buffer+4 ; Only "xxx%" |
3531 STRCAT_PRINT "" | 3748 STRCAT_PRINT "" |
3532 bcf win_invert | 3749 bcf win_invert |
3533 call TFT_standard_color | 3750 call TFT_standard_color |
3534 WIN_SMALL dm_custom_end_column, dm_custom_end_row | 3751 WIN_SMALL dm_custom_end_column, dm_custom_end_row |
3535 movff batt_voltage+0,lo | 3752 movff batt_voltage+0,lo |
3538 output_16dp .2 | 3755 output_16dp .2 |
3539 bcf leftbind | 3756 bcf leftbind |
3540 PUTC 'V' | 3757 PUTC 'V' |
3541 movff buffer+5,buffer+4 | 3758 movff buffer+5,buffer+4 |
3542 movlw 0x00 | 3759 movlw 0x00 |
3543 movff WREG,buffer+5 ; Only "x.yzV" | 3760 movff WREG,buffer+5 ; Only "x.yzV" |
3544 STRCAT_PRINT "" | 3761 STRCAT_PRINT "" |
3545 | 3762 |
3546 btfsc FLAG_apnoe_mode ; In Apnoe mode? | 3763 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
3547 return ; Yes, done. | 3764 return ; Yes, done. |
3548 btfsc FLAG_gauge_mode ; In Gauge mode? | 3765 btfsc FLAG_gauge_mode ; In Gauge mode? |
3549 return ; Yes, done. | 3766 return ; Yes, done. |
3550 | 3767 |
3551 ; Show tissue diagram | 3768 ; Show tissue diagram |
3552 call TFT_divemask_color | 3769 call TFT_divemask_color |
3553 WIN_TINY dm_custom_tissue_N2_column, dm_custom_tissue_N2_row | 3770 WIN_TINY dm_custom_tissue_N2_column, dm_custom_tissue_N2_row |
3554 STRCPY_TEXT_PRINT tN2 | 3771 STRCPY_TEXT_PRINT tN2 |
3555 WIN_TINY dm_custom_tissue_He_column, dm_custom_tissue_He_row | 3772 WIN_TINY dm_custom_tissue_He_column, dm_custom_tissue_He_row |
3556 STRCPY_TEXT_PRINT tHe | 3773 STRCPY_TEXT_PRINT tHe |
3557 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) | 3774 bra DISP_tissue_saturation_graph ; Show char_O_tissue_N2_saturation and char_O_tissue_He_saturation and return... |
3558 movlb b'00000001' ; select ram bank 1 | |
3559 bra DISP_tissue_saturation_graph ; Show char_O_tissue_N2_saturation and char_O_tissue_He_saturation ; and return... | |
3560 | 3775 |
3561 | 3776 |
3562 global TFT_pscr_info_mask | 3777 global TFT_pscr_info_mask |
3563 TFT_pscr_info_mask: ; Show ppO2, drop and lung ratio mask | 3778 TFT_pscr_info_mask: ; Show pSCR-ppO2, drop and lung ratio mask |
3564 rcall TFT_mask_ppo2 | 3779 rcall TFT_mask_ppo2 |
3565 call TFT_divemask_color | 3780 call TFT_divemask_color |
3566 WIN_TINY dm_custom_pscr_text_drop_column, dm_custom_pscr_text_row | 3781 WIN_TINY dm_custom_pscr_text_drop_column, dm_custom_pscr_text_row |
3567 STRCPY_TEXT_PRINT tPSCR_O2_drop | 3782 STRCPY_TEXT_PRINT tPSCR_O2_drop |
3568 WIN_TINY dm_custom_pscr_text_ratio_column, dm_custom_pscr_text_row | 3783 WIN_TINY dm_custom_pscr_text_ratio_column, dm_custom_pscr_text_row |
3569 STRCPY_TEXT_PRINT tPSCR_lungratio | 3784 STRCPY_TEXT_PRINT tPSCR_lungratio |
3570 goto TFT_standard_color; and return... | 3785 goto TFT_standard_color ; and return... |
3571 | 3786 |
3572 global TFT_pscr_info ; Show ppO2, drop and lung ratio | 3787 global TFT_pscr_info ; Show pSCR-ppO2, drop and lung ratio |
3573 TFT_pscr_info: | 3788 TFT_pscr_info: |
3574 ;show ppO2 | 3789 ;show ppO2 |
3575 rcall TFT_display_ppo2_val | 3790 WIN_MEDIUM dm_custom_ceiling_ppo2_val_col, dm_custom_ceiling_value_row |
3791 movff int_O_pSCR_ppO2+0,lo ; copy pSCR ppO2 to hi:lo | |
3792 movff int_O_pSCR_ppO2+1,hi | |
3793 TFT_color_code warn_ppo2 ; color-code output | |
3794 bsf leftbind | |
3795 output_16dp .3 ; x.xx bar | |
3796 bcf leftbind | |
3797 STRCAT_PRINT "" | |
3576 ; Show Drop | 3798 ; Show Drop |
3577 WIN_STD dm_custom_pscr_drop_column,dm_custom_pscr_drop_row | 3799 WIN_STD dm_custom_pscr_drop_column,dm_custom_pscr_drop_row |
3578 movff opt_PSCR_drop,lo | 3800 call TFT_standard_color |
3801 movff char_I_PSCR_drop,lo | |
3579 bsf leftbind | 3802 bsf leftbind |
3580 output_8 | 3803 output_8 |
3581 STRCAT_PRINT "%" | 3804 STRCAT_PRINT "%" |
3582 ; Show lung ratio | 3805 ; Show lung ratio |
3583 WIN_STD dm_custom_pscr_ratio_column,dm_custom_pscr_ratio_row | 3806 WIN_STD dm_custom_pscr_ratio_column,dm_custom_pscr_ratio_row |
3584 movff opt_PSCR_lungratio,lo | 3807 movff char_I_PSCR_lungratio,lo |
3585 bsf leftbind | 3808 bsf leftbind |
3586 STRCPY "1/" | 3809 STRCPY "1/" |
3587 output_8 | 3810 output_8 |
3588 STRCAT_PRINT "" | 3811 STRCAT_PRINT "" |
3589 bcf leftbind | 3812 bcf leftbind |
3590 return | 3813 return |
3814 | |
3815 | |
3816 global TFT_gas_needs_mask | |
3817 TFT_gas_needs_mask: | |
3818 call TFT_divemask_color | |
3819 WIN_TINY dm_custom_dyn_gas_mask_column-.10,dm_custom_dyn_gas_mask_row | |
3820 STRCPY_TEXT_PRINT tGasNeedsBar ; "Gas Needs (bar)" | |
3821 goto TFT_standard_color ; and return... | |
3822 | |
3823 global TFT_gas_needs | |
3824 TFT_gas_needs: ; LIMITATION: there is only space for 4 gases on the screen - if 5 gases | |
3825 bsf leftbind ; have a pres_need > 0, then only the first 4 will be shown! | |
3826 clrf up | |
3827 WIN_SMALL dm_custom_dyn_gas_column1+.5,dm_custom_dyn_gas_row1 | |
3828 call TFT_gas_needs_helper | |
3829 WIN_SMALL dm_custom_dyn_gas_column1+.5,dm_custom_dyn_gas_row2 | |
3830 call TFT_gas_needs_helper | |
3831 WIN_SMALL dm_custom_dyn_gas_column2+.5,dm_custom_dyn_gas_row1 | |
3832 call TFT_gas_needs_helper | |
3833 WIN_SMALL dm_custom_dyn_gas_column2+.5,dm_custom_dyn_gas_row2 | |
3834 call TFT_gas_needs_helper | |
3835 bcf leftbind | |
3836 return | |
3837 | |
3838 TFT_gas_needs_helper: | |
3839 call TFT_standard_color | |
3840 movlw .5 ; number of gases | |
3841 cpfslt up ; check if all gases have been processed | |
3842 bra TFT_gas_needs_helper_1 ; yes -> clear display area | |
3843 movf up,W ; no -> get gas number and check if need of that gas is > 0 | |
3844 rlncf WREG,W ; multipy by 2 | |
3845 lfsr FSR1,int_O_tank_pres_need+1 ; read HIGH(int_O_tank_pres_need[up]) | |
3846 movff PLUSW1,hi ; copy to temp storage hi | |
3847 btfss hi,int_is_zero ; check flag for pres_need == 0 | |
3848 bra TFT_gas_needs_helper_2 ; no -> print gas type and pressure needed | |
3849 incf up,F ; yes -> increment to next gas... | |
3850 bra TFT_gas_needs_helper ; ...and try the next gas | |
3851 TFT_gas_needs_helper_1: ; no gases to show anymore, clear display area from potential remains of last invocation | |
3852 STRCAT_PRINT " ---- " ; overwrite outdated stuff if screen position is not needed | |
3853 return | |
3854 TFT_gas_needs_helper_2: ; output gas type and pressure needed | |
3855 movf up,W ; get gas number (0-4) to WREG | |
3856 lfsr FSR1,opt_gas_O2_ratio ; read opt_gas_O2_ratio[WREG] | |
3857 movff PLUSW1,lo ; copy result to lo | |
3858 movf up,W ; get gas number (0-4) to WREG ; SHOULD NOT BE NEEDED AS movff SHOULD NOT ALTER wreg | |
3859 lfsr FSR1,opt_gas_He_ratio ; read opt_gas_He_ratio[WREG] | |
3860 movff PLUSW1,hi ; copy result to hi | |
3861 call customview_show_mix ; print "Air", "O2", "21/35", etc. | |
3862 STRCAT ":" | |
3863 movf up,W ; get gas number (0-4) to WREG | |
3864 rlncf WREG,W ; multipy by 2 | |
3865 lfsr FSR1,int_O_tank_pres_need+0 ; read lower part of integer | |
3866 movff PLUSW1,lo | |
3867 movf up,W ; get gas number (0-4) to WREG ; SHOULD NOT BE NEEDED AS movff SHOULD NOT ALTER wreg | |
3868 rlncf WREG,W ; multipy by 2 | |
3869 lfsr FSR1,int_O_tank_pres_need+1 ; read upper part of integer | |
3870 movff PLUSW1,hi | |
3871 btfsc hi,int_prewarning_flag ; check if pre-warning flag is set (pres_need > pres_fill * threshold) | |
3872 call TFT_attention_color ; yes, print gas need in yellow | |
3873 btfsc hi,int_warning_flag ; check if warning flag is set (pres_need > pres_fill) | |
3874 call TFT_warnings_color ; yes, print gas need in red | |
3875 movff int_O_tank_pres_need+1,WREG ; get HIGH(int_O_tank_pres_need[0]) which hold flag for invalid data | |
3876 btfsc WREG,int_invalid_flag ; check if invalid data flag is set | |
3877 call TFT_disabled_color ; yes, print gas need in disabled color | |
3878 bcf hi,int_prewarning_flag ; clear pre-warning flag for attention color | |
3879 bcf hi,int_warning_flag ; clear warning flag for warning color | |
3880 bcf hi,int_invalid_flag ; clear flag for invalid data (will actually only be set with 1st gas) | |
3881 output_16_3 ; limit to 999 and display only (0-999) | |
3882 STRCAT_PRINT " " ; adds a space to overwrite any potential remains of earlier outputs | |
3883 incf up,F ; increment to next gas | |
3884 goto TFT_standard_color ; and return... | |
3885 | |
3886 | |
3887 global TFT_mask_ppo2 ; helper function for several custom views | |
3888 TFT_mask_ppo2: | |
3889 call TFT_divemask_color | |
3890 btfss FLAG_ccr_mode ; in CCR mode? | |
3891 bra TFT_mask_ppo2a ; NO - continue checking for pSCR and OC | |
3892 btfsc is_bailout ; in bailout? | |
3893 bra TFT_mask_ppo2b ; YES | |
3894 WIN_TINY dm_custom_ceiling_ppo2_col_dil,dm_custom_ceiling_text_row ; tuned position for longer text | |
3895 STRCPY_TEXT_PRINT tppO2Dil ; print "ppO2(Dil)" | |
3896 goto TFT_standard_color ; and return... | |
3897 TFT_mask_ppo2a: | |
3898 btfss FLAG_pscr_mode ; in pSCR mode? | |
3899 bra TFT_mask_ppo2b ; NO - continue with OC mode (or bailout) | |
3900 btfsc is_bailout ; in bailout? | |
3901 bra TFT_mask_ppo2b ; YES | |
3902 WIN_TINY dm_custom_ceiling_ppo2_col_dil,dm_custom_ceiling_text_row ; tuned position for longer text | |
3903 STRCPY_TEXT_PRINT tppO2Mix ; print "ppO2(Mix)" | |
3904 goto TFT_standard_color ; and return... | |
3905 TFT_mask_ppo2b: ; OC mode or bailout | |
3906 WIN_TINY dm_custom_ceiling_ppo2_column, dm_custom_ceiling_text_row ; normal position | |
3907 STRCPY_TEXT_PRINT tppO2 ; in all other modes | |
3908 goto TFT_standard_color ; and return... | |
3909 | |
3910 global TFT_display_pure_ppo2 ; show ppO2 of the pure gas - helper function for several custom views | |
3911 TFT_display_pure_ppo2: | |
3912 WIN_MEDIUM dm_custom_ceiling_ppo2_val_col, dm_custom_ceiling_value_row | |
3913 movff int_O_pure_ppO2+0,lo ; copy ppO2 of the pure gas to hi:lo | |
3914 movff int_O_pure_ppO2+1,hi | |
3915 TFT_color_code warn_ppo2 ; color-code output | |
3916 bsf leftbind | |
3917 output_16dp .3 ; x.xx bar | |
3918 bcf leftbind | |
3919 STRCAT_PRINT "" | |
3920 goto TFT_standard_color ; and return... | |
3921 | |
3591 | 3922 |
3923 global TFT_ppo2_ead_end_cns_mask ; Show ppO2, END/EAD and CNS mask | |
3924 TFT_ppo2_ead_end_cns_mask: | |
3925 rcall TFT_mask_ppo2 | |
3926 call TFT_divemask_color | |
3927 WIN_TINY dm_custom_ead_column, dm_custom_eadend_title_row | |
3928 STRCPY_TEXT_PRINT tDiveEAD_END | |
3929 WIN_TINY dm_custom_gf_title_col3, dm_custom_gf_title_row | |
3930 STRCPY_TEXT_PRINT tCNS2 | |
3931 goto TFT_standard_color ; and return... | |
3592 | 3932 |
3593 global TFT_ppo2_ead_end_cns_mask ; Show ppO2, END/EAD and CNS mask | 3933 global TFT_ppo2_ead_end_cns ; Show ppO2, END/EAD and CNS |
3594 TFT_ppo2_ead_end_cns_mask: | |
3595 rcall TFT_mask_ppo2 | |
3596 call TFT_divemask_color | |
3597 WIN_TINY dm_custom_ead_column, dm_custom_eadend_title_row | |
3598 STRCPY_TEXT_PRINT tDiveEAD_END | |
3599 WIN_TINY dm_custom_gf_title_col3, dm_custom_gf_title_row | |
3600 STRCPY_TEXT_PRINT tCNS2 | |
3601 goto TFT_standard_color; and return... | |
3602 | |
3603 | |
3604 global TFT_ppo2_ead_end_cns ; Show ppO2, END/EAD and CNS | |
3605 TFT_ppo2_ead_end_cns: | 3934 TFT_ppo2_ead_end_cns: |
3606 ;show ppO2 | 3935 ;show ppO2 |
3607 rcall TFT_display_ppo2_val | 3936 rcall TFT_display_pure_ppo2 ; show ppO2 of the pure gas |
3608 ; Show END/EAD | 3937 ; Show END/EAD |
3609 WIN_SMALL dm_custom_ead_column, dm_custom_ead_row | 3938 WIN_SMALL dm_custom_ead_column, dm_custom_ead_row |
3610 STRCPY_TEXT tEAD ; EAD: | 3939 STRCPY_TEXT tEAD ; EAD: |
3611 movff char_O_EAD,lo | 3940 movff char_O_EAD,lo |
3612 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | 3941 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars |
3613 WIN_SMALL dm_custom_end_column, dm_custom_end_row | 3942 WIN_SMALL dm_custom_end_column, dm_custom_end_row |
3614 STRCPY_TEXT tEND ; END: | 3943 STRCPY_TEXT tEND ; END: |
3615 movff char_O_END,lo | 3944 movff char_O_END,lo |
3616 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | 3945 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars |
3617 ; Show CNS | 3946 ; Show CNS |
3618 WIN_STD dm_custom_currentgf_column, dm_custom_currentgf_row | 3947 WIN_STD dm_custom_currentgf_column, dm_custom_currentgf_row |
3619 TFT_color_code warn_cns ; Color-code CNS output | |
3620 movff int_O_CNS_fraction+0,lo | 3948 movff int_O_CNS_fraction+0,lo |
3621 movff int_O_CNS_fraction+1,hi | 3949 movff int_O_CNS_fraction+1,hi |
3950 TFT_color_code warn_cns ; Color-code CNS output | |
3622 bsf leftbind | 3951 bsf leftbind |
3623 output_16_3 ;Displays only 0...999 | 3952 output_16_3 ; Displays only 0...999 |
3624 bcf leftbind | 3953 bcf leftbind |
3625 STRCAT_PRINT "%" | 3954 STRCAT_PRINT "%" |
3626 goto TFT_standard_color; and return... | 3955 goto TFT_standard_color ; and return... |
3627 | 3956 |
3628 TFT_end_ead_common: ; print "lo m" (or ft) and limit to 8 chars | 3957 TFT_end_ead_common: ; print "lo m" (or ft) and limit to 8 chars |
3629 bsf leftbind | 3958 bsf leftbind |
3630 TSTOSS opt_units ; 0=Meters, 1=Feets | 3959 TSTOSS opt_units ; 0=Meters, 1=Feets |
3631 bra TFT_end_ead_common_metric | 3960 bra TFT_end_ead_common_metric |
3632 ;TFT_end_ead_common_imperial: | 3961 ;TFT_end_ead_common_imperial: |
3633 ; With lo in m | 3962 movf lo,W ; With lo in m |
3634 movf lo,W | 3963 mullw .100 ; PRODL:PRODH = mbar/min |
3635 mullw .100 ; PRODL:PRODH = mbar/min | |
3636 movff PRODL,lo | 3964 movff PRODL,lo |
3637 movff PRODH,hi | 3965 movff PRODH,hi |
3638 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | 3966 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
3639 output_16_3 | 3967 output_16_3 |
3640 STRCAT_TEXT tFeets | 3968 STRCAT_TEXT tFeets |
3641 clrf WREG | 3969 clrf WREG |
3642 movff WREG,buffer+.8 ; limit string length to 8 | 3970 movff WREG,buffer+.8 ; limit string length to 8 |
3643 bra TFT_end_ead_common_exit | 3971 bra TFT_end_ead_common_exit |
3644 TFT_end_ead_common_metric: | 3972 TFT_end_ead_common_metric: |
3645 output_8 | 3973 output_8 |
3646 STRCAT_TEXT tMeters | 3974 STRCAT_TEXT tMeters |
3647 TFT_end_ead_common_exit: | 3975 TFT_end_ead_common_exit: |
3648 bcf leftbind | 3976 bcf leftbind |
3649 movlw .8 | 3977 movlw .8 |
3650 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | 3978 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
3651 STRCAT_PRINT "" | 3979 STRCAT_PRINT "" |
3652 return | 3980 return |
3653 | 3981 |
3654 global TFT_sensor_check_mask ; Show ppO2 of O2 and Diluent mask | 3982 |
3983 global TFT_sensor_check_mask ; show ppO2 of O2 and Diluent mask | |
3655 TFT_sensor_check_mask: | 3984 TFT_sensor_check_mask: |
3656 call TFT_divemask_color | 3985 call TFT_divemask_color |
3657 WIN_TINY dm_custom_s_check_text_column, dm_custom_s_check_text_row | 3986 WIN_TINY dm_custom_s_check_text_column, dm_custom_s_check_text_row |
3658 STRCPY_TEXT_PRINT tSensorCheck | 3987 STRCPY_TEXT_PRINT tSensorCheck |
3659 WIN_TINY dm_custom_ppO2_text_column, dm_custom_s_check_text_row | 3988 WIN_TINY dm_custom_ppO2_text_column, dm_custom_s_check_text_row |
3660 STRCPY_TEXT_PRINT tppO2O2 | 3989 STRCPY_TEXT_PRINT tppO2O2 |
3661 WIN_TINY dm_custom_ppDil_text_column, dm_custom_s_check_text_row | 3990 WIN_TINY dm_custom_ppDil_text_column, dm_custom_s_check_text_row |
3662 STRCPY_TEXT_PRINT tppO2Dil | 3991 STRCPY_TEXT_PRINT tppO2Dil |
3663 return | 3992 goto TFT_standard_color ; and return... |
3664 | 3993 |
3665 global TFT_sensor_check ; Show ppO2 of O2 and Diluent | 3994 global TFT_sensor_check ; show ppO2 of O2 and Diluent |
3666 TFT_sensor_check: | 3995 TFT_sensor_check: |
3667 ; Show ppO2 of O2 in this depth | 3996 ; Show ppO2 of O2 in this depth |
3668 SAFE_2BYTE_COPY amb_pressure, xA | 3997 WIN_MEDIUM dm_custom_s_check_ppo2_o2_column, dm_custom_s_check_value_row |
3669 movlw d'10' | 3998 movff int_O_O2_ppO2+0,lo ; copy ppO2 of pure O2 to hi:lo |
3670 movwf xB+0 | 3999 movff int_O_O2_ppO2+1,hi |
3671 clrf xB+1 | 4000 TFT_color_code warn_ppo2 ; color-code output |
3672 call div16x16 ; xC=p_amb/10 | 4001 bsf leftbind |
3673 movff xC+0,xA+0 | 4002 output_16dp .3 ; x.xx bar |
3674 movff xC+1,xA+1 | 4003 bcf leftbind |
3675 movlw .100 | 4004 STRCAT_PRINT "" |
3676 movwf xB+0 ; =O2 ratio | |
3677 clrf xB+1 | |
3678 call mult16x16 ; char_I_O2_ratio * p_amb/10 | |
3679 call TFT_standard_color | |
3680 TFT_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) | |
3681 WIN_MEDIUM dm_custom_s_check_ppo2_o2_column, dm_custom_s_check_value_row | |
3682 ; ; hijacking neg_flag_velocity to know where the value is displayed | |
3683 bsf neg_flag_velocity | |
3684 call TFT_display_ppo2_com | |
3685 | |
3686 ; Show ppO2 of the diluent in this depth | 4005 ; Show ppO2 of the diluent in this depth |
3687 SAFE_2BYTE_COPY amb_pressure, xA | |
3688 movlw d'10' | |
3689 movwf xB+0 | |
3690 clrf xB+1 | |
3691 call div16x16 ; xC=p_amb/10 | |
3692 movff xC+0,xA+0 | |
3693 movff xC+1,xA+1 | |
3694 movff char_I_O2_ratio,xB+0 ; =O2 ratio | |
3695 clrf xB+1 | |
3696 call mult16x16 ; char_I_O2_ratio * p_amb/10 | |
3697 call TFT_standard_color | |
3698 TFT_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) | |
3699 WIN_MEDIUM dm_custom_s_check_ppo2_dil_col, dm_custom_s_check_value_row | 4006 WIN_MEDIUM dm_custom_s_check_ppo2_dil_col, dm_custom_s_check_value_row |
3700 ; ; hijacking neg_flag_velocity to know where the value is displayed | 4007 movff int_O_pure_ppO2+0,lo ; copy ppO2 of pure gas to hi:lo |
3701 bsf neg_flag_velocity | 4008 movff int_O_pure_ppO2+1,hi |
3702 goto TFT_display_ppo2_com; and return... | 4009 TFT_color_code warn_ppo2 ; color-code output |
4010 bsf leftbind | |
4011 output_16dp .3 ; x.xx bar | |
4012 bcf leftbind | |
4013 STRCAT_PRINT "" | |
4014 goto TFT_standard_color ; and return... | |
4015 | |
4016 ;============================================================================= | |
3703 | 4017 |
3704 global TFT_surface_lastdive | 4018 global TFT_surface_lastdive |
3705 TFT_surface_lastdive: | 4019 TFT_surface_lastdive: |
3706 call TFT_divemask_color | 4020 call TFT_divemask_color |
3707 WIN_TINY surf_gaslist_column,surf_gaslist_row+.5 | 4021 WIN_TINY surf_gaslist_column,surf_gaslist_row+.5 |
3710 STRCAT_TEXT_PRINT tDivetime ; Divetime | 4024 STRCAT_TEXT_PRINT tDivetime ; Divetime |
3711 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)+.5 | 4025 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)+.5 |
3712 STRCAT_TEXT_PRINT tMaxDepth ; Max. Depth | 4026 STRCAT_TEXT_PRINT tMaxDepth ; Max. Depth |
3713 call TFT_standard_color | 4027 call TFT_standard_color |
3714 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row | 4028 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row |
4029 | |
4030 movff int_O_desaturation_time+0,lo ; bank-safe copies | |
4031 movff int_O_desaturation_time+1,WREG | |
4032 iorwf lo,W ; check if desaturation time is zero | |
4033 bz TFT_surface_lastdive_1 ; YES - show last dive time | |
4034 movff surface_interval+0,lo ; NO - show dive interval | |
4035 movff surface_interval+1,hi | |
4036 call convert_time ; lo=mins, hi=hours | |
4037 movf hi,W | |
4038 movff lo,hi | |
4039 movwf lo ; exchange lo and hi | |
4040 bsf leftbind | |
4041 output_99x | |
4042 PUTC 'h' | |
4043 movff hi,lo | |
4044 output_99x | |
4045 STRCAT_PRINT "m " | |
4046 bra TFT_surface_lastdive_2 | |
4047 TFT_surface_lastdive_1: | |
3715 movff lastdive_time+0,xC+0 | 4048 movff lastdive_time+0,xC+0 |
3716 movff lastdive_time+1,xC+1 | 4049 movff lastdive_time+1,xC+1 |
3717 movff lastdive_time+2,xC+2 | 4050 movff lastdive_time+2,xC+2 |
3718 movff lastdive_time+3,xC+3 | 4051 movff lastdive_time+3,xC+3 |
3719 movlw LOW .3600 | 4052 movlw LOW .3600 |
3720 movwf xB+0 | 4053 movwf xB+0 |
3721 movlw HIGH .3600 | 4054 movlw HIGH .3600 |
3722 movwf xB+1 ; One day = 3600s | 4055 movwf xB+1 ; One day = 3600s |
3723 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | 4056 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder |
3724 ;xC+0:xC+1 -> Full hours | 4057 ;xC+0:xC+1 -> Full hours |
3725 movff xC+1,xA+1 | 4058 movff xC+1,xA+1 |
3726 movff xC+0,xA+0 | 4059 movff xC+0,xA+0 |
3727 clrf xB+1 | 4060 clrf xB+1 |
3728 movlw .24 | 4061 movlw .24 |
3729 movwf xB+0 | 4062 movwf xB+0 |
3730 call div16x16 ;xA/xB=xC with xA+0 as remainder | 4063 call div16x16 ;xA/xB=xC with xA+0 as remainder |
3731 movff xC+0,lo | 4064 movff xC+0,lo |
3732 movff xC+1,hi ; Full days | 4065 movff xC+1,hi ; Full days |
3733 bsf leftbind | 4066 bsf leftbind |
3734 output_16 | 4067 output_16 |
3735 PUTC "d" | 4068 PUTC "d" |
3736 movff xA+0,lo ; Full hours | 4069 movff xA+0,lo ; Full hours |
3737 output_8 | 4070 output_8 |
3738 STRCAT_PRINT "h" | 4071 STRCAT_PRINT "h " |
4072 TFT_surface_lastdive_2: | |
3739 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.1) | 4073 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.1) |
3740 movff lastdive_duration+0,lo | 4074 movff lastdive_duration+0,lo |
3741 movff lastdive_duration+1,hi | 4075 movff lastdive_duration+1,hi |
3742 output_16 ; divetime minutes | 4076 output_16 ; divetime minutes |
3743 PUTC ":" | 4077 PUTC ":" |
3745 output_99x ; divetime seconds | 4079 output_99x ; divetime seconds |
3746 STRCAT_PRINT "" | 4080 STRCAT_PRINT "" |
3747 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.2) | 4081 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.2) |
3748 movff lastdive_maxdepth+0,lo | 4082 movff lastdive_maxdepth+0,lo |
3749 movff lastdive_maxdepth+1,hi | 4083 movff lastdive_maxdepth+1,hi |
3750 TSTOSS opt_units ; 0=Meters, 1=Feets | 4084 TSTOSS opt_units ; 0=Meters, 1=Feets |
3751 bra TFT_surface_lastdive_metric | 4085 bra TFT_surface_lastdive_metric |
3752 ;imperial | 4086 ;imperial |
3753 rcall convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | 4087 rcall convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
3754 output_16_3 ; limit to 999 and display only (0-999) | 4088 output_16_3 ; limit to 999 and display only (0-999) |
3755 STRCAT_TEXT tFeets1 | 4089 STRCAT_TEXT tFeets1 |
3756 bra TFT_surface_lastdive2 | 4090 bra TFT_surface_lastdive2 |
3757 | 4091 |
3758 TFT_surface_lastdive_metric: | 4092 TFT_surface_lastdive_metric: |
3759 bsf ignore_digit5 ; no cm... | 4093 bsf ignore_digit5 ; no cm... |
3760 movlw d'1' ; +1 | 4094 movlw d'1' ; +1 |
3761 movff WREG,ignore_digits ; no 1000m | 4095 movff WREG,ignore_digits ; no 1000m |
3762 output_16dp .3 ; xxx.y | 4096 output_16dp .3 ; xxx.y |
3763 STRCAT_TEXT tMeters | 4097 STRCAT_TEXT tMeters |
3764 TFT_surface_lastdive2: | 4098 TFT_surface_lastdive2: |
3765 STRCAT_PRINT "" | 4099 STRCAT_PRINT "" |
3766 bcf leftbind | 4100 bcf leftbind |
3767 return ; Done. | 4101 return ; Done. |
3768 | 4102 |
4103 ;============================================================================= | |
4104 | |
3769 global TFT_surface_tissues | 4105 global TFT_surface_tissues |
3770 TFT_surface_tissues: ; Show Tissue diagram in surface mode | 4106 TFT_surface_tissues: ; Show Tissue diagram in surface mode |
3771 WIN_SMALL surf_tissue_N2_column,surf_tissue_N2_row | 4107 WIN_SMALL surf_tissue_N2_column,surf_tissue_N2_row |
3772 STRCPY_TEXT_PRINT tN2 | 4108 STRCPY_TEXT_PRINT tN2 |
3773 WIN_SMALL surf_tissue_He_column,surf_tissue_He_row | 4109 WIN_SMALL surf_tissue_He_column,surf_tissue_He_row |
3774 STRCPY_TEXT_PRINT tHe | 4110 STRCPY_TEXT_PRINT tHe |
3775 | 4111 |
3776 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) | 4112 movlw color_deepblue |
3777 movlb b'00000001' ; select ram bank 1 | 4113 call TFT_set_color ; Make this configurable? |
3778 | |
3779 movlw color_deepblue | |
3780 call TFT_set_color ; Make this configurable? | |
3781 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.29,.29 | 4114 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.29,.29 |
3782 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.37,.37 | 4115 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.37,.37 |
3783 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.45,.45 | 4116 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.45,.45 |
3784 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.53,.53 | 4117 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.53,.53 |
3785 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.61,.61 | 4118 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.61,.61 |
3786 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.69,.69 | 4119 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.69,.69 |
3787 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.77,.77 | 4120 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.77,.77 |
3788 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.85,.85 | 4121 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.85,.85 |
3789 WIN_FRAME_STD surf_tissue_diagram_top, surf_tissue_diagram_bottom, surf_tissue_diagram_left, surf_tissue_diagram_right ; outer frame | 4122 WIN_FRAME_STD surf_tissue_diagram_top, surf_tissue_diagram_bottom, surf_tissue_diagram_left, surf_tissue_diagram_right ; outer frame |
3790 | 4123 |
3791 movlw .1 | 4124 movlw .1 |
3792 movff WREG,win_height ; row bottom (0-239) | 4125 movff WREG,win_height ; row bottom (0-239) |
3793 movlw surf_tissue_diagram_left+.4 ; Surface mode | 4126 |
3794 movff WREG,win_leftx2 ; column left (0-159) | 4127 ;---- Draw N2 Tissues ---------------------------------------------------- |
3795 movlw surf_tissue_diagram_right - surf_tissue_diagram_left - .4 ; Width | 4128 |
4129 movlw surf_tissue_diagram_left+.4 ; start position for N2 bars | |
4130 movff WREG,win_leftx2 ; column left (0-159) | |
4131 movlw surf_tissue_diagram_right - surf_tissue_diagram_left - .4 ; max width for N2 bars | |
3796 movff WREG,win_width | 4132 movff WREG,win_width |
3797 | 4133 |
3798 ;---- Draw N2 Tissues | |
3799 lfsr FSR2, char_O_tissue_N2_saturation | 4134 lfsr FSR2, char_O_tissue_N2_saturation |
3800 movlw d'16' | 4135 movlw d'16' |
3801 movwf wait_temp ; 16 tissues | 4136 movwf wait_temp ; 16 tissues |
3802 clrf waitms_temp ; Row offset | 4137 clrf waitms_temp ; row offset |
3803 surf_tissue_saturation_graph_N2: | 4138 surf_tissue_saturation_graph_N2: |
3804 movlw surf_tissue_diagram_top+.23 ; surface mode | 4139 movlw surf_tissue_diagram_top+.23 ; surface mode |
3805 addwf waitms_temp,W | 4140 addwf waitms_temp,W |
3806 movff WREG,win_top ; row top (0-239) | 4141 movff WREG,win_top ; row top (0-239) |
3807 rcall surf_tissue_saturation_loop ; Show one tissue | 4142 rcall surf_tissue_saturation_loop ; show one tissue |
3808 decfsz wait_temp,F | 4143 decfsz wait_temp,F |
3809 bra surf_tissue_saturation_graph_N2 | 4144 bra surf_tissue_saturation_graph_N2 |
3810 | 4145 |
3811 ;---- Draw He Tissues ---------------------------------------------------- | 4146 ;---- Draw He Tissues ---------------------------------------------------- |
4147 | |
4148 movlw surf_tissue_diagram_left + .24 ; start position for He bars (.15 without x2) | |
4149 movff WREG,win_leftx2 ; column left (0-159) | |
4150 movlw surf_tissue_diagram_right - surf_tissue_diagram_left - .24 ; max width for He bars | |
4151 movff WREG,win_width | |
4152 | |
3812 lfsr FSR2, char_O_tissue_He_saturation | 4153 lfsr FSR2, char_O_tissue_He_saturation |
3813 movlw d'16' | 4154 movlw d'16' |
3814 movwf wait_temp ; 16 tissues | 4155 movwf wait_temp ; 16 tissues |
3815 clrf waitms_temp ; Row offset | 4156 clrf waitms_temp ; row offset |
3816 surf_tissue_saturation_graph_He: | 4157 surf_tissue_saturation_graph_He: |
3817 movlw surf_tissue_diagram_top+.23+.56 ; surface mode | 4158 movlw surf_tissue_diagram_top+.23+.56 ; surface mode |
3818 addwf waitms_temp,W | 4159 addwf waitms_temp,W |
3819 movff WREG,win_top ; row top (0-239) | 4160 movff WREG,win_top ; row top (0-239) |
3820 rcall surf_tissue_saturation_loop ; Show one tissue | 4161 rcall surf_tissue_saturation_loop ; show one tissue |
3821 decfsz wait_temp,F | 4162 decfsz wait_temp,F |
3822 bra surf_tissue_saturation_graph_He | 4163 bra surf_tissue_saturation_graph_He |
3823 return | 4164 |
4165 WIN_SMALL surf_tissue_He_column+.22,surf_tissue_He_row ; position in-between tissue bars | |
4166 movff int_O_CNS_fraction+0,lo | |
4167 movff int_O_CNS_fraction+1,hi | |
4168 TFT_color_code warn_cns | |
4169 STRCPY_TEXT tCNS2 ; CNS: | |
4170 bsf leftbind | |
4171 output_16_3 ; Displays only 0...999 | |
4172 bcf leftbind | |
4173 STRCAT_PRINT "%" | |
4174 goto TFT_standard_color ; and return... | |
3824 | 4175 |
3825 surf_tissue_saturation_loop: | 4176 surf_tissue_saturation_loop: |
3826 call TFT_standard_color | 4177 call TFT_standard_color |
3827 movlw .2 ; row spacing | 4178 movlw .2 ; row spacing |
3828 addwf waitms_temp,F | 4179 addwf waitms_temp,F |
3829 movf POSTINC2,W ; Get tissue load | 4180 movf POSTINC2,W ; get tissue load |
3830 bcf STATUS,C | 4181 bcf WREG,7 ; clear flag bit for sat/desat info (not used in surface mode) |
3831 rrcf WREG ; And divide by 2 | 4182 rlncf WREG,W ; multiply with 2 (previously cleared bit 7 will be rotated to bit 0) |
4183 incf WREG,W ; add 1 for a minimum visible bar (He-bars could be invisible else-wise) | |
3832 movwf temp1 | 4184 movwf temp1 |
3833 movlw .20 | 4185 movff win_width+0,WREG ; get max window width (win_width) |
3834 subwf temp1,F ; Subtract some offset | 4186 cpfslt temp1 ; skip if WREG < win_width |
3835 movf win_width+0,W ; Max width. | 4187 movwf temp1 ; crop length to win_width |
3836 cpfslt temp1 ; skip if WREG < win_width | 4188 ; no need to be able to draw longer bars – |
3837 movwf temp1 | 4189 ; we are at the surface and if bars would |
4190 ; even touch the max length possible here, | |
4191 ; the diver would be in severe decompression | |
4192 ; issues if not dead already... | |
3838 movff temp1,win_bargraph | 4193 movff temp1,win_bargraph |
3839 clrf win_width+1 | 4194 clrf win_width+1 |
3840 goto TFT_box ; and return... | 4195 goto TFT_box ; and return... |
3841 | 4196 |
3842 ;============================================================================= | 4197 ;============================================================================= |
3843 ; Draw saturation graph, is surface mode or in dive mode. | 4198 ; Draw saturation graph in dive mode. |
4199 | |
3844 DISP_tissue_saturation_graph: | 4200 DISP_tissue_saturation_graph: |
3845 ;---- Draw Frame | 4201 ;---- Draw Frame |
3846 call TFT_standard_color | 4202 call TFT_standard_color |
3847 WIN_FRAME_COLOR16 dm_custom_tissue_diagram_top, dm_custom_tissue_diagram_bottom, dm_custom_tissue_diagram_left, .159 ; outer frame | 4203 WIN_FRAME_COLOR16 dm_custom_tissue_diagram_top, dm_custom_tissue_diagram_bottom, dm_custom_tissue_diagram_left, .159 ; outer frame |
3848 | 4204 |
3849 movlw .1 | 4205 movlw .1 |
3850 movff WREG,win_height ; row bottom (0-239) | 4206 movff WREG,win_height ; row bottom (0-239) |
3851 movlw dm_custom_tissue_diagram_left+.3 ; divemode | 4207 |
3852 movff WREG,win_leftx2 ; column left (0-159) | 4208 ;---- Draw N2 Tissues ---------------------------------------------------- |
3853 movlw .159-dm_custom_tissue_diagram_left-.4 ; Width | 4209 |
4210 movlw dm_custom_tissue_diagram_left+.3 ; divemode | |
4211 movff WREG,win_leftx2 ; column left (0-159) | |
4212 movlw .159-dm_custom_tissue_diagram_left-.4 ; width | |
3854 movff WREG,win_width | 4213 movff WREG,win_width |
3855 | 4214 |
3856 ;---- Draw N2 Tissues | |
3857 lfsr FSR2, char_O_tissue_N2_saturation | 4215 lfsr FSR2, char_O_tissue_N2_saturation |
3858 movlw d'16' | 4216 movlw d'16' |
3859 movwf wait_temp ; 16 tissues | 4217 movwf wait_temp ; 16 tissues |
3860 clrf waitms_temp ; Row offset | 4218 clrf waitms_temp ; row offset |
3861 tissue_saturation_graph_N2: | 4219 tissue_saturation_graph_N2: |
3862 movlw dm_custom_tissue_diagram_top+.3 ; divemode | 4220 movlw dm_custom_tissue_diagram_top+.3 ; divemode |
3863 rcall tissue_saturation_graph_loop ; Show one tissue | 4221 rcall tissue_saturation_graph_loop ; show one tissue |
3864 decfsz wait_temp,F | 4222 decfsz wait_temp,F |
3865 bra tissue_saturation_graph_N2 | 4223 bra tissue_saturation_graph_N2 |
3866 | 4224 |
3867 ;---- Draw He Tissues ---------------------------------------------------- | 4225 ;---- Draw He Tissues ---------------------------------------------------- |
4226 | |
4227 movlw dm_custom_tissue_diagram_left + .8 ; divemode | |
4228 movff WREG,win_leftx2 ; column left (0-159) | |
4229 movlw .159 - dm_custom_tissue_diagram_left - .14 ; width | |
4230 movff WREG,win_width | |
4231 | |
3868 lfsr FSR2, char_O_tissue_He_saturation | 4232 lfsr FSR2, char_O_tissue_He_saturation |
3869 movlw d'16' | 4233 movlw d'16' |
3870 movwf wait_temp ; 16 tissues | 4234 movwf wait_temp ; 16 tissues |
3871 clrf waitms_temp ; Row offset | 4235 clrf waitms_temp ; row offset |
3872 tissue_saturation_graph_He: | 4236 tissue_saturation_graph_He: |
3873 movlw dm_custom_tissue_diagram_top+.3+.22 ; divemode | 4237 movlw dm_custom_tissue_diagram_top+.3+.22 ; divemode |
3874 rcall tissue_saturation_graph_loop ; Show one tissue | 4238 rcall tissue_saturation_graph_loop ; show one tissue |
3875 | |
3876 decfsz wait_temp,F | 4239 decfsz wait_temp,F |
3877 bra tissue_saturation_graph_He | 4240 bra tissue_saturation_graph_He |
3878 return | 4241 goto TFT_standard_color ; and return... |
3879 | 4242 |
3880 tissue_saturation_graph_loop: | 4243 tissue_saturation_graph_loop: |
3881 addwf waitms_temp,W | 4244 addwf waitms_temp,W |
3882 movff WREG,win_top ; row top (0-239) | 4245 movff WREG,win_top ; row top (0-239) |
3883 | 4246 movlw color_cyan ; preset color for tissues with decreasing pressure |
3884 call TFT_standard_color | 4247 call TFT_set_color |
3885 incf waitms_temp,F | 4248 incf waitms_temp,F |
3886 movf POSTINC2,W | 4249 movf POSTINC2,W |
3887 bcf STATUS,C | 4250 btfss WREG,7 ; check fs flag for increasing tissue pressure set |
3888 rrcf WREG | 4251 bra tissue_saturation_graph_loop_1 ; NO - keep color |
4252 movwf temp1 ; YES - buffer WREG | |
4253 movlw color_orange ; select color for tissues with increasing pressure | |
4254 call TFT_set_color ; change color | |
4255 movf temp1,W ; restore WREG | |
4256 tissue_saturation_graph_loop_1: | |
4257 bcf WREG,7 ; clear flag bit | |
3889 bcf STATUS,C | 4258 bcf STATUS,C |
3890 rrcf WREG ; And divide by 4 | 4259 rrcf WREG ; divide by 2 |
4260 incf WREG,W ; add a bit for a minimum visible bar | |
3891 movwf temp1 | 4261 movwf temp1 |
3892 movlw .12 | 4262 ;movlw .1 |
3893 subwf temp1,F ; Subtract some offset | 4263 ;addwf temp1,F ; add a bit for a minimum visible bar (old version) |
3894 movf win_width,W ; Max width. | 4264 movf win_width,W ; get max window width (win_width) |
3895 cpfslt temp1 ; skip if WREG < win_width | 4265 cpfslt temp1 ; skip if WREG < win_width |
3896 movwf temp1 | 4266 movwf temp1 |
3897 movff temp1,win_bargraph | 4267 movff temp1,win_bargraph |
3898 clrf win_width+1 | 4268 clrf win_width+1 |
3899 goto TFT_box ; and return | 4269 goto TFT_box ; and return... |
3900 | 4270 |
4271 ;============================================================================= | |
3901 | 4272 |
3902 global TFT_display_cns | 4273 global TFT_display_cns |
3903 TFT_display_cns: | 4274 TFT_display_cns: |
3904 rcall TFT_warning_set_window ; Sets the row and column for the current warning | 4275 call TFT_warning_set_window ; Sets the row and column for the current warning |
3905 tstfsz WREG ; Is there room for the warning? | 4276 tstfsz WREG ; Is there room for the warning? |
3906 return ; No | 4277 return ; No |
3907 call TFT_warning_set_window_com | 4278 STRCPY_TEXT tCNS ; CNS: |
3908 TFT_color_code warn_cns ; Color-code CNS output | 4279 movff int_O_CNS_fraction+0,lo |
3909 STRCPY_TEXT tCNS2 ; CNS: | |
3910 movff int_O_CNS_fraction+0,lo | |
3911 movff int_O_CNS_fraction+1,hi | 4280 movff int_O_CNS_fraction+1,hi |
4281 TFT_color_code warn_cns ; Color-code CNS output | |
4282 bsf leftbind | |
4283 output_16_3 ; Displays only 0...999 | |
4284 bcf leftbind | |
4285 PUTC "%" | |
4286 movlw dm_warning_length ; Divemode string length | |
4287 btfss divemode ; In Divemode? | |
4288 movlw surf_warning_length ; No, use surface string length | |
4289 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
4290 STRCAT_PRINT "" | |
4291 bcf win_invert | |
4292 goto TFT_standard_color ; and return... | |
4293 | |
4294 | |
4295 global TFT_display_eod_cns | |
4296 TFT_display_eod_cns: | |
4297 call TFT_warning_set_window ; Sets the row and column for the current warning | |
4298 tstfsz WREG ; Is there room for the warning? | |
4299 return ; No | |
4300 call TFT_warnings_color ; switch to warnings (red) text color | |
4301 STRCPY_TEXT tCNSeod ; end-of-dive CNS warning text | |
4302 movlw dm_warning_length ; Divemode string length | |
4303 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
4304 STRCAT_PRINT "" | |
4305 goto TFT_standard_color ; and return... | |
4306 | |
4307 | |
4308 global TFT_display_ppo2 | |
4309 TFT_display_ppo2: | |
4310 call TFT_warning_set_window ; Sets the row and column for the current warning | |
4311 tstfsz WREG ; Is there room for the warning? | |
4312 return ; No | |
4313 movff int_O_pure_ppO2+0,lo ; copy ppO2 of the pure gas (OC: = breathed gas, loop: = diluent/premix) to hi:lo | |
4314 movff int_O_pure_ppO2+1,hi | |
4315 TFT_color_code warn_ppo2 ; Color-code output | |
4316 btfss FLAG_ccr_mode ; in CCR mode? | |
4317 bra TFT_display_diluent_1 ; NO - continue with pSCR or OC | |
4318 btfsc is_bailout ; YES - in bailout? | |
4319 bra TFT_display_diluent_2 ; YES - continue with OC | |
4320 STRCPY_TEXT tdil ; NO - print "Dil:" | |
4321 bra TFT_display_diluent_3 | |
4322 TFT_display_diluent_1: | |
4323 btfss FLAG_pscr_mode ; in pSCR mode? | |
4324 bra TFT_display_diluent_2 ; NO - continue with pSCR or OC | |
4325 btfsc is_bailout ; YES - in bailout? | |
4326 bra TFT_display_diluent_2 ; YES - continue with OC | |
4327 STRCPY_TEXT tmix ; NO - print "Mix:" | |
4328 bra TFT_display_diluent_3 | |
4329 TFT_display_diluent_2: | |
4330 STRCPY_TEXT tppO2 ; OC mode or bailout, print "ppO2:" | |
4331 TFT_display_diluent_3: | |
3912 bsf leftbind | 4332 bsf leftbind |
3913 output_16_3 ;Displays only 0...999 | 4333 output_16dp .3 ; x.xx bar |
3914 bcf leftbind | 4334 bcf leftbind |
3915 PUTC "%" | 4335 movlw dm_warning_length ; Divemode string length |
3916 movlw dm_warning_length ; Divemode string length | 4336 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
3917 btfss divemode ; In Divemode? | |
3918 movlw surf_warning_length ; No, use surface string length | |
3919 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3920 STRCAT_PRINT "" | 4337 STRCAT_PRINT "" |
3921 bcf win_invert | 4338 goto TFT_standard_color ; and return... |
3922 goto TFT_standard_color; and return... | |
3923 | |
3924 global TFT_mask_ppo2 | |
3925 TFT_mask_ppo2: | |
3926 call TFT_divemask_color | |
3927 btfss FLAG_ccr_mode | |
3928 bra TFT_mask_ppo2a ; not in CC mode | |
3929 btfsc is_bailout | |
3930 bra TFT_mask_ppo2a ; in CC mode but in bailout | |
3931 WIN_TINY dm_custom_ceiling_ppo2_col_dil,dm_custom_ceiling_text_row ; NEW position for loger text | |
3932 STRCPY_TEXT_PRINT tppO2Dil ; in CC mode and not bailout | |
3933 goto TFT_standard_color ; and return... | |
3934 | |
3935 TFT_mask_ppo2a: | |
3936 WIN_TINY dm_custom_ceiling_ppo2_column, dm_custom_ceiling_text_row | |
3937 STRCPY_TEXT_PRINT tppO2 ; in all other modes | |
3938 goto TFT_standard_color; and return... | |
3939 | |
3940 global TFT_display_ppo2_val | |
3941 TFT_display_ppo2_val: | |
3942 btfss FLAG_pscr_mode | |
3943 bra TFT_display_ppo2_val_non_pscr ; Non-PSCR modes... | |
3944 btfsc is_bailout | |
3945 bra TFT_display_ppo2_val_non_pscr ; In bailout | |
3946 | |
3947 ; in PSCR mode | |
3948 call compute_pscr_ppo2 ; pSCR ppO2 into sub_c:2 | |
3949 movff sub_c+0,xA+0 | |
3950 movff sub_c+1,xA+1 | |
3951 movlw d'100' | |
3952 movwf xB+0 | |
3953 clrf xB+1 | |
3954 call div16x16 ; /100 | |
3955 tstfsz xC+1 ; Is ppO2 > 2.55bar ? | |
3956 setf xC+0 ; yes: bound to 2.55... better than wrap around. | |
3957 movff xC+0,char_I_actual_ppO2 ; copy last ppO2 to buffer register (for pSCR CNS) | |
3958 clrf xC+2 | |
3959 clrf xC+3 | |
3960 movff sub_c+0,xC+0 | |
3961 movff sub_c+1,xC+1 ; copy for comptibility | |
3962 bra TFT_display_ppo2_val_com | |
3963 | |
3964 TFT_display_ppo2_val_non_pscr: | |
3965 SAFE_2BYTE_COPY amb_pressure, xA | |
3966 movlw d'10' | |
3967 movwf xB+0 | |
3968 clrf xB+1 | |
3969 call div16x16 ; xC=p_amb/10 | |
3970 movff xC+0,xA+0 | |
3971 movff xC+1,xA+1 | |
3972 movff char_I_O2_ratio,xB+0 ; =O2 ratio | |
3973 clrf xB+1 | |
3974 call mult16x16 ; char_I_O2_ratio * p_amb/10 | |
3975 | |
3976 TFT_display_ppo2_val_com: | |
3977 call TFT_standard_color | |
3978 TFT_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) | |
3979 WIN_MEDIUM dm_custom_ceiling_ppo2_val_col, dm_custom_ceiling_value_row | |
3980 ; hijacking neg_flag_velocity to know where the value is displayed | |
3981 bsf neg_flag_velocity | |
3982 bra TFT_display_ppo2_com | |
3983 | |
3984 global TFT_display_ppo2 | |
3985 TFT_display_ppo2: ; Show ppO2 (ppO2 stored in xC, in mbar!) | |
3986 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3987 tstfsz WREG ; Is there room for the warning? | |
3988 return ; No | |
3989 call TFT_warning_set_window_com | |
3990 TFT_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) | |
3991 | 4339 |
3992 btfss FLAG_ccr_mode ; new code to conditionally name the warning ppO2: or Dil: | 4340 ;============================================================================= |
3993 bra TFT_display_ppo2_none_ccr ; ppO2 warning text | 4341 |
3994 btfsc is_bailout | |
3995 bra TFT_display_ppo2_none_ccr ; ccr-mode but in bailout, ppO2 warning text again | |
3996 ; ccr-mode and no bailout | |
3997 STRCPY_TEXT tdil ; "Dil:" | |
3998 bra TFT_display_ppo2_cont | |
3999 | |
4000 TFT_display_ppo2_none_ccr: | |
4001 STRCPY_TEXT tppO2 ; "ppO2:" | |
4002 TFT_display_ppo2_cont: | |
4003 ; hijacking neg_flag_velocity to know where the value is displayed | |
4004 bcf neg_flag_velocity | |
4005 TFT_display_ppo2_com: | |
4006 ; Check very high ppO2 manually | |
4007 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | |
4008 bra TFT_show_ppO2_3 ; Yes, display fixed Value! | |
4009 movff xC+0,lo | |
4010 movff xC+1,hi | |
4011 bsf ignore_digit4 ; no mbar resolution | |
4012 output_16dp d'1' | |
4013 | |
4014 ; Set ".xx" to "0.xx" (bar) | |
4015 banksel buffer | |
4016 movlw " " | |
4017 cpfseq buffer+5 ; For ppO2 in warning area | |
4018 bra TFT_show_ppO2_1 | |
4019 movlw "0" ; Replace Space with "0" | |
4020 movwf buffer+5 | |
4021 TFT_show_ppO2_1: | |
4022 movlw " " | |
4023 cpfseq buffer+0 ; For ppO2 in custom view | |
4024 bra TFT_show_ppO2_2 | |
4025 movlw "0" ; Replace Space with "0" | |
4026 movwf buffer+0 | |
4027 TFT_show_ppO2_2: | |
4028 banksel common | |
4029 movlw dm_warning_length ; Divemode string length | |
4030 ; neg_flag_velocity is hijacked, used to toggle the fillup lenght. | |
4031 btfsc neg_flag_velocity | |
4032 movlw .4 | |
4033 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
4034 STRCAT_PRINT "" | |
4035 bcf win_invert | |
4036 goto TFT_standard_color; and return... | |
4037 | |
4038 TFT_show_ppO2_3: | |
4039 ; STRCAT "'6.6" ; Workaround until a ">" is available in STD font | |
4040 STRCAT "6.65" ; Workaround until a ">" is available in STD font | |
4041 bra TFT_show_ppO2_2 | |
4042 | |
4043 | |
4044 global TFT_LogOffset_Logtitle | 4342 global TFT_LogOffset_Logtitle |
4045 TFT_LogOffset_Logtitle: | 4343 TFT_LogOffset_Logtitle: |
4046 STRCPY_TEXT tLogOffset | 4344 STRCPY_TEXT tLogOffset |
4047 PUTC ":" | 4345 PUTC ":" |
4048 call do_logoffset_common_read ; Offset into lo:hi | 4346 call do_logoffset_common_read ; Offset into lo:hi |
4049 bsf leftbind | 4347 bsf leftbind |
4050 output_16_4 | 4348 output_16_4 |
4051 bcf leftbind | 4349 bcf leftbind |
4052 PUTC " " | 4350 PUTC " " |
4053 return ; No "_PRINT" here... | 4351 return ; No "_PRINT" here... |
4352 | |
4353 ;============================================================================= | |
4054 | 4354 |
4055 global adjust_depth_with_salinity | 4355 global adjust_depth_with_salinity |
4356 global adjust_depth_with_salinity_log | |
4056 adjust_depth_with_salinity: ; computes salinity setting into lo:hi [mbar] | 4357 adjust_depth_with_salinity: ; computes salinity setting into lo:hi [mbar] |
4057 btfsc simulatormode_active ; Do apply salinity in Simulatormode | 4358 btfsc simulatormode_active ; Do not apply salinity in Simulatormode |
4058 return | 4359 return |
4059 | |
4060 global adjust_depth_with_salinity_log | |
4061 movff opt_salinity,WREG ; 0-5% | 4360 movff opt_salinity,WREG ; 0-5% |
4062 adjust_depth_with_salinity_log: ; computes salinity setting (FROM WREG!) into lo:hi [mbar] | 4361 adjust_depth_with_salinity_log: ; computes salinity setting (FROM WREG!) into lo:hi [mbar] |
4063 addlw d'100' ; 1.00kg/l | 4362 addlw d'100' ; 1.00kg/l |
4064 movwf wait_temp | 4363 movwf wait_temp |
4065 | 4364 |
4066 movlw d'105' ; 105% ? | 4365 movlw d'105' ; 105% ? |
4067 cpfslt wait_temp ; Salinity higher limit | 4366 cpfslt wait_temp ; Salinity higher limit |
4074 movff hi,xA+1 | 4373 movff hi,xA+1 |
4075 | 4374 |
4076 movlw d'102' ; 0,98bar/10m | 4375 movlw d'102' ; 0,98bar/10m |
4077 movwf xB+0 | 4376 movwf xB+0 |
4078 clrf xB+1 | 4377 clrf xB+1 |
4079 call mult16x16 ;xA*xB=xC (lo:hi * 100) | 4378 call mult16x16 ; xA*xB=xC (lo:hi * 100) |
4080 movff wait_temp,xB+0 ; Salinity | 4379 movff wait_temp,xB+0 ; Salinity |
4081 clrf xB+1 | 4380 clrf xB+1 |
4082 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | 4381 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder |
4083 movff xC+0,lo | 4382 movff xC+0,lo |
4084 movff xC+1,hi ; restore lo and hi with updated value | 4383 movff xC+1,hi ; restore lo and hi with updated value |
4085 return | 4384 return |
4086 | 4385 |
4386 ;============================================================================= | |
4387 | |
4087 global convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | 4388 global convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
4088 convert_mbar_to_feet: ; convert value in lo:hi from mbar to feet | 4389 convert_mbar_to_feet: ; convert value in lo:hi from mbar to feet |
4089 movff lo,xA+0 | 4390 movff lo,xA+0 |
4090 movff hi,xA+1 | 4391 movff hi,xA+1 |
4091 | 4392 |
4112 | 4413 |
4113 movff xC+0,lo | 4414 movff xC+0,lo |
4114 movff xC+1,hi ; restore lo and hi with updated value | 4415 movff xC+1,hi ; restore lo and hi with updated value |
4115 return | 4416 return |
4116 | 4417 |
4418 ;============================================================================= | |
4419 | |
4117 global convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit | 4420 global convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit |
4118 convert_celsius_to_fahrenheit: ; convert value in lo:hi from celsius to fahrenheit | 4421 convert_celsius_to_fahrenheit: ; convert value in lo:hi from celsius to fahrenheit |
4119 movff lo,xA+0 ; temperature in 1/10 of °C | 4422 movff lo,xA+0 ; temperature in 1/10 of °C |
4120 movff hi,xA+1 | 4423 movff hi,xA+1 |
4121 | 4424 |
4122 movlw LOW d'1000' ; offset °C value by 1000 to get out of any negative numbers | 4425 movlw LOW d'1000' ; offset °C value by 1000 to get out of any negative numbers |
4123 addwf xA+0,F | 4426 addwf xA+0,F |
4124 movlw HIGH d'1000' | 4427 movlw HIGH d'1000' |
4142 subwfb xC+1,F | 4445 subwfb xC+1,F |
4143 | 4446 |
4144 movff xC+0,lo | 4447 movff xC+0,lo |
4145 movff xC+1,hi ; restore lo and hi with updated value | 4448 movff xC+1,hi ; restore lo and hi with updated value |
4146 return | 4449 return |
4147 | 4450 |
4148 ;============================================================================= | 4451 ;============================================================================= |
4149 global compute_pscr_ppo2 | 4452 |
4150 compute_pscr_ppo2: | |
4151 ; (Pressure[mbar]*char_I_O2_ratio)-(100-char_I_O2_ratio)*CF61*CF62*10 | |
4152 movff char_I_O2_ratio,WREG | |
4153 sublw .100 ; 100-char_I_O2_ratio -> WREG | |
4154 mullw .10 ; (100-char_I_O2_ratio)*10 -> PROD:2 | |
4155 movff PRODL,xA+0 | |
4156 movff PRODH,xA+1 | |
4157 movff opt_PSCR_drop,xB+0 ; O2 Drop | |
4158 clrf xB+1 | |
4159 call mult16x16 ;xA*xB=xC -> (100-char_I_O2_ratio)*10*CF61 | |
4160 movff xC+0,xA+0 | |
4161 movff xC+1,xA+1 | |
4162 movff opt_PSCR_lungratio,xB+0 ; Lung ratio | |
4163 clrf xB+1 | |
4164 call mult16x16 ;xA*xB=xC -> (100-char_I_O2_ratio)*10*CF61*CF62 | |
4165 | |
4166 movlw .10 | |
4167 movwf xB+0 | |
4168 clrf xB+1 | |
4169 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
4170 ; store xC:2 in lo:hi | |
4171 movff xC+0,lo | |
4172 movff xC+1,hi | |
4173 | |
4174 SAFE_2BYTE_COPY amb_pressure, xA | |
4175 movff char_I_O2_ratio,xB+0 | |
4176 clrf xB+1 | |
4177 call mult16x16 ;xA*xB=xC -> xC:4 = Pressure[mbar]*char_I_O2_ratio | |
4178 | |
4179 movlw .10 | |
4180 movwf xB+0 | |
4181 clrf xB+1 | |
4182 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
4183 | |
4184 ; store xC:2 in sub_a | |
4185 movff xC+0,sub_a+0 | |
4186 movff xC+1,sub_a+1 | |
4187 ; reload result from lo:hi | |
4188 movff lo,sub_b+0 | |
4189 movff hi,sub_b+1 | |
4190 | |
4191 call subU16 ;sub_c = sub_a - sub_b (with UNSIGNED values) | |
4192 return | |
4193 | |
4194 | |
4195 END | 4453 END |