Mercurial > public > hwos_code
comparison src/logbook.asm @ 500:989917fe2d9f
Battery % in logbook when updated from Sport to Tech
NEW: Third logbook page per dive showing Gaslist and Setpoints in standard font size
author | heinrichsweikamp |
---|---|
date | Thu, 11 May 2017 15:39:40 +0200 |
parents | a0247e9f71d0 |
children | 0910c227018f |
comparison
equal
deleted
inserted
replaced
499:ab20ec12baec | 500:989917fe2d9f |
---|---|
1600 STRCAT_PRINT "" | 1600 STRCAT_PRINT "" |
1601 return | 1601 return |
1602 | 1602 |
1603 | 1603 |
1604 logbook_page2: ; Show more info | 1604 logbook_page2: ; Show more info |
1605 ; call speed_fastest | 1605 rcall log_details_header ; Shows number, time/date and basic dive info |
1606 clrf CCP1CON ; stop PWM | |
1607 bcf PORTC,2 ; Pull PWM out to GND | |
1608 call TFT_ClearScreen ; Clear screen | |
1609 | |
1610 ; Set ext_flash pointer to "#divesecs-oldest" dive | |
1611 ; compute read_int_eeprom .2 - divesecs | |
1612 ; Read required header data for profile display | |
1613 ; look in header for pointer to begin of diveprofile (Byte 2-4) | |
1614 ; Set pointer (ext_flash_log_pointer:3) to this address, start drawing | |
1615 | |
1616 decf divesecs,F ;-1 | |
1617 read_int_eeprom .2 | |
1618 movf EEDATA,W | |
1619 bcf STATUS,C | |
1620 subfwb divesecs,W ; max. dives (low value) - divesecs | |
1621 movwf lo ; result | |
1622 incf divesecs,F ;+1 | |
1623 ; Set ext_flash_address:3 to TOC entry of this dive | |
1624 ; 1st: 200000h-200FFFh -> lo=0 | |
1625 ; 2nd: 201000h-201FFFh -> lo=1 | |
1626 ; 3rd: 202000h-202FFFh -> lo=2 | |
1627 ; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...) | |
1628 clrf ext_flash_address+0 | |
1629 clrf ext_flash_address+1 | |
1630 movlw 0x20 | |
1631 movwf ext_flash_address+2 | |
1632 movlw .16 | |
1633 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) | |
1634 movf PRODL,W | |
1635 addwf ext_flash_address+1,F | |
1636 movf PRODH,W | |
1637 addwfc ext_flash_address+2,F | |
1638 ; pointer at the first 0xFA of header | |
1639 rcall logbook_show_divenumber ; Show the dive number in medium font | |
1640 ; Show date and time in first row | |
1641 WIN_SMALL .59,.10 | |
1642 LOG_POINT_TO log_date | |
1643 call ext_flash_byte_read_plus | |
1644 movff temp1,convert_value_temp+2 ; Year | |
1645 call ext_flash_byte_read_plus | |
1646 movff temp1,convert_value_temp+0 ; Month | |
1647 call ext_flash_byte_read_plus | |
1648 movff temp1,convert_value_temp+1 ; Day | |
1649 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
1650 PUTC "-" | |
1651 call ext_flash_byte_read_plus ; hour | |
1652 movff temp1,lo | |
1653 call ext_flash_byte_read_plus ; Minutes | |
1654 movff temp1,hi | |
1655 output_99x ; hour | |
1656 PUTC ':' | |
1657 movff hi,lo | |
1658 output_99x ; minute | |
1659 STRCAT_PRINT "" ; Display 1st row of details | |
1660 | |
1661 ; Show max depth and dive time | |
1662 WIN_SMALL .5,.35 | |
1663 STRCAT "Max:" | |
1664 LOG_POINT_TO log_max_depth | |
1665 call ext_flash_byte_read_plus ; read max depth | |
1666 movff temp1,lo | |
1667 call ext_flash_byte_read_plus ; read max depth | |
1668 movff temp1,hi | |
1669 | |
1670 TSTOSS opt_units ; 0=Meters, 1=Feets | |
1671 bra logbook_page2_depth_metric | |
1672 ; imperial | |
1673 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
1674 PUTC ' ' | |
1675 bcf leftbind | |
1676 output_16_3 | |
1677 STRCAT_TEXT tFeets | |
1678 bra logbook_page2_depth_common | |
1679 | |
1680 logbook_page2_depth_metric: | |
1681 bsf leftbind | |
1682 output_16dp d'3' ; max. depth | |
1683 STRCAT_TEXT tMeters | |
1684 | |
1685 logbook_page2_depth_common: | |
1686 STRCAT " - " | |
1687 call ext_flash_byte_read_plus ; divetime in minutes | |
1688 movff temp1,lo | |
1689 call ext_flash_byte_read_plus | |
1690 movff temp1,hi ; divetime in minutes | |
1691 | |
1692 bsf leftbind | |
1693 output_16 ; divetime minutes | |
1694 PUTC "m" | |
1695 LOG_POINT_TO log_divetime+.2 | |
1696 call ext_flash_byte_read_plus ; read divetime seconds | |
1697 movff temp1,lo | |
1698 bsf leftbind | |
1699 output_99x ; divetime seconds | |
1700 call TFT_standard_color | |
1701 STRCAT_PRINT "s" | |
1702 ; ; Dive mode | |
1703 ; LOG_POINT_TO log_divemode | |
1704 ; call ext_flash_byte_read_plus ; Read divemode | |
1705 ; movff temp1,lo | |
1706 ; call TFT_display_decotype_surface1 ; "strcat_print"s divemode (OC, CC, APNEA or GAUGE) | |
1707 | |
1708 | 1606 |
1709 ; Deco model | 1607 ; Deco model |
1710 WIN_SMALL .5,.65 | 1608 WIN_SMALL .5,.65 |
1711 LOG_POINT_TO log_decomodel | 1609 LOG_POINT_TO log_decomodel |
1712 call ext_flash_byte_read_plus ; read deco model | 1610 call ext_flash_byte_read_plus ; read deco model |
1802 movff temp1,lo | 1700 movff temp1,lo |
1803 bsf neg_flag ; set flag for 2.15 or newer | 1701 bsf neg_flag ; set flag for 2.15 or newer |
1804 movlw .1 | 1702 movlw .1 |
1805 cpfsgt lo ; >1? | 1703 cpfsgt lo ; >1? |
1806 bcf neg_flag ; No, clear flag | 1704 bcf neg_flag ; No, clear flag |
1705 movlw .9 | |
1706 cpfslt lo ; <9? | |
1707 bcf neg_flag ; No, clear flag (When unit was updgraded from hwOS Sport (10.xx)) | |
1807 bsf leftbind | 1708 bsf leftbind |
1808 output_8 | 1709 output_8 |
1809 PUTC "." | 1710 PUTC "." |
1810 call ext_flash_byte_read_plus ; read firmware yy | 1711 call ext_flash_byte_read_plus ; read firmware yy |
1811 movff temp1,lo | 1712 movff temp1,lo |
1857 | 1758 |
1858 movlw color_greenish | 1759 movlw color_greenish |
1859 call TFT_set_color | 1760 call TFT_set_color |
1860 WIN_FRAME_COLOR16 .63,.220,.107,.159; Top, Bottom, Left, Right | 1761 WIN_FRAME_COLOR16 .63,.220,.107,.159; Top, Bottom, Left, Right |
1861 | 1762 |
1862 | |
1863 | |
1864 | |
1865 ; ; OC/CC Gas List | |
1866 ; LOG_POINT_TO log_divemode | |
1867 ; call ext_flash_byte_read_plus ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into temp1 | |
1868 ; WIN_TINY log2_title_column,log2_title_row1 | |
1869 ; WIN_COLOR color_greenish | |
1870 ; STRCPY_TEXT_PRINT tGaslist | |
1871 ; WIN_FRAME_STD log2_title_row1-2, log2_gas_row3+.15, log2_title_column-2, .159 ; Top, Bottom, Left, Right | |
1872 ; bcf leftbind | |
1873 ; LOG_POINT_TO log_gas1 | |
1874 ; movlw color_white ; Color for Gas 1 | |
1875 ; call TFT_set_color ; Set Color... | |
1876 ; WIN_TINY log2_gas_column, log2_gas_row1 | |
1877 ; rcall log_show_gas_common2 | |
1878 ; movlw color_green ; Color for Gas 2 | |
1879 ; call TFT_set_color ; Set Color... | |
1880 ; WIN_TINY log2_gas_column, log2_gas_row2 | |
1881 ; rcall log_show_gas_common2 | |
1882 ; movlw color_red ; Color for Gas 3 | |
1883 ; call TFT_set_color ; Set Color... | |
1884 ; WIN_TINY log2_gas_column, log2_gas_row3 | |
1885 ; rcall log_show_gas_common2 | |
1886 ;; movlw color_yellow ; Color for Gas 4 | |
1887 ;; call TFT_set_color ; Set Color... | |
1888 ;; WIN_TINY log2_gas_column, log2_gas_row4 | |
1889 ;; rcall log_show_gas_common2 | |
1890 ;; movlw color_cyan ; Color for Gas 5 | |
1891 ;; call TFT_set_color ; Set Color... | |
1892 ;; WIN_TINY log2_gas_column, log2_gas_row5 | |
1893 ;; rcall log_show_gas_common2 | |
1894 ; | |
1895 ; | |
1896 ; | |
1897 | |
1898 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco | 1763 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco |
1899 display_details_loop: | 1764 display_details_loop: |
1900 btfsc switch_left ; SET/MENU? | 1765 btfsc switch_left ; SET/MENU? |
1901 goto display_profile2 ; Show the profile view again | 1766 bra logbook_page3 ; Details, 2nd page |
1902 btfsc switch_right ; ENTER? | 1767 btfsc switch_right ; ENTER? |
1903 bra exit_profileview ; back to list | 1768 bra exit_profileview ; back to list |
1904 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second | 1769 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second |
1905 btfsc sleepmode ; Timeout? | 1770 btfsc sleepmode ; Timeout? |
1906 bra exit_profileview ; back to list | 1771 bra exit_profileview ; back to list |
1907 | 1772 bra display_details_loop ; wait for something to do |
1908 bra display_details_loop ; wait for something to do | |
1909 | 1773 |
1910 global logbook_preloop_tasks | 1774 global logbook_preloop_tasks |
1911 logbook_preloop_tasks: | 1775 logbook_preloop_tasks: |
1912 movlw CCP1CON_VALUE ; See hwos.inc | 1776 movlw CCP1CON_VALUE ; See hwos.inc |
1913 movwf CCP1CON ; Power-on backlight | 1777 movwf CCP1CON ; Power-on backlight |
1914 call TFT_standard_color | 1778 call TFT_standard_color |
1915 bcf sleepmode ; clear some flags | 1779 bcf sleepmode ; clear some flags |
1916 bcf switch_right | 1780 bcf switch_right |
1917 bcf switch_left | 1781 bcf switch_left |
1918 clrf timeout_counter2 | 1782 clrf timeout_counter2 |
1919 goto speed_normal ; and return | 1783 goto speed_normal ; and return |
1920 | 1784 |
1785 | |
1786 logbook_page3: ; Show even more info | |
1787 rcall log_details_header ; Shows number, time/date and basic dive info | |
1788 | |
1789 ; OC/CC Gas List | |
1790 LOG_POINT_TO log_divemode | |
1791 call ext_flash_byte_read_plus ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into temp1 | |
1792 WIN_SMALL .5,.65 | |
1793 WIN_COLOR color_greenish | |
1794 STRCPY_TEXT_PRINT tGaslist | |
1795 bcf leftbind | |
1796 LOG_POINT_TO log_gas1 | |
1797 movlw color_white ; Color for Gas 1 | |
1798 call TFT_set_color ; Set Color... | |
1799 WIN_SMALL .5,.90 | |
1800 rcall log_show_gas_common2 | |
1801 movlw color_green ; Color for Gas 2 | |
1802 call TFT_set_color ; Set Color... | |
1803 WIN_SMALL .5,.115 | |
1804 rcall log_show_gas_common2 | |
1805 movlw color_red ; Color for Gas 3 | |
1806 call TFT_set_color ; Set Color... | |
1807 WIN_SMALL .5,.140 | |
1808 rcall log_show_gas_common2 | |
1809 movlw color_yellow ; Color for Gas 4 | |
1810 call TFT_set_color ; Set Color... | |
1811 WIN_SMALL .5,.165 | |
1812 rcall log_show_gas_common2 | |
1813 movlw color_cyan ; Color for Gas 5 | |
1814 call TFT_set_color ; Set Color... | |
1815 WIN_SMALL .5,.190 | |
1816 rcall log_show_gas_common2 | |
1817 | |
1818 movlw color_lightblue | |
1819 call TFT_set_color | |
1820 WIN_FRAME_COLOR16 .63,.220,.2,.90; Top, Bottom, Left, Right | |
1821 | |
1822 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco | |
1823 display_details2_loop: | |
1824 btfsc switch_left ; SET/MENU? | |
1825 goto logbook_page4 ; Show more info | |
1826 btfsc switch_right ; ENTER? | |
1827 bra exit_profileview ; back to list | |
1828 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second | |
1829 btfsc sleepmode ; Timeout? | |
1830 bra exit_profileview ; back to list | |
1831 bra display_details2_loop ; wait for something to do | |
1832 | |
1833 logbook_page4: ; Show even more info | |
1834 rcall log_details_header ; Shows number, time/date and basic dive info | |
1835 | |
1836 ; Setpoint list | |
1837 LOG_POINT_TO log_sp1 | |
1838 WIN_SMALL .5,.65 | |
1839 WIN_COLOR color_greenish | |
1840 STRCPY_TEXT_PRINT tFixedSetpoints | |
1841 call TFT_standard_color | |
1842 WIN_SMALL .5,.90 | |
1843 rcall log_show_sp_common | |
1844 WIN_SMALL .5,.115 | |
1845 rcall log_show_sp_common | |
1846 WIN_SMALL .5,.140 | |
1847 rcall log_show_sp_common | |
1848 WIN_SMALL .5,.165 | |
1849 rcall log_show_sp_common | |
1850 WIN_SMALL .5,.190 | |
1851 rcall log_show_sp_common | |
1852 | |
1853 movlw color_greenish | |
1854 call TFT_set_color | |
1855 WIN_FRAME_COLOR16 .63,.220,.2,.112; Top, Bottom, Left, Right | |
1856 | |
1857 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco | |
1858 display_details3_loop: | |
1859 btfsc switch_left ; SET/MENU? | |
1860 goto display_profile2 ; Show the profile view again | |
1861 btfsc switch_right ; ENTER? | |
1862 bra exit_profileview ; back to list | |
1863 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second | |
1864 btfsc sleepmode ; Timeout? | |
1865 bra exit_profileview ; back to list | |
1866 bra display_details3_loop ; wait for something to do | |
1867 | |
1868 | |
1869 | |
1870 log_details_header: | |
1871 clrf CCP1CON ; stop PWM | |
1872 bcf PORTC,2 ; Pull PWM out to GND | |
1873 call TFT_ClearScreen ; Clear screen | |
1874 | |
1875 ; Set ext_flash pointer to "#divesecs-oldest" dive | |
1876 ; compute read_int_eeprom .2 - divesecs | |
1877 ; Read required header data for profile display | |
1878 ; look in header for pointer to begin of diveprofile (Byte 2-4) | |
1879 ; Set pointer (ext_flash_log_pointer:3) to this address, start drawing | |
1880 | |
1881 decf divesecs,F ;-1 | |
1882 read_int_eeprom .2 | |
1883 movf EEDATA,W | |
1884 bcf STATUS,C | |
1885 subfwb divesecs,W ; max. dives (low value) - divesecs | |
1886 movwf lo ; result | |
1887 incf divesecs,F ;+1 | |
1888 ; Set ext_flash_address:3 to TOC entry of this dive | |
1889 ; 1st: 200000h-200FFFh -> lo=0 | |
1890 ; 2nd: 201000h-201FFFh -> lo=1 | |
1891 ; 3rd: 202000h-202FFFh -> lo=2 | |
1892 ; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...) | |
1893 clrf ext_flash_address+0 | |
1894 clrf ext_flash_address+1 | |
1895 movlw 0x20 | |
1896 movwf ext_flash_address+2 | |
1897 movlw .16 | |
1898 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) | |
1899 movf PRODL,W | |
1900 addwf ext_flash_address+1,F | |
1901 movf PRODH,W | |
1902 addwfc ext_flash_address+2,F | |
1903 ; pointer at the first 0xFA of header | |
1904 rcall logbook_show_divenumber ; Show the dive number in medium font | |
1905 ; Show date and time in first row | |
1906 WIN_SMALL .59,.10 | |
1907 LOG_POINT_TO log_date | |
1908 call ext_flash_byte_read_plus | |
1909 movff temp1,convert_value_temp+2 ; Year | |
1910 call ext_flash_byte_read_plus | |
1911 movff temp1,convert_value_temp+0 ; Month | |
1912 call ext_flash_byte_read_plus | |
1913 movff temp1,convert_value_temp+1 ; Day | |
1914 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
1915 PUTC "-" | |
1916 call ext_flash_byte_read_plus ; hour | |
1917 movff temp1,lo | |
1918 call ext_flash_byte_read_plus ; Minutes | |
1919 movff temp1,hi | |
1920 output_99x ; hour | |
1921 PUTC ':' | |
1922 movff hi,lo | |
1923 output_99x ; minute | |
1924 STRCAT_PRINT "" ; Display 1st row of details | |
1925 | |
1926 ; Show max depth and dive time | |
1927 WIN_SMALL .5,.35 | |
1928 STRCAT "Max:" | |
1929 LOG_POINT_TO log_max_depth | |
1930 call ext_flash_byte_read_plus ; read max depth | |
1931 movff temp1,lo | |
1932 call ext_flash_byte_read_plus ; read max depth | |
1933 movff temp1,hi | |
1934 | |
1935 TSTOSS opt_units ; 0=Meters, 1=Feets | |
1936 bra logbook_page2_depth_metric | |
1937 ; imperial | |
1938 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
1939 PUTC ' ' | |
1940 bcf leftbind | |
1941 output_16_3 | |
1942 STRCAT_TEXT tFeets | |
1943 bra logbook_page2_depth_common | |
1944 | |
1945 logbook_page2_depth_metric: | |
1946 bsf leftbind | |
1947 output_16dp d'3' ; max. depth | |
1948 STRCAT_TEXT tMeters | |
1949 | |
1950 logbook_page2_depth_common: | |
1951 STRCAT " - " | |
1952 call ext_flash_byte_read_plus ; divetime in minutes | |
1953 movff temp1,lo | |
1954 call ext_flash_byte_read_plus | |
1955 movff temp1,hi ; divetime in minutes | |
1956 | |
1957 bsf leftbind | |
1958 output_16 ; divetime minutes | |
1959 PUTC "m" | |
1960 LOG_POINT_TO log_divetime+.2 | |
1961 call ext_flash_byte_read_plus ; read divetime seconds | |
1962 movff temp1,lo | |
1963 bsf leftbind | |
1964 output_99x ; divetime seconds | |
1965 call TFT_standard_color | |
1966 STRCAT_PRINT "s" | |
1967 ; ; Dive mode | |
1968 ; LOG_POINT_TO log_divemode | |
1969 ; call ext_flash_byte_read_plus ; Read divemode | |
1970 ; movff temp1,lo | |
1971 ; call TFT_display_decotype_surface1 ; "strcat_print"s divemode (OC, CC, APNEA or GAUGE) | |
1972 return | |
1973 | |
1974 | |
1921 log_show_sp_common: | 1975 log_show_sp_common: |
1922 lfsr FSR2,buffer | 1976 lfsr FSR2,buffer |
1923 call ext_flash_byte_read_plus ; Read setpoint | 1977 call ext_flash_byte_read_plus ; Read setpoint |
1924 movff temp1,lo | 1978 movff temp1,lo |
1925 clrf hi | 1979 clrf hi |