comparison code_part1/OSTC_code_asm_part1/pled_outputs.asm @ 401:6ed12fad3b97

Ignore 5mbar pressure sensor noise in surface screen
author heinrichsweikamp
date Sun, 26 Jun 2011 18:07:51 +0200
parents 40b282821dcf
children e565392e0fcc
comparison
equal deleted inserted replaced
400:40b282821dcf 401:6ed12fad3b97
1772 btfss high_altitude_mode ; In high altitude mode? 1772 btfss high_altitude_mode ; In high altitude mode?
1773 call PLED_standard_color ; No 1773 call PLED_standard_color ; No
1774 btfsc high_altitude_mode ; In high altitude mode? 1774 btfsc high_altitude_mode ; In high altitude mode?
1775 call PLED_warnings_color ; Yes, display ambient pressure in red 1775 call PLED_warnings_color ; Yes, display ambient pressure in red
1776 1776
1777 lfsr FSR2,letter
1778 SAFE_2BYTE_COPY amb_pressure, lo 1777 SAFE_2BYTE_COPY amb_pressure, lo
1778 lfsr FSR2,letter
1779
1780 movff lo,sub_a+0
1781 movff hi,sub_a+1
1782 movff last_surfpressure_30min+0,sub_b+0
1783 movff last_surfpressure_30min+1,sub_b+1
1784 call sub16 ; sub_c = sub_a - sub_b
1785 btfsc neg_flag ; Pressure lower?
1786 rcall update_surf_press2 ; Yes, test threshold
1787
1788 tstfsz sub_c+1 ; >255mbar difference?
1789 bra update_surf_press_common; Yes, display!
1790 movlw d'5'
1791 subwf sub_c+0,W
1792 btfsc STATUS,C
1793 bra update_surf_press_common; Yes, display!
1794 ; PUTC '+' ; For debug only
1795 SAFE_2BYTE_COPY last_surfpressure_30min, lo ; Overwrite with stable value...
1796
1797 update_surf_press_common:
1779 bsf leftbind 1798 bsf leftbind
1780 output_16 1799 output_16
1781 bcf leftbind 1800 bcf leftbind
1782 STRCAT_PRINT "mbar " 1801 STRCAT_PRINT "mbar "
1783 call PLED_standard_color ; Reset color 1802 call PLED_standard_color ; Reset color
1803 return
1804
1805 update_surf_press2:
1806 movff lo,sub_b+0
1807 movff hi,sub_b+1
1808 movff last_surfpressure_30min+0,sub_a+0
1809 movff last_surfpressure_30min+1,sub_a+1
1810 call sub16 ; sub_c = sub_a - sub_b
1811 ; PUTC '-' ; For debug only
1784 return 1812 return
1785 1813
1786 update_batt_voltage_divemode: 1814 update_batt_voltage_divemode:
1787 call PLED_warnings_color 1815 call PLED_warnings_color
1788 DISPLAYTEXT d'246' ; LowBatt! 1816 DISPLAYTEXT d'246' ; LowBatt!