Mercurial > public > hwos_code
annotate src/tft_outputs.asm @ 656:8af5aefbcdaf default tip
Update to 3.31 beta
| author | heinrichsweikamp |
|---|---|
| date | Thu, 27 Nov 2025 18:32:58 +0100 |
| parents | 75e90cd0c2c3 |
| children |
| rev | line source |
|---|---|
| 0 | 1 ;============================================================================= |
| 2 ; | |
| 640 | 3 ; File tft_outputs.asm * combined next generation V3.12.3 |
| 0 | 4 ; |
| 623 | 5 ; high-level Display Outputs |
| 0 | 6 ; |
| 654 | 7 ; Copyright (c) 2011, JD Gascuel, heinrichs weikamp gmbh, all right reserved. |
| 0 | 8 ;============================================================================= |
| 9 ; HISTORY | |
| 10 ; 2011-08-07 : [mH] moving from OSTC code | |
| 11 | |
| 604 | 12 #include "hwos.inc" ; mandatory header |
| 13 #include "shared_definitions.h" ; mailbox from/to p2_deco.c | |
| 582 | 14 #include "tft.inc" |
| 15 #include "start.inc" | |
| 16 #include "strings.inc" | |
| 17 #include "convert.inc" | |
| 18 #include "varargs.inc" | |
| 19 #include "math.inc" | |
| 20 #include "eeprom_rs232.inc" | |
| 21 #include "adc_lightsensor.inc" | |
| 22 #include "surfmode.inc" | |
| 23 #include "divemode.inc" | |
| 24 #include "ghostwriter.inc" | |
| 25 #include "customview.inc" | |
| 26 #include "i2c.inc" | |
| 27 #include "calibrate.inc" | |
| 604 | 28 #include "gaslist.inc" |
| 29 #include "rx_ops.inc" | |
| 631 | 30 #include "logbook.inc" |
| 634 | 31 #include "external_flash.inc" |
| 32 #include "colorschemes.inc" | |
| 623 | 33 |
| 34 | |
| 35 ;---- external Functions ----------------------------------------------------- | |
| 560 | 36 |
| 604 | 37 extern get_first_gas_to_WREG |
| 623 | 38 |
| 39 ;---- external Texts --------------------------------------------------------- | |
| 604 | 40 |
| 41 extern tFirmware | |
| 631 | 42 extern tFirmwareDate |
| 628 | 43 extern tHardware |
| 604 | 44 extern tSerial |
| 45 extern tTotalDives | |
| 46 extern tBatteryV | |
| 631 | 47 extern tSensorC |
| 48 extern tSensorD | |
| 604 | 49 extern tUptime |
| 50 extern tPPO2MIN | |
| 51 extern tPPO2Max | |
| 52 extern tPPO2DECO | |
| 623 | 53 extern tbar |
| 54 | |
| 55 IFDEF _ccr_pscr | |
| 56 extern tPPO2MINCC | |
| 57 ENDIF | |
| 604 | 58 |
| 59 IFDEF _rx_functions | |
| 60 extern tFirmware_rx | |
| 61 ENDIF | |
| 0 | 62 |
| 623 | 63 IFDEF _compass |
| 64 extern tCalX,tCalY,tCalZ | |
| 65 ENDIF | |
| 66 | |
| 67 | |
| 634 | 68 ;============================================================================= |
| 69 pallet_table CODE_PACK 0x09800 ; must be at 0x***00 | |
| 70 ;============================================================================= | |
| 71 | |
| 72 | |
| 73 pallet_table: | |
| 640 | 74 ; mask disabled memo advice attention warning ; pallet |
| 75 ; --------------- ------------------- --------------- --------------- --------------- --------------- -------- | |
| 76 DB color_green, color_lightblue, color_white, color_green, color_yellow, color_red ; standard | |
| 77 DB color_red, color_dark_red, color_orange, color_greenish, color_pink, color_red ; reddish | |
| 78 DB color_cyan, color_dark_green, color_green, color_green, color_cyan, color_red ; greenish | |
| 79 DB color_blue, color_deepblue, color_lightblue,color_greenish, color_orange, color_red ; blueish | |
| 634 | 80 |
| 623 | 81 |
| 0 | 82 ;============================================================================= |
| 634 | 83 tft_out1 CODE |
| 84 ;============================================================================= | |
| 85 | |
| 86 | |
| 87 ;----------------------------------------------------------------------------- | |
| 88 ; load standard Color Pallet | |
| 89 ; | |
| 90 global TFT_load_std_color_pallet | |
| 91 TFT_load_std_color_pallet: | |
| 92 clrf WREG ; select standard pallet | |
| 93 bra TFT_load_color_pallet ; load color pallet | |
| 94 | |
| 95 | |
| 96 ;----------------------------------------------------------------------------- | |
| 97 ; load Dive Mode Color Pallet | |
| 98 ; | |
| 99 global TFT_load_dive_color_pallet | |
| 100 TFT_load_dive_color_pallet: | |
| 101 movff opt_dive_color_scheme,WREG ; get color scheme selection | |
| 102 ;bra TFT_load_color_pallet ; load color pallet | |
| 103 | |
| 104 | |
| 105 ; Helper Function - load color pallet | |
| 106 TFT_load_color_pallet: | |
| 107 mullw .6 ; 6 bytes per pallet, compute pallet offset | |
| 108 | |
| 109 movf PRODL,W ; get pallet offset, low | |
| 110 movwf TBLPTRL ; set table pointer, low | |
| 111 | |
| 112 movlw HIGH (pallet_table) ; get start of table, high | |
| 113 movwf TBLPTRH ; set table pointer, high | |
| 114 | |
| 115 movlw UPPER (pallet_table) ; get start of table, upper | |
| 116 movwf TBLPTRU ; set table pointer, upper | |
| 117 | |
| 118 lfsr FSR2,pallet_color_mask ; point to first color in pallet | |
| 119 movlw .6 ; initialize loop counter | |
| 120 TFT_load_color_pallet_loop: | |
| 121 TBLRD*+ ; read color | |
| 122 movff TABLAT,POSTINC2 ; copy color to pallet | |
| 123 decfsz WREG ; decrement loop counter, reached zero? | |
| 124 bra TFT_load_color_pallet_loop ; NO - loop | |
| 125 return ; YES - done | |
| 623 | 126 |
| 582 | 127 |
| 0 | 128 ;============================================================================= |
| 634 | 129 tft_out2 CODE |
| 130 ;============================================================================= | |
| 131 | |
| 132 | |
| 133 ;----------------------------------------------------------------------------- | |
| 134 ; Color-Code a Tank Pressure or SAC Rate | |
| 135 ; | |
| 136 ; Input hi:lo pressure / SAC rate | |
| 137 ; | |
| 138 TFT_color_code_pres_sac: | |
| 604 | 139 btfss hi,int_not_avail_flag ; is the not-available flag set? |
| 140 bra TFT_color_code_tank_pres_1 ; NO | |
| 141 bcf hi,int_not_avail_flag ; YES - clear not-available flag | |
| 634 | 142 TFT_color_code_tank_pres_0: ; - entry point for outdated flag |
| 143 bcf hi,int_outdated_flag ; - clear outdated flag (it may be set) | |
| 144 bcf hi,int_warning_flag ; - clear warning flag (it may be set) | |
| 145 bcf hi,int_attention_flag ; - clear attention flag (it may be set) | |
| 146 FONT_COLOR_DISABLED ; - set to disabled color and return | |
| 147 return ; - done | |
| 148 | |
| 604 | 149 TFT_color_code_tank_pres_1: |
| 150 btfsc hi,int_outdated_flag ; is the outdated flag set? | |
| 151 bra TFT_color_code_tank_pres_0 ; YES - handle alike with not-available flag | |
| 634 | 152 btfss hi,int_warning_flag ; NO - is the warning flag set? |
| 153 bra TFT_color_code_tank_pres_2 ; NO | |
| 154 bcf hi,int_attention_flag ; YES - clear attention flag (it may be set) | |
| 155 bcf hi,int_warning_flag ; - clear warning flag | |
| 156 FONT_COLOR_WARNING ; - select warning color | |
| 157 return ; - done | |
| 158 | |
| 604 | 159 TFT_color_code_tank_pres_2: |
| 634 | 160 btfss hi,int_attention_flag ; is the attention flag set? |
| 161 bra TFT_color_code_tank_pres_3 ; NO - set memo color and return | |
| 162 bcf hi,int_attention_flag ; YES - clear attention flag | |
| 163 FONT_COLOR_ATTENTION ; - set to attention color | |
| 164 return ; - done | |
| 165 | |
| 604 | 166 TFT_color_code_tank_pres_3: |
| 634 | 167 FONT_COLOR_MEMO ; set to memo color |
| 168 return ; done | |
| 169 | |
| 170 | |
| 171 ;----------------------------------------------------------------------------- | |
| 172 ; Color-Code a Gas by its ppO2 | |
| 173 ; | |
| 174 ; Input hi O2% of the gas | |
| 175 ; pressure_abs_10 current absolute pressure / 10 | |
| 176 ; | |
| 582 | 177 global TFT_color_code_gaslist |
| 634 | 178 TFT_color_code_gaslist: |
| 179 ; check for very high ppO2 | |
| 180 MOVII pressure_abs_10,xA ; get absolute pressure / 10 | |
| 181 movff hi,xB+0 ; get O2% | |
| 182 clrf xB+1 ; ... | |
| 623 | 183 call mult16x16 ; hi * absolute pressure / 10 |
| 634 | 184 ; check if ppO2 > 6.55 bar |
| 623 | 185 tstfsz xC+2 ; char_I_O2_ratio * absolute pressure / 10 > 65536, i.e. ppO2 > 6.55 bar ? |
| 634 | 186 bra TFT_color_code_gaslist_warn ; YES - set warning color and return |
| 187 | |
| 188 ; check if ppO2 > 3.30 bar | |
| 189 btfsc xC+1,7 ; ppO2 > 3.30 bar ? | |
| 190 bra TFT_color_code_gaslist_warn ; YES - set warning color and return | |
| 191 | |
| 192 ; check for low ppO2 | |
| 193 MOVII xC,sub_a ; get ppO2 of the gas | |
| 194 movff char_I_ppO2_min,WREG ; get minimum ppO2 | |
| 195 mullw d'100' ; compute (minimum ppO2) * 100 | |
| 196 MOVII PRODL,sub_b ; copy result to sub_b | |
| 623 | 197 call cmpU16 ; compare (sub_a - sub_b) |
| 604 | 198 btfsc neg_flag ; lower than ppO2 min? |
| 634 | 199 bra TFT_color_code_gaslist_warn ; YES - set warning color and return |
| 200 | |
| 201 ; check for high ppO2 | |
| 604 | 202 movff char_O_deco_info,WREG ; bank-safe copy of deco info vector |
| 628 | 203 btfsc WREG,deco_mode ; are we in deco? |
| 604 | 204 bra TFT_color_code_gaslist_deco ; YES - check against ppO2 max deco only |
| 634 | 205 |
| 206 ; check for ppO2 max travel/normal | |
| 623 | 207 movff char_I_ppO2_max_work,WREG ; ppo2 max during working phase |
| 208 mullw d'100' ; char_I_ppO2_max_work*100 | |
| 628 | 209 ADDLI ppO2_margin_on_max,PROD ; add ppO2 margin on max value to compensate for surface pressures > 1000 hPa |
| 210 MOVII PRODL,sub_b ; copy result to sub_b | |
| 623 | 211 call cmpU16 ; compare (sub_a - sub_b) |
| 604 | 212 btfss neg_flag ; higher than ppO2 max travel/deco? |
| 634 | 213 FONT_COLOR_ATTENTION ; YES - set attention color |
| 214 ;bra TFT_color_code_gaslist_deco ; continue checking against max deco | |
| 215 | |
| 216 ; check for ppO2 max deco | |
| 604 | 217 TFT_color_code_gaslist_deco: |
| 218 movff char_I_ppO2_max_deco,WREG ; ppo2 max for deco | |
| 623 | 219 mullw d'100' ; char_I_ppO2_max_deco * 100 |
| 628 | 220 ADDLI ppO2_margin_on_max,PROD ; add ppO2 margin on max value to compensate for surface pressures > 1000 hPa |
| 221 MOVII PRODL,sub_b ; copy result to sub_b | |
| 623 | 222 call cmpU16 ; compare (sub_a - sub_b) |
| 634 | 223 btfsc neg_flag ; higher than ppO2 max deco? |
| 224 return ; NO - done | |
| 225 ;bra TFT_color_code_gaslist_warn ; YES - set warning color and return | |
| 226 | |
| 227 | |
| 228 ; Helper Function - set waring color and return | |
| 229 TFT_color_code_gaslist_warn: | |
| 230 FONT_COLOR_WARNING ; select warning color | |
| 231 return ; done | |
| 232 | |
| 233 | |
| 234 ;----------------------------------------------------------------------------- | |
| 235 ; Color-Code the Ceiling Depth | |
| 236 ; | |
| 237 ; Input mpr ceiling depth [mbar] | |
| 238 ; pressure_rel_cur_cached current relative pressure [mbar] | |
| 239 ; | |
| 240 TFT_color_code_ceiling: | |
| 241 ; check for invalid | |
| 582 | 242 btfsc hi,char_invalid_flag ; is the invalid flag set? (bit 7 here) |
| 634 | 243 bra TFT_color_code_ceiling_dis ; YES - set to disabled color and return |
| 244 | |
| 245 ; check for ceiling | |
| 246 MOVII pressure_rel_cur_cached,sub_a;get current pressure to sub_a | |
| 247 MOVII mpr,sub_b ; get ceiling to sub_b | |
| 248 call cmpU16 ; sub_a - sub_b = relative pressure [mbar] - int_O_ceiling [mbar] | |
| 249 btfss neg_flag ; is current depth < ceiling (too shallow) ? | |
| 250 bra TFT_color_code_ceiling_memo ; NO - set to memo color and return | |
| 251 | |
| 252 ; check for outside | |
| 253 movff char_O_deco_warnings,WREG ; bank-safe copy of deco warnings | |
| 254 btfss WREG,outside_warning ; are we currently outside of the ZH-L16 model? | |
| 255 bra TFT_color_code_ceiling_attn ; NO - set to attention color and return | |
| 256 ;bra TFT_color_code_ceiling_warn ; YES - set to warnings color and return | |
| 257 | |
| 258 | |
| 259 ; Helper Functions - select color and return | |
| 260 TFT_color_code_ceiling_warn: | |
| 261 FONT_COLOR_WARNING ; select color | |
| 262 return ; done | |
| 263 | |
| 264 TFT_color_code_ceiling_attn: | |
| 265 FONT_COLOR_ATTENTION ; select color | |
| 266 return ; done | |
| 267 | |
| 268 TFT_color_code_ceiling_memo: | |
| 269 FONT_COLOR_MEMO ; select color | |
| 270 return ; done | |
| 271 | |
| 272 TFT_color_code_ceiling_dis: | |
| 560 | 273 bcf hi,char_invalid_flag ; clear the invalid flag (bit 7 here) |
| 634 | 274 FONT_COLOR_DISABLED ; select disabled color |
| 275 return ; done | |
| 276 | |
| 277 | |
| 278 ;----------------------------------------------------------------------------- | |
| 279 ; Color-Code the Stop Depth | |
| 280 ; | |
| 281 ; memo color if below stop depth, | |
| 282 ; attention color if above stop but below ceiling*, | |
| 283 ; warning color if above stop and ceiling* | |
| 284 ; | |
| 285 ; Input: depth_meter current depth | |
| 286 ; lo stop depth | |
| 287 ; char_O_deco_gas deco data valid flag | |
| 288 ; | |
| 289 ; * the ceiling depth is calculated using current (interpolated) GF | |
| 290 ; | |
| 291 TFT_color_code_stop: | |
| 292 ; check for invalid | |
| 560 | 293 movff char_O_deco_gas+0,WREG ; get flag for invalid deco data |
| 294 btfsc WREG,char_invalid_flag ; is the invalid flag set? | |
| 634 | 295 bra TFT_color_code_stop_dis ; YES - set to disabled color and return |
| 296 | |
| 297 ; check for shallower than stop depth | |
| 298 movf lo,W ; get depth of first stop in meters into WREG | |
| 299 subwf depth_meter,W ; compute current depth - stop depth | |
| 300 btfsc STATUS,C ; result negative? | |
| 301 bra TFT_color_code_stop_1 ; NO - not shallower than stop depth, check for ascent advice | |
| 302 MOVII int_O_ceiling,sub_b ; YES - get ceiling depth in mbar | |
| 303 btfsc sub_b+1,char_invalid_flag ; - is the invalid flag set? (bit 7 here) | |
| 304 bra TFT_color_code_stop_warn ; YES - select warning color and return | |
| 305 MOVII pressure_rel_cur_cached,sub_a; NO - get current pressure | |
| 306 call cmpU16 ; - sub_a - sub_b = relative pressure - int_O_ceiling | |
| 307 btfsc neg_flag ; - is ceiling > current depth? | |
| 308 bra TFT_color_code_stop_warn ; YES - set to warning color and return | |
| 309 bra TFT_color_code_stop_attn ; NO - set to attention color and return | |
| 310 | |
| 311 ; check for ascent advice | |
| 623 | 312 TFT_color_code_stop_1: |
| 634 | 313 movf lo,W ; get depth of first stop in meters into WREG |
| 628 | 314 incf WREG,W ; compute stop depth + 1 meter |
| 315 subwf depth_meter,W ; compute current depth - (first stop depth + 1 meter) | |
| 316 btfss STATUS,C ; result negative? | |
| 634 | 317 bra TFT_color_code_stop_memo ; YES - within 1 meter of stop depth, use memo color |
| 318 btfsc deco_region ; NO - within deco stops region? | |
| 319 bra TFT_color_code_stop_advc ; YES - use advice color and return | |
| 320 ;bra TFT_color_code_stop_memo ; NO - use memo color and return | |
| 321 | |
| 322 | |
| 323 ; Helper Functions - select color and return | |
| 324 TFT_color_code_stop_memo: | |
| 325 FONT_COLOR_MEMO ; select color | |
| 326 return ; done | |
| 327 | |
| 328 TFT_color_code_stop_advc: | |
| 329 FONT_COLOR_ADVICE ; select color | |
| 330 bsf win_invert ; print in inverse | |
| 331 return ; done | |
| 332 | |
| 333 TFT_color_code_stop_attn: | |
| 334 FONT_COLOR_ATTENTION ; select color | |
| 335 return ; done | |
| 336 | |
| 337 TFT_color_code_stop_warn: | |
| 338 FONT_COLOR_WARNING ; select color | |
| 339 return ; done | |
| 340 | |
| 341 TFT_color_code_stop_dis: | |
| 342 FONT_COLOR_DISABLED ; select color | |
| 343 return ; done | |
| 344 | |
| 345 | |
| 346 ;----------------------------------------------------------------------------- | |
| 347 ; Color-Code the current Depth | |
| 348 ; | |
| 623 | 349 TFT_color_code_depth: |
| 631 | 350 TSTOSS opt_depth_warn ; depth warning switched on? |
| 623 | 351 bra TFT_color_code_depth_no_mod ; NO |
| 634 | 352 btfsc warn_det_depth_limit ; YES - depth limit warning active? |
| 623 | 353 bra TFT_color_code_depth_warn ; YES - set to warning color |
| 634 | 354 bra TFT_color_code_depth_mod ; NO - check depth against MOD |
| 355 | |
| 623 | 356 TFT_color_code_depth_no_mod: |
| 634 | 357 btfsc warn_det_depth_limit ; depth limit warning active? |
| 358 bra TFT_color_code_depth_warn ; YES - set to warning color and return | |
| 359 bra TFT_color_code_depth_memo ; NO - set to memo color and return... | |
| 360 | |
| 623 | 361 TFT_color_code_depth_mod: |
| 362 IFDEF _ccr_pscr | |
| 363 movff opt_dive_mode,WREG ; get deco mode: 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR | |
| 364 decfsz WREG,F ; in CCR mode? | |
| 560 | 365 bra TFT_color_code_depth_no_ccr ; NO - continue checking for ppO2 |
| 623 | 366 btfss bailout_mode ; YES - check if in bailout |
| 604 | 367 bra TFT_color_code_depth_outside; NO - continue checking for outside ZHL16 model |
| 634 | 368 ;bra TFT_color_code_depth_no_ccr ; YES - continue checking for ppO2 |
| 623 | 369 ENDIF |
| 634 | 370 |
| 560 | 371 TFT_color_code_depth_no_ccr: |
| 372 movff int_O_breathed_ppO2+1,WREG ; get upper byte of currently breathed ppO2 | |
| 373 btfsc WREG,int_warning_flag ; is the warning flag set? | |
| 374 bra TFT_color_code_depth_warn ; YES - animate in warning design | |
| 634 | 375 ;bra TFT_color_code_depth_outside; NO - continue checking for outside ZHL16 model |
| 376 | |
| 604 | 377 TFT_color_code_depth_outside: |
| 378 movff char_O_deco_warnings,WREG ; bank-safe copy of deco warnings | |
| 379 btfsc WREG,outside_warning ; are we currently outside of the ZH-L16 model? | |
| 623 | 380 bra TFT_color_code_depth_warn ; YES - activate depth warning |
| 634 | 381 btfsc WREG,outside_attention ; NO - are we near to outside of the ZH-L16 model? |
| 623 | 382 bra TFT_color_code_depth_att ; YES - activate depth attention |
| 634 | 383 ;bra TFT_color_code_depth_memo ; NO - select memo color and return |
| 384 | |
| 385 | |
| 386 ; Helper Functions - set colors and attention/warning flags | |
| 387 TFT_color_code_depth_memo: | |
| 388 bcf depth_color_warning ; terminate depth warning | |
| 389 bcf depth_color_attention ; terminate depth attention | |
| 390 FONT_COLOR_MEMO ; select color | |
| 391 return ; done | |
| 392 | |
|
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
393 TFT_color_code_depth_warn: |
| 634 | 394 bsf depth_color_warning ; activate depth warning |
| 395 bcf depth_color_attention ; terminate depth attention | |
| 396 FONT_COLOR_WARNING ; select warning color | |
| 397 return ; done | |
| 398 | |
| 604 | 399 TFT_color_code_depth_att: |
| 634 | 400 bcf depth_color_warning ; terminate depth warning |
| 401 bsf depth_color_attention ; activate depth attention | |
| 402 FONT_COLOR_ATTENTION ; select attention | |
| 403 return ; done | |
| 404 | |
| 405 | |
| 406 ;----------------------------------------------------------------------------- | |
| 407 ; Color-Code a CNS Value | |
| 408 ; | |
| 409 ; Input hi:lo CNS value [%] | |
| 410 ; | |
| 582 | 411 global TFT_color_code_cns |
| 634 | 412 TFT_color_code_cns: |
| 560 | 413 btfss hi,int_invalid_flag ; is the invalid flag set? |
| 414 bra TFT_color_code_cns_1 ; NO | |
| 582 | 415 bcf hi,int_invalid_flag ; YES - clear invalid flag |
| 634 | 416 bcf hi,int_warning_flag ; - clear warning flag (it may be set) |
| 417 bcf hi,int_attention_flag ; - clear attention flag (it may be set) | |
| 418 FONT_COLOR_DISABLED ; - select disabled color | |
| 419 return ; - done | |
| 420 | |
| 628 | 421 TFT_color_code_cns_1: |
| 560 | 422 btfss hi,int_warning_flag ; is the warning flag set? |
| 423 bra TFT_color_code_cns_2 ; NO | |
| 604 | 424 bcf hi,int_warning_flag ; YES - clear warning flag |
| 425 bcf hi,int_attention_flag ; - clear attention flag (it may be set) | |
| 634 | 426 FONT_COLOR_WARNING ; - select warning color |
| 427 return ; - done | |
| 428 | |
| 560 | 429 TFT_color_code_cns_2: |
| 582 | 430 btfss hi,int_attention_flag ; is the attention flag set? |
| 634 | 431 bra TFT_color_code_cns_3 ; NO - select memo color |
| 582 | 432 bcf hi,int_attention_flag ; YES - clear attention flag |
| 634 | 433 FONT_COLOR_ATTENTION ; - select attention color |
| 434 return ; - done | |
| 435 | |
| 436 TFT_color_code_cns_3: | |
| 437 FONT_COLOR_MEMO ; select memo color | |
| 438 return ; done | |
| 439 | |
| 440 | |
| 441 ;----------------------------------------------------------------------------- | |
| 442 ; Color-Code a Supersaturation Value | |
| 443 ; | |
| 444 ; Input hi:lo CNS value [%] | |
| 445 ; | |
| 446 ; with int_O_lead_supersat, the upper byte is solely used for the flags | |
| 447 ; and not for the value, thus there is no need to clear the flags | |
| 448 ; | |
| 449 TFT_color_code_supersat: | |
| 450 movf pallet_color_memo,W ; load memo color by default | |
| 451 btfsc hi,int_attention_flag ; is the attention flag set? | |
| 452 movf pallet_color_attention,W ; YES - replace by attention color | |
| 453 btfsc hi,int_warning_flag ; is the warning flag set? | |
| 454 movf pallet_color_warning,W ; YES - replace by warning color | |
| 582 | 455 btfsc hi,int_invalid_flag ; is the invalid flag set? |
| 634 | 456 movf pallet_color_disabled,W ; YES - replace by disabled color |
| 457 movwf font_color ; set font color | |
| 458 return ; done | |
| 459 | |
| 460 | |
| 461 ;----------------------------------------------------------------------------- | |
| 462 ; Color-Code a ppO2 Value by its warning flags (16 bit) | |
| 463 ; | |
| 464 ; Input hi:lo ppO2 value [cbar] | |
| 465 ; | |
| 466 TFT_color_code_ppo2: | |
| 560 | 467 btfss hi,int_warning_flag ; is the warning flag set? |
| 468 bra TFT_color_code_ppo2_1 ; NO | |
| 582 | 469 bcf hi,int_warning_flag ; YES - clear warning flag |
| 634 | 470 bcf hi,int_attention_flag ; - clear attention flag (it may be set) |
| 471 bcf hi,int_high_flag ; - clear high warning flag (it may be set) | |
| 472 bcf hi,int_low_flag ; - clear low warning flag (it may be set) | |
| 473 FONT_COLOR_WARNING ; - select warning color | |
| 474 return ; - done | |
| 475 | |
| 560 | 476 TFT_color_code_ppo2_1: |
| 582 | 477 btfss hi,int_attention_flag ; is the attention flag set? |
| 478 bra TFT_color_code_ppo2_2 ; NO | |
| 479 bcf hi,int_attention_flag ; YES - clear attention flag (it may be set) | |
| 634 | 480 bcf hi,int_high_flag ; - clear high warning flag (it may be set) |
| 481 bcf hi,int_low_flag ; - clear low warning flag (it may be set) | |
| 482 FONT_COLOR_ATTENTION ; - select to attention color | |
| 483 return ; - done | |
| 484 | |
| 582 | 485 TFT_color_code_ppo2_2: |
| 486 bcf hi,int_high_flag ; clear high warning flag (it may be set) | |
| 487 bcf hi,int_low_flag ; clear low warning flag (it may be set) | |
| 634 | 488 FONT_COLOR_MEMO ; select memo color |
| 489 return ; done | |
| 490 | |
| 623 | 491 |
| 492 IFDEF _ccr_pscr | |
| 560 | 493 |
| 634 | 494 ;----------------------------------------------------------------------------- |
| 495 ; Color-Code a ppO2 Value by its warning flags (8 bit) | |
| 496 ; | |
| 497 ; Input lo ppO2 value [cbar] | |
| 498 ; | |
| 499 TFT_color_code_ppo2_hud: | |
| 604 | 500 movff char_O_deco_info,WREG ; get the deco info vector |
| 634 | 501 btfss WREG,deco_mode ; in deco? |
| 560 | 502 bra TFT_color_code_ppo2_hud_a ; NO - load normal max value as threshold |
| 634 | 503 movff char_I_ppO2_max_deco,WREG ; YES - load deco max value as threshold |
| 504 bra TFT_color_code_ppo2_hud_b ; continue | |
| 505 | |
| 582 | 506 TFT_color_code_ppo2_hud_a: |
| 623 | 507 movff char_I_ppO2_max_work,WREG ; ppO2 max while in working phase |
| 634 | 508 ;bra TFT_color_code_ppo2_hud_b ; continue |
| 509 | |
| 582 | 510 TFT_color_code_ppo2_hud_b: |
| 511 cpfsgt lo ; lo > threshold? | |
| 512 bra TFT_color_code_ppo2_hud1 ; NO - continue with checking for ppO2 low | |
| 634 | 513 FONT_COLOR_WARNING ; YES - set warning color |
| 514 return ; - done | |
| 515 | |
| 0 | 516 TFT_color_code_ppo2_hud1: |
| 560 | 517 movff opt_dive_mode,WREG ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR |
| 634 | 518 decfsz WREG,F ; in CCR mode? |
| 519 bra TFT_color_code_ppo2_hud_nocc; NO - check with ppO2 min for OC mode | |
| 520 btfsc bailout_mode ; YES - in bailout mode? | |
| 521 bra TFT_color_code_ppo2_hud_nocc; YES - check with ppO2 min for OC mode | |
| 522 movff char_I_ppO2_min_loop,WREG ; NO - check with ppO2 min for loop mode | |
| 523 bra TFT_color_code_ppo2_hud_com ; - continue with common part | |
| 524 | |
| 560 | 525 TFT_color_code_ppo2_hud_nocc: |
| 634 | 526 movff char_I_ppO2_min,WREG ; get ppO2 min for all other modes |
| 527 ;bra TFT_color_code_ppo2_hud_com ; continue with common part | |
| 528 | |
| 529 TFT_color_code_ppo2_hud_com: | |
| 582 | 530 cpfslt lo ; lo < char_I_ppO2_min? |
| 634 | 531 bra TFT_color_code_ppo2_hud_com1; NO - set memo color |
| 532 FONT_COLOR_WARNING ; YES - set warning color | |
| 533 return ; - done | |
| 534 | |
| 535 TFT_color_code_ppo2_hud_com1: | |
| 536 FONT_COLOR_MEMO ; select memo color | |
| 537 return ; done | |
| 623 | 538 |
| 539 ENDIF ; _ccr_pscr | |
| 540 | |
| 634 | 541 |
| 542 ;----------------------------------------------------------------------------- | |
| 543 ; Color-Code the Battery Level | |
| 544 ; | |
| 545 ; Input battery_low_condition battery status flag | |
| 546 ; | |
| 547 TFT_color_code_battery: | |
| 548 movf pallet_color_memo,W ; get memo color by default | |
| 549 btfsc battery_low_condition ; battery low condition detected? | |
| 550 movf pallet_color_warning,W ; YES - switch to warning color | |
| 551 movwf font_color ; set font color | |
| 552 return ; done | |
| 553 | |
| 554 | |
| 555 ;----------------------------------------------------------------------------- | |
| 556 ; Color-Code according to Gas Number | |
| 557 ; | |
| 558 ; Input WREG gas number | |
| 559 ; | |
| 560 global TFT_color_code_gas | |
| 561 TFT_color_code_gas: | |
| 562 movwf up ; copy gas number (1-6) to up | |
| 563 movlw color_white ; default color | |
| 564 dcfsnz up,F ; gas 1 ? | |
| 565 movlw color_white ; YES - color for gas 1 | |
| 566 dcfsnz up,F ; gas 2 ? | |
| 567 movlw color_green ; YES - color for gas 2 | |
| 568 dcfsnz up,F ; gas 3 ? | |
| 569 movlw color_red ; YSE - color for gas 3 | |
| 570 dcfsnz up,F ; gas 4 ? | |
| 571 movlw color_yellow ; YES - color for gas 4 | |
| 572 dcfsnz up,F ; gas 5 ? | |
| 573 movlw color_cyan ; YES - color for gas 5 | |
| 574 dcfsnz up,F ; gas 6 ? | |
| 575 movlw color_pink ; YES - color for gas 6 | |
| 576 movwf font_color ; set color | |
| 577 return ; done | |
| 578 | |
| 579 | |
| 623 | 580 ;============================================================================= |
| 634 | 581 tft_out3 CODE |
| 582 ;============================================================================= | |
| 583 | |
| 584 | |
| 585 ;----------------------------------------------------------------------------- | |
| 586 ; Surface Mode Screen - current Time | |
| 587 ; | |
| 588 global TFT_surfmode_time | |
| 589 TFT_surfmode_time: | |
| 654 | 590 TSTOSS opt_timeformat ; =1: Use 12h format |
| 591 bra TFT_surfmode_time24 ; <>1: Use 24h format | |
| 592 ; 12h Format | |
| 593 WIN_SMALL surf_clock_column,surf_clock_row | |
| 594 FONT_COLOR_MEMO ; set color | |
| 595 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time | |
| 596 movff rtc_latched_hour,lo ; get hours | |
| 597 call TFT_convert_lo_into_12h_format ; converts lo (0-23h) into lo (1-12) and sets aux_flag for PM/AM | |
| 598 output_99 ; print hours (0-99) | |
| 599 movlw ':' ; load a ":" | |
| 600 movff rtc_latched_secs,lo ; get seconds | |
| 601 btfss lo,0 ; on even second? | |
| 602 movlw ' ' ; NO - load a space char | |
| 603 movwf POSTINC2 ; print ":" or space char | |
| 604 movff rtc_latched_mins,lo ; get minutes | |
| 605 output_99x ; print minutes (00-99) | |
| 606 btfsc aux_flag ; =1 for PM | |
| 607 bra TFT_surfmode_time_PM | |
| 608 STRCAT_PRINT "AM" | |
| 609 return ; done | |
| 610 TFT_surfmode_time_PM: | |
| 611 STRCAT_PRINT "PM" | |
| 612 return ; done | |
| 613 | |
| 614 TFT_surfmode_time24: | |
| 634 | 615 WIN_SMALL surf_clock_column+.7,surf_clock_row |
| 616 FONT_COLOR_MEMO ; set color | |
| 617 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time | |
| 618 movff rtc_latched_hour,lo ; get hours | |
| 619 output_99 ; print hours (0-99) | |
| 620 movlw ':' ; load a ":" | |
| 621 movff rtc_latched_secs,lo ; get seconds | |
| 622 btfss lo,0 ; on even second? | |
| 623 movlw ' ' ; NO - load a space char | |
| 624 movwf POSTINC2 ; print ":" or space char | |
| 625 movff rtc_latched_mins,lo ; get minutes | |
| 626 output_99x ; print minutes (00-99) | |
| 627 PRINT ; dump to screen | |
| 628 return ; done | |
| 629 | |
| 630 | |
| 631 ;----------------------------------------------------------------------------- | |
| 632 ; Surface Mode Screen - current Date | |
| 633 ; | |
| 634 global TFT_surfmode_date | |
| 635 TFT_surfmode_date: | |
| 636 WIN_SMALL surf_date_column,surf_date_row | |
| 637 FONT_COLOR_MEMO ; set color | |
| 638 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time | |
| 639 movff rtc_latched_year, lo ; copy year to lo | |
| 640 movff rtc_latched_month,hi ; copy month to hi | |
| 641 movff rtc_latched_day, up ; copy day to up | |
| 642 call output_date ; print date | |
| 643 PRINT ; dump to screen | |
| 644 return ; done | |
| 645 | |
| 646 | |
| 647 ;----------------------------------------------------------------------------- | |
| 648 ; Surface Mode Screen - show Pressure, on condition deltaP > threshold | |
| 649 ; | |
| 650 global TFT_surfmode_pres_fast | |
| 651 TFT_surfmode_pres_fast: | |
| 652 SMOVII pressure_abs, sub_a ; ISR-safe 2 byte copy of current absolute pressure to sub_a | |
| 653 MOVII pressure_abs_ref,sub_b ; standard 2 byte copy 10 min ago absolute pressure to sub_b | |
| 654 call subU16 ; sub_c = | sub_a - sub_b | = deltaP | |
| 655 tstfsz sub_c+1 ; deltaP > 255 mbar ? | |
| 656 bra TFT_pres_surfmode_fast_1 ; YES - show current pressure | |
| 657 movlw pressure_noise_threshold+.1 ; NO - load noise suppression threshold | |
| 658 subwf sub_c+0,W ; - subtract threshold from deltaP | |
| 659 bc TFT_pres_surfmode_fast_1 ; - result negative -> show current pressure | |
| 660 tstfsz pressure_update_lag_counter ; - still in lag time? | |
| 661 bra TFT_pres_surfmode_fast_0 ; YES - continue updating the display | |
| 662 return ; NO - no display updates any more, done | |
| 663 | |
| 664 TFT_pres_surfmode_fast_0: | |
| 665 decf pressure_update_lag_counter,F ; clock down lag time counter | |
| 666 bra TFT_surfmode_pres ; update display | |
| 667 | |
| 668 TFT_pres_surfmode_fast_1: | |
| 669 movlw pressure_noise_lag_time ; get lag time | |
| 670 movwf pressure_update_lag_counter ; re-set lag time counter | |
| 671 ;bra TFT_surfmode_pres ; update display | |
| 672 | |
| 673 | |
| 674 ;----------------------------------------------------------------------------- | |
| 675 ; Surface Mode Screen - show Pressure (unconditional) | |
| 676 ; | |
| 677 global TFT_surfmode_pres | |
| 678 TFT_surfmode_pres: | |
| 679 ; value | |
| 656 | 680 WIN_SMALL surf_press_column+.6,surf_press_row |
| 634 | 681 FONT_COLOR_MEMO ; set color |
| 682 SMOVII pressure_abs,mpr ; get current pressure | |
| 683 FONT_COLOR_MEMO ; print in standard color | |
| 684 output_9999 ; print (0-9999) | |
| 656 | 685 PUTC " " |
| 686 STRCAT_TEXT_PRINT tMBAR ; print unit (hPa) | |
| 634 | 687 return ; done |
| 688 | |
| 689 | |
| 690 ;----------------------------------------------------------------------------- | |
| 691 ; Surface Mode Screen - Temperature | |
| 692 ; | |
| 693 global TFT_surfmode_temp | |
| 694 TFT_surfmode_temp: | |
| 695 ; unit | |
| 696 WIN_SMALL surf_temp_column+3*8,surf_temp_row | |
| 656 | 697 FONT_COLOR_MEMO ; print in standard color |
| 634 | 698 TSTOSS opt_units ; 0=°C, 1=°F |
| 699 bra TFT_temp_surfmode_metric ; 0: metric | |
| 700 ;bra TFT_temp_surfmode_imperial ; 1: imperial | |
| 701 | |
| 702 TFT_temp_surfmode_imperial: | |
| 703 STRCAT_TEXT tLogTunitF ; print "°F" | |
| 704 bra TFT_temp_surfmode_common ; continue with common part | |
| 705 | |
| 706 TFT_temp_surfmode_metric: | |
| 707 STRCAT_TEXT tLogTunitC ; print "°C" | |
| 708 ;bra TFT_temp_surfmode_common ; continue with common part | |
| 709 | |
| 710 TFT_temp_surfmode_common: | |
| 711 PRINT ; dump the unit to screen | |
| 712 | |
| 713 ; value | |
| 714 WIN_SMALL surf_temp_column,surf_temp_row | |
| 715 bra TFT_temp_common ; continue with common part | |
| 716 | |
| 717 | |
| 718 ; Helper Function - common output for surface and dive mode temperature | |
| 719 TFT_temp_common: | |
| 720 FONT_COLOR_MEMO ; set color | |
| 721 SMOVII temperature_cur,mpr ; ISR-safe 2 byte copy of current temperature to hi:lo | |
| 722 | |
| 723 ; DEBUG CODE - manual override temp | |
| 724 ; ----------------------------------- | |
| 725 ; MOVLI 0xFFF6,mpr ; - 1.0 °C | |
| 726 ; MOVLI 0xFF9C,mpr ; -10.0 °C | |
| 727 | |
| 728 TSTOSC opt_units ; 0=°C, 1=°F | |
| 729 call convert_celsius_to_fahrenheit;1 - convert value in lo:hi from Celsius to Fahrenheit | |
| 730 call convert_signed_16bit ; convert lo:hi into signed-short and print '-' if negative | |
| 731 btfsc neg_flag ; is the temperature negative? | |
| 732 bsf hide_digit4 ; YES - do not print digit 4 | |
| 733 bsf omit_digit_1 ; do not print digit 1 (0.1°) | |
| 734 output_9999 ; print temperature (0x-999x / 0x-99x if negative) | |
| 735 | |
| 736 btfss divemode ; in dive mode? | |
| 737 bra TFT_temp_common_no_unit ; NO - no unit to append | |
| 738 TSTOSS opt_units ; YES - check unit type: 0=°C, 1=°F | |
| 739 bra TFT_temp_common_metric ; 0 - metric | |
| 740 ;bra TFT_temp_common_imperial ; 1 - imperial | |
| 741 | |
| 742 TFT_temp_common_imperial: | |
| 743 STRCAT_TEXT_PRINT tLogTunitF ; append "°F" and dump to screen | |
| 744 return ; done | |
| 745 | |
| 746 TFT_temp_common_metric: | |
| 747 STRCAT_TEXT_PRINT tLogTunitC ; append "°C" and dump to screen | |
| 748 return ; done | |
| 749 | |
| 750 TFT_temp_common_no_unit: | |
| 751 PRINT ; dump to screen | |
| 752 return ; done | |
| 753 | |
| 754 | |
| 755 ;----------------------------------------------------------------------------- | |
| 756 ; Surface Mode Screen - Battery Status | |
| 757 ; | |
| 758 global TFT_surfmode_batt | |
| 759 TFT_surfmode_batt: | |
| 760 FONT_COLOR_MEMO ; set default color | |
| 761 | |
| 762 ; apply charging indicator and warnings | |
| 763 clrf WREG ; default to no indication/warning | |
| 764 btfsc cc_active ; charging in CC mode? | |
| 765 movlw color_yellow ; YES - set output color to yellow | |
| 766 btfsc cv_active ; charging in CV mode? | |
| 767 movlw color_green ; YES - set output color to green | |
| 631 | 768 btfsc battery_low_condition ; battery low condition detected? |
| 634 | 769 movf pallet_color_warning,W ; YES - set output to warning color |
| 770 btfsc battery_overtemp ; battery over-temperature detector tripped? | |
| 771 movf pallet_color_warning,W ; YES - set output to warning color | |
| 772 tstfsz WREG ; any indicator or warning active? | |
| 773 bsf win_invert ; YES - set output to inverse | |
| 774 tstfsz WREG ; any indicator or warning active (asked again)? | |
| 775 movwf font_color ; YES - change color | |
| 776 | |
| 777 WIN_SMALL batt_percent_column+.2,batt_percent_row | |
| 778 movff batt_percent,lo ; get battery % | |
| 779 output_256 ; print battery % (0-255) | |
| 780 STRCAT_PRINT "% " ; append unit with trailing space and dump to screen | |
| 781 | |
| 782 WIN_TINY batt_voltage_column+.15,batt_voltage_row | |
| 656 | 783 btfss dn_flag |
| 784 bra TFT_surfmode_batt2 | |
| 785 WIN_TINY batt_voltage_column+.15,.5 | |
| 786 FONT_COLOR color_green ; set menu title font color | |
| 787 STRCPY_TEXT_PRINT tBattery | |
| 788 return | |
| 789 TFT_surfmode_batt2: | |
| 790 FONT_COLOR_MEMO ; set color | |
| 791 movff battery_type,lo ; get battery type | |
| 792 PUTC "T" ; print "T" | |
| 793 output_9 ; print battery type code (0-9) | |
| 794 PUTC ":" ; print ":" | |
| 795 MOVII batt_voltage,mpr ; get battery voltage | |
| 796 bsf omit_digit_2 ; do not print 2nd and 1st digit | |
| 797 bsf decimal_digit3 ; place a decimal point in front of digit 3 | |
| 798 output_9999 ; print x.x-- | |
| 799 PUTC_PRINT 'V' ; append unit and dump to screen | |
| 800 return ; done | |
| 801 | |
| 802 | |
| 803 WIN_TINY batt_voltage_column+.15,batt_voltage_row | |
| 634 | 804 FONT_COLOR_MEMO ; set color |
| 805 movff battery_type,lo ; get battery type | |
| 806 PUTC "T" ; print "T" | |
| 807 output_9 ; print battery type code (0-9) | |
| 808 PUTC ":" ; print ":" | |
| 809 MOVII batt_voltage,mpr ; get battery voltage | |
| 810 bsf omit_digit_2 ; do not print 2nd and 1st digit | |
| 811 bsf decimal_digit3 ; place a decimal point in front of digit 3 | |
| 812 output_9999 ; print x.x-- | |
| 813 PUTC_PRINT 'V' ; append unit and dump to screen | |
| 814 return ; done | |
| 815 | |
| 816 ;update_battery_debug: | |
| 817 ; FONT_COLOR_MEMO | |
| 818 ; WIN_TINY .70,.0 | |
| 819 ; movff battery_gauge+5,xC+3 | |
| 820 ; movff battery_gauge+4,xC+2 | |
| 821 ; movff battery_gauge+3,xC+1 | |
| 822 ; movff battery_gauge+2,xC+0 | |
| 823 ; ; battery_gauge:6 is nAs | |
| 824 ; ; devide through 65536 | |
| 825 ; ; devide through 152 | |
| 826 ; ; Result is 0.01Ah in xC+1:xC+0 | |
| 827 ; MOVLI .152,xB | |
| 828 ; call div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder | |
| 829 ; MOVII xC,mpr | |
| 830 ; bsf leftbind | |
| 831 ; output_65535 | |
| 832 ; STRCAT_PRINT "x.01Ah" | |
| 833 ; return | |
| 834 | |
| 835 | |
| 836 ;----------------------------------------------------------------------------- | |
| 837 ; Surface Mode Screen - Deco Mode (0=OC, 1=CCR, 2=Gauge, 3=Apnoe, 4=pSCR) | |
| 838 ; | |
| 839 global TFT_surfmode_decotype | |
| 840 TFT_surfmode_decotype: | |
| 841 WIN_STD surf_decotype_column,surf_decotype_row | |
| 656 | 842 FONT_COLOR color_green ; set font color |
| 634 | 843 movff opt_dive_mode,lo ; get deco mode |
| 844 tstfsz lo ; in OC mode? | |
| 845 bra TFT_decotype_surface_2 ; NO | |
| 846 STRCAT_TEXT_PRINT tDvOC ; YES - print OC | |
| 847 return ; - done | |
| 848 | |
| 849 TFT_decotype_surface_2: | |
| 850 decfsz lo,F ; in CCR mode? | |
| 851 bra TFT_decotype_surface_3 ; NO | |
| 852 IFDEF _ccr_pscr | |
| 853 STRCAT_TEXT_PRINT tDvCC ; YES - print CCR | |
| 854 | |
| 855 WIN_TINY surf_decotype_column+.18,surf_decotype_row+.12 | |
| 856 FONT_COLOR_MEMO ; - set color | |
| 857 movff opt_ccr_mode,WREG ; - ccr mode | |
| 858 tstfsz WREG ; - ccr_mode = 0 (FixedSP) ? | |
| 859 bra TFT_surfmode_decotype_cc_var; NO - not fixed | |
| 860 ;bra TFT_surfmode_decotype_cc_fix; YES - fixed | |
| 861 | |
| 862 TFT_surfmode_decotype_cc_fix: | |
| 863 STRCPY_TEXT tCCRModeFixedSP ; print "fixed SP" | |
| 864 bra TFT_decotype_surface_cc_com ; continue | |
| 865 | |
| 866 TFT_surfmode_decotype_cc_var: | |
| 867 ; Sensor or Auto SP mode | |
| 868 sublw .2 ; ccr_mode = 2 (Auto SP) ? | |
| 869 bz TFT_decotype_surface_cc_auto; YES - AutoSP | |
| 656 | 870 IFDEF _external_sensor_eccr |
| 634 | 871 STRCPY_TEXT tCCRModeSensor ; NO - print "Sensor" |
| 872 bra TFT_decotype_surface_cc_com ; - continue | |
| 656 | 873 ENDIF ; _external_sensor_eccr |
| 634 | 874 |
| 875 TFT_decotype_surface_cc_auto: | |
| 876 STRCPY_TEXT tCCRModeAutoSP ; print "Auto SP" | |
| 877 ;bra TFT_decotype_surface_cc_com ; continue | |
| 878 | |
| 879 TFT_decotype_surface_cc_com: | |
| 880 clrf WREG ; load string terminator | |
| 881 movff WREG,buffer+.8 ; limit string length to 8 | |
| 882 PRINT ; dump to screen | |
| 883 return ; done | |
| 884 ENDIF ; _ccr_pscr | |
| 885 | |
| 886 TFT_decotype_surface_3: | |
| 887 decfsz lo,F ; in gauge mode? | |
| 888 bra TFT_decotype_surface_4 ; NO | |
| 889 STRCAT_TEXT_PRINT tDvGauge ; YES - print "Gauge" | |
| 890 return ; - done | |
| 891 | |
| 892 TFT_decotype_surface_4: | |
| 893 decfsz lo,F ; in apnea mode? | |
| 894 bra TFT_decotype_surface_5 ; NO | |
| 895 STRCAT_TEXT_PRINT tDvApnea ; YES - print "Apnoe" | |
| 896 return ; - done | |
| 897 | |
| 898 TFT_decotype_surface_5: | |
| 899 STRCAT_TEXT_PRINT tDvPSCR ; print "pSCR" | |
| 900 return ; done | |
| 901 | |
| 902 | |
| 903 ;----------------------------------------------------------------------------- | |
| 904 ; Surface Mode Screen - small Gas List | |
| 905 ; | |
| 906 global TFT_surfmode_startgas | |
| 907 TFT_surfmode_startgas: | |
| 908 ; FIRST gas | |
| 582 | 909 WIN_SMALL surf_decotype_column+.1,surf_decotype_row+.30 |
| 634 | 910 FONT_COLOR_MEMO ; set font color |
| 604 | 911 call get_first_gas_to_WREG ; get first gas (1-5) into WREG |
| 560 | 912 decf WREG,W ; 1-5 -> 0-4 |
| 634 | 913 movwf PRODL ; copy to PRODL |
| 914 call gaslist_strcat_mix_PRODL ; print gas description | |
| 915 PRINT ; dump to screen | |
| 916 | |
| 917 ; show gases | |
| 918 WIN_TOP surf_decotype_row+.30+.25 ; set row position | |
| 919 | |
| 920 ; 1st gas | |
| 582 | 921 WIN_LEFT surf_decotype_boxes_left1+.1 |
| 922 movff opt_gas_type+0,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco | |
| 634 | 923 rcall TFT_surfmode_startgas_helper; set font color |
| 924 STRCPY_PRINT "1" ; print "1" | |
| 582 | 925 decfsz hi,F ; Type = 1 (First)? |
| 634 | 926 bra TFT_surfmode_startgas_2 ; NO - skip box |
| 927 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left1, surf_decotype_boxes_left1+.8 | |
| 928 | |
| 929 ; 2nd gas | |
| 930 TFT_surfmode_startgas_2: | |
| 931 WIN_LEFT surf_decotype_boxes_left2+.1 | |
| 582 | 932 movff opt_gas_type+1,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
| 634 | 933 rcall TFT_surfmode_startgas_helper; set font color |
| 934 STRCPY_PRINT "2" ; print "2" | |
| 582 | 935 decfsz hi,F ; Type = 1 (First)? |
| 634 | 936 bra TFT_surfmode_startgas_3 ; NO - skip box |
| 937 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left2, surf_decotype_boxes_left2+.8 | |
| 938 | |
| 939 ; 3rd gas | |
| 940 TFT_surfmode_startgas_3: | |
| 941 WIN_LEFT surf_decotype_boxes_left3+.1 | |
| 582 | 942 movff opt_gas_type+2,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
| 634 | 943 rcall TFT_surfmode_startgas_helper; set font color |
| 944 STRCPY_PRINT "3" ; print "3" | |
| 582 | 945 decfsz hi,F ; Type = 1 (First)? |
| 634 | 946 bra TFT_surfmode_startgas_4 ; NO - skip box |
| 947 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left3, surf_decotype_boxes_left3+.8 | |
| 948 | |
| 949 ; 4th gas | |
| 950 TFT_surfmode_startgas_4: | |
| 951 WIN_LEFT surf_decotype_boxes_left4+.1 | |
| 582 | 952 movff opt_gas_type+3,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
| 634 | 953 rcall TFT_surfmode_startgas_helper; set font color |
| 954 STRCPY_PRINT "4" ; print "4" | |
| 582 | 955 decfsz hi,F ; Type = 1 (First)? |
| 634 | 956 bra TFT_surfmode_startgas_5 ; NO - skip box |
| 957 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left4, surf_decotype_boxes_left4+.8 | |
| 958 | |
| 959 ; 5th gas | |
| 960 TFT_surfmode_startgas_5: | |
| 961 WIN_LEFT surf_decotype_boxes_left5+.1 | |
| 582 | 962 movff opt_gas_type+4,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
| 634 | 963 rcall TFT_surfmode_startgas_helper; set font color |
| 964 STRCPY_PRINT "5" ; print "5" | |
| 604 | 965 decfsz hi,F ; type = 1 (First)? |
| 634 | 966 return ; NO - done |
| 967 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left5, surf_decotype_boxes_left5+.8 | |
| 968 return ; done | |
| 969 | |
| 970 | |
| 971 ; Helper Function - set font color | |
| 972 TFT_surfmode_startgas_helper: | |
| 640 | 973 movf pallet_color_disabled,W ; set default color |
| 634 | 974 tstfsz hi ; gas not disabled? |
| 975 movf pallet_color_memo,W ; YES - change to memo color | |
| 976 movwf font_color ; set font color | |
| 977 return | |
| 978 | |
| 979 IFDEF _rx_functions | |
| 980 | |
| 981 ;----------------------------------------------------------------------------- | |
| 982 ; Surface Mode Screen - Tank Pressure Reading above Surface Pressure | |
| 983 ; | |
| 984 global TFT_surfmode_tankpres | |
| 985 TFT_surfmode_tankpres: | |
| 986 WIN_SMALL surf_decotype_column+.6,surf_decotype_row+.30+.47 | |
| 987 movff int_IO_pressure_value+0,lo ; copy pressure from 1st reading to hi:lo | |
| 988 movff int_IO_pressure_value+1,hi ; ... | |
| 989 btfss hi,int_not_avail_flag ; pressure reading 1 available? | |
| 990 bra TFT_surface_tank_pres_0 ; YES | |
| 991 movff int_IO_pressure_value+2,lo ; NO - copy pressure from 2nd reading to hi:lo | |
| 992 movff int_IO_pressure_value+3,hi ; - ... | |
| 993 btfsc hi,int_not_avail_flag ; - pressure reading 2 available? | |
| 994 bra TFT_surface_tank_pres_1 ; NO - show not avail message | |
| 995 | |
| 996 TFT_surface_tank_pres_0: | |
| 997 call TFT_color_code_pres_sac ; set output color according to flags | |
| 998 bsf omit_digit_1 ; do not print 1st digit (0.1 bar) | |
| 999 output_9999 ; print (0x-999x) | |
| 1000 PRINT ; dump to screen | |
| 1001 bra TFT_surface_tank_pres_2 ; print unit | |
| 1002 | |
| 1003 TFT_surface_tank_pres_1: | |
| 1004 FONT_COLOR_DISABLED ; select disabled color | |
| 1005 STRCAT_PRINT " ---" ; output for no pressure data available | |
| 1006 | |
| 1007 TFT_surface_tank_pres_2: | |
| 1008 WIN_SMALL surf_decotype_column+.38,surf_decotype_row+.30+.47 | |
| 1009 FONT_COLOR_MASK ; select mask color | |
| 1010 STRCAT_PRINT "bar" ; can not use tbar because it has a leading space | |
| 1011 return ; done | |
| 1012 | |
| 1013 ENDIF ; _rx_functions | |
| 1014 | |
| 1015 | |
| 1016 ;============================================================================= | |
| 1017 tft_out4 CODE | |
| 1018 ;============================================================================= | |
| 1019 | |
| 1020 | |
| 1021 ;----------------------------------------------------------------------------- | |
| 1022 ; Imprint the Color Schemes | |
| 1023 ; | |
| 1024 global TFT_imprint_color_schemes | |
| 1025 TFT_imprint_color_schemes: | |
| 1026 call TFT_load_dive_color_pallet ; load dive mode color pallet | |
| 1027 | |
| 1028 FONT_COLOR_MASK ; select mask color | |
| 1029 WIN_TINY .12,.40 ; print labels | |
| 1030 STRCAT_TEXT_PRINT tDepth ; ... | |
| 1031 WIN_TINY .62,.40 ; ... | |
| 1032 STRCAT_TEXT_PRINT tMaxDepth ; ... | |
| 1033 WIN_TINY .122,.40 ; ... | |
| 1034 STRCAT_TEXT_PRINT tDivetime ; ... | |
| 1035 | |
| 1036 FONT_COLOR_DISABLED ; select disabled color | |
| 1037 | |
| 1038 ; max. depth demo | |
| 1039 WIN_MEDIUM .64,.54 ; set font and position | |
| 1040 movlw .63 ; load demo depth | |
| 1041 movwf lo ; ... | |
| 1042 output_99 ; print full meters (0-99) | |
| 1043 PRINT ; dump to screen | |
| 1044 | |
| 1045 WIN_SMALL .87,.66 ; set font and position | |
| 1046 PUTC "." ; print ":" | |
| 1047 movlw .4 ; load demo depth | |
| 1048 movwf lo ; ... | |
| 1049 output_9 ; print decimeters (0-9) | |
| 1050 PRINT ; dump to screen | |
| 1051 | |
| 1052 FONT_COLOR_MEMO ; select memo color | |
| 1053 | |
| 1054 ; depth demo | |
| 1055 WIN_MEDIUM .3,.54 ; set font and position | |
| 1056 movlw .17 ; load a demo depth | |
| 1057 movwf lo ; ... | |
| 1058 output_99 ; print full meters (0-99) | |
| 1059 PRINT ; dump to screen | |
| 1060 | |
| 1061 WIN_SMALL .25,.66 ; set font and position | |
| 1062 PUTC "." ; print ":" | |
| 1063 movlw .5 ; load demo depth | |
| 1064 movwf lo ; ... | |
| 1065 output_9 ; print decimeters (0-9) | |
| 1066 PRINT ; dump to screen | |
| 1067 | |
| 1068 ; dive time demo | |
| 1069 WIN_MEDIUM .103, .54 ; set font and position | |
| 1070 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time | |
| 1071 movff rtc_latched_mins,lo ; get minutes | |
| 1072 output_256 ; print minutes (in 3 digits, 1st digit used as spacer) | |
| 1073 PRINT ; dump to screen | |
| 1074 | |
| 1075 WIN_SMALL .139, .66 ; set font and position | |
| 1076 PUTC ':' ; print ":" | |
| 1077 movff rtc_latched_secs,lo ; get seconds | |
| 1078 output_99x ; print seconds (00-99) | |
| 1079 PRINT ; dump to screen | |
| 1080 | |
| 1081 ; messages demo | |
| 1082 WIN_SMALL dm_warning1_column-.78, dm_warning1_row+.39+.12 | |
| 1083 FONT_COLOR_ADVICE ; select advice color | |
| 1084 STRCPY_TEXT_PRINT tgaschange ; sample text "Change?" | |
| 1085 | |
| 1086 WIN_SMALL dm_warning1_column, dm_warning1_row+.39 | |
| 1087 FONT_COLOR_ATTENTION ; select attention color | |
| 1088 STRCPY_TEXT_PRINT tCNSeod ; sample text "CNS final" | |
| 1089 | |
| 1090 WIN_SMALL dm_warning2_column, dm_warning2_row+.38 | |
| 1091 FONT_COLOR_WARNING ; select warning color | |
| 1092 STRCPY_TEXT_PRINT tGasNeedsWarn ; sample text "Gas Needs" | |
| 1093 | |
| 1094 call TFT_load_std_color_pallet ; re-load standard color pallet | |
| 1095 | |
| 1096 return ; done | |
| 1097 | |
| 1098 | |
| 1099 ;----------------------------------------------------------------------------- | |
| 1100 ; Surface Menu - Imprint Time & Date | |
| 1101 ; | |
| 1102 global TFT_imprint_time_date | |
| 1103 TFT_imprint_time_date: | |
| 1104 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of current date & time | |
| 1105 ;bra TFT_imprint_time_date_fast ; continue | |
| 1106 | |
| 1107 | |
| 1108 ;----------------------------------------------------------------------------- | |
| 1109 ; Surface Menu - Imprint Time & Date - fast Updating | |
| 1110 ; | |
| 1111 global TFT_imprint_time_date_fast | |
| 1112 TFT_imprint_time_date_fast: | |
| 654 | 1113 WIN_SMALL .20,.35 ; column, row - keep clear of the cursor area on the left! |
| 1114 FONT_COLOR_MEMO ; set color | |
| 1115 TSTOSS opt_timeformat ; =1: Use 12h format | |
| 1116 bra TFT_imprint_time_date_fast24 ; <>1: Use 24h format | |
| 1117 ; 12h Format | |
| 1118 movff rtc_latched_hour,lo ; get hours | |
| 1119 rcall TFT_convert_lo_into_12h_format ; converts lo (0-23h) into lo (1-12) and sets aux_flag for PM/AM | |
| 1120 output_99 ; print hours (0-99) | |
| 1121 movlw ':' ; load a ":" | |
| 1122 movff rtc_latched_secs,lo ; get seconds | |
| 1123 btfss lo,0 ; on even second? | |
| 1124 movlw ' ' ; NO - load a space char | |
| 1125 movwf POSTINC2 ; print ":" or space char | |
| 1126 movff rtc_latched_mins,lo ; get minutes | |
| 1127 output_99x ; print minutes (00-99) | |
| 1128 PUTC ':' ; print ":" | |
| 1129 movff rtc_latched_secs,lo ; get seconds | |
| 1130 output_99x ; print seconds (00-99) | |
| 1131 btfsc aux_flag ; =1 for PM | |
| 1132 bra TFT_surfmode_time_PM_fast | |
| 1133 STRCAT "AM " | |
| 1134 bra TFT_imprint_time_date_fast_date ; done | |
| 1135 TFT_surfmode_time_PM_fast: | |
| 1136 STRCAT "PM " | |
| 1137 bra TFT_imprint_time_date_fast_date ; done | |
| 1138 TFT_imprint_time_date_fast24: | |
| 634 | 1139 movff rtc_latched_hour,lo ; get hours |
| 1140 output_99 ; print hours (0-99) | |
| 1141 PUTC ':' ; print ":" | |
| 1142 movff rtc_latched_mins,lo ; get minutes | |
| 1143 output_99x ; print minutes (00-99) | |
| 1144 PUTC ':' ; print ":" | |
| 1145 movff rtc_latched_secs,lo ; get seconds | |
| 1146 output_99x ; print seconds (00-99) | |
| 1147 STRCAT " " ; append two spaces | |
| 654 | 1148 TFT_imprint_time_date_fast_date: |
| 634 | 1149 movff rtc_latched_year, lo ; get date |
| 1150 movff rtc_latched_month,hi ; ... | |
| 1151 movff rtc_latched_day, up ; ... | |
| 1152 call output_date ; print date | |
| 1153 PUTC_PRINT " " ; append a space and dump to screen | |
| 604 | 1154 return ; done |
| 582 | 1155 |
| 654 | 1156 global TFT_convert_lo_into_12h_format |
| 1157 TFT_convert_lo_into_12h_format: ; converts lo (0-23h) into lo (1-12) with PM/AM flag in aux_flag | |
| 1158 tstfsz lo | |
| 1159 bra TFT_convert_lo_into_12h_format1 | |
| 1160 ; 0 -> 12AM | |
| 1161 movlw .12 | |
| 1162 movwf lo | |
| 1163 bcf aux_flag ; PM/AM Bit | |
| 1164 return | |
| 1165 TFT_convert_lo_into_12h_format1: | |
| 1166 movlw .13 | |
| 1167 cpfslt lo ; >12h? | |
| 1168 bra TFT_convert_lo_into_12h_format2 ; yes | |
| 1169 ; lo stays the same | |
| 1170 bsf aux_flag ; PM/AM Bit | |
| 1171 movlw .12 ; 12:00 is 12:00 PM... | |
| 1172 cpfseq lo | |
| 1173 bcf aux_flag | |
| 1174 return | |
| 1175 TFT_convert_lo_into_12h_format2: | |
| 1176 movlw .12 | |
| 1177 subwf lo,F | |
| 1178 bsf aux_flag ; PM/AM Bit | |
| 1179 return | |
| 1180 | |
| 656 | 1181 IFDEF _external_sensor_eccr |
| 634 | 1182 |
| 1183 ;----------------------------------------------------------------------------- | |
| 1184 ; Surface Mode - Imprint ppO2 from Sensors | |
| 1185 ; | |
| 1186 global TFT_imprint_surf_ppO2 | |
| 1187 TFT_imprint_surf_ppO2: | |
| 1188 | |
| 1189 TFT_imprint_surf_ppO2_1: | |
| 1190 WIN_SMALL surf_hud_sensor1_column,surf_hud_sensor1_row | |
| 1191 btfsc sensor1_calibrated_ok ; sensor calibrated? | |
| 1192 bra TFT_imprint_surf_ppO2_1a ; YES | |
| 1193 btfsc sensor1_active ; NO - valid HUD data for this sensor? | |
| 1194 bra TFT_imprint_surf_ppO2_1a ; YES | |
| 1195 rcall TFT_imprint_surf_ppO2_h2 ; NO - print dashes | |
| 1196 bra TFT_imprint_surf_ppO2_2 ; - continue with sensor 2 | |
| 1197 TFT_imprint_surf_ppO2_1a: | |
| 1198 movff sensor1_ppO2,lo ; get ppO2 | |
| 1199 rcall TFT_imprint_surf_ppO2_h1 ; print ppO2 | |
| 1200 | |
| 1201 TFT_imprint_surf_ppO2_2: | |
| 1202 WIN_SMALL surf_hud_sensor2_column,surf_hud_sensor2_row | |
| 1203 btfsc sensor2_calibrated_ok ; sensor calibrated? | |
| 1204 bra TFT_imprint_surf_ppO2_2a ; YES | |
| 1205 btfsc sensor2_active ; NO - valid HUD data for this sensor | |
| 1206 bra TFT_imprint_surf_ppO2_2a ; YES | |
| 1207 rcall TFT_imprint_surf_ppO2_h2 ; NO - print dashes | |
| 1208 bra TFT_imprint_surf_ppO2_3 ; - continue with sensor 3 | |
| 1209 TFT_imprint_surf_ppO2_2a: | |
| 1210 movff sensor2_ppO2,lo ; get ppO2 | |
| 1211 rcall TFT_imprint_surf_ppO2_h1 ; print ppO2 | |
| 1212 | |
| 1213 TFT_imprint_surf_ppO2_3: | |
| 1214 WIN_SMALL surf_hud_sensor3_column,surf_hud_sensor3_row | |
| 1215 btfsc sensor3_calibrated_ok ; sensor calibrated? | |
| 1216 bra TFT_imprint_surf_ppO2_3a ; YES | |
| 1217 btfsc sensor3_active ; NO - valid HUD data for this sensor | |
| 1218 bra TFT_imprint_surf_ppO2_3a ; YES | |
| 1219 bra TFT_imprint_surf_ppO2_h2 ; NO - print dashes and return | |
| 1220 return ; - done | |
| 1221 TFT_imprint_surf_ppO2_3a: | |
| 1222 movff sensor3_ppO2,lo ; get ppO2 | |
| 1223 ;bra TFT_imprint_surf_ppO2_h1 ; print ppO2 and return | |
| 1224 | |
| 1225 TFT_imprint_surf_ppO2_h1: | |
| 1226 call TFT_color_code_ppo2_hud ; color-code with ppO2 [cbar] in lo | |
| 1227 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 1228 output_256 ; print (0.00-2.55) | |
| 1229 PRINT ; dump to screen | |
| 1230 return ; done | |
| 1231 | |
| 1232 TFT_imprint_surf_ppO2_h2: | |
| 1233 FONT_COLOR_MEMO ; select standard color | |
| 1234 STRCPY_PRINT "--- " ; print dashes | |
| 1235 return ; done | |
| 1236 | |
| 1237 | |
| 1238 ;----------------------------------------------------------------------------- | |
| 1239 ; Surface Mode - Imprint mV from Sensors | |
| 1240 ; | |
| 1241 global TFT_imprint_surf_mV | |
| 1242 TFT_imprint_surf_mV: | |
| 1243 FONT_COLOR_MEMO ; set font color | |
| 1244 | |
| 1245 ; sensor 1 | |
| 1246 WIN_SMALL surf_mV_sensor_column,surf_mV_sensor1_row | |
| 1247 SMOVII sensor1_mv,mpr ; in 0.1mV steps | |
| 1248 STRCAT "1: " ; print number | |
| 1249 rcall TFT_sensor_mV_helper ; print mV | |
| 1250 | |
| 1251 ; sensor 2 | |
| 1252 WIN_SMALL surf_mV_sensor_column,surf_mV_sensor2_row | |
| 1253 SMOVII sensor2_mv,mpr ; in 0.1mV steps | |
| 1254 STRCAT "2: " ; print number | |
| 1255 rcall TFT_sensor_mV_helper | |
| 1256 | |
| 1257 ; sensor 3 | |
| 1258 WIN_SMALL surf_mV_sensor_column,surf_mV_sensor3_row | |
| 1259 SMOVII sensor3_mv,mpr ; in 0.1mV steps | |
| 1260 STRCAT "3: " ; print number | |
| 1261 rcall TFT_sensor_mV_helper ; print mV | |
| 1262 | |
| 1263 ; print sensor connection type | |
| 1264 WIN_SMALL surf_mV_sensor_column,surf_mV_sensor3_row+.24 | |
| 1265 btfsc ext_input_optical ; optical input? | |
| 1266 bra TFT_sensor_mV_optical ; YES | |
| 656 | 1267 btfsc ext_s8_full_digital ; are we in external S8 full digital mode? |
| 1268 bra TFT_sensor_mV_optical ; YES | |
| 634 | 1269 TSTOSS opt_s8_mode ; NO - S8 input selected? |
| 1270 bra TFT_sensor_mV_analog ; NO - analog input | |
| 1271 ;bra TFT_sensor_mV_s8 ; YES - S8 | |
| 1272 | |
| 1273 TFT_sensor_mV_s8: | |
| 1274 STRCAT_PRINT "Digital" ; print "Digital" | |
| 1275 return ; done | |
| 1276 | |
| 1277 TFT_sensor_mV_optical: | |
| 1278 STRCAT_PRINT "Optical" ; print "Optical" | |
| 1279 return ; done | |
| 1280 | |
| 1281 TFT_sensor_mV_analog: | |
| 1282 STRCAT_PRINT "Analog" ; print "analog" | |
| 1283 return ; done | |
| 1284 | |
| 1285 | |
| 1286 ; Helper Function - print mV value | |
| 1287 TFT_sensor_mV_helper: | |
| 1288 bsf decimal_digit1 ; place a decimal point in front of digit 1 | |
| 1289 output_9999 ; print (0.0-999.9) | |
| 1290 STRCAT_PRINT "mV " ; append unit and dump buffer to screen | |
| 1291 return ; done | |
| 1292 | |
| 1293 | |
| 1294 ;----------------------------------------------------------------------------- | |
| 1295 ; Surface Mode - Imprint End-of-Life from Sensors | |
| 1296 ; | |
| 1297 ; when opt_x_sx > 255 the sensor will just give 8 mV at a ppO2 of 0.21 | |
| 1298 ; | |
| 1299 global TFT_imprint_surf_sensor_eol | |
| 1300 TFT_imprint_surf_sensor_eol: | |
| 1301 FONT_COLOR_WARNING ; set color | |
| 1302 | |
| 1303 TFT_imprint_surf_eol_1: | |
| 1304 ; sensor 1 | |
| 1305 btfss sensor1_calibrated_ok ; valid calibration? | |
| 1306 bra TFT_imprint_surf_eol_2 ; NO - skip | |
| 1307 movff opt_x_s1+1,WREG ; YES - get high(opt_x_s1) | |
| 1308 movf WREG,W ; - excite flags | |
| 1309 bz TFT_imprint_surf_eol_2 ; - opt_x_s1 > 255 -> the sensor is not too bad yet for a warning | |
| 1310 WIN_SMALL surf_mV_sensor_status_column,surf_mV_sensor1_row-.5 | |
| 1311 STRCPY_PRINT "\xb8" ; mark sensor as being at end of lifetime | |
| 1312 | |
| 1313 TFT_imprint_surf_eol_2: | |
| 1314 ; sensor 2 | |
| 1315 btfss sensor2_calibrated_ok ; valid calibration? | |
| 1316 bra TFT_imprint_surf_eol_3 ; NO - skip | |
| 1317 movff opt_x_s2+1,WREG ; YES - get high(opt_x_s2) | |
| 1318 movf WREG,W ; - excite flags | |
| 1319 bz TFT_imprint_surf_eol_3 ; - opt_x_s2 > 255 -> the sensor is not too bad yet for a warning | |
| 1320 WIN_SMALL surf_mV_sensor_status_column,surf_mV_sensor2_row-.5 | |
| 1321 STRCPY_PRINT "\xb8" ; mark sensor as being at end of lifetime | |
| 1322 | |
| 1323 TFT_imprint_surf_eol_3: | |
| 1324 ; sensor 3 | |
| 1325 btfss sensor3_calibrated_ok ; valid calibration? | |
| 1326 bra TFT_imprint_surf_eol_4 ; NO - skip | |
| 1327 movff opt_x_s3+1,WREG ; YES - get high(opt_x_s3) | |
| 1328 movf WREG,W ; - excite flags | |
| 1329 bz TFT_imprint_surf_eol_4 ; - opt_x_s3 > 255 -> the sensor is not too bad yet for a warning | |
| 1330 WIN_SMALL surf_mV_sensor_status_column,surf_mV_sensor3_row-.5 | |
| 1331 STRCPY_PRINT "\xb8" ; mark sensor as being at end of lifetime | |
| 1332 | |
| 1333 TFT_imprint_surf_eol_4: | |
| 1334 return ; done | |
| 1335 | |
| 1336 | |
| 1337 ;----------------------------------------------------------------------------- | |
| 1338 ; Imprint Function for the Calibration Menu | |
| 1339 ; | |
| 1340 global TFT_imprint_menu_mV | |
| 1341 TFT_imprint_menu_mV: | |
| 1342 FONT_COLOR color_yellow ; show in yellow | |
| 1343 rcall TFT_sensor_mv_get ; get sensor mV values | |
| 1344 | |
| 1345 ; sensor 1 | |
| 1346 WIN_SMALL surf_menu_sensor1_column,surf_menu2_sensor1_row | |
| 1347 SMOVII sensor1_mv,mpr ; in 0.1mV steps | |
| 1348 rcall TFT_imprint_menu_mV_helper ; print mV value | |
| 1349 | |
| 1350 ; sensor 2 | |
| 1351 WIN_SMALL surf_menu_sensor2_column,surf_menu2_sensor2_row | |
| 1352 SMOVII sensor2_mv,mpr ; in 0.1mV steps | |
| 1353 rcall TFT_imprint_menu_mV_helper ; print mV value | |
| 1354 | |
| 1355 ; sensor 3 | |
| 1356 WIN_SMALL surf_menu_sensor3_column,surf_menu2_sensor3_row | |
| 1357 SMOVII sensor3_mv,mpr ; in 0.1mV steps | |
| 1358 rcall TFT_imprint_menu_mV_helper ; print mV value | |
| 1359 | |
| 1360 TSTOSS opt_s8_mode ; =0: analog, =1: digital | |
| 1361 return ; analog - done | |
| 1362 | |
| 1363 ; imprint HUD battery voltage | |
| 1364 WIN_TINY .20,.209 ; set position | |
| 1365 STRCPY "HUD Batt: " ; print label | |
| 1366 SMOVII hud_battery_mv,mpr ; get HUD battery voltage | |
| 1367 bsf decimal_digit3 ; place a decimal point in front of digit 3 | |
| 1368 output_9999 ; print (0.000-9.999) | |
| 1369 PUTC_PRINT "V" ; append unit and dump buffer to screen | |
| 1370 return ; done | |
| 1371 | |
| 1372 ; Helper Function - get sensor mV values | |
| 1373 TFT_sensor_mv_get: | |
| 1374 ; btfsc ext_input_optical ; do we have an optical interface? | |
| 1375 ; return ; YES - optical interface delivers ready-to-use mV data, done | |
| 1376 TSTOSS opt_s8_mode ; NO - S8 input selected? | |
| 1377 bra TFT_sensor_mv_get_ana ; NO - read analog inputs | |
| 1378 ;bra TFT_sensor_mv_get_dig ; YES - convert digitally received ppO2 into mV | |
| 1379 | |
| 1380 TFT_sensor_mv_get_dig: | |
| 1381 btfss trigger_S8_data_update ; new data frame received? | |
| 1382 return ; NO - use old values | |
| 1383 bcf trigger_S8_data_update ; YES - clear update flag | |
| 1384 call compute_mvolts_from_rawdata ; - compute mV values from received raw data | |
| 1385 return ; - done | |
| 1386 | |
| 1387 TFT_sensor_mv_get_ana: | |
| 1388 call get_analog_inputs ; read mV values from analog inputs | |
| 1389 return ; done | |
| 1390 | |
| 1391 | |
| 1392 ; Helper Function - print mV value | |
| 1393 TFT_imprint_menu_mV_helper: | |
| 1394 bsf decimal_digit1 ; place a decimal point in front of digit 1 (no 0.1 mV) | |
| 1395 output_9999 ; print (0.0-999.9) | |
| 1396 STRCAT_PRINT "mV" ; append unit and dump buffer to screen | |
| 1397 return ; done | |
| 1398 | |
| 656 | 1399 ENDIF ; _external_sensor_eccr |
| 634 | 1400 |
| 1401 | |
| 1402 IFDEF _rx_functions | |
| 1403 ;----------------------------------------------------------------------------- | |
| 1404 ; Imprint Function for the Tank Setup Menu | |
| 1405 ; | |
| 1406 global TFT_imprint_tank_pres | |
| 1407 TFT_imprint_tank_pres: | |
| 1408 FONT_COLOR_MEMO ; set color | |
| 1409 ; get ID | |
| 1410 lfsr FSR1,opt_transmitter_id_1 ; load base address of opt_transmitter_id | |
| 1411 movf gaslist_gas,W ; get current gas | |
| 1412 rlncf WREG,W ; multiply by 2 because IDs are 2 byte in size | |
| 1413 movff PLUSW1,lo ; copy opt_transmitter_id+0[gaslist_gas] to lo | |
| 1414 incf WREG,W ; increment index | |
| 1415 movff PLUSW1,hi ; copy opt_transmitter_id+1[gaslist_gas] to hi | |
| 1416 ; show pressure | |
| 1417 WIN_SMALL .90, .61 ; column, row (+/- 27 per row) | |
| 1418 call get_pres_by_transmitter_id ; get pressure into hi:lo | |
| 1419 tstfsz WREG ; do we have valid tank data (WREG=0) ? | |
| 1420 bra TFT_menu_tank_pres_1 ; NO - transmitter not found | |
| 1421 call TFT_color_code_pres_sac ; set output color according to flags | |
| 1422 bsf omit_digit_1 ; do not print 1st digit (0.1 bar) | |
| 1423 output_9999 ; print (0x-999x) | |
| 1424 bra TFT_menu_tank_pres_2 | |
| 1425 TFT_menu_tank_pres_1: | |
| 1426 FONT_COLOR_DISABLED ; select color | |
| 1427 STRCAT " ---" ; print dashes for no pressure data available | |
| 1428 TFT_menu_tank_pres_2: | |
| 1429 STRCAT_TEXT_PRINT tbar ; print " bar" | |
| 1430 return ; done | |
| 1431 | |
| 1432 ENDIF ; _rx_functions | |
| 1433 | |
| 1434 | |
| 1435 ;============================================================================= | |
| 1436 tft_out5 CODE | |
| 1437 ;============================================================================= | |
| 1438 | |
| 1439 | |
| 1440 ;----------------------------------------------------------------------------- | |
| 1441 ; Dive Mode - static Layout | |
| 1442 ; | |
| 623 | 1443 global TFT_show_divemode_mask |
| 1444 TFT_show_divemode_mask: ; display mask in dive mode | |
| 634 | 1445 FONT_COLOR_MASK ; select color |
| 1446 | |
| 1447 ; current depth | |
| 623 | 1448 WIN_TINY dm_mask_depth_column,dm_mask_depth_row ; position for "Depth" |
| 1449 btfss alt_layout_active ; alternative layout active? | |
| 1450 bra TFT_divemode_mask_depth_text ; NO | |
| 634 | 1451 btfsc cur_depth_greater_100m ; YES - current depth >= 100 m? |
| 1452 bra TFT_divemode_mask_max_avg ; YES - skip depth label as it collides with depth number | |
| 1453 WIN_TINY dm_mask_depth_column_alt,dm_mask_depth_row ; NO - set alternative position for "Depth" | |
| 623 | 1454 TFT_divemode_mask_depth_text: |
| 1455 STRCAT_TEXT_PRINT tDepth ; print "Depth" | |
| 1456 | |
| 634 | 1457 TFT_divemode_mask_max_avg: |
| 623 | 1458 ; avg or max depth |
| 1459 btfsc alt_layout_active ; alternative layout active? | |
| 1460 bra TFT_divemode_mask_avg_max_alt ; YES | |
| 1461 | |
| 1462 WIN_TINY dm_mask_maxdepth_col_nvsi,dm_mask_maxdepth_row ; default position for "max.Depth"/"avg.Depth" | |
| 1463 TSTOSS opt_vsigraph ; graphical VSI bar enabled? | |
| 1464 bra TFT_divemode_mask_max_avg_pos ; NO - keep position | |
| 1465 WIN_TINY dm_mask_maxdepth_col,dm_mask_maxdepth_row ; YES - adopt position | |
| 1466 TFT_divemode_mask_max_avg_pos: | |
| 1467 btfsc FLAG_apnoe_mode ; in apnea mode? | |
| 1468 bra TFT_divemode_mask_max_text ; YES - always draw max depth | |
| 1469 TSTOSS opt_2ndDepthDisp ; NO - shall draw avg depth instead of max depth? | |
| 1470 bra TFT_divemode_mask_max_text ; NO - print "max.Depth" | |
| 1471 STRCAT_TEXT_PRINT tAvgDepth ; YES - print "avg.Depth" | |
| 1472 bra TFT_divemode_mask_time_pos ; - continue with dive time | |
| 1473 TFT_divemode_mask_max_text: | |
| 1474 STRCAT_TEXT_PRINT tMaxDepth ; print "max.Depth" | |
| 1475 bra TFT_divemode_mask_time_pos ; continue with dive time | |
| 1476 TFT_divemode_mask_avg_max_alt: | |
| 1477 btfss FLAG_gauge_mode ; in gauge mode? | |
| 1478 bra TFT_divemode_mask_time_pos ; NO - continue with dive time | |
| 1479 WIN_TINY dm_gauge_max_depth_text_col,dm_gauge_max_depth_text_row ; YES - set position | |
| 1480 STRCAT_TEXT_PRINT tMaxDepth ; - print "max.Depth" | |
| 1481 WIN_TINY dm_gauge_avg_depth_text_col,dm_gauge_avg_depth_text_row ; - set position | |
| 1482 STRCAT_TEXT_PRINT tDiveTotalAvg ; - print "Total Avg" | |
| 1483 ;bra TFT_divemode_mask_time_pos ; - continue with dive time | |
| 1484 | |
| 1485 ; dive time | |
| 1486 TFT_divemode_mask_time_pos: | |
| 1487 WIN_TINY dm_mask_divetime_column,dm_mask_divetime_row ; position for "Divetime" | |
| 1488 TFT_divemode_mask_time_text: | |
| 1489 STRCAT_TEXT_PRINT tDivetime ; print "Divetime" | |
| 1490 btfss FLAG_apnoe_mode ; in apnea mode? | |
| 634 | 1491 return ; NO - done |
| 623 | 1492 WIN_TINY dm_total_apnoe_text_col,dm_total_apnoe_text_row; YES - set position |
| 1493 STRCPY_TEXT_PRINT tApnoeTotal ; - print "Total" | |
| 634 | 1494 return ; - done |
| 1495 | |
| 1496 | |
| 1497 ;----------------------------------------------------------------------------- | |
| 1498 ; Dive Mode - NDL Layout Add-on | |
| 1499 ; | |
| 623 | 1500 global TFT_show_ndl_mask |
| 1501 TFT_show_ndl_mask: | |
| 1502 btfsc dive_main_menu ; is the dive mode menu shown? | |
| 1503 return ; YES - abort | |
| 634 | 1504 FONT_COLOR_MASK ; NO - set color |
| 623 | 1505 ; - set position |
| 582 | 1506 WIN_STD dm_ndl_text_column, dm_ndl_text_row |
| 623 | 1507 STRCPY_TEXT_PRINT tNDL ; - print "NDL" |
| 628 | 1508 btfss deco_region ; - was the dive within deco stops region? |
| 634 | 1509 return ; NO - done |
| 628 | 1510 btfsc safety_stop_active ; YES - safety stop shown? |
| 634 | 1511 return ; YES - done |
| 654 | 1512 btfsc alt_layout_active ; In alternative layout? |
| 1513 return ; YES - DONE. | |
| 634 | 1514 goto TFT_show_slow_reminder ; NO - show "slow" reminder |
| 1515 | |
| 1516 | |
| 1517 ;----------------------------------------------------------------------------- | |
| 1518 ; Dive Mode - Deco Layout Add-on | |
| 1519 ; | |
| 623 | 1520 global TFT_show_deco_mask |
| 1521 TFT_show_deco_mask: | |
| 1522 bcf safety_stop_active ; flag safety stop is not shown any more TODO: needed? | |
| 1523 btfsc dive_main_menu ; is the dive mode menu shown? | |
| 1524 return ; YES - abort | |
| 1525 btfsc alt_layout_active ; NO - in alternative layout? | |
| 1526 bra TFT_show_deco_mask_alt ; YES | |
| 1527 ;bra TFT_show_deco_mask_norm ; NO | |
| 1528 | |
| 1529 TFT_show_deco_mask_norm: | |
| 634 | 1530 WIN_STD dm_tts_text_col_norm, dm_tts_text_row_norm |
| 1531 bra TFT_show_deco_mask_common ; continue with common part | |
| 623 | 1532 |
| 1533 TFT_show_deco_mask_alt: | |
| 634 | 1534 WIN_TINY dm_tts_text_col_alt, dm_tts_text_row_alt |
| 1535 STRCPY "Stop/" ; print "Stop/" | |
| 1536 ;bra TFT_show_deco_mask_common ; continue with common part | |
| 623 | 1537 |
| 1538 TFT_show_deco_mask_common: | |
| 634 | 1539 FONT_COLOR_MASK ; set color |
| 623 | 1540 STRCAT_TEXT_PRINT tTTS ; print "TTS" |
| 1541 return ; done | |
| 1542 | |
| 1543 | |
| 0 | 1544 ;============================================================================= |
| 634 | 1545 tft_out6 CODE |
| 623 | 1546 ;============================================================================= |
| 1547 | |
| 634 | 1548 |
| 1549 ;----------------------------------------------------------------------------- | |
| 1550 ; Dive Mode - show Dive Time | |
| 631 | 1551 ; |
| 623 | 1552 global TFT_show_divetime |
| 1553 TFT_show_divetime: | |
| 634 | 1554 FONT_COLOR_MEMO ; set color |
| 623 | 1555 SMOVTT counted_divetime_mins,mpr ; ISR-safe 3 byte copy of minutes:2 (mpr+1:mpr+0) and seconds (mpr+2) |
| 1556 btfsc show_only_divemins ; shall suppress display of seconds? | |
| 1557 bra TFT_show_divetime_min_only ; YES - show minutes only | |
| 1558 movlw .99 ; NO - load 99 | |
| 1559 cpfsgt mpr+0 ; - dive time > 99 minutes ? | |
| 1560 bra TFT_show_divetime_min_sec ; NO - show min:sec | |
| 1561 bsf show_only_divemins ; YES - set flag to suppress the display of seconds for the rest of the dive | |
| 1562 btfsc alt_layout_active ; - in alternative layout? | |
| 1563 bra TFT_show_divetime_clear_alt ; YES - clear min:sec area of alternative layout | |
| 1564 ;bra TFT_show_divetime_clear_norm ; NO - clear min:sec area of normal layout | |
| 1565 | |
| 1566 TFT_show_divetime_clear_norm: | |
| 1567 WIN_BOX_BLACK dm_divetime_row, dm_divetime_bot_medium, dm_divetime_col_medium, dm_divetime_rgt ;top, bottom, left, right | |
| 1568 bra TFT_show_divetime_min_only_norm ; show minutes only | |
| 1569 | |
| 1570 TFT_show_divetime_clear_alt: | |
| 1571 WIN_BOX_BLACK dm_divetime_row, dm_divetime_bot_large, dm_divetime_col_large, dm_divetime_rgt ;top, bottom, left, right | |
| 1572 bra TFT_show_divetime_min_only_alt ; show minutes only | |
| 1573 | |
| 1574 TFT_show_divetime_min_sec: | |
| 1575 ; show the minutes | |
| 1576 btfsc alt_layout_active ; in alternative layout? | |
| 1577 bra TFT_show_divetime_min_alt ; YES | |
| 1578 ;bra TFT_show_divetime_min_norm ; NO | |
| 1579 | |
| 1580 TFT_show_divetime_min_norm: | |
| 1581 WIN_MEDIUM dm_divetime_col_medium, dm_divetime_row | |
| 1582 bra TFT_show_divetime_min_com ; continue with common part | |
| 1583 | |
| 1584 TFT_show_divetime_min_alt: | |
| 1585 WIN_LARGE dm_divetime_col_large, dm_divetime_row | |
| 1586 ;bra TFT_show_divetime_min_com ; continue with common part | |
| 1587 | |
| 1588 TFT_show_divetime_min_com: | |
| 634 | 1589 output_99 ; print minutes (0-99) |
| 1590 PRINT ; dump buffer to screen | |
| 623 | 1591 |
| 1592 ; show the seconds | |
| 1593 btfsc alt_layout_active ; in alternative layout? | |
| 1594 bra TFT_show_divetime_sec_alt ; YES | |
| 1595 ;bra TFT_show_divetime_sec_norm ; NO | |
| 1596 | |
| 1597 TFT_show_divetime_sec_norm: | |
| 1598 WIN_SMALL dm_divetime_sec_col_small, dm_divetime_sec_row_small | |
| 1599 bra TFT_show_divetime_sec_com ; continue with common part | |
| 1600 | |
| 1601 TFT_show_divetime_sec_alt: | |
| 1602 WIN_MEDIUM dm_divetime_sec_col_medium, dm_divetime_sec_row_medium | |
| 1603 ;bra TFT_show_divetime_sec_com ; continue with common part | |
| 1604 | |
| 1605 TFT_show_divetime_sec_com: | |
| 1606 PUTC ':' ; print separator char | |
| 634 | 1607 movff mpr+2,lo ; copy seconds to lo |
| 1608 output_99x ; print seconds (00-99) | |
| 623 | 1609 bra TFT_divemins_exit ; continue with common part |
| 1610 | |
| 1611 TFT_show_divetime_min_only: | |
| 1612 btfsc alt_layout_active ; in alternative layout? | |
| 1613 bra TFT_show_divetime_min_only_alt ; YES | |
| 1614 ;bra TFT_show_divetime_min_only_norm ; NO | |
| 1615 | |
| 1616 TFT_show_divetime_min_only_norm: | |
| 1617 WIN_MEDIUM dm_divetime_minonly_col_medium, dm_divetime_row | |
| 634 | 1618 output_9999 ; print minutes (0-9999) |
| 623 | 1619 bra TFT_divemins_exit ; continue with common part |
| 1620 | |
| 1621 TFT_show_divetime_min_only_alt: | |
| 1622 WIN_LARGE dm_divetime_minonly_col_large, dm_divetime_row | |
| 634 | 1623 output_999 ; print minutes (0-999) |
| 623 | 1624 ;bra TFT_divemins_exit ; continue with common part |
| 1625 | |
| 604 | 1626 TFT_divemins_exit: |
| 634 | 1627 PRINT ; dump buffer to screen |
| 1628 return ; done | |
| 1629 | |
| 1630 | |
| 1631 ;----------------------------------------------------------------------------- | |
| 1632 ; Dive Mode - show current Depth | |
| 1633 ; | |
| 1634 global TFT_show_depth | |
| 1635 TFT_show_depth: | |
| 1636 MOVII pressure_rel_cur_cached,mpr ; copy relative pressure to MPR | |
| 1637 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
| 1638 call TFT_color_code_depth ; set warning / attention flags and color-code the output | |
| 1639 rcall TFT_depth_blink ; control animation (blinking) | |
| 1640 | |
| 1641 rcall TFT_depth_position_m_ft ; set output position for full meters/feet | |
| 1642 TSTOSS opt_units ; 0=m, 1=ft ? | |
| 1643 bra TFT_depth_metric ; 0 - metric | |
| 1644 ;bra TFT_depth_imperial ; 1 - imperial | |
| 1645 | |
| 1646 TFT_depth_imperial: | |
| 1647 MOVLI .30,sub_a ; load depth threshold of 30 cm (for showing 0 if shallower) | |
| 1648 MOVII mpr,sub_b ; get current depth | |
| 1649 call cmpU16 ; compute sub_a - sub_b = threshold - current depth | |
| 1650 btfss neg_flag ; shallower than 30 cm ? | |
| 1651 bra depth_0_feet ; YES - print a zero directly | |
| 1652 call convert_cm_to_feet ; NO - convert value in hi:lo from [cm] to [feet] | |
| 1653 output_999 ; - feet in large or huge font | |
| 1654 PRINT ; - dump to screen | |
| 1655 bra TFT_depth_exit ; - do some cleanup and show target depth if in simulator mode | |
| 1656 | |
| 1657 depth_0_feet: | |
| 1658 STRCAT_PRINT " 0" ; print a zero directly | |
| 1659 bra TFT_depth_exit ; do some cleanup and show target depth if in simulator mode | |
| 1660 | |
| 1661 TFT_depth_metric: | |
| 1662 bsf omit_digit_2 ; print depth in full meters, i.e. do not print 2nd and 1st digit | |
| 1663 output_9999 ; test-print depth for range up to 99.9 meter (0xx-99xx) | |
| 1664 btfsc output_overflow ; did the printing clip, i.e. deeper than 99.9 meter? | |
| 1665 bra TFT_depth_metric_100m ; YES - print depth in full meters only | |
| 1666 | |
| 1667 ; depth in meters and decimeters | |
| 1668 btfsc cur_depth_greater_100m ; was the depth >= 100 meter during last call? | |
| 1669 rcall TFT_depth_box_black ; YES - clear depth area | |
| 643 | 1670 |
| 1671 btfsc cur_depth_greater_100m ; was the depth >= 100 meter during last call? | |
| 1672 rcall TFT_depth_position_m_ft ; re-set output position for full meters/feet | |
| 1673 | |
| 634 | 1674 bcf cur_depth_greater_100m ; current depth is now < 100 meter |
| 1675 PRINT ; dump full meters to screen | |
| 1676 | |
| 1677 btfsc depth_inverse_last ; in inverse printing cycle? | |
| 1678 bsf win_invert ; YES - print inverse | |
| 1679 rcall TFT_depth_position_dm ; set output position for decimeters | |
| 1680 MOVLI .30,sub_a ; 30 mbar = 0.3 meter | |
| 1681 MOVII mpr,sub_b ; current depth | |
| 1682 call cmpU16 ; compare (sub_a - sub_b) | |
| 1683 btfss neg_flag ; current depth < 0.3 meter ? | |
| 1684 bra depth_0_decimeter ; YES - print a zero | |
| 1685 output_65535 ; NO - print full depth to buffer | |
| 1686 REINIT_BUFFER ; - re-initialize the output buffer | |
| 1687 PUTC "." ; - print a decimal point | |
| 1688 movff buffer+3,POSTINC2 ; - get and print the decimeters | |
| 1689 PRINT ; - dump to screen | |
| 1690 bra TFT_depth_exit ; - do some cleanup and show target depth if in simulator mode | |
| 1691 depth_0_decimeter: | |
| 1692 STRCAT_PRINT ".0" ; print a zero directly and dump buffer to screen | |
| 1693 bra TFT_depth_exit ; do some cleanup and show target depth if in simulator mode | |
| 1694 | |
| 1695 TFT_depth_metric_100m: | |
| 1696 ; full meters only | |
| 1697 btfss cur_depth_greater_100m ; was the depth >= 100 meter during last call? | |
| 1698 rcall TFT_depth_box_black ; NO - clear depth area | |
| 643 | 1699 |
| 1700 btfss cur_depth_greater_100m ; was the depth >= 100 meter during last call? | |
| 1701 rcall TFT_depth_position_m_ft ; re-set output position for full meters/feet | |
| 1702 | |
| 634 | 1703 bsf cur_depth_greater_100m ; depth is >= 100 meter now |
| 1704 REINIT_BUFFER ; re-initialize the output buffer | |
| 1705 bsf omit_digit_2 ; print depth in full meters, i.e. do not print 1st and 2nd digit | |
| 1706 output_65535 ; print depth for range >= 100 meter (0xx-655xx) | |
| 1707 PRINT ; dump to screen | |
| 1708 ;bra TFT_depth_exit ; do some cleanup and show target depth if in simulator mode | |
| 1709 | |
| 1710 TFT_depth_exit: | |
| 1711 btfss alt_layout_active ; alternative layout active? | |
| 1712 bra TFT_depth_exit_2 ; NO | |
| 1713 btfsc depth_inverse_last ; YES - was last output in inverse mode? | |
| 1714 bra TFT_depth_exit_2 ; YES - do not restore "Depth" as it collides with depth number | |
| 1715 btfsc cur_depth_greater_100m ; NO - current depth >= 100 m? | |
| 1716 bra TFT_depth_exit_2 ; YES | |
| 1717 ;bra TFT_depth_exit_1 ; NO | |
| 1718 | |
| 656 | 1719 TFT_depth_exit_1: |
| 634 | 1720 WIN_TINY dm_mask_depth_column_alt,dm_mask_depth_row |
| 1721 FONT_COLOR_MASK ; set color | |
| 1722 STRCAT_TEXT_PRINT tDepth ; restore "Depth" title | |
| 1723 | |
| 1724 TFT_depth_exit_2: | |
| 1725 btfss sensor_override_active ; pressure sensor override active (simulator mode)? | |
| 1726 return ; NO - done | |
| 1727 bra TFT_depth_target ; YES - show simulator target depth | |
| 1728 | |
| 1729 | |
| 1730 ; Helper Function - control animation (blinking) | |
| 1731 TFT_depth_blink: | |
| 1732 TSTOSS opt_depth_warn ; 0=standard, 1=blink | |
| 1733 return ; standard, done | |
| 1734 btfsc depth_color_last ; was there a warning or attention on the depth in the previous cycle? | |
| 1735 bra TFT_depth_blink_prev ; YES | |
| 1736 btfsc depth_color_warning ; NO - do we have a depth warning now? | |
| 1737 bra TFT_depth_blink_new ; YES - so we have a warning now but not previously | |
| 1738 btfsc depth_color_attention ; NO - do we have a depth attention now? | |
| 1739 bra TFT_depth_blink_new ; YES - so we have attention now but not previously | |
| 1740 bra TFT_depth_blink_none ; NO - no warning in previous cycle, no warning now, reset all flags | |
| 1741 | |
| 1742 TFT_depth_blink_prev: | |
| 1743 ; we had a warning or attention in previous cycle, check if we still have a warning or attention | |
| 1744 btfsc depth_color_warning ; do we still have a warning? | |
| 1745 bra TFT_depth_blink_prev_1 ; YES | |
| 1746 btfsc depth_color_attention ; NO - do we still have an attention? | |
| 1747 bra TFT_depth_blink_prev_1 ; YES | |
| 1748 ; we had a warning or attention before, but not now any more - clear depth area from previous color | |
| 1749 rcall TFT_depth_box_black ; NO - clear depth area | |
| 1750 ;bra TFT_depth_blink_none ; - reset all flags | |
| 1751 | |
| 1752 TFT_depth_blink_none: | |
| 1753 bcf depth_inverse_last ; memorize depth was printed in normal | |
| 1754 bcf depth_color_last ; memorize there was no warning or attention | |
| 1755 FONT_COLOR_MEMO ; select memo color | |
| 1756 return ; done | |
| 1757 | |
| 1758 TFT_depth_blink_prev_1: | |
| 1759 ; we had a warning or attention in previous cycle, and we still have a warning or attention | |
| 1760 btfss depth_inverse_last ; was the depth printed in inverse last time? | |
| 1761 bra TFT_depth_blink_set ; NO - print in inverse now | |
| 1762 bra TFT_depth_blink_reset ; YES - print in normal now | |
| 1763 | |
| 1764 TFT_depth_blink_new: | |
| 1765 ; we had no warning or attention in previous cycle, but now | |
| 1766 bsf depth_color_last ; memorize that the depth had a warning or attention | |
| 1767 ;bra TFT_depth_blink_set ; start with inverse display | |
| 1768 | |
| 1769 TFT_depth_blink_set: | |
| 1770 ; fill the area with respective color | |
| 1771 movf pallet_color_attention,W ; select attention color as default | |
| 1772 btfsc depth_color_warning ; do we have a warning? | |
| 1773 movf pallet_color_warning,W ; YES - replace with warning color | |
| 1774 rcall TFT_depth_box_color ; color depth area with color in WREG | |
| 1775 bsf win_invert ; print in inverse | |
| 1776 bsf depth_inverse_last ; memorize depth was printed in inverse | |
| 1777 return ; done | |
| 1778 | |
| 1779 TFT_depth_blink_reset: | |
| 1780 ; fill the area with black color | |
| 1781 rcall TFT_depth_box_black ; clear depth area | |
| 1782 bcf depth_inverse_last ; memorize depth was printed in normal | |
| 1783 return ; done | |
| 1784 | |
| 1785 | |
| 1786 ; Helper Function - set output position for full meters/feet | |
| 1787 TFT_depth_position_m_ft: ; output position meters / feet | |
| 1788 btfsc alt_layout_active ; alternative layout active? | |
| 1789 bra TFT_depth_position_m_ft_alt ; YES | |
| 1790 ;bra TFT_depth_position_m_ft_norm; NO | |
| 1791 | |
| 1792 TFT_depth_position_m_ft_norm: | |
| 1793 WIN_LARGE dm_depth_col_large,dm_depth_row_large | |
| 1794 return ; done | |
| 1795 | |
| 1796 TFT_depth_position_m_ft_alt: | |
| 1797 WIN_HUGE dm_depth_col_huge, dm_depth_row_huge | |
| 1798 return ; done | |
| 1799 | |
| 1800 | |
| 1801 ; Helper Function - set output position for decimeters | |
| 1802 TFT_depth_position_dm: ; output position decimeters | |
| 1803 btfsc alt_layout_active ; alternative layout active? | |
| 1804 bra TFT_depth_position_dm_alt ; YES | |
| 1805 bra TFT_depth_position_dm_norm ; NO | |
| 1806 | |
| 1807 TFT_depth_position_dm_norm: | |
| 1808 WIN_MEDIUM dm_depth_dm_col_medium, dm_depth_dm_row_medium | |
| 1809 return ; done | |
| 1810 TFT_depth_position_dm_alt: | |
| 1811 WIN_LARGE dm_depth_dm_col_large, dm_depth_dm_row_large | |
| 1812 return ; done | |
| 1813 | |
| 1814 | |
| 1815 ; Helper Function - clear depth area | |
| 1816 TFT_depth_box_black: | |
| 1817 clrf WREG ; select black color | |
| 1818 ;bra TFT_depth_box_color ; continue with colored box | |
| 1819 | |
| 1820 | |
| 1821 ; Helper Function - color depth area with color in WREG | |
| 1822 TFT_depth_box_color: | |
| 1823 btfsc alt_layout_active ; alternative layout active? | |
| 1824 bra TFT_depth_box_alt ; YES | |
| 1825 ;bra TFT_depth_box_norm ; NO | |
| 1826 | |
| 1827 TFT_depth_box_norm: | |
| 1828 WIN_BOX_COLOR dm_depth_row_large,dm_depth_bot_large,dm_depth_col_large,dm_depth_rgt_large | |
| 1829 return ; done | |
| 1830 | |
| 1831 TFT_depth_box_alt: | |
| 1832 WIN_BOX_COLOR dm_mask_depth_row, dm_depth_bot_huge, dm_depth_col_huge, dm_depth_rgt_huge | |
| 1833 TFT_depth_box_exit: | |
| 1834 return ; done | |
| 1835 | |
| 1836 | |
| 1837 ; Helper Function - show simulated target depth | |
| 1838 TFT_depth_target: | |
| 1839 FONT_COLOR_ATTENTION ; select attention color | |
| 1840 movff simulatormode_depth,lo ; copy target depth to lo | |
| 1841 TSTOSS opt_units ; check unit selection (0=m or 1=ft) | |
| 1842 bra TFT_depth_target_metric ; 0 - metric | |
| 1843 ;bra TFT_depth_target_imperial ; 1 - imperial | |
| 1844 | |
| 1845 TFT_depth_target_imperial: | |
| 1846 btfsc alt_layout_active ; alternative layout active? | |
| 1847 bra TFT_depth_target_imperial_alt ; YES | |
| 1848 ;bra TFT_depth_target_imperial_norm ; NO | |
| 1849 | |
| 1850 TFT_depth_target_imperial_norm: | |
| 1851 WIN_TINY dm_mask_depth_column+.40,dm_mask_depth_row ; position right of depth label | |
| 1852 bra TFT_depth_target_imperial_com ; continue with common part | |
| 1853 | |
| 1854 TFT_depth_target_imperial_alt: | |
| 1855 WIN_TINY dm_mask_depth_column+.62,dm_mask_depth_row+.20 ; position within last digit | |
| 1856 ;bra TFT_depth_target_imperial_com ; continue with common part | |
| 1857 | |
| 1858 TFT_depth_target_imperial_com: | |
| 1859 call convert_meter_to_feet ; convert value in lo from meters to feet | |
| 1860 output_999 ; display only last three digits from a 16 bit value (0-999) | |
| 1861 STRCAT_PRINT "ft" ; append unit and dump buffer to screen | |
| 1862 return ; done | |
| 1863 | |
| 1864 TFT_depth_target_metric: | |
| 1865 btfsc alt_layout_active ; alternative layout active? | |
| 1866 bra TFT_depth_target_metric_alt ; YES | |
| 1867 ;bra TFT_depth_target_metric_norm ; NO | |
| 1868 | |
| 1869 TFT_depth_target_metric_norm: | |
| 1870 WIN_TINY dm_mask_depth_column+.38,dm_mask_depth_row+.22 ; position right of full meters, above decimal | |
| 1871 bra TFT_depth_target_metric_com ; continue with common part | |
| 1872 | |
| 1873 TFT_depth_target_metric_alt: | |
| 1874 WIN_TINY dm_mask_depth_column+.65,dm_mask_depth_row+.20 ; position right of full meters, above decimal | |
| 1875 ;bra TFT_depth_target_metric_com ; continue with common part | |
| 1876 | |
| 1877 TFT_depth_target_metric_com: | |
| 1878 output_256 ; display target depth (0-255) | |
| 1879 PUTC_PRINT "m" ; append unit and dump to screen | |
| 1880 return ; done | |
| 623 | 1881 |
| 1882 | |
| 1883 ;----------------------------------------------------------------------------- | |
| 634 | 1884 ; Dive Mode - show maximum Depth |
| 623 | 1885 ; |
| 634 | 1886 global TFT_show_max_depth |
| 1887 TFT_show_max_depth: | |
| 1888 FONT_COLOR_MEMO ; select color | |
| 1889 btfsc alt_layout_active ; alternative layout active? | |
| 1890 bra TFT_show_max_depth_alt ; YES | |
| 1891 ;bra TFT_show_max_depth_norm ; NO | |
| 1892 | |
| 1893 TFT_show_max_depth_norm: | |
| 1894 WIN_MEDIUM dm_max_depth_column_nvsi, dm_max_depth_row | |
| 1895 TSTOSS opt_vsigraph ; graphical VSI bar enabled? | |
| 1896 bra TFT_show_max_depth_norm_1 ; NO - keep position | |
| 1897 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row ; YES - adopt output position | |
| 1898 | |
| 1899 TFT_show_max_depth_norm_1: | |
| 1900 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
| 1901 bra TFT_max_depth_apnoe ; YES - different handling in apnoe mode | |
| 1902 TSTOSS opt_2ndDepthDisp ; NO - show average depth instead of max depth? | |
| 1903 bra TFT_max_depth_current ; NO - show max depth | |
| 1904 bra TFT_avg_depth_current ; YES - show avg depth | |
| 1905 | |
| 1906 TFT_max_depth_apnoe: | |
| 1907 btfss apnoe_at_surface ; apnoe mode, at the surface? | |
| 1908 bra TFT_max_depth_current ; NO - show max depth of current dive | |
| 1909 MOVII apnoe_max_pressure,mpr ; YES - get max pressure of all dives so far | |
| 1910 bra TFT_max_depth_common ; - continue with common part | |
| 1911 | |
| 1912 TFT_max_depth_current: | |
| 1913 MOVII pressure_rel_max_cached,mpr ; get the "normal" max pressure | |
| 1914 bra TFT_max_depth_common ; continue with common part | |
| 1915 | |
| 1916 TFT_avg_depth_current: | |
| 1917 MOVII pressure_rel_avg_total,mpr ; get total dive average pressure | |
| 1918 ;bra TFT_max_depth_common ; continue with common part | |
| 1919 | |
| 1920 TFT_max_depth_common: | |
| 1921 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
| 1922 TSTOSS opt_units ; 0=m or 1=ft ? | |
| 1923 bra TFT_max_depth_metric ; 0 - use metric version | |
| 1924 ;bra TFT_max_depth_imperial ; 1 - use imperial version | |
| 1925 | |
| 1926 TFT_max_depth_imperial: | |
| 1927 bra TFT_show_depth_helper_imperial | |
| 1928 | |
| 1929 TFT_max_depth_metric: | |
| 1930 bsf omit_digit_2 ; print depth in full meters, i.e. do not print 2nd and 1st digit | |
| 1931 output_9999 ; test-print depth for range up to 99.9 meter (0xx-99xx) | |
| 1932 btfsc output_overflow ; did the printing clip, i.e. deeper than 99.9 meter? | |
| 1933 bra TFT_max_depth_metric_100m ; YES - print depth in full meters only | |
| 1934 ;bra TFT_max_depth_metric_99m ; NO - print depth in meters and decimeters | |
| 1935 | |
| 1936 TFT_max_depth_metric_99m: | |
| 1937 ; full meters | |
| 1938 btfsc max_depth_greater_100m ; was the depth >= 100 meter during last call? | |
| 1939 rcall TFT_max_depth_box_black ; NO - clear max depth area | |
| 1940 bcf max_depth_greater_100m ; current depth is now < 100 meter | |
| 1941 PRINT ; dump full meters to screen | |
| 1942 ; decimeters | |
| 1943 rcall TFT_max_depth_metric_dm ; set output position for decimeters | |
| 1944 output_65535 ; print full depth to buffer | |
| 1945 REINIT_BUFFER ; re-initialize the output buffer | |
| 1946 PUTC "." ; print a decimal point | |
| 1947 movff buffer+3,POSTINC2 ; get and print the decimeters | |
| 1948 PRINT ; dump to screen | |
| 1949 return ; done | |
| 1950 | |
| 1951 TFT_max_depth_metric_100m: | |
| 1952 ; full meters only | |
| 1953 btfss max_depth_greater_100m ; was the depth >= 100 meter during last call? | |
| 1954 rcall TFT_max_depth_box_black ; NO - clear max depth area | |
| 1955 bsf max_depth_greater_100m ; depth is >= 100 meter now | |
| 1956 REINIT_BUFFER ; re-initialize the output buffer | |
| 1957 bsf omit_digit_2 ; print depth in full meters, i.e. do not print 1st and 2nd digit | |
| 1958 output_65535 ; print depth for range >= 100 meter (0xx-655xx) | |
| 1959 PRINT ; dump to screen | |
| 1960 return ; done | |
| 1961 | |
| 1962 TFT_show_max_depth_alt: | |
| 1963 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
| 1964 bra TFT_show_apnoe_max_depth ; YES - use apnoe surface output also in alternative dive mode screen | |
| 1965 btfss FLAG_gauge_mode ; NO - in gauge mode? | |
| 1966 return ; NO - done | |
| 1967 ;bra TFT_show_gauge_max_avg_depth; YES | |
| 1968 | |
| 1969 TFT_show_gauge_max_avg_depth: | |
| 1970 WIN_MEDIUM dm_gauge_max_depth_col, dm_gauge_max_depth_row ; set position for max depth | |
| 1971 MOVII pressure_rel_max_cached,mpr ; get max pressure into hi:lo | |
| 1972 rcall TFT_show_depth_helper ; print max depth | |
| 1973 WIN_MEDIUM dm_gauge_avg_depth_col, dm_gauge_avg_depth_row ; set position for avg depth | |
| 1974 MOVII pressure_rel_avg_total,mpr ; get average pressure into hi:lo | |
| 1975 bra TFT_show_depth_helper ; print avg depth and return | |
| 1976 | |
| 1977 | |
| 1978 ; Helper Function - clear max depth area | |
| 1979 TFT_max_depth_box_black: | |
| 1980 WIN_BOX_BLACK dm_max_depth_row, dm_max_depth_bot, dm_max_depth_column, dm_max_depth_rgt | |
| 631 | 1981 return ; done |
| 1982 | |
| 634 | 1983 |
| 1984 ; Helper Function - set output position for decimeters | |
| 1985 TFT_max_depth_metric_dm: | |
| 1986 WIN_SMALL dm_max_depth_dm_column_nvsi, dm_max_depth_dm_row ; default position | |
| 1987 TSTOSS opt_vsigraph ; graphical VSI bar enabled? | |
| 1988 return ; NO - keep position | |
| 1989 WIN_SMALL dm_max_depth_dm_column, dm_max_depth_dm_row ; YES - adopt position | |
| 1990 return ; done | |
| 1991 | |
| 1992 | |
| 1993 ; Helper Function - print depth in mpr | |
| 1994 TFT_show_depth_helper: | |
| 1995 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
| 1996 TSTOSS opt_units ; 0=m, 1=ft | |
| 1997 bra TFT_show_depth_helper_metric ; 0 - metric | |
| 1998 ;bra TFT_show_depth_helper_imperial ; 1 - imperial | |
| 1999 | |
| 2000 TFT_show_depth_helper_imperial: | |
| 2001 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] | |
| 2002 output_999 ; print depth (0-999) | |
| 2003 PRINT ; dump to screen | |
| 631 | 2004 return ; done |
| 604 | 2005 |
| 634 | 2006 TFT_show_depth_helper_metric: |
| 2007 bsf omit_digit_1 ; do not print 1st digit | |
| 2008 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 2009 output_65535 ; print depth (0.0x-655.3x) | |
| 2010 PRINT ; dump to screen | |
| 2011 return ; done | |
| 0 | 2012 |
| 628 | 2013 |
| 623 | 2014 ;----------------------------------------------------------------------------- |
| 634 | 2015 ; Dive Mode - show maximum Depth - Apnoe Mode |
| 2016 ; | |
| 2017 global TFT_show_apnoe_max_depth | |
| 2018 TFT_show_apnoe_max_depth: | |
| 2019 ; title | |
| 2020 WIN_TINY dm_apnoe_last_max_depth_text_col, dm_apnoe_last_max_depth_text_row | |
| 2021 FONT_COLOR_MASK ; set color | |
| 2022 btfsc alt_layout_active ; alternative layout active? | |
| 2023 bra TFT_show_apnoe_max_depth_alt ; YES | |
| 2024 ;bra TFT_show_apnoe_max_depth_norm ; NO | |
| 2025 | |
| 2026 TFT_show_apnoe_max_depth_norm: | |
| 2027 STRCPY_TEXT_PRINT tApnoeMax ; print "Last Descent" | |
| 2028 bra TFT_show_apnoe_max_depth_com ; continue with common part | |
| 2029 | |
| 2030 TFT_show_apnoe_max_depth_alt: | |
| 2031 STRCPY_TEXT_PRINT tMaxDepth ; print "Max.Depth" | |
| 2032 ;bra TFT_show_apnoe_max_depth_com ; continue with common part | |
| 2033 | |
| 2034 TFT_show_apnoe_max_depth_com: | |
| 2035 ; value | |
| 2036 WIN_MEDIUM dm_apnoe_last_max_depth_column, dm_apnoe_last_max_depth_row | |
| 2037 FONT_COLOR_MEMO ; select color | |
| 2038 MOVII pressure_rel_max_cached,mpr ; get max pressure into hi:lo | |
| 2039 bra TFT_show_depth_helper ; print max depth and return | |
| 2040 | |
| 2041 | |
| 2042 ;----------------------------------------------------------------------------- | |
| 2043 ; Dive Mode - show Temperature | |
| 2044 ; | |
| 2045 global TFT_show_temp_divemode | |
| 2046 TFT_show_temp_divemode: | |
| 2047 btfsc dive_pre_menu ; is the pre-menu shown? | |
| 2048 return ; YES - abort | |
| 2049 btfsc dive_main_menu ; is the dive mode menu shown? | |
| 2050 return ; YES - abort, no update of temperature now | |
| 2051 btfsc better_gas_blinking ; blinking better gas? | |
| 2052 return ; YES - abort, no update of temperature now | |
| 2053 btfsc better_dil_blinking ; blinking better diluent? | |
| 2054 return ; YES - abort, no update of temperature now | |
| 2055 | |
| 2056 WIN_SMALL dm_temp_column,dm_temp_row; set position | |
| 2057 FONT_COLOR_MEMO ; set color | |
| 656 | 2058 goto TFT_temp_common ; continue with common part for temperature |
| 2059 | |
| 2060 global TFT_dive_compass_extras | |
| 2061 TFT_dive_compass_extras: ; Update Stopwatch display in compass mode | |
| 2062 WIN_SMALL dm_compass_stopwatch_column,dm_compass_stopwatch_row ; set position | |
| 2063 FONT_COLOR_MEMO ; set color | |
| 2064 MOVII divesecs_compass_trip,mpr ; get the compass stopwatch | |
| 2065 goto update_stopwatch_common ; YES - show resettable dive time instead of temperature (And return) | |
| 2066 | |
| 631 | 2067 |
| 2068 ;----------------------------------------------------------------------------- | |
| 634 | 2069 ; Dive Mode - active Gas and Setpoint |
| 2070 ; | |
| 2071 global TFT_show_active_gas_divemode | |
| 2072 TFT_show_active_gas_divemode: | |
| 2073 btfsc dive_main_menu ; is the dive mode menu shown? | |
| 2074 return ; YES - abort | |
| 2075 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
| 2076 return ; YES - done | |
| 2077 btfsc FLAG_gauge_mode ; in gauge mode? | |
| 2078 return ; YES - done | |
| 2079 | |
| 2080 IFDEF _ccr_pscr | |
| 2081 | |
| 2082 btfsc FLAG_oc_mode ; in OC mode? | |
| 2083 bra TFT_active_gas ; YES - show OC gas | |
| 2084 btfss bailout_mode ; NO - in bailout? | |
| 2085 bra TFT_active_sp_loop ; NO | |
| 2086 ;bra TFT_active_sp_bailout ; YES | |
| 2087 | |
| 2088 TFT_active_sp_bailout: | |
| 2089 WIN_SMALL dm_active_dil_column, dm_active_dil_row | |
| 2090 FONT_COLOR_ATTENTION ; set color | |
| 2091 STRCPY_TEXT_PRINT tDiveBailout ; print "Bailout" | |
| 2092 bra TFT_active_gas ; continue showing OC bailout gas | |
| 2093 | |
| 2094 TFT_active_sp_loop: | |
| 2095 MOVII int_O_breathed_ppO2,mpr ; copy ppO2 [cbar] to hi:lo | |
| 2096 call TFT_color_code_ppo2 ; color-code the output by the ppO2 of the loop gas mixture | |
| 2097 btfss timebase_1sec ; on even second? | |
| 2098 bra TFT_active_sp_print ; YES - print ppO2 with normal rendering | |
| 2099 btfsc warn_det_sensors_lost ; NO - all sensors lost? | |
| 2100 bra TFT_active_sp_fallback ; YES - process fallback case | |
| 2101 movff int_O_breathed_ppO2+1,WREG ; NO - get flags again (have been cleared in hi:lo by TFT_color_code_ppo2 meanwhile) | |
| 2102 btfss WREG,int_warning_flag ; warning flag set? | |
| 2103 bra TFT_active_sp_print ; NO - ppO2 is ok, print ppO2 with normal rendering | |
| 2104 bra TFT_active_sp_invers ; YES - print with inverse rendering | |
| 2105 TFT_active_sp_fallback: ; set up fallback case | |
| 2106 FONT_COLOR_ATTENTION ; set color to attention | |
| 2107 TFT_active_sp_invers: | |
| 2108 bsf win_invert ; print in inverse | |
| 2109 TFT_active_sp_print: | |
| 2110 WIN_MEDIUM dm_active_gas_sp_value_col, dm_active_gas_sp_value_row | |
| 2111 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 2112 output_999 ; print ppO2 (0.00-9.99) | |
| 2113 PRINT ; dump to screen | |
| 2114 | |
| 2115 btfsc sign_shown ; advice/attention/warning sign shown? | |
| 2116 bra TFT_active_diluent ; YES - do not overwrite in case of alternative layout | |
| 2117 | |
| 2118 btfsc velocity_active_vsi ; graphical vertical speed indicator shown? | |
| 2119 bra TFT_active_diluent ; YES - do not overwrite in case of alternative layout | |
| 2120 | |
| 2121 TFT_active_sp_label_1: | |
| 2122 WIN_STD dm_active_sp_label_col, dm_active_sp_label_row | |
| 2123 FONT_COLOR_MEMO ; select memo color | |
| 2124 STRCAT "bar" ; print "bar" | |
| 2125 | |
| 656 | 2126 IFDEF _external_sensor_eccr |
| 634 | 2127 |
| 640 | 2128 movf dive_ccr_mode,W ; get setpoint mode =0: Fixed SP, =1: Sensor, =2: Auto SP |
| 2129 sublw .1 ; dive_ccr_mode = 1 (Sensor) ? | |
| 634 | 2130 bnz TFT_active_sp_label_2 ; NO - skip |
| 2131 btfsc alt_layout_active ; YES - in alternative layout? | |
| 2132 bra TFT_active_sp_label_2 ; YES - no space available for the "*" | |
| 2133 PUTC "*" ; NO - append "*" | |
| 2134 | |
| 2135 ENDIF | |
| 2136 | |
| 2137 TFT_active_sp_label_2: | |
| 2138 PRINT ; dump buffer to screen | |
| 2139 | |
| 2140 TFT_active_loop_mode: | |
| 2141 WIN_TINY dm_active_sp_label_col, dm_active_dil_row+.3 | |
| 2142 FONT_COLOR_MEMO ; set memo color | |
| 2143 btfsc FLAG_ccr_mode ; in CCR mode? | |
| 2144 bra TFT_active_loop_mode_ccr ; YES - print CCR label | |
| 2145 btfsc FLAG_pscr_mode ; in pSCR mode? | |
| 2146 bra TFT_active_loop_mode_pscr ; YES - print pSCR label | |
| 2147 bra TFT_active_diluent ; NO to both - should not happen | |
| 2148 | |
| 2149 TFT_active_loop_mode_ccr: | |
| 2150 STRCPY_TEXT_PRINT tDvCCR ; print "CCR" | |
| 2151 bra TFT_active_diluent ; continue with diluent | |
| 2152 | |
| 2153 TFT_active_loop_mode_pscr: | |
| 2154 STRCPY_TEXT_PRINT tDvPSCR ; print "pSCR" | |
| 2155 ;bra TFT_active_diluent ; continue with diluent | |
| 2156 | |
| 2157 TFT_active_diluent: | |
| 2158 MOVII int_O_pure_ppO2,mpr ; get ppO2 [cbar] into hi:lo | |
| 2159 call TFT_color_code_ppo2 ; color-code the output | |
| 2160 btfss better_dil_available ; better diluent available? | |
| 2161 bra TFT_active_diluent_show ; NO - print in normal rendering | |
| 2162 btg better_dil_blinking ; YES - toggle blink bit... | |
| 2163 btfss better_dil_blinking ; - blink now? | |
| 2164 bra TFT_active_diluent_show ; NO - print in normal rendering | |
| 2165 FONT_COLOR_ATTENTION ; YES - print in attention color | |
| 2166 bsf win_invert ; - print in inverse | |
| 2167 | |
| 2168 TFT_active_diluent_show: | |
| 2169 WIN_SMALL dm_active_dil_column, dm_active_dil_row | |
| 2170 bra TFT_active_dil_gas_common ; continue with common part | |
| 2171 | |
| 2172 ENDIF ; _ccr_pscr | |
| 2173 | |
| 2174 TFT_active_gas: | |
| 2175 MOVII int_O_breathed_ppO2,mpr ; copy ppO2 [cbar] into hi:lo | |
| 2176 call TFT_color_code_ppo2 ; color-code the output | |
| 2177 btfss better_gas_available ; better gas available? | |
| 2178 bra TFT_active_gas_print ; NO - print in normal rendering | |
| 2179 btg better_gas_blinking ; YES - toggle blink bit | |
| 2180 btfss better_gas_blinking ; blink now? | |
| 2181 bra TFT_active_gas_print ; NO - print in normal rendering | |
| 2182 FONT_COLOR_ATTENTION ; YES - blink in attention color | |
| 2183 bsf win_invert ; print in inverse | |
| 2184 | |
| 2185 TFT_active_gas_print: | |
| 2186 WIN_STD dm_active_gas_sp_value_col, dm_active_sp_label_row | |
| 2187 | |
| 2188 TFT_active_dil_gas_common: | |
| 2189 movff char_I_O2_ratio,lo ; lo now stores O2 in % | |
| 2190 IFDEF _helium | |
| 2191 movff char_I_He_ratio,hi ; hi now stores He in % | |
| 2192 ELSE | |
| 2193 clrf hi ; set hi to zero (no He) | |
| 2194 ENDIF | |
| 2195 call gaslist_strcat_mix ; print "Nxlo", "Txlo/hi", "Air" or "O2" | |
| 2196 PRINT ; dump to screen | |
| 631 | 2197 return ; done |
| 2198 | |
| 2199 | |
| 2200 ;----------------------------------------------------------------------------- | |
| 634 | 2201 ; Dive Mode - NDL Time |
| 2202 ; | |
| 2203 global TFT_show_ndl | |
| 2204 TFT_show_ndl: | |
| 2205 btfsc dive_main_menu ; is the dive mode menu shown? | |
| 2206 return ; YES - abort | |
| 2207 MOVII int_O_NDL_norm,mpr ; NO - get NDL time in normal plan | |
| 2208 rcall TFT_show_ndl_tts_set_color ; - set color | |
| 654 | 2209 ; btfsc deco_locked ; - was the dive in deco? |
| 2210 ; bra TFT_show_ndl_norm ; YES - use normal layout | |
| 634 | 2211 btfsc alt_layout_active ; NO - alternative layout active? |
| 2212 bra TFT_show_ndl_alt ; YES - use alternative layout | |
| 2213 ;bra TFT_show_ndl_norm ; NO - use normal layout | |
| 2214 | |
| 2215 TFT_show_ndl_norm: | |
| 2216 WIN_MEDIUM dm_ndl_value_col_norm,dm_ndl_value_row_norm | |
| 2217 output_256 ; print NDL (0-255) | |
| 2218 PUTC_PRINT "'" ; append unit and dump buffer to screen | |
| 2219 return ; done | |
| 2220 | |
| 2221 TFT_show_ndl_alt: | |
| 2222 btfsc safety_stop_active ; is the safety stop active? | |
| 2223 bra TFT_show_ndl_alt_safety ; YES | |
| 2224 ;bra TFT_show_ndl_alt_no_safety ; NO | |
| 2225 | |
| 2226 TFT_show_ndl_alt_no_safety: ; clear potential remains from NDL normal | |
| 2227 WIN_BOX_BLACK dm_ndl_value_row_norm, dm_3rdrow_bot, dm_ndl_value_col_norm, dm_ndl_value_col_alt ; top, bottom, left, right | |
| 2228 WIN_LARGE dm_ndl_value_col_alt, dm_ndl_value_row_alt | |
| 2229 output_99 ; print NDL (0-99) | |
| 2230 PRINT ; dump buffer to screen | |
| 2231 return ; done | |
| 2232 | |
| 2233 TFT_show_ndl_alt_safety: | |
| 2234 WIN_MEDIUM dm_ndl_value_col_norm,dm_ndl_value_row_norm | |
| 2235 output_256 ; print NDL (0-255) | |
| 2236 PUTC_PRINT "'" ; append unit and dump buffer to screen | |
| 2237 return ; done | |
| 2238 | |
| 2239 | |
| 2240 ; Helper Function - set color | |
| 2241 TFT_show_ndl_tts_set_color: | |
| 2242 movf pallet_color_memo,W ; load memo color as default | |
| 2243 btfsc mpr+1,int_invalid_flag ; is the invalid flag set? | |
| 2244 movf pallet_color_disabled,W ; YES - replace by disabled color | |
| 2245 movwf font_color ; set font color | |
| 2246 return ; done | |
| 2247 | |
| 2248 | |
| 2249 ;----------------------------------------------------------------------------- | |
| 2250 ; Dive Mode - TTS Time | |
| 2251 ; | |
| 2252 global TFT_show_tts | |
| 2253 TFT_show_tts: | |
| 2254 btfsc dive_main_menu ; is the dive mode menu shown? | |
| 2255 return ; YES - abort | |
| 2256 MOVII int_O_TTS_norm,mpr ; NO - get the TTS | |
| 2257 rcall TFT_show_ndl_tts_set_color ; - color-code | |
| 2258 bcf hi,int_invalid_flag ; - clear the invalid flag if applicable | |
| 2259 btfsc alt_layout_active ; - in alternative layout? | |
| 2260 bra TFT_display_tts_alt ; YES | |
| 2261 ;bra TFT_display_tts_norm ; NO | |
| 2262 | |
| 2263 TFT_display_tts_norm: | |
| 2264 WIN_MEDIUM dm_tts_value_col_999x, dm_tts_value_row | |
| 2265 output_999 ; print (0...999) | |
| 2266 PUTC_PRINT "'" ; append unit and dump buffer to screen | |
| 2267 return ; done | |
| 2268 | |
| 2269 TFT_display_tts_alt: | |
| 2270 output_99 ; print TTS for range 0-99 | |
| 2271 btfsc output_overflow ; does TTS fit into 0-99 ? | |
| 2272 bra TFT_display_tts_alt_999 ; NO - print in 999 format | |
| 2273 ;bra TFT_display_tts_alt_99 ; YES - print in 99 format | |
| 2274 | |
| 2275 TFT_display_tts_alt_99: | |
| 2276 btfsc tts_over_99_last ; was TTS > 99 last time? | |
| 2277 rcall TFT_display_tts_clear ; YES - clear remains from TTS > 99 | |
| 2278 WIN_MEDIUM dm_tts_value_col_99, dm_tts_value_row | |
| 2279 output_99 ; print TTS (0...99) | |
| 2280 PUTC_PRINT "'" ; append unit and dump buffer to screen | |
| 2281 return ; done | |
| 2282 | |
| 2283 TFT_display_tts_alt_999: | |
| 2284 WIN_MEDIUM dm_tts_value_col_999, dm_tts_value_row | |
| 2285 REINIT_BUFFER ; clear the buffer | |
| 2286 output_999 ; print (0...999), no space for unit | |
| 2287 PRINT ; dump to screen | |
| 2288 bsf tts_over_99_last ; remember last TTS was > 99 mins | |
| 2289 return ; done | |
| 2290 | |
| 2291 | |
| 2292 ; Helper Function - clear remains from TTS > 99 | |
| 2293 TFT_display_tts_clear: ; clear remains from TTS > 99 | |
| 2294 WIN_BOX_BLACK dm_tts_value_row, dm_tts_value_row+.31, dm_tts_value_col_999, dm_tts_value_col_99 ; top, bottom, left, right | |
| 2295 bcf tts_over_99_last ; remember last TTS was NOT > 99 mins | |
| 2296 return ; done | |
| 2297 | |
| 2298 | |
| 2299 ;----------------------------------------------------------------------------- | |
| 2300 ; Dive Mode - Deco Stop Time & Depth | |
| 2301 ; | |
| 2302 global TFT_show_deco | |
| 2303 TFT_show_deco: | |
| 2304 btfsc dive_main_menu ; is the dive mode menu shown? | |
| 2305 return ; YES - abort | |
| 2306 | |
| 2307 movff char_O_deco_depth,lo ; get depth of first stop in meters | |
| 2308 call TFT_color_code_stop ; color-code output | |
| 2309 TSTOSC opt_units ; get unit (0=m, 1=ft) | |
| 2310 bra TFT_show_deco_norm ; 1 - ft can only be displayed in normal layout due to space required for 3 digit depth | |
| 2311 btfsc alt_layout_active ; 0 - in alternative layout? | |
| 2312 bra TFT_show_deco_alt ; YES | |
| 2313 ;bra TFT_show_deco_norm ; NO - combined depth and time | |
| 2314 | |
| 2315 TFT_show_deco_norm: | |
| 2316 WIN_MEDIUM dm_decostop_col_norm, dm_decostop_row_norm | |
| 2317 call TFT_display_stop_depth ; print stop (depth in lo) | |
| 2318 PUTC ' ' ; put a space char between depth and time | |
| 2319 bra TFT_display_deco_common ; continue with common part | |
| 2320 | |
| 2321 TFT_show_deco_alt: | |
| 2322 WIN_LARGE dm_decostop_col_alt_depth, dm_decostop_row_alt_depth | |
| 2323 output_99 ; print stop depth (0-99) | |
| 2324 PRINT ; dump buffer to screen | |
| 2325 WIN_MEDIUM dm_decostop_col_alt_time, dm_decostop_row_alt_time | |
| 2326 FONT_COLOR_MEMO ; select memo color | |
| 2327 ;bra TFT_display_deco_common ; continue with common part | |
| 2328 | |
| 2329 TFT_display_deco_common: | |
| 2330 movff char_O_deco_time,lo ; get stop time of the first stop in minutes | |
| 2331 output_99DD ; print minutes or double dots if null | |
| 2332 PUTC_PRINT "'" ; append unit and dump buffer to screen | |
| 2333 return ; done | |
| 2334 | |
| 2335 | |
| 2336 ;============================================================================= | |
| 2337 tft_out7 CODE | |
| 2338 ;============================================================================= | |
| 2339 | |
| 2340 ;----------------------------------------------------------------------------- | |
| 2341 ; Dive Mode - Apnoe current and overall Dive Time | |
| 2342 ; | |
| 2343 global TFT_show_apnoe_times | |
| 2344 TFT_show_apnoe_times: | |
| 2345 ; current dive time | |
| 2346 FONT_COLOR_MEMO ; select color | |
| 2347 WIN_MEDIUM dm_divetime_apnoe_col, dm_divetime_apnoe_row | |
| 2348 SMOVII apnoe_dive_mins,mpr ; ISR-safe copy of minutes to lo and seconds to hi | |
| 2349 output_99 ; print minutes (0-99) | |
| 2350 PRINT ; dump to screen | |
| 2351 WIN_SMALL dm_divetime_apnoe_secs_col, dm_divetime_apnoe_secs_row | |
| 2352 PUTC ':' ; print ":" | |
| 2353 movff hi,lo ; copy seconds to lo | |
| 2354 output_99x ; print seconds (00-99) | |
| 2355 PRINT ; dump to screen | |
| 2356 ; overall dive time | |
| 2357 WIN_MEDIUM dm_apnoe_total_divetime_col, dm_apnoe_total_divetime_row | |
| 2358 SMOVTT counted_divetime_mins,mpr ; ISR-safe 3 byte copy of minutes:2 and seconds | |
| 2359 output_256 ; minutes (0-256) | |
| 2360 PRINT ; show minutes in large font | |
| 2361 WIN_SMALL dm_apnoe_total_divetime_secs_col, dm_apnoe_total_divetime_secs_row ; left position for two sec figures | |
| 2362 PUTC ':' ; print ":" | |
| 2363 movff up,lo ; copy seconds from up to lo | |
| 2364 output_99x ; print seconds (00-99) | |
| 2365 PRINT ; dump to screen | |
| 2366 return ; done | |
| 2367 | |
| 2368 | |
| 2369 ;----------------------------------------------------------------------------- | |
| 2370 ; Dive Mode - show Apnoe Surface Time | |
| 2371 ; | |
| 2372 global TFT_show_apnoe_surface | |
| 2373 TFT_show_apnoe_surface: | |
| 2374 FONT_COLOR_MASK ; select mask color | |
| 2375 WIN_TINY dm_apnoe_surface_time_text_col, dm_apnoe_surface_time_text_row | |
| 2376 STRCPY_TEXT_PRINT tApnoeSurface ; print label | |
| 2377 FONT_COLOR_MEMO ; select memo color | |
| 2378 WIN_MEDIUM dm_apnoe_surface_time_column, dm_apnoe_surface_time_row | |
| 2379 SMOVII apnoe_surface_mins,mpr ; ISR-safe copy of minutes to lo and seconds to hi | |
| 2380 output_256 ; print minutes (0-255) | |
| 2381 PUTC ':' ; print ":" | |
| 2382 movff hi,lo ; copy seconds to lo | |
| 2383 output_99x ; print seconds (00-99) | |
| 2384 PRINT ; dump to screen | |
| 631 | 2385 return ; done |
| 2386 | |
| 2387 | |
| 623 | 2388 ;----------------------------------------------------------------------------- |
| 634 | 2389 ; Dive Mode - clear Apnoe Surface Time |
| 2390 ; | |
| 2391 global TFT_clear_apnoe_surface | |
| 2392 TFT_clear_apnoe_surface: | |
| 2393 WIN_BOX_BLACK dm_apnoe_last_max_depth_text_row, .239, dm_apnoe_last_max_depth_column, .159 | |
| 654 | 2394 WIN_BOX_BLACK dm_customview_bot, dm_apnoe_last_max_depth_text_row, dm_apnoe_surface_dive_text_col, .159 |
| 631 | 2395 return ; done |
| 604 | 2396 |
| 654 | 2397 ;----------------------------------------------------------------------------- |
| 2398 ; Dive Mode - show apnoe #dive counter | |
| 2399 ; | |
| 2400 global TFT_apnoe_divecounter | |
| 2401 TFT_apnoe_divecounter: | |
| 2402 FONT_COLOR_MASK ; select mask color | |
| 2403 WIN_TINY dm_apnoe_surface_dive_text_col, dm_apnoe_surface_dive_text_row | |
| 2404 STRCPY_TEXT_PRINT tTotalDives ; print label | |
| 2405 FONT_COLOR_MEMO ; select memo color | |
| 2406 WIN_STD dm_apnoe_surface_divecnt_col, dm_apnoe_surface_divecnt_row | |
| 2407 movff apnoe_dive_counter,lo | |
| 2408 output_256 ; print #dives (0-255) | |
| 2409 PRINT ; dump to screen | |
| 2410 return ; done | |
| 634 | 2411 |
| 2412 ;============================================================================= | |
| 2413 tft_out8 CODE | |
| 2414 ;============================================================================= | |
| 2415 | |
| 2416 | |
| 2417 ;----------------------------------------------------------------------------- | |
| 2418 ; Dive Mode - clear Deco Data (NDL / Stop & TTS ) | |
| 2419 ; | |
| 2420 global TFT_clear_deco_data | |
| 2421 TFT_clear_deco_data: | |
| 2422 btfsc dive_main_menu ; is the dive mode menu shown? | |
| 2423 return ; YES | |
| 2424 | |
| 2425 WIN_BOX_BLACK dm_decostop_row_alt_depth, dm_3rdrow_bot, dm_decostop_col_alt_depth, dm_3rdrow_rgt ; top, bottom, left, right | |
| 2426 return | |
| 2427 | |
| 2428 | |
| 628 | 2429 ;----------------------------------------------------------------------------- |
| 634 | 2430 ; Dive Mode - clear Dive Mode Menu |
| 2431 ; | |
| 2432 ; starts 2 pixel higher to completely wipe away the temperature display | |
| 2433 ; | |
| 2434 global TFT_clear_divemode_menu | |
| 2435 TFT_clear_divemode_menu: | |
| 2436 WIN_BOX_BLACK dm_menu_row-.2, dm_menu_lower, dm_menu_left, dm_menu_right | |
| 582 | 2437 return |
|
544
64a45f203144
NEW: Show Compass calibration results in Compass menu
heinrichsweikamp
parents:
535
diff
changeset
|
2438 |
| 634 | 2439 |
| 2440 ;============================================================================= | |
| 2441 VSI_table CODE_PACK | |
| 2442 ;============================================================================= | |
| 2443 | |
| 2444 VSI_table: | |
| 2445 | |
| 2446 ; use a depth-dependent ascent rate warning | |
| 2447 ; depth(ft): <20 >20 >40 >60 >75 >88 >101 >115 >128 >144 >164 | |
| 2448 ; speed(ft/min): 23 26 29 33 36 43 49 56 59 62 66 | |
| 2449 ; depth(m): <=6 >6 >12 >18 >23 >27 >31 >35 >39 >44 >50 | |
| 2450 ; speed(m/min): 7 8 9 10 11 13 15 17 18 19 20 (warning) | |
| 2451 ; speed(m/min): 5 6 7 8 8 10 12 13 14 15 15 (attention) | |
| 2452 | |
| 2453 ; < depth (m), warning speed, attention speed | |
| 2454 DB .6, .7, .5 | |
| 2455 DB .12, .8, .6 | |
| 2456 DB .18, .9, .7 | |
| 2457 DB .23,.10, .8 | |
| 2458 DB .27,.11, .8 | |
| 2459 DB .31,.13,.10 | |
| 2460 DB .35,.15,.12 | |
| 2461 DB .39,.17,.13 | |
| 2462 DB .44,.18,.14 | |
| 2463 DB .50,.19,.15 | |
| 2464 DB .255,.20,.15 | |
| 2465 | |
| 2466 | |
| 2467 ;============================================================================= | |
| 2468 tft_out9 CODE | |
| 2469 ;============================================================================= | |
| 623 | 2470 |
|
453
b4f28ab23b87
NEW: Show Uptime (Time since last firmware boot) in information menu
heinrichsweikamp
parents:
444
diff
changeset
|
2471 |
| 0 | 2472 ;----------------------------------------------------------------------------- |
| 634 | 2473 ; Dive Mode - show vertical Velocity |
| 2474 ; | |
| 2475 global TFT_velocity_show | |
| 2476 TFT_velocity_show: | |
| 2477 FONT_COLOR_MEMO ; set default color | |
| 2478 btfsc neg_flag_velocity ; descending? | |
| 2479 rcall TFT_velocity_set_color ; NO - set color for text dependent on speed and set threshold for VSI graph | |
| 2480 rcall TFT_velocity_num ; show the numerical VSI | |
| 2481 TSTOSS opt_vsigraph ; graphical VSI bar enabled? | |
| 2482 return ; NO - done | |
| 2483 btfss neg_flag_velocity ; YES - in ascent? | |
| 2484 bra TFT_velocity_clear_graph ; NO - clear the graph | |
| 2485 ;bra TFT_velocity_graph_show ; YES - show the graph | |
| 2486 | |
| 2487 TFT_velocity_graph_show: | |
| 2488 btfsc alt_layout_active ; in alternative layout? | |
| 2489 return ; YES - done (not implemented) | |
| 2490 | |
| 2491 btfsc velocity_active_vsi ; was the graphical VSI shown before? | |
| 2492 bra TFT_velocity_graph_1 ; YES - no need to redraw the framework box | |
| 2493 bsf velocity_active_vsi ; NO - remember it is shown as of now | |
| 2494 ; - draw the framework box | |
| 2495 movf pallet_color_mask,W ; - color -> WREG | |
| 2496 WIN_FRAME_COLOR dm_velocity_graph_top+.00, dm_velocity_graph_bot-.00, dm_velocity_graph_lft, dm_velocity_graph_rgt | |
| 2497 movf pallet_color_mask,W ; - color -> WREG | |
| 2498 WIN_FRAME_COLOR dm_velocity_graph_top+.10, dm_velocity_graph_bot-.10, dm_velocity_graph_lft, dm_velocity_graph_rgt | |
| 2499 movf pallet_color_mask,W ; - color -> WREG | |
| 2500 WIN_FRAME_COLOR dm_velocity_graph_top+.20, dm_velocity_graph_bot-.20, dm_velocity_graph_lft, dm_velocity_graph_rgt | |
| 2501 movf pallet_color_mask,W ; - color -> WREG | |
| 2502 WIN_FRAME_COLOR dm_velocity_graph_top+.30, dm_velocity_graph_bot-.30, dm_velocity_graph_lft, dm_velocity_graph_rgt | |
| 2503 | |
| 2504 TFT_velocity_graph_1: | |
| 2505 movff divA+0,hi ; copy ascend speed (in m/min) to hi | |
| 2506 movff divA+1,xA+0 ; m/min for warning level (upper two blocks) | |
| 2507 clrf xA+1 | |
| 2508 MOVLI .5,xB ; threshold for color warning (5 color normal + 2 color warning) | |
| 2509 call div16x16 ; xC = xA / xB with xA as remainder | |
| 2510 ; xC+0 holds step size in m/min (e.g. =3 for 15m/min warning threshold) | |
| 2511 movff hi,xA+0 ; velocity in m/min | |
| 2512 clrf xA+1 ; ... | |
| 2513 movff xC+0,xB+0 ; step size | |
| 2514 clrf xB+1 ; ... | |
| 2515 call div16x16 ; xC = xA / xB with xA as remainder | |
| 2516 movff xC+0,lo ; copy amount of segments to show to lo | |
| 2517 incf lo,F ; lo +=1 | |
| 2518 dcfsnz lo,F ; lo = 1 ? | |
| 2519 bra DISP_graph_vel_0_fill ; YES - fill lowest segment | |
| 2520 dcfsnz lo,F ; lo = 2 ? | |
| 2521 bra DISP_graph_vel_1_fill ; YES - fill lower 2 segments | |
| 2522 dcfsnz lo,F ; lo = 3 ? | |
| 2523 bra DISP_graph_vel_2_fill ; YES - fill lower 3 segments | |
| 2524 dcfsnz lo,F ; lo = 4 ? | |
| 2525 bra DISP_graph_vel_3_fill ; YES - fill lower 4 segments | |
| 2526 dcfsnz lo,F ; lo = 5 ? | |
| 2527 bra DISP_graph_vel_4_fill ; YES - fill lower 5 segments | |
| 2528 dcfsnz lo,F ; lo = 6 ? | |
| 2529 bra DISP_graph_vel_5_fill ; YES - fill lower 6 segments | |
| 2530 dcfsnz lo,F ; lo = 7 ? | |
| 2531 bra DISP_graph_vel_6_fill ; YES - fill lower 7 segments | |
| 2532 ;bra DISP_graph_vel_7_fill ; YES - fill all segments | |
| 2533 | |
| 2534 DISP_graph_vel_7_fill: | |
| 2535 movf pallet_color_warning,W | |
| 2536 WIN_BOX_COLOR dm_velocity_graph_top+.2, dm_velocity_graph_top+.8, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
| 2537 DISP_graph_vel_6_fill: | |
| 2538 movf pallet_color_warning,W | |
| 2539 WIN_BOX_COLOR dm_velocity_graph_top+.12, dm_velocity_graph_top+.18, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
| 2540 DISP_graph_vel_5_fill: | |
| 2541 movf pallet_color_attention,W | |
| 2542 WIN_BOX_COLOR dm_velocity_graph_top+.22, dm_velocity_graph_top+.28, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
| 2543 DISP_graph_vel_4_fill: | |
| 2544 movf pallet_color_memo,W | |
| 2545 WIN_BOX_COLOR dm_velocity_graph_top+.32, dm_velocity_graph_top+.38, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
| 2546 DISP_graph_vel_3_fill: | |
| 2547 movf pallet_color_memo,W | |
| 2548 WIN_BOX_COLOR dm_velocity_graph_top+.42, dm_velocity_graph_top+.48, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
| 2549 DISP_graph_vel_2_fill: | |
| 2550 movf pallet_color_memo,W | |
| 2551 WIN_BOX_COLOR dm_velocity_graph_top+.52, dm_velocity_graph_top+.58, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
| 2552 DISP_graph_vel_1_fill: | |
| 2553 movf pallet_color_memo,W | |
| 2554 WIN_BOX_COLOR dm_velocity_graph_top+.62, dm_velocity_graph_top+.68, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
| 2555 DISP_graph_vel_0_fill: | |
| 2556 | |
| 2557 movff xC+0,lo ; copy amount of segments to show to lo | |
| 2558 incf lo,F ; lo += 1 | |
| 2559 dcfsnz lo,F ; lo = 1 ? | |
| 2560 bra DISP_graph_vel_0_clear ; YES - clear upper 7 segments | |
| 2561 dcfsnz lo,F ; lo = 2 ? | |
| 2562 bra DISP_graph_vel_1_clear ; YES - clear upper 6 segments | |
| 2563 dcfsnz lo,F ; lo = 3 ? | |
| 2564 bra DISP_graph_vel_2_clear ; YES - clear upper 5 segments | |
| 2565 dcfsnz lo,F ; lo = 4 ? | |
| 2566 bra DISP_graph_vel_3_clear ; YES - clear upper 4 segments | |
| 2567 dcfsnz lo,F ; lo = 5 ? | |
| 2568 bra DISP_graph_vel_4_clear ; YES - clear upper 3 segments | |
| 2569 dcfsnz lo,F ; lo = 6 ? | |
| 2570 bra DISP_graph_vel_5_clear ; YES - clear upper 2 segments | |
| 2571 dcfsnz lo,F ; lo = 7 ? | |
| 2572 bra DISP_graph_vel_6_clear ; YES - clear upper 1 segments | |
| 2573 bra DISP_graph_vel_7_clear ; YES - clear no segments | |
| 2574 | |
| 2575 DISP_graph_vel_0_clear: | |
| 2576 WIN_BOX_BLACK dm_velocity_graph_top+.62, dm_velocity_graph_top+.68, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
| 2577 DISP_graph_vel_1_clear: | |
| 2578 WIN_BOX_BLACK dm_velocity_graph_top+.52, dm_velocity_graph_top+.58, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
| 2579 DISP_graph_vel_2_clear: | |
| 2580 WIN_BOX_BLACK dm_velocity_graph_top+.42, dm_velocity_graph_top+.48, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
| 2581 DISP_graph_vel_3_clear: | |
| 2582 WIN_BOX_BLACK dm_velocity_graph_top+.32, dm_velocity_graph_top+.38, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
| 2583 DISP_graph_vel_4_clear: | |
| 2584 WIN_BOX_BLACK dm_velocity_graph_top+.22, dm_velocity_graph_top+.28, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
| 2585 DISP_graph_vel_5_clear: | |
| 2586 WIN_BOX_BLACK dm_velocity_graph_top+.12, dm_velocity_graph_top+.18, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
| 2587 DISP_graph_vel_6_clear: | |
| 2588 WIN_BOX_BLACK dm_velocity_graph_top+.2, dm_velocity_graph_top+.8, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
| 2589 DISP_graph_vel_7_clear: | |
| 2590 return ; done | |
| 2591 | |
| 2592 | |
| 2593 ; Helper Function - set color based on speed table or use static thresholds, with divA+0 = m/min | |
| 2594 TFT_velocity_set_color: | |
| 2595 bsf aux_flag ; for alternative layout: default is to show numerical VSI | |
| 2596 ; check if old/new ascend logic is used | |
| 2597 TSTOSS opt_vsitext ; 0=standard, 1=dynamic | |
| 2598 bra TFT_velocity_set_color_static ; 0 - static ascend rate limit | |
| 2599 ;bra TFT_velocity_set_color_dynamic ; 1 - dynamic ascend rate limit | |
| 2600 | |
| 2601 TFT_velocity_set_color_dynamic: | |
| 2602 movlw LOW (VSI_table-.2) ; point to 2 entries ahead of the speed table | |
| 2603 movwf TBLPTRL ; ... | |
| 2604 movlw HIGH (VSI_table-.2) ; ... | |
| 2605 movwf TBLPTRH ; ... | |
| 2606 movlw UPPER (VSI_table-.2) ; ... | |
| 2607 movwf TBLPTRU ; ... | |
| 2608 TFT_velocity_set_color_loop: | |
| 2609 TBLRD*+ ; consume waring speed form last round | |
| 2610 TBLRD*+ ; consume attention speed form last round | |
| 2611 TBLRD*+ ; get table depth | |
| 2612 movf depth_meter,W ; get current depth | |
| 2613 cpfsgt TABLAT ; table depth > current depth ? | |
| 2614 bra TFT_velocity_set_color_loop ; NO - try next | |
| 2615 TBLRD*+ ; YES - read warning speed threshold | |
| 2616 movf TABLAT,W ; - ... | |
| 2617 movwf divA+1 ; - copy to graph routine | |
| 2618 cpfslt divA+0 ; - actual vertical speed smaller than warning threshold? | |
| 2619 bra TFT_velocity_set_color_warn ; NO - set warning color and return | |
| 2620 TBLRD*+ ; YES - read attention speed threshold | |
| 2621 movf TABLAT,W ; - ... | |
| 2622 cpfslt divA+0 ; - actual vertical speed smaller than attention threshold? | |
| 2623 bra TFT_velocity_set_color_attn ; NO - set attention color and return | |
| 2624 bcf aux_flag ; YES - don't show in alternative layout | |
| 2625 bra TFT_velocity_set_color_memo ; - set memo color and return | |
| 2626 | |
| 2627 TFT_velocity_set_color_static: | |
| 2628 movlw color_code_velocity_warn_high ; get static threshold for warning in m/min | |
| 2629 movwf divA+1 ; copy for graph routine | |
| 2630 cpfslt divA+0 ; actual vertical speed smaller than warning threshold? | |
| 2631 bra TFT_velocity_set_color_warn ; NO - set warning color and return | |
| 2632 movlw color_code_velocity_attn_high ; YES - get static threshold for attention in m/min | |
| 2633 cpfslt divA+0 ; - actual vertical speed smaller than attention threshold? | |
| 2634 bra TFT_velocity_set_color_attn ; NO - set attention color and return | |
| 2635 bcf aux_flag ; YES - don't show in alternative layout | |
| 2636 ;bra TFT_velocity_set_color_memo ; - set memo color and return | |
| 2637 | |
| 2638 | |
| 2639 ; Helper Function - select color | |
| 2640 TFT_velocity_set_color_memo: | |
| 2641 FONT_COLOR_MEMO ; select memo color | |
| 2642 return ; done | |
| 2643 | |
| 2644 TFT_velocity_set_color_attn: | |
| 2645 FONT_COLOR_ATTENTION ; select attention color | |
| 2646 return ; done | |
| 2647 | |
| 2648 TFT_velocity_set_color_warn: | |
| 2649 FONT_COLOR_WARNING ; select warning color | |
| 2650 return ; done | |
| 2651 | |
| 2652 | |
| 2653 ; Helper Function - show the numerical VSI | |
| 2654 TFT_velocity_num: | |
| 2655 btfsc alt_layout_active ; in alternative layout? | |
| 2656 bra TFT_velocity_num_alt ; YES | |
| 2657 ;bra TFT_velocity_num_norm ; NO | |
| 2658 | |
| 2659 TFT_velocity_num_norm: | |
| 2660 WIN_SMALL dm_velocity_text_col_norm, dm_velocity_text_row_norm | |
| 2661 bra TFT_velocity_num_com ; continue with common part | |
| 2662 | |
| 2663 TFT_velocity_num_alt: | |
| 2664 btfsc dive_main_menu ; is the dive mode menu shown? | |
| 2665 return ; YES - abort | |
| 2666 btfss neg_flag_velocity ; NO - in ascent? | |
| 2667 bcf aux_flag ; NO - clear aux flag | |
| 2668 btfsc aux_flag ; - above attention or warning threshold? | |
| 2669 bsf win_invert ; YES - print inverse | |
| 2670 WIN_SMALL dm_velocity_text_col_alt, dm_velocity_text_row_alt | |
| 2671 ;bra TFT_velocity_num_com ; - continue with common part | |
| 2672 | |
| 2673 TFT_velocity_num_com: | |
| 2674 bsf velocity_active_num ; set numerical velocity as shown | |
| 2675 TSTOSS opt_units ; 0=meter, 1=feet | |
| 2676 bra TFT_velocity_num_metric ; 0 - meter | |
| 2677 ;bra TFT_velocity_num_imperial ; 1 - feet | |
| 2678 | |
| 2679 TFT_velocity_num_imperial: | |
| 2680 movff divA+0,WREG ; divA+0 = m/min | |
| 2681 mullw .100 ; PROD = mbar/min | |
| 2682 MOVII PRODL,mpr ; copy to hi:lo | |
| 2683 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] | |
| 2684 tstfsz hi ; > 255 ? | |
| 2685 setf lo ; YES - set lo to 255 | |
| 2686 rcall TFT_velocity_num_helper ; print vertical speed | |
| 2687 STRCAT_TEXT tVelImperial ; print unit | |
| 2688 bra TFT_velocity_num_finish ; do finishing tasks | |
| 2689 | |
| 2690 TFT_velocity_num_metric: | |
| 2691 movff divA+0,lo ; divA+0 = m/min | |
| 2692 rcall TFT_velocity_num_helper ; print vertical speed | |
| 2693 STRCAT_TEXT tVelMetric ; print unit | |
| 2694 ;bra TFT_velocity_num_finish ; do finishing tasks | |
| 2695 | |
| 2696 TFT_velocity_num_finish: | |
| 2697 btfss alt_layout_active ; in alternative layout? | |
| 2698 bra TFT_velocity_num_finish_1 ; NO | |
| 2699 movlw "'" ; load encoding of minute sign | |
| 2700 movff WREG,buffer+4 ; put it after m (meter) / f (feet) | |
| 2701 clrf WREG ; load string terminator | |
| 2702 movff WREG,buffer+5 ; terminate string after minute sign | |
| 2703 TFT_velocity_num_finish_1: | |
| 2704 PRINT ; dump to screen | |
| 2705 return ; done | |
| 2706 | |
| 2707 | |
| 2708 ; Helper Function - print vertical speed | |
| 2709 TFT_velocity_num_helper: | |
| 2710 movlw '-' ; load coding for minus sign | |
| 2711 btfsc neg_flag_velocity ; ascending? | |
| 2712 movlw '+' ; YES - replace with coding for plus sign | |
| 2713 movwf POSTINC2 ; put sign into output buffer | |
| 2714 output_99 ; print rate (0-99) | |
| 2715 return ; done | |
| 2716 | |
| 2717 | |
| 2718 ;----------------------------------------------------------------------------- | |
| 2719 ; Dive Mode - clear vertical Velocity | |
| 2720 ; | |
| 2721 global TFT_velocity_clear | |
| 2722 TFT_velocity_clear: | |
| 2723 btfss velocity_active_num ; was the numerical VSI shown in last cycle? | |
| 2724 bra TFT_velocity_check_graph ; NO - no need to clear it, continue with graphical VSI | |
| 2725 ;bra TFT_velocity_clear_num ; YES | |
| 2726 | |
| 2727 TFT_velocity_clear_num: | |
| 2728 bcf velocity_active_num ; clear flag | |
| 2729 btfsc alt_layout_active ; in alternative layout? | |
| 2730 bra TFT_velocity_clear_num_alt ; YES | |
| 2731 ;bra TFT_velocity_clear_num_norm ; NO | |
| 2732 | |
| 2733 TFT_velocity_clear_num_norm: ; clear normal numerical area | |
| 2734 WIN_BOX_BLACK dm_velocity_text_row_norm, dm_velocity_text_bot_norm, dm_velocity_text_col_norm, dm_velocity_text_rgt_norm | |
| 2735 bra TFT_velocity_check_graph ; continue with graphical VSI | |
| 2736 | |
| 2737 TFT_velocity_clear_num_alt: ; clear alternative numerical area | |
| 2738 btfsc dive_main_menu ; is the dive mode menu shown? | |
| 2739 bra TFT_velocity_check_graph ; YES - skip | |
| 2740 WIN_BOX_BLACK dm_velocity_text_row_alt, dm_velocity_text_bot_alt, dm_velocity_text_col_alt, dm_velocity_text_rgt_alt | |
| 2741 ;bra TFT_velocity_check_graph ; continue with graphical VSI | |
| 2742 | |
| 2743 TFT_velocity_check_graph: | |
| 2744 btfss velocity_active_vsi ; was the graphical VSI shown in last cycle? | |
| 2745 return ; NO - no need to clear it, done | |
| 2746 ;bra TFT_velocity_clear_graph ; YES - clear it | |
| 2747 | |
| 2748 TFT_velocity_clear_graph: | |
| 2749 bcf velocity_active_vsi ; clear flag | |
| 2750 btfsc alt_layout_active ; in alternative layout? | |
| 2751 return ; YES - done (not implemented) | |
| 2752 WIN_BOX_BLACK dm_velocity_graph_top, dm_velocity_graph_bot, dm_velocity_graph_lft, dm_velocity_graph_rgt | |
| 2753 return ; done | |
| 2754 | |
| 560 | 2755 |
| 2756 ;============================================================================= | |
| 634 | 2757 tft_out10 CODE |
| 2758 ;============================================================================= | |
| 2759 | |
| 2760 | |
| 2761 ;----------------------------------------------------------------------------- | |
| 2762 ; Dive Mode - show Sign | |
| 2763 ; | |
| 2764 global TFT_divemode_sign_show | |
| 2765 TFT_divemode_sign_show: | |
| 2766 btfsc alt_layout_active ; alternative layout active? | |
| 2767 bra TFT_divemode_sign_show_alt ; YES | |
| 2768 ;bra TFT_divemode_sign_show_norm ; NO | |
| 2769 | |
| 2770 TFT_divemode_sign_show_norm: | |
| 2771 WIN_TOP dm_sign_row_norm ; set row position | |
| 2772 WIN_LEFT dm_sign_col_norm ; set column position | |
| 2773 bra TFT_divemode_sign_show_com ; continue with common part | |
| 2774 | |
| 2775 TFT_divemode_sign_show_alt: | |
| 2776 btfsc dive_main_menu ; is the dive mode menu shown? | |
| 2777 return ; YES - abort | |
| 2778 btfsc sign_shown ; NO - sign already shown? | |
| 2779 bra TFT_divemode_sign_show_alt_1; YES - no need to clear area again | |
| 2780 btfsc bailout_mode ; NO - in bailout? | |
| 2781 bra TFT_divemode_sign_show_alt_1; YES - no need to clear the area | |
| 2782 ; NO - clear area from "bar" label and loop mode if applicable | |
| 2783 WIN_BOX_BLACK dm_active_dil_row, dm_3rdrow_bot, dm_active_sp_label_col, dm_sign_rgt_alt ; top, bottom, left, right | |
| 2784 | |
| 2785 TFT_divemode_sign_show_alt_1: | |
| 2786 WIN_TOP dm_sign_row_alt ; - set row position | |
| 2787 WIN_LEFT dm_sign_col_alt ; - set column position | |
| 2788 ;bra TFT_divemode_sign_show_com ; - continue with common part | |
| 2789 | |
| 2790 TFT_divemode_sign_show_com: | |
| 2791 bsf sign_shown ; flag sign is shown | |
| 2792 btfsc sign_warning ; shall show warning sign? | |
| 2793 bra TFT_divemode_sign_show_warn ; YES - show warning sign | |
| 2794 btfsc sign_attention ; NO - shall show attention sign? | |
| 2795 bra TFT_divemode_sign_show_att ; YES - show attention sign | |
| 2796 btfsc sign_advice ; NO - shall show advice sign? | |
| 2797 bra TFT_divemode_sign_show_adv ; YES - show advice sign | |
| 2798 return ; NO - false alarm | |
| 2799 | |
| 2800 TFT_divemode_sign_color_warn: ; custom colors table for dive_warning2 icon - warning | |
| 2801 db .4, 0 ; #colors, spare | |
| 2802 dw 0x0000 ; color 0x00: outside black | |
| 2803 dw 0xff80 ; color 0x01: triangle yellow | |
| 2804 dw 0xff80 ; color 0x02: exclamation mark yellow | |
| 2805 dw 0xf800 ; color 0x03: inside red | |
| 2806 | |
| 2807 TFT_divemode_sign_color_adv: ; custom colors table for dive_warning2 icon - advice | |
| 2808 db .4, 0 ; #colors, spare | |
| 2809 dw 0x0000 ; color 0x00: outside black | |
| 2810 dw 0xffff ; color 0x01: triangle white | |
| 2811 dw 0xffff ; color 0x02: exclamation mark white | |
| 2812 dw 0x0780 ; color 0x03: inside green | |
| 2813 | |
| 2814 TFT_divemode_sign_show_warn: | |
| 2815 TFT_WRITE_PROM_IMAGE_CUST_COLOR TFT_divemode_sign_color_warn; set custom colors for warning | |
| 2816 TFT_WRITE_PROM_IMAGE_BY_LABEL dive_warning2_block ; show sign | |
| 2817 return ; done | |
| 2818 | |
| 2819 TFT_divemode_sign_show_att: | |
| 2820 TFT_WRITE_PROM_IMAGE_BY_LABEL dive_warning2_block ; show sign (with default colors) | |
| 2821 return ; done | |
| 2822 | |
| 2823 TFT_divemode_sign_show_adv: | |
| 2824 TFT_WRITE_PROM_IMAGE_CUST_COLOR TFT_divemode_sign_color_adv ; set custom colors for advice | |
| 2825 TFT_WRITE_PROM_IMAGE_BY_LABEL dive_warning2_block ; show sign | |
| 2826 return ; done | |
| 2827 | |
| 2828 | |
| 2829 ;----------------------------------------------------------------------------- | |
| 2830 ; Dive Mode - show Sign | |
| 2831 ; | |
| 2832 global TFT_divemode_sign_clear | |
| 2833 TFT_divemode_sign_clear: | |
| 2834 btfss sign_shown ; is the advice/attention/warning sign shown? | |
| 2835 return ; NO - done | |
| 2836 bcf sign_shown ; YES - clear flag | |
| 2837 btfsc alt_layout_active ; - alternative layout active? | |
| 2838 bra TFT_divemode_sign_clear_alt ; - YES | |
| 2839 ;bra TFT_divemode_sign_clear_norm; - NO | |
| 2840 | |
| 2841 TFT_divemode_sign_clear_norm: | |
| 2842 WIN_BOX_BLACK dm_sign_row_norm, dm_sign_bot_norm, dm_sign_col_norm, dm_sign_rgt_norm | |
| 2843 return ; done | |
| 2844 | |
| 2845 TFT_divemode_sign_clear_alt: | |
| 2846 WIN_BOX_BLACK dm_sign_row_alt, dm_sign_bot_alt, dm_sign_col_alt, dm_sign_rgt_alt | |
| 2847 return ; done | |
| 2848 | |
| 2849 | |
| 2850 ;============================================================================= | |
| 2851 tft_out11 CODE | |
| 2852 ;============================================================================= | |
| 2853 | |
| 2854 | |
| 2855 ;----------------------------------------------------------------------------- | |
| 2856 ; Dive Mode - show Safety Stop | |
| 2857 ; | |
| 2858 global TFT_safety_stop_show | |
| 2859 TFT_safety_stop_show: | |
| 2860 btfsc dive_main_menu ; is the dive mode menu shown? | |
| 2861 return ; YES - abort | |
| 2862 btfsc safety_stop_active ; NO - is the safety stop shown already? | |
| 2863 bra TFT_safety_stop_show_time ; YES - just update the time | |
| 2864 ; NO - clear area that may be polluted by alternative NDL | |
| 2865 WIN_BOX_BLACK dm_safetystop_row, dm_tts_value_row, dm_ndl_value_col_alt, dm_safetystop_rgt ; top, bottom, left, right | |
| 2866 bsf safety_stop_active ; - flag safety stop is shown now | |
| 2867 WIN_STD dm_safetystop_text_column, dm_safetystop_text_row | |
| 2868 FONT_COLOR_MASK ; - set color | |
| 2869 STRCPY_PRINT "Stop " ; - print "Stop" with a trailing space to wipe away potential other remains | |
| 2870 | |
| 2871 TFT_safety_stop_show_time: | |
| 2872 WIN_MEDIUM dm_safetystop_column, dm_safetystop_row | |
| 2873 FONT_COLOR_ATTENTION ; set color | |
| 2874 movff safety_stop_countdown,lo ; get remaining time in seconds, low byte, from safety stop timer | |
| 2875 clrf hi ; set remaining time in seconds, high byte, to zero | |
| 2876 call convert_time ; convert hi:lo in seconds to minutes (up:hi) and seconds (lo) | |
| 2877 movff lo,up ; save seconds in up | |
| 2878 movff hi,lo ; move minutes to lo | |
| 2879 output_9 ; print minutes (0-9) | |
| 2880 PUTC ':' ; print ":" | |
| 2881 movff up,lo ; move seconds to lo | |
| 2882 output_99x ; print seconds (00-99) | |
| 2883 PRINT ; dump buffer to screen | |
| 2884 return ; done | |
| 2885 | |
| 2886 | |
| 2887 ;----------------------------------------------------------------------------- | |
| 2888 ; Dive Mode - clear Safety Stop | |
| 2889 ; | |
| 2890 global TFT_safety_stop_clear | |
| 2891 TFT_safety_stop_clear: | |
| 2892 btfsc dive_main_menu ; is the dive mode menu shown? | |
| 2893 return ; YES - abort | |
| 2894 btfss safety_stop_active ; NO - is the safety stop shown? | |
| 2895 return ; NO - done, nothing to do | |
| 2896 ; YES - clear safety stop area | |
| 2897 WIN_BOX_BLACK dm_safetystop_row, dm_safetystop_bot, dm_safetystop_text_column, dm_safetystop_rgt ; top, bottom, left, right | |
| 2898 bcf safety_stop_active ; - safety stop not shown any more | |
| 2899 btfss deco_region ; - was the dive within deco stops region? | |
| 654 | 2900 return |
| 2901 btfsc alt_layout_active ; In alternative layout? | |
| 2902 return ; YES - DONE. | |
| 634 | 2903 ;bra TFT_show_slow_reminder ; YES - show "SLOW" reminder |
| 2904 | |
| 2905 | |
| 2906 ;----------------------------------------------------------------------------- | |
| 2907 ; Dive Mode - show "slow" Reminder | |
| 2908 ; | |
| 2909 TFT_show_slow_reminder: | |
| 2910 WIN_STD dm_safetystop_text_column+.5,dm_safetystop_text_row+.5 | |
| 2911 FONT_COLOR_ATTENTION ; set color | |
| 2912 STRCPY_TEXT tSlow ; print "SLOW" reminder | |
| 2913 STRCAT_PRINT 0x94 ; append an up-arrow | |
| 2914 return ; done | |
| 2915 | |
| 2916 | |
| 2917 ;============================================================================= | |
| 2918 tft_out12 CODE | |
| 2919 ;============================================================================= | |
| 2920 | |
| 2921 | |
| 2922 ;----------------------------------------------------------------------------- | |
| 2923 ; clear complete Message Window | |
| 2924 ; | |
| 623 | 2925 global TFT_clear_message_window |
| 2926 TFT_clear_message_window: | |
| 634 | 2927 btfss divemode ; in dive mode? |
| 2928 bra TFT_clear_message_window_surf ; NO - clear surface mode area | |
| 2929 ;bra TFT_clear_message_window_dive ; YES - clear dive mode area | |
| 623 | 2930 |
| 2931 TFT_clear_message_window_dive: | |
| 634 | 2932 btfsc alt_layout_active ; in alternative layout? |
| 2933 bra TFT_clear_message_window_dive_2 ; YES - clear dive mode area, 2nd row only | |
| 2934 | |
| 2935 WIN_BOX_BLACK dm_warning_row, dm_warning_bot, dm_warning_column, dm_warning_rgt | |
| 2936 return ; done | |
| 623 | 2937 |
| 2938 TFT_clear_message_window_surf: | |
| 582 | 2939 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ; top, bottom, left, right |
| 634 | 2940 return ; done |
| 2941 | |
| 2942 | |
| 2943 ;----------------------------------------------------------------------------- | |
| 2944 ; clear 2nd Line of Message Window | |
| 2945 ; | |
| 623 | 2946 global TFT_clear_message_window_row2 |
| 2947 TFT_clear_message_window_row2: | |
| 634 | 2948 bcf message_2nd_row_used ; 2nd row is cleared |
| 2949 btfss divemode ; in dive mode? | |
| 2950 bra TFT_clear_message_window_surf_2 ; NO - clear surface mode area, 2nd row only | |
| 2951 ;bra TFT_clear_message_window_dive_2 ; YES - clear dive mode area, 2nd row only | |
| 623 | 2952 |
| 2953 TFT_clear_message_window_dive_2: | |
| 634 | 2954 WIN_BOX_BLACK dm_warning2_row, dm_warning2_bot, dm_warning2_column, dm_warning2_rgt |
| 2955 return ; done | |
| 623 | 2956 |
| 2957 TFT_clear_message_window_surf_2: | |
| 582 | 2958 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ; top, bottom, left, right |
| 634 | 2959 return ; done |
| 2960 | |
| 643 | 2961 ;----------------------------------------------------------------------------- |
| 2962 ; Surface Mode - Message - when "I2CFail" was triggered | |
| 2963 ; | |
| 2964 global TFT_message_i2c_error | |
| 2965 TFT_message_i2c_error: | |
| 2966 rcall TFT_message_open ; set row and column for the message | |
| 2967 tstfsz WREG ; is there room for the message? | |
| 2968 return ; NO - skip message in this cycle | |
| 656 | 2969 STRCPY "I: " ; print "I2C Error:" |
| 643 | 2970 movff i2c_error_vault+0,WREG ; last device adress |
| 2971 output_hex | |
| 2972 PUTC " " | |
| 2973 movff i2c_error_vault+1,WREG ; last data byte | |
| 2974 output_hex | |
| 656 | 2975 PUTC " " |
| 2976 movff i2c_error_vault+2,WREG ; copy of SSP1CON2 | |
| 2977 output_hex | |
| 643 | 2978 bra TFT_message_close ; finalize message output |
| 634 | 2979 |
| 2980 ;----------------------------------------------------------------------------- | |
| 2981 ; Surface Mode - Message - Desaturation | |
| 2982 ; | |
| 2983 global TFT_surf_mesg_desat | |
| 2984 TFT_surf_mesg_desat: | |
| 654 | 2985 movlw .11 |
| 2986 cpfseq active_customview ; custom view 11 (DSAT/NOFLY/CNS) shown? | |
| 2987 bra TFT_surf_mesg_desat1 ; No, continue | |
| 2988 return ; Yes. Skip the warning then | |
| 2989 TFT_surf_mesg_desat1: | |
| 634 | 2990 rcall TFT_message_open ; set row and column for the message |
| 604 | 2991 tstfsz WREG ; is there room for the message? |
| 631 | 2992 return ; NO - skip message in this cycle |
| 634 | 2993 |
| 654 | 2994 TFT_surf_mesg_desat2: |
| 634 | 2995 FONT_COLOR_MEMO ; select color |
| 2996 STRCPY "Desat:" ; print label | |
| 2997 MOVII int_O_desaturation_time,mpr ; get desaturation time in minutes | |
| 2998 bra TFT_dsat_nofly_common ; continue with common part | |
| 2999 | |
| 3000 | |
| 3001 ;----------------------------------------------------------------------------- | |
| 3002 ; Surface Mode - Message - No-Fly / NO-Altitude | |
| 3003 ; | |
| 3004 global TFT_surf_mesg_nofly | |
| 3005 TFT_surf_mesg_nofly: | |
| 654 | 3006 movlw .11 |
| 3007 cpfseq active_customview ; custom view 11 (DSAT/NOFLY/CNS) shown? | |
| 3008 bra TFT_surf_mesg_nofly1 ; No, continue | |
| 3009 return ; Yes. Skip the warning then | |
| 3010 TFT_surf_mesg_nofly1: | |
| 634 | 3011 rcall TFT_message_open ; set row and column for the message |
| 604 | 3012 tstfsz WREG ; is there room for the message? |
| 631 | 3013 return ; NO - skip message in this cycle |
| 634 | 3014 |
| 3015 FONT_COLOR_MEMO ; select color | |
| 3016 movff char_I_altitude_wait,WREG ; get mode | |
| 3017 tstfsz WREG ; mode = altitude? | |
| 3018 bra TFT_nofly_time_alt ; YES | |
| 3019 ;bra TFT_nofly_time_fly ; NO | |
| 3020 | |
| 3021 TFT_nofly_time_fly: | |
| 3022 STRCPY "NoFly:" ; print no-fly label | |
| 3023 bra TFT_nofly_time_com ; continue | |
| 3024 | |
| 3025 TFT_nofly_time_alt: | |
| 3026 STRCPY "NoAlt:" ; print no-altitude label | |
| 3027 ;bra TFT_nofly_time_com ; continue | |
| 3028 | |
| 3029 TFT_nofly_time_com: | |
| 3030 MOVII int_O_nofly_time,mpr ; get no-fly time in minutes | |
| 3031 ;bra TFT_dsat_nofly_common ; continue with common part | |
| 3032 | |
| 3033 | |
| 3034 ; Helper Function - common part for TFT_surf_mesg_desat and TFT_surf_mesg_nofly | |
| 3035 TFT_dsat_nofly_common: | |
| 3036 call convert_time ; convert hi:lo in minutes to hours (up:hi) and minutes (lo) | |
| 3037 movff lo,up ; backup lo | |
| 3038 movff hi,lo ; get hours into lo | |
| 3039 output_99 ; print hours (0-99) | |
| 3040 PUTC ':' ; print ":" | |
| 3041 movff up,lo ; get minutes into lo | |
| 3042 output_99x ; print minutes (00-99) | |
| 3043 bra TFT_message_close ; finalize message output | |
| 3044 | |
| 3045 | |
| 3046 ;----------------------------------------------------------------------------- | |
| 3047 ; Dive Mode - Message - fTTS | |
| 3048 ; | |
| 3049 global TFT_message_ftts | |
| 3050 TFT_message_ftts: | |
| 3051 call TFT_message_open ; set row and column for the message | |
| 604 | 3052 tstfsz WREG ; is there room for the message? |
| 631 | 3053 return ; NO - skip message in this cycle |
| 634 | 3054 |
| 3055 IFDEF _cave_mode | |
| 3056 btfss cave_mode ; cave mode switched on? | |
| 3057 bra TFT_display_ftts_2 ; NO - classic open water TTS | |
| 3058 btfss dive_turned ; YES - dive turned? | |
| 3059 bra TFT_display_ftts_1 ; NO - cTTS from current position | |
| 3060 STRCPY "WP" ; YES - print waypoint mark | |
| 3061 movf backtrack_waypoint_num,W ; - copy current waypoint number to WREG | |
| 3062 cpfseq backtrack_waypoint_turn ; - current waypoint = turn point ? | |
| 3063 bra TFT_display_ftts_0 ; NO - print waypoint number | |
| 3064 STRCAT "-| " ; YES - print turn point symbol | |
| 3065 bra TFT_display_ftts_5 ; - continue with TTS | |
| 3066 TFT_display_ftts_0: | |
| 3067 movwf lo ; copy current waypoint number to lo | |
| 3068 bsf leftbind ; print left-aligned | |
| 3069 output_99 ; print waypoint number (0-99) | |
| 3070 PUTC " " ; append a space char | |
| 3071 bra TFT_display_ftts_5 ; continue with TTS | |
| 3072 TFT_display_ftts_1: | |
| 3073 STRCPY "cTTS " ; print cave TTS label followed by a space | |
| 3074 bra TFT_display_ftts_5 ; continue with TTS | |
| 623 | 3075 ENDIF ; _cave_mode |
| 634 | 3076 TFT_display_ftts_2: |
| 3077 btfsc FLAG_oc_mode ; in OC mode? | |
| 3078 bra TFT_display_ftts_3 ; YES - print fTTS label | |
| 3079 TSTOSS opt_calc_gasvolume ; NO - bailout volume calculation requested? | |
| 3080 bra TFT_display_ftts_3 ; NO - print fTTS label | |
| 3081 STRCPY "B/O" ; YES - print bailout label | |
| 3082 bra TFT_display_ftts_4 ; - continue | |
| 3083 TFT_display_ftts_3: ; OC or CCR/pSCR but no bailout volume calculation | |
| 3084 STRCPY "@+" ; print fTTS label | |
| 3085 TFT_display_ftts_4: | |
| 3086 movff char_I_extra_time,lo ; get fTTS delay time | |
| 3087 output_9 ; print fTTS delay time (0-9) | |
| 3088 PUTC ":" ; print ":" | |
| 3089 TFT_display_ftts_5: | |
| 3090 MOVII int_O_TTS_alt,mpr ; get alternative TTS | |
| 3091 FONT_COLOR_MEMO ; set memo color | |
| 3092 btfss hi,int_invalid_flag ; is the invalid flag set? | |
| 3093 bra TFT_display_ftts_6 ; NO - keep memo color | |
| 3094 bcf hi,int_invalid_flag ; YES - clear flag | |
| 3095 FONT_COLOR_DISABLED ; - switch to disabled color | |
| 3096 TFT_display_ftts_6: | |
| 3097 btfsc hi,int_not_yet_computed ; is the not-yet-computed flag set? | |
| 3098 bra TFT_display_ftts_8 ; YES - show dashes | |
| 3099 IFDEF _cave_mode | |
| 3100 btfsc cave_mode ; cave mode switched on? | |
| 3101 bra TFT_display_ftts_7 ; YES - take shortcut | |
| 3102 ENDIF | |
| 3103 movff int_O_TST_alt+1,WREG ; get high byte of the alternative total stops time | |
| 3104 btfsc WREG,int_is_zero ; total stops time = zero ? | |
| 3105 bra TFT_display_ftts_9 ; YES - show "NDL" | |
| 640 | 3106 movff char_O_deco_info,WREG ; NO - get deco info vector |
| 3107 btfsc WREG,deco_zone ; - fTTS <= TTS ? | |
| 3108 FONT_COLOR_ADVICE ; YES - set to advice color (green) | |
| 634 | 3109 TFT_display_ftts_7: |
| 3110 bsf leftbind ; print left-aligned | |
| 3111 output_999 ; print ascent time (0-999) | |
| 3112 PUTC "'" ; print minutes symbol | |
| 3113 bra TFT_message_close ; finalize message output | |
| 3114 TFT_display_ftts_8: | |
| 3115 STRCAT "---" ; print "---" for not computed | |
| 3116 bra TFT_message_close ; finalize message output | |
| 3117 TFT_display_ftts_9: | |
| 3118 STRCAT_TEXT tNDL ; print "NDL" | |
| 3119 bra TFT_message_close ; finalize message output | |
| 3120 | |
| 3121 | |
| 3122 ;----------------------------------------------------------------------------- | |
| 3123 ; Dive Mode - Message - ppO2 | |
| 3124 ; | |
| 3125 global TFT_message_ppo2 | |
| 3126 TFT_message_ppo2: | |
| 3127 call TFT_message_open ; set row and column for the message | |
| 604 | 3128 tstfsz WREG ; is there room for the message? |
| 631 | 3129 return ; NO - skip message in this cycle |
| 634 | 3130 |
| 3131 call TFT_color_code_ppo2 ; color-code output | |
| 3132 | |
| 3133 btfsc bailout_mode ; in bailout? | |
| 3134 bra TFT_display_diluent_oc ; YES - bailout (OC) | |
| 3135 btfsc FLAG_ccr_mode ; NO - in CCR mode? | |
| 3136 bra TFT_display_diluent_ccr ; YES - CCR | |
| 3137 btfsc FLAG_pscr_mode ; NO - in pSCR mode? | |
| 3138 bra TFT_display_diluent_pscr ; YES - pSCR | |
| 3139 ;bra TFT_display_diluent_oc ; NO - OC | |
| 3140 | |
| 3141 TFT_display_diluent_oc: | |
| 3142 STRCPY_TEXT tppO2 ; bailout or OC mode, print "ppO2:" | |
| 3143 bra TFT_display_diluent_comm ; continue with ppO2 value | |
| 3144 | |
| 3145 TFT_display_diluent_ccr: | |
| 3146 STRCPY_TEXT tdil ; print "Dil:" | |
| 3147 bra TFT_display_diluent_comm ; continue with ppO2 value | |
| 3148 | |
| 3149 TFT_display_diluent_pscr: | |
| 3150 STRCPY_TEXT tmix ; YES - print "Mix:" | |
| 3151 ;bra TFT_display_diluent_comm ; - continue with ppO2 value | |
| 3152 | |
| 3153 TFT_display_diluent_comm: | |
| 3154 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 3155 output_999 ; print ppO2 (0.00-9.99) | |
| 3156 bra TFT_message_close ; finalize message output | |
| 3157 | |
| 3158 | |
| 3159 ;----------------------------------------------------------------------------- | |
| 3160 ; Dive Mode - Message - Battery | |
| 3161 ; | |
| 3162 global TFT_message_battery_percent | |
| 3163 TFT_message_battery_percent: | |
| 3164 rcall TFT_message_open ; set row and column for the message | |
| 604 | 3165 tstfsz WREG ; is there room for the message? |
| 631 | 3166 return ; NO - skip message in this cycle |
| 634 | 3167 |
| 3168 call TFT_color_code_battery ; color-code according to battery_low_condition flag | |
| 3169 STRCPY "Batt:" ; print "Batt:" | |
| 3170 bsf leftbind ; print left-aligned | |
| 3171 movff batt_percent,lo ; get battery % | |
| 3172 output_256 ; print battery % (0-255) | |
| 3173 PUTC "%" ; print "%" | |
| 3174 bra TFT_message_close ; finalize message output | |
| 3175 | |
| 3176 | |
| 3177 ;----------------------------------------------------------------------------- | |
| 3178 ; Dive Mode - Message - current CNS | |
| 3179 ; | |
| 3180 global TFT_message_cns | |
| 3181 TFT_message_cns: | |
| 3182 call TFT_message_open ; set row and column for the message | |
| 604 | 3183 tstfsz WREG ; is there room for the message? |
| 631 | 3184 return ; NO - skip message in this cycle |
| 634 | 3185 |
| 3186 MOVII int_O_CNS_current,mpr ; get current CNS | |
| 3187 call TFT_color_code_cns ; color-code CNS output | |
| 3188 STRCPY_TEXT tCNS ; CNS: | |
| 3189 bsf leftbind ; print left-aligned | |
| 3190 output_999 ; print (0-999) | |
| 3191 PUTC "%" ; append unit | |
| 3192 bra TFT_message_close ; finalize message output | |
| 3193 | |
| 3194 | |
| 3195 ;----------------------------------------------------------------------------- | |
| 3196 ; Dive Mode - Message - End-of-Dive CNS | |
| 3197 ; | |
| 3198 global TFT_message_cns_eod | |
| 3199 TFT_message_cns_eod: | |
| 3200 call TFT_message_open ; set row and column for the message | |
| 623 | 3201 tstfsz WREG ; is there room for the message? |
| 631 | 3202 return ; NO - skip message in this cycle |
| 634 | 3203 |
| 3204 FONT_COLOR_WARNING ; switch to warnings (red) text color | |
| 3205 STRCPY_TEXT tCNSeod ; end-of-dive CNS warning text | |
| 3206 bra TFT_message_close ; finalize message output | |
| 3207 | |
| 3208 | |
| 3209 ;----------------------------------------------------------------------------- | |
| 3210 ; Dive Mode - Message - Saturation | |
| 3211 ; | |
| 3212 global TFT_message_saturation | |
| 650 | 3213 TFT_message_saturation: |
| 634 | 3214 rcall TFT_message_open ; set row and column for the message |
| 604 | 3215 tstfsz WREG ; is there room for the message? |
| 631 | 3216 return ; NO - skip message in this cycle |
| 634 | 3217 |
| 3218 MOVII int_O_lead_supersat,mpr ; get leading tissue's supersaturation | |
| 3219 call TFT_color_code_supersat ; color-code output | |
| 3220 STRCPY_TEXT tSAT ; print "Sat:" | |
| 3221 PUTC " " ; add a space to align the output with other warnings' outputs | |
| 3222 bsf leftbind ; print left-aligned | |
| 3223 output_256 ; print value of lo only, int_O_lead_supersat is limited to 255 | |
| 3224 PUTC "%" ; print "%" | |
| 3225 bra TFT_message_close ; finalize message output | |
| 3226 | |
| 3227 | |
| 3228 ;----------------------------------------------------------------------------- | |
| 3229 ; Dive Mode - Message - alternative GF | |
| 3230 ; | |
| 3231 global TFT_message_agf | |
| 3232 TFT_message_agf: | |
| 3233 rcall TFT_message_open ; set row and column for the message | |
| 604 | 3234 tstfsz WREG ; is there room for the message? |
| 631 | 3235 return ; NO - skip message in this cycle |
| 634 | 3236 |
| 3237 FONT_COLOR_ATTENTION ; set attention color | |
| 3238 STRCPY_TEXT tDiveaGF_active ; print "aGF!" | |
| 3239 bra TFT_message_close ; finalize message output | |
| 3240 | |
| 3241 | |
| 3242 ;----------------------------------------------------------------------------- | |
| 3243 ; Dive Mode - Message - Dive Timeout | |
| 3244 ; | |
| 3245 global TFT_message_divetimeout | |
| 3246 TFT_message_divetimeout: | |
| 3247 call TFT_message_open ; set row and column for the message | |
| 604 | 3248 tstfsz WREG ; is there room for the message? |
| 631 | 3249 return ; NO - skip message in this cycle |
| 634 | 3250 |
| 3251 FONT_COLOR_MEMO ; select color | |
| 3252 STRCPY 0x94 ; "End of dive" symbol (up-arrow) | |
| 3253 movff opt_diveTimeout,WREG ; get timeout in minutes | |
| 3254 mullw .60 ; get timeout in seconds | |
| 3255 MOVII PRODL, sub_a ; calculate timeout - elapsed time = countdown | |
| 3256 MOVII dive_timeout_timer,sub_b ; ... | |
| 3257 call subU16 ; ... | |
| 3258 MOVII sub_c,mpr ; transfer to mpr | |
| 3259 call convert_time ; convert hi:lo in seconds to minutes (up:hi) and seconds (lo) | |
| 3260 movff lo,up ; back-up lo | |
| 3261 movff hi,lo ; get minutes | |
| 3262 output_99 ; print minutes (0-99) | |
| 3263 PUTC ':' ; print ":" | |
| 3264 movff up,lo ; get seconds | |
| 3265 output_99x ; print seconds (00-99) | |
| 3266 movlw dm_warning_length ; get dive mode string length | |
| 3267 rcall TFT_buffer_trim_length ; fill / cut buffer to target length | |
| 3268 PRINT ; dump to screen | |
| 3269 return ; done | |
| 3270 | |
| 3271 | |
| 3272 ;----------------------------------------------------------------------------- | |
| 3273 ; Dive Mode - Message - Gas Needs | |
| 3274 ; | |
| 3275 global TFT_message_gas_needs | |
| 3276 TFT_message_gas_needs: | |
| 3277 rcall TFT_message_open ; set row and column for the message | |
| 604 | 3278 tstfsz WREG ; is there room for the message? |
| 634 | 3279 return ; NO - skip message in this cycle |
| 3280 | |
| 3281 btfsc attn_det_gas_needs ; attention? | |
| 3282 FONT_COLOR_ATTENTION ; YES - set attention color | |
| 3283 btfsc warn_det_gas_needs ; warning? | |
| 3284 FONT_COLOR_WARNING ; YES - set warning color | |
| 3285 STRCPY_TEXT tGasNeedsWarn ; print "Gas Needs" | |
| 3286 bra TFT_message_close ; finalize message output | |
| 3287 | |
| 3288 | |
| 3289 ;----------------------------------------------------------------------------- | |
| 3290 ; Dive Mode - Message - Gas Change | |
| 3291 ; | |
| 3292 global TFT_message_gas_change | |
| 3293 TFT_message_gas_change: | |
| 3294 rcall TFT_message_open ; set row and column for the message | |
| 604 | 3295 tstfsz WREG ; is there room for the message? |
| 634 | 3296 return ; NO - skip message in this cycle |
| 3297 | |
| 3298 FONT_COLOR_ADVICE ; set advice color | |
| 3299 STRCPY_TEXT tgaschange ; print "Change?" | |
| 3300 bra TFT_message_close ; finalize message output | |
| 3301 | |
| 3302 | |
| 3303 ;----------------------------------------------------------------------------- | |
| 3304 ; Dive Mode - Message - no Bailout Gas | |
| 3305 ; | |
| 3306 global TFT_message_no_BO_gas | |
| 3307 TFT_message_no_BO_gas: | |
| 3308 rcall TFT_message_open ; set row and column for the message | |
| 3309 tstfsz WREG ; is there room for the message? | |
| 3310 return ; NO - skip message in this cycle | |
| 3311 | |
| 3312 FONT_COLOR_WARNING ; set warning color | |
| 3313 STRCPY_TEXT tnoBOgas ; print "-B/O-Gas-" | |
| 3314 bra TFT_message_close ; finalize message output | |
| 3315 | |
| 3316 | |
| 3317 ;----------------------------------------------------------------------------- | |
| 3318 ; Message - open Message | |
| 3319 ; | |
| 3320 ; sets the row and column for the current message | |
| 3321 ; | |
| 3322 TFT_message_open: | |
| 582 | 3323 ; ignore warning (now)? |
| 623 | 3324 decf message_counter,W ; load (message counter - 1) into WREG |
| 3325 bcf STATUS,C ; clear carry bit | |
| 3326 btfss alt_layout_active ; in alternative layout? | |
| 3327 rrcf WREG,W ; NO - divide (message_counter-1) by 2 to get the page of the message | |
| 3328 cpfseq message_page ; page of the message = current page ? | |
| 3329 retlw .255 ; NO - do not show in this cycle (message window is not defined) | |
| 3330 btfss divemode ; YES - in dive mode? | |
| 3331 bra TFT_set_message_window_sf ; NO - setup for surface mode | |
| 3332 ;bra TFT_set_message_window_dm ; YES - setup for dive mode | |
| 3333 | |
| 3334 ; Dive Mode | |
| 3335 TFT_set_message_window_dm: | |
| 634 | 3336 btfsc alt_layout_active ; in alternative layout? |
| 3337 bra TFT_set_message_window_dm_row2 ; YES - alternative layout only uses 2nd row | |
| 3338 btfss message_counter,0 ; NO - is the message number uneven? | |
| 3339 bra TFT_set_message_window_dm_row2 ; NO - use 2nd row | |
| 3340 ;bra TFT_set_message_window_dm_row1 ; YES - use 1st row | |
| 623 | 3341 |
| 3342 TFT_set_message_window_dm_row1: | |
| 634 | 3343 WIN_SMALL dm_warning1_column, dm_warning1_row |
| 3344 bcf message_2nd_row_used ; flag that the 2nd does not contain a message yet | |
| 3345 retlw .0 ; show in this cycle (message window is defined) | |
| 623 | 3346 |
| 3347 TFT_set_message_window_dm_row2: | |
| 634 | 3348 WIN_SMALL dm_warning2_column, dm_warning2_row |
| 3349 bsf message_2nd_row_used ; flag that the 2nd row contains a message now | |
| 3350 retlw .0 ; show in this cycle (message window is defined) | |
| 623 | 3351 |
| 3352 ; Surface Mode | |
| 3353 TFT_set_message_window_sf: | |
| 634 | 3354 btfss message_counter,0 ; is the message counter uneven? |
| 3355 bra TFT_set_message_window_sf_row2 ; NO - use 2nd row | |
| 3356 ;bra TFT_set_message_window_sf_row1 ; YES - use 1st row | |
| 623 | 3357 |
| 3358 TFT_set_message_window_sf_row1: | |
| 634 | 3359 WIN_SMALL surf_warning1_column,surf_warning1_row |
| 3360 bcf message_2nd_row_used ; flag that the 2nd row does not contain a message yet | |
| 3361 retlw .0 ; show in this cycle (message window is defined) | |
| 623 | 3362 |
| 3363 TFT_set_message_window_sf_row2: | |
| 634 | 3364 WIN_SMALL surf_warning2_column,surf_warning2_row |
| 3365 bsf message_2nd_row_used ; flag that the 2nd row contains a message now | |
| 3366 retlw .0 ; show in this cycle (message window is defined) | |
| 3367 | |
| 3368 | |
| 3369 ;----------------------------------------------------------------------------- | |
| 3370 ; Message - fill to a given Length, or cut if too long | |
| 3371 ; | |
| 3372 ; Input: buffer message | |
| 3373 ; WREG max length | |
| 3374 ; | |
| 3375 global TFT_buffer_trim_length | |
| 3376 TFT_buffer_trim_length: | |
| 3377 movwf lo ; copy max. string length to lo | |
| 3378 movf FSR2L,W ; get current string length to WREG | |
| 3379 subwf lo,F ; lo = max length - current length | |
| 3380 bn TFT_fillup_with_spaces_cut ; string too long -> cut string at max length | |
| 3381 bnz TFT_fillup_with_spaces_apnd ; string too short -> append spaces and string terminator | |
| 3382 bra TFT_fillup_with_spaces_term ; string at exact length -> append string terminator | |
| 3383 | |
| 3384 TFT_fillup_with_spaces_apnd: | |
| 3385 PUTC " " ; add one space | |
| 3386 decfsz lo,F ; all spaces done? | |
| 3387 bra TFT_fillup_with_spaces_apnd ; NO - loop | |
| 3388 bra TFT_fillup_with_spaces_term ; YES - append string terminator | |
| 3389 | |
| 3390 TFT_fillup_with_spaces_cut: | |
| 3391 movf lo,W ; get over-length (as negative number) into WREG | |
| 3392 addwf FSR2L,F ; set back buffer pointer to end of max length | |
| 3393 ;bra TFT_fillup_with_spaces_term ; append string terminator | |
| 3394 | |
| 3395 TFT_fillup_with_spaces_term: | |
| 3396 clrf INDF2 ; append string terminator | |
| 3397 return ; done | |
| 3398 | |
| 3399 | |
| 3400 ;----------------------------------------------------------------------------- | |
| 3401 ; Message - close Message | |
| 3402 ; | |
| 3403 TFT_message_close: | |
| 3404 movlw surf_warning_length ; get surface string length | |
| 3405 btfsc divemode ; in dive mode? | |
| 3406 movlw dm_warning_length ; YES - replace by dive mode string length | |
| 3407 rcall TFT_buffer_trim_length ; fill / cut buffer to target length | |
| 3408 PRINT ; dump to screen | |
| 3409 return ; done | |
| 3410 | |
| 3411 | |
| 3412 ;----------------------------------------------------------------------------- | |
| 3413 ; Dive Mode - Message - Micro-Bubbles | |
| 3414 ; | |
| 3415 global TFT_message_mbubbles | |
| 3416 TFT_message_mbubbles: | |
| 3417 rcall TFT_message_open ; set row and column for the message | |
| 604 | 3418 tstfsz WREG ; is there room for the message? |
| 634 | 3419 return ; NO - skip message in this cycle |
| 3420 | |
| 3421 FONT_COLOR_ATTENTION ; set attention color as default | |
| 3422 movff char_O_deco_warnings,WREG ; bank-safe copy for deco warnings | |
| 3423 btfsc WREG,mbubble_warning ; currently in the micro bubbles zone? | |
| 3424 FONT_COLOR_WARNING ; YES - reconfigure to warning color | |
| 3425 STRCPY_TEXT tMicroBubbles ; print message text | |
| 3426 bra TFT_message_close ; finalize message output | |
| 3427 | |
| 3428 | |
| 3429 ;----------------------------------------------------------------------------- | |
| 3430 ; Dive Mode - Message - Outside Buhlmann Model | |
| 3431 ; | |
| 3432 global TFT_message_outside | |
| 3433 TFT_message_outside: | |
| 3434 rcall TFT_message_open ; set row and column for the message | |
| 3435 tstfsz WREG ; is there room for the message? | |
| 3436 return ; NO - skip message in this cycle | |
| 3437 | |
| 3438 FONT_COLOR_ATTENTION ; set attention color | |
| 3439 movff char_O_deco_warnings,WREG ; bank-safe copy for deco warnings | |
| 3440 btfsc WREG,outside_warning ; currently outside the ZH-L16 model? | |
| 3441 FONT_COLOR_WARNING ; YES - reconfigure to warning color | |
| 3442 STRCPY "X-ZHL16-X" ; print message text | |
| 3443 bra TFT_message_close ; finalize message output | |
| 3444 | |
| 3445 | |
| 3446 ;----------------------------------------------------------------------------- | |
| 3447 ; Dive Mode - Message - Depth Limit | |
| 3448 ; | |
| 3449 global TFT_message_depth_limit | |
| 3450 TFT_message_depth_limit: | |
| 3451 rcall TFT_message_open ; set row and column for the message | |
| 3452 tstfsz WREG ; is there room for the message? | |
| 3453 return ; NO - skip message in this cycle | |
| 3454 | |
| 3455 FONT_COLOR_WARNING ; set warning color | |
| 3456 STRCPY_TEXT tMaxDepth ; print "max.Depth" | |
| 3457 bra TFT_message_close ; finalize message output | |
| 3458 | |
| 3459 | |
| 3460 ;----------------------------------------------------------------------------- | |
| 3461 ; Dive Mode - Message - Deco Info | |
| 3462 ; | |
| 3463 global TFT_message_deco_info | |
| 650 | 3464 TFT_message_deco_info: |
| 634 | 3465 rcall TFT_message_open ; set row and column for the message |
| 3466 tstfsz WREG ; is there room for the message? | |
| 3467 return ; NO - skip message in this cycle | |
| 3468 | |
| 3469 FONT_COLOR_ADVICE ; actually it is a memo, but we break the rules here and display in advice color (green) | |
| 3470 STRCPY_TEXT tDecoInfo ; write "Deco Zone" | |
| 3471 bra TFT_message_close ; finalize message output | |
| 3472 | |
| 3473 | |
| 3474 IFDEF _helium | |
| 3475 | |
| 3476 ;----------------------------------------------------------------------------- | |
| 3477 ; Dive Mode - Message - IBCD | |
| 3478 ; | |
| 3479 global TFT_message_IBCD | |
| 3480 TFT_message_IBCD: | |
| 3481 rcall TFT_message_open ; set row and column for the message | |
| 3482 tstfsz WREG ; is there room for the message? | |
| 3483 return ; NO - skip message in this cycle | |
| 3484 | |
| 3485 FONT_COLOR_ATTENTION ; set attention color | |
| 3486 STRCPY_TEXT tIBCD ; Print "IBCD N2He" | |
| 3487 bra TFT_message_close ; finalize message output | |
| 3488 | |
| 3489 ENDIF ; _helium | |
| 623 | 3490 |
| 3491 IFDEF _ccr_pscr | |
| 604 | 3492 |
| 634 | 3493 ;----------------------------------------------------------------------------- |
| 3494 ; Dive Mode - Message - Gas Density | |
| 3495 ; | |
| 3496 global TFT_message_gas_density | |
| 3497 TFT_message_gas_density: | |
| 3498 rcall TFT_message_open ; set row and column for the message | |
| 3499 tstfsz WREG ; is there room for the message? | |
| 3500 return ; NO - skip message in this cycle | |
| 3501 | |
| 3502 btfsc attn_det_gas_density ; on attention level? | |
| 3503 FONT_COLOR_ATTENTION ; YES - set attention color | |
| 3504 btfsc warn_det_gas_density ; on warning level? | |
| 3505 FONT_COLOR_WARNING ; YES set warning color | |
| 3506 STRCPY_TEXT tGasDensity ; print "G.Density" | |
| 3507 bra TFT_message_close ; finalize message output | |
| 3508 | |
| 3509 ENDIF ; _ccr_pscr | |
| 3510 | |
| 656 | 3511 IFDEF _external_sensor_eccr |
| 634 | 3512 |
| 3513 ;----------------------------------------------------------------------------- | |
| 3514 ; Dive Mode - Message - Sensor ppO2 Divergence | |
| 3515 ; | |
| 3516 global TFT_message_divergence | |
| 3517 TFT_message_divergence: | |
| 3518 rcall TFT_message_open ; set row and column for the message | |
| 3519 tstfsz WREG ; is there room for the message? | |
| 3520 return ; NO - skip message in this cycle | |
| 3521 | |
| 3522 FONT_COLOR_WARNING ; set warning color | |
| 3523 STRCPY_TEXT tSensorDisagree ; print "Sensors<>" | |
| 3524 bra TFT_message_close ; finalize message output | |
| 3525 | |
| 3526 | |
| 3527 ;----------------------------------------------------------------------------- | |
| 3528 ; Dive Mode - Message - Fallback | |
| 3529 ; | |
| 3530 global TFT_message_fallback | |
| 3531 TFT_message_fallback: | |
| 3532 rcall TFT_message_open ; set row and column for the message | |
| 3533 tstfsz WREG ; is there room for the message? | |
| 3534 return ; NO - skip message in this cycle | |
| 3535 | |
| 3536 FONT_COLOR_WARNING ; set warning color | |
| 3537 STRCPY_TEXT tDiveFallback ; print "Fallback!" | |
| 3538 bra TFT_message_close ; finalize message output | |
| 3539 | |
| 656 | 3540 ENDIF ; _external_sensor_eccr |
| 634 | 3541 |
| 3542 IFDEF _rx_functions | |
| 3543 | |
| 3544 ;----------------------------------------------------------------------------- | |
| 3545 ; Dive Mode - Message - TR - Transmitter | |
| 3546 ; | |
| 3547 global TFT_message_transmitter | |
| 3548 TFT_message_transmitter: | |
| 3549 rcall TFT_message_open ; set row and column for the message | |
| 3550 tstfsz WREG ; is there room for the message? | |
| 3551 return ; NO - skip message in this cycle | |
| 3552 | |
| 3553 FONT_COLOR_ATTENTION ; set attention color | |
| 3554 STRCPY_TEXT tTransmitter ; print "P.Transm." | |
| 3555 bra TFT_message_close ; finalize message output | |
| 3556 | |
| 3557 | |
| 3558 ;----------------------------------------------------------------------------- | |
| 3559 ; Dive Mode - Message - TR - Pressure | |
| 3560 ; | |
| 3561 global TFT_message_pressure | |
| 3562 TFT_message_pressure: | |
| 3563 rcall TFT_message_open ; set row and column for the message | |
| 3564 tstfsz WREG ; is there room for the message? | |
| 3565 return ; NO - skip message in this cycle | |
| 3566 | |
| 3567 btfsc attn_det_pressure1 ; on attention level - pressure 1 ? | |
| 3568 FONT_COLOR_ATTENTION ; YES - set attention color | |
| 3569 btfsc attn_det_pressure2 ; on attention level - pressure 2 ? | |
| 3570 FONT_COLOR_ATTENTION ; YES - set attention color | |
| 3571 btfsc warn_det_pressure1 ; on warning level - pressure 1 ? | |
| 3572 FONT_COLOR_WARNING ; YES - set warning color | |
| 3573 btfsc warn_det_pressure2 ; on warning level - pressure 2 ? | |
| 3574 FONT_COLOR_WARNING ; YES - set warning color | |
| 3575 STRCPY_TEXT tPressure ; print "Tank Pres" | |
| 3576 bra TFT_message_close ; finalize message output | |
| 3577 | |
| 3578 | |
| 3579 ;----------------------------------------------------------------------------- | |
| 3580 ; Dive Mode - Message - TR - SAC | |
| 3581 ; | |
| 3582 global TFT_message_sac | |
| 3583 TFT_message_sac: | |
| 3584 rcall TFT_message_open ; set row and column for the message | |
| 3585 tstfsz WREG ; is there room for the message? | |
| 3586 return ; NO - skip message in this cycle | |
| 3587 | |
| 3588 MOVII int_O_SAC_measured,mpr ; copy measured SAC rate to hi:lo | |
| 3589 call TFT_color_code_pres_sac ; color-code the output | |
| 3590 STRCPY_TEXT tSAC ; print "SAC" (needs to be exactly 3 chars long) | |
| 3591 STRCAT ": " ; print ": " | |
| 3592 bsf decimal_digit1 ; place a decimal point in front of digit 1 | |
| 3593 output_999 ; print (0.0-99.9) | |
| 3594 bra TFT_message_close ; finalize message output | |
| 3595 | |
| 3596 | |
| 3597 ;----------------------------------------------------------------------------- | |
| 3598 ; Dive Mode - Message - TR - switch Tank Advice | |
| 3599 ; | |
| 3600 global TFT_message_switch_tanks | |
| 3601 TFT_message_switch_tanks: | |
| 3602 rcall TFT_message_open ; set row and column for the message | |
| 3603 tstfsz WREG ; is there room for the message? | |
| 3604 return ; NO - skip message in this cycle | |
| 3605 | |
| 3606 FONT_COLOR_ADVICE ; set advice color | |
| 3607 STRCPY_TEXT tswap ; print "Swap Tank" | |
| 3608 bra TFT_message_close ; finalize message output | |
| 3609 | |
| 3610 ENDIF ; _rx_functions | |
| 3611 | |
| 3612 IFDEF _cave_mode | |
| 3613 | |
| 3614 ;----------------------------------------------------------------------------- | |
| 3615 ; Dive Mode - Message - Cave Mode | |
| 3616 ; | |
| 3617 global TFT_message_cave_mode | |
| 3618 TFT_message_cave_mode: | |
| 3619 rcall TFT_message_open ; set row and column for the message | |
| 3620 tstfsz WREG ; is there room for the message? | |
| 3621 return ; NO - skip message in this cycle | |
| 3622 | |
| 3623 btfss attn_det_cave_shut_down ; on attention level? | |
| 3624 bra TFT_message_cave_mode_1 ; NO | |
| 3625 FONT_COLOR_ATTENTION ; YES - select attention color | |
| 3626 bra TFT_message_cave_mode_sd ; - print shutdown message | |
| 3627 | |
| 3628 TFT_message_cave_mode_1: | |
| 3629 btfss warn_det_cave_shut_down ; on warning level? | |
| 3630 bra TFT_message_cave_mode_info ; NO | |
| 3631 FONT_COLOR_WARNING ; YES - select warning color | |
| 3632 ;bra TFT_message_cave_mode_sd ; - print shutdown message | |
| 3633 | |
| 3634 TFT_message_cave_mode_sd: | |
| 3635 STRCPY_TEXT tCaveModeShutdown ; print "X-Cave-X" | |
| 3636 bra TFT_message_close ; finalize message output | |
| 3637 | |
| 3638 TFT_message_cave_mode_info: | |
| 3639 FONT_COLOR_MEMO ; set memo color | |
| 3640 bsf win_invert ; print in inverse | |
| 3641 STRCPY_TEXT tCaveMode ; write "Cave Mode" | |
| 3642 bra TFT_message_close ; finalize message output | |
| 3643 | |
| 3644 ENDIF ; _cave_mode | |
| 3645 | |
| 623 | 3646 |
| 3647 ;============================================================================= | |
| 634 | 3648 tft_out13 CODE |
| 623 | 3649 ;============================================================================= |
| 3650 | |
| 654 | 3651 ;----------------------------------------------------------------------------- |
| 3652 ; Surface Custom View - DESAT, NoFly, CNS | |
| 3653 ; | |
| 3654 | |
| 3655 global TFT_surf_desat_nofly_cns | |
| 3656 TFT_surf_desat_nofly_cns: | |
| 656 | 3657 FONT_COLOR color_green ; set menu title font color |
| 3658 WIN_TINY surf_gaslist_column,surf_gaslist_row+.5 | |
| 3659 STRCPY_PRINT "Desat:" ; print label | |
| 3660 FONT_COLOR_MEMO ; select color | |
| 3661 WIN_SMALL surf_gaslist_column+.56,surf_gaslist_row | |
| 3662 MOVII int_O_desaturation_time,mpr ; get desaturation time in minutes | |
| 3663 rcall TFT_surf_desat_nofly_cns_helper | |
| 3664 | |
| 3665 FONT_COLOR color_green ; set menu title font color | |
| 3666 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1)+.5 | |
| 3667 movff char_I_altitude_wait,WREG ; get mode | |
| 3668 tstfsz WREG ; mode = altitude? | |
| 3669 bra TFT_surf_desat_nofly_cns_noalt ; YES | |
| 3670 ;bra TFT_nofly_time_fly ; NO | |
| 3671 | |
| 3672 TFT_surf_desat_nofly_cns_nofly: | |
| 3673 STRCPY_PRINT "NoFly:" ; print no-fly label | |
| 3674 FONT_COLOR_MEMO ; select color | |
| 3675 WIN_SMALL surf_gaslist_column+.56,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
| 3676 MOVII int_O_nofly_time,mpr ; get no-fly time in minutes | |
| 3677 rcall TFT_surf_desat_nofly_cns_helper | |
| 3678 bra TFT_surf_desat_nofly_cns2 ; continue | |
| 3679 | |
| 3680 TFT_surf_desat_nofly_cns_noalt: | |
| 3681 STRCPY_PRINT "NoAlt:" ; print no-altitude label | |
| 3682 FONT_COLOR_MEMO ; select color | |
| 3683 WIN_SMALL surf_gaslist_column+.56,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
| 3684 rcall TFT_surf_desat_nofly_cns_helper | |
| 3685 ;bra TFT_surf_desat_nofly_cns2 ; continue | |
| 3686 | |
| 3687 TFT_surf_desat_nofly_cns2: | |
| 3688 FONT_COLOR color_green ; set menu title font color | |
| 3689 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)+.5 | |
| 3690 STRCPY_PRINT "CNS:" ; print label | |
| 3691 FONT_COLOR_MEMO ; select color | |
| 3692 WIN_SMALL surf_gaslist_column+.62,surf_gaslist_row+(surf_gaslist_spacing*.2) | |
| 3693 MOVII int_O_CNS_current,mpr ; get current CNS | |
| 3694 call TFT_color_code_cns ; color-code CNS value | |
| 3695 output_999 ; print (0-999) | |
| 3696 PUTC_PRINT "%" ; append unit and dump to screen | |
| 3697 return | |
| 3698 | |
| 3699 TFT_surf_desat_nofly_cns_helper: | |
| 3700 call convert_time ; convert hi:lo in minutes to hours (up:hi) and minutes (lo) | |
| 3701 movff lo,up ; backup lo | |
| 3702 movff hi,lo ; get hours into lo | |
| 3703 output_99 ; print hours (0-99) | |
| 3704 PUTC ':' ; print ":" | |
| 3705 movff up,lo ; get minutes into lo | |
| 3706 output_99x ; print minutes (00-99) | |
| 3707 PRINT | |
| 3708 return | |
| 654 | 3709 |
| 634 | 3710 ;----------------------------------------------------------------------------- |
| 3711 ; Surface Custom View - Last Dive Summery | |
| 3712 ; | |
| 3713 global TFT_surf_cv_lastdive | |
| 3714 TFT_surf_cv_lastdive: | |
| 656 | 3715 FONT_COLOR color_green ; set menu title font color |
| 3716 | |
| 582 | 3717 WIN_TINY surf_gaslist_column,surf_gaslist_row+.5 |
| 634 | 3718 STRCAT_TEXT_PRINT tLastDive ; "Last Dive:" |
| 3719 | |
| 582 | 3720 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1)+.5 |
| 634 | 3721 STRCAT_TEXT_PRINT tDivetime ; "Divetime:" |
| 3722 | |
| 582 | 3723 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)+.5 |
| 634 | 3724 STRCAT_TEXT_PRINT tMaxDepth ; "Max.Depth" |
| 3725 | |
| 623 | 3726 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3)+.5 |
| 634 | 3727 STRCAT_TEXT_PRINT tAvgDepth ; "Average" |
| 623 | 3728 |
| 656 | 3729 FONT_COLOR_MEMO ; set color |
| 582 | 3730 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row |
| 634 | 3731 SMOVII int_O_desaturation_time,mpr ; ISR-safe copy of the desaturation time |
| 3732 movf mpr+0,W ; get low byte into WREG | |
| 3733 iorwf mpr+1,W ; inclusive-or with high byte, check if desaturation time is zero | |
| 3734 bz TFT_surface_lastdive_2 ; YES - show last dive time | |
| 3735 ;bra TFT_surface_lastdive_1 ; NO - show surface interval | |
| 3736 | |
| 560 | 3737 TFT_surface_lastdive_1: |
| 634 | 3738 ; surface interval |
| 3739 SMOVII surface_interval_mins,mpr ; ISR-safe copy of surface interval in minutes | |
| 3740 call convert_time ; convert hi:lo in minutes to hours (up:hi) and minutes (lo) | |
| 3741 movff lo,up ; back-up low | |
| 3742 movff hi,lo ; get hours | |
| 3743 output_99 ; print hours (0-99) | |
| 3744 PUTC 'h' ; append hours unit | |
| 3745 movff up,lo ; get minutes | |
| 3746 output_99x ; print minutes (00-99) | |
| 3747 PUTC_PRINT "m" ; append minutes unit and dump to screen | |
| 3748 bra TFT_surface_lastdive_com ; continue | |
| 3749 | |
| 560 | 3750 TFT_surface_lastdive_2: |
| 634 | 3751 ; last dive time |
| 3752 SMOVQQ surface_interval_secs,xC ; ISR-safe copy of surface_interval_secs:4 to xC:4 | |
| 3753 call output_secs_as_days_hours ; print seconds as days and hours | |
| 3754 PRINT ; dump to screen | |
| 3755 ;bra TFT_surface_lastdive_com ; continue | |
| 3756 | |
| 3757 TFT_surface_lastdive_com: | |
| 3758 ; last dive duration | |
| 582 | 3759 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.1) |
| 634 | 3760 MOVII lastdive_duration,mpr ; get duration of last dive, minutes |
| 3761 output_999 ; print minutes | |
| 3762 PUTC ":" ; print ":" | |
| 3763 movff lastdive_duration+2,lo ; get duration of last dive, seconds | |
| 3764 output_99x ; print seconds | |
| 3765 PRINT ; dump to screen | |
| 3766 | |
| 3767 ; last dive max depth | |
| 582 | 3768 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.2) |
| 634 | 3769 MOVII lastdive_maxdepth,mpr ; get max depth of last dive |
| 3770 rcall TFT_surface_lastdive_depth ; print depth | |
| 3771 | |
| 3772 ; average depth | |
| 623 | 3773 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.3) |
| 634 | 3774 MOVII lastdive_avgdepth,mpr ; get avg depth of last dive |
| 3775 ;bra TFT_surface_lastdive_depth ; print depth and return | |
| 3776 | |
| 3777 ; Helper Function - print depth | |
| 3778 TFT_surface_lastdive_depth: | |
| 3779 TSTOSS opt_units ; 0=Meter, 1=Feet | |
| 3780 bra TFT_surface_lastdive_m ; 0 - metric | |
| 3781 ;bra TFT_surface_lastdive_ft ; 1 - imperial | |
| 3782 | |
| 3783 TFT_surface_lastdive_ft: | |
| 3784 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] | |
| 3785 output_999 ; print (0-999) | |
| 3786 STRCAT_TEXT tFeets1 ; "ft" | |
| 3787 PRINT ; dump to screen | |
| 3788 return ; done | |
| 3789 | |
| 3790 TFT_surface_lastdive_m: | |
| 3791 bsf omit_digit_1 ; do not print 1st digit | |
| 3792 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 3793 output_65535 ; print (0.0x-655.3x) | |
| 3794 STRCAT_TEXT tMeters ; "m" | |
| 3795 PRINT ; dump to screen | |
| 3796 return ; done | |
| 3797 | |
| 3798 | |
| 3799 ;----------------------------------------------------------------------------- | |
| 3800 ; Surface Custom View - OC Gas List | |
| 3801 ; | |
| 3802 global TFT_surf_cv_list_gas | |
| 3803 TFT_surf_cv_list_gas: | |
| 3804 clrf WREG ; do OC gases (0-4) | |
| 3805 ;bra TFT_surf_cv_list_gas_common ; continue with common part | |
| 3806 | |
| 3807 ; common list for OC gases and diluents | |
| 3808 TFT_surf_cv_list_gas_common: | |
| 3809 movwf gaslist_gas ; set first gas/dil to show | |
| 3810 FONT_COLOR_MEMO ; set color | |
| 3811 | |
| 3812 bsf short_gas_descriptions ; use short versions of gaslist_strcat_gas and gaslist_strcat_setpoint | |
| 3813 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) | |
| 3814 | |
| 3815 ; Gas 1 | |
| 3816 WIN_SMALL surf_gaslist_column,surf_gaslist_row | |
| 3817 call gaslist_strcat_gas ; print gas description | |
| 3818 PRINT ; dump to screen | |
| 3819 | |
| 3820 ; Gas 2 | |
| 3821 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
| 3822 incf gaslist_gas,F ; select next gas/dil | |
| 3823 call gaslist_strcat_gas ; print gas description | |
| 3824 PRINT ; dump to screen | |
| 3825 | |
| 3826 ; Gas 3 | |
| 3827 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) | |
| 3828 incf gaslist_gas,F ; select next gas/dil | |
| 3829 call gaslist_strcat_gas ; print gas description | |
| 3830 PRINT ; dump to screen | |
| 3831 | |
| 3832 ; Gas 4 | |
| 3833 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3) | |
| 3834 incf gaslist_gas,F ; select next gas/dil | |
| 3835 call gaslist_strcat_gas ; print gas description | |
| 3836 PRINT ; dump to screen | |
| 3837 | |
| 3838 ; Gas 5 | |
| 3839 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) | |
| 3840 incf gaslist_gas,F ; select next gas/dil | |
| 3841 call gaslist_strcat_gas ; print gas description | |
| 3842 PRINT ; dump to screen | |
| 3843 | |
| 3844 return ; done | |
| 3845 | |
| 3846 | |
| 3847 ;----------------------------------------------------------------------------- | |
| 3848 ; Surface Custom View - Custom Text | |
| 3849 ; | |
| 3850 global TFT_surf_cv_text | |
| 3851 TFT_surf_cv_text: | |
| 3852 FONT_COLOR_MEMO ; set color | |
| 3853 | |
| 3854 ; 1st row | |
| 3855 WIN_SMALL surf_customtext_column,surf_customtext_row1 | |
| 3856 MOVRR opt_name+ .0,buffer,.12 ; copy 1st 12 chars to output buffer | |
| 3857 PRINT ; dump to screen | |
| 3858 | |
| 3859 ; 2nd row | |
| 3860 WIN_SMALL surf_customtext_column,surf_customtext_row2 | |
| 3861 MOVRR opt_name+.12,buffer,.12 ; copy 2nd 12 chars to output buffer | |
| 3862 PRINT ; dump to screen | |
| 3863 | |
| 3864 ; 3rd row | |
| 3865 WIN_SMALL surf_customtext_column,surf_customtext_row3 | |
| 3866 MOVRR opt_name+.24,buffer,.12 ; copy 3rd 12 chars to output buffer | |
| 3867 PRINT ; dump to screen | |
| 3868 | |
| 3869 ; 4th row | |
| 3870 WIN_SMALL surf_customtext_column,surf_customtext_row4 | |
| 3871 MOVRR opt_name+.36,buffer,.12 ; copy 4th 12 chars to output buffer | |
| 3872 PRINT ; dump to screen | |
| 3873 | |
| 3874 ; 5th row | |
| 3875 WIN_SMALL surf_customtext_column,surf_customtext_row5 | |
| 3876 MOVRR opt_name+.48,buffer,.12 ; copy 5th 12 chars to output buffer | |
| 3877 PRINT ; dump to screen | |
| 3878 | |
| 3879 return ; done | |
| 3880 | |
| 3881 | |
| 3882 ;----------------------------------------------------------------------------- | |
| 3883 ; Surface Custom View - Tissue Graphics | |
| 3884 ; | |
| 3885 global TFT_surf_cv_tissues | |
| 3886 TFT_surf_cv_tissues: | |
| 623 | 3887 |
| 3888 ; draw outer frame | |
| 3889 WIN_FRAME_STD surf_tissue_diagram_top, surf_tissue_diagram_bottom, surf_tissue_diagram_left, surf_tissue_diagram_right | |
| 3890 | |
| 634 | 3891 ; draw labels |
| 3892 FONT_COLOR_MEMO ; set color | |
| 582 | 3893 WIN_SMALL surf_tissue_N2_column,surf_tissue_N2_row |
| 623 | 3894 IFDEF _helium |
| 634 | 3895 btfss tissue_graphic_layout ; shall N2 and He? |
| 3896 bra TFT_surface_tissues_1 ; NO - print "Tissues" | |
| 3897 STRCPY_TEXT_PRINT tN2 ; YES - print "N2" | |
| 582 | 3898 WIN_SMALL surf_tissue_He_column,surf_tissue_He_row |
| 634 | 3899 STRCPY_TEXT_PRINT tHe ; - print "He" |
| 3900 bra TFT_surface_tissues_2 ; - continue with common part | |
| 623 | 3901 ENDIF |
| 631 | 3902 |
| 623 | 3903 TFT_surface_tissues_1: |
| 634 | 3904 STRCPY_TEXT_PRINT tDiveTissues ; print "Tissues" |
| 631 | 3905 |
| 623 | 3906 TFT_surface_tissues_2: |
| 634 | 3907 ; draw scale |
| 623 | 3908 |
| 3909 SCALELINE macro x | |
| 634 | 3910 movlw color_deepblue |
| 3911 WIN_FRAME_COLOR surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,surf_tissue_diagram_left+.4+x,surf_tissue_diagram_left+.4+x | |
| 623 | 3912 endm |
| 3913 | |
| 3914 SCALELINE .0 | |
| 3915 SCALELINE .8 | |
| 3916 SCALELINE .16 | |
| 3917 SCALELINE .24 | |
| 3918 SCALELINE .32 | |
| 3919 SCALELINE .40 | |
| 3920 SCALELINE .48 | |
| 3921 SCALELINE .56 | |
| 3922 SCALELINE .64 | |
| 3923 SCALELINE .72 | |
| 3924 SCALELINE .80 | |
| 3925 | |
| 634 | 3926 ; common initialization for tissue pressures and saturation |
| 0 | 3927 movlw .1 |
| 634 | 3928 movwf win_height ; hight of the bargraph (0-239) |
| 3929 movlw surf_tissue_diagram_left+.4 ; left start position for N2 bars | |
| 3930 movwf win_leftx2 ; column left (0-159) | |
| 3931 movlw surf_tissue_diagram_right-surf_tissue_diagram_left-.4 ; get max width for N2 bars (78 pixel) | |
| 3932 movwf win_width+0 ; set width of the bar box | |
| 3933 clrf win_width+1 ; ... | |
| 3934 movlw color_white ; color for tissues not exceeding surface max pressure | |
| 3935 movwf ex ; store in ex | |
| 3936 movlw color_red ; color for tissues exceeding surface max pressure | |
| 3937 movwf ul ; store in ul | |
| 3938 bcf aux_flag ; draw tissue pressures by default | |
| 3939 | |
| 3940 ; draw combined or N2 tissue pressures | |
| 3941 lfsr FSR2,char_O_tissue_pressure ; load base address of combined pressures by default | |
| 623 | 3942 IFDEF _helium |
| 634 | 3943 btfsc tissue_graphic_layout ; shall show N2+He ? |
| 3944 lfsr FSR2,char_O_tissue_pres_N2 ; YES - replace with base address of N2 pressures | |
| 623 | 3945 ENDIF |
| 631 | 3946 btfsc tissue_graphic_mode ; in logbook mode? |
| 3947 lfsr FSR2,header_buffer+index_tissue_pres_total ; YES - replace with base address from logbook | |
| 623 | 3948 movlw d'16' |
| 634 | 3949 movwf lo ; tissue counter, 16 tissues |
| 3950 clrf hi ; row counter | |
| 623 | 3951 TFT_surf_tissues_N2_loop: |
| 634 | 3952 movlw surf_tissue_diagram_top+.23 ; surface mode top start position N2 |
| 3953 rcall TFT_surf_tissues_bargraph ; show one tissue | |
| 3954 movlw .2 ; bargraph spacing | |
| 3955 addwf hi,F ; increment row counter | |
| 3956 decfsz lo,F ; decrement tissue counter, done? | |
| 3957 bra TFT_surf_tissues_N2_loop ; NO - loop | |
| 623 | 3958 IFDEF _helium |
| 634 | 3959 btfsc tissue_graphic_layout ; shall show N2+He ? |
| 3960 bra TFT_surface_tissues_3 ; YES - show He tissue pressures | |
| 623 | 3961 ENDIF |
| 3962 | |
| 634 | 3963 ; draw tissue saturations |
| 623 | 3964 lfsr FSR2,char_O_tissue_saturation ; load base address of tissue supersaturation |
| 631 | 3965 btfsc tissue_graphic_mode ; in logbook mode? |
| 3966 lfsr FSR2,header_buffer+index_tissue_supersat ; YES - replace with base address from logbook | |
| 0 | 3967 movlw d'16' |
| 634 | 3968 movwf lo ; tissue counter, 16 tissues |
| 3969 clrf hi ; row counter | |
| 3970 movlw color_grey ; color for tissue saturation | |
| 3971 movwf ex ; store in ex | |
| 3972 ; movlw color_yellow ; 2nd color is not used by tissue saturation | |
| 3973 ; movwf ul ; ... | |
| 3974 bsf aux_flag ; draw tissue saturation | |
| 623 | 3975 TFT_surf_tissues_sat_loop: |
| 634 | 3976 movlw surf_tissue_diagram_top+.23+.57 ; surface mode top start position saturations |
| 3977 rcall TFT_surf_tissues_bargraph ; draw tissue bargraph | |
| 3978 movlw .2 ; bargraph spacing | |
| 3979 addwf hi,F ; increment row counter | |
| 3980 decfsz lo,F ; decrement tissue counter, done? | |
| 3981 bra TFT_surf_tissues_sat_loop ; NO - loop | |
| 3982 | |
| 3983 ; common part for vertical lines | |
| 3984 movlw surf_tissue_diagram_top+.23+.57 ; get top position | |
| 3985 movwf win_top ; set top position (0-239) | |
| 3986 movlw .30 ; get hight | |
| 3987 movwf win_height ; set height | |
| 3988 movlw .1 ; get width | |
| 3989 movwf win_width+0 ; set width, low byte | |
| 3990 clrf win_width+1 ; set width, high byte | |
| 3991 | |
| 3992 ; print 100% line | |
| 3993 movlw surf_tissue_diagram_left+.4+.64 ; get left position | |
| 3994 movwf win_leftx2 ; set left position (0-159) | |
| 3995 movlw color_red ; color for 100% line | |
| 3996 BOX_COLOR ; draw the line | |
| 623 | 3997 |
| 3998 ; GF factors enabled? | |
| 634 | 3999 btfss tissue_graphic_gf ; GF factors enabled? |
| 4000 bra TFT_surface_tissues_4 ; NO - continue with CNS | |
| 4001 | |
| 4002 ; print GF low line | |
| 4003 movlw surf_tissue_diagram_left+.4 ; get left base position | |
| 4004 movwf win_leftx2 ; set left base position (0-159) | |
| 4005 movff opt_GF_low,WREG ; get GF low in 0.01 % | |
| 4006 btfsc tissue_graphic_mode ; in logbook mode? | |
| 4007 movff header_buffer+index_gf_lo_hi+0,WREG ; YES - replace by GF low from logbook | |
| 4008 mullw .164 ; multiply with 164 | |
| 4009 movf PRODH,W ; divide by 256 -> resulting scale factor is 164/256 = 0.640625 | |
| 4010 addwf win_leftx2,F ; add to base position | |
| 4011 movlw color_green ; color for GF low line | |
| 4012 BOX_COLOR ; draw the line | |
| 4013 | |
| 4014 ; print GF high line | |
| 4015 movlw surf_tissue_diagram_left+.4 ; get left base position | |
| 4016 movwf win_leftx2 ; set left base position (0-159) | |
| 4017 movff opt_GF_high,WREG ; get GF high in 0.01 % | |
| 4018 btfsc tissue_graphic_mode ; in logbook mode? | |
| 4019 movff header_buffer+index_gf_lo_hi+1,WREG ; YES - replace by GF high from logbook | |
| 4020 mullw .164 ; multiply with 164 | |
| 4021 movf PRODH,W ; divide by 256 -> resulting scale factor is 164/256 = 0.640625 | |
| 4022 addwf win_leftx2,F ; add to base position | |
| 4023 movlw color_yellow ; color for GF high line | |
| 4024 BOX_COLOR ; draw the line | |
| 4025 bra TFT_surface_tissues_4 ; continue with CNS | |
| 623 | 4026 |
| 4027 IFDEF _helium | |
| 4028 TFT_surface_tissues_3: | |
| 634 | 4029 ; draw He tissue pressures |
| 4030 movlw surf_tissue_diagram_left+.4+.16 ; start position for He bars | |
| 4031 movwf win_leftx2 ; column left (0-159) | |
| 4032 movlw surf_tissue_diagram_right-surf_tissue_diagram_left-.4-.16 ; max width for He bars | |
| 4033 movwf win_width+0 ; set total width of the bar box | |
| 4034 clrf win_width+1 ; ... | |
| 4035 lfsr FSR2,char_O_tissue_pres_He ; load base address of He pressures | |
| 0 | 4036 movlw d'16' |
| 634 | 4037 movwf lo ; tissue counter, 16 tissues |
| 4038 clrf hi ; row counter | |
| 623 | 4039 TFT_surf_tissues_He_loop: |
| 634 | 4040 movlw surf_tissue_diagram_top+.23+.57 ; surface mode top start position He |
| 4041 rcall TFT_surf_tissues_bargraph ; show one tissue | |
| 4042 movlw .2 ; bargraph spacing | |
| 4043 addwf hi,F ; increment row counter | |
| 4044 decfsz lo,F ; decrement tissue counter, done? | |
| 4045 bra TFT_surf_tissues_He_loop ; NO - loop | |
| 623 | 4046 ENDIF |
| 4047 | |
| 4048 TFT_surface_tissues_4: | |
| 634 | 4049 btfss tissue_graphic_cns ; shall show CNS value? |
| 4050 return ; NO - done | |
| 4051 | |
| 4052 ; draw CNS% in-between tissue bars | |
| 4053 WIN_SMALL surf_tissue_He_column+.22,surf_tissue_He_row | |
| 654 | 4054 TFT_surface_tissues_5: |
| 634 | 4055 MOVII int_O_CNS_current,mpr ; get current CNS |
| 4056 call TFT_color_code_cns ; color-code CNS value | |
| 4057 STRCPY_TEXT tCNS2 ; "CNS: " | |
| 4058 bsf leftbind ; print left-aligned | |
| 4059 output_999 ; print (0-999) | |
| 4060 PUTC_PRINT "%" ; append unit and dump to screen | |
| 4061 return ; done | |
| 4062 | |
| 4063 | |
| 4064 ; Helper Function - draw a bargraph | |
| 623 | 4065 TFT_surf_tissues_bargraph: |
| 634 | 4066 addwf hi,W ; add row number to start position |
| 4067 movwf win_top ; set as row top (0-239) | |
| 4068 movff POSTINC2,up ; get tissue value | |
| 4069 movf ex,W ; default color | |
| 4070 btfsc up,7 ; check if flag in bit 7 is set | |
| 4071 movf ul,W ; YES - switch to 2nd color | |
| 4072 bcf up,7 ; clear flag bit | |
| 4073 btfss aux_flag ; drawing saturations? | |
| 4074 rlncf up,F ; NO - multiply with 2 (previously cleared bit 7 will be rotated to bit 0) | |
| 4075 movff up,win_bargraph ; set length of the bargraph | |
| 4076 incf win_bargraph,F ; add 1 for a minimum visible bar (He-bars could be invisible else-wise) | |
| 4077 BOX_COLOR ; draw bargraph with color in WREG | |
| 4078 return ; done | |
| 4079 | |
| 4080 | |
| 4081 ;----------------------------------------------------------------------------- | |
| 4082 ; Surface Custom View - Tissue Graphics | |
| 631 | 4083 ; |
| 634 | 4084 global TFT_surf_cv_settings |
| 4085 TFT_surf_cv_settings: | |
| 656 | 4086 FONT_COLOR color_green ; set menu title font color |
| 4087 | |
| 4088 WIN_TINY surf_gaslist_column,surf_gaslist_row+.5 | |
| 4089 STRCAT_TEXT tGasDeco ; "Deco" | |
| 4090 PUTC ":" | |
| 4091 PRINT | |
| 4092 | |
| 634 | 4093 ; Deco Mode |
| 4094 FONT_COLOR_MEMO ; select color | |
| 656 | 4095 WIN_SMALL surf_gaslist_column+.27,surf_gaslist_row |
| 634 | 4096 STRCAT_PRINT "ZH-L16" ; print fix part of model |
| 4097 movff char_I_model,WREG ; get model | |
| 4098 iorwf WREG ; GF enabled? | |
| 4099 bnz TFT_surface_decosettings1 ; YES | |
| 4100 ;bra TFT_surface_decosettings0 ; NO | |
| 4101 | |
| 4102 TFT_surface_decosettings0: | |
| 4103 ; Display ZH-L16 sat/desat model | |
| 656 | 4104 FONT_COLOR color_green ; set menu title font color |
| 4105 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1)+.5 | |
| 4106 STRCPY_TEXT_PRINT tSD ; print label (S/D) | |
| 4107 FONT_COLOR_MEMO ; select color | |
| 4108 WIN_SMALL surf_gaslist_column+.27,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
| 634 | 4109 movff char_I_saturation_multiplier, lo ; get sat mult. |
| 4110 movff char_I_desaturation_multiplier,hi ; get desat mult. | |
| 4111 bra TFT_surface_decosettings_com ; continue with common part | |
| 4112 | |
| 4113 TFT_surface_decosettings1: | |
| 4114 ; Display ZH-L16-GF low/high model | |
| 656 | 4115 WIN_SMALL surf_gaslist_column+.43+.27,surf_gaslist_row |
| 4116 STRCPY_TEXT_PRINT tZHL16GF ; print "+GF" label behind deco model label | |
| 4117 | |
| 4118 FONT_COLOR color_green ; set menu title font color | |
| 4119 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1)+.5 | |
| 4120 STRCPY_TEXT_PRINT tGF ; print label (GF:) | |
| 4121 FONT_COLOR_MEMO ; select color | |
| 4122 WIN_SMALL surf_gaslist_column+.27,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
| 634 | 4123 movff opt_GF_low, lo ; get GF low |
| 4124 movff opt_GF_high,hi ; get GF high | |
| 4125 ;bra TFT_surface_decosettings_com ; continue with common part | |
| 4126 | |
| 4127 TFT_surface_decosettings_com: | |
| 4128 ; percentage pair | |
| 4129 output_256 ; print (0-255) | |
| 4130 STRCAT "%/" ; print "%/" | |
| 4131 movff hi,lo ; get 2nd value | |
| 4132 output_256 ; print (0-255) | |
| 4133 PUTC_PRINT "%" ; append unit and dump to screen | |
| 4134 | |
| 4135 ; fTTS | |
| 656 | 4136 FONT_COLOR color_green ; set menu title font color |
| 4137 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)+.5 | |
| 4138 STRCPY_TEXT_PRINT tFTTSSurf ; print label | |
| 4139 FONT_COLOR_MEMO ; select color | |
| 4140 WIN_SMALL surf_gaslist_column+.76,surf_gaslist_row+(surf_gaslist_spacing*.2) | |
| 634 | 4141 movff char_I_extra_time,lo ; get time |
| 4142 output_9 ; print time (0-9) | |
| 4143 STRCAT_TEXT_PRINT tMinutes ; append unit and dump to screen | |
| 4144 | |
| 4145 ; Last Stop | |
| 656 | 4146 FONT_COLOR color_green ; set menu title font color |
| 4147 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3)+.5 | |
| 4148 STRCPY_TEXT_PRINT tLastDecostopSurf ; print label | |
| 4149 FONT_COLOR_MEMO ; select color | |
| 4150 WIN_SMALL surf_gaslist_column+.76,surf_gaslist_row+(surf_gaslist_spacing*.3) | |
| 634 | 4151 movff opt_last_stop,lo ; get depth |
| 4152 output_9 ; print depth (0-9) | |
| 4153 STRCAT_TEXT_PRINT tMeters ; append unit and dump to screen | |
| 4154 | |
| 4155 ; Salinity | |
| 656 | 4156 FONT_COLOR color_green ; set menu title font color |
| 4157 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4)+.5 | |
| 4158 STRCPY_TEXT_PRINT tDvSalinitySurf ; print label | |
| 4159 FONT_COLOR_MEMO ; select color | |
| 4160 WIN_SMALL surf_gaslist_column+.76,surf_gaslist_row+(surf_gaslist_spacing*.4) | |
| 634 | 4161 movff opt_salinity,lo ; get salinity |
| 4162 output_9 ; print salinity (0-9) | |
| 4163 STRCAT_TEXT_PRINT tPercent ; append unit and dump to screen | |
| 4164 return ; done | |
| 4165 | |
| 604 | 4166 |
| 4167 IFDEF _rx_functions | |
| 4168 | |
| 634 | 4169 ;----------------------------------------------------------------------------- |
| 4170 ; Surface Custom View - TR - Tank Data | |
| 4171 ; | |
| 4172 global TFT_surf_cv_tankdata | |
| 4173 TFT_surf_cv_tankdata: | |
| 4174 lfsr FSR1,rx_buffer ; load base address of RX buffer | |
| 4175 | |
| 4176 IFNDEF _rx_functions_debug | |
| 4177 | |
| 604 | 4178 WIN_SMALL surf_customtext_column,surf_customtext_row1 |
| 4179 rcall TFT_surface_tankdata_print | |
| 4180 WIN_SMALL surf_customtext_column,surf_customtext_row2 | |
| 4181 rcall TFT_surface_tankdata_print | |
| 4182 WIN_SMALL surf_customtext_column,surf_customtext_row3 | |
| 4183 rcall TFT_surface_tankdata_print | |
| 4184 WIN_SMALL surf_customtext_column,surf_customtext_row4 | |
| 4185 rcall TFT_surface_tankdata_print | |
| 4186 WIN_SMALL surf_customtext_column,surf_customtext_row5 | |
| 4187 rcall TFT_surface_tankdata_print | |
| 634 | 4188 |
| 4189 return ; done | |
| 4190 | |
| 4191 | |
| 4192 ; Helper Function - print transmitter data (max 12 char) | |
| 4193 TFT_surface_tankdata_print: | |
| 4194 FONT_COLOR_MEMO ; set color | |
| 4195 movff POSTINC1,hi ; get ID high (+0) | |
| 4196 movff POSTINC1,lo ; get ID low (+1) | |
| 4197 tstfsz hi ; ID high = 0 ? | |
| 4198 bra TFT_surface_tankdata_print_1; NO - slot in use | |
| 4199 tstfsz lo ; ID low = 0? | |
| 4200 bra TFT_surface_tankdata_print_1; NO - slot in use | |
| 4201 STRCAT_PRINT "---- " ; YES - mark as unused and clear rest of line from previous remains | |
| 4202 movf POSTINC1,W ; - dummy read (+2) to advance index | |
| 4203 movf POSTINC1,W ; - dummy read (+3) to advance index | |
| 4204 movf POSTINC1,W ; - dummy read (+4) to advance index | |
| 4205 bra TFT_surface_tankdata_print_3; - one more dummy read and return | |
| 4206 | |
| 604 | 4207 TFT_surface_tankdata_print_1: |
| 634 | 4208 movf hi,W ; copy ID high to WREG |
| 4209 output_hex ; print as hex 2 chars | |
| 4210 movf lo,W ; copy ID low to WREG | |
| 4211 output_hex ; print as hex 2 chars (4 in total) | |
| 4212 movff POSTINC1,hi ; get pressure high (+2) | |
| 4213 movff POSTINC1,lo ; get pressure low (+3) | |
| 4214 call TFT_color_code_pres_sac ; needed to clear the status flags before output | |
| 4215 bsf omit_digit_1 ; do not print 1st digit (0.1 bar) | |
| 4216 output_65535 ; print (0x-6553x) 4 chars (8 in total) | |
| 4217 PUTC " " ; 1 char (9 in total) | |
| 4218 movf POSTINC1,W ; get status (+4) | |
| 4219 andlw .7 ; mask out battery voltage | |
| 4220 bnz TFT_surface_tankdata_2 ; branch if battery is not completely drained | |
| 4221 FONT_COLOR_WARNING ; output in red | |
| 4222 STRCAT_PRINT "XXX" ; "XXX" for low | |
| 4223 bra TFT_surface_tankdata_print_3; one more dummy read and return | |
| 4224 | |
| 604 | 4225 TFT_surface_tankdata_2: |
| 634 | 4226 addlw .28 ; add offset of 2.8 Volt |
| 4227 movff WREG,lo ; copy to lo | |
| 4228 bsf decimal_digit1 ; put a decimal point in front of digit 1 | |
| 4229 output_99 ; print voltage 2 chars (11 in total) | |
| 4230 PUTC_PRINT " " ; dummy char 1 char (12 in total) | |
| 4231 | |
| 604 | 4232 TFT_surface_tankdata_print_3: |
| 634 | 4233 movf POSTINC1,W ; dummy read (+5) to advance index |
| 4234 return ; done | |
| 4235 | |
| 4236 ELSE ; _rx_functions_debug | |
| 4237 | |
| 4238 TFT_surface_tankdata_debug: ; surface custom view debug output | |
| 4239 FONT_COLOR_MEMO ; set color | |
| 4240 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*0 | |
| 4241 rcall TFT_surface_tankdata_debug_print | |
| 4242 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*1 | |
| 4243 rcall TFT_surface_tankdata_debug_print | |
| 4244 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*2 | |
| 4245 rcall TFT_surface_tankdata_debug_print | |
| 4246 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*3 | |
| 4247 rcall TFT_surface_tankdata_debug_print | |
| 4248 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*4 | |
| 4249 rcall TFT_surface_tankdata_debug_print | |
| 4250 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*5 | |
| 4251 rcall TFT_surface_tankdata_debug_print | |
| 4252 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*6 | |
| 4253 rcall TFT_surface_tankdata_debug_print | |
| 4254 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*7 | |
| 4255 rcall TFT_surface_tankdata_debug_print | |
| 4256 return ; done | |
| 4257 | |
| 4258 TFT_surface_tankdata_debug_print: | |
| 4259 movff POSTINC1,hi ; read ID high (+0) | |
| 4260 output_hex ; print as hex | |
| 4261 movff POSTINC1,lo ; read ID low (+1) | |
| 4262 output_hex ; print as hex | |
| 4263 PUTC "," ; print "," | |
| 4264 movff POSTINC1,hi ; read pressure high (+2) | |
| 4265 movff POSTINC1,lo ; read pressure low (+3) | |
| 4266 call TFT_color_code_pres_sac ; needed to clear the status flags before output | |
| 4267 bsf decimal_digit1 ; place a decimal point in front of digit 1 | |
| 4268 output_9999 ; print pressure (0.0-999.9) | |
| 4269 PUTC "," ; print "," | |
| 4270 movff POSTINC1,lo ; read status (+4) | |
| 4271 output_hex ; print as hex | |
| 4272 PUTC "," ; print "," | |
| 4273 movff POSTINC1,lo ; read date (+5) | |
| 4274 output_256 ; print (0-255) | |
| 4275 PRINT ; dump to screen | |
| 4276 return ; done | |
| 4277 | |
| 4278 ENDIF ; _rx_functions_debug | |
| 623 | 4279 ENDIF ; _rx_functions |
| 604 | 4280 |
| 634 | 4281 IFDEF _compass |
| 4282 | |
| 4283 ;----------------------------------------------------------------------------- | |
| 4284 ; Surface Custom View - Compass - "set Bearing Dialog" | |
| 4285 ; | |
| 4286 global TFT_surf_cv_compass_bearing | |
| 4287 TFT_surf_cv_compass_bearing: | |
| 4288 btfsc compass_menu ; is the "set bearing" selection shown? | |
| 4289 return ; YES - done | |
| 4290 bsf compass_menu ; NO - set "set bearing" selection as shown | |
| 4291 WIN_BOX_BLACK surf_compass_bear_row,surf_warning1_row-1, surf_compass_bear_column, surf_decotype_column-.1 ; top, bottom, left, right | |
| 4292 WIN_SMALL surf_compass_bear_column,surf_compass_bear_row | |
| 4293 FONT_COLOR color_yellow ; set color | |
| 4294 bsf win_invert ; print inverse | |
| 4295 STRCPY_TEXT_PRINT tSetHeading ; 7 chars | |
| 4296 return ; done | |
| 4297 | |
| 4298 ENDIF ; _compass | |
| 4299 | |
| 4300 IFDEF _ccr_pscr | |
| 4301 | |
| 4302 ;----------------------------------------------------------------------------- | |
| 4303 ; Surface Custom View - Diluent List | |
| 4304 ; | |
| 4305 global TFT_surf_cv_list_dil | |
| 4306 TFT_surf_cv_list_dil: | |
| 4307 movlw .5 ; do diluents (5-9) | |
| 4308 bra TFT_surf_cv_list_gas_common ; continue with common part | |
| 4309 | |
| 4310 | |
| 4311 ;----------------------------------------------------------------------------- | |
| 4312 ; Surface Custom View - Setpoint List | |
| 4313 ; | |
| 4314 global TFT_surf_cv_list_sp ; show setpoint list | |
| 4315 TFT_surf_cv_list_sp: | |
| 4316 FONT_COLOR_MEMO ; set color | |
| 4317 bsf short_gas_descriptions ; use short versions of gaslist_strcat_gas_PRODL and gaslist_strcat_setpoint | |
| 4318 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) | |
| 4319 | |
| 4320 ;SP 1 | |
| 4321 WIN_SMALL surf_gaslist_column,surf_gaslist_row | |
| 4322 clrf gaslist_gas ; select SP 1 | |
| 4323 call gaslist_strcat_setpoint ; show setpoint data | |
| 4324 PRINT ; dump to screen | |
| 4325 | |
| 4326 ;SP 2 | |
| 4327 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
| 4328 incf gaslist_gas,F ; select next SP | |
| 4329 call gaslist_strcat_setpoint ; show SP#+1 of PRODL# | |
| 4330 PRINT ; dump to screen | |
| 4331 | |
| 4332 ;SP 3 | |
| 4333 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) | |
| 4334 incf gaslist_gas,F ; select next SP | |
| 4335 call gaslist_strcat_setpoint ; show SP#+1 of PRODL# | |
| 4336 PRINT ; dump to screen | |
| 4337 | |
| 4338 ;SP 4 | |
| 4339 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3) | |
| 4340 incf gaslist_gas,F ; select next SP | |
| 4341 call gaslist_strcat_setpoint ; show SP#+1 of PRODL# | |
| 4342 PRINT ; dump to screen | |
| 4343 | |
| 4344 ;SP 5 | |
| 4345 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) | |
| 4346 incf gaslist_gas,F ; select next SP | |
| 4347 call gaslist_strcat_setpoint ; show SP#+1 of PRODL# | |
| 4348 PRINT ; dump to screen | |
| 4349 | |
| 4350 return ; done | |
| 4351 | |
| 4352 ENDIF ; _ccr_pscr | |
| 4353 | |
| 4354 | |
| 631 | 4355 ;============================================================================= |
| 634 | 4356 tft_out14 CODE |
| 4357 ;============================================================================= | |
| 4358 | |
| 4359 | |
| 4360 ;----------------------------------------------------------------------------- | |
| 4361 ; Dive Custom View - AVR / Stopwatch - Mask | |
| 4362 ; | |
| 4363 global TFT_avr_stopwatch_mask | |
| 4364 TFT_avr_stopwatch_mask: | |
| 4365 FONT_COLOR_MASK ; select color | |
| 4366 | |
| 4367 IFNDEF _min_depth_option | |
| 4368 | |
| 4369 WIN_TINY dm_custom_avr_stop_column1+.2,dm_custom_avr_stop_title_row | |
| 4370 TSTOSS opt_2ndDepthDisp ; show avg depth instead of max depth in main screen? | |
| 4371 bra TFT_avr_stopwatch_mask_1 ; NO - draw avg depth in custom view then | |
| 4372 btfss alt_layout_active ; YES - in alternative layout? | |
| 4373 bra TFT_avr_stopwatch_mask_max ; NO - show max depth | |
| 4374 ;bra TFT_avr_stopwatch_mask_avg ; YES - show avg depth | |
| 4375 | |
| 4376 TFT_avr_stopwatch_mask_avg: | |
| 4377 STRCPY_TEXT_PRINT tDiveTotalAvg ; mask for average depth | |
| 4378 bra TFT_avr_stopwatch_mask_2 ; continue | |
| 4379 | |
| 4380 TFT_avr_stopwatch_mask_1: | |
| 4381 btfss alt_layout_active ; YES - in alternative layout? | |
| 4382 bra TFT_avr_stopwatch_mask_avg ; NO - show avg depth | |
| 4383 ;bra TFT_avr_stopwatch_mask_max ; YES - show max depth | |
| 4384 | |
| 4385 TFT_avr_stopwatch_mask_max: | |
| 4386 STRCPY_TEXT_PRINT tMaxDepth ; mask for maximum depth | |
| 4387 ;bra TFT_avr_stopwatch_mask_2 ; continue | |
| 4388 | |
| 4389 TFT_avr_stopwatch_mask_2: | |
| 4390 WIN_TINY dm_custom_avr_stop_column2+.3,dm_custom_avr_stop_title_row | |
| 4391 STRCPY_TEXT_PRINT tDiveStopwatch ; print label | |
| 4392 | |
| 4393 WIN_TINY dm_custom_avr_stop_column3-.8,dm_custom_avr_stop_title_row | |
| 4394 STRCPY_TEXT_PRINT tDiveStopAvg ; print label | |
| 4395 | |
| 4396 return ; done | |
| 4397 | |
| 4398 ELSE | |
| 4399 | |
| 4400 WIN_TINY dm_custom_avr_stop_column1+.2,dm_custom_avr_stop_title_row | |
| 4401 STRCPY_PRINT "Max.Depth" ; print label | |
| 4402 | |
| 4403 WIN_TINY dm_custom_avr_stop_column2+.3,dm_custom_avr_stop_title_row | |
| 4404 STRCPY_PRINT "Avg.Depth" ; print label | |
| 4405 | |
| 4406 WIN_TINY dm_custom_avr_stop_column3-.8,dm_custom_avr_stop_title_row | |
| 4407 STRCPY_PRINT "Min.Depth" ; print label | |
| 4408 | |
| 4409 return ; done | |
| 4410 | |
| 4411 ENDIF | |
| 4412 | |
| 4413 | |
| 4414 ;----------------------------------------------------------------------------- | |
| 4415 ; Dive Custom View - AVR / Stopwatch - Data | |
| 4416 ; | |
| 4417 global TFT_avr_stopwatch | |
| 4418 TFT_avr_stopwatch: | |
| 4419 FONT_COLOR_MEMO ; select color | |
| 4420 | |
| 4421 IFNDEF _min_depth_option | |
| 4422 | |
| 4423 ; total average depth or max depth | |
| 4424 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row | |
| 4425 TSTOSS opt_2ndDepthDisp ; show average depth instead of maximum depth in main screen? | |
| 4426 bra TFT_avr_stopwatch_1 ; NO - draw avg depth in custom view then | |
| 4427 btfsc alt_layout_active ; YES - in alternative layout? | |
| 4428 bra TFT_avr_stopwatch_avg ; YES - show avg depth | |
| 4429 bra TFT_avr_stopwatch_max ; NO - show max depth | |
| 4430 | |
| 4431 TFT_avr_stopwatch_1: | |
| 4432 btfsc alt_layout_active ; YES - in alternative layout? | |
| 4433 bra TFT_avr_stopwatch_max ; YES - show max depth | |
| 4434 ;bra TFT_avr_stopwatch_avg ; NO - show avg depth | |
| 4435 | |
| 4436 TFT_avr_stopwatch_avg: | |
| 4437 MOVII pressure_rel_avg_total,mpr ; get total dive average pressure into hi:lo | |
| 4438 bra TFT_avr_stopwatch_2 ; continue | |
| 4439 | |
| 4440 TFT_avr_stopwatch_max: | |
| 4441 MOVII pressure_rel_max_cached,mpr ; get maximum pressure into hi:lo | |
| 4442 ;bra TFT_avr_stopwatch_2 ; continue | |
| 4443 | |
| 4444 TFT_avr_stopwatch_2: | |
| 4445 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
| 4446 TSTOSS opt_units ; 0=m, 1=ft | |
| 4447 bra TFT_update_avr_stopwatch1_metric; 0 - metric | |
| 4448 ;bra TFT_update_avr_stopwatch1_imp ; 1 - imperial | |
| 4449 | |
| 4450 TFT_update_avr_stopwatch1_imp: | |
| 4451 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] | |
| 4452 output_999 ; print (0-999) | |
| 4453 PRINT ; dump to screen | |
| 4454 bra TFT_update_avr_stopwatch2 ; continue | |
| 4455 | |
| 4456 TFT_update_avr_stopwatch1_metric: | |
| 4457 rcall TFT_update_avr_stopwatch_metric ; print metric depth | |
| 4458 ;bra TFT_update_avr_stopwatch2 ; continue | |
| 4459 | |
| 4460 TFT_update_avr_stopwatch2: | |
| 4461 ; stopped average depth | |
| 4462 WIN_MEDIUM dm_custom_avr_stop_column3,dm_custom_avr_stop_row | |
| 4463 MOVII pressure_rel_avg_trip,mpr ; get the resettable average pressure | |
| 4464 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
| 4465 TSTOSS opt_units ; 0=m, 1=ft | |
| 4466 bra TFT_update_avr_stopwatch2_metric; 0 - metric | |
| 4467 ;bra TFT_update_avr_stopwatch2_imp ; 1 - imperial | |
| 4468 | |
| 4469 TFT_update_avr_stopwatch2_imp: | |
| 4470 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] | |
| 4471 output_999 ; print (0-999) | |
| 4472 PRINT ; dump to screen | |
| 4473 bra TFT_update_avr_stopwatch3 ; continue | |
| 4474 | |
| 4475 TFT_update_avr_stopwatch2_metric: | |
| 4476 rcall TFT_update_avr_stopwatch_metric ; print metric depth | |
| 4477 bra TFT_update_avr_stopwatch3 ; continue | |
| 4478 | |
| 4479 | |
| 4480 ; Helper Function - print metric depth | |
| 4481 TFT_update_avr_stopwatch_metric: | |
| 4482 bsf leftbind ; print left-aligned | |
| 4483 bsf omit_digit_1 ; do not print 1st digit (no cm) | |
| 4484 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 4485 output_65535 ; print (0.0x-655.3x) | |
| 4486 PUTC " " ; wipe out remains from last output | |
| 4487 clrf WREG | |
| 4488 movff WREG,buffer+.4 ; limit string length to 4 = 3 digits + 1 half-size decimal dot | |
| 4489 PRINT ; dump to screen | |
| 4490 return ; done | |
| 4491 | |
| 4492 ELSE | |
| 4493 | |
| 4494 ; resettable maximum depth - needs ISR-safe copy! | |
| 4495 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row | |
| 4496 FONT_COLOR_MEMO ; select color | |
| 4497 SMOVII pressure_rel_max_trip,mpr ; get resettable maximum pressure | |
| 4498 rcall TFT_avr_stopwatch_helper ; print depth | |
| 4499 | |
| 4500 ; resettable average depth | |
| 4501 WIN_MEDIUM dm_custom_avr_stop_column2-.1,dm_custom_avr_stop_row | |
| 4502 FONT_COLOR_ATTENTION ; select color | |
| 4503 MOVII pressure_rel_avg_trip,mpr ; get resettable average pressure | |
| 4504 rcall TFT_avr_stopwatch_helper ; print depth | |
| 4505 | |
| 4506 ; resettable minimum depth - needs ISR safe copy! | |
| 4507 WIN_MEDIUM dm_custom_avr_stop_column3-.12,dm_custom_avr_stop_row | |
| 4508 FONT_COLOR_MEMO ; select color | |
| 4509 SMOVII pressure_rel_min_trip,mpr ; get resettable minimum pressure | |
| 4510 rcall TFT_avr_stopwatch_helper ; print depth | |
| 4511 | |
| 4512 return ; done | |
| 4513 | |
| 4514 TFT_avr_stopwatch_helper: | |
| 4515 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
| 4516 bsf leftbind ; print left-aligned | |
| 4517 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 4518 output_65535 ; print (0.00-655.35) | |
| 4519 PUTC " " ; wipe out remains from last output | |
| 4520 clrf WREG ; load string terminator | |
| 4521 movff WREG,buffer+.5 ; limit string length to 5 = 4 digits + 1 half-size decimal dot | |
| 4522 PRINT ; dump to screen | |
| 4523 return ; done | |
| 4524 | |
| 4525 ENDIF | |
| 4526 | |
| 4527 TFT_update_avr_stopwatch3: | |
| 4528 WIN_MEDIUM dm_custom_avr_stop_column2,dm_custom_avr_stop_row | |
| 4529 ;bra TFT_update_stopwatch ; continue | |
| 4530 | |
| 4531 TFT_update_stopwatch: | |
| 656 | 4532 MOVII divesecs_avg_trip,mpr ; get the resettable dive time (stopwatch) |
| 4533 update_stopwatch_common: ; jump-in point for stopped dive time in compass custom view | |
| 634 | 4534 call convert_time ; convert hi:lo in seconds to minutes (up:hi) and seconds (lo) |
| 4535 movlw .100 ; display layout will change if minutes become >= 100 | |
| 4536 cpfslt hi ; minutes < 100 ? | |
| 4537 bra TFT_update_stopwatch_1 ; NO - display hours:minutes | |
| 4538 bcf aux_flag ; YES - will print minutes : seconds | |
| 4539 bra TFT_update_stopwatch_2 ; - continue | |
| 4540 | |
| 4541 TFT_update_stopwatch_1: | |
| 4542 movff hi,lo ; transfer minutes (low byte) to lo | |
| 4543 movff up,hi ; transfer minutes (high byte) to hi | |
| 4544 call convert_time ; convert hi:lo in minutes to hours (up:hi) and minutes (lo) | |
| 4545 bsf aux_flag ; will print hours : minutes | |
| 4546 | |
| 4547 TFT_update_stopwatch_2: | |
| 4548 movf hi,W ; exchange lo and hi | |
| 4549 movff lo,hi ; ... | |
| 4550 movwf lo ; ... | |
| 4551 output_99 ; print minutes or hours (0 - 99) | |
| 4552 movlw ":" ; load standard separator | |
| 4553 btfsc aux_flag ; will print hours : minutes ? | |
| 4554 movlw "'" ; YES - swap to alternative separator | |
| 4555 movwf POSTINC2 ; print separator | |
| 4556 movff hi,lo ; restore lo | |
| 4557 output_99x ; print seconds or minutes (00-99) | |
| 4558 movlw .5 ; set target length | |
| 4559 call TFT_buffer_trim_length ; fill / cut buffer to target length | |
| 4560 PRINT ; dump to screen | |
| 4561 return ; done | |
| 4562 | |
| 4563 | |
| 4564 ;----------------------------------------------------------------------------- | |
| 4565 ; Dive Custom View - Gas Needs - Mask | |
| 4566 ; | |
| 4567 global TFT_gas_needs_mask | |
| 4568 TFT_gas_needs_mask: | |
| 4569 WIN_TINY dm_custom_gas_column_title, dm_custom_gas_mask_row | |
| 4570 FONT_COLOR_MASK ; select color | |
| 4571 | |
| 4572 IFDEF _cave_mode | |
| 4573 | |
| 4574 movff char_O_deco_info,WREG ; get the deco info vector | |
| 4575 btfss WREG,gas_needs_cave ; are the gas needs calculated for cave mode? | |
| 4576 bra TFT_gas_needs_mask_ascent_1 ; NO - show as direct ascent needs | |
| 4577 ;bra TFT_gas_needs_mask_ascent_0 ; YES - show as cave return needs | |
| 4578 | |
| 4579 TFT_gas_needs_mask_ascent_0: | |
| 4580 bsf gas_needs_mode_last ; remember last results were for cave mode | |
| 4581 STRCPY_TEXT tGasNeedsCaveMode ; print "Gas Needs Cave Mode" | |
| 4582 bra TFT_gas_needs_mask_ascent_2 ; continue | |
| 4583 | |
| 4584 TFT_gas_needs_mask_ascent_1: | |
| 4585 bcf gas_needs_mode_last ; remember last results were for direct ascent | |
| 4586 STRCPY_TEXT tGasNeedsAscent ; "Gas Needs Ascent" | |
| 4587 ;bra TFT_gas_needs_mask_ascent_2 ; continue | |
| 4588 | |
| 4589 ELSE | |
| 4590 | |
| 4591 STRCPY_TEXT tGasNeedsAscent ; "Gas Needs Ascent" | |
| 4592 | |
| 4593 ENDIF | |
| 4594 | |
| 4595 TFT_gas_needs_mask_ascent_2: | |
| 4596 TSTOSS char_I_extra_time ; fTTS enabled? | |
| 4597 bra TFT_gas_needs_mask_ascent_3 ; NO - continue | |
| 4598 STRCAT " fTTS" ; YES - append fTTS marking | |
| 4599 TFT_gas_needs_mask_ascent_3: | |
| 4600 STRCAT_PRINT " (bar)" ; append " (bar)" and dump buffer to screen | |
| 4601 return ; done | |
| 4602 | |
| 4603 | |
| 4604 ;----------------------------------------------------------------------------- | |
| 4605 ; Dive Custom View - Gas Needs - Data | |
| 4606 ; | |
| 4607 ; LIMITATION: there is only space for 4 gases on the screen - if 5 gases | |
| 4608 ; have a pres_need > 0, then only the first 4 will be shown! | |
| 4609 ; | |
| 4610 global TFT_gas_needs | |
| 4611 TFT_gas_needs: | |
| 4612 | |
| 4613 IFDEF _cave_mode | |
| 4614 | |
| 4615 movff char_O_deco_info,WREG ; get deco info vector | |
| 4616 btfss WREG,gas_needs_cave ; are the gas needs calculated for cave mode? | |
| 4617 bra TFT_gas_needs_ascent_1 ; NO - continue below... | |
| 4618 btfsc gas_needs_mode_last ; YES - were the last results calculated for cave mode? | |
| 4619 bra TFT_gas_needs_ascent_3 ; YES - mask still valid | |
| 4620 bra TFT_gas_needs_ascent_2 ; NO - redraw mask | |
| 4621 | |
| 4622 TFT_gas_needs_ascent_1: | |
| 4623 btfss gas_needs_mode_last ; NO - were the last results calculated for direct ascent? | |
| 4624 bra TFT_gas_needs_ascent_3 ; YES - mask still valid | |
| 4625 ;bra TFT_gas_needs_ascent_2 ; NO - redraw mask | |
| 4626 | |
| 4627 TFT_gas_needs_ascent_2: | |
| 4628 rcall TFT_gas_needs_mask ; redraw mask | |
| 4629 ;bra TFT_gas_needs_ascent_3 ; continue | |
| 4630 | |
| 4631 ENDIF | |
| 4632 | |
| 4633 TFT_gas_needs_ascent_3: | |
| 4634 clrf up ; initialize gas index (0-4) | |
| 4635 WIN_SMALL dm_custom_gas_column1+.5,dm_custom_gas_row1 ; set position | |
| 4636 rcall TFT_gas_needs_helper ; print need | |
| 4637 WIN_SMALL dm_custom_gas_column1+.5,dm_custom_gas_row2 ; set position | |
| 4638 rcall TFT_gas_needs_helper ; print need | |
| 4639 WIN_SMALL dm_custom_gas_column2+.5,dm_custom_gas_row1 ; set position | |
| 4640 rcall TFT_gas_needs_helper ; print need | |
| 4641 WIN_SMALL dm_custom_gas_column2+.5,dm_custom_gas_row2 ; set position | |
| 4642 rcall TFT_gas_needs_helper ; print need | |
| 4643 return ; done | |
| 4644 | |
| 4645 | |
| 4646 ; Helper Function - print need for next gas | |
| 4647 TFT_gas_needs_helper: | |
| 4648 FONT_COLOR_MEMO ; select default color | |
| 4649 movlw .5 ; total number of gases | |
| 4650 cpfslt up ; check if all gases have been processed | |
| 4651 bra TFT_gas_needs_helper_1 ; YES - clear display area | |
| 4652 movf up,W ; NO - get gas number and check if need of that gas is > 0 | |
| 4653 rlncf WREG,W ; - multiply by 2 | |
| 4654 incf WREG,W ; - add 1 to address high byte | |
| 4655 lfsr FSR1,int_O_gas_need_pres ; - load base of gas needs in pressure | |
| 4656 movff PLUSW1,hi ; - read HIGH(int_O_gas_need_pres[up]) | |
| 4657 btfss hi,int_is_zero ; - check flag for pres_need == 0 | |
| 4658 bra TFT_gas_needs_helper_2 ; NO - print gas type and pressure needed | |
| 4659 incf up,F ; YES - increment to next gas | |
| 4660 bra TFT_gas_needs_helper ; - loop and try the next gas | |
| 4661 | |
| 4662 TFT_gas_needs_helper_1: | |
| 4663 ; no gases to show anymore, clear display area from potential remains of last invocation | |
| 4664 STRCAT_PRINT " ---- " ; overwrite outdated stuff if screen position is not needed | |
| 4665 return ; done | |
| 4666 | |
| 4667 TFT_gas_needs_helper_2: | |
| 4668 ; output gas type and pressure needed | |
| 4669 movf up,W ; get gas number (0-4) to WREG | |
| 4670 lfsr FSR1,opt_gas_O2_ratio ; read opt_gas_O2_ratio[WREG] | |
| 4671 movff PLUSW1,lo ; copy result to lo | |
| 4672 lfsr FSR1,opt_gas_He_ratio ; read opt_gas_He_ratio[WREG] | |
| 4673 movff PLUSW1,hi ; copy result to hi | |
| 4674 call gaslist_strcat_mix ; print "Air", "O2", "21/35", etc. | |
| 4675 PUTC ':' ; print ":" | |
| 4676 movf up,W ; get gas number (0-4) to WREG | |
| 4677 rlncf WREG,W ; multiply by 2 | |
| 4678 lfsr FSR1,int_O_gas_need_pres ; load base of gas needs in pressure | |
| 4679 movff PLUSW1,lo ; read LOW(int_O_gas_need_pres[up]) | |
| 4680 incf WREG,W ; add 1 to address high byte | |
| 4681 movff PLUSW1,hi ; read HIGH(int_O_gas_need_pres[up]) | |
| 4682 btfsc hi,int_attention_flag ; check if attention flag is set (pres_need > pres_fill * threshold) | |
| 4683 FONT_COLOR_ATTENTION ; YES - print gas need in attention color | |
| 4684 btfsc hi,int_warning_flag ; check if warning flag is set (pres_need > pres_fill) | |
| 4685 FONT_COLOR_WARNING ; YES - print gas need in warning color | |
| 4686 movff int_O_gas_need_pres+1,WREG ; get HIGH(int_O_gas_need_pres[0]) which holds flag for invalid data | |
| 4687 btfsc WREG,int_invalid_flag ; check if invalid data flag is set | |
| 4688 FONT_COLOR_DISABLED ; YES - print gas need in disabled color | |
| 4689 bcf hi,int_attention_flag ; clear flag for attention | |
| 4690 bcf hi,int_warning_flag ; clear flag for warning | |
| 4691 bcf hi,int_high_flag ; clear flag for > 999 bar | |
| 4692 bcf hi,int_invalid_flag ; clear flag for invalid data (will actually only be set with 1st gas) | |
| 4693 output_999 ; print (0-999) | |
| 4694 PUTC_PRINT " " ; add a space to overwrite any potential remains of earlier outputs and dump buffer to screen | |
| 4695 incf up,F ; increment to next gas | |
| 4696 return ; done | |
| 4697 | |
| 4698 | |
| 4699 ;----------------------------------------------------------------------------- | |
| 4700 ; Dive Custom View - Deco Plan - Mask | |
| 4701 ; | |
| 4702 global TFT_decoplan_mask ; mask for deco plan | |
| 4703 TFT_decoplan_mask: | |
| 4704 WIN_TINY dm_custom_decoplan_title_column, dm_custom_decoplan_title_row | |
| 4705 FONT_COLOR_MASK ; select color | |
| 4706 STRCPY_TEXT_PRINT tDiveDecoplan ; print label | |
| 4707 | |
| 4708 return ; done | |
| 4709 | |
| 4710 | |
| 4711 ;----------------------------------------------------------------------------- | |
| 4712 ; Dive Custom View - Deco Plan - Data | |
| 4713 ; | |
| 4714 global TFT_decoplan | |
| 4715 TFT_decoplan: | |
| 4716 lfsr FSR0,char_O_deco_depth ; load base address of stops table | |
| 4717 clrf ex ; will be used for auxiliary flags | |
| 4718 FONT_COLOR_MEMO ; set default output color | |
| 4719 movff char_O_deco_gas+0,lo ; get flag for invalid deco data | |
| 4720 btfsc lo,char_invalid_flag ; is the invalid flag set? | |
| 4721 FONT_COLOR_DISABLED ; YES - set to disabled color | |
| 4722 ; 2nd stop | |
| 4723 WIN_SMALL dm_cust_dstop_2nd_stop_column, dm_cust_dstop_2nd_stop_row | |
| 4724 rcall TFT_decoplan_helper ; show stop data | |
| 4725 ; 3rd stop | |
| 4726 WIN_SMALL dm_cust_dstop_3rd_stop_column, dm_cust_dstop_3rd_stop_row | |
| 4727 rcall TFT_decoplan_helper ; show stop data | |
| 4728 ; 4th stop | |
| 4729 bsf ex,4 ; flag we are on 4th screen position | |
| 4730 WIN_SMALL dm_cust_dstop_4th_stop_column, dm_cust_dstop_4th_stop_row | |
| 4731 rcall TFT_decoplan_helper ; show stop data | |
| 4732 bcf ex,4 ; clear 4th position flag again | |
| 4733 ; 5th stop | |
| 4734 WIN_SMALL dm_cust_dstop_5th_stop_column, dm_cust_dstop_5th_stop_row | |
| 4735 rcall TFT_decoplan_helper ; show stop data | |
| 4736 ; 6th stop | |
| 4737 WIN_SMALL dm_cust_dstop_6th_stop_column, dm_cust_dstop_6th_stop_row | |
| 4738 rcall TFT_decoplan_helper ; show stop data | |
| 4739 ; 7th stop | |
| 4740 WIN_SMALL dm_cust_dstop_7th_stop_column, dm_cust_dstop_7th_stop_row | |
| 4741 rcall TFT_decoplan_helper ; show stop data | |
| 4742 return ; done | |
| 4743 | |
| 4744 | |
| 4745 ; Helper Function - show stop data | |
| 4746 TFT_decoplan_helper: | |
| 4747 btfsc ex,0 ; no more stops to show? | |
| 4748 bra TFT_decoplan_helper_1 ; YES - skip checking next entry - it will be empty, too | |
| 4749 movff PREINC0,lo ; NO - advance pointer to get the depth of the 2nd, 3rd, 4th, ... stop | |
| 4750 tstfsz lo ; is the stop depth = 0, i.e. no stop entry? | |
| 4751 bra TFT_decoplan_helper_3 ; NO - show stop data | |
| 4752 | |
| 4753 TFT_decoplan_helper_1: ; no more stop table entries | |
| 4754 bsf ex,0 ; flag that there are no more stop table entries | |
| 4755 btfss ex,4 ; are we on the 4th screen position? | |
| 4756 bra TFT_decoplan_helper_2 ; NO - normal handling on this position | |
| 4757 btfsc ex,1 ; YES - special handling, has any stop been shown? | |
| 4758 bra TFT_decoplan_helper_2 ; YES - print normal blanking | |
| 4759 STRCPY_PRINT " ---- " ; NO - print a "no stops" indication (blanking potential previous content, too) | |
| 4760 return ; done | |
| 4761 | |
| 4762 TFT_decoplan_helper_2: ; no more stop table entries, blank potential previous content | |
| 4763 STRCPY_PRINT " " ; wipe screen position by printing 7 spaces | |
| 4764 return ; done | |
| 4765 | |
| 4766 TFT_decoplan_helper_3: | |
| 4767 rcall TFT_display_stop_depth ; print stop depth (depth in lo) | |
| 4768 PUTC " " ; put a space char between depth and time | |
| 4769 movlw NUM_STOPS ; offset between arrays holding depths and durations | |
| 4770 movff PLUSW0,lo ; get duration of the current stop | |
| 4771 output_99dd ; print duration, prints double dots if duration is zero | |
| 4772 PUTC_PRINT "'" ; append unit and dump buffer to screen | |
| 4773 bsf ex,1 ; flag that a stop was shown | |
| 4774 return ; done | |
| 4775 | |
| 4776 | |
| 4777 ; Helper Function - print stop depth | |
| 4778 TFT_display_stop_depth: ; print depth (stored in lo) | |
| 4779 TSTOSS opt_units ; get unit (0=m, 1=ft) | |
| 4780 bra TFT_display_stop_depth_m ; 0 - meter | |
| 4781 ;bra TFT_display_stop_depth_ft ; 1 - feet | |
| 4782 | |
| 4783 TFT_display_stop_depth_ft: | |
| 4784 call convert_meter_to_feet ; convert value in lo from meters to feet | |
| 4785 output_999 ; output stop depth (0-999) | |
| 4786 return ; done | |
| 4787 | |
| 4788 TFT_display_stop_depth_m: | |
| 4789 output_99 ; output stop depth (0-99) | |
| 4790 STRCAT_TEXT tMeters ; append unit | |
| 4791 return ; done | |
| 4792 | |
| 4793 | |
| 4794 ;----------------------------------------------------------------------------- | |
| 4795 ; Dive Custom View - Ceiling, Supersaturation & Tissues - Mask | |
| 4796 ; | |
| 4797 global TFT_ceiling_GF_tissue_mask | |
| 4798 TFT_ceiling_GF_tissue_mask: | |
| 4799 FONT_COLOR_MASK ; select color | |
| 4800 | |
| 656 | 4801 WIN_TINY dm_custom_gf_column1+.5, dm_custom_gf_title_row |
| 4802 STRCPY_TEXT_PRINT tGFInfo ; print label | |
| 4803 | |
| 634 | 4804 WIN_TINY dm_custom_ceiling_column+.2,dm_custom_ceiling_title_row |
| 4805 STRCPY_TEXT_PRINT tCeiling ; print label | |
| 4806 | |
| 4807 WIN_TINY dm_custom_tissue_title_column, dm_custom_tissue_title_row | |
| 656 | 4808 STRCPY_TEXT_PRINT tDiveTissues ; print labelGF |
| 4809 return ; done | |
| 4810 | |
| 4811 ;----------------------------------------------------------------------------- | |
| 4812 ; Dive Custom View - Ceiling, Supersaturation & GF Surface - Mask | |
| 4813 ; | |
| 4814 global TFT_ceiling_GF_surfGF_mask | |
| 4815 TFT_ceiling_GF_surfGF_mask: | |
| 4816 FONT_COLOR_MASK ; select color | |
| 634 | 4817 |
| 4818 WIN_TINY dm_custom_gf_column1+.5, dm_custom_gf_title_row | |
| 4819 STRCPY_TEXT_PRINT tGFInfo ; print label | |
| 4820 | |
| 656 | 4821 WIN_TINY dm_custom_ceiling_column+.2,dm_custom_ceiling_title_row |
| 4822 STRCPY_TEXT_PRINT tCeiling ; print label | |
| 4823 | |
| 4824 WIN_TINY dm_custom_surfGF_title_column, dm_custom_surfGF_title_row | |
| 4825 STRCPY_TEXT_PRINT tDiveSurfGF ; print label | |
| 4826 return ; done | |
| 634 | 4827 |
| 4828 ;----------------------------------------------------------------------------- | |
| 4829 ; Dive Custom View - Ceiling, Supersaturation & Tissues - Data | |
| 4830 ; | |
| 4831 global TFT_ceiling_GF_tissue | |
| 4832 TFT_ceiling_GF_tissue: | |
| 656 | 4833 ; Show ceiling |
| 4834 rcall TFT_ceiling | |
| 634 | 4835 ; show tissue diagram |
| 4836 rcall TFT_dive_tissues ; show tissue pressure diagram | |
| 4837 ; show current supersaturation | |
| 4838 WIN_MEDIUM dm_custom_clock_column+.3, dm_custom_gf_row | |
| 4839 MOVII int_O_lead_supersat,mpr ; bank-safe copy of leading tissue's supersaturation | |
| 4840 call TFT_color_code_supersat ; color-code output | |
| 4841 output_256 ; need to print lo only, int_O_lead_supersat value is limited to 255 | |
| 4842 PRINT ; dump to screen | |
| 4843 WIN_STD dm_custom_clock_column+.40, dm_custom_gf_row+.5 | |
| 4844 PUTC_PRINT "%" ; print "%" and dump to screen | |
| 4845 return ; done | |
| 4846 | |
| 4847 ;------------------------------------------------------------------------- | |
| 4848 ; Draw saturation graph in dive mode custom view | |
| 4849 ; | |
| 4850 TFT_dive_tissues: | |
| 4851 ; draw outer frame | |
| 4852 movf pallet_color_memo,W ; get color into WREG | |
| 4853 WIN_FRAME_COLOR dm_custom_tissue_diagram_top, dm_custom_tissue_diagram_bottom, dm_custom_tissue_diagram_left, .159 ; outer frame | |
| 4854 | |
| 4855 ; clear area showing leading tissue number as it may not be printed over | |
| 4856 WIN_BOX_BLACK dm_custom_tissue_diagram_top+.16, dm_custom_tissue_diagram_top+.16+.10, dm_custom_tissue_diagram_left+.32, dm_custom_tissue_diagram_left+.32+.8 ; top, bottom, left, right | |
| 4857 | |
| 4858 TFT_dive_tissues_1: | |
| 4859 ; common initialization for tissue pressures and saturation | |
| 4860 movlw .1 | |
| 4861 movwf win_height ; hight of the bargraph (0-239) | |
| 4862 movlw dm_custom_tissue_diagram_left+.3 ; get dive mode left start position | |
| 4863 movwf win_leftx2 ; set column left (0-159) | |
| 4864 movlw .159-dm_custom_tissue_diagram_left-.4 ; get max width | |
| 4865 movwf win_width+0 ; set width (low byte) | |
| 4866 clrf win_width+1 ; high byte of with is always zero | |
| 4867 movlw color_cyan ; color for tissues with decreasing pressure | |
| 4868 movwf ex ; store in ex | |
| 4869 movlw color_orange ; color for tissues with increasing pressure | |
| 4870 movwf ul ; store in ul | |
| 4871 | |
| 4872 ; draw combined or N2 tissue pressures | |
| 4873 lfsr FSR2,char_O_tissue_pressure ; load base address of combined pressures by default | |
| 4874 IFDEF _helium | |
| 4875 btfsc tissue_graphic_layout ; shall show N2+He ? | |
| 4876 lfsr FSR2,char_O_tissue_pres_N2 ; YES - load base address of N2 pressures | |
| 4877 ENDIF | |
| 4878 movlw d'16' | |
| 4879 movwf lo ; tissue counter, 16 tissues | |
| 4880 clrf hi ; row counter | |
| 4881 TFT_dive_tissues_N2_loop: | |
| 4882 movlw dm_custom_tissue_diagram_top+.3 ; dive mode top start position N2 | |
| 4883 rcall TFT_dive_tissues_bargraph ; draw tissue bargraph | |
| 4884 incf hi,F ; increment row counter | |
| 4885 decfsz lo,F ; decrement tissue counter, done? | |
| 4886 bra TFT_dive_tissues_N2_loop ; NO - loop | |
| 4887 IFDEF _helium | |
| 4888 btfsc tissue_graphic_layout ; shall show N2+He ? | |
| 4889 bra TFT_dive_tissues_3 ; YES - show He tissue pressures | |
| 4890 ENDIF | |
| 4891 | |
| 4892 ; draw tissue saturations | |
| 4893 lfsr FSR2,char_O_tissue_saturation ; load base address of tissue supersaturation | |
| 4894 movlw d'16' | |
| 4895 movwf lo ; tissue counter, 16 tissues | |
| 4896 clrf hi ; row counter | |
| 4897 movlw color_grey ; color for tissue saturation, alternative: color_lightblue | |
| 4898 movwf ex ; store in ex | |
| 4899 ; movlw color_yellow ; 2nd color is not used by tissue saturation | |
| 4900 ; movwf ul ; ... | |
| 4901 TFT_dive_tissues_sat_loop: | |
| 4902 movlw dm_custom_tissue_diagram_top+.25 ; dive mode top start position saturations | |
| 4903 rcall TFT_dive_tissues_bargraph ; draw tissue bargraph | |
| 4904 incf hi,F ; increment row counter | |
| 4905 decfsz lo,F ; decrement tissue counter, done? | |
| 4906 bra TFT_dive_tissues_sat_loop ; NO - loop | |
| 4907 | |
| 4908 ; common part for vertical lines | |
| 4909 movlw dm_custom_tissue_diagram_top+.25 ; get top position | |
| 4910 movwf win_top ; set top position (0-239) | |
| 4911 movlw .15 ; get hight | |
| 4912 movwf win_height ; set height | |
| 4913 movlw .1 ; get width | |
| 4914 movwf win_width+0 ; set width, low byte | |
| 4915 clrf win_width+1 ; set width, high byte | |
| 4916 | |
| 4917 ; print 100% line | |
| 4918 movlw dm_custom_tissue_diagram_left+.36 ; get left position | |
| 4919 movwf win_leftx2 ; set left position (0-159) | |
| 4920 movlw color_red ; color for 100% line | |
| 4921 BOX_COLOR ; draw line | |
| 4922 | |
| 4923 ; GF factors enabled? | |
| 4924 btfss tissue_graphic_gf ; shall show GF lines? | |
| 4925 bra TFT_dive_tissues_4 ; NO - continue with number of leading tissue | |
| 4926 | |
| 4927 ; print GF low line | |
| 4928 movlw dm_custom_tissue_diagram_left+.3 ; get left base position | |
| 4929 movwf win_leftx2 ; set left base position (0-159) | |
| 4930 movff char_I_GF_Low_percentage,WREG ; get GF low in 0.01 % | |
| 4931 mullw .82 ; multiply with 82 | |
| 4932 movf PRODH,W ; divide by 256 -> resulting scale factor is 82/256 = 0.3203125 | |
| 4933 addwf win_leftx2,F ; add to base position | |
| 4934 movlw color_green ; color for GF low line | |
| 4935 BOX_COLOR ; draw line | |
| 4936 | |
| 4937 ; print GF high line | |
| 4938 movlw dm_custom_tissue_diagram_left+.3 ; get left base position | |
| 4939 movwf win_leftx2 ; set left base position (0-159) | |
| 4940 movff char_I_GF_High_percentage,WREG ; get GF high in 0.01 % | |
| 4941 mullw .82 ; multiply with 82 | |
| 4942 movf PRODH,W ; divide by 256 -> resulting scale factor is 82/256 = 0.3203125 | |
| 4943 addwf win_leftx2,F ; add to base position | |
| 4944 movlw color_yellow ; color for GF high line | |
| 4945 BOX_COLOR ; draw line | |
| 640 | 4946 bra TFT_dive_tissues_4 ; continue with number of leading tissue |
| 634 | 4947 |
| 4948 IFDEF _helium | |
| 4949 TFT_dive_tissues_3: | |
| 4950 ; draw He tissues pressures | |
| 4951 lfsr FSR2,char_O_tissue_pres_He ; load base address of He pressures | |
| 4952 movlw dm_custom_tissue_diagram_left+.7 ; get dive mode left start position for He bars | |
| 4953 movwf win_leftx2 ; set column left (0-159) | |
| 4954 movlw .159-dm_custom_tissue_diagram_left-.8 ; get max width for He bars | |
| 4955 movwf win_width+0 ; set width (low byte) | |
| 4956 clrf win_width+1 ; ... | |
| 4957 movlw d'16' | |
| 4958 movwf lo ; tissue counter, 16 tissues | |
| 4959 clrf hi ; row counter | |
| 4960 TFT_dive_tissues_He_loop: | |
| 4961 movlw dm_custom_tissue_diagram_top+.25 ; dive mode top start position H2 | |
| 4962 rcall TFT_dive_tissues_bargraph ; draw tissue bargraph | |
| 4963 incf hi,F ; increment row counter | |
| 4964 decfsz lo,F ; decrement tissue counter, done? | |
| 4965 bra TFT_dive_tissues_He_loop ; NO - loop | |
| 4966 ENDIF | |
| 4967 | |
| 4968 TFT_dive_tissues_4: | |
| 4969 ; print number of leading tissue ; TODO: some flicker due to overwriting by tissue bars | |
| 4970 movff int_O_lead_supersat+0,WREG ; get current leading tissue's supersaturation (only low byte used for value) | |
| 4971 tstfsz WREG ; current supersaturation = 0 ? | |
| 4972 bra TFT_dive_tissues_5 ; NO - print number of leading tissue | |
| 4973 movff char_O_deco_info,WREG ; YES - get deco info vector | |
| 4974 btfss WREG,deco_ceiling ; - do we have a ceiling obligation? | |
| 4975 return ; NO - can ascent directly, don't print number, set standard color and return | |
| 4976 ; YES - print number of leading tissue | |
| 4977 TFT_dive_tissues_5: | |
| 4978 movff char_O_lead_tissue,lo ; get number of leading tissue as 0-15 | |
| 4979 incf lo,F ; adjust to 1-16 | |
| 4980 movlw .10 | |
| 4981 cpfsgt lo ; is it > 10 ? | |
| 4982 bra TFT_dive_tissues_6 ; NO - will output a single digit number | |
| 4983 ; start position for a 2 digit number | |
| 4984 WIN_TINY dm_custom_tissue_diagram_left+.32,dm_custom_tissue_diagram_top+.10 | |
| 4985 bra TFT_dive_tissues_7 | |
| 4986 TFT_dive_tissues_6: | |
| 4987 ; start position for a 1 digit number | |
| 4988 WIN_TINY dm_custom_tissue_diagram_left+.32+.4,dm_custom_tissue_diagram_top+.10 | |
| 4989 TFT_dive_tissues_7: | |
| 4990 FONT_COLOR_MEMO ; set output color | |
| 4991 bsf leftbind ; print left-aligned | |
| 4992 output_99 ; print tissue number (0-99) | |
| 4993 PRINT ; dump buffer to screen | |
| 4994 return ; done | |
| 4995 | |
| 656 | 4996 TFT_ceiling: |
| 4997 WIN_MEDIUM dm_custom_ceiling_column,dm_custom_ceiling_row | |
| 4998 MOVII int_O_ceiling,mpr ; get ceiling in [mbar] relative pressure | |
| 4999 call TFT_color_code_ceiling ; color-code the output (also strips off flags) | |
| 5000 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
| 5001 | |
| 5002 TSTOSS opt_units ; 0=m, 1=ft | |
| 5003 bra TFT_ceiling_GF_tissue_metric ; 0 - meter | |
| 5004 ;bra TFT_ceiling_GF_tissue_imperial ; 1 - feet | |
| 5005 | |
| 5006 TFT_ceiling_GF_tissue_imperial: | |
| 5007 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] | |
| 5008 output_999 ; print (0-999) | |
| 5009 bra TFT_ceiling_GF_tissue0 ; continue | |
| 5010 | |
| 5011 TFT_ceiling_GF_tissue_metric: | |
| 5012 bsf omit_digit_1 ; do not print 1st digit | |
| 5013 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 5014 bsf leftbind ; print left-aligned | |
| 5015 output_65535 ; print (xxx.x-) | |
| 5016 bra TFT_ceiling_GF_tissue0 ; continue | |
| 5017 | |
| 5018 TFT_ceiling_GF_tissue0: | |
| 5019 PUTC_PRINT " " ; append a space and dump to screen | |
| 5020 return | |
| 634 | 5021 |
| 5022 ; Helper Function - draw a bargraph | |
| 5023 TFT_dive_tissues_bargraph: | |
| 5024 addwf hi,W ; add row number to start position | |
| 5025 movwf win_top ; set as row top (0-239) | |
| 5026 movff POSTINC2,up ; get tissue value | |
| 5027 movf ex,W ; default color | |
| 5028 btfsc up,7 ; check if flag in bit 7 is set | |
| 5029 movf ul,W ; YES - switch to 2nd color | |
| 5030 bcf up,7 ; clear flag bit | |
| 5031 bcf STATUS,C ; clear carry bit | |
| 5032 rrcf up,F ; divide by 2 | |
| 5033 movff up,win_bargraph ; set bargraph length | |
| 5034 incf win_bargraph,F ; add a bit for a minimum visible bar | |
| 5035 BOX_COLOR ; draw bargraph | |
| 5036 return ; done | |
| 5037 | |
| 656 | 5038 ;----------------------------------------------------------------------------- |
| 5039 ; Dive Custom View - Ceiling, Supersaturation & Surf GF - Data | |
| 5040 ; | |
| 5041 | |
| 5042 global TFT_ceiling_GF_surfGF | |
| 5043 TFT_ceiling_GF_surfGF: ; data for ceiling, current GF and Surf GF | |
| 5044 ; Show ceiling | |
| 5045 rcall TFT_ceiling | |
| 5046 ; show current supersaturation | |
| 5047 WIN_MEDIUM dm_custom_clock_column+.3, dm_custom_gf_row | |
| 5048 MOVII int_O_lead_supersat,mpr ; bank-safe copy of leading tissue's supersaturation | |
| 5049 call TFT_color_code_supersat ; color-code output | |
| 5050 output_256 ; need to print lo only, int_O_lead_supersat value is limited to 255 | |
| 5051 PRINT ; dump to screen | |
| 5052 WIN_STD dm_custom_clock_column+.40, dm_custom_gf_row+.5 | |
| 5053 PUTC_PRINT "%" ; print "%" and dump to screen | |
| 5054 ; show Surface GF | |
| 5055 WIN_MEDIUM dm_custom_gf_column3+.13, dm_custom_gf_row | |
| 5056 MOVII int_O_GF_surface,mpr ; bank-safe copy of leading tissue's supersaturation | |
| 5057 FONT_COLOR_MEMO ; set color | |
| 5058 output_999 | |
| 5059 PRINT ; dump to screen | |
| 5060 WIN_STD dm_custom_gf_column3+.50, dm_custom_gf_row+.5 | |
| 5061 PUTC_PRINT "%" ; print "%" and dump to screen | |
| 5062 | |
| 5063 return | |
| 634 | 5064 |
| 5065 ;----------------------------------------------------------------------------- | |
| 5066 ; Dive Custom View - CNS - Mask | |
| 5067 ; | |
| 5068 global TFT_CNS_mask | |
| 5069 TFT_CNS_mask: | |
| 5070 FONT_COLOR_MASK ; select color | |
| 5071 | |
| 5072 WIN_TINY dm_custom_cns3_column1, dm_custom_cns3_title_row | |
| 5073 STRCPY_TEXT_PRINT tCNSsurf ; print label | |
| 5074 | |
| 5075 WIN_TINY dm_custom_cns3_column2, dm_custom_cns3_title_row | |
| 5076 | |
| 5077 IFDEF _cave_mode | |
| 5078 btfss cave_mode ; cave mode switched on? | |
| 5079 bra TFT_CNS_mask_col2 ; NO | |
| 5080 STRCPY_TEXT_PRINT tCNScave ; YES - print cave TTS label | |
| 5081 bra TFT_CNS_mask_col3 ; - continue with 3rd column | |
| 5082 ENDIF | |
| 5083 | |
| 5084 TFT_CNS_mask_col2: | |
| 5085 btfsc FLAG_oc_mode ; in OC mode? | |
| 5086 bra TFT_CNS_mask_ftts ; YES - print fTTS label | |
| 5087 btfsc bailout_mode ; NO - in bailout? | |
| 5088 bra TFT_CNS_mask_ftts ; YES - print fTTS label (label will be printed, but a fTTS will actually not be calculated) | |
| 5089 TSTOSS opt_calc_gasvolume ; NO - bailout volume calculation requested? | |
| 5090 bra TFT_CNS_mask_ftts ; NO - print fTTS label | |
| 5091 ;bra TFT_CNS_mask_bo ; YES - print bailout label | |
| 5092 | |
| 5093 TFT_CNS_mask_bo: | |
| 5094 STRCPY_TEXT_PRINT tCNSBO ; print bailout label | |
| 5095 bra TFT_CNS_mask_col3 ; continue with 3rd column | |
| 5096 | |
| 5097 TFT_CNS_mask_ftts: | |
| 5098 STRCPY_TEXT_PRINT tCNSfTTS ; print fTTS label | |
| 5099 ;bra TFT_CNS_mask_col3 ; continue with 3rd column | |
| 5100 | |
| 5101 TFT_CNS_mask_col3: | |
| 5102 WIN_TINY dm_custom_cns3_column3, dm_custom_cns3_title_row | |
| 5103 STRCPY_TEXT_PRINT tCNSnow ; print CNS now label | |
| 5104 return ; done | |
| 5105 | |
| 5106 | |
| 5107 ;----------------------------------------------------------------------------- | |
| 5108 ; Dive Custom View - CNS - Data | |
| 5109 ; | |
| 5110 global TFT_CNS | |
| 5111 TFT_CNS: | |
| 5112 ; CNS at end of normal dive | |
| 5113 WIN_STD dm_custom_cns3_column1+.3,dm_custom_cns3_row | |
| 5114 MOVII int_O_CNS_norm,mpr ; get CNS at end of dive in normal plan | |
| 5115 call TFT_color_code_cns ; color-code the CNS value | |
| 5116 bsf leftbind ; print left-aligned | |
| 5117 output_999 ; print (0-999) | |
| 5118 STRCAT_PRINT "% " ; append unit and trailing space and dump to screen | |
| 5119 ; fTTS / Bailout CNS, if enabled | |
| 5120 WIN_STD dm_custom_cns3_column2+.2,dm_custom_cns3_row | |
| 5121 btfsc bailout_mode ; in bailout? | |
| 5122 bra TFT_CNS_3 ; YES - show "---" | |
| 5123 TSTOSS opt_calc_gasvolume ; NO - bailout volume calculation requested? | |
| 5124 bra TFT_CNS_1 ; NO - continue checking fTTS extra time | |
| 5125 btfss FLAG_oc_mode ; YES - in OC mode? | |
| 5126 bra TFT_CNS_2 ; NO - show CNS% | |
| 5127 ;bra TFT_CNS_1 ; YES - continue checking fTTS extra time | |
| 5128 | |
| 5129 TFT_CNS_1: | |
| 5130 ; not in bailout, no volume calculation, and/or in OC mode | |
| 5131 TSTOSS char_I_extra_time ; fTTS extra time configured? | |
| 5132 bra TFT_CNS_3 ; NO - show "---" | |
| 5133 ;bra TFT_CNS_2 ; YES - show CNS% | |
| 5134 | |
| 5135 TFT_CNS_2: | |
| 5136 MOVII int_O_CNS_alt,mpr ; get CNS at end of dive in alternative plan | |
| 5137 call TFT_color_code_cns ; color-code the CNS value | |
| 5138 bsf leftbind ; print left-aligned | |
| 5139 output_999 ; print (0-999) | |
| 5140 STRCAT_PRINT "% " ; append unit and trailing space and dump to screen | |
| 5141 bra TFT_CNS_4 ; continue | |
| 5142 | |
| 5143 TFT_CNS_3: | |
| 5144 IFDEF _cave_mode | |
| 5145 btfss cave_mode ; cave mode switched on? | |
| 5146 bra TFT_CNS_3a ; NO - show dashes | |
| 5147 btfsc backtrack_entire_full ; YES - cave mode shut down due to storage fully used up? | |
| 5148 bra TFT_CNS_3a ; YES - show dashes | |
| 5149 btfss dive_turned ; NO - dive turned? | |
| 5150 bra TFT_CNS_2 ; NO - show cave CNS | |
| 5151 ;bra TFT_CNS_3a ; YES - show dashes | |
| 5152 ENDIF | |
| 5153 | |
| 5154 TFT_CNS_3a: | |
| 5155 FONT_COLOR_MEMO ; select color | |
| 5156 STRCPY_PRINT "--- " ; print non-avail symbol | |
| 5157 ;bra TFT_CNS_4 ; continue | |
| 5158 | |
| 5159 TFT_CNS_4: | |
| 5160 ; current CNS | |
| 5161 WIN_STD dm_custom_cns3_column3+.3,dm_custom_cns3_row | |
| 5162 MOVII int_O_CNS_current,mpr ; get current CNS | |
| 5163 call TFT_color_code_cns ; color-code the CNS value | |
| 5164 bsf leftbind ; print left-aligned | |
| 5165 output_999 ; print (0-999) | |
| 5166 PUTC_PRINT "%" ; append unit and dump to screen | |
| 5167 return ; done | |
| 5168 | |
| 5169 | |
| 5170 ;----------------------------------------------------------------------------- | |
| 5171 ; Dive Custom View - ppO2, EAD/END & Gas Density - Mask | |
| 5172 ; | |
| 5173 global TFT_ppo2_ead_end_cns_mask | |
| 5174 TFT_ppo2_ead_end_cns_mask: | |
| 5175 FONT_COLOR_MASK ; select color | |
| 5176 | |
| 5177 WIN_TINY dm_custom_ppo2_column-.2,dm_custom_ppo2_title_row | |
| 5178 STRCPY_TEXT_PRINT tppO2 ; print label | |
| 5179 | |
| 5180 WIN_TINY dm_custom_ead_column,dm_custom_eadend_title_row | |
| 5181 STRCPY_TEXT_PRINT tDiveEAD_END ; print label | |
| 5182 | |
| 5183 IFDEF _ccr_pscr | |
| 5184 WIN_TINY dm_custom_cns_column-.5,dm_custom_eadend_title_row | |
| 5185 STRCPY_TEXT_PRINT tGasDensity ; print label | |
| 5186 ELSE | |
| 5187 WIN_TINY dm_custom_cns_column,dm_custom_cns_title_row | |
| 5188 STRCPY_TEXT_PRINT tCNS2 ; print label | |
| 5189 ENDIF | |
| 5190 | |
| 5191 return ; done | |
| 5192 | |
| 5193 | |
| 5194 | |
| 5195 ;----------------------------------------------------------------------------- | |
| 5196 ; Dive Custom View - ppO2, EAD/END & Gas Density - Data | |
| 5197 ; | |
| 5198 global TFT_ppo2_ead_end_cns | |
| 5199 TFT_ppo2_ead_end_cns: | |
| 5200 ; show ppO2 | |
| 5201 WIN_MEDIUM dm_custom_ppo2_column, dm_custom_ppo2_row | |
| 5202 MOVII int_O_breathed_ppO2,mpr ; copy ppO2 of the currently breathed gas to hi:lo | |
| 5203 call TFT_color_code_ppo2 ; color-code output | |
| 5204 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 5205 output_999 ; print ppO2 (0.00-9.99) | |
| 5206 PRINT ; dump to screen | |
| 5207 ; show END/EAD | |
| 5208 FONT_COLOR_MEMO ; select color | |
| 5209 WIN_SMALL dm_custom_ead_column, dm_custom_ead_row | |
| 5210 STRCPY_TEXT tEAD ; print "EAD:" | |
| 5211 MOVII int_O_EAD_pres,mpr ; copy EAD in [mbar] to MPR | |
| 5212 rcall TFT_end_ead_common ; convert to depth, print and limit to 8 chars | |
| 5213 WIN_SMALL dm_custom_end_column, dm_custom_end_row | |
| 5214 STRCPY_TEXT tEND ; print "END:" | |
| 5215 MOVII int_O_END_pres,mpr ; copy END in [mbar] to MPR | |
| 5216 rcall TFT_end_ead_common ; convert to depth, print and limit to 8 chars | |
| 5217 IFDEF _helium | |
| 5218 ; show gas density | |
| 5219 WIN_MEDIUM dm_custom_cns_column-.5, dm_custom_cns_row | |
| 5220 MOVII int_O_gas_density,mpr ; get current gas density | |
| 5221 call TFT_color_code_cns ; color-code output | |
| 5222 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 5223 output_999 ; print (0.00-9.99) | |
| 5224 PRINT ; dump to screen | |
| 5225 ELSE | |
| 5226 ; show CNS | |
| 5227 WIN_STD dm_custom_cns_column+.3, dm_custom_cns_row | |
| 5228 MOVII int_O_CNS_current,mpr ; get current CNS | |
| 5229 call TFT_color_code_cns ; color-code CNS output | |
| 5230 bsf leftbind ; print left-aligned | |
| 5231 output_999 ; print (0-999) | |
| 5232 PUTC_PRINT "%" ; append unit and dump buffer to screen | |
| 5233 ENDIF | |
| 5234 return ; done | |
| 5235 | |
| 5236 | |
| 5237 ; Helper Function - convert to depth, print and limit to 8 chars | |
| 5238 TFT_end_ead_common: | |
| 5239 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
| 5240 TSTOSS opt_units ; 0=Meter, 1=Feet | |
| 5241 bra TFT_end_ead_common_metric ; 0: meter | |
| 5242 ;bra TFT_end_ead_common_imperial ; 1: feet | |
| 5243 | |
| 5244 TFT_end_ead_common_imperial: | |
| 5245 call convert_cm_to_feet ; convert depth in [cm] to depth in [feet] | |
| 5246 output_999 ; print (0-999) | |
| 5247 PRINT ; dump buffer to screen | |
| 5248 return ; done | |
| 5249 | |
| 5250 TFT_end_ead_common_metric: | |
| 5251 bsf omit_digit_2 ; do not print 2nd and 1st digit | |
| 5252 output_65535 ; print (0xx-655xx) | |
| 5253 PUTC_PRINT 'm' ; append unit and dump to screen | |
| 5254 return ; done | |
| 5255 | |
| 5256 | |
| 5257 ;----------------------------------------------------------------------------- | |
| 5258 ; Dive Custom View - GF Factors (Mask only) | |
| 5259 ; | |
| 5260 global TFT_gf_factors_mask | |
| 5261 TFT_gf_factors_mask: | |
| 5262 FONT_COLOR_MASK ; select color | |
| 5263 | |
| 5264 ; show labels | |
| 5265 WIN_TINY dm_custom_gf_column1,dm_custom_gf_title_row | |
| 5266 STRCPY_TEXT_PRINT tGFactors | |
| 5267 WIN_TINY dm_custom_gf_column3,dm_custom_gf_title_row | |
| 5268 STRCPY_TEXT_PRINT taGFactors | |
| 5269 | |
| 5270 ; show GF (static) | |
| 5271 WIN_STD dm_custom_gf_column1, dm_custom_gf_row | |
| 5272 FONT_COLOR_DISABLED ; default to disabled color | |
| 5273 btfss use_aGF ; shall use alternative GF factors? | |
| 5274 FONT_COLOR_MEMO ; NO - switch to memo color | |
| 5275 movff opt_GF_low, lo ; get normal GF low | |
| 5276 movff opt_GF_high,hi ; get normal GF high | |
| 5277 rcall TFT_gf_factors_mask_helper ; print GFs | |
| 5278 | |
| 5279 ; show aGF (static) | |
| 5280 FONT_COLOR_MEMO ; select memo color | |
| 5281 TSTOSS opt_enable_aGF ; are alternative GF factors enabled? | |
| 5282 bra TFT_gf_factors_mask_3 ; NO - show "---" and return | |
| 5283 ; bra TFT_gf_factors_mask_0 ; YES - show arrow | |
| 5284 | |
| 5285 TFT_gf_factors_mask_0: | |
| 5286 WIN_STD dm_custom_gf_column2, dm_custom_gf_row | |
| 5287 btfss use_aGF ; shall use aGF? | |
| 5288 bra TFT_gf_factors_mask_1L ; NO - print "<- " | |
| 5289 ;bra TFT_gf_factors_mask_1R ; YES - print " ->" | |
| 5290 | |
| 5291 TFT_gf_factors_mask_1R: | |
| 5292 STRCPY_PRINT " ->" ; print " ->" | |
| 5293 bra TFT_gf_factors_mask_2 ; continue | |
| 5294 | |
| 5295 TFT_gf_factors_mask_1L: | |
| 5296 STRCPY_PRINT "<- " ; print "<- " | |
| 5297 ;bra TFT_gf_factors_mask_2 ; continue | |
| 5298 | |
| 5299 TFT_gf_factors_mask_2: | |
| 5300 WIN_STD dm_custom_gf_column3, dm_custom_gf_row | |
| 5301 ;FONT_COLOR_MEMO ; select memo color (still selected) | |
| 5302 btfss use_aGF ; shall use aGF? | |
| 5303 FONT_COLOR_DISABLED ; NO - switch to disabled color | |
| 5304 movff opt_aGF_low, lo ; get aGF low | |
| 5305 movff opt_aGF_high,hi ; get aGF high | |
| 5306 rcall TFT_gf_factors_mask_helper ; print GFs | |
| 5307 return ; done | |
| 5308 | |
| 5309 TFT_gf_factors_mask_3: | |
| 5310 WIN_STD dm_custom_gf_column3+.10, dm_custom_gf_row | |
| 5311 STRCPY_PRINT "---" ; print not-avail symbol | |
| 5312 return ; done | |
| 5313 | |
| 5314 ; Helper Function - print GF pair | |
| 5315 TFT_gf_factors_mask_helper: | |
| 5316 output_256 ; print GF low (0-255) | |
| 5317 PUTC "/" ; print "/" | |
| 5318 movff hi,lo ; get GF high | |
| 5319 output_256 ; print GF high (0-255) | |
| 5320 PRINT ; dump to screen | |
| 5321 return ; done | |
| 5322 | |
| 5323 | |
| 5324 ;----------------------------------------------------------------------------- | |
| 5325 ; Dive Custom View - Clock, Battery & Surface Pressure - Mask | |
| 5326 ; | |
| 5327 global TFT_clock_batt_surfpress_mask | |
| 5328 TFT_clock_batt_surfpress_mask: | |
| 5329 FONT_COLOR_MASK ; select color | |
| 5330 | |
| 5331 WIN_TINY dm_custom_clock_column, dm_custom_clock_title_row | |
| 5332 STRCPY_TEXT_PRINT tTime ; "Time" | |
| 5333 | |
| 5334 WIN_TINY dm_custom_battery_column, dm_custom_battery_title_row | |
| 5335 STRCPY_TEXT_PRINT tBattery ; "Battery" | |
| 5336 | |
| 5337 WIN_TINY dm_custom_surfpres_column+.8, dm_custom_surfpres_title_row | |
| 5338 STRCPY_TEXT_PRINT tSurface ; "Surface" | |
| 5339 | |
| 5340 ; show configured surface pressure (done in mask, because it's static during the dive) | |
| 5341 WIN_SMALL dm_custom_surfpres_column, dm_custom_surfpres_row | |
| 5342 FONT_COLOR_MEMO ; select color | |
| 5343 MOVII pressure_surf,mpr ; get surface pressure | |
| 5344 output_65535 ; print (5 digits, first one used as spacer) | |
| 5345 PUTC ' ' ; print a space | |
| 5346 STRCAT_TEXT_PRINT tMBAR ; append unit and dump to screen | |
| 5347 return ; done | |
| 5348 | |
| 5349 | |
| 5350 ;----------------------------------------------------------------------------- | |
| 5351 ; Dive Custom View - Clock, Battery & Surface Pressure - Data | |
| 5352 ; | |
| 5353 global TFT_clock_batt_surfpress | |
| 5354 TFT_clock_batt_surfpress: | |
| 5355 ; update clock | |
| 5356 WIN_SMALL dm_custom_clock_column, dm_custom_clock_row | |
| 5357 FONT_COLOR_MEMO ; select color | |
| 5358 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time | |
| 654 | 5359 TSTOSS opt_timeformat ; =1: Use 12h format |
| 5360 bra TFT_clock_batt_surfpress24 ; <>1: Use 24h format | |
| 5361 ; 12h Format | |
| 5362 movff rtc_latched_hour,lo ; get hours | |
| 5363 call TFT_convert_lo_into_12h_format ; converts lo (0-23h) into lo (1-12) and sets aux_flag for PM/AM | |
| 5364 output_99 ; print hours (0-99) | |
| 5365 movlw ':' ; load a ":" | |
| 5366 movff rtc_latched_secs,lo ; get seconds | |
| 5367 btfss lo,0 ; on even second? | |
| 5368 movlw ' ' ; NO - load a space char | |
| 5369 movwf POSTINC2 ; print ":" or space char | |
| 5370 movff rtc_latched_mins,lo ; get minutes | |
| 5371 output_99x ; print minutes (00-99) | |
| 5372 btfsc aux_flag ; =1 for PM | |
| 5373 bra TFT_clock_batt_surfpress_PM | |
| 5374 STRCAT_PRINT "AM" | |
| 5375 bra TFT_clock_batt_surfpress_batt ; done | |
| 5376 TFT_clock_batt_surfpress_PM: | |
| 5377 STRCAT_PRINT "PM" | |
| 5378 bra TFT_clock_batt_surfpress_batt ; done | |
| 5379 TFT_clock_batt_surfpress24: | |
| 634 | 5380 movff rtc_latched_hour,lo ; get hours |
| 5381 output_99 ; print hours (0-99) | |
| 5382 PUTC ':' ; print ":" | |
| 5383 movff rtc_latched_mins,lo ; get minutes | |
| 5384 output_99x ; print minutes (00-99) | |
| 5385 PUTC ":" ; print ":" | |
| 5386 movff rtc_latched_secs,lo ; get seconds | |
| 5387 output_99x ; print seconds (00-99) | |
| 5388 PRINT ; dump to screen | |
| 654 | 5389 TFT_clock_batt_surfpress_batt: |
| 634 | 5390 ; show battery voltage |
| 5391 WIN_SMALL dm_custom_battery_column, dm_custom_battery_volt_row | |
| 5392 ;FONT_COLOR_MEMO ; select color | |
| 5393 MOVII batt_voltage,mpr ; get voltage | |
| 5394 bsf decimal_digit3 ; place a decimal point in front of digit 3 | |
| 5395 bsf omit_digit_1 ; do not print 1st digit | |
| 5396 output_9999 ; print voltage (0.00x-9.99x) | |
| 5397 PUTC_PRINT 'V' ; append unit and dump to screen | |
| 5398 | |
| 5399 ; show battery percent | |
| 5400 WIN_SMALL dm_custom_battery_column+.7, dm_custom_battery_percent_row | |
| 5401 call TFT_color_code_battery ; color-code according to battery_low_condition flag | |
| 5402 movff batt_percent,lo ; get battery % | |
| 5403 output_256 ; print battery % (0-999) | |
| 5404 PUTC_PRINT "%" ; append unit and dump to screen | |
| 5405 | |
| 5406 ; surface pressure is shown via the mask because it is static | |
| 5407 return ; done | |
| 5408 | |
| 5409 | |
| 5410 IFDEF _ccr_pscr | |
| 5411 | |
| 5412 ;----------------------------------------------------------------------------- | |
| 5413 ; Dive Custom View - Sensor Check - Mask | |
| 5414 ; | |
| 5415 global TFT_sensor_check_mask | |
| 5416 TFT_sensor_check_mask: | |
| 5417 FONT_COLOR_MASK ; select color | |
| 5418 | |
| 5419 WIN_TINY dm_custom_s_check_title_column, dm_custom_s_check_title_row | |
| 5420 STRCPY_TEXT_PRINT tSensorCheck ; print label | |
| 5421 | |
| 5422 WIN_TINY dm_custom_ppO2_column, dm_custom_s_check_title_row | |
| 5423 STRCPY_TEXT_PRINT tppO2O2 ; print label | |
| 5424 | |
| 5425 WIN_TINY dm_custom_ppDil_column, dm_custom_s_check_title_row | |
| 5426 STRCPY_TEXT_PRINT tppO2Dil ; print label | |
| 5427 | |
| 5428 return ; done | |
| 5429 | |
| 5430 | |
| 5431 ;----------------------------------------------------------------------------- | |
| 5432 ; Dive Custom View - Sensor Check - Data | |
| 5433 ; | |
| 5434 global TFT_sensor_check | |
| 5435 TFT_sensor_check: | |
| 5436 ; show ppO2 of O2 in this depth | |
| 5437 WIN_MEDIUM dm_custom_ppO2_column, dm_custom_s_check_row | |
| 5438 MOVII int_O_O2_ppO2,mpr ; copy ppO2 of pure O2 to hi:lo | |
| 5439 rcall TFT_sensor_check_helper ; print ppO2 | |
| 5440 ; show ppO2 of the diluent in this depth | |
| 5441 WIN_MEDIUM dm_custom_ppDil_column, dm_custom_s_check_row | |
| 5442 MOVII int_O_pure_ppO2,mpr ; copy ppO2 of pure gas to hi:lo | |
| 5443 rcall TFT_sensor_check_helper ; print ppO2 | |
| 5444 return ; done | |
| 5445 | |
| 5446 TFT_sensor_check_helper: | |
| 5447 call TFT_color_code_ppo2 ; color-code output | |
| 5448 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 5449 output_999 ; print ppO2 (0.00-9.99) | |
| 5450 PRINT ; dump to screen | |
| 5451 return ; done | |
| 5452 | |
| 5453 | |
| 5454 ;----------------------------------------------------------------------------- | |
| 5455 ; Dive Custom View - pSCR Info - Mask | |
| 5456 ; | |
| 5457 global TFT_pscr_info_mask | |
| 5458 TFT_pscr_info_mask: | |
| 5459 FONT_COLOR_MASK ; select color | |
| 5460 | |
| 5461 WIN_TINY dm_custom_pscr_drop_column, dm_custom_pscr_title_row | |
| 5462 STRCPY_TEXT_PRINT tPSCR_O2_drop ; print label | |
| 5463 | |
| 5464 WIN_TINY dm_custom_pscr_ratio_column, dm_custom_pscr_title_row | |
| 5465 STRCPY_TEXT_PRINT tPSCR_lungratio ; print label | |
| 5466 | |
| 5467 WIN_TINY dm_custom_ppo2_column-.2,dm_custom_ppo2_title_row | |
| 5468 btfsc bailout_mode ; in bailout? | |
| 5469 bra TFT_pscr_info_mask_2 ; YES | |
| 5470 ;bra TFT_pscr_info_mask_1 ; NO | |
| 5471 | |
| 5472 TFT_pscr_info_mask_1: | |
| 5473 STRCPY_TEXT_PRINT tppO2Mix ; print "ppO2(Mix)" | |
| 5474 return ; done | |
| 5475 | |
| 5476 TFT_pscr_info_mask_2: | |
| 5477 STRCPY_TEXT_PRINT tppO2 ; print "ppO2" | |
| 5478 return ; done | |
| 5479 | |
| 5480 | |
| 5481 ;----------------------------------------------------------------------------- | |
| 5482 ; Dive Custom View - pSCR Info - Data | |
| 5483 ; | |
| 5484 global TFT_pscr_info | |
| 5485 TFT_pscr_info: | |
| 5486 ;show ppO2 | |
| 5487 WIN_MEDIUM dm_custom_ppo2_column,dm_custom_ppo2_row | |
| 5488 MOVII int_O_pSCR_ppO2,mpr ; copy pSCR ppO2 to hi:lo | |
| 5489 call TFT_color_code_ppo2 ; color-code output | |
| 5490 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 5491 output_999 ; print ppO2 (0.00-9-99) | |
| 5492 PRINT ; dump to screen | |
| 5493 ; show drop | |
| 5494 WIN_STD dm_custom_pscr_drop_column+.11,dm_custom_pscr_row | |
| 5495 FONT_COLOR_MEMO ; select color | |
| 5496 movff char_I_PSCR_drop,lo ; get drop | |
| 5497 output_99 ; print drop (0-99) | |
| 5498 PUTC_PRINT "%" ; append unit and dump to screen | |
| 5499 ; show lung ratio | |
| 5500 WIN_STD dm_custom_pscr_ratio_column+.5,dm_custom_pscr_row | |
| 5501 ;FONT_COLOR_MEMO ; select color | |
| 5502 movff char_I_PSCR_lungratio,lo ; get ratio | |
| 5503 STRCPY "1/" ; print "1/" | |
| 5504 bsf leftbind ; print left-aligned | |
| 5505 output_256 ; print ratio number (0-256) | |
| 5506 PRINT ; dump to screen | |
| 5507 return ; done | |
| 5508 | |
| 5509 ENDIF ; _ccr_psrc | |
| 5510 | |
| 656 | 5511 IFDEF _external_sensor_eccr |
| 634 | 5512 |
| 5513 ;----------------------------------------------------------------------------- | |
| 5514 ; Dive Custom View - Sensor ppO2 - Mask | |
| 5515 ; | |
| 5516 global TFT_ppo2_sensors_mask | |
| 5517 TFT_ppo2_sensors_mask: | |
| 5518 FONT_COLOR_MASK ; select color | |
| 5519 | |
| 5520 WIN_TINY dm_custom_hud_sensor1_column+.4,dm_custom_hud_title_row | |
| 5521 STRCPY_TEXT_PRINT tDiveHudMask1 ; print label | |
| 5522 | |
| 5523 WIN_TINY dm_custom_hud_sensor2_column+.3,dm_custom_hud_title_row | |
| 5524 STRCPY_TEXT_PRINT tDiveHudMask2 ; print label | |
| 5525 | |
| 5526 WIN_TINY dm_custom_hud_sensor3_column+.2,dm_custom_hud_title_row | |
| 5527 STRCPY_TEXT_PRINT tDiveHudMask3 ; print label | |
| 5528 | |
| 5529 return ; done | |
| 5530 | |
| 5531 | |
| 5532 ;----------------------------------------------------------------------------- | |
| 5533 ; Dive Custom View - Sensor ppO2 - Data | |
| 5534 ; | |
| 5535 ; Definition of the output: | |
| 5536 ; | |
| 5537 ; sensorX use voting o2 | |
| 5538 ; _calibrated _O2 _logic _ppo2 Output Color | |
| 5539 ; _ok _sensorX _sensorX _sensorX | |
| 5540 ;----------------------------------------------------------------------------------------------- | |
| 5541 ; 0 -/- -/- -/- "----" memo | |
| 5542 ; 1 0 -/- = 0 o2_ppo2_sensorX attention | |
| 5543 ; 1 0 -/- > 0 o2_ppo2_sensorX disabled | |
| 5544 ; 1 1 0 -/- o2_ppo2_sensorX TFT_color_code_ppo2_hud + win_invert | |
| 5545 ; 1 1 1 -/- o2_ppo2_sensorX TFT_color_code_ppo2_hud | |
| 5546 ; | |
| 5547 global TFT_ppo2_sensors | |
| 5548 TFT_ppo2_sensors: | |
| 5549 | |
| 5550 ; sensor 1 | |
| 5551 TFT_ppo2_sensors_1: | |
| 5552 btfsc sensor1_calibrated_ok ; valid calibration? | |
| 5553 bra TFT_ppo2_sensors_1b ; YES | |
| 5554 btfsc sensor1_active ; NO - valid HUD data for this sensor? | |
| 5555 bra TFT_ppo2_sensors_1b ; YES | |
| 5556 ;bra TFT_ppo2_sensors_1a ; NO | |
| 5557 | |
| 5558 TFT_ppo2_sensors_1a: | |
| 5559 ; no valid calibration | |
| 5560 WIN_STD dm_custom_hud_sensor1_column+.7, dm_custom_hud_row+.5 | |
| 5561 FONT_COLOR_MEMO ; set color | |
| 5562 STRCPY_PRINT "---" ; print dashes | |
| 5563 bra TFT_ppo2_sensors_2 ; continue with sensor 2 | |
| 5564 | |
| 5565 TFT_ppo2_sensors_1b: | |
| 5566 ; sensor has a valid calibration | |
| 5567 WIN_MEDIUM dm_custom_hud_sensor1_column,dm_custom_hud_row | |
| 5568 movff sensor1_ppO2,lo ; load ppO2 value into transfer storage for output | |
| 5569 btfsc use_O2_sensor1 ; in use? | |
| 5570 bra TFT_ppo2_sensors_1d ; YES | |
| 5571 tstfsz lo ; NO - sensor value = 0 ? | |
| 5572 bra TFT_ppo2_sensors_1c ; NO | |
| 5573 FONT_COLOR_ATTENTION ; YES - set attention color | |
| 5574 bra TFT_ppo2_sensors_1e ; - print ppO2 value | |
| 5575 | |
| 5576 TFT_ppo2_sensors_1c: | |
| 5577 ; sensor has valid calibration, is not in use and has a value > 0 | |
| 5578 FONT_COLOR_DISABLED ; set disabled color | |
| 5579 bra TFT_ppo2_sensors_1e ; print ppO2 value | |
| 5580 | |
| 5581 TFT_ppo2_sensors_1d: | |
| 5582 ; sensor has valid calibration and is in use | |
| 5583 call TFT_color_code_ppo2_hud ; color-code with ppO2 [cbar] in lo | |
| 5584 btfsc voting_logic_sensor1 ; sensor value agrees with values of other sensors? | |
| 5585 bra TFT_ppo2_sensors_1e ; YES | |
| 5586 bsf win_invert ; NO - invert output | |
| 5587 ;bra TFT_ppo2_sensors_1e ; print ppO2 value | |
| 5588 | |
| 5589 TFT_ppo2_sensors_1e: | |
| 5590 ; all coloring is set up now, let's write the value to the display! | |
| 5591 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 5592 output_256 ; print (0.00-2.55) | |
| 5593 PRINT ; dump to screen | |
| 5594 | |
| 5595 ; sensor 2 | |
| 5596 TFT_ppo2_sensors_2: | |
| 5597 btfsc sensor2_calibrated_ok ; valid calibration? | |
| 5598 bra TFT_ppo2_sensors_2b ; YES | |
| 5599 btfsc sensor2_active ; NO - valid HUD data for this sensor? | |
| 5600 bra TFT_ppo2_sensors_2b ; YES | |
| 5601 ;bra TFT_ppo2_sensors_2a ; NO | |
| 5602 | |
| 5603 TFT_ppo2_sensors_2a: | |
| 5604 ; no valid calibration | |
| 5605 WIN_STD dm_custom_hud_sensor2_column+.7, dm_custom_hud_row+.5 | |
| 5606 FONT_COLOR_MEMO ; set color | |
| 5607 STRCPY_PRINT "---" ; print dashes | |
| 5608 bra TFT_ppo2_sensors_3 ; continue with sensor 3 | |
| 5609 | |
| 5610 TFT_ppo2_sensors_2b: | |
| 5611 ; sensor has a valid calibration | |
| 5612 WIN_MEDIUM dm_custom_hud_sensor2_column,dm_custom_hud_row | |
| 5613 movff sensor2_ppO2,lo ; load ppO2 value into transfer storage for output | |
| 5614 btfsc use_O2_sensor2 ; in use? | |
| 5615 bra TFT_ppo2_sensors_2d ; YES | |
| 5616 tstfsz lo ; NO - sensor value = 0? | |
| 5617 bra TFT_ppo2_sensors_2c ; NO | |
| 5618 FONT_COLOR_ATTENTION ; YES - print in attention color | |
| 5619 bra TFT_ppo2_sensors_2e ; - print ppO2 value | |
| 5620 | |
| 5621 TFT_ppo2_sensors_2c: | |
| 5622 ; sensor has valid calibration, is not in use and has a value > 0 | |
| 5623 FONT_COLOR_DISABLED ; output in light blue | |
| 5624 bra TFT_ppo2_sensors_2e ; print ppO2 value | |
| 5625 | |
| 5626 TFT_ppo2_sensors_2d: | |
| 5627 ; sensor has valid calibration and is in use | |
| 5628 call TFT_color_code_ppo2_hud ; color-code with ppO2 [cbar] in lo | |
| 5629 btfsc voting_logic_sensor2 ; sensor value agrees with values of other sensors? | |
| 5630 bra TFT_ppo2_sensors_2e ; YES | |
| 5631 bsf win_invert ; NO - invert output | |
| 5632 ;bra TFT_ppo2_sensors_2e ; - print ppO2 value | |
| 5633 | |
| 5634 TFT_ppo2_sensors_2e: | |
| 5635 ; all coloring is set up now, let's write the value to the display! | |
| 5636 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 5637 output_256 ; print (0.00-2.55) | |
| 5638 PRINT ; dump to screen | |
| 5639 | |
| 5640 ; sensor 3 | |
| 5641 TFT_ppo2_sensors_3: | |
| 5642 btfsc sensor3_calibrated_ok ; valid calibration? | |
| 5643 bra TFT_ppo2_sensors_3b ; YES | |
| 5644 btfsc sensor3_active ; NO - valid HUD data for this sensor? | |
| 5645 bra TFT_ppo2_sensors_3b ; YES | |
| 5646 ;bra TFT_ppo2_sensors_3a ; NO | |
| 5647 | |
| 5648 TFT_ppo2_sensors_3a: | |
| 5649 WIN_STD dm_custom_hud_sensor3_column+.7, dm_custom_hud_row+.5 | |
| 5650 FONT_COLOR_MEMO ; set color | |
| 5651 STRCPY_PRINT "---" ; print dashes | |
| 5652 bra TFT_ppo2_sensors_4 ; done | |
| 5653 | |
| 5654 TFT_ppo2_sensors_3b: | |
| 5655 ; sensor has a valid calibration | |
| 5656 WIN_MEDIUM dm_custom_hud_sensor3_column,dm_custom_hud_row | |
| 5657 movff sensor3_ppO2,lo ; load ppO2 value into transfer storage for output | |
| 5658 btfsc use_O2_sensor3 ; in use? | |
| 5659 bra TFT_ppo2_sensors_3d ; YES | |
| 5660 tstfsz lo ; NO - sensor value = 0? | |
| 5661 bra TFT_ppo2_sensors_3c ; NO | |
| 5662 FONT_COLOR_ATTENTION ; YES - print in attention color | |
| 5663 bra TFT_ppo2_sensors_3e ; - print ppO2 value | |
| 5664 | |
| 5665 TFT_ppo2_sensors_3c: | |
| 5666 ; sensor has valid calibration, is not in use and has a value > 0 | |
| 5667 FONT_COLOR_DISABLED ; print in disabled color | |
| 5668 bra TFT_ppo2_sensors_3e ; print ppO2 value | |
| 5669 | |
| 5670 TFT_ppo2_sensors_3d: | |
| 5671 ; sensor has valid calibration and is in use | |
| 5672 call TFT_color_code_ppo2_hud ; color-code with ppO2 [cbar] in lo | |
| 5673 btfsc voting_logic_sensor3 ; sensor value agrees with values other sensors? | |
| 5674 bra TFT_ppo2_sensors_3e ; YES | |
| 5675 bsf win_invert ; NO - invert output | |
| 5676 ;bra TFT_ppo2_sensors_3e ; - print ppO2 value | |
| 5677 | |
| 5678 TFT_ppo2_sensors_3e: | |
| 5679 ; all coloring is set up now, let's write the value to the display! | |
| 5680 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 5681 output_256 ; print (0.00-2.55) | |
| 5682 PRINT ; dump to screen | |
| 5683 | |
| 5684 TFT_ppo2_sensors_4: | |
| 5685 return ; done | |
| 5686 | |
| 656 | 5687 ENDIF ; _external_sensor_eccr |
| 634 | 5688 |
| 5689 IFDEF _rx_functions | |
| 5690 | |
| 5691 ;----------------------------------------------------------------------------- | |
| 5692 ; Dive Custom View - Pressures & SAC - Mask | |
| 5693 ; | |
| 5694 global TFT_pressures_SAC_mask | |
| 5695 TFT_pressures_SAC_mask: | |
| 5696 FONT_COLOR_MASK ; select color | |
| 5697 | |
| 5698 ; pressure reading 1 | |
| 5699 WIN_TINY dm_custom_tankdata_pres1_col, dm_custom_tankdata_mask_row | |
| 5700 movff char_I_pressure_gas+0,WREG ; =0: disabled, =1..10: gases/dils | |
| 5701 bcf aux_flag ; selector for disabled / need set to disabled | |
| 5702 rcall TFT_pressures_SAC_mask_h1 ; print gas composition or " ---" if disabled | |
| 5703 | |
| 5704 ; pressure reading 2 | |
| 5705 WIN_TINY dm_custom_tankdata_pres2_col, dm_custom_tankdata_mask_row | |
| 5706 movff char_I_pressure_gas+1,WREG ; =0: need to reading 1, =1..10: gases/dils | |
| 5707 bsf aux_flag ; selector for disabled / need set to need | |
| 5708 rcall TFT_pressures_SAC_mask_h1 ; print gas composition or "Need " if 0 | |
| 5709 | |
| 5710 ; SAC rate | |
| 5711 WIN_TINY dm_custom_tankdata_SAC_col, dm_custom_tankdata_mask_row | |
| 5712 STRCPY_TEXT tSAC ; "SAC | |
| 5713 STRCAT " (" ; ( | |
| 5714 STRCAT_TEXT tLitersMinute ; l/min | |
| 5715 PUTC_PRINT ")" ; )" | |
| 5716 return ; done | |
| 5717 | |
| 5718 | |
| 5719 ; Helper Function - print gas composition or " ---" if disabled | |
| 5720 TFT_pressures_SAC_mask_h1: | |
| 5721 tstfsz WREG ; pressure reading assigned? | |
| 5722 bra TFT_pressures_SAC_mask_h2 ; YES - print gas composition | |
| 5723 btfsc aux_flag ; NO - check auxiliary flag | |
| 5724 bra TFT_pressures_SAC_mask_h3 ; 1 - print "Need " | |
| 5725 STRCAT_PRINT " ---" ; 0 - print " ---" | |
| 5726 return ; - done | |
| 5727 | |
| 5728 TFT_pressures_SAC_mask_h2: | |
| 5729 decf WREG,W ; (1..10) -> (0..9) | |
| 5730 bsf short_gas_descriptions ; just "Air", "O2" or "xx/yy" | |
| 5731 call gaslist_strcat_mix_WREG ; print composition of gas/dil in WREG (0..9) | |
| 5732 bra TFT_pressures_SAC_mask_h4 ; finish with adding "(bar)" | |
| 5733 | |
| 5734 TFT_pressures_SAC_mask_h3: | |
| 5735 STRCPY_TEXT tNeed ; "Need" | |
| 5736 ;bra TFT_pressures_SAC_mask_h4 ; finish with adding "(bar)" | |
| 5737 | |
| 5738 TFT_pressures_SAC_mask_h4: | |
| 5739 STRCAT_PRINT "(bar)" ; print "(bar)" | |
| 5740 return ; done | |
| 5741 | |
| 5742 | |
| 5743 ;----------------------------------------------------------------------------- | |
| 5744 ; Dive Custom View - Pressures & SAC - Data | |
| 5745 ; | |
| 5746 global TFT_pressures_SAC | |
| 5747 TFT_pressures_SAC: | |
| 5748 ; check mode for second reading | |
| 5749 bcf aux_flag ; clear auxiliary flag by default (reading 2 is pressure) | |
| 5750 movff char_I_pressure_gas+1,WREG ; =0: need to reading 1, =1..10: gases/dils | |
| 5751 addlw .0 ; dummy operation to set status register flags | |
| 5752 btfsc STATUS,Z ; gas selected = 0 (i.e. no 2nd pressure reading) ? | |
| 5753 bsf aux_flag ; YES - set auxiliary flag (display position of reading 2 shall show need to reading 1) | |
| 5754 ; get data of reading 1 | |
| 5755 movff int_IO_pressure_value+0,lo ; copy pressure 1 to hi:lo | |
| 5756 movff int_IO_pressure_value+1,hi ; ... | |
| 5757 movff char_I_pressure_stat+0,ex ; copy status data | |
| 5758 ; pressure of reading 1 | |
| 5759 WIN_STD dm_custom_tankdata_pres1_col+.4,dm_custom_tankdata_row | |
| 5760 rcall TFT_pressures_SAC_helper_1 ; print pressure if available, else " ---" | |
| 5761 ; battery status of reading 1 | |
| 5762 WIN_SMALL dm_custom_hud_sensor1_column+.4+.36,dm_custom_tankdata_row | |
| 5763 rcall TFT_pressures_SAC_helper_2 ; print or clear down arrow as low bat indicator | |
| 5764 ; get data for reading 2 | |
| 5765 btfsc aux_flag ; shall reading 2 show need to reading 1 ? | |
| 5766 bra TFT_pressures_SAC_1 ; YES | |
| 5767 movff int_IO_pressure_value+2,lo ; NO - copy pressure 2 to hi:lo | |
| 5768 movff int_IO_pressure_value+3,hi ; - ... | |
| 5769 movff char_I_pressure_stat+1,ex ; - copy status data | |
| 5770 bra TFT_pressures_SAC_2 ; - continue | |
| 5771 | |
| 5772 TFT_pressures_SAC_1: | |
| 5773 MOVII int_O_pressure_need,mpr ; copy need to pressure 1 to hi:lo | |
| 5774 clrf ex ; set status data to 0 | |
| 5775 bra TFT_pressures_SAC_2 ; continue | |
| 5776 | |
| 5777 TFT_pressures_SAC_2: | |
| 5778 ; pressure of reading 2 | |
| 5779 WIN_STD dm_custom_tankdata_pres2_col+.2,dm_custom_tankdata_row | |
| 5780 rcall TFT_pressures_SAC_helper_1 ; print pressure if available, else " ---" | |
| 5781 ; battery status of reading 2 | |
| 5782 WIN_SMALL dm_custom_tankdata_pres2_col+.2+.36,dm_custom_tankdata_row | |
| 5783 rcall TFT_pressures_SAC_helper_2 ; print or clear down arrow as low bat indicator | |
| 5784 | |
| 5785 TFT_pressures_SAC_3: | |
| 5786 ; SAC | |
| 5787 WIN_STD dm_custom_tankdata_SAC_col+.6,dm_custom_tankdata_row | |
| 5788 MOVII int_O_SAC_measured,mpr ; copy measured SAC rate to hi:lo | |
| 5789 btfsc hi,int_not_avail_flag ; SAC rate available? | |
| 5790 bra TFT_pressures_SAC_4 ; NO - print " --.-" | |
| 5791 call TFT_color_code_pres_sac ; color-code the output | |
| 5792 bsf decimal_digit1 ; place a decimal point in front of digit 1 | |
| 5793 output_999 ; print (0.0-99.9) | |
| 5794 PRINT ; dump to screen | |
| 5795 return ; done | |
| 5796 | |
| 5797 TFT_pressures_SAC_4: | |
| 5798 FONT_COLOR_DISABLED ; set color | |
| 5799 STRCAT_PRINT "--.-" ; output for no SAC data available | |
| 5800 return ; done | |
| 5801 | |
| 5802 | |
| 5803 ; Helper Function - print pressure if available, else " ---" | |
| 5804 TFT_pressures_SAC_helper_1: | |
| 5805 btfss hi,int_not_avail_flag ; pressure available? | |
| 5806 bra TFT_pressures_SAC_helper_1a ; YES - print pressure | |
| 5807 FONT_COLOR_DISABLED ; NO - use disabled color as default | |
| 5808 ; btfsc ex,char_transmitter_lost ; - transmitter lost? | |
| 5809 ; FONT_COLOR_ATTENTION ; YES - use attention color | |
| 5810 STRCAT_PRINT " ---" ; - print " ---" | |
| 0 | 5811 return |
| 5812 | |
| 634 | 5813 TFT_pressures_SAC_helper_1a: |
| 5814 btfsc hi,int_warning_flag ; out of range (signaled by warning flag)? | |
| 5815 bra TFT_pressures_SAC_helper_1c ; YES - special treatment | |
| 5816 call TFT_color_code_pres_sac ; NO - color-code the output | |
| 5817 PUTC ' ' ; - add a space | |
| 5818 bsf omit_digit_1 ; - do not print 1st digit (0.1 bar) | |
| 5819 output_999 ; - print pressure (0x-999x) | |
| 5820 PRINT ; - dump buffer to screen | |
| 5821 return ; - done | |
| 5822 | |
| 5823 TFT_pressures_SAC_helper_1c: | |
| 5824 call TFT_color_code_pres_sac ; color-code the output | |
| 5825 STRCPY_PRINT ">400" ; print ">400" | |
| 5826 return ; done | |
| 5827 | |
| 5828 | |
| 5829 ; Helper Function - print or clear down arrow as low bat indicator | |
| 5830 TFT_pressures_SAC_helper_2: | |
| 5831 btfss ex,char_transmitter_low_bat ; low battery flag set? | |
| 5832 bra TFT_pressures_SAC_helper_2b ; NO - clear down arrow (low bat indicator) | |
| 5833 ;bra TFT_pressures_SAC_helper_2a ; YES - show down arrow (low bat indicator) | |
| 5834 | |
| 5835 TFT_pressures_SAC_helper_2a: | |
| 5836 FONT_COLOR_ATTENTION ; use attention color | |
| 5837 STRCPY_PRINT "\xb8" ; print down arrow as bat low indication | |
| 5838 return ; done | |
| 5839 | |
| 5840 TFT_pressures_SAC_helper_2b: | |
| 5841 STRCPY_PRINT " " ; wipe out down arrow (low bat indicator) | |
| 5842 return ; done | |
| 5843 | |
| 5844 ENDIF _rx_functions | |
| 5845 | |
| 5846 IFDEF _cave_mode | |
| 5847 | |
| 5848 ;----------------------------------------------------------------------------- | |
| 5849 ; Dive Custom View - Cave Mode TTS, total Stops and Run Time - Mask | |
| 5850 ; | |
| 5851 | |
| 5852 global TFT_cave_tts_mask | |
| 5853 TFT_cave_tts_mask: | |
| 5854 FONT_COLOR_MASK ; select color | |
| 5855 | |
| 5856 WIN_TINY dm_custom_cave_title_column1,dm_custom_cave_title_row | |
| 5857 STRCPY_TEXT_PRINT tCaveStops ; print label | |
| 5858 | |
| 5859 WIN_TINY dm_custom_cave_title_column2,dm_custom_cave_title_row | |
| 5860 STRCPY_TEXT_PRINT tCaveTTS ; print label | |
| 5861 | |
| 5862 WIN_TINY dm_custom_cave_title_column3,dm_custom_cave_title_row | |
| 5863 STRCPY_TEXT_PRINT tCaveRuntime ; print label | |
| 5864 | |
| 5865 return ; done | |
| 5866 | |
| 5867 | |
| 5868 ;----------------------------------------------------------------------------- | |
| 5869 ; Dive Custom View - Cave Mode TTS, total Stops and Run Time - Data | |
| 5870 ; | |
| 5871 global TFT_cave_tts | |
| 5872 TFT_cave_tts: | |
| 5873 ; total time of all stops | |
| 5874 WIN_MEDIUM dm_custom_cave_data_column1,dm_custom_cave_data_row | |
| 5875 FONT_COLOR_MEMO ; set default color | |
| 5876 btfss cave_mode ; cave mode switched on? | |
| 5877 bra TFT_cave_1b ; NO - print dashes | |
| 5878 MOVII int_O_TST_norm,mpr ; YES - get normal plan total stops time | |
| 5879 btfss mpr+1,int_not_yet_computed ; - not yet computed? | |
| 5880 bra TFT_cave_1a ; NO - continue | |
| 5881 FONT_COLOR_DISABLED ; YES - switch to disabled color | |
| 5882 bra TFT_cave_1b ; - print dashes | |
| 5883 | |
| 5884 TFT_cave_1a: | |
| 5885 btfsc mpr+1,int_invalid_flag ; stops time invalid? | |
| 5886 FONT_COLOR_DISABLED ; YES - switch to disabled color | |
| 5887 bcf mpr+1,int_invalid_flag ; clear invalid flag if applicable | |
| 5888 movf mpr+0,W ; copy low byte of stops time to WREG | |
| 5889 iorwf mpr+1,W ; ior with high byte of stops time | |
| 5890 bz TFT_cave_1b ; print dashes if stops time is zero | |
| 5891 output_999 ; print (0-999) | |
| 5892 PUTC_PRINT "'" ; append unit and dump to screen | |
| 5893 bra TFT_cave_2 ; continue | |
| 5894 | |
| 5895 TFT_cave_1b: | |
| 5896 STRCAT_PRINT ",-,-,-," ; print 3 dashes (',' produces a half-width space) | |
| 5897 ;bra TFT_cave_2 ; continue | |
| 5898 | |
| 5899 TFT_cave_2: | |
| 5900 ; cave TTS | |
| 5901 WIN_MEDIUM dm_custom_cave_data_column2,dm_custom_cave_data_row ; column 60 | |
| 5902 FONT_COLOR_MEMO ; set default color | |
| 5903 btfsS cave_mode ; cave mode switched on? | |
| 5904 bra TFT_cave_2b ; NO - print dashes | |
| 5905 MOVII int_O_TTS_norm,mpr ; YES - get normal plan total time to surface | |
| 5906 btfss mpr+1,int_not_yet_computed ; - not yet computed? | |
| 5907 bra TFT_cave_2a ; NO - continue | |
| 5908 FONT_COLOR_DISABLED ; YES - switch to disabled color | |
| 5909 bra TFT_cave_2b ; - print dashes | |
| 5910 | |
| 5911 TFT_cave_2a: | |
| 5912 btfsc mpr+1,int_invalid_flag ; TTS invalid? | |
| 5913 FONT_COLOR_DISABLED ; YES - switch to disabled color | |
| 5914 bcf mpr+1,int_invalid_flag ; clear invalid flag if applicable | |
| 5915 output_999 ; print (0-999) | |
| 5916 PUTC_PRINT "'" ; append unit and dump to screen | |
| 5917 bra TFT_cave_3 ; continue | |
| 5918 | |
| 5919 TFT_cave_2b: | |
| 5920 STRCAT_PRINT ",-,-,-," ; print 3 dashes (',' produces a half-width space) | |
| 5921 ;bra TFT_cave_3 ; continue | |
| 5922 | |
| 5923 TFT_cave_3: | |
| 5924 ; estimated total runtime | |
| 5925 WIN_MEDIUM dm_custom_cave_data_column3,dm_custom_cave_data_row | |
| 5926 ; ; keep color from cave TTS | |
| 5927 btfss cave_mode ; cave mode switched on? | |
| 5928 bra TFT_cave_3b ; NO - print dashes | |
| 5929 SMOVII counted_divetime_mins,mpr ; YES - ISR safe copy of counted dive time to MPR | |
| 5930 movff int_O_TTS_norm+0,WREG ; - get TTS, low byte, into WREG | |
| 5931 addwf mpr+0,F ; - add TTS, low byte, to dive time in MPR | |
| 5932 movff int_O_TTS_norm+1,WREG ; - get TTS, high byte, into WREG | |
| 5933 btfsc WREG,int_not_yet_computed ; - not yet computed? | |
| 5934 bra TFT_cave_3b ; YES - print dashes | |
| 5935 bcf WREG,int_invalid_flag ; NO - clear invalid flag if applicable | |
| 5936 addwfc mpr+1,F ; - add TTS, high byte, to dive time in MPR | |
| 5937 output_999 ; - print (0-999) | |
| 5938 PUTC_PRINT "'" ; - append unit and dump to screen | |
| 5939 return ; - done | |
| 5940 | |
| 5941 TFT_cave_3b: | |
| 5942 STRCAT_PRINT ",-,-,-," ; print 3 dashes (',' produces a half-width space) | |
| 5943 return ; done | |
| 5944 | |
| 5945 | |
| 5946 ;----------------------------------------------------------------------------- | |
| 5947 ; Dive Custom View - Cave Mode Waypoints | |
| 5948 ; | |
| 5949 global TFT_cave_waypoints | |
| 5950 TFT_cave_waypoints: | |
| 5951 ; arrow | |
| 5952 WIN_TINY .70,dm_custom_cave_title_row | |
| 5953 FONT_COLOR_ATTENTION ; select color | |
| 5954 btfss cave_mode ; cave mode switched on? | |
| 5955 bra TFT_cave_waypoints_3 ; NO - do not show any marker (any more) | |
| 5956 btfsc dive_turned ; YES - dive turned? | |
| 5957 bra TFT_cave_waypoints_2 ; YES - print marker in the middle | |
| 5958 ;bra TFT_cave_waypoints_1 ; NO - print marker on right side | |
| 5959 | |
| 5960 TFT_cave_waypoints_1: | |
| 5961 movlw .12 ; start with 12 space chars | |
| 5962 call TFT_buffer_trim_length ; fill / cut buffer to target length | |
| 5963 ;bra TFT_cave_waypoints_2 ; continue | |
| 5964 | |
| 5965 TFT_cave_waypoints_2: | |
| 5966 STRCAT "<=====" ; print marker symbol | |
| 5967 ;bra TFT_cave_waypoints_3 ; continue | |
| 5968 | |
| 5969 TFT_cave_waypoints_3: | |
| 5970 movlw .18 ; set overall number of chars | |
| 5971 call TFT_buffer_trim_length ; fill / cut buffer to target length | |
| 5972 PRINT ; dump buffer to screen | |
| 5973 ; waypoint band | |
| 5974 btfsc cave_mode ; cave mode switched on? | |
| 5975 bra TFT_cave_waypoints_4 ; YES - show graphics | |
| 5976 WIN_STD .0,dm_custom_cave_data_row ; NO - show "Cave Mode off" text | |
| 5977 FONT_COLOR_ATTENTION ; - select attention color | |
| 5978 PUTC " " ; - print 2 space chars | |
| 5979 PUTC " " ; - ... | |
| 5980 STRCAT_TEXT tCaveMode ; - print "Cave Mode" | |
| 5981 PUTC " " ; - print 1 space char | |
| 5982 STRCAT_TEXT tOff ; - print "off" | |
| 5983 movlw .17 ; - set max number of chars | |
| 5984 call TFT_buffer_trim_length ; - fill / cut buffer to target length | |
| 5985 PRINT ; - dump buffer to screen | |
| 5986 return ; - done | |
| 5987 | |
| 5988 TFT_cave_waypoints_4: | |
| 5989 WIN_MEDIUM .0,dm_custom_cave_data_row; start in column 0 | |
| 5990 FONT_COLOR_MEMO ; select default color | |
| 5991 tstfsz DM_flags_cavereq ; any pending cave mode requests? | |
| 5992 FONT_COLOR_DISABLED ; YES - switch to disabled color | |
| 5993 ; 1st section: previous waypoint number or beginning line | |
| 5994 movlw .1 ; load a one into WREG | |
| 5995 cpfsgt backtrack_waypoint_num ; current waypoint number > 1 ? | |
| 5996 bra TFT_cave_waypoints_5 ; NO - print line segment only | |
| 5997 STRCAT ",-," ; YES - print one dash | |
| 5998 movff backtrack_waypoint_num,lo ; - copy current waypoint number to lo | |
| 5999 decf lo,F ; - create previous waypoint number | |
| 6000 output_99 ; - print previous waypoint number in two digit format | |
| 6001 STRCAT "," ; - print a half-space | |
| 6002 bra TFT_cave_waypoints_6 ; - continue with next section | |
| 6003 | |
| 6004 TFT_cave_waypoints_5: | |
| 6005 STRCAT ",-,-----" ; print line segment | |
| 6006 ;bra TFT_cave_waypoints_6 ; continue with next section | |
| 6007 | |
| 6008 TFT_cave_waypoints_6: | |
| 6009 ; 2nd section: solid line | |
| 6010 STRCAT "---" ; print a solid line | |
| 6011 ; 3rd section: current waypoint number, turn point symbol or line segment | |
| 6012 tstfsz backtrack_waypoint_num ; does a current waypoint exist? | |
| 6013 bra TFT_cave_waypoints_8 ; YES - print its number or the turn point symbol | |
| 6014 btfss dive_turned ; NO - dive turned? | |
| 6015 bra TFT_cave_waypoints_7 ; NO - print a separated line segment | |
| 6016 STRCAT "------" ; YES - print a continuous line | |
| 6017 bra TFT_cave_waypoints_10 ; - continue with next section | |
| 6018 | |
| 6019 TFT_cave_waypoints_7: | |
| 6020 STRCAT ",----," ; print a separated line segment | |
| 6021 bra TFT_cave_waypoints_10 ; continue with next section | |
| 6022 | |
| 6023 TFT_cave_waypoints_8: | |
| 6024 STRCAT "," ; print a half-width space | |
| 6025 movff backtrack_waypoint_num,lo ; copy current waypoint number to lo | |
| 6026 movf backtrack_waypoint_turn,W ; copy turn point number to WREG | |
| 6027 cpfseq lo ; current waypoint = turn point ? | |
| 6028 bra TFT_cave_waypoints_9 ; NO - show waypoint number | |
| 6029 STRCAT_PRINT "--|, " ; YES - print end-of-line symbol, clear remaining output and dump buffer to screen | |
| 6030 return ; - done | |
| 6031 | |
| 6032 TFT_cave_waypoints_9: | |
| 6033 movff backtrack_waypoint_num,lo ; copy current waypoint number to lo | |
| 6034 output_99 ; print current waypoint number in two digit format | |
| 6035 STRCAT "," ; print a half-space | |
| 6036 ;bra TFT_cave_waypoints_10 ; continue with next section | |
| 6037 | |
| 6038 TFT_cave_waypoints_10: | |
| 6039 ; 4th section: solid line | |
| 6040 STRCAT "---" ; print a solid line | |
| 6041 ; 5th section: next waypoint number or end of line symbol | |
| 6042 incf backtrack_waypoint_num,W ; load WREG with next waypoint number | |
| 6043 cpfseq backtrack_waypoint_turn ; next waypoint number = turn point number ? | |
| 6044 btfsc waypoint_reached_last ; NO - is the current waypoint the last waypoint? | |
| 6045 bra TFT_cave_waypoints_11 ; YES / YES - print end-of-line symbol | |
| 6046 STRCAT "," ; NO - print a half-space | |
| 6047 incf backtrack_waypoint_num,W ; - (re)load WREG with next waypoint number | |
| 6048 movwf lo ; NO - copy next waypoint number to lo | |
| 6049 output_99 ; - print next waypoint number in two digit format | |
| 6050 PRINT ; - dump buffer to screen | |
| 6051 return ; - done | |
| 6052 | |
| 6053 TFT_cave_waypoints_11: | |
| 6054 STRCAT_PRINT "---|," ; print end-of-line symbol and dump buffer to screen | |
| 6055 return ; done | |
| 6056 | |
| 6057 ENDIF ; _cave_mode | |
| 6058 | |
| 631 | 6059 |
| 560 | 6060 ;============================================================================= |
| 634 | 6061 tft_out15 CODE |
| 6062 ;============================================================================= | |
| 6063 | |
| 6064 | |
| 6065 ;----------------------------------------------------------------------------- | |
| 6066 ; Helper Function - check if firmware is within expiry period | |
| 6067 ; | |
| 6068 ; Output: aux_flag set if not | |
| 6069 ; | |
| 6070 check_expiry: | |
| 6071 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time | |
| 6072 movff rtc_latched_day,lo ; get current day | |
| 6073 movff rtc_latched_month,hi ; get current month | |
| 6074 movff rtc_latched_year,up ; get current year | |
| 6075 bsf aux_flag ; set firmware as expired by default | |
| 6076 movlw firmware_expire_year ; start with checking year | |
| 6077 cpfsgt up ; current year > expiry year ? | |
| 6078 bra check_expiry_Y ; NO - continue checks | |
| 6079 return ; YES - expired | |
| 6080 | |
| 6081 check_expiry_Y: | |
| 6082 cpfseq up ; current year = expiry year ? | |
| 6083 bra check_expiry_ok ; NO - must be < then, OK whatever month & day | |
| 6084 movlw firmware_expire_month ; YES - continue checking month | |
| 6085 cpfsgt hi ; current month > expiry month ? | |
| 6086 bra check_expiry_M ; NO - continue checks | |
| 6087 return ; YES - expired | |
| 6088 | |
| 6089 check_expiry_M: | |
| 6090 cpfseq hi ; current month = expiry month ? | |
| 6091 bra check_expiry_ok ; NO - must be < then, OK whatever day | |
| 6092 movlw firmware_expire_day ; YES - continue checking day | |
| 6093 cpfsgt lo ; current day > expiry day ? | |
| 6094 bra check_expiry_ok ; NO - must be <= then, OK | |
| 6095 return ; YES - expired | |
| 6096 | |
| 6097 check_expiry_ok: | |
| 6098 bcf aux_flag ; not expired | |
| 6099 return ; done | |
| 6100 | |
| 6101 | |
| 6102 ;----------------------------------------------------------------------------- | |
| 6103 ; show Firmware updated Message | |
| 6104 ; | |
| 6105 ; Attention: | |
| 6106 ; Pallet colors and language switching are not | |
| 6107 ; available yet, all text outputs are hard-coded! | |
| 6108 ; | |
| 6109 global TFT_message_fw_update | |
| 6110 TFT_message_fw_update: | |
| 6111 FONT_COLOR_STANDARD ; set color | |
| 6112 | |
| 6113 ; show update message | |
| 6114 WIN_SMALL .20,.100 ; set position | |
| 6115 STRCPY_PRINT "Update successful!" ; print message | |
| 6116 | |
| 6117 ; show firmware version | |
| 6118 WIN_SMALL .20,.140 ; set position | |
| 6119 STRCPY "New Firmware: " ; print message | |
| 6120 | |
| 6121 bra TFT_message_fw_common ; show firmware version | |
| 6122 | |
| 6123 | |
| 6124 ;----------------------------------------------------------------------------- | |
| 6125 ; show Firmware kept Message | |
| 6126 ; | |
| 6127 ; Attention: | |
| 6128 ; Pallet colors and language switching are not | |
| 6129 ; available yet, all text outputs are hard-coded! | |
| 6130 ; | |
| 6131 global TFT_message_fw_kept | |
| 6132 TFT_message_fw_kept: | |
| 6133 FONT_COLOR_STANDARD ; set color | |
| 6134 | |
| 6135 ; show reboot message | |
| 6136 WIN_SMALL .60,.100 ; set position | |
| 6137 STRCPY_PRINT "Reboot" ; print message | |
| 6138 | |
| 6139 ; show firmware version | |
| 6140 WIN_SMALL .30,.140 ; set position | |
| 6141 STRCPY "Firmware: " ; print message | |
| 6142 | |
| 6143 ;bra TFT_message_fw_common ; show firmware version | |
| 6144 | |
| 6145 | |
| 6146 ; Helper Function - show firmware version x.y and color-code + invert if outdated | |
| 6147 TFT_message_fw_common: | |
| 6148 rcall TFT_cat_firmware ; append major/minor and color-code on expiry | |
| 6149 PRINT ; dump to screen | |
| 6150 ; show firmware beta status | |
| 6151 WIN_SMALL .60,.180 | |
| 6152 FONT_COLOR_STANDARD ; set default color for a release version | |
| 6153 rcall TFT_cat_beta_long ; show "Release" or "BETA" + issue | |
| 6154 PRINT ; dump to screen | |
| 6155 return ; done | |
| 6156 | |
| 6157 | |
| 6158 ;----------------------------------------------------------------------------- | |
| 6159 ; append Firmware Version to current String, including color-coding on expiry | |
| 6160 ; | |
| 6161 global TFT_cat_firmware | |
| 6162 TFT_cat_firmware: | |
| 6163 movlw fw_version_major ; get major | |
| 6164 movwf lo ; ... | |
| 6165 bsf leftbind ; print left-aligned | |
| 6166 output_99 ; print major (0-99) | |
| 6167 PUTC '.' ; print a dot | |
| 6168 movlw fw_version_minor ; get minor | |
| 6169 movwf lo ; ... | |
| 6170 output_99x ; print minor in two digit format | |
| 6171 rcall check_expiry ; check if firmware is expired | |
| 6172 btfss aux_flag ; expired? | |
| 6173 return ; NO | |
| 6174 bsf win_invert ; YES - print in inverse | |
| 6175 FONT_COLOR color_yellow ; - print in yellow | |
| 6176 return ; - done | |
| 6177 | |
| 6178 | |
| 6179 ;----------------------------------------------------------------------------- | |
| 6180 ; append Firmware BETA Status to current String, including color-coding on BETA | |
| 6181 ; | |
| 6182 global TFT_cat_beta_long | |
| 6183 TFT_cat_beta_long: | |
| 6184 bsf aux_flag ; do long version | |
| 6185 bra TFT_cat_beta_common ; continue with common part | |
| 6186 | |
| 6187 global TFT_cat_beta_short | |
| 6188 TFT_cat_beta_short: | |
| 6189 bcf aux_flag ; do short version | |
| 6190 ;bra TFT_cat_beta_common ; continue with common part | |
| 6191 | |
| 6192 TFT_cat_beta_common: | |
| 6193 | |
| 6194 IFDEF _DEBUG | |
| 6195 | |
| 6196 FONT_COLOR color_red ; set color | |
| 6197 btfss aux_flag ; shall show long version? | |
| 6198 bra TFT_cat_debug_short ; NO - show short version | |
| 6199 ;bra TFT_cat_debug_long ; YES - show long version | |
| 6200 | |
| 6201 TFT_cat_debug_long: | |
| 6202 STRCAT "DEBUG" ; print long debug | |
| 6203 return ; done | |
| 6204 | |
| 6205 TFT_cat_debug_short: | |
| 6206 STRCAT "DBG." ; print short debug | |
| 6207 return ; done | |
| 6208 | |
| 6209 ELSE | |
| 6210 | |
| 6211 movlw fw_version_beta ; =0: release, =1: beta 1, =2: beta 2, ... | |
| 6212 movwf lo ; copy to lo | |
| 6213 tstfsz lo ; release version? | |
| 6214 bra TFT_cat_beta_com ; NO - must be beta version then | |
| 6215 btfss aux_flag ; YES - shall show long version? | |
| 6216 bra TFT_cat_beta_rel_short ; NO - show short version | |
| 6217 rcall check_expiry ; YES - check expiry date | |
| 6218 btfsc aux_flag ; - within expiry date? | |
| 6219 bra TFT_cat_beta_update ; NO - give update cue | |
| 6220 ;bra TFT_cat_beta_rel_long ; YES - "Release" | |
| 6221 | |
| 6222 TFT_cat_beta_rel_long: | |
| 6223 STRCAT "Release" ; print long "Release" | |
| 6224 return ; done | |
| 6225 | |
| 6226 TFT_cat_beta_rel_short: | |
| 6227 STRCAT "Rel." ; print short "Release" | |
| 6228 return ; done | |
| 6229 | |
| 6230 TFT_cat_beta_com: | |
| 6231 FONT_COLOR color_yellow ; set color | |
| 6232 btfss aux_flag ; shall show long version? | |
| 6233 bra TFT_cat_beta_short_exec ; NO - show short version | |
| 6234 ;bra TFT_cat_beta_long_exec ; YES - show long version | |
| 6235 | |
| 6236 TFT_cat_beta_long_exec: | |
| 6237 STRCAT "Beta " ; print long "Beta" | |
| 6238 bra TFT_cat_beta_version ; print version | |
| 6239 | |
| 6240 TFT_cat_beta_short_exec: | |
| 6241 STRCAT "B." ; print short "Beta" | |
| 6242 ;bra TFT_cat_beta_version ; append beta version number | |
| 6243 | |
| 6244 TFT_cat_beta_version: | |
| 6245 bsf leftbind ; print left-aligned | |
| 6246 output_256 ; print beta version number (0-255) | |
| 6247 return ; done | |
| 6248 | |
| 6249 TFT_cat_beta_update: | |
| 6250 FONT_COLOR color_yellow | |
| 6251 STRCAT "update!" ; print update cue | |
| 6252 return ; done | |
| 6253 | |
| 6254 ENDIF | |
| 6255 | |
| 6256 | |
| 6257 ;----------------------------------------------------------------------------- | |
| 6258 ; append Serial Number to to current String | |
| 6259 ; | |
| 6260 global TFT_cat_serial | |
| 6261 TFT_cat_serial: | |
| 6262 call eeprom_serial_number_read ; read OSTC serial number | |
| 6263 bsf leftbind ; print left-aligned | |
| 6264 output_65535 ; print serial number | |
| 6265 return ; done | |
| 6266 | |
| 6267 | |
| 6268 ;----------------------------------------------------------------------------- | |
| 6269 ; print Serial Number and Firmware Version (used by comm mode) | |
| 6270 ; | |
| 6271 global TFT_print_serial_and_firmware | |
| 6272 TFT_print_serial_and_firmware: | |
| 6273 STRCPY "#" ; print "#" | |
| 6274 rcall TFT_cat_serial ; print serial number | |
| 6275 STRCAT " " ; print a space | |
| 6276 STRCAT "v" ; print a "v" (version) | |
| 6277 ;bra TFT_print_firmware ; print firmware version | |
| 6278 | |
| 6279 | |
| 6280 ;----------------------------------------------------------------------------- | |
| 6281 ; print Firmware Version | |
| 6282 ; | |
| 6283 global TFT_print_firmware | |
| 6284 TFT_print_firmware: | |
| 6285 rcall TFT_cat_firmware ; print firmware major/minor, will set win_invert if outdated | |
| 6286 STRCAT " " ; print a space | |
| 6287 rcall TFT_cat_beta_long ; print release/beta and update notification if expired | |
| 6288 PRINT ; dump to screen | |
| 6289 return ; done | |
| 6290 | |
| 6291 | |
| 6292 ;----------------------------------------------------------------------------- | |
| 6293 ; print Deco Type (OC, CCR, ...) | |
| 6294 ; | |
| 6295 ; Input: lo deco type number: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR | |
| 6296 ; | |
| 6297 global TFT_print_decotype | |
| 6298 TFT_print_decotype: | |
| 6299 bsf aux_flag ; default to dive with deco calculation (used by logbook) | |
| 6300 incf lo,W ; WREG = lo + 1 | |
| 656 | 6301 TFT_print_decotype_1: |
| 634 | 6302 decfsz WREG,W ; in OC mode? |
| 6303 bra TFT_print_decotype_2 ; NO - try next | |
| 6304 STRCAT_TEXT_PRINT tDvOC ; YES - print "OC" | |
| 6305 return ; - done | |
| 6306 TFT_print_decotype_2: | |
| 6307 decfsz WREG,W ; in CCR mode? | |
| 6308 bra TFT_print_decotype_3 ; NO - try next | |
| 6309 STRCAT_TEXT_PRINT tDvCC ; YES - print "CCR" | |
| 6310 return ; - done | |
| 6311 TFT_print_decotype_3: | |
| 6312 decfsz WREG,W ; in gauge mode? | |
| 6313 bra TFT_print_decotype_4 ; NO - try next | |
| 6314 bcf aux_flag ; YES - dive without deco data | |
| 6315 STRCAT_TEXT_PRINT tDvGauge ; - Print "Gauge" | |
| 6316 return ; - done | |
| 6317 TFT_print_decotype_4: | |
| 6318 decfsz WREG,W ; in apnea mode? | |
| 6319 bra TFT_print_decotype_5 ; NO - try next | |
| 6320 bcf aux_flag ; YES - dive without deco data | |
| 6321 STRCAT_TEXT_PRINT tDvApnea ; - print "Apnoe" | |
| 6322 return ; - done | |
| 6323 TFT_print_decotype_5: | |
| 6324 STRCAT_TEXT_PRINT tDvPSCR ; print "pSCR" | |
| 6325 return ; done | |
| 6326 | |
| 560 | 6327 |
|
480
ad8acade5567
NEW: PSCR mode (Passive semi-closed rebreather)
heinrichsweikamp
parents:
477
diff
changeset
|
6328 ;============================================================================= |
| 634 | 6329 tft_out16 CODE |
| 6330 ;============================================================================= | |
| 6331 | |
| 6332 global TFT_debug_output | |
| 6333 TFT_debug_output: | |
| 6334 | |
| 6335 IFNDEF _debug_output | |
| 6336 | |
| 6337 return ; do nothing | |
| 6338 | |
| 6339 ELSE | |
| 6340 | |
| 640 | 6341 ; btfsc alt_layout_active ; alternative layout active? |
| 6342 ; return ; YES - abort | |
| 634 | 6343 |
| 636 | 6344 WIN_TINY .100,.30 ; surface mode: fits under the textual logo in the upper right corner |
| 634 | 6345 ; WIN_TINY .35, .0 ; dive mode: fits to the right side of the depth label |
| 636 | 6346 ; WIN_TINY .0, . 0 ; dive mode: overwrites depth label |
| 634 | 6347 FONT_COLOR_MEMO ; set color |
| 640 | 6348 |
| 656 | 6349 ;movff ambient_light+0,lo |
| 650 | 6350 movff gp_debug+0,lo |
| 656 | 6351 movff gp_debug+1,hi |
| 6352 output_65535 | |
| 643 | 6353 PUTC "," |
| 656 | 6354 movff ambient_light+0,lo |
| 6355 ; movff gp_debug+1,lo | |
| 650 | 6356 output_256 |
| 6357 | |
| 6358 ; ; deco engine scheduling performance | |
| 640 | 6359 ; MOVII int_O_profiling_overrun,mpr ; runtime +/- versus target |
| 6360 ; btfss mpr+1,7 ; overrun? | |
| 6361 ; bra TFT_debug_output_1 ; YES | |
| 6362 ; bcf mpr+1,7 ; NO - clear flag | |
| 6363 ; PUTC "-" ; - print a minus | |
| 6364 ; bra TFT_debug_output_2 ; - continue | |
| 6365 ;TFT_debug_output_1: | |
| 6366 ; PUTC " " ; print a space instead of the minus | |
| 6367 ;TFT_debug_output_2: | |
| 6368 ; output_999 ; print time (0-999) | |
| 6369 ; PUTC "." ; print a dot as separator | |
| 6370 ; MOVII int_O_profiling_overrun_max,mpr ; get max runtime so far | |
| 6371 ; output_999 ; print (0-999) | |
| 6372 ; PUTC "." ; print a dot as separator | |
| 6373 ; movff char_O_profiling_overrun_phase,WREG ; get calculation phase causing the max runtime | |
| 6374 ; output_hex ; print a hex | |
| 6375 ; PUTC "." ; print a dot as separator | |
| 6376 ; movff char_O_profiling_runs_norm,mpr ; get runs/cycle normal plan | |
| 6377 ; output_99 ; print (0-99) | |
| 6378 ; PUTC "." ; print a dot as separator | |
| 6379 ; movff char_O_profiling_runs_alt,mpr ; get runs/cycle alternative plan | |
| 6380 ; output_99 ; print (0-99) | |
| 634 | 6381 PRINT ; dump to screen |
| 6382 return ; done | |
| 6383 | |
| 6384 ENDIF ; _debug_output | |
| 6385 | |
| 6386 ;----------------------------------------------------------------------------- | |
| 6387 | |
| 6388 END |
