comparison code_part1/OSTC_code_asm_part1/menu_gassetup.asm @ 297:ceedf078b2d8

Gas Setup page 2 reworked, Texts 107, 108, 109,150, 149, 168, 42, 43, 53,54,55, 165 need update in french, spanish and german
author Heinrichsweikamp
date Fri, 29 Apr 2011 20:17:32 +0200
parents 4dbff2aa31ee
children eac799f69360
comparison
equal deleted inserted replaced
296:2986e7cdb68c 297:ceedf078b2d8
641 641
642 next_gas_page: 642 next_gas_page:
643 call PLED_ClearScreen 643 call PLED_ClearScreen
644 movlw d'1' 644 movlw d'1'
645 movwf menupos 645 movwf menupos
646 DISPLAYTEXT .109 ; Back 646 bcf first_FA ; Here: =1: -, =0: +
647 647 bcf second_FA ; Here: =1: Is first gas
648 DISPLAYTEXT .107 ; Depth +/-
649 DISPLAYTEXT .108 ; Change:
650 DISPLAYTEXT .109 ; Default:
648 DISPLAYTEXT .11 ; Exit 651 DISPLAYTEXT .11 ; Exit
649 652
650 next_gas_page1: 653 next_gas_page1:
651 clrf timeout_counter2 654 clrf timeout_counter2
652 bcf menubit2 655 bcf menubit2
653 bcf menubit3 656 bcf menubit3
654 657
658 WIN_TOP .65
659 WIN_LEFT .20
660 lfsr FSR2,letter
661 OUTPUTTEXT .88 ; First Gas?
662 PUTC ' '
663
664 movlw d'33'
665 movwf EEADR
666 call read_eeprom ; Get current startgas 1-5 # into EEDATA
667 decf EEDATA,W ; 0-4
668 cpfseq decodata+0 ; =current displayed gas #?
669 bra menu_firstgas0 ; no, display three spaces
670
671 OUTPUTTEXT .96 ; Yes
672 bsf second_FA ; Is first gas
673
674 movf decodata+0,W ; read current value
675 addlw d'28' ; offset in memory
676 movwf EEADR
677 call read_eeprom ; Low-value
678 clrf EEDATA ; Set change depth to zero
679 call write_eeprom ; save result in EEPROM
680
681 bra menu_firstgas1
682
683 menu_firstgas0:
684 bcf second_FA ; Is not first gas
685 STRCAT " " ; 3 spaces.
686
687 menu_firstgas1:
688 call word_processor
689
690
655 rcall gassetup_title_bar2 ; Displays the title bar with the current Gas info 691 rcall gassetup_title_bar2 ; Displays the title bar with the current Gas info
692 WIN_TOP .125
693 WIN_LEFT .70
694 lfsr FSR2,letter
695 ; lo still holds change depth
696 bsf leftbind
697 output_8
698 STRCAT_PRINT "m "
699
700 WIN_TOP .125
701 WIN_LEFT .100
702 lfsr FSR2,letter
703
656 rcall gassetup_show_ppO2 ; Display the ppO2 of the change depth with the current gas 704 rcall gassetup_show_ppO2 ; Display the ppO2 of the change depth with the current gas
657 705
658 WIN_TOP .65 706 movff xC+0,sub_a+0
707 movff xC+1,sub_a+1
708 GETCUSTOM8 d'46' ; color-code ppO2 warning [cBar]
709 mullw d'1' ; ppo2_warning_high*1
710 movff PRODL,sub_b+0
711 movff PRODH,sub_b+1
712 call sub16 ; sub_c = sub_a - sub_b
713 btfss neg_flag
714 bra gassetup_color_code_ppo2_1; too high -> Warning Color!
715 call PLED_standard_color
716 bra gassetup_color_code_ppo2_2
717 gassetup_color_code_ppo2_1:
718 call PLED_warnings_color
719 gassetup_color_code_ppo2_2:
720 call word_processor
721 call PLED_standard_color
722
723 WIN_TOP .95
724 WIN_LEFT .95
725 lfsr FSR2,letter
726 movlw '+'
727 btfsc first_FA
728 movlw '-'
729 movwf POSTINC2
730 call word_processor
731
732 ; Show MOD as "default"
733 WIN_TOP .155
734 WIN_LEFT .78
735 lfsr FSR2, letter
736 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG
737 mullw d'10'
738 movff PRODL,xA+0
739 movff PRODH,xA+1 ; ppO2 in [0.01Bar] * 10
740
741 movf divemins+0,W
742 addlw 0x06
743 movwf EEADR
744 call read_eeprom ; O2 value
745 movff EEDATA,xB+0
746 clrf xB+1
747 call div16x16 ; xA/xB=xC with xA as remainder
748 movlw d'10'
749 subwf xC+0,F ; Subtract 10m...
750 movff xC+0,lo
751 movlw d'0'
752 subwfb xC+1,F
753 movff xC+1,hi
754
755 btfsc second_FA ; Is first gas?
756 clrf lo ; Yes, display 0m
757 btfsc second_FA ; Is first gas?
758 clrf hi ; Yes, display 0m
759
760 output_16
761 STRCAT_PRINT "m "
762
763 WIN_TOP .35
659 WIN_LEFT .20 764 WIN_LEFT .20
660 lfsr FSR2,letter 765 lfsr FSR2,letter
661 OUTPUTTEXT .105 ; "Active Gas? " 766 OUTPUTTEXT .105 ; "Active Gas? "
662 767
663 ; Active gas flags in BIT0:4 .... 768 ; Active gas flags in BIT0:4 ....
680 STRCAT " " ; three spaces instead of "Yes" 785 STRCAT " " ; three spaces instead of "Yes"
681 786
682 active_gas_display_end: 787 active_gas_display_end:
683 call word_processor 788 call word_processor
684 789
685 WIN_TOP .95
686 WIN_LEFT .20
687 lfsr FSR2,letter
688 OUTPUTTEXT .88 ; First Gas?
689 PUTC ' '
690
691 movlw d'33'
692 movwf EEADR
693 call read_eeprom ; Get current startgas 1-5 # into EEDATA
694 decf EEDATA,W ; 0-4
695 cpfseq decodata+0 ; =current displayed gas #?
696 bra menu_firstgas0 ; no, display three spaces
697
698 OUTPUTTEXT .96 ; Yes
699 bra menu_firstgas1
700
701 menu_firstgas0:
702 STRCAT " " ; 3 spaces.
703
704 menu_firstgas1:
705 call word_processor
706
707 WIN_TOP .125
708 WIN_LEFT .20
709 lfsr FSR2,letter
710 OUTPUTTEXT .107 ; Change+
711 call word_processor
712
713 WIN_TOP .155
714 WIN_LEFT .20
715 lfsr FSR2,letter
716 OUTPUTTEXT .108 ; Change-
717 call word_processor
718
719 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! 790 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
720 call PLED_menu_cursor 791 call PLED_menu_cursor
721 792
722 next_gas_page_loop: 793 next_gas_page_loop:
723 call check_switches_logbook 794 call check_switches_logbook
762 bcf menubit3 ; clear flag 833 bcf menubit3 ; clear flag
763 bra next_gas_page_loop 834 bra next_gas_page_loop
764 835
765 do_next_gas_page: 836 do_next_gas_page:
766 dcfsnz menupos,F 837 dcfsnz menupos,F
838 bra toggle_active_gas
839 dcfsnz menupos,F
840 bra make_first_gas
841 dcfsnz menupos,F
842 bra change_gas_depth_plus_minus
843 dcfsnz menupos,F
844 bra change_gas_depth_apply
845 dcfsnz menupos,F
846 bra change_gas_depth_default
767 bra next_gas 847 bra next_gas
768 dcfsnz menupos,F
769 bra toggle_active_gas
770 dcfsnz menupos,F
771 bra make_first_gas
772 dcfsnz menupos,F
773 bra change_gas_depth_plus
774 dcfsnz menupos,F
775 bra change_gas_depth_minus
776 bra exit_gassetup ; Exit menu
777 848
778 make_first_gas: 849 make_first_gas:
779 movff decodata+0,EEDATA ; current gas (0-4) into EEDATA 850 movff decodata+0,EEDATA ; current gas (0-4) into EEDATA
780 incf EEDATA,F ; current gas (1-5) into EEDATA 851 incf EEDATA,F ; current gas (1-5) into EEDATA
781 movlw d'33' 852 movlw d'33'
796 bsf EEDATA,3 867 bsf EEDATA,3
797 dcfsnz lo,F 868 dcfsnz lo,F
798 bsf EEDATA,4 869 bsf EEDATA,4
799 write_int_eeprom d'27' ; write flag register 870 write_int_eeprom d'27' ; write flag register
800 871
801 movlw d'3' 872 movlw d'2'
802 movwf menupos 873 movwf menupos
803 bra next_gas_page1 874 bra next_gas_page1
804 875
805 toggle_active_gas: 876 toggle_active_gas:
806 read_int_eeprom d'27' ; read flag register 877 read_int_eeprom d'27' ; read flag register
815 dcfsnz lo,F 886 dcfsnz lo,F
816 btg EEDATA,3 887 btg EEDATA,3
817 dcfsnz lo,F 888 dcfsnz lo,F
818 btg EEDATA,4 889 btg EEDATA,4
819 write_int_eeprom d'27' ; write flag register 890 write_int_eeprom d'27' ; write flag register
820 movlw d'2' 891 movlw d'1'
821 movwf menupos 892 movwf menupos
822 bra next_gas_page1 893 bra next_gas_page1
823 894
824 change_gas_depth_plus: 895 change_gas_depth_apply: ; Apply +1 or -1m
825 movf decodata+0,W ; read current value 896 movf decodata+0,W ; read current value
826 addlw d'28' ; offset in memory 897 addlw d'28' ; offset in memory
827 movwf EEADR 898 movwf EEADR
828 call read_eeprom ; Low-value 899 call read_eeprom ; Low-value
829 movff EEDATA,lo 900 movff EEDATA,lo
830 901
902 btfsc first_FA ; Minus?
903 bra change_gas_depth_minus ; yes, minus!
904 ; +1m
905
831 incf lo,F ; increase depth 906 incf lo,F ; increase depth
832 movlw d'100' ; Change depth limit + 1 907 movlw d'100' ; Change depth limit + 1
833 cpfseq lo 908 cpfseq lo
834 bra change_gas_depth_plus2 909 bra change_gas_depth_plus2
835 movlw d'99' ; Change depth limit 910 movlw d'99' ; Change depth limit
840 915
841 movlw d'4' 916 movlw d'4'
842 movwf menupos 917 movwf menupos
843 bra next_gas_page1 918 bra next_gas_page1
844 919
845
846 change_gas_depth_minus: 920 change_gas_depth_minus:
921 decf lo,F ; decrease depth
922 btfss lo,7 ; 255?
923 bra change_gas_depth_plus2 ; no, exit
924 clrf lo
925 bra change_gas_depth_plus2 ; exit
926
927 change_gas_depth_plus_minus:
928 btg first_FA
929 movlw d'3'
930 movwf menupos
931 bra next_gas_page1
932
933 change_gas_depth_default:
934 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG
935 mullw d'10'
936 movff PRODL,xA+0
937 movff PRODH,xA+1 ; ppO2 in [0.01Bar] * 10
938
939 movf divemins+0,W
940 addlw 0x06
941 movwf EEADR
942 call read_eeprom ; O2 value
943 movff EEDATA,xB+0
944 clrf xB+1
945 call div16x16 ; xA/xB=xC with xA as remainder
946 movlw d'10'
947 subwf xC+0,F ; Subtract 10m...
948 movff xC+0,lo
949 movlw d'0'
950 subwfb xC+1,F
951 movff xC+1,hi
952
847 movf decodata+0,W ; read current value 953 movf decodata+0,W ; read current value
848 addlw d'28' ; offset in memory 954 addlw d'28' ; offset in memory
849 movwf EEADR 955 movwf EEADR
850 call read_eeprom ; Low-value 956 call read_eeprom ; Low-value
851 movff EEDATA,lo
852
853 decf lo,F ; decrease depth
854 movlw d'255'
855 cpfseq lo
856 bra change_gas_depth_minus2
857 movlw d'0'
858 movwf lo
859
860 change_gas_depth_minus2:
861 movff lo,EEDATA ; write result 957 movff lo,EEDATA ; write result
862 call write_eeprom ; save result in EEPROM 958 call write_eeprom ; save result in EEPROM
863 959
864 movlw d'5' 960 movlw d'5'
865 movwf menupos 961 movwf menupos
866 bra next_gas_page1 962 bra next_gas_page1
963
867 964
868 ; Changed v1.44se 965 ; Changed v1.44se
869 gassetup_title_bar2: 966 gassetup_title_bar2:
870 call PLED_topline_box 967 call PLED_topline_box
871 WIN_INVERT .1 ; Init new Wordprocessor 968 WIN_INVERT .1 ; Init new Wordprocessor
998 movwf xB+0 1095 movwf xB+0
999 clrf xB+1 1096 clrf xB+1
1000 call div16x16 ;xA/xB=xC with xA as remainder 1097 call div16x16 ;xA/xB=xC with xA as remainder
1001 movff xC+0,lo ; ((Depth+10m)*O2)/10 = [0.01Bar] ppO2 1098 movff xC+0,lo ; ((Depth+10m)*O2)/10 = [0.01Bar] ppO2
1002 movff xC+1,hi 1099 movff xC+1,hi
1003
1004 WIN_LEFT .55
1005 WIN_TOP .35
1006 lfsr FSR2,letter
1007 OUTPUTTEXT d'149' ; (ppO2:
1008 output_16dp d'3' 1100 output_16dp d'3'
1009 OUTPUTTEXT d'150' ; Bar: 1101 OUTPUTTEXT d'150' ; bar:
1010 call word_processor
1011 return 1102 return
1012 1103
1013 ;============================================================================= 1104 ;=============================================================================
1014 ; Make sure first gas is marked active. 1105 ; Make sure first gas is marked active.
1015 ; Note: - Gas are not soted anymore. 1106 ; Note: - Gas are not soted anymore.