comparison src/tft_outputs.asm @ 214:a17359244d93

compass changes
author heinrichsweikamp
date Sun, 14 Dec 2014 13:56:05 +0100
parents 3b5df65d53fc
children effd7259f5a5
comparison
equal deleted inserted replaced
213:3b5df65d53fc 214:a17359244d93
1586 STRCAT_TEXT tNW 1586 STRCAT_TEXT tNW
1587 return 1587 return
1588 1588
1589 compass_heading_common: 1589 compass_heading_common:
1590 call speed_normal 1590 call speed_normal
1591 movlw compass_averaging ; numbers of extra averaging
1592 movwf up
1593 compass_heading_common2:
1591 rcall TFT_get_compass 1594 rcall TFT_get_compass
1592 rcall TFT_get_compass 1595 decfsz up,F
1593 rcall TFT_get_compass 1596 bra compass_heading_common2
1594 rcall TFT_get_compass
1595 rcall TFT_get_compass
1596 rcall TFT_get_compass
1597 extern compass 1597 extern compass
1598 call compass ; Do compass corrections. 1598 call compass ; Do compass corrections.
1599 banksel common 1599 banksel common
1600 1600
1601 ; More then compass_fast_treshold? 1601 ; More then compass_fast_treshold?
1602 movff compass_heading_old+0,sub_a+0 1602 movff compass_heading_old+0,sub_a+0
1603 movff compass_heading_old+1,sub_a+1 1603 movff compass_heading_old+1,sub_a+1
1604 movff compass_heading+0,sub_b+0 1604 movff compass_heading+0,sub_b+0
1605 movff compass_heading+1,sub_b+1 1605 movff compass_heading+1,sub_b+1
1606 call sub16 1606 call sub16
1607 btfss neg_flag ; <0?
1608 bra compass_heading_common3 ; No, test for threshold
1609 ; Yes, subtract the other way round
1610 movff compass_heading+0,sub_a+0
1611 movff compass_heading+1,sub_a+1
1612 movff compass_heading_old+0,sub_b+0
1613 movff compass_heading_old+1,sub_b+1
1614 call sub16
1615 compass_heading_common3:
1607 movff compass_heading+0,compass_heading_old+0 ; copy new "old" 1616 movff compass_heading+0,compass_heading_old+0 ; copy new "old"
1608 movff compass_heading+1,compass_heading_old+1 1617 movff compass_heading+1,compass_heading_old+1
1609 1618
1610 bcf compass_fast_mode 1619 bcf compass_fast_mode
1611 movlw compass_fast_treshold 1620 movlw compass_fast_treshold
1615 btfss compass_fast_mode ; In fast mode? 1624 btfss compass_fast_mode ; In fast mode?
1616 return ; No. 1625 return ; No.
1617 ; Yes. 1626 ; Yes.
1618 movff compass_heading+0,lo 1627 movff compass_heading+0,lo
1619 movff compass_heading+1,hi 1628 movff compass_heading+1,hi
1620 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required 1629 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
1621 movff lo,compass_heading_shown+0 1630 movff lo,compass_heading_shown+0
1622 movff hi,compass_heading_shown+1 1631 movff hi,compass_heading_shown+1
1623 return 1632 return
1624 1633
1625 TFT_get_compass: 1634 TFT_get_compass:
1723 1732
1724 TSTOSS opt_units ; 0=°C, 1=°F 1733 TSTOSS opt_units ; 0=°C, 1=°F
1725 bra TFT_temp_surfmode_metric 1734 bra TFT_temp_surfmode_metric
1726 1735
1727 ;TFT_temp_surfmode_imperial: 1736 ;TFT_temp_surfmode_imperial:
1728 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required 1737 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
1729 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit 1738 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit
1730 lfsr FSR2,buffer ; Overwrite "-" 1739 lfsr FSR2,buffer ; Overwrite "-"
1731 bsf ignore_digit5 ; Full degrees only 1740 bsf ignore_digit5 ; Full degrees only
1732 output_16 1741 output_16
1733 STRCAT_PRINT "" 1742 STRCAT_PRINT ""
1735 WIN_SMALL surf_temp_column+4*8,surf_temp_row 1744 WIN_SMALL surf_temp_column+4*8,surf_temp_row
1736 STRCPY_PRINT "°F" 1745 STRCPY_PRINT "°F"
1737 return 1746 return
1738 1747
1739 TFT_temp_surfmode_metric: 1748 TFT_temp_surfmode_metric:
1740 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required 1749 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
1741 movlw d'3' 1750 movlw d'3'
1742 movwf ignore_digits 1751 movwf ignore_digits
1743 bsf ignore_digit5 ; Full degrees only 1752 bsf ignore_digit5 ; Full degrees only
1744 output_16 1753 output_16
1745 1754
1812 SAFE_2BYTE_COPY temperature, lo 1821 SAFE_2BYTE_COPY temperature, lo
1813 TSTOSS opt_units ; 0=°C, 1=°F 1822 TSTOSS opt_units ; 0=°C, 1=°F
1814 bra TFT_temp_divemode_metric 1823 bra TFT_temp_divemode_metric
1815 1824
1816 ;TFT_temp_divemode_imperial: 1825 ;TFT_temp_divemode_imperial:
1817 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required 1826 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
1818 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit 1827 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit
1819 lfsr FSR2,buffer ; Overwrite "-" (There won't be less then -18°C underwater...) 1828 lfsr FSR2,buffer ; Overwrite "-" (There won't be less then -18°C underwater...)
1820 bsf ignore_digit5 ; Full degrees only 1829 bsf ignore_digit5 ; Full degrees only
1821 output_16 1830 output_16
1822 STRCAT_TEXT tLogTunitF 1831 STRCAT_TEXT tLogTunitF
1826 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 1835 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
1827 STRCAT_PRINT "" 1836 STRCAT_PRINT ""
1828 return ; Done. 1837 return ; Done.
1829 1838
1830 TFT_temp_divemode_metric: 1839 TFT_temp_divemode_metric:
1831 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required 1840 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
1832 movlw d'3' 1841 movlw d'3'
1833 movwf ignore_digits 1842 movwf ignore_digits
1834 bsf ignore_digit5 ; Full degrees only 1843 bsf ignore_digit5 ; Full degrees only
1835 output_16 1844 output_16
1836 STRCAT_TEXT tLogTunitC 1845 STRCAT_TEXT tLogTunitC