comparison src/tft_outputs.asm @ 304:a50edfada621

Merge with new_screen_layout
author heinrichsweikamp
date Mon, 01 Jun 2015 17:19:37 +0200
parents 9b1b0b32e7d5
children 14719662fb95
comparison
equal deleted inserted replaced
302:be341d0df3ee 304:a50edfada621
237 movwf hi 237 movwf hi
238 movff lo,sub_b+0 238 movff lo,sub_b+0
239 movff hi,sub_b+1 239 movff hi,sub_b+1
240 movff hi_temp,hi 240 movff hi_temp,hi
241 movff lo_temp,lo ; Restore hi, lo 241 movff lo_temp,lo ; Restore hi, lo
242
243 TSTOSS opt_depthblink ; 0=standard, 1=blink
244 bra TFT_color_code_depth_std
245 ;TFT_color_code_depth_blink:
242 call subU16 ; sub_c = sub_a - sub_b 246 call subU16 ; sub_c = sub_a - sub_b
243 btfss neg_flag 247 btfss neg_flag
248 bra TFT_color_code_depth_warn ; Set to warning color
249 call TFT_color_code_ppo2_depth ; check depth against MOD
250 return
251
252 TFT_color_code_depth_std:
253 call subU16 ; sub_c = sub_a - sub_b
254 btfss neg_flag
244 bra TFT_warnings_color ; Set to warning color 255 bra TFT_warnings_color ; Set to warning color
245 call TFT_standard_color 256 call TFT_standard_color
246 return 257 return
258
259 TFT_color_code_ppo2_depth:
260 SAFE_2BYTE_COPY amb_pressure, xA
261 movlw d'10'
262 movwf xB+0
263 clrf xB+1
264 call div16x16 ; xC=p_amb/10
265
266 movff xC+0,xA+0
267 movff xC+1,xA+1
268 movff char_I_O2_ratio,xB+0 ; =O2 ratio
269 clrf xB+1
270 call mult16x16 ; char_I_O2_ratio * p_amb/10
271
272 ; Check if ppO2>6,55bar
273 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
274 ;bra TFT_color_code_warn ; Yes, warn in warning color
275 bra TFT_color_code_depth_warn
276 ; Check if ppO2>3,30bar
277 btfsc xC+1,7
278 bra TFT_color_code_depth_warn
279
280 movff xC+0,sub_a+0
281 movff xC+1,sub_a+1
282 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode
283 mullw d'100'
284 movff PRODL,sub_b+0
285 movff PRODH,sub_b+1
286 call subU16 ; sub_c = sub_a - sub_b
287 btfss neg_flag
288 bra TFT_color_code_depth_warn
289
290 movff xC+0,sub_a+0
291 movff xC+1,sub_a+1
292 movff opt_ppO2_min,WREG ; PPO2 min for Sensors and color coding in divemode
293 mullw d'100'
294 movff PRODL,sub_b+0
295 movff PRODH,sub_b+1
296 call subU16 ; sub_c = sub_a - sub_b
297 btfsc neg_flag
298 bra TFT_color_code_depth_warn
299 if dm_offset != 0
300 call TFT_standard_color
301 else
302 movlw color_green
303 call TFT_set_color
304 endif
305 bcf blinking_depth_warning ; reset warning
306 return
307
308 TFT_color_code_depth_warn:
309 bsf blinking_depth_warning ; Set warning
310 bra TFT_warnings_color ; Set to warning color
247 311
248 TFT_color_code_cns: 312 TFT_color_code_cns:
249 movff int_O_CNS_fraction+1,lo ; copy into bank1 313 movff int_O_CNS_fraction+1,lo ; copy into bank1
250 tstfsz lo ; >255% ? 314 tstfsz lo ; >255% ?
251 bra TFT_warnings_color ; Yes 315 bra TFT_warnings_color ; Yes
396 460
397 global TFT_show_color_schemes 461 global TFT_show_color_schemes
398 TFT_show_color_schemes: ; update the color schemes 462 TFT_show_color_schemes: ; update the color schemes
399 bsf divemode ; put in divemode 463 bsf divemode ; put in divemode
400 call TFT_divemask_color 464 call TFT_divemask_color
401 WIN_TINY divemode_mask_depth_column,divemode_mask_depth_row+.40 465 WIN_TINY .12,.40
402 STRCAT_TEXT_PRINT tDepth 466 STRCAT_TEXT_PRINT tDepth
403 WIN_TINY divemode_mask_maxdepth_column,divemode_mask_maxdepth_row+.40 467 WIN_TINY .62,.40
404 STRCAT_TEXT_PRINT tMaxDepth 468 STRCAT_TEXT_PRINT tMaxDepth
405 WIN_TINY divemode_mask_divetime_column,divemode_mask_divetime_row+.40 469 WIN_TINY .122,.40
406 STRCAT_TEXT_PRINT tDivetime 470 STRCAT_TEXT_PRINT tDivetime
407 471
408 ; Show some demo screen 472 ; Show some demo screen
409 473
410 ; Depth demo 474 ; Depth demo
411 call TFT_standard_color 475 call TFT_standard_color
412 WIN_MEDIUM depth_column+.3,depth_row+.40 476 WIN_MEDIUM .3,.54
413 movlw LOW .5172 477 movlw LOW .5172
414 movwf lo 478 movwf lo
415 movlw HIGH .5172 479 movlw HIGH .5172
416 movwf hi 480 movwf hi
417 bsf leftbind 481 bsf leftbind
418 bsf ignore_digit4 482 bsf ignore_digit4
419 output_16 ; Full meters in Big font 483 output_16 ; Full meters in Big font
420 bcf leftbind 484 bcf leftbind
421 STRCAT_PRINT "" ; Display full meters 485 STRCAT_PRINT "" ; Display full meters
422 WIN_SMALL depth_dm_column-.15,max_depth_dm_row+.40 486 WIN_SMALL .25,.66
423 movlw LOW .5172 487 movlw LOW .5172
424 movwf lo 488 movwf lo
425 movlw HIGH .5172 489 movlw HIGH .5172
426 movwf hi 490 movwf hi
427 PUTC "." 491 PUTC "."
431 output_16dp d'0' ; .1m in SMALL font 495 output_16dp d'0' ; .1m in SMALL font
432 STRCAT_PRINT "" ; Display decimeters 496 STRCAT_PRINT "" ; Display decimeters
433 WIN_FONT FT_SMALL 497 WIN_FONT FT_SMALL
434 498
435 ; Max. Depth demo 499 ; Max. Depth demo
436 WIN_MEDIUM max_depth_column,max_depth_row+.40 500 WIN_MEDIUM .64,.54
437 bsf ignore_digit4 ; no 0.1m 501 bsf ignore_digit4 ; no 0.1m
438 bsf leftbind 502 bsf leftbind
439 movlw LOW .6349 503 movlw LOW .6349
440 movwf lo 504 movwf lo
441 movlw HIGH .6349 505 movlw HIGH .6349
442 movwf hi 506 movwf hi
443 output_16 507 output_16
444 STRCAT_PRINT "" ; Display full meters 508 STRCAT_PRINT "" ; Display full meters
445 bcf leftbind 509 bcf leftbind
446 ; .1m in SMALL font 510 ; .1m in SMALL font
447 WIN_SMALL max_depth_dm_column,max_depth_dm_row+.40 511 WIN_SMALL .87,.66
448 PUTC "." 512 PUTC "."
449 movlw d'4' 513 movlw d'4'
450 movwf ignore_digits 514 movwf ignore_digits
451 bsf ignore_digit5 515 bsf ignore_digit5
452 bsf leftbind 516 bsf leftbind
459 bcf leftbind 523 bcf leftbind
460 524
461 ; Divetime demo 525 ; Divetime demo
462 movff mins,lo 526 movff mins,lo
463 clrf hi 527 clrf hi
464 WIN_MEDIUM divetime_column, divetime_row+.40 528 WIN_MEDIUM .103, .54
465 output_16_3 ; limit to 999 and display only (0-999) 529 output_16_3 ; limit to 999 and display only (0-999)
466 STRCAT_PRINT "" ; Show minutes in large font 530 STRCAT_PRINT "" ; Show minutes in large font
467 WIN_SMALL divetime_secs_column, divetime_secs_row+.40 ; left position for two sec figures 531 WIN_SMALL .139, .66 ; left position for two sec figures
468 PUTC ':' 532 PUTC ':'
469 bsf leftbind 533 bsf leftbind
470 movff secs,lo 534 movff secs,lo
471 output_99x 535 output_99x
472 bcf leftbind 536 bcf leftbind
475 bcf divemode ; don't stay in divemode 539 bcf divemode ; don't stay in divemode
476 return 540 return
477 541
478 global TFT_divemode_mask 542 global TFT_divemode_mask
479 TFT_divemode_mask: ; Displays mask in Dive-Mode 543 TFT_divemode_mask: ; Displays mask in Dive-Mode
480 call TFT_divemask_color 544 if dm_offset != 0
481 WIN_TINY divemode_mask_depth_column,divemode_mask_depth_row 545 call TFT_divemask_color
482 STRCAT_TEXT_PRINT tDepth 546 WIN_TINY dm_mask_depth_column,dm_mask_depth_row
483 WIN_TINY divemode_mask_maxdepth_column,divemode_mask_maxdepth_row 547 STRCAT_TEXT_PRINT tDepth
484 STRCAT_TEXT_PRINT tMaxDepth 548 WIN_TINY dm_mask_maxdepth_column,dm_mask_maxdepth_row
485 WIN_TINY divemode_mask_divetime_column,divemode_mask_divetime_row 549 STRCAT_TEXT_PRINT tMaxDepth
486 STRCAT_TEXT_PRINT tDivetime 550 WIN_TINY dm_mask_divetime_column,dm_mask_divetime_row
487 551 STRCAT_TEXT_PRINT tDivetime
552 endif
488 call TFT_standard_color 553 call TFT_standard_color
489 return 554 return
490 555
491 global TFT_clear_customview_divemode 556 global TFT_clear_customview_divemode
492 TFT_clear_customview_divemode: 557 TFT_clear_customview_divemode:
493 WIN_BOX_BLACK divemode_customview_row, .163, .0, .159 ; top, bottom, left, right 558 WIN_BOX_BLACK dm_customview_row, dm_customview_bot, dm_customview_column, dm_customview_rgt ; top, bottom, left, right
494 return 559 return
495 560
496 global TFT_display_velocity 561 global TFT_display_velocity
497 TFT_display_velocity: ; With divA+0 = m/min 562 TFT_display_velocity: ; With divA+0 = m/min
498 TFT_color_code warn_velocity ; Color-code Output (With divA+0 = m/min) 563 TFT_color_code warn_velocity ; Color-code Output (With divA+0 = m/min)
499 WIN_SMALL velocity_text_column,velocity_text_row 564 WIN_SMALL dm_velocity_text_column, dm_velocity_text_row
500 565
501 TSTOSS opt_units ; 0=Meters, 1=Feets 566 TSTOSS opt_units ; 0=Meters, 1=Feets
502 bra TFT_display_velocity_metric 567 bra TFT_display_velocity_metric
503 ;TFT_display_velocity_imperial: 568 ;TFT_display_velocity_imperial:
504 movff divA+0,WREG ; divA+0 = m/min 569 movff divA+0,WREG ; divA+0 = m/min
529 return 594 return
530 595
531 global TFT_display_velocity_clear 596 global TFT_display_velocity_clear
532 TFT_display_velocity_clear: 597 TFT_display_velocity_clear:
533 ; Clear Text 598 ; Clear Text
534 WIN_BOX_BLACK velocity_text_row, velocity_text_row+.22, velocity_text_column, (velocity_text_column+.7*.8)-1 ; top, bottom, left, right 599 WIN_BOX_BLACK dm_velocity_text_row, dm_velocity_text_bot, dm_velocity_text_column, dm_velocity_text_rgt ; top, bottom, left, right
535 return 600 return
536 601
537 global TFT_clear_decoarea 602 global TFT_clear_decoarea
538 TFT_clear_decoarea: 603 TFT_clear_decoarea:
539 WIN_BOX_BLACK decostop_1st_stop_row, .239, decostop_1st_stop_column ,.159 ; top, bottom, left, right 604 WIN_BOX_BLACK dm_decostop_1st_stop_row, .239, dm_decostop_1st_stop_column, .159 ; top, bottom, left, right
540 return 605 return
541 606
542 global TFT_clear_divemode_menu 607 global TFT_clear_divemode_menu
543 TFT_clear_divemode_menu: 608 TFT_clear_divemode_menu:
544 WIN_BOX_BLACK divemode_menu_row, divemode_menu_lower, divemode_menu_left ,divemode_menu_right ; top, bottom, left, right 609 if dm_offset != 0
610 WIN_BOX_BLACK dm_menu_row, dm_menu_lower, dm_menu_left, dm_menu_right ; top, bottom, left, right
611 else
612 WIN_BOX_BLACK dm_3rdrow_top, dm_3rdrow_bot, dm_3rdrow_lft, dm_3rdrow_rgt ; top, bottom, left, right
613 endif
545 return 614 return
546 615
547 global TFT_display_ndl_mask 616 global TFT_display_ndl_mask
548 TFT_display_ndl_mask: 617 TFT_display_ndl_mask:
549 btfsc divemode_menu ; Is the dive mode menu shown? 618 btfsc divemode_menu ; Is the dive mode menu shown?
550 return ; Yes, return 619 return ; Yes, return
551 rcall TFT_clear_decoarea ; Clear Dekostop and Dekosum 620 rcall TFT_clear_decoarea ; Clear Dekostop and Dekosum
552 call TFT_divemask_color 621 call TFT_divemask_color
553 WIN_STD ndl_text_column,ndl_text_row 622 WIN_STD dm_ndl_text_column, dm_ndl_text_row
554 STRCPY_TEXT_PRINT tNDL ; NDL 623 STRCPY_TEXT_PRINT tNDL ; NDL
555 call TFT_standard_color 624 call TFT_standard_color
556 return 625 return
557 626
558 global TFT_show_TTS_divemode 627 global TFT_show_TTS_divemode
560 btfsc divemode_menu ; Is the dive mode menu shown? 629 btfsc divemode_menu ; Is the dive mode menu shown?
561 return ; Yes, return 630 return ; Yes, return
562 call TFT_standard_color 631 call TFT_standard_color
563 movff int_O_ascenttime+0,lo ; TTS 632 movff int_O_ascenttime+0,lo ; TTS
564 movff int_O_ascenttime+1,hi ; on 16bits 633 movff int_O_ascenttime+1,hi ; on 16bits
565 WIN_MEDIUM tts_value_column,tts_value_row 634 WIN_MEDIUM dm_tts_value_column, dm_tts_value_row
566 output_16_3 ;Displays only 0...999 635 output_16_3 ;Displays only 0...999
567 STRCAT_PRINT "'" 636 STRCAT_PRINT "'"
568 return 637 return
569 638
570 global TFT_display_ndl 639 global TFT_display_ndl
571 TFT_display_ndl: 640 TFT_display_ndl:
572 btfsc divemode_menu ; Is the dive mode menu shown? 641 btfsc divemode_menu ; Is the dive mode menu shown?
573 return ; Yes, return 642 return ; Yes, return
574 WIN_MEDIUM ndl_value_column,ndl_value_row 643 WIN_MEDIUM dm_ndl_value_column, dm_ndl_value_row
575 call TFT_standard_color 644 call TFT_standard_color
576 movff char_O_nullzeit,lo ; Get NDL from C-code 645 movff char_O_nullzeit,lo ; Get NDL from C-code
577 output_8 646 output_8
578 STRCAT_PRINT "'" 647 STRCAT_PRINT "'"
579 return 648 return
580 649
581 global TFT_divemode_warning 650 global TFT_divemode_warning
582 TFT_divemode_warning: 651 TFT_divemode_warning:
583 bsf dive_warning_displayed ; =1: The warning sign is shown 652 bsf dive_warning_displayed ; =1: The warning sign is shown
584 WIN_TOP warning_icon_row 653 WIN_TOP dm_warning_icon_row
585 WIN_LEFT warning_icon_column 654 WIN_LEFT dm_warning_icon_column
586 TFT_WRITE_PROM_IMAGE dive_warning2_block ; Show Warning icon 655 TFT_WRITE_PROM_IMAGE dive_warning2_block ; Show Warning icon
587 return 656 return
588 657
589 global TFT_divemode_warning_clear 658 global TFT_divemode_warning_clear
590 TFT_divemode_warning_clear: 659 TFT_divemode_warning_clear:
591 btfss dive_warning_displayed ; =1: The warning sign is shown 660 btfss dive_warning_displayed ; =1: The warning sign is shown
592 return 661 return
593 bcf dive_warning_displayed ; clear only once 662 bcf dive_warning_displayed ; clear only once
594 WIN_BOX_BLACK warning_icon_row, warning_icon_row+.38, warning_icon_column, warning_icon_column+.21; top, bottom, left, right 663 WIN_BOX_BLACK dm_warning_icon_row, dm_warning_icon_bot, dm_warning_icon_column, dm_warning_icon_rgt ; top, bottom, left, right
595 return 664 return
596 665
597 global TFT_display_deko_mask 666 global TFT_display_deko_mask
598 TFT_display_deko_mask: 667 TFT_display_deko_mask:
599 rcall TFT_clear_decoarea 668 rcall TFT_clear_decoarea
600 WIN_STD tts_text_column,tts_text_row 669 WIN_STD dm_tts_text_column, dm_tts_text_row
601 call TFT_divemask_color 670 call TFT_divemask_color
602 STRCPY_TEXT_PRINT tTTS ; TTS 671 STRCPY_TEXT_PRINT tTTS ; TTS
603 call TFT_standard_color 672 call TFT_standard_color
604 bcf show_safety_stop ; Clear safety stop flag 673 bcf show_safety_stop ; Clear safety stop flag
605 return 674 return
646 715
647 global TFT_display_deko 716 global TFT_display_deko
648 TFT_display_deko: 717 TFT_display_deko:
649 btfsc divemode_menu ; Is the dive mode menu shown? 718 btfsc divemode_menu ; Is the dive mode menu shown?
650 return ; Yes, return 719 return ; Yes, return
651 WIN_MEDIUM decostop_1st_stop_column,decostop_1st_stop_row 720 WIN_MEDIUM dm_decostop_1st_stop_column, dm_decostop_1st_stop_row
652 TFT_color_code warn_ceiling ; Color-code Output 721 TFT_color_code warn_ceiling ; Color-code Output
653 movff char_O_first_deco_depth,lo ; Ceiling in m 722 movff char_O_first_deco_depth,lo ; Ceiling in m
654 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) 723 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
655 movff char_O_first_deco_time,lo ; length of first stop in min 724 movff char_O_first_deco_time,lo ; length of first stop in min
656 output_99 725 output_99
659 return 728 return
660 729
661 global TFT_decoplan 730 global TFT_decoplan
662 TFT_decoplan: 731 TFT_decoplan:
663 call TFT_divemask_color 732 call TFT_divemask_color
664 WIN_TINY decoplan_title_column,decoplan_title_row 733 WIN_TINY dm_custom_decoplan_title_column, dm_custom_decoplan_title_row
665 STRCPY_TEXT_PRINT tDiveDecoplan 734 STRCPY_TEXT_PRINT tDiveDecoplan
666 call TFT_standard_color 735 call TFT_standard_color
667 736
668 movff char_O_deco_depth+1,lo 737 movff char_O_deco_depth+1,lo
669 tstfsz lo ; Show another stop? 738 tstfsz lo ; Show another stop?
670 bra TFT_display_deko2 ; Yes 739 bra TFT_display_deko2 ; Yes
671 ; No, clear output and return 740 ; No, clear output and return
672 call TFT_standard_color 741 call TFT_standard_color
673 WIN_SMALL decostop_4th_stop_column,decostop_4th_stop_row 742 WIN_SMALL dm_cust_dstop_4th_stop_column,dm_cust_dstop_4th_stop_row
674 STRCPY_PRINT " --- " 743 STRCPY_PRINT " --- "
675 WIN_BOX_BLACK decostop_2nd_stop_row, divemode_simtext_row-1, decostop_2nd_stop_column, decostop_4th_stop_column ; top, bottom, left, right 744 WIN_BOX_BLACK dm_cust_dstop_2nd_stop_row, dm_customview_bot, dm_cust_dstop_2nd_stop_column, dm_cust_dstop_4th_stop_column ; top, bottom, left, right
676 WIN_BOX_BLACK decostop_5th_stop_row, divemode_simtext_row-1, decostop_5th_stop_column, decostop_6th_stop_column ; top, bottom, left, right 745 WIN_BOX_BLACK dm_cust_dstop_5th_stop_row, dm_customview_bot, dm_cust_dstop_5th_stop_column, dm_cust_dstop_6th_stop_column ; top, bottom, left, right
677 WIN_BOX_BLACK decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159 ; top, bottom, left, right 746 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right
678 return 747 return
679 TFT_display_deko2: 748 TFT_display_deko2:
680 WIN_SMALL decostop_2nd_stop_column,decostop_2nd_stop_row 749 WIN_SMALL dm_cust_dstop_2nd_stop_column, dm_cust_dstop_2nd_stop_row
681 movff char_O_deco_depth+1,lo ; stop in m 750 movff char_O_deco_depth+1,lo ; stop in m
682 bcf lo,7 ; Clear GAS_SWITCH bit 751 bcf lo,7 ; Clear GAS_SWITCH bit
683 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) 752 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
684 movff char_O_deco_time+1,lo ; length of stop in min 753 movff char_O_deco_time+1,lo ; length of stop in min
685 output_99 754 output_99
686 STRCAT_PRINT "'" 755 STRCAT_PRINT "'"
687 movff char_O_deco_depth+2,lo 756 movff char_O_deco_depth+2,lo
688 tstfsz lo ; Show another stop? 757 tstfsz lo ; Show another stop?
689 bra TFT_display_deko3 ; Yes 758 bra TFT_display_deko3 ; Yes
690 ; No, clear output and return 759 ; No, clear output and return
691 WIN_BOX_BLACK decostop_3rd_stop_row, divemode_simtext_row-1, decostop_2nd_stop_column, decostop_4th_stop_column ; top, bottom, left, right 760 WIN_BOX_BLACK dm_cust_dstop_3rd_stop_row, dm_customview_bot, dm_cust_dstop_2nd_stop_column, dm_cust_dstop_4th_stop_column ; top, bottom, left, right
692 WIN_BOX_BLACK decostop_4th_stop_row, divemode_simtext_row-1, decostop_4th_stop_column, .159 ; top, bottom, left, right 761 WIN_BOX_BLACK dm_cust_dstop_4th_stop_row, dm_customview_bot, dm_cust_dstop_4th_stop_column, .159 ; top, bottom, left, right
693 return 762 return
694 763
695 TFT_display_deko3: 764 TFT_display_deko3:
696 WIN_SMALL decostop_3rd_stop_column,decostop_3rd_stop_row 765 WIN_SMALL dm_cust_dstop_3rd_stop_column, dm_cust_dstop_3rd_stop_row
697 movff char_O_deco_depth+2,lo ; stop in m 766 movff char_O_deco_depth+2,lo ; stop in m
698 bcf lo,7 ; Clear GAS_SWITCH bit 767 bcf lo,7 ; Clear GAS_SWITCH bit
699 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) 768 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
700 movff char_O_deco_time+2,lo ; length of stop in min 769 movff char_O_deco_time+2,lo ; length of stop in min
701 output_99 770 output_99
703 772
704 movff char_O_deco_depth+3,lo 773 movff char_O_deco_depth+3,lo
705 tstfsz lo ; Show another stop? 774 tstfsz lo ; Show another stop?
706 bra TFT_display_deko4 ; Yes 775 bra TFT_display_deko4 ; Yes
707 ; No, clear output and return 776 ; No, clear output and return
708 WIN_BOX_BLACK decostop_4th_stop_row, divemode_simtext_row-1, decostop_4th_stop_column, .159 ; top, bottom, left, right 777 WIN_BOX_BLACK dm_cust_dstop_4th_stop_row, dm_customview_bot, dm_cust_dstop_4th_stop_column, .159 ; top, bottom, left, right
709 return ; Done. 778 return ; Done.
710 779
711 TFT_display_deko4: 780 TFT_display_deko4:
712 WIN_SMALL decostop_4th_stop_column,decostop_4th_stop_row 781 WIN_SMALL dm_cust_dstop_4th_stop_column, dm_cust_dstop_4th_stop_row
713 movff char_O_deco_depth+3,lo ; stop in m 782 movff char_O_deco_depth+3,lo ; stop in m
714 bcf lo,7 ; Clear GAS_SWITCH bit 783 bcf lo,7 ; Clear GAS_SWITCH bit
715 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) 784 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
716 movff char_O_deco_time+3,lo ; length of stop in min 785 movff char_O_deco_time+3,lo ; length of stop in min
717 output_99 786 output_99
719 788
720 movff char_O_deco_depth+4,lo 789 movff char_O_deco_depth+4,lo
721 tstfsz lo ; Show another stop? 790 tstfsz lo ; Show another stop?
722 bra TFT_display_deko5 ; Yes 791 bra TFT_display_deko5 ; Yes
723 ; No, clear output and return 792 ; No, clear output and return
724 WIN_BOX_BLACK decostop_5th_stop_row, divemode_simtext_row-1, decostop_5th_stop_column, decostop_6th_stop_column ; top, bottom, left, right 793 WIN_BOX_BLACK dm_cust_dstop_5th_stop_row, dm_customview_bot, dm_cust_dstop_5th_stop_column, dm_cust_dstop_6th_stop_column ; top, bottom, left, right
725 WIN_BOX_BLACK decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159 ; top, bottom, left, right 794 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right
726 return ; Done. 795 return ; Done.
727 796
728 TFT_display_deko5: 797 TFT_display_deko5:
729 WIN_SMALL decostop_5th_stop_column,decostop_5th_stop_row 798 WIN_SMALL dm_cust_dstop_5th_stop_column, dm_cust_dstop_5th_stop_row
730 movff char_O_deco_depth+4,lo ; stop in m 799 movff char_O_deco_depth+4,lo ; stop in m
731 bcf lo,7 ; Clear GAS_SWITCH bit 800 bcf lo,7 ; Clear GAS_SWITCH bit
732 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) 801 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
733 movff char_O_deco_time+4,lo ; length of stop in min 802 movff char_O_deco_time+4,lo ; length of stop in min
734 output_99 803 output_99
735 STRCAT_PRINT "'" 804 STRCAT_PRINT "'"
736 movff char_O_deco_depth+5,lo 805 movff char_O_deco_depth+5,lo
737 tstfsz lo ; Show another stop? 806 tstfsz lo ; Show another stop?
738 bra TFT_display_deko6 ; Yes 807 bra TFT_display_deko6 ; Yes
739 ; No, clear output and return 808 ; No, clear output and return
740 WIN_BOX_BLACK decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159 ; top, bottom, left, right 809 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right
741 return ; Done. 810 return ; Done.
742 TFT_display_deko6: 811 TFT_display_deko6:
743 WIN_SMALL decostop_6th_stop_column,decostop_6th_stop_row 812 WIN_SMALL dm_cust_dstop_6th_stop_column, dm_cust_dstop_6th_stop_row
744 movff char_O_deco_depth+5,lo ; stop in m 813 movff char_O_deco_depth+5,lo ; stop in m
745 bcf lo,7 ; Clear GAS_SWITCH bit 814 bcf lo,7 ; Clear GAS_SWITCH bit
746 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) 815 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
747 movff char_O_deco_time+5,lo ; length of stop in min 816 movff char_O_deco_time+5,lo ; length of stop in min
748 output_99 817 output_99
749 STRCAT_PRINT "'" 818 STRCAT_PRINT "'"
750 movff char_O_deco_depth+6,lo 819 movff char_O_deco_depth+6,lo
751 tstfsz lo ; Show another stop? 820 tstfsz lo ; Show another stop?
752 bra TFT_display_deko7 ; Yes 821 bra TFT_display_deko7 ; Yes
753 ; No, clear output and return 822 ; No, clear output and return
754 WIN_BOX_BLACK decostop_7th_stop_row, divemode_simtext_row-1, decostop_7th_stop_column, .159 ; top, bottom, left, right 823 WIN_BOX_BLACK dm_cust_dstop_7th_stop_row, dm_customview_bot, dm_cust_dstop_7th_stop_column, .159 ; top, bottom, left, right
755 return ; Done. 824 return ; Done.
756 TFT_display_deko7: 825 TFT_display_deko7:
757 WIN_SMALL decostop_7th_stop_column,decostop_7th_stop_row 826 WIN_SMALL dm_cust_dstop_7th_stop_column, dm_cust_dstop_7th_stop_row
758 movff char_O_deco_depth+6,lo ; stop in m 827 movff char_O_deco_depth+6,lo ; stop in m
759 bcf lo,7 ; Clear GAS_SWITCH bit 828 bcf lo,7 ; Clear GAS_SWITCH bit
760 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) 829 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
761 movff char_O_deco_time+6,lo ; length of stop in min 830 movff char_O_deco_time+6,lo ; length of stop in min
762 output_99 831 output_99
772 ; bra TFT_display_ndl_mask2 ; Clear gradient factor 841 ; bra TFT_display_ndl_mask2 ; Clear gradient factor
773 ; 842 ;
774 843
775 global TFT_clear_safety_stop 844 global TFT_clear_safety_stop
776 TFT_clear_safety_stop: 845 TFT_clear_safety_stop:
777 WIN_BOX_BLACK safetystop_text_row, ndl_text_row-.4, safetystop_text_column, .159 ; top, bottom, left, right 846 WIN_BOX_BLACK dm_safetystop_row, dm_safetystop_bot, dm_safetystop_text_column, .159 ; top, bottom, left, right
778 return 847 return
779 848
780 global TFT_show_safety_stop 849 global TFT_show_safety_stop
781 TFT_show_safety_stop: 850 TFT_show_safety_stop:
782 tstfsz safety_stop_countdown ; Countdown at zero? 851 tstfsz safety_stop_countdown ; Countdown at zero?
796 bsf safety_stop_active ; Set flag 865 bsf safety_stop_active ; Set flag
797 decf safety_stop_countdown,F ; Reduce countdown 866 decf safety_stop_countdown,F ; Reduce countdown
798 867
799 btfsc divemode_menu ; Is the dive mode menu shown? 868 btfsc divemode_menu ; Is the dive mode menu shown?
800 return ; Yes, return 869 return ; Yes, return
801 btfsc menuview 870 ;btfsc menuview
802 bra TFT_show_safety_stop3 ; No room when menuview=1... 871 ;bra TFT_show_safety_stop3 ; No room when menuview=1...
803 872 if dm_offset != 0
804 rcall TFT_divemask_color 873 call TFT_divemask_color
805 WIN_STD safetystop_text_column,safetystop_text_row 874 else
875 call TFT_standard_color
876 endif
877 WIN_STD dm_safetystop_text_column, dm_safetystop_text_row
806 STRCPY_TEXT_PRINT tDiveSafetyStop 878 STRCPY_TEXT_PRINT tDiveSafetyStop
807 TFT_show_safety_stop3: 879 TFT_show_safety_stop3:
808 rcall TFT_attention_color ; show in yellow 880 call TFT_attention_color ; show in yellow
809 WIN_MEDIUM safetystop_column,safetystop_row 881 WIN_MEDIUM dm_safetystop_column, dm_safetystop_row
810 lfsr FSR2,buffer 882 lfsr FSR2,buffer
811 movff safety_stop_countdown,lo 883 movff safety_stop_countdown,lo
812 clrf hi 884 clrf hi
813 call convert_time ; converts hi:lo in seconds to mins (hi) and seconds (lo) 885 call convert_time ; converts hi:lo in seconds to mins (hi) and seconds (lo)
814 movf hi,W 886 movf hi,W
820 PUTC ':' 892 PUTC ':'
821 movff hi,lo 893 movff hi,lo
822 output_99x 894 output_99x
823 STRCAT_PRINT "" 895 STRCAT_PRINT ""
824 WIN_FONT FT_SMALL 896 WIN_FONT FT_SMALL
825 rcall TFT_standard_color 897 call TFT_standard_color
826 return 898 return
827 899
828 global TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch 900 global TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch
829 TFT_mask_avr_stopwatch: 901 TFT_mask_avr_stopwatch:
830 ; The mask 902 ; The mask
831 call TFT_divemask_color 903 call TFT_divemask_color
832 WIN_TINY dive_custom_avr_stop_column1,dive_custom_avr_stop_row 904 WIN_TINY dm_custom_avr_stop_title_column1,dm_custom_avr_stop_title_row
833 STRCPY_TEXT_PRINT tDiveTotalAvr 905 STRCPY_TEXT_PRINT tDiveTotalAvr
834 WIN_TINY dive_custom_avr_stop_column2,dive_custom_avr_stop_row 906 WIN_TINY dm_custom_avr_stop_title_column2,dm_custom_avr_stop_title_row
835 STRCPY_TEXT_PRINT tDiveStopwatch 907 STRCPY_TEXT_PRINT tDiveStopwatch
836 WIN_TINY dive_custom_avr_stop_column3,dive_custom_avr_stop_row 908 WIN_TINY dm_custom_avr_stop_title_column3,dm_custom_avr_stop_title_row
837 STRCPY_TEXT_PRINT tDiveStopAvr 909 STRCPY_TEXT_PRINT tDiveStopAvr
838 call TFT_standard_color 910 call TFT_standard_color
839 return 911 return
840 912
841 global TFT_dyn_gaslist 913 global TFT_dyn_gaslist
842 TFT_dyn_gaslist: ; Show the dynamic gaslist 914 TFT_dyn_gaslist: ; Show the dynamic gaslist
843 ; The mask 915 ; The mask
844 call TFT_divemask_color 916 call TFT_divemask_color
845 WIN_TINY dive_custom_dyn_mask_column,dive_custom_dyn_mask_row 917 WIN_TINY dm_custom_dyn_gas_mask_column,dm_custom_dyn_gas_mask_row
846 STRCPY_TEXT_PRINT tGaslist 918 STRCPY_TEXT_PRINT tGaslist
847 ; call TFT_standard_color 919 ; call TFT_standard_color
848 920
849 WIN_SMALL dive_custom_dyn_mask_column1,dive_custom_dyn_mask_row1 921 WIN_SMALL dm_custom_dyn_gas_column1,dm_custom_dyn_gas_row1
850 movlw .1 922 movlw .1
851 movwf uart1_temp 923 movwf uart1_temp
852 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint 924 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
853 rcall TFT_dyn_gaslist_common 925 rcall TFT_dyn_gaslist_common
854 WIN_SMALL dive_custom_dyn_mask_column1,dive_custom_dyn_mask_row2 926 WIN_SMALL dm_custom_dyn_gas_column1,dm_custom_dyn_gas_row2
855 incf uart1_temp,F ; +1 927 incf uart1_temp,F ; +1
856 movf uart1_temp,W ; into W 928 movf uart1_temp,W ; into W
857 rcall TFT_dyn_gaslist_common 929 rcall TFT_dyn_gaslist_common
858 WIN_SMALL dive_custom_dyn_mask_column2,dive_custom_dyn_mask_row1 930 WIN_SMALL dm_custom_dyn_gas_column2,dm_custom_dyn_gas_row1
859 incf uart1_temp,F ; +1 931 incf uart1_temp,F ; +1
860 movf uart1_temp,W ; into W 932 movf uart1_temp,W ; into W
861 rcall TFT_dyn_gaslist_common 933 rcall TFT_dyn_gaslist_common
862 WIN_SMALL dive_custom_dyn_mask_column2,dive_custom_dyn_mask_row2 934 WIN_SMALL dm_custom_dyn_gas_column2,dm_custom_dyn_gas_row2
863 incf uart1_temp,F ; +1 935 incf uart1_temp,F ; +1
864 movf uart1_temp,W ; into W 936 movf uart1_temp,W ; into W
865 rcall TFT_dyn_gaslist_common 937 rcall TFT_dyn_gaslist_common
866 call TFT_standard_color 938 call TFT_standard_color
867 return 939 return
889 global TFT_update_avr_stopwatch ; Update average depth and stopwatch 961 global TFT_update_avr_stopwatch ; Update average depth and stopwatch
890 TFT_update_avr_stopwatch: 962 TFT_update_avr_stopwatch:
891 call TFT_standard_color 963 call TFT_standard_color
892 SAFE_2BYTE_COPY average_divesecs,lo 964 SAFE_2BYTE_COPY average_divesecs,lo
893 call convert_time ; lo=secs, hi=mins 965 call convert_time ; lo=secs, hi=mins
894 WIN_MEDIUM dive_avr_stop_column2,dive_avr_stop_row 966 WIN_MEDIUM dm_custom_avr_stop_column2,dm_custom_avr_stop_row
895 bsf leftbind 967 bsf leftbind
896 movf hi,W 968 movf hi,W
897 movff lo,hi 969 movff lo,hi
898 movwf lo ; exchange lo and hi 970 movwf lo ; exchange lo and hi
899 output_8 971 output_8
911 ;TFT_update_avr_stopwatch_imperial 983 ;TFT_update_avr_stopwatch_imperial
912 movff avr_rel_pressure_total+0,lo 984 movff avr_rel_pressure_total+0,lo
913 movff avr_rel_pressure_total+1,hi 985 movff avr_rel_pressure_total+1,hi
914 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 986 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
915 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet 987 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
916 WIN_MEDIUM dive_avr_stop_column1,dive_avr_stop_row 988 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row
917 bsf leftbind 989 bsf leftbind
918 output_16 ; yxz 990 output_16 ; yxz
919 STRCAT_PRINT " " 991 STRCAT_PRINT " "
920 ; Stopped average depth 992 ; Stopped average depth
921 movff avr_rel_pressure+0,lo 993 movff avr_rel_pressure+0,lo
922 movff avr_rel_pressure+1,hi 994 movff avr_rel_pressure+1,hi
923 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 995 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
924 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet 996 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
925 WIN_MEDIUM dive_avr_stop_column3,dive_avr_stop_row 997 WIN_MEDIUM dm_custom_avr_stop_column3,dm_custom_avr_stop_row
926 output_16 ; yxz 998 output_16 ; yxz
927 bcf leftbind 999 bcf leftbind
928 STRCAT_PRINT " " 1000 STRCAT_PRINT " "
929 return 1001 return
930 1002
931 TFT_update_avr_stopwatch_metric: 1003 TFT_update_avr_stopwatch_metric:
932 ; Non-resettable average depth 1004 ; Non-resettable average depth
933 movff avr_rel_pressure_total+0,lo 1005 movff avr_rel_pressure_total+0,lo
934 movff avr_rel_pressure_total+1,hi 1006 movff avr_rel_pressure_total+1,hi
935 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 1007 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
936 WIN_MEDIUM dive_avr_stop_column1,dive_avr_stop_row 1008 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row
937 bsf ignore_digit5 ; no cm 1009 bsf ignore_digit5 ; no cm
938 output_16dp .3 ; yxz.a 1010 output_16dp .3 ; yxz.a
939 STRCAT_PRINT " " 1011 STRCAT_PRINT " "
940 ; Stopped average depth 1012 ; Stopped average depth
941 movff avr_rel_pressure+0,lo 1013 movff avr_rel_pressure+0,lo
942 movff avr_rel_pressure+1,hi 1014 movff avr_rel_pressure+1,hi
943 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 1015 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
944 WIN_MEDIUM dive_avr_stop_column3,dive_avr_stop_row 1016 WIN_MEDIUM dm_custom_avr_stop_column3,dm_custom_avr_stop_row
945 bsf ignore_digit5 ; no cm 1017 bsf ignore_digit5 ; no cm
946 output_16dp .3 ; yxz.a 1018 output_16dp .3 ; yxz.a
947 bcf leftbind 1019 bcf leftbind
948 bcf ignore_digit5 1020 bcf ignore_digit5
949 STRCAT_PRINT " " 1021 STRCAT_PRINT " "
950 return 1022 return
951 1023
952 global TFT_ceiling_mask ; The ceiling mask 1024 global TFT_ceiling_mask ; The ceiling mask
953 TFT_ceiling_mask: 1025 TFT_ceiling_mask:
954 call TFT_divemask_color 1026 call TFT_divemask_color
955 WIN_TINY dive_ceiling_text_column,dive_ceiling_text_row 1027 WIN_TINY dm_custom_ceiling_text_column,dm_custom_ceiling_text_row
956 STRCPY_TEXT_PRINT tCeiling 1028 STRCPY_TEXT_PRINT tCeiling
957 call TFT_standard_color 1029 call TFT_standard_color
958 return 1030 return
959 1031
960 global TFT_ceiling ; Ceiling 1032 global TFT_ceiling ; Ceiling
961 TFT_ceiling: 1033 TFT_ceiling:
962 call TFT_standard_color 1034 call TFT_standard_color
963 WIN_MEDIUM dive_ceiling_value_column,dive_ceiling_value_row 1035 WIN_MEDIUM dm_custom_ceiling_value_column,dm_custom_ceiling_value_row
964 movff int_O_ceiling+0,lo 1036 movff int_O_ceiling+0,lo
965 movff int_O_ceiling+1,hi 1037 movff int_O_ceiling+1,hi
966 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 1038 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
967 bsf leftbind 1039 bsf leftbind
968 TSTOSS opt_units ; 0=m, 1=ft 1040 TSTOSS opt_units ; 0=m, 1=ft
983 return 1055 return
984 1056
985 global TFT_hud_mask ; The HUD mask 1057 global TFT_hud_mask ; The HUD mask
986 TFT_hud_mask: 1058 TFT_hud_mask:
987 call TFT_divemask_color 1059 call TFT_divemask_color
988 WIN_TINY dive_custom_hud_column1,dive_custom_hud_row 1060 WIN_TINY dm_custom_hud_column1,dm_custom_hud_row
989 STRCPY_TEXT_PRINT tDiveHudMask1 1061 STRCPY_TEXT_PRINT tDiveHudMask1
990 WIN_TINY dive_custom_hud_column2,dive_custom_hud_row 1062 WIN_TINY dm_custom_hud_column2,dm_custom_hud_row
991 STRCPY_TEXT_PRINT tDiveHudMask2 1063 STRCPY_TEXT_PRINT tDiveHudMask2
992 WIN_TINY dive_custom_hud_column3,dive_custom_hud_row 1064 WIN_TINY dm_custom_hud_column3,dm_custom_hud_row
993 STRCPY_TEXT_PRINT tDiveHudMask3 1065 STRCPY_TEXT_PRINT tDiveHudMask3
994 call TFT_standard_color 1066 call TFT_standard_color
995 return 1067 return
996 1068
997 global TFT_hud_voltages 1069 global TFT_hud_voltages
998 TFT_hud_voltages: ; Show HUD details 1070 TFT_hud_voltages: ; Show HUD details
999 WIN_SMALL .5,dive_hud_data_row 1071 WIN_SMALL dm_custom_hud_sensor1_column,dm_custom_hud_data_row
1000 call TFT_standard_color 1072 call TFT_standard_color
1001 btfss use_O2_sensor1 1073 btfss use_O2_sensor1
1002 call TFT_warnings_color 1074 call TFT_warnings_color
1003 movff o2_mv_sensor1+0,lo 1075 movff o2_mv_sensor1+0,lo
1004 movff o2_mv_sensor1+1,hi 1076 movff o2_mv_sensor1+1,hi
1005 bsf leftbind 1077 bsf leftbind
1006 output_16dp .4 ; x.xx 1078 output_16dp .4 ; x.xx
1007 bcf leftbind 1079 bcf leftbind
1008 STRCAT_PRINT "mV " 1080 STRCAT_PRINT "mV "
1009 WIN_SMALL .55,dive_hud_data_row 1081 WIN_SMALL dm_custom_hud_sensor2_column,dm_custom_hud_data_row
1010 call TFT_standard_color 1082 call TFT_standard_color
1011 btfss use_O2_sensor2 1083 btfss use_O2_sensor2
1012 call TFT_warnings_color 1084 call TFT_warnings_color
1013 movff o2_mv_sensor2+0,lo 1085 movff o2_mv_sensor2+0,lo
1014 movff o2_mv_sensor2+1,hi 1086 movff o2_mv_sensor2+1,hi
1015 bsf leftbind 1087 bsf leftbind
1016 output_16dp .4 ; x.xx 1088 output_16dp .4 ; x.xx
1017 bcf leftbind 1089 bcf leftbind
1018 STRCAT_PRINT "mV " 1090 STRCAT_PRINT "mV "
1019 WIN_SMALL .105,dive_hud_data_row 1091 WIN_SMALL dm_custom_hud_sensor3_column,dm_custom_hud_data_row
1020 call TFT_standard_color 1092 call TFT_standard_color
1021 btfss use_O2_sensor3 1093 btfss use_O2_sensor3
1022 call TFT_warnings_color 1094 call TFT_warnings_color
1023 movff o2_mv_sensor3+0,lo 1095 movff o2_mv_sensor3+0,lo
1024 movff o2_mv_sensor3+1,hi 1096 movff o2_mv_sensor3+1,hi
1036 btfsc use_O2_sensor1 ; Use Sensor 1? 1108 btfsc use_O2_sensor1 ; Use Sensor 1?
1037 bra TFT_update_hud1 ; Yes 1109 bra TFT_update_hud1 ; Yes
1038 btfss dive_hud1_displayed ; Was the sensor shown? 1110 btfss dive_hud1_displayed ; Was the sensor shown?
1039 bra TFT_update_hud2 ; Yes, skip clear 1111 bra TFT_update_hud2 ; Yes, skip clear
1040 bcf dive_hud1_displayed ; No, clear display flag 1112 bcf dive_hud1_displayed ; No, clear display flag
1041 WIN_BOX_BLACK dive_hud_data_row, dive_hud_data_row+.31, dive_hud_sensor1_column, dive_hud_sensor2_column ; top, bottom, left, right 1113 WIN_BOX_BLACK dm_custom_hud_data_row, dm_customview_bot, dm_custom_hud_sensor1_column, dm_custom_hud_sensor2_column ; top, bottom, left, right
1042 WIN_STD dive_hud_sensor1_column+.7,dive_hud_data_row+.5 1114 WIN_STD dm_custom_hud_sensor1_column+.7, dm_custom_hud_data_row+.5
1043 call TFT_standard_color 1115 call TFT_standard_color
1044 STRCPY_PRINT "---" 1116 STRCPY_PRINT "---"
1045 bra TFT_update_hud2 ; Skip Sensor 1 1117 bra TFT_update_hud2 ; Skip Sensor 1
1046 TFT_update_hud1: 1118 TFT_update_hud1:
1047 WIN_MEDIUM dive_hud_sensor1_column,dive_hud_data_row 1119 WIN_MEDIUM dm_custom_hud_sensor1_column,dm_custom_hud_data_row
1048 movff o2_ppo2_sensor1,lo 1120 movff o2_ppo2_sensor1,lo
1049 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo 1121 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo
1050 btfss voting_logic_sensor1 ; Sensor within voting logic? 1122 btfss voting_logic_sensor1 ; Sensor within voting logic?
1051 bsf win_invert ; No, invert output... 1123 bsf win_invert ; No, invert output...
1052 btfss voting_logic_sensor1 1124 btfss voting_logic_sensor1
1060 btfsc use_O2_sensor2 ; Use Sensor 2? 1132 btfsc use_O2_sensor2 ; Use Sensor 2?
1061 bra TFT_update_hud3 ; Yes 1133 bra TFT_update_hud3 ; Yes
1062 btfss dive_hud2_displayed ; Was the sensor shown? 1134 btfss dive_hud2_displayed ; Was the sensor shown?
1063 bra TFT_update_hud4 ; Yes, skip clear 1135 bra TFT_update_hud4 ; Yes, skip clear
1064 bcf dive_hud2_displayed ; No, clear display flag 1136 bcf dive_hud2_displayed ; No, clear display flag
1065 WIN_BOX_BLACK dive_hud_data_row, dive_hud_data_row+.31, dive_hud_sensor2_column, dive_hud_sensor3_column ; top, bottom, left, right 1137 WIN_BOX_BLACK dm_custom_hud_data_row, dm_customview_bot, dm_custom_hud_sensor2_column, dm_custom_hud_sensor3_column ; top, bottom, left, right
1066 WIN_STD dive_hud_sensor2_column+.7,dive_hud_data_row+.5 1138 WIN_STD dm_custom_hud_sensor2_column+.7, dm_custom_hud_data_row+.5
1067 call TFT_standard_color 1139 call TFT_standard_color
1068 STRCPY_PRINT "---" 1140 STRCPY_PRINT "---"
1069 bra TFT_update_hud4 ; Skip Sensor 2 1141 bra TFT_update_hud4 ; Skip Sensor 2
1070 TFT_update_hud3: 1142 TFT_update_hud3:
1071 WIN_MEDIUM dive_hud_sensor2_column,dive_hud_data_row 1143 WIN_MEDIUM dm_custom_hud_sensor2_column,dm_custom_hud_data_row
1072 movff o2_ppo2_sensor2,lo 1144 movff o2_ppo2_sensor2,lo
1073 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo 1145 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo
1074 btfss voting_logic_sensor2 ; Sensor within voting logic? 1146 btfss voting_logic_sensor2 ; Sensor within voting logic?
1075 bsf win_invert ; No, invert output... 1147 bsf win_invert ; No, invert output...
1076 btfss voting_logic_sensor2 1148 btfss voting_logic_sensor2
1084 btfsc use_O2_sensor3 ; Use Sensor 3? 1156 btfsc use_O2_sensor3 ; Use Sensor 3?
1085 bra TFT_update_hud5 ; Yes 1157 bra TFT_update_hud5 ; Yes
1086 btfss dive_hud3_displayed ; Was the sensor shown? 1158 btfss dive_hud3_displayed ; Was the sensor shown?
1087 bra TFT_update_hud6 ; Yes, skip clear 1159 bra TFT_update_hud6 ; Yes, skip clear
1088 bcf dive_hud3_displayed ; No, clear display flag 1160 bcf dive_hud3_displayed ; No, clear display flag
1089 WIN_BOX_BLACK dive_hud_data_row, dive_hud_data_row+.31, dive_hud_sensor3_column, .159 ; top, bottom, left, right 1161 WIN_BOX_BLACK dm_custom_hud_data_row, dm_customview_bot, dm_custom_hud_sensor3_column, .159 ; top, bottom, left, right
1090 WIN_STD dive_hud_sensor3_column+.7,dive_hud_data_row+.5 1162 WIN_STD dm_custom_hud_sensor3_column+.7, dm_custom_hud_data_row+.5
1091 call TFT_standard_color 1163 call TFT_standard_color
1092 STRCPY_PRINT "---" 1164 STRCPY_PRINT "---"
1093 bra TFT_update_hud6 ; Skip Sensor 3 1165 bra TFT_update_hud6 ; Skip Sensor 3
1094 TFT_update_hud5: 1166 TFT_update_hud5:
1095 WIN_MEDIUM dive_hud_sensor3_column,dive_hud_data_row 1167 WIN_MEDIUM dm_custom_hud_sensor3_column,dm_custom_hud_data_row
1096 movff o2_ppo2_sensor3,lo 1168 movff o2_ppo2_sensor3,lo
1097 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo 1169 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo
1098 btfss voting_logic_sensor3 ; Sensor within voting logic? 1170 btfss voting_logic_sensor3 ; Sensor within voting logic?
1099 bsf win_invert ; No, invert output... 1171 bsf win_invert ; No, invert output...
1100 btfss voting_logic_sensor3 1172 btfss voting_logic_sensor3
1390 movwf lo ; exchange lo and hi 1462 movwf lo ; exchange lo and hi
1391 output_99x 1463 output_99x
1392 PUTC ':' 1464 PUTC ':'
1393 movff hi,lo 1465 movff hi,lo
1394 output_99x 1466 output_99x
1395 movlw warning_length ; Divemode string length 1467 movlw dm_warning_length ; Divemode string length
1396 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 1468 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
1397 STRCAT_PRINT "" 1469 STRCAT_PRINT ""
1398 return 1470 return
1399 1471
1400 global TFT_ftts 1472 global TFT_ftts
1401 TFT_ftts: 1473 TFT_ftts:
1402 movff char_I_extra_time,lo 1474 movff char_I_extra_time,lo
1403 tstfsz lo 1475 tstfsz lo
1404 bra $+4 1476 bra $+4
1405 return ; char_I_extra_time=0, return. 1477 return ; char_I_extra_time=0, return.
1406 incf warning_counter,F ; increase counter 1478
1407 call TFT_warning_set_window ; Sets the row and column for the current warning 1479 if dm_offset !=0
1408 tstfsz WREG ; Is there room for the warning? 1480 incf warning_counter,F ; increase counter
1409 return ; No 1481 call TFT_warning_set_window ; Sets the row and column for the current warning
1482 tstfsz WREG ; Is there room for the warning?
1483 return ; No
1484 else
1485 call TFT_standard_color
1486 WIN_SMALL dm_ftts_value_column, dm_ftts_value_row
1487 endif
1488
1410 movff char_I_extra_time,lo 1489 movff char_I_extra_time,lo
1411 STRCPY "@+" 1490 STRCPY "@+"
1412 bsf leftbind 1491 bsf leftbind
1413 output_8 1492 output_8
1414 PUTC ":" 1493 PUTC ":"
1422 incf WREG,w 1501 incf WREG,w
1423 bz TFT_ftts2 ; Wait... 1502 bz TFT_ftts2 ; Wait...
1424 output_16 1503 output_16
1425 bcf leftbind 1504 bcf leftbind
1426 PUTC "'" 1505 PUTC "'"
1427 movlw warning_length ; Divemode string length 1506 movlw dm_warning_length ; Divemode string length
1428 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 1507 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
1429 STRCAT_PRINT "" 1508 STRCAT_PRINT ""
1430 return 1509 return
1431 1510
1432 TFT_ftts2: 1511 TFT_ftts2:
1433 STRCAT "---" 1512 STRCAT "---"
1434 bcf leftbind 1513 bcf leftbind
1435 movlw warning_length ; Divemode string length 1514 movlw dm_warning_length ; Divemode string length
1436 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 1515 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
1437 STRCAT_PRINT "" 1516 STRCAT_PRINT ""
1438 return 1517 return
1439 1518
1440 1519
1495 return 1574 return
1496 1575
1497 ;============================================================================= 1576 ;=============================================================================
1498 global TFT_divemode_menu_cursor 1577 global TFT_divemode_menu_cursor
1499 TFT_divemode_menu_cursor: 1578 TFT_divemode_menu_cursor:
1500 WIN_BOX_BLACK divemode_menu_item1_row,divemode_menu_item3_row+.24,divemode_menu_item1_column-.8,divemode_menu_item1_column-.1 1579 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item1_column-.8, dm_menu_item1_column-.1
1501 WIN_BOX_BLACK divemode_menu_item4_row,divemode_menu_item6_row+.24,divemode_menu_item4_column-.8,divemode_menu_item4_column-.1 1580 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item4_column-.8, dm_menu_item4_column-.1
1502 call TFT_standard_color 1581 call TFT_standard_color
1503 1582
1504 movlw divemode_menu_item1_column-.8 1583 movlw dm_menu_item1_column-.8
1505 btfsc menupos,2 ; >3? 1584 btfsc menupos,2 ; >3?
1506 movlw divemode_menu_item4_column-.8 ; Yes 1585 movlw dm_menu_item4_column-.8 ; Yes
1507 movff WREG,win_leftx2 1586 movff WREG,win_leftx2
1508 1587
1509 movff menupos,lo ; Copy menu pos 1588 movff menupos,lo ; Copy menu pos
1510 movlw divemode_menu_item6_row 1589 movlw dm_menu_item6_row
1511 dcfsnz lo,F 1590 dcfsnz lo,F
1512 movlw divemode_menu_item1_row 1591 movlw dm_menu_item1_row
1513 dcfsnz lo,F 1592 dcfsnz lo,F
1514 movlw divemode_menu_item2_row 1593 movlw dm_menu_item2_row
1515 dcfsnz lo,F 1594 dcfsnz lo,F
1516 movlw divemode_menu_item3_row 1595 movlw dm_menu_item3_row
1517 dcfsnz lo,F 1596 dcfsnz lo,F
1518 movlw divemode_menu_item4_row 1597 movlw dm_menu_item4_row
1519 dcfsnz lo,F 1598 dcfsnz lo,F
1520 movlw divemode_menu_item5_row 1599 movlw dm_menu_item5_row
1521 movff WREG,win_top 1600 movff WREG,win_top
1522 movlw FT_SMALL 1601 movlw FT_SMALL
1523 movff WREG,win_font 1602 movff WREG,win_font
1524 STRCPY_PRINT "\xb7" ; print cursor 1603 STRCPY_PRINT "\xb7" ; print cursor
1525 return 1604 return
1529 btfsc divemode_menu ; Is the dive mode menu shown? 1608 btfsc divemode_menu ; Is the dive mode menu shown?
1530 return ; Yes, return 1609 return ; Yes, return
1531 btfsc blinking_better_gas ; blinking better Gas? 1610 btfsc blinking_better_gas ; blinking better Gas?
1532 return ; Yes, no update of temperature now 1611 return ; Yes, no update of temperature now
1533 ; temperature 1612 ; temperature
1534 WIN_SMALL dive_temp_column,dive_temp_row 1613 WIN_SMALL dm_temp_column,dm_temp_row
1535 call TFT_standard_color 1614 call TFT_standard_color
1536 bsf leftbind 1615 bsf leftbind
1537 1616
1538 SAFE_2BYTE_COPY temperature, lo 1617 SAFE_2BYTE_COPY temperature, lo
1539 TSTOSS opt_units ; 0=°C, 1=°F 1618 TSTOSS opt_units ; 0=°C, 1=°F
1575 PUTC "*" 1654 PUTC "*"
1576 STRCAT_PRINT "" 1655 STRCAT_PRINT ""
1577 return 1656 return
1578 1657
1579 TFT_active_setpoint: ; Show setpoint 1658 TFT_active_setpoint: ; Show setpoint
1580 WIN_STD active_gas_column,active_gas_row 1659 WIN_STD dm_active_gas_column, dm_active_gas_row
1581 call TFT_standard_color 1660 call TFT_standard_color
1582 btfsc is_bailout ; =1: Bailout 1661 btfsc is_bailout ; =1: Bailout
1583 bra TFT_active_setpoint_bail ; Show "Bailout" instead of Setpoint 1662 bra TFT_active_setpoint_bail ; Show "Bailout" instead of Setpoint
1584 1663
1585 rcall TFT_active_setpoint2 ; show setpoint (Non-Inverted in all cases) 1664 rcall TFT_active_setpoint2 ; show setpoint (Non-Inverted in all cases)
1591 bra TFT_active_setpoint_diluent ; Done. 1670 bra TFT_active_setpoint_diluent ; Done.
1592 1671
1593 movlw color_yellow ; Blink in yellow 1672 movlw color_yellow ; Blink in yellow
1594 call TFT_set_color 1673 call TFT_set_color
1595 bsf win_invert ; Set invert flag 1674 bsf win_invert ; Set invert flag
1596 WIN_STD active_gas_column,active_gas_row 1675 WIN_STD dm_active_gas_column, dm_active_gas_row
1597 movff char_I_const_ppO2,lo 1676 movff char_I_const_ppO2,lo
1598 clrf hi 1677 clrf hi
1599 bsf leftbind 1678 bsf leftbind
1600 output_16dp d'3' 1679 output_16dp d'3'
1601 bcf leftbind 1680 bcf leftbind
1606 STRCAT_PRINT "" 1685 STRCAT_PRINT ""
1607 bcf win_invert ; Reset invert flag 1686 bcf win_invert ; Reset invert flag
1608 1687
1609 TFT_active_setpoint_diluent: 1688 TFT_active_setpoint_diluent:
1610 call TFT_standard_color 1689 call TFT_standard_color
1611 WIN_SMALL active_dil_column,active_dil_row 1690 if dm_offset != 0
1691 WIN_SMALL dm_active_dil_column, dm_active_dil_row
1692 else
1693 WIN_STD dm_active_dil_column, dm_active_dil_row
1694 endif
1612 movff char_I_O2_ratio,lo ; lo now stores O2 in % 1695 movff char_I_O2_ratio,lo ; lo now stores O2 in %
1613 movff char_I_He_ratio,hi ; hi now stores He in % 1696 movff char_I_He_ratio,hi ; hi now stores He in %
1614 rcall TFT_show_dil_divemode2 ; Show diluent (Non-Inverted in all cases) 1697 rcall TFT_show_dil_divemode2 ; Show diluent (Non-Inverted in all cases)
1615 1698
1616 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode 1699 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode
1620 return ; No, Done. 1703 return ; No, Done.
1621 1704
1622 movlw color_yellow ; Blink in yellow 1705 movlw color_yellow ; Blink in yellow
1623 call TFT_set_color 1706 call TFT_set_color
1624 bsf win_invert ; Set invert flag 1707 bsf win_invert ; Set invert flag
1625 WIN_SMALL active_dil_column,active_dil_row 1708 if dm_offset != 0
1709 WIN_SMALL dm_active_dil_column, dm_active_dil_row
1710 else
1711 WIN_STD dm_active_dil_column, dm_active_dil_row
1712 endif
1626 movff char_I_O2_ratio,lo ; lo now stores O2 in % 1713 movff char_I_O2_ratio,lo ; lo now stores O2 in %
1627 movff char_I_He_ratio,hi ; hi now stores He in % 1714 movff char_I_He_ratio,hi ; hi now stores He in %
1628 rcall TFT_show_dil_divemode2 ; Show gas 1715 rcall TFT_show_dil_divemode2 ; Show gas
1629 bcf win_invert ; Reset invert flag 1716 bcf win_invert ; Reset invert flag
1630 call TFT_standard_color 1717 call TFT_standard_color
1647 return 1734 return
1648 btfsc FLAG_ccr_mode ; in CCR mode 1735 btfsc FLAG_ccr_mode ; in CCR mode
1649 bra TFT_active_setpoint ; Yes, show setpoint 1736 bra TFT_active_setpoint ; Yes, show setpoint
1650 1737
1651 call TFT_standard_color 1738 call TFT_standard_color
1652 WIN_STD active_gas_column,active_gas_row 1739 WIN_STD dm_active_gas_column, dm_active_gas_row
1653 movff char_I_O2_ratio,lo ; lo now stores O2 in % 1740 movff char_I_O2_ratio,lo ; lo now stores O2 in %
1654 movff char_I_He_ratio,hi ; hi now stores He in % 1741 movff char_I_He_ratio,hi ; hi now stores He in %
1655 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases) 1742 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases)
1656 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode 1743 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode
1657 return ; Done. 1744 return ; Done.
1659 btg blinking_better_gas ; Toggle blink bit... 1746 btg blinking_better_gas ; Toggle blink bit...
1660 btfss blinking_better_gas ; blink now? 1747 btfss blinking_better_gas ; blink now?
1661 return ; No, Done. 1748 return ; No, Done.
1662 call TFT_attention_color ; blink in yellow 1749 call TFT_attention_color ; blink in yellow
1663 bsf win_invert ; Set invert flag 1750 bsf win_invert ; Set invert flag
1664 WIN_STD active_gas_column,active_gas_row 1751 WIN_STD dm_active_gas_column, dm_active_gas_row
1665 movff char_I_O2_ratio,lo ; lo now stores O2 in % 1752 movff char_I_O2_ratio,lo ; lo now stores O2 in %
1666 movff char_I_He_ratio,hi ; hi now stores He in % 1753 movff char_I_He_ratio,hi ; hi now stores He in %
1667 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases) 1754 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases)
1668 bcf win_invert ; Reset invert flag 1755 bcf win_invert ; Reset invert flag
1669 call TFT_standard_color 1756 call TFT_standard_color
1808 bsf ccr_diluent_setup ; Use CCR Diluents... 1895 bsf ccr_diluent_setup ; Use CCR Diluents...
1809 rcall TFT_gaslist_surfmode ; Use OC/BAIL routine 1896 rcall TFT_gaslist_surfmode ; Use OC/BAIL routine
1810 bcf ccr_diluent_setup ; Clear flag 1897 bcf ccr_diluent_setup ; Clear flag
1811 return 1898 return
1812 1899
1900 ;==================================================================
1901
1813 global TFT_depth 1902 global TFT_depth
1814 TFT_depth: 1903 TFT_depth:
1815 SAFE_2BYTE_COPY rel_pressure, lo 1904 SAFE_2BYTE_COPY rel_pressure, lo
1816 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 1905 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
1906
1907 TFT_color_code warn_depth ; Color-code the output
1908 call TFT_depth_blink
1909 WIN_LARGE dm_depth_column, dm_depth_row
1817 1910
1818 TSTOSS opt_units ; 0=m, 1=ft 1911 TSTOSS opt_units ; 0=m, 1=ft
1819 bra TFT_depth_metric 1912 bra TFT_depth_metric
1820 ;TFT_depth_imperial 1913 ;TFT_depth_imperial
1821 WIN_LARGE depth_feet_column,depth_feet_row
1822 TFT_color_code warn_depth ; Color-code the output
1823
1824 clrf sub_a+1 ; Display 0ft if lower then 30cm 1914 clrf sub_a+1 ; Display 0ft if lower then 30cm
1825 movlw d'30' 1915 movlw d'30'
1826 movwf sub_a+0 1916 movwf sub_a+0
1827 movff hi,sub_b+1 1917 movff hi,sub_b+1
1828 movff lo,sub_b+0 1918 movff lo,sub_b+0
1835 output_16 ; feet in Big font 1925 output_16 ; feet in Big font
1836 bcf leftbind 1926 bcf leftbind
1837 movlw .3 ; limit to three chars 1927 movlw .3 ; limit to three chars
1838 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 1928 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
1839 STRCAT_PRINT "" ; Display feet 1929 STRCAT_PRINT "" ; Display feet
1930 bcf win_invert ; Reset invert flag
1840 return 1931 return
1841 1932
1842 depth_less_0.3mtr_feet: 1933 depth_less_0.3mtr_feet:
1843 STRCAT_PRINT "0 " ; manual zero 1934 STRCAT_PRINT "0 " ; manual zero
1935 bcf win_invert ; Reset invert flag
1844 return 1936 return
1845 1937
1846 TFT_depth_metric: 1938 TFT_depth_metric:
1847 WIN_LARGE depth_column,depth_row
1848 TFT_color_code warn_depth ; Color-code the output
1849
1850 movlw .039 1939 movlw .039
1851 cpfslt hi 1940 cpfslt hi
1852 bra depth_greater_99_84mtr 1941 bra depth_greater_99_84mtr
1853 1942
1854 btfsc depth_greater_100m ; Was depth>100m during last call 1943 btfsc depth_greater_100m ; Was depth>100m during last call
1893 1982
1894 tft_depth3: 1983 tft_depth3:
1895 STRCAT_PRINT "" ; Display full meters 1984 STRCAT_PRINT "" ; Display full meters
1896 1985
1897 ; .1m in MEDIUM font 1986 ; .1m in MEDIUM font
1898 WIN_MEDIUM depth_dm_column,depth_dm_row 1987 WIN_MEDIUM dm_depth_dm_column, dm_depth_dm_row
1899 TFT_color_code warn_depth ; Color-code the output 1988 TFT_color_code warn_depth ; Color-code the output
1900 1989
1901 SAFE_2BYTE_COPY rel_pressure, lo 1990 SAFE_2BYTE_COPY rel_pressure, lo
1902 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 1991 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
1903 1992
1915 movlw d'4' 2004 movlw d'4'
1916 movwf ignore_digits 2005 movwf ignore_digits
1917 bsf ignore_digit5 2006 bsf ignore_digit5
1918 output_16dp d'0' 2007 output_16dp d'0'
1919 STRCAT_PRINT "" ; Display decimeters 2008 STRCAT_PRINT "" ; Display decimeters
2009 bcf win_invert ; Reset invert flag
1920 WIN_FONT FT_SMALL 2010 WIN_FONT FT_SMALL
1921 return 2011 return
1922 2012
1923 depth_less_0.3mtr: 2013 depth_less_0.3mtr:
1924 STRCAT_PRINT "0" ; Display 0.0m manually 2014 STRCAT_PRINT "0" ; Display 0.0m manually
2015 bcf win_invert ; Reset invert flag
1925 WIN_FONT FT_SMALL 2016 WIN_FONT FT_SMALL
1926 return 2017 return
1927 2018
1928 depth_greater_99_84mtr: ; Display only in full meters 2019 depth_greater_99_84mtr: ; Display only in full meters
1929 btfss depth_greater_100m ; Is depth>100m already? 2020 btfss depth_greater_100m ; Is depth>100m already?
1930 rcall TFT_clear_depth ; No, clear depth area and set flag 2021 rcall TFT_clear_depth ; No, clear depth area and set flag
2022 TFT_color_code warn_depth
1931 ; Depth is already in hi:lo 2023 ; Depth is already in hi:lo
1932 ; Show depth in Full meters 2024 ; Show depth in Full meters
1933 ; That means ignore figure 4 and 5 2025 ; That means ignore figure 4 and 5
1934 lfsr FSR2,buffer 2026 lfsr FSR2,buffer
1935 bsf ignore_digit4 2027 bsf ignore_digit4
1936 bsf leftbind 2028 bsf leftbind
1937 output_16 2029 output_16
1938 bcf leftbind 2030 bcf leftbind
1939 STRCAT_PRINT "" ; Display full meters only 2031 STRCAT_PRINT "" ; Display full meters only
2032 bcf win_invert ; Reset invert flag
1940 WIN_FONT FT_SMALL 2033 WIN_FONT FT_SMALL
1941 return 2034 return
1942 2035
1943 TFT_clear_depth: ; No, clear depth area and set flag 2036 TFT_clear_depth: ; No, clear depth area and set flag
1944 WIN_BOX_BLACK depth_row, .77,.0, max_depth_column-.1 ;top, bottom, left, right 2037 WIN_BOX_BLACK dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right
1945 bsf depth_greater_100m ; Set Flag 2038 bsf depth_greater_100m ; Set Flag
1946 return 2039 return
2040
2041 TFT_depth_blink:
2042 TSTOSS opt_depthblink ; 0=standard, 1=blink
2043 return
2044
2045 ; check if previous cycle had the blinking warning or not
2046 btfsc blinking_depth_prev ; did we have warning prev?
2047 bra TFT_depth_blink_prevwarn ; Yes
2048
2049 ; No; check if it's set now
2050 btfsc blinking_depth_warning ; do we have warning set now?
2051 bra TFT_depth_blink_warn ; Yes - so we have warning now but not prev
2052
2053 ; no warning in previous cycle, no warning now, reset all flags
2054 bcf blinking_depth_prev ; reset prev flag
2055 bcf blinking_depth_toggle ; reset toggle
2056 bcf win_invert
2057 ; all done
2058 return
2059
2060 TFT_depth_blink_prevwarn:
2061 ; ...we had warning in previous cycle, check if we still have the warning set
2062 btfss blinking_depth_warning ; do we still have the warning?
2063 bra TFT_depth_blink_prevwarn_nowarn ; No, clear the depth area
2064
2065 ; we still have the warning, set previous flag for next cycle...
2066 bsf blinking_depth_prev ; set prev flag
2067 ; and set toggle and invert if required
2068 btfss blinking_depth_toggle ; do we have the toggle set?
2069 bra TFT_depth_blink_set ; No: set inverse, do color_box, set flag
2070 bra TFT_depth_blink_reset ; Yes: clear inverse, do black box, reset flag
2071
2072 TFT_depth_blink_prevwarn_nowarn:
2073 ; we had warning, but not now... (e.g. ascended or switched to better gas)
2074 ; reset the previous cycle flag for the next cycle...
2075 bcf blinking_depth_prev ; reset prev flag
2076 ; clear it - just in case if we had a blinked before
2077 bra TFT_depth_blink_reset ; Yes: clear inverse, do black box, reset flag
2078
2079 TFT_depth_blink_warn:
2080 ; new blinking warning activated (had no warning in previous cycle)
2081 bsf blinking_depth_prev ; set prev flag
2082 ; set toggle and invert
2083 bra TFT_depth_blink_set
2084
2085 TFT_depth_blink_set:
2086 ; clear the area with color
2087 movlw color_red ; that should not be hardcoded...
2088 WIN_BOX_COLOR dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right
2089 ;set the invert color
2090 bsf win_invert
2091 ; set the toggle
2092 bsf blinking_depth_toggle
2093 ; all done
2094 return
2095
2096 TFT_depth_blink_reset:
2097 ; clear the area with black
2098 WIN_BOX_BLACK dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right
2099 ;reset the invert color
2100 bcf win_invert
2101 ; reset the toggle
2102 bcf blinking_depth_toggle
2103 ; if it's still warning...
2104 btfsc blinking_depth_warning
2105 call TFT_warnings_color
2106 ; all done
2107 return
1947 2108
1948 ;============================================================================= 2109 ;=============================================================================
1949 2110
1950 global TFT_custom_text 2111 global TFT_custom_text
1951 TFT_custom_text: ; Show the custom text 2112 TFT_custom_text: ; Show the custom text
2226 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 2387 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
2227 TSTOSS opt_units ; 0=m, 1=ft 2388 TSTOSS opt_units ; 0=m, 1=ft
2228 bra TFT_max_pressure2_metric 2389 bra TFT_max_pressure2_metric
2229 ;TFT_max_pressure2_imperial 2390 ;TFT_max_pressure2_imperial
2230 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet 2391 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
2231 WIN_MEDIUM max_depth_feet_column,max_depth_feet_row 2392 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row
2232 call TFT_standard_color 2393 call TFT_standard_color
2233 output_16_3 2394 output_16_3
2234 STRCAT_PRINT "" 2395 STRCAT_PRINT ""
2235 return 2396 return
2236 2397
2237 TFT_max_pressure2_metric: 2398 TFT_max_pressure2_metric:
2238 WIN_MEDIUM max_depth_column,max_depth_row 2399 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row
2239 2400
2240 movlw .039 2401 movlw .039
2241 cpfslt hi 2402 cpfslt hi
2242 bra max_depth_greater_99_84mtr 2403 bra max_depth_greater_99_84mtr
2243 2404
2276 bsf leftbind 2437 bsf leftbind
2277 output_16 2438 output_16
2278 bra tft_max_depth3 2439 bra tft_max_depth3
2279 2440
2280 tft_max_depth2: 2441 tft_max_depth2:
2281 WIN_MEDIUM max_depth_column,max_depth_row 2442 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row
2282 STRCAT "0" 2443 STRCAT "0"
2283 2444
2284 tft_max_depth3: 2445 tft_max_depth3:
2285 call TFT_standard_color 2446 call TFT_standard_color
2286 STRCAT_PRINT "" ; Display full meters 2447 STRCAT_PRINT "" ; Display full meters
2287 bcf leftbind 2448 bcf leftbind
2288 2449
2289 ; .1m in SMALL font 2450 ; .1m in SMALL font
2290 WIN_SMALL max_depth_dm_column,max_depth_dm_row 2451 WIN_SMALL dm_max_depth_dm_column, dm_max_depth_dm_row
2291 2452
2292 SAFE_2BYTE_COPY max_pressure, lo 2453 SAFE_2BYTE_COPY max_pressure, lo
2293 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 2454 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
2294 2455
2295 PUTC "." 2456 PUTC "."
2317 STRCAT_PRINT "" ; Display full meters only 2478 STRCAT_PRINT "" ; Display full meters only
2318 WIN_FONT FT_SMALL 2479 WIN_FONT FT_SMALL
2319 return 2480 return
2320 2481
2321 TFT_clear_max_depth: ; No, clear max. depth area and set flag 2482 TFT_clear_max_depth: ; No, clear max. depth area and set flag
2322 WIN_BOX_BLACK max_depth_row,.49,max_depth_column, max_depth_dm_column+.13 ;top, bottom, left, right 2483 WIN_BOX_BLACK dm_max_depth_row, dm_max_depth_bot, dm_max_depth_column, dm_max_depth_rgt ;top, bottom, left, right
2323 bsf max_depth_greater_100m ; Set Flag 2484 bsf max_depth_greater_100m ; Set Flag
2324 return 2485 return
2325 2486
2326 2487
2327 TFT_max_pressure_apnoe: 2488 TFT_max_pressure_apnoe:
2331 bra TFT_max_pressure3 ; Show apnoe_max_pressure as max. depth 2492 bra TFT_max_pressure3 ; Show apnoe_max_pressure as max. depth
2332 2493
2333 global TFT_display_apnoe_last_max 2494 global TFT_display_apnoe_last_max
2334 TFT_display_apnoe_last_max: 2495 TFT_display_apnoe_last_max:
2335 call TFT_divemask_color 2496 call TFT_divemask_color
2336 WIN_TINY last_max_apnoe_text_column,last_max_apnoe_text_row 2497 WIN_TINY dm_apnoe_last_max_depth_text_col, dm_apnoe_last_max_depth_text_row
2337 STRCPY_TEXT_PRINT tApnoeMax 2498 STRCPY_TEXT_PRINT tApnoeMax
2338 2499
2339 call TFT_standard_color 2500 call TFT_standard_color
2340 SAFE_2BYTE_COPY max_pressure, lo 2501 SAFE_2BYTE_COPY max_pressure, lo
2341 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 2502 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
2342 TSTOSS opt_units ; 0=m, 1=ft 2503 TSTOSS opt_units ; 0=m, 1=ft
2343 bra TFT_display_apnoe_last_m_metric 2504 bra TFT_display_apnoe_last_m_metric
2344 ;TFT_display_apnoe_last_max_imperial 2505 ;TFT_display_apnoe_last_max_imperial
2345 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet 2506 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
2346 WIN_MEDIUM apnoe_last_max_depth_column,apnoe_last_max_depth_row 2507 WIN_MEDIUM dm_apnoe_last_max_depth_column, dm_apnoe_last_max_depth_row
2347 output_16 2508 output_16
2348 STRCAT_PRINT "" 2509 STRCAT_PRINT ""
2349 return 2510 return
2350 2511
2351 TFT_display_apnoe_last_m_metric: 2512 TFT_display_apnoe_last_m_metric:
2352 WIN_MEDIUM apnoe_last_max_depth_column,apnoe_last_max_depth_row 2513 WIN_MEDIUM dm_apnoe_last_max_depth_column, dm_apnoe_last_max_depth_row
2353 bsf ignore_digit5 ; do not display 1cm depth 2514 bsf ignore_digit5 ; do not display 1cm depth
2354 output_16dp d'3' 2515 output_16dp d'3'
2355 STRCAT_PRINT "" 2516 STRCAT_PRINT ""
2356 return 2517 return
2357 2518
2358 ;============================================================================= 2519 ;=============================================================================
2359 global TFT_divemins 2520 global TFT_divemins
2360 TFT_divemins: 2521 TFT_divemins:
2361 movff divemins+0,lo 2522 movff divemins+0,lo
2362 movff divemins+1,hi 2523 movff divemins+1,hi
2363 bcf leftbind 2524
2364 2525 ; Already showing divemins > 99min
2365 btfsc no_more_divesecs ; Ignore seconds? 2526 btfsc no_more_divesecs ; Ignore seconds?
2366 bra TFT_divemins2 ; Show minutes only 2527 bra TFT_divemins2 ; Show minutes only
2367 2528
2529 ; check if divemins has hi, definitely > 99min
2530 movlw .1
2531 cpfslt hi ; HI less than 1?
2532 bra TFT_divemins_clr ; No, show mins only
2533
2534 ; check if divemins (when HI is zero) > 99min
2368 movlw .99 2535 movlw .99
2369 cpfsgt lo ; bigger then 99? 2536 cpfsgt lo ; bigger than 99?
2370 bra TFT_divemins1 ; No show mins:secs 2537 bra TFT_divemins1 ; No show mins:secs
2538
2539 TFT_divemins_clr:
2371 ; Yes, remove second display for the rest of the dive and clear seconds 2540 ; Yes, remove second display for the rest of the dive and clear seconds
2372 bsf no_more_divesecs ; Set flag 2541 bsf no_more_divesecs ; Set flag
2373 ; Clear rest of seconds 2542 ; Clear rest of seconds
2374 WIN_BOX_BLACK divetime_row, warning1_row,divetime_column,.159 ;top, bottom, left, right 2543 WIN_BOX_BLACK dm_divetime_row, dm_divetime_bot, dm_divetime_column, dm_divetime_rgt ;top, bottom, left, right
2375 bra TFT_divemins2 ; Show minutes only 2544 bra TFT_divemins2 ; Show minutes only
2376 2545
2377 TFT_divemins1: 2546 TFT_divemins1:
2378 WIN_MEDIUM divetime_column, divetime_row 2547 ; Print out the minutes, up to 99min, only 2chars !
2379 output_16_3 ; displays only last three figures from a 16Bit value (0-999) 2548 call TFT_standard_color
2380 call TFT_standard_color 2549 WIN_MEDIUM dm_divetime_column, dm_divetime_row
2550
2551 movlw .9
2552 cpfsgt lo ; bigger then 9?
2553 bra TFT_divemins1_pad ; No, need padding
2554 ; Yes, just print out the value
2555 bsf leftbind
2556 movff divemins+0,lo
2557 output_99x ; displays only last two figures from a 8Bit value (00-99)
2558 bcf leftbind
2381 STRCAT_PRINT "" ; Show minutes in large font 2559 STRCAT_PRINT "" ; Show minutes in large font
2382 2560 bra TFT_divemins1_sec
2383 WIN_SMALL divetime_secs_column, divetime_secs_row ; left position for two sec figures 2561
2562 TFT_divemins1_pad:
2563 bcf leftbind
2564 PUTC " " ; Add a padding space
2565 bsf leftbind
2566 movff divemins+0,lo
2567 output_99 ; displays only last two figures from a 8Bit value (0-99)
2568 bcf leftbind
2569 STRCAT_PRINT "" ; Show minutes in large font
2570
2571 TFT_divemins1_sec:
2572 ; Print out the seconds
2573 WIN_SMALL dm_divetime_secs_column, dm_divetime_secs_row ; left position for two sec figures
2384 PUTC ':' 2574 PUTC ':'
2385 bsf leftbind 2575 bsf leftbind
2386 movff divesecs,lo 2576 movff divesecs,lo
2387 output_99x 2577 output_99x
2388 bcf leftbind 2578 bcf leftbind
2389 STRCAT_PRINT "" ; Show seconds in small font 2579 STRCAT_PRINT "" ; Show seconds in small font
2390 return 2580 return
2391 2581
2392 TFT_divemins2: 2582 TFT_divemins2:
2393 WIN_MEDIUM divetime_minsonly_column, divetime_row 2583 call TFT_standard_color
2394 output_16 2584 WIN_MEDIUM dm_divetime_minsonly_column, dm_divetime_row
2395 call TFT_standard_color 2585 bcf leftbind
2586
2587 ; if we are at or over the limit, do a WARNIGN color
2588 ; 9999 = 27 0F = [39][15]
2589 movlw .38
2590 cpfsgt hi ; hi > 38 ?
2591 bra TFT_divemins2_out ; No, hi <= 38, no need to warn
2592
2593 movlw .40
2594 cpfslt hi ; hi < 40 ?
2595 bra TFT_divemins2_warn ; No, hi >= 40, need to warn
2596
2597 ; hi = 39, check lo. check 14 as 9999 should be already WARN!
2598 movlw .14
2599 cpfsgt lo
2600 bra TFT_divemins2_out ; No, lo <= 14, no need to warn
2601 ; Yes, lo > 14, need to warn
2602
2603 TFT_divemins2_warn:
2604 call TFT_warnings_color
2605 bsf win_invert
2606
2607 TFT_divemins2_out:
2608 output_16_4
2396 STRCAT_PRINT "" ; Show minutes in large font 2609 STRCAT_PRINT "" ; Show minutes in large font
2610 bcf win_invert
2397 return 2611 return
2398 2612
2399 ;============================================================================= 2613 ;=============================================================================
2400 global TFT_display_apnoe_surface 2614 global TFT_display_apnoe_surface
2401 TFT_display_apnoe_surface: 2615 TFT_display_apnoe_surface:
2402 call TFT_divemask_color 2616 call TFT_divemask_color
2403 WIN_TINY surface_apnoe_text_column,surface_apnoe_text_row 2617 WIN_TINY dm_apnoe_surface_time_text_col, dm_apnoe_surface_time_text_row
2404 STRCPY_TEXT_PRINT tApnoeSurface 2618 STRCPY_TEXT_PRINT tApnoeSurface
2405 2619
2406 call TFT_standard_color 2620 call TFT_standard_color
2407 WIN_MEDIUM surface_time_apnoe_column, surface_time_apnoe_row 2621 WIN_MEDIUM dm_apnoe_surface_time_column, dm_apnoe_surface_time_row
2408 movff apnoe_surface_mins,lo 2622 movff apnoe_surface_mins,lo
2409 output_8 2623 output_8
2410 PUTC ':' 2624 PUTC ':'
2411 movff apnoe_surface_secs,lo 2625 movff apnoe_surface_secs,lo
2412 output_99x 2626 output_99x
2414 return 2628 return
2415 2629
2416 global TFT_apnoe_clear_surface 2630 global TFT_apnoe_clear_surface
2417 TFT_apnoe_clear_surface: 2631 TFT_apnoe_clear_surface:
2418 ; Clear Surface timer.... 2632 ; Clear Surface timer....
2419 WIN_BOX_BLACK surface_apnoe_text_row, .239, surface_apnoe_text_column, .159 ;top, bottom, left, right 2633 WIN_BOX_BLACK dm_apnoe_surface_time_text_row, .239, dm_apnoe_surface_time_text_col, .159 ;top, bottom, left, right
2420 return 2634 return
2421 2635
2422 global TFT_display_apnoe_descent 2636 global TFT_display_apnoe_descent
2423 TFT_display_apnoe_descent: ; Descent divetime 2637 TFT_display_apnoe_descent: ; Descent divetime
2424 movff apnoe_mins,lo 2638 movff apnoe_mins,lo
2425 clrf hi 2639 clrf hi
2426 WIN_MEDIUM divetime_column, divetime_row 2640 WIN_MEDIUM dm_divetime_apnoe_column, dm_divetime_apnoe_row
2427 output_16_3 ; displays only last three figures from a 16Bit value (0-999) 2641 output_16_3 ; displays only last three figures from a 16Bit value (0-999)
2428 call TFT_standard_color 2642 call TFT_standard_color
2429 STRCAT_PRINT "" ; Show minutes in large font 2643 STRCAT_PRINT "" ; Show minutes in large font
2430 WIN_SMALL divetime_secs_column, divetime_secs_row ; left position for two sec figures 2644 WIN_SMALL dm_divetime_apnoe_secs_column, dm_divetime_apnoe_secs_row ; left position for two sec figures
2431 PUTC ':' 2645 PUTC ':'
2432 bsf leftbind 2646 bsf leftbind
2433 movff apnoe_secs,lo 2647 movff apnoe_secs,lo
2434 output_99x 2648 output_99x
2435 bcf leftbind 2649 bcf leftbind
2436 STRCAT_PRINT "" ; Show seconds in small font 2650 STRCAT_PRINT "" ; Show seconds in small font
2437 2651
2438 call TFT_divemask_color 2652 call TFT_divemask_color
2439 WIN_TINY total_apnoe_text_column,total_apnoe_text_row 2653 WIN_TINY dm_total_apnoe_text_column,dm_total_apnoe_text_row
2440 STRCPY_TEXT_PRINT tApnoeTotal 2654 STRCPY_TEXT_PRINT tApnoeTotal
2441 call TFT_standard_color 2655 call TFT_standard_color
2442 movff divemins,lo 2656 movff divemins,lo
2443 clrf hi 2657 clrf hi
2444 WIN_MEDIUM apnoe_total_divetime_column, apnoe_total_divetime_row 2658 WIN_MEDIUM dm_apnoe_total_divetime_column, dm_apnoe_total_divetime_row
2445 output_16_3 ; displays only last three figures from a 16Bit value (0-999) 2659 output_16_3 ; displays only last three figures from a 16Bit value (0-999)
2446 call TFT_standard_color 2660 call TFT_standard_color
2447 STRCAT_PRINT "" ; Show minutes in large font 2661 STRCAT_PRINT "" ; Show minutes in large font
2448 WIN_SMALL apnoe_total_divetime_secs_column, apnoe_total_divetime_secs_row ; left position for two sec figures 2662 WIN_SMALL dm_apnoe_total_divetime_secs_col, dm_apnoe_total_divetime_secs_row ; left position for two sec figures
2449 PUTC ':' 2663 PUTC ':'
2450 bsf leftbind 2664 bsf leftbind
2451 movff divesecs,lo 2665 movff divesecs,lo
2452 output_99x 2666 output_99x
2453 bcf leftbind 2667 bcf leftbind
2646 2860
2647 global TFT_clear_warning_text 2861 global TFT_clear_warning_text
2648 TFT_clear_warning_text: 2862 TFT_clear_warning_text:
2649 btfss divemode ; in divemode? 2863 btfss divemode ; in divemode?
2650 bra TFT_clear_warning_text2 ; No, setup for surface mode 2864 bra TFT_clear_warning_text2 ; No, setup for surface mode
2651 WIN_BOX_BLACK warning1_row, divemode_customview_row-3, warning1_column, warning_icon_column-3 ;top, bottom, left, right 2865 WIN_BOX_BLACK dm_warning_row, dm_warning_bot, dm_warning_column, dm_warning_rgt ;top, bottom, left, right
2652 return 2866 return
2653 TFT_clear_warning_text2: 2867 TFT_clear_warning_text2:
2654 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ;top, bottom, left, right 2868 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ;top, bottom, left, right
2655 return 2869 return
2656 2870
2657 global TFT_clear_warning_text_2nd_row 2871 global TFT_clear_warning_text_2nd_row
2658 TFT_clear_warning_text_2nd_row: 2872 TFT_clear_warning_text_2nd_row:
2659 btfss divemode ; in divemode? 2873 btfss divemode ; in divemode?
2660 bra TFT_clear_warning_text_2nd_2 ; No, setup for surface mode 2874 bra TFT_clear_warning_text_2nd_2 ; No, setup for surface mode
2661 WIN_BOX_BLACK warning2_row, divemode_customview_row-3, warning2_column, warning_icon_column-3 ;top, bottom, left, right 2875 WIN_BOX_BLACK dm_warning2_row, dm_warning2_bot, dm_warning2_column, dm_warning2_rgt ;top, bottom, left, right
2662 return 2876 return
2663 TFT_clear_warning_text_2nd_2: 2877 TFT_clear_warning_text_2nd_2:
2664 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ;top, bottom, left, right 2878 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ;top, bottom, left, right
2665 return 2879 return
2666 2880
2735 rcall TFT_warning_set_window ; Sets the row and column for the current warning 2949 rcall TFT_warning_set_window ; Sets the row and column for the current warning
2736 tstfsz WREG ; Is there room for the warning? 2950 tstfsz WREG ; Is there room for the warning?
2737 return ; No 2951 return ; No
2738 call TFT_warnings_color 2952 call TFT_warnings_color
2739 STRCPY_TEXT tDiveaGF_active ; "aGF!" 2953 STRCPY_TEXT tDiveaGF_active ; "aGF!"
2740 movlw warning_length ; Divemode string length 2954 movlw dm_warning_length ; Divemode string length
2741 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 2955 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
2742 STRCAT_PRINT "" 2956 STRCAT_PRINT ""
2743 call TFT_standard_color 2957 call TFT_standard_color
2744 return 2958 return
2745 2959
2748 rcall TFT_warning_set_window ; Sets the row and column for the current warning 2962 rcall TFT_warning_set_window ; Sets the row and column for the current warning
2749 tstfsz WREG ; Is there room for the warning? 2963 tstfsz WREG ; Is there room for the warning?
2750 return ; No 2964 return ; No
2751 call TFT_warnings_color 2965 call TFT_warnings_color
2752 STRCPY_TEXT tDiveFallback ; "Fallback!" 2966 STRCPY_TEXT tDiveFallback ; "Fallback!"
2753 movlw warning_length ; Divemode string length 2967 movlw dm_warning_length ; Divemode string length
2754 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 2968 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
2755 STRCAT_PRINT "" 2969 STRCAT_PRINT ""
2756 call TFT_standard_color 2970 call TFT_standard_color
2757 return 2971 return
2758 2972
2765 STRCPY "GF:" 2979 STRCPY "GF:"
2766 movff char_O_gradient_factor,lo ; gradient factor 2980 movff char_O_gradient_factor,lo ; gradient factor
2767 bsf leftbind 2981 bsf leftbind
2768 output_8 2982 output_8
2769 PUTC "%" 2983 PUTC "%"
2770 movlw warning_length ; Divemode string length 2984 movlw dm_warning_length ; Divemode string length
2771 btfss divemode ; In Divemode? 2985 btfss divemode ; In Divemode?
2772 movlw surf_warning_length ; No, use surface string length 2986 movlw surf_warning_length ; No, use surface string length
2773 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 2987 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
2774 STRCAT_PRINT "" 2988 STRCAT_PRINT ""
2775 bcf leftbind 2989 bcf leftbind
2789 btfss divemode ; in divemode? 3003 btfss divemode ; in divemode?
2790 bra TFT_warning_set_window3 ; No, setup for surface mode 3004 bra TFT_warning_set_window3 ; No, setup for surface mode
2791 3005
2792 btfss warning_counter,0 ; Toggle with each warning 3006 btfss warning_counter,0 ; Toggle with each warning
2793 bra TFT_warning_set_window2 3007 bra TFT_warning_set_window2
2794 WIN_SMALL warning1_column,warning1_row 3008 WIN_SMALL dm_warning1_column, dm_warning1_row
2795 bcf second_row_warning ; =1: The second row contains a warning 3009 bcf second_row_warning ; =1: The second row contains a warning
2796 retlw .0 ; WREG=0 -> Warning window defined 3010 retlw .0 ; WREG=0 -> Warning window defined
2797 TFT_warning_set_window2: 3011 TFT_warning_set_window2:
2798 WIN_SMALL warning2_column,warning2_row 3012 WIN_SMALL dm_warning2_column, dm_warning2_row
2799 bsf second_row_warning ; =1: The second row contains a warning 3013 bsf second_row_warning ; =1: The second row contains a warning
2800 retlw .0 ; WREG=0 -> Warning window defined 3014 retlw .0 ; WREG=0 -> Warning window defined
2801 3015
2802 TFT_warning_set_window3: 3016 TFT_warning_set_window3:
2803 btfss warning_counter,0 ; Toggle with each warning 3017 btfss warning_counter,0 ; Toggle with each warning
2821 STRCPY "Batt:" 3035 STRCPY "Batt:"
2822 bsf leftbind 3036 bsf leftbind
2823 output_8 3037 output_8
2824 bcf leftbind 3038 bcf leftbind
2825 PUTC "%" 3039 PUTC "%"
2826 movlw warning_length ; Divemode string length 3040 movlw dm_warning_length ; Divemode string length
2827 btfss divemode ; In Divemode? 3041 btfss divemode ; In Divemode?
2828 movlw surf_warning_length ; No, use surface string length 3042 movlw surf_warning_length ; No, use surface string length
2829 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 3043 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
2830 STRCAT_PRINT "" 3044 STRCAT_PRINT ""
2831 call TFT_standard_color 3045 call TFT_standard_color
2834 3048
2835 global TFT_gf_mask ; Setup Mask 3049 global TFT_gf_mask ; Setup Mask
2836 TFT_gf_mask: 3050 TFT_gf_mask:
2837 ; The mask 3051 ; The mask
2838 call TFT_divemask_color 3052 call TFT_divemask_color
2839 WIN_TINY dive_gf_column1,dive_gf_text_row 3053 WIN_TINY dm_custom_gf_title_col1, dm_custom_gf_title_row
2840 STRCPY_TEXT_PRINT tGFactors 3054 STRCPY_TEXT_PRINT tGFactors
2841 WIN_TINY dive_gf_column2,dive_gf_text_row 3055 WIN_TINY dm_custom_gf_title_col2, dm_custom_gf_title_row
2842 STRCPY_TEXT_PRINT taGFactors 3056 STRCPY_TEXT_PRINT taGFactors
2843 WIN_TINY dive_gf_column3,dive_gf_text_row 3057 WIN_TINY dm_custom_gf_title_col3, dm_custom_gf_title_row
2844 STRCPY_TEXT_PRINT tGFInfo 3058 STRCPY_TEXT_PRINT tGFInfo
2845 3059
2846 ; Show GF (Static) 3060 ; Show GF (Static)
2847 call TFT_disabled_color 3061 call TFT_disabled_color
2848 btfss use_agf 3062 btfss use_agf
2849 call TFT_standard_color 3063 call TFT_standard_color
2850 3064
2851 WIN_STD dive_gf_column,dive_gf_row 3065 WIN_STD dm_custom_gf_column, dm_custom_gf_row
2852 bsf leftbind 3066 bsf leftbind
2853 movff opt_GF_low,lo 3067 movff opt_GF_low,lo
2854 output_8 3068 output_8
2855 PUTC "/" 3069 PUTC "/"
2856 movff opt_GF_high,lo 3070 movff opt_GF_high,lo
2862 bra TFT_gf_mask2 ; Show "---" instead 3076 bra TFT_gf_mask2 ; Show "---" instead
2863 3077
2864 btfss use_agf 3078 btfss use_agf
2865 call TFT_disabled_color 3079 call TFT_disabled_color
2866 3080
2867 WIN_STD dive_agf_column,dive_agf_row 3081 WIN_STD dm_custom_agf_column, dm_custom_agf_row
2868 movff opt_aGF_low,lo 3082 movff opt_aGF_low,lo
2869 output_8 3083 output_8
2870 PUTC "/" 3084 PUTC "/"
2871 movff opt_aGF_high,lo 3085 movff opt_aGF_high,lo
2872 output_8 3086 output_8
2874 bcf leftbind 3088 bcf leftbind
2875 call TFT_standard_color 3089 call TFT_standard_color
2876 return 3090 return
2877 3091
2878 TFT_gf_mask2: 3092 TFT_gf_mask2:
2879 WIN_STD dive_agf_column+.10,dive_agf_row 3093 WIN_STD dm_custom_agf_column+.10, dm_custom_agf_row
2880 STRCPY_PRINT "---" 3094 STRCPY_PRINT "---"
2881 bcf leftbind 3095 bcf leftbind
2882 return 3096 return
2883 3097
2884 global TFT_gf_info ; Show GF informations 3098 global TFT_gf_info ; Show GF informations
2886 ; Show current GF 3100 ; Show current GF
2887 movff char_O_gradient_factor,lo ; gradient factor absolute (Non-GF model) 3101 movff char_O_gradient_factor,lo ; gradient factor absolute (Non-GF model)
2888 movff char_I_deco_model,hi 3102 movff char_I_deco_model,hi
2889 decfsz hi,F ; jump over next line if char_I_deco_model == 1 3103 decfsz hi,F ; jump over next line if char_I_deco_model == 1
2890 movff char_O_relative_gradient_GF,lo ; gradient factor relative (GF model) 3104 movff char_O_relative_gradient_GF,lo ; gradient factor relative (GF model)
2891 WIN_STD dive_currentgf_column,dive_currentgf_row 3105 WIN_STD dm_custom_currentgf_column, dm_custom_currentgf_row
2892 output_8 3106 output_8
2893 STRCAT_PRINT "%" 3107 STRCAT_PRINT "%"
2894 return 3108 return
2895 3109
2896 global TFT_ead_end_tissues_clock_mask ; Setup Mask 3110 global TFT_ead_end_tissues_clock_mask ; Setup Mask
2900 btfsc FLAG_apnoe_mode ; In Apnoe mode? 3114 btfsc FLAG_apnoe_mode ; In Apnoe mode?
2901 bra TFT_ead_end_tissues_clock_mask2 ; Yes 3115 bra TFT_ead_end_tissues_clock_mask2 ; Yes
2902 btfsc FLAG_gauge_mode ; In Gauge mode? 3116 btfsc FLAG_gauge_mode ; In Gauge mode?
2903 bra TFT_ead_end_tissues_clock_mask2 ; Yes 3117 bra TFT_ead_end_tissues_clock_mask2 ; Yes
2904 ; Put three columns at HUD positions 3118 ; Put three columns at HUD positions
2905 WIN_TINY dive_custom_hud_column2,dive_custom_hud_row 3119 WIN_TINY dm_custom_ead_column, dm_custom_eadend_title_row
2906 STRCPY_TEXT_PRINT tDiveEAD_END 3120 STRCPY_TEXT_PRINT tDiveEAD_END
2907 WIN_TINY dive_custom_hud_column3,dive_custom_hud_row 3121 WIN_TINY dm_custom_tissue_title_column, dm_custom_tissue_title_row
2908 STRCPY_TEXT_PRINT tDiveTissues 3122 STRCPY_TEXT_PRINT tDiveTissues
2909 TFT_ead_end_tissues_clock_mask2: ; Show only clock 3123 TFT_ead_end_tissues_clock_mask2: ; Show only clock
2910 WIN_TINY dive_custom_hud_column1,dive_custom_hud_row 3124 WIN_TINY dm_custom_clock_column, dm_custom_clock_title_row
2911 STRCPY_TEXT_PRINT tDiveClock 3125 STRCPY_TEXT_PRINT tDiveClock
2912 call TFT_standard_color 3126 call TFT_standard_color
2913 return 3127 return
2914 3128
2915 global TFT_ead_end_tissues_clock ; Show EAD/END, Tissues and clock 3129 global TFT_ead_end_tissues_clock ; Show EAD/END, Tissues and clock
2916 TFT_ead_end_tissues_clock: 3130 TFT_ead_end_tissues_clock:
2917 ; Update clock and date 3131 ; Update clock and date
2918 WIN_SMALL dive_clock_column,dive_clock_row 3132 WIN_SMALL dm_custom_clock_column, dm_custom_clock_row
2919 call TFT_clock2 ; print clock 3133 call TFT_clock2 ; print clock
2920 3134
2921 btfsc FLAG_apnoe_mode ; In Apnoe mode? 3135 btfsc FLAG_apnoe_mode ; In Apnoe mode?
2922 return ; Yes, done. 3136 return ; Yes, done.
2923 btfsc FLAG_gauge_mode ; In Gauge mode? 3137 btfsc FLAG_gauge_mode ; In Gauge mode?
2958 ;TFT_ead_end_tissues_clock2: 3172 ;TFT_ead_end_tissues_clock2:
2959 ; STRCPY_PRINT " " 3173 ; STRCPY_PRINT " "
2960 ;TFT_ead_end_tissues_clock3: 3174 ;TFT_ead_end_tissues_clock3:
2961 3175
2962 ; Show END/EAD 3176 ; Show END/EAD
2963 WIN_SMALL dive_ead_column,dive_ead_row 3177 WIN_SMALL dm_custom_ead_column, dm_custom_ead_row
2964 STRCPY_TEXT tEAD ; EAD: 3178 STRCPY_TEXT tEAD ; EAD:
2965 movff char_O_EAD,lo 3179 movff char_O_EAD,lo
2966 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars 3180 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars
2967 WIN_SMALL dive_end_column,dive_end_row 3181 WIN_SMALL dm_custom_end_column, dm_custom_end_row
2968 STRCPY_TEXT tEND ; END: 3182 STRCPY_TEXT tEND ; END:
2969 movff char_O_END,lo 3183 movff char_O_END,lo
2970 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars 3184 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars
2971 3185
2972 ; Show tissue diagram 3186 ; Show tissue diagram
2973 call TFT_divemask_color 3187 call TFT_divemask_color
2974 WIN_TINY dive_tissue_N2_column,dive_tissue_N2_row 3188 WIN_TINY dm_custom_tissue_N2_column, dm_custom_tissue_N2_row
2975 STRCPY_TEXT_PRINT tN2 3189 STRCPY_TEXT_PRINT tN2
2976 WIN_TINY dive_tissue_He_column,dive_tissue_He_row 3190 WIN_TINY dm_custom_tissue_He_column, dm_custom_tissue_He_row
2977 STRCPY_TEXT_PRINT tHe 3191 STRCPY_TEXT_PRINT tHe
2978 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) 3192 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation)
2979 movlb b'00000001' ; select ram bank 1 3193 movlb b'00000001' ; select ram bank 1
2980 rcall DISP_tissue_saturation_graph ; Show char_O_tissue_N2_saturation and char_O_tissue_He_saturation 3194 rcall DISP_tissue_saturation_graph ; Show char_O_tissue_N2_saturation and char_O_tissue_He_saturation
2981 return 3195 return
3030 3244
3031 movlw .1 3245 movlw .1
3032 movff WREG,win_height ; row bottom (0-239) 3246 movff WREG,win_height ; row bottom (0-239)
3033 movlw surf_tissue_diagram_left+.4 ; Surface mode 3247 movlw surf_tissue_diagram_left+.4 ; Surface mode
3034 movff WREG,win_leftx2 ; column left (0-159) 3248 movff WREG,win_leftx2 ; column left (0-159)
3035 movlw surf_tissue_diagram_right-surf_tissue_diagram_left-4 ; Width 3249 movlw surf_tissue_diagram_right - surf_tissue_diagram_left - .4 ; Width
3036 movff WREG,win_width 3250 movff WREG,win_width
3037 3251
3038 ;---- Draw N2 Tissues 3252 ;---- Draw N2 Tissues
3039 lfsr FSR2, char_O_tissue_N2_saturation 3253 lfsr FSR2, char_O_tissue_N2_saturation
3040 movlw d'16' 3254 movlw d'16'
3082 ;============================================================================= 3296 ;=============================================================================
3083 ; Draw saturation graph, is surface mode or in dive mode. 3297 ; Draw saturation graph, is surface mode or in dive mode.
3084 DISP_tissue_saturation_graph: 3298 DISP_tissue_saturation_graph:
3085 ;---- Draw Frame 3299 ;---- Draw Frame
3086 call TFT_standard_color 3300 call TFT_standard_color
3087 WIN_FRAME_COLOR16 tissue_diagram_top, tissue_diagram_bottom, tissue_diagram_left, .159 ; outer frame 3301 WIN_FRAME_COLOR16 dm_custom_tissue_diagram_top, dm_custom_tissue_diagram_bottom, dm_custom_tissue_diagram_left, .159 ; outer frame
3088 3302
3089 movlw .1 3303 movlw .1
3090 movff WREG,win_height ; row bottom (0-239) 3304 movff WREG,win_height ; row bottom (0-239)
3091 movlw tissue_diagram_left+.3 ; divemode 3305 movlw dm_custom_tissue_diagram_left+.3 ; divemode
3092 movff WREG,win_leftx2 ; column left (0-159) 3306 movff WREG,win_leftx2 ; column left (0-159)
3093 movlw .159-tissue_diagram_left-4 ; Width 3307 movlw .159-dm_custom_tissue_diagram_left-.4 ; Width
3094 movff WREG,win_width 3308 movff WREG,win_width
3095 3309
3096 ;---- Draw N2 Tissues 3310 ;---- Draw N2 Tissues
3097 lfsr FSR2, char_O_tissue_N2_saturation 3311 lfsr FSR2, char_O_tissue_N2_saturation
3098 movlw d'16' 3312 movlw d'16'
3099 movwf wait_temp ; 16 tissues 3313 movwf wait_temp ; 16 tissues
3100 clrf waitms_temp ; Row offset 3314 clrf waitms_temp ; Row offset
3101 tissue_saturation_graph_N2: 3315 tissue_saturation_graph_N2:
3102 movlw tissue_diagram_top+3 ; divemode 3316 movlw dm_custom_tissue_diagram_top+.3 ; divemode
3103 addwf waitms_temp,W 3317 addwf waitms_temp,W
3104 movff WREG,win_top ; row top (0-239) 3318 movff WREG,win_top ; row top (0-239)
3105 rcall tissue_saturation_graph_loop ; Show one tissue 3319 rcall tissue_saturation_graph_loop ; Show one tissue
3106 decfsz wait_temp,F 3320 decfsz wait_temp,F
3107 bra tissue_saturation_graph_N2 3321 bra tissue_saturation_graph_N2
3110 lfsr FSR2, char_O_tissue_He_saturation 3324 lfsr FSR2, char_O_tissue_He_saturation
3111 movlw d'16' 3325 movlw d'16'
3112 movwf wait_temp ; 16 tissues 3326 movwf wait_temp ; 16 tissues
3113 clrf waitms_temp ; Row offset 3327 clrf waitms_temp ; Row offset
3114 tissue_saturation_graph_He: 3328 tissue_saturation_graph_He:
3115 movlw tissue_diagram_top+3+.22 ; divemode 3329 movlw dm_custom_tissue_diagram_top+.3+.22 ; divemode
3116 addwf waitms_temp,W 3330 addwf waitms_temp,W
3117 movff WREG,win_top ; row top (0-239) 3331 movff WREG,win_top ; row top (0-239)
3118 3332
3119 rcall tissue_saturation_graph_loop ; Show one tissue 3333 rcall tissue_saturation_graph_loop ; Show one tissue
3120 3334
3152 movff int_O_CNS_fraction+1,hi 3366 movff int_O_CNS_fraction+1,hi
3153 bsf leftbind 3367 bsf leftbind
3154 output_16_3 ;Displays only 0...999 3368 output_16_3 ;Displays only 0...999
3155 bcf leftbind 3369 bcf leftbind
3156 PUTC "%" 3370 PUTC "%"
3157 movlw warning_length ; Divemode string length 3371 movlw dm_warning_length ; Divemode string length
3158 btfss divemode ; In Divemode? 3372 btfss divemode ; In Divemode?
3159 movlw surf_warning_length ; No, use surface string length 3373 movlw surf_warning_length ; No, use surface string length
3160 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 3374 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
3161 STRCAT_PRINT "" 3375 STRCAT_PRINT ""
3162 call TFT_standard_color 3376 call TFT_standard_color
3175 movff xC+0,lo 3389 movff xC+0,lo
3176 movff xC+1,hi 3390 movff xC+1,hi
3177 bsf ignore_digit4 3391 bsf ignore_digit4
3178 output_16dp d'1' 3392 output_16dp d'1'
3179 TFT_show_ppO2_2: 3393 TFT_show_ppO2_2:
3180 movlw warning_length ; Divemode string length 3394 movlw dm_warning_length ; Divemode string length
3181 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 3395 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
3182 STRCAT_PRINT "" 3396 STRCAT_PRINT ""
3183 call TFT_standard_color 3397 call TFT_standard_color
3184 return 3398 return
3185 3399