comparison src/tft_outputs.asm @ 307:14719662fb95 new_screen_layout

Merged Screen layout work #4 into VSItextv2
author Janos Kovacs <kovjanos@gmail.com>
date Tue, 02 Jun 2015 23:38:21 +0100
parents 9b1b0b32e7d5
children efb53af0d62a
comparison
equal deleted inserted replaced
306:e9d058f20097 307:14719662fb95
154 dcfsnz WREG 154 dcfsnz WREG
155 bra TFT_color_code_gf ; color_code_gf_warn_high [%] 155 bra TFT_color_code_gf ; color_code_gf_warn_high [%]
156 dcfsnz WREG 156 dcfsnz WREG
157 bra TFT_color_code_ppo2 ; Color-code the OC ppO2 results [cbar], opt_ppO2_max as threshold 157 bra TFT_color_code_ppo2 ; Color-code the OC ppO2 results [cbar], opt_ppO2_max as threshold
158 dcfsnz WREG 158 dcfsnz WREG
159 bra TFT_color_code_velocity ; color_code_velocity_warn_high [m/min]
160 dcfsnz WREG
161 bra TFT_color_code_ceiling ; Show warning if current depth>shown ceiling 159 bra TFT_color_code_ceiling ; Show warning if current depth>shown ceiling
162 dcfsnz WREG 160 dcfsnz WREG
163 bra TFT_color_code_gaslist ; Color-code current row in Gaslist (%O2 in hi), opt_ppO2_max as threshold 161 bra TFT_color_code_gaslist ; Color-code current row in Gaslist (%O2 in hi), opt_ppO2_max as threshold
164 dcfsnz WREG 162 dcfsnz WREG
165 bra TFT_color_code_ppo2_hud ; Color-code the hud ppO2 readings [cbar], opt_ppO2_max as threshold 163 bra TFT_color_code_ppo2_hud ; Color-code the hud ppO2 readings [cbar], opt_ppO2_max as threshold
238 movff lo,sub_b+0 236 movff lo,sub_b+0
239 movff hi,sub_b+1 237 movff hi,sub_b+1
240 movff hi_temp,hi 238 movff hi_temp,hi
241 movff lo_temp,lo ; Restore hi, lo 239 movff lo_temp,lo ; Restore hi, lo
242 240
243 TSTOSS opt_depthblink ; 0=standard, 1=blink 241 TSTOSS opt_modwarning ; 0=standard, 1=blink
244 bra TFT_color_code_depth_std 242 bra TFT_color_code_depth_std
245 ;TFT_color_code_depth_blink: 243 ;TFT_color_code_depth_blink:
246 call subU16 ; sub_c = sub_a - sub_b 244 call subU16 ; sub_c = sub_a - sub_b
247 btfss neg_flag 245 btfss neg_flag
248 bra TFT_color_code_depth_warn ; Set to warning color 246 bra TFT_color_code_depth_warn ; Set to warning color
355 movff PRODL,sub_b+0 353 movff PRODL,sub_b+0
356 movff PRODH,sub_b+1 354 movff PRODH,sub_b+1
357 call subU16 ; sub_c = sub_a - sub_b 355 call subU16 ; sub_c = sub_a - sub_b
358 btfsc neg_flag 356 btfsc neg_flag
359 bra TFT_warnings_color ; Set to warning color 357 bra TFT_warnings_color ; Set to warning color
360 call TFT_standard_color
361 return
362
363 TFT_color_code_velocity:
364 btfss neg_flag ; Ignore for descent!
365 bra TFT_color_code_velocity1 ; Skip check!
366 movff divA+0,lo
367 movlw color_code_velocity_warn_high ; Velocity warn [m/min]
368 subwf lo,W
369 btfsc STATUS,C
370 bra TFT_warnings_color ; Set to warning color
371 TFT_color_code_velocity1:
372 call TFT_standard_color 358 call TFT_standard_color
373 return 359 return
374 360
375 TFT_color_code_ppo2_hud: ; With ppO2 [cbar] in lo 361 TFT_color_code_ppo2_hud: ; With ppO2 [cbar] in lo
376 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode 362 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode
556 global TFT_clear_customview_divemode 542 global TFT_clear_customview_divemode
557 TFT_clear_customview_divemode: 543 TFT_clear_customview_divemode:
558 WIN_BOX_BLACK dm_customview_row, dm_customview_bot, dm_customview_column, dm_customview_rgt ; top, bottom, left, right 544 WIN_BOX_BLACK dm_customview_row, dm_customview_bot, dm_customview_column, dm_customview_rgt ; top, bottom, left, right
559 return 545 return
560 546
547 ;=========================================================================
548
561 global TFT_display_velocity 549 global TFT_display_velocity
562 TFT_display_velocity: ; With divA+0 = m/min 550 TFT_display_velocity: ; With divA+0 = m/min
563 TFT_color_code warn_velocity ; Color-code Output (With divA+0 = m/min) 551
564 WIN_SMALL dm_velocity_text_column, dm_velocity_text_row 552 TSTOSS opt_vsitextv2 ; 0=standard, 1=dynamic
565 553 bra TFT_dispay_velocity_std
554
555 ; Input is:
556 ; neg_flag: ascend=1, descend=0
557 ; divA+0: rate in m/min
558
559 movlw velocity_display_threshold_2 ; lowest threshold for display vertical velocity
560 subwf divA+0,W
561 btfss STATUS,C
562 bra TFT_display_velocity_clear
563 bsf display_velocity
564
565 ; use a depth-dependent ascent rate warning
566 ; depth(ft): <20 >20 >40 >60 >75 >88 >101 >115 >128 >144 >164
567 ; speed(ft/min): 23 26 29 33 36 43 49 56 59 62 66
568 ; depth(m): <=6 >6 >12 >18 >23 >27 >31 >35 >39 >44 >50
569 ; speed(m/min): 7 8 9 10 11 13 15 17 18 19 20 (warning)
570 ; speed(m/min): 5 6 7 8 8 10 12 13 14 15 15 (attention)
571
572 bcf neg_flag_save
573 btfsc neg_flag
574 bsf neg_flag_save
575
576 ; no warning color if descending
577 call TFT_standard_color
578 btfss neg_flag ; Ignore for descent!
579 bra TFT_display_velocity_out
580
581 SAFE_2BYTE_COPY rel_pressure, lo ; get the actual depth
582 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
583 call convert_mbar_to_feet ; get depth in feet
584 ; xA will be used to store the warning/attention limits passed to the verification
585 clrf xA+0
586 clrf xA+1
587
588 ; store current depth (in feet) into sub_a
589 movff lo,sub_a+0
590 movff hi,sub_a+1
591
592 ;TFT_display_velocity_asc_164:
593 ; store segment limit into sub_b
594 clrf sub_b+1
595 movlw LOW d'164'
596 movwf sub_b+0
597 movlw .20 ; store the warn limit to xA+0
598 movwf xA+0
599 movlw .15 ; store the attn limit to xA+1
600 movwf xA+1
601 ; check if current depth > segment limit
602 call subU16 ; sub_c = sub_a - sub_b; depth - sLimit
603 btfss neg_flag ; depth lower than segment limit? sLimit>depth?
604 bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment
605
606 ;TFT_display_velocity_asc_144:
607 ; store segment limit into sub_b
608 clrf sub_b+1
609 movlw LOW d'144'
610 movwf sub_b+0
611 movlw .19 ; store the warn limit to xA+0
612 movwf xA+0
613 movlw .15 ; store the attn limit to xA+1
614 movwf xA+1
615 ; check if current depth > segment limit
616 call subU16 ; sub_c = sub_a - sub_b; depth - sLimit
617 btfss neg_flag ; depth lower than segment limit? sLimit>depth?
618 bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment
619
620 ;TFT_display_velocity_asc_128:
621 ; store segment limit into sub_b
622 clrf sub_b+1
623 movlw LOW d'128'
624 movwf sub_b+0
625 movlw .18 ; store the warn limit to xA+0
626 movwf xA+0
627 movlw .14 ; store the attn limit to xA+1
628 movwf xA+1
629 ; check if current depth > segment limit
630 call subU16 ; sub_c = sub_a - sub_b; depth - sLimit
631 btfss neg_flag ; depth lower than segment limit? sLimit>depth?
632 bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment
633
634 ;TFT_display_velocity_asc_115:
635 ; store segment limit into sub_b
636 clrf sub_b+1
637 movlw LOW d'115'
638 movwf sub_b+0
639 movlw .17 ; store the warn limit to xA+0
640 movwf xA+0
641 movlw .13 ; store the attn limit to xA+1
642 movwf xA+1
643 ; check if current depth > segment limit
644 call subU16 ; sub_c = sub_a - sub_b; depth - sLimit
645 btfss neg_flag ; depth lower than segment limit? sLimit>depth?
646 bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment
647
648 ;TFT_display_velocity_asc_101:
649 ; store segment limit into sub_b
650 clrf sub_b+1
651 movlw LOW d'101'
652 movwf sub_b+0
653 movlw .15 ; store the warn limit to xA+0
654 movwf xA+0
655 movlw .12 ; store the attn limit to xA+1
656 movwf xA+1
657 ; check if current depth > segment limit
658 call subU16 ; sub_c = sub_a - sub_b; depth - sLimit
659 btfss neg_flag ; depth lower than segment limit? sLimit>depth?
660 bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment
661
662 ;TFT_display_velocity_asc_88:
663 ; store segment limit into sub_b
664 clrf sub_b+1
665 movlw LOW d'88'
666 movwf sub_b+0
667 movlw .13 ; store the warn limit to xA+0
668 movwf xA+0
669 movlw .10 ; store the attn limit to xA+1
670 movwf xA+1
671 ; check if current depth > segment limit
672 call subU16 ; sub_c = sub_a - sub_b; depth - sLimit
673 btfss neg_flag ; depth lower than segment limit? sLimit>depth?
674 bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment
675
676 ;TFT_display_velocity_asc_75:
677 ; store segment limit into sub_b
678 clrf sub_b+1
679 movlw LOW d'75'
680 movwf sub_b+0
681 movlw .11 ; store the warn limit to xA+0
682 movwf xA+0
683 movlw .8 ; store the attn limit to xA+1
684 movwf xA+1
685 ; check if current depth > segment limit
686 call subU16 ; sub_c = sub_a - sub_b; depth - sLimit
687 btfss neg_flag ; depth lower than segment limit? sLimit>depth?
688 bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment
689
690 ;TFT_display_velocity_asc_60:
691 ; store segment limit into sub_b
692 clrf sub_b+1
693 movlw LOW d'60'
694 movwf sub_b+0
695 movlw .10 ; store the warn limit to xA+0
696 movwf xA+0
697 movlw .8 ; store the attn limit to xA+1
698 movwf xA+1
699 ; check if current depth > segment limit
700 call subU16 ; sub_c = sub_a - sub_b; depth - sLimit
701 btfss neg_flag ; depth lower than segment limit? sLimit>depth?
702 bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment
703
704 ;TFT_display_velocity_asc_40:
705 ; store segment limit into sub_b
706 clrf sub_b+1
707 movlw LOW d'40'
708 movwf sub_b+0
709 movlw .9 ; store the warn limit to xA+0
710 movwf xA+0
711 movlw .7 ; store the attn limit to xA+1
712 movwf xA+1
713 ; check if current depth > segment limit
714 call subU16 ; sub_c = sub_a - sub_b; depth - sLimit
715 btfss neg_flag ; depth lower than segment limit? sLimit>depth?
716 bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment
717
718 ;TFT_display_velocity_asc_20:
719 ; store segment limit into sub_b
720 clrf sub_b+1
721 movlw LOW d'20'
722 movwf sub_b+0
723 movlw .8 ; store the warn limit to xA+0
724 movwf xA+0
725 movlw .6 ; store the attn limit to xA+1
726 movwf xA+1
727 ; check if current depth > segment limit
728 call subU16 ; sub_c = sub_a - sub_b; depth - sLimit
729 btfss neg_flag ; depth lower than segment limit? sLimit>depth?
730 bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment
731
732 ;TFT_display_velocity_asc_n6:
733 ; no more steps, check the smallest rate
734 ; store the warn limit to xA : <20ft=23; <6m=7
735 movlw .7
736 movwf xA+0
737 movlw .5
738 movwf xA+1
739 ;bra TFT_velocity_check ; depth < 20ft / 6m
740
741 TFT_velocity_check:
742 ; move current ascent rate to lo
743 clrf hi
744 movff divA+0,lo
745 ; Velocity warn [m/min] - we receive it from xA+0
746 movff xA+0,WREG
747 ; compare the values
748 subwf lo,W ; subtract W from lo,
749 btfsc STATUS,C ; Check if C (carry flag) is set. Cleared if the larger number is subtracted from smaller one
750 bra TFT_velocity_warn ; Skip if no carry flag otherwise set to warning color
751 ; not eq or gt warning trashold, lets check if it reach the attention level
752 ; Velocity attn [m/min] - we receive it from xA+1
753 movff xA+1,WREG
754 ; compare the values
755 subwf lo,W ; subtract W from lo,
756 btfsc STATUS,C ; Check if C (carry flag) is set. Cleared if the larger number is subtracted from smaller one
757 bra TFT_velocity_attn ; Skip if no carry flag otherwise set to warning color
758 ;bra TFT_velocity_def
759
760 TFT_velocity_def:
761 call TFT_standard_color
762 bra TFT_display_velocity_out
763
764 TFT_velocity_warn:
765 call TFT_warnings_color ; Set to warning color
766 bsf win_invert
767 bra TFT_display_velocity_out
768
769 TFT_velocity_attn:
770 call TFT_attention_color ; Set to attention color
771 ;bra TFT_display_velocity_out
772
773 TFT_display_velocity_out:
774 ; retain neg_flag value - restore
775 bcf neg_flag
776 btfsc neg_flag_save
777 bsf neg_flag
778 bra TFT_dispay_velocity_disp
779
780 TFT_dispay_velocity_std:
781 movlw velocity_display_threshold_1 ; lowest threshold for display vertical velocity
782 subwf divA+0,W
783 btfss STATUS,C
784 bra TFT_display_velocity_clear
785 bsf display_velocity
786
787 call TFT_standard_color
788 btfss neg_flag ; Ignore for descent!
789 bra TFT_dispay_velocity_disp ; Skip check!
790 movff divA+0,lo
791 movlw color_code_velocity_warn_high ; Velocity warn [m/min]
792 subwf lo,W
793 btfsc STATUS,C
794 call TFT_warnings_color ; Set to warning color
795
796 TFT_dispay_velocity_disp:
797 WIN_SMALL dm_velocity_text_column, dm_velocity_text_row
566 TSTOSS opt_units ; 0=Meters, 1=Feets 798 TSTOSS opt_units ; 0=Meters, 1=Feets
567 bra TFT_display_velocity_metric 799 bra TFT_display_velocity_metric
568 ;TFT_display_velocity_imperial: 800 ;TFT_display_velocity_imperial:
569 movff divA+0,WREG ; divA+0 = m/min 801 movff divA+0,WREG ; divA+0 = m/min
570 mullw .100 ; PRODL:PRODH = mbar/min 802 mullw .100 ; PRODL:PRODH = mbar/min
578 bsf leftbind 810 bsf leftbind
579 output_16 811 output_16
580 bcf leftbind 812 bcf leftbind
581 STRCAT_TEXT_PRINT tVelImperial ; Unit switch 813 STRCAT_TEXT_PRINT tVelImperial ; Unit switch
582 call TFT_standard_color 814 call TFT_standard_color
815 bcf win_invert
583 return 816 return
584 817
585 TFT_display_velocity_metric: 818 TFT_display_velocity_metric:
586 movff divA+0,lo ; divA+0 = m/min 819 movff divA+0,lo ; divA+0 = m/min
587 movlw '-' 820 movlw '-'
589 movlw '+' 822 movlw '+'
590 movwf POSTINC2 823 movwf POSTINC2
591 output_99 824 output_99
592 STRCAT_TEXT_PRINT tVelMetric ; Unit switch 825 STRCAT_TEXT_PRINT tVelMetric ; Unit switch
593 call TFT_standard_color 826 call TFT_standard_color
827 bcf win_invert
594 return 828 return
595 829
596 global TFT_display_velocity_clear 830 global TFT_display_velocity_clear
597 TFT_display_velocity_clear: 831 TFT_display_velocity_clear:
832 btfss display_velocity ; Velocity was not displayed, do not delete
833 return
834 bcf display_velocity ; Velocity was displayed, delete velocity now
598 ; Clear Text 835 ; Clear Text
599 WIN_BOX_BLACK dm_velocity_text_row, dm_velocity_text_bot, dm_velocity_text_column, dm_velocity_text_rgt ; top, bottom, left, right 836 WIN_BOX_BLACK dm_velocity_text_row, dm_velocity_text_bot, dm_velocity_text_column, dm_velocity_text_rgt ; top, bottom, left, right
600 return 837 return
838
839 ;=========================================================================
601 840
602 global TFT_clear_decoarea 841 global TFT_clear_decoarea
603 TFT_clear_decoarea: 842 TFT_clear_decoarea:
604 WIN_BOX_BLACK dm_decostop_1st_stop_row, .239, dm_decostop_1st_stop_column, .159 ; top, bottom, left, right 843 WIN_BOX_BLACK dm_decostop_1st_stop_row, .239, dm_decostop_1st_stop_column, .159 ; top, bottom, left, right
605 return 844 return
2037 WIN_BOX_BLACK dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right 2276 WIN_BOX_BLACK dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right
2038 bsf depth_greater_100m ; Set Flag 2277 bsf depth_greater_100m ; Set Flag
2039 return 2278 return
2040 2279
2041 TFT_depth_blink: 2280 TFT_depth_blink:
2042 TSTOSS opt_depthblink ; 0=standard, 1=blink 2281 TSTOSS opt_modwarning ; 0=standard, 1=blink
2043 return 2282 return
2044 2283
2045 ; check if previous cycle had the blinking warning or not 2284 ; check if previous cycle had the blinking warning or not
2046 btfsc blinking_depth_prev ; did we have warning prev? 2285 btfsc blinking_depth_prev ; did we have warning prev?
2047 bra TFT_depth_blink_prevwarn ; Yes 2286 bra TFT_depth_blink_prevwarn ; Yes