comparison code_part1/OSTC_code_asm_part1/pled_outputs.asm @ 341:2144f19fa1eb

BUGFIX protect against ISR changing pressure/temperature while reading it.
author JeanDo
date Fri, 20 May 2011 00:48:30 +0200
parents ecbbbd423e86
children 06299199dfb9
comparison
equal deleted inserted replaced
340:ecbbbd423e86 341:2144f19fa1eb
103 bra PLED_color_code_gaslist ; Color-code current row in Gaslist (%O2 in "EEDATA") 103 bra PLED_color_code_gaslist ; Color-code current row in Gaslist (%O2 in "EEDATA")
104 104
105 105
106 PLED_color_code_gaslist: ; %O2 in "EEDATA" 106 PLED_color_code_gaslist: ; %O2 in "EEDATA"
107 ; Check very high ppO2 manually 107 ; Check very high ppO2 manually
108 movff amb_pressure+0,xA+0 108 SAFE_2BYTE_COPY amb_pressure,xA
109 movff amb_pressure+1,xA+1
110 movlw d'10' 109 movlw d'10'
111 movwf xB+0 110 movwf xB+0
112 clrf xB+1 111 clrf xB+1
113 call div16x16 ; xC=p_amb/10 112 call div16x16 ; xC=p_amb/10
114 movff xC+0,xA+0 113 movff xC+0,xA+0
141 movwf lo 140 movwf lo
142 movlw d'1' 141 movlw d'1'
143 cpfseq lo ; =1? 142 cpfseq lo ; =1?
144 bra PLED_color_code_ceiling1 ; No, Set to default color 143 bra PLED_color_code_ceiling1 ; No, Set to default color
145 144
146 movff rel_pressure+1,hi 145 SAFE_2BYTE_COPY rel_pressure, lo
147 movff rel_pressure+0,lo
148 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar] 146 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar]
149 movff hi,xA+1 147 movff hi,xA+1
150 movff lo,xA+0 148 movff lo,xA+0
151 movff char_O_first_deco_depth,lo ; Ceiling in m 149 movff char_O_first_deco_depth,lo ; Ceiling in m
152 decf lo,F ; -1 150 decf lo,F ; -1
166 return 164 return
167 165
168 PLED_color_code_depth: 166 PLED_color_code_depth:
169 movff hi,hi_temp 167 movff hi,hi_temp
170 movff lo,lo_temp 168 movff lo,lo_temp
171 movff rel_pressure+1,hi 169 SAFE_2BYTE_COPY rel_pressure, lo
172 movff rel_pressure+0,lo
173 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar] 170 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar]
174 movff lo,sub_a+0 171 movff lo,sub_a+0
175 movff hi,sub_a+1 172 movff hi,sub_a+1
176 GETCUSTOM15 d'43' ; Depth warn [mBar] 173 GETCUSTOM15 d'43' ; Depth warn [mBar]
177 movff lo,sub_b+0 174 movff lo,sub_b+0
837 call word_processor 834 call word_processor
838 835
839 WIN_LEFT .0 836 WIN_LEFT .0
840 WIN_TOP .177 837 WIN_TOP .177
841 STRCPY "amb:" 838 STRCPY "amb:"
842 movff amb_pressure+0,lo 839 SAFE_2BYTE_COPY amb_pressure, lo
843 movff amb_pressure+1,hi
844 output_16 840 output_16
845 call word_processor 841 call word_processor
846 WIN_LEFT .80 842 WIN_LEFT .80
847 WIN_TOP .177 843 WIN_TOP .177
848 STRCPY "temp:" 844 STRCPY "temp:"
849 movff temperature+0,lo 845 SAFE_2BYTE_COPY temperature, lo
850 movff temperature+1,hi
851 output_16 846 output_16
852 call word_processor 847 call word_processor
853 848
854 call get_battery_voltage ; get battery voltage 849 call get_battery_voltage ; get battery voltage
855 WIN_LEFT .0 850 WIN_LEFT .0
946 DISPLAYTEXT .11 ; Exit 941 DISPLAYTEXT .11 ; Exit
947 return 942 return
948 943
949 PLED_temp_surfmode: 944 PLED_temp_surfmode:
950 ostc_debug 'e' 945 ostc_debug 'e'
951 movff temperature+0,last_temperature+0 946 SAFE_2BYTE_COPY temperature, last_temperature
952 movff temperature+1,last_temperature+1
953 WIN_TOP .100 947 WIN_TOP .100
954 WIN_LEFT .1 948 WIN_LEFT .1
955 WIN_FONT FT_SMALL 949 WIN_FONT FT_SMALL
956 WIN_INVERT .0 ; Init new Wordprocessor 950 WIN_INVERT .0 ; Init new Wordprocessor
957 call PLED_standard_color 951 call PLED_standard_color
958 952
959 movff temperature+1,hi 953 movff last_temperature+1,hi
960 movff temperature+0,lo 954 movff last_temperature+0,lo
961 lfsr FSR2,letter 955 lfsr FSR2,letter
962 956
963 btfss hi,7 ; Negative temperature ? 957 btfss hi,7 ; Negative temperature ?
964 bra PLED_temp_surfmode_1 ; No: continue 958 bra PLED_temp_surfmode_1 ; No: continue
965 959
981 975
982 PLED_temp_divemode: 976 PLED_temp_divemode:
983 ostc_debug 'u' ; Sends debug-information to screen if debugmode active 977 ostc_debug 'u' ; Sends debug-information to screen if debugmode active
984 978
985 ; temperature 979 ; temperature
986 movff temperature+0,last_temperature+0 980 SAFE_2BYTE_COPY temperature, last_temperature
987 movff temperature+1,last_temperature+1
988 981
989 WIN_TOP .216 982 WIN_TOP .216
990 WIN_LEFT .50 983 WIN_LEFT .50
991 WIN_FONT FT_SMALL 984 WIN_FONT FT_SMALL
992 WIN_INVERT .0 ; Init new Wordprocessor 985 WIN_INVERT .0 ; Init new Wordprocessor
993 call PLED_standard_color 986 call PLED_standard_color
994 987
995 movff temperature+1,hi 988 movff last_temperature+1,hi
996 movff temperature+0,lo 989 movff last_temperature+0,lo
990
997 lfsr FSR2,letter 991 lfsr FSR2,letter
998 992
999 btfss hi,7 ; Negative temperature ? 993 btfss hi,7 ; Negative temperature ?
1000 bra PLED_temp_divemode_1 ; No: continue 994 bra PLED_temp_divemode_1 ; No: continue
1001 995
1562 bra PLED_confirmbox2 ; Return to Profile Menu, also updates cursor 1556 bra PLED_confirmbox2 ; Return to Profile Menu, also updates cursor
1563 1557
1564 1558
1565 PLED_depth: 1559 PLED_depth:
1566 ostc_debug 'r' ; Sends debug-information to screen if debugmode active 1560 ostc_debug 'r' ; Sends debug-information to screen if debugmode active
1567 movff rel_pressure+1,hi 1561 SAFE_2BYTE_COPY rel_pressure, lo
1568 movff rel_pressure+0,lo
1569 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar] 1562 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar]
1570 1563
1571 movlw .039 1564 movlw .039
1572 cpfslt hi 1565 cpfslt hi
1573 bra depth_greater_99_84mtr 1566 bra depth_greater_99_84mtr
1623 WIN_FONT FT_MEDIUM 1616 WIN_FONT FT_MEDIUM
1624 WIN_TOP .50 1617 WIN_TOP .50
1625 WIN_LEFT .40 1618 WIN_LEFT .40
1626 PLED_color_code warn_depth ; Color-code the output 1619 PLED_color_code warn_depth ; Color-code the output
1627 1620
1628 movff rel_pressure+1,hi 1621 SAFE_2BYTE_COPY rel_pressure, lo
1629 movff rel_pressure+0,lo
1630 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar] 1622 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar]
1631 1623
1632 STRCPY "." 1624 STRCPY "."
1633 1625
1634 movlw HIGH d'9' 1626 movlw HIGH d'9'
1775 call PLED_standard_color ; No 1767 call PLED_standard_color ; No
1776 btfsc high_altitude_mode ; In high altitude mode? 1768 btfsc high_altitude_mode ; In high altitude mode?
1777 call PLED_warnings_color ; Yes, display ambient pressure in red 1769 call PLED_warnings_color ; Yes, display ambient pressure in red
1778 1770
1779 lfsr FSR2,letter 1771 lfsr FSR2,letter
1780 movff amb_pressure+0,lo 1772 SAFE_2BYTE_COPY amb_pressure, lo
1781 movff amb_pressure+1,hi
1782 bsf leftbind 1773 bsf leftbind
1783 output_16 1774 output_16
1784 bcf leftbind 1775 bcf leftbind
1785 STRCAT_PRINT "mbar " 1776 STRCAT_PRINT "mbar "
1786 call PLED_standard_color ; Reset color 1777 call PLED_standard_color ; Reset color
2996 call word_processor 2987 call word_processor
2997 return 2988 return
2998 2989
2999 PLED_const_ppO2_value2: ; Display SetPoint 2990 PLED_const_ppO2_value2: ; Display SetPoint
3000 ;Show fixed SP value 2991 ;Show fixed SP value
3001 movff amb_pressure+0,xA+0 2992 SAFE_2BYTE_COPY amb_pressure, xA
3002 movff amb_pressure+1,xA+1 2993
3003 movlw d'10' 2994 movlw d'10'
3004 movwf xB+0 2995 movwf xB+0
3005 clrf xB+1 2996 clrf xB+1
3006 ;xA/xB=xC with xA as remainder 2997 ;xA/xB=xC with xA as remainder
3007 call div16x16 ; xC+0=p_amb/10 2998 call div16x16 ; xC+0=p_amb/10
3017 movff xC+0,char_I_const_ppO2 ; No, Overwrite with actual value 3008 movff xC+0,char_I_const_ppO2 ; No, Overwrite with actual value
3018 bra PLED_const_ppO2_value1a 3009 bra PLED_const_ppO2_value1a
3019 3010
3020 PLED_const_ppO2_value1: 3011 PLED_const_ppO2_value1:
3021 ; char_I_const_ppO2 < ppO2[Diluent] -> Not physically possible! -> Display actual value! 3012 ; char_I_const_ppO2 < ppO2[Diluent] -> Not physically possible! -> Display actual value!
3022 movff amb_pressure+0,xA+0 3013 SAFE_2BYTE_COPY amb_pressure, xA
3023 movff amb_pressure+1,xA+1
3024 movlw d'10' 3014 movlw d'10'
3025 movwf xB+0 3015 movwf xB+0
3026 clrf xB+1 3016 clrf xB+1
3027 call div16x16 ; xC=p_amb/10 3017 call div16x16 ; xC=p_amb/10
3028 movff xC+0,xA+0 3018 movff xC+0,xA+0