comparison src/tft_outputs.asm @ 582:b455b31ce022

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