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