comparison src/logbook.asm @ 490:8dfb93e80338

NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically) NEW: Logbook detail page in larger font (And nicer layout) CHANGE: Sleep mode current slightly reduced for all hwOS devices NEW: Logbook now records battery information NEW: Markers in internal logbook drawn as small "m" next to the profile
author heinrichsweikamp
date Wed, 29 Mar 2017 21:35:12 +0200
parents 23b58c4bc6aa
children 336bfbbeb2b5
comparison
equal deleted inserted replaced
489:22092d14fd8c 490:8dfb93e80338
166 #DEFINE log_battery .50 166 #DEFINE log_battery .50
167 #DEFINE log_samplingrate .52 167 #DEFINE log_samplingrate .52
168 #DEFINE log_cns_start .53 168 #DEFINE log_cns_start .53
169 #DEFINE log_gf_start .55 169 #DEFINE log_gf_start .55
170 #DEFINE log_gf_end .56 170 #DEFINE log_gf_end .56
171 #DEFINE log_batt_info .59
171 #DEFINE log_sp1 .60 172 #DEFINE log_sp1 .60
172 #DEFINE log_sp2 .62 173 #DEFINE log_sp2 .62
173 #DEFINE log_sp3 .64 174 #DEFINE log_sp3 .64
174 #DEFINE log_sp4 .66 175 #DEFINE log_sp4 .66
175 #DEFINE log_sp5 .68 176 #DEFINE log_sp5 .68
909 910
910 PIXEL_WRITE logbook_pixel_x_pos,xC+0 ; Set col(0..159) x row (0..239), put a std color pixel. 911 PIXEL_WRITE logbook_pixel_x_pos,xC+0 ; Set col(0..159) x row (0..239), put a std color pixel.
911 incf logbook_pixel_x_pos,F ; Next column 912 incf logbook_pixel_x_pos,F ; Next column
912 913
913 ;---- Draw Marker square , if any ---------------------------------------- 914 ;---- Draw Marker square , if any ----------------------------------------
914 ; btfss log_marker_found ; Any marker to draw? ; mH 915 btfss log_marker_found ; Any marker to draw?
915 bra profile_display_skip_marker ; No 916 bra profile_display_skip_marker ; No
916 917
917 ; 2x2 square 918 ; tiny "m"
918 incf apnoe_mins,W ; increase row (Y) 919 incf apnoe_mins,W ; increase row (Y)
919 movwf win_top 920 movwf win_top
920 movlw .4 921 movlw .4
921 movwf win_height 922 movwf win_height
922 movlw .2 923 movlw .2
925 decf logbook_pixel_x_pos,W ; decrease column (X) 926 decf logbook_pixel_x_pos,W ; decrease column (X)
926 movwf win_leftx2 927 movwf win_leftx2
927 928
928 movlw color_orange 929 movlw color_orange
929 call TFT_set_color 930 call TFT_set_color
930 call TFT_box ; Draw 2x2 Box 931 WIN_FONT FT_TINY
931 bcf log_marker_found ; Clear flag 932 lfsr FSR2,buffer
933 STRCPY_PRINT "m"
934 ; bcf log_marker_found ; Clear flag
932 935
933 profile_display_skip_marker: 936 profile_display_skip_marker:
934 bcf log_marker_found ; Clear flag ; mH 937 bcf log_marker_found ; Clear flag ; mH
935 ;---- Draw CNS curve, if any --------------------------------------------- 938 ;---- Draw CNS curve, if any ---------------------------------------------
936 movf divisor_cns,W 939 movf divisor_cns,W
1617 movf PRODL,W 1620 movf PRODL,W
1618 addwf ext_flash_address+1,F 1621 addwf ext_flash_address+1,F
1619 movf PRODH,W 1622 movf PRODH,W
1620 addwfc ext_flash_address+2,F 1623 addwfc ext_flash_address+2,F
1621 ; pointer at the first 0xFA of header 1624 ; pointer at the first 0xFA of header
1622 call logbook_show_divenumber ; Show the dive number in medium font 1625 rcall logbook_show_divenumber ; Show the dive number in medium font
1623 1626 ; Show date and time in first row
1624 1627 WIN_SMALL .59,.10
1625 LOG_POINT_TO log_surface_press 1628 LOG_POINT_TO log_date
1626 ; surface pressure in mbar 1629 call ext_flash_byte_read_plus
1627 call ext_flash_byte_read_plus ; read surface pressure 1630 movff temp1,convert_value_temp+2 ; Year
1628 movff temp1,lo 1631 call ext_flash_byte_read_plus
1629 call ext_flash_byte_read_plus ; read surface pressure 1632 movff temp1,convert_value_temp+0 ; Month
1630 movff temp1,hi 1633 call ext_flash_byte_read_plus
1631 WIN_TINY MBAR_column,MBAR_row 1634 movff temp1,convert_value_temp+1 ; Day
1632 bsf leftbind 1635 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
1633 output_16 ; Air pressure before dive 1636 PUTC "-"
1634 STRCAT_TEXT_PRINT tMBAR 1637 call ext_flash_byte_read_plus ; hour
1635 1638 movff temp1,lo
1636 ; OC/CC Gas List 1639 call ext_flash_byte_read_plus ; Minutes
1637 LOG_POINT_TO log_divemode 1640 movff temp1,hi
1638 call ext_flash_byte_read_plus ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into temp1 1641 output_99x ; hour
1639 WIN_TINY log2_title_column,log2_title_row1 1642 PUTC ':'
1640 WIN_COLOR color_greenish 1643 movff hi,lo
1641 movlw .1 1644 output_99x ; minute
1642 cpfseq temp1 ;=CC? 1645 STRCAT_PRINT "" ; Display 1st row of details
1643 bra logbook_gaslist_oc 1646
1644 STRCPY_TEXT_PRINT tGaslistCC 1647 ; Show max depth and dive time
1645 bra logbook_gaslist_common 1648 WIN_SMALL .5,.35
1646 logbook_gaslist_oc: 1649 STRCAT "Max:"
1647 STRCPY_TEXT_PRINT tGaslist 1650 LOG_POINT_TO log_max_depth
1648 logbook_gaslist_common: 1651 call ext_flash_byte_read_plus ; read max depth
1649 LOG_POINT_TO log_gas1 1652 movff temp1,lo
1650 WIN_FRAME_STD log2_title_row1-2, log2_gas_row5+.15, log2_title_column-2, .159 ; Top, Bottom, Left, Right 1653 call ext_flash_byte_read_plus ; read max depth
1651 bcf leftbind 1654 movff temp1,hi
1652 movlw color_white ; Color for Gas 1 1655
1653 call TFT_set_color ; Set Color... 1656 TSTOSS opt_units ; 0=Meters, 1=Feets
1654 WIN_TINY log2_gas_column, log2_gas_row1 1657 bra logbook_page2_depth_metric
1655 rcall log_show_gas_common2 1658 ; imperial
1656 movlw color_green ; Color for Gas 2 1659 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
1657 call TFT_set_color ; Set Color... 1660 PUTC ' '
1658 WIN_TINY log2_gas_column, log2_gas_row2 1661 bcf leftbind
1659 rcall log_show_gas_common2 1662 output_16_3
1660 movlw color_red ; Color for Gas 3 1663 STRCAT_TEXT tFeets
1661 call TFT_set_color ; Set Color... 1664 bra logbook_page2_depth_common
1662 WIN_TINY log2_gas_column, log2_gas_row3 1665
1663 rcall log_show_gas_common2 1666 logbook_page2_depth_metric:
1664 movlw color_yellow ; Color for Gas 4 1667 bsf leftbind
1665 call TFT_set_color ; Set Color... 1668 output_16dp d'3' ; max. depth
1666 WIN_TINY log2_gas_column, log2_gas_row4 1669 STRCAT_TEXT tMeters
1667 rcall log_show_gas_common2 1670
1668 movlw color_cyan ; Color for Gas 5 1671 logbook_page2_depth_common:
1669 call TFT_set_color ; Set Color... 1672 STRCAT " - "
1670 WIN_TINY log2_gas_column, log2_gas_row5 1673 call ext_flash_byte_read_plus ; divetime in minutes
1671 rcall log_show_gas_common2 1674 movff temp1,lo
1672 1675 call ext_flash_byte_read_plus
1673 ; Firmware 1676 movff temp1,hi ; divetime in minutes
1674 call TFT_standard_color 1677
1675 WIN_TINY log2_firmware_column,log2_firmware_row 1678 bsf leftbind
1676 STRCPY_TEXT tFirmware 1679 output_16 ; divetime minutes
1677 call ext_flash_byte_read_plus ; read firmware xx 1680 PUTC "m"
1678 movff temp1,lo 1681 LOG_POINT_TO log_divetime+.2
1679 bsf leftbind 1682 call ext_flash_byte_read_plus ; read divetime seconds
1680 output_8 1683 movff temp1,lo
1681 PUTC "." 1684 bsf leftbind
1682 call ext_flash_byte_read_plus ; read firmware yy 1685 output_99x ; divetime seconds
1683 movff temp1,lo 1686 call TFT_standard_color
1684 output_99x 1687 STRCAT_PRINT "s"
1685 STRCAT_PRINT "" 1688 ; ; Dive mode
1686 1689 ; LOG_POINT_TO log_divemode
1687 ; Battery 1690 ; call ext_flash_byte_read_plus ; Read divemode
1688 WIN_TINY log2_battery_column,log2_battery_row 1691 ; movff temp1,lo
1689 STRCPY "Batt:" 1692 ; call TFT_display_decotype_surface1 ; "strcat_print"s divemode (OC, CC, APNEA or GAUGE)
1690 call ext_flash_byte_read_plus ; read battery low 1693
1691 movff temp1,lo 1694
1692 call ext_flash_byte_read_plus ; read battery high 1695 ; Deco model
1693 movff temp1,hi 1696 WIN_SMALL .5,.65
1694 output_16dp .2
1695 STRCAT_PRINT "V"
1696
1697 ; Setpoint list
1698 LOG_POINT_TO log_sp1
1699 WIN_TINY log2_title_column,log2_title_sp_row
1700 WIN_COLOR color_greenish
1701 STRCPY_TEXT_PRINT tFixedSetpoints
1702 WIN_FRAME_STD log2_title_sp_row-2, log2_sp_row5+.15, log2_title_column-2, .159 ; Top, Bottom, Left, Right
1703 WIN_TINY log2_gas_column, log2_sp_row1
1704 rcall log_show_sp_common
1705 WIN_TINY log2_gas_column, log2_sp_row2
1706 rcall log_show_sp_common
1707 WIN_TINY log2_gas_column, log2_sp_row3
1708 rcall log_show_sp_common
1709 WIN_TINY log2_gas_column, log2_sp_row4
1710 rcall log_show_sp_common
1711 WIN_TINY log2_gas_column, log2_sp_row5
1712 rcall log_show_sp_common
1713
1714 ; Salinity
1715 WIN_TINY log2_salinity_column,log2_salinity_row
1716 STRCPY_TEXT tDvSalinity
1717 bsf leftbind
1718 call ext_flash_byte_read_plus ; read salinity
1719 movff temp1,lo
1720 movff temp1,total_divetime_seconds+1 ; backup for average depth display
1721 output_8
1722 STRCAT_PRINT "%"
1723
1724 ; CNS
1725 LOG_POINT_TO log_cns_start
1726 WIN_TINY log2_cns_column,log2_cns_row
1727 STRCPY_TEXT tCNS2
1728 call ext_flash_byte_read_plus ; read cns low
1729 movff temp1,lo
1730 call ext_flash_byte_read_plus ; read cns high
1731 movff temp1,hi
1732 output_16
1733 LOG_POINT_TO log_cns_end
1734 STRCAT "->"
1735 call ext_flash_byte_read_plus ; read CNS low
1736 movff temp1,lo
1737 call ext_flash_byte_read_plus ; read CNS high
1738 movff temp1,hi
1739 output_16
1740 STRCAT_PRINT "%"
1741
1742 ; Average depth
1743 WIN_TINY log2_avr_column,log2_avr_row
1744 STRCPY_TEXT tAVG
1745 call ext_flash_byte_read_plus ; read avr low
1746 movff temp1,lo
1747 call ext_flash_byte_read_plus ; read avr high
1748 movff temp1,hi
1749
1750 movf total_divetime_seconds+1,W ; salinity for this dive
1751 call adjust_depth_with_salinity_log ; computes salinity setting (FROM WREG!) into lo:hi [mbar]
1752
1753 output_16dp .3
1754 STRCAT_PRINT "m"
1755
1756 ; Deco model
1757 LOG_POINT_TO log_decomodel 1697 LOG_POINT_TO log_decomodel
1758 WIN_TINY log2_decomodel_column,log2_decomodel_row 1698 call ext_flash_byte_read_plus ; read deco model
1759 STRCPY_TEXT tDkMode
1760 call ext_flash_byte_read_plus ; read deco model
1761 movff temp1,lo 1699 movff temp1,lo
1762 decfsz temp1,F 1700 decfsz temp1,F
1763 bra logbook_decomodel1 1701 bra logbook_decomodel1
1764 ; Deco model GF Version 1702 ; Deco model GF Version
1765 STRCAT_TEXT_PRINT tZHL16GF 1703 STRCAT_TEXT_PRINT tZHL16GF
1766 LOG_POINT_TO log_gf_lo 1704 LOG_POINT_TO log_gf_lo
1767 WIN_TINY log2_decomodel2_column,log2_decomodel2_row 1705 WIN_SMALL .5,.90
1768 STRCPY_TEXT tGF_low 1706 STRCPY_TEXT tGF
1769 call ext_flash_byte_read_plus ; Read GF lo 1707 call ext_flash_byte_read_plus ; Read GF lo
1770 movff temp1,lo 1708 movff temp1,lo
1771 output_8 1709 output_8
1772 STRCAT_PRINT "%" 1710 STRCAT "%/"
1773 WIN_TINY log2_decomodel3_column,log2_decomodel3_row 1711 bra logbook_decomodel_common
1774 STRCPY_TEXT tGF_high
1775 call ext_flash_byte_read_plus ; Read GF hi
1776 movff temp1,lo
1777 output_8
1778 STRCAT_PRINT "%"
1779 bra logbook_decomodel2
1780 logbook_decomodel1: 1712 logbook_decomodel1:
1781 ; Deco model NON-GF Version 1713 ; Deco model NON-GF Version
1782 STRCAT_TEXT_PRINT tZHL16 1714 STRCAT_TEXT_PRINT tZHL16
1783 LOG_POINT_TO log_sat_mult 1715 LOG_POINT_TO log_sat_mult
1784 WIN_TINY log2_decomodel2_column,log2_decomodel2_row 1716 WIN_SMALL .5,.90
1785 STRCPY_TEXT tSaturationMult 1717 call ext_flash_byte_read_plus ; Read sat_mult
1786 call ext_flash_byte_read_plus ; Read sat_mult 1718 movff temp1,lo
1719 output_8
1720 STRCAT "%/"
1721 logbook_decomodel_common:
1722 call ext_flash_byte_read_plus ; Read desat_mult or GF_hi
1787 movff temp1,lo 1723 movff temp1,lo
1788 output_8 1724 output_8
1789 STRCAT_PRINT "%" 1725 STRCAT_PRINT "%"
1790 WIN_TINY log2_decomodel3_column,log2_decomodel3_row 1726
1791 STRCPY_TEXT tDesaturationMult 1727 ; CNS
1792 call ext_flash_byte_read_plus ; Read desat_mult 1728 LOG_POINT_TO log_cns_start
1729 WIN_SMALL .5,.115
1730 STRCPY_TEXT tCNS2
1731 call ext_flash_byte_read_plus ; read cns low
1732 movff temp1,lo
1733 call ext_flash_byte_read_plus ; read cns high
1734 movff temp1,hi
1735 output_16
1736 LOG_POINT_TO log_cns_end
1737 STRCAT "->"
1738 call ext_flash_byte_read_plus ; read CNS low
1739 movff temp1,lo
1740 call ext_flash_byte_read_plus ; read CNS high
1741 movff temp1,hi
1742 output_16
1743 STRCAT_PRINT "%"
1744
1745 ; Salinity
1746 WIN_SMALL .5,.140
1747 LOG_POINT_TO log_salinity
1748 STRCPY_TEXT tDvSalinity
1749 bsf leftbind
1750 call ext_flash_byte_read_plus ; read salinity
1751 movff temp1,lo
1752 movff temp1,total_divetime_seconds+1 ; backup for average depth display
1753 output_8
1754 STRCAT_PRINT "%"
1755
1756 ; Average depth
1757 WIN_SMALL .5,.165
1758 STRCPY_TEXT tAVG
1759 LOG_POINT_TO log_avr_depth
1760 call ext_flash_byte_read_plus ; read avr low
1761 movff temp1,lo
1762 call ext_flash_byte_read_plus ; read avr high
1763 movff temp1,hi
1764 movf total_divetime_seconds+1,W ; salinity for this dive
1765 call adjust_depth_with_salinity_log ; computes salinity setting (FROM WREG!) into lo:hi [mbar]
1766 output_16dp .3
1767 STRCAT_PRINT "m"
1768
1769 ; Last deco
1770 LOG_POINT_TO log_last_stop
1771 WIN_SMALL .5,.190
1772 STRCPY_TEXT tLastDecostop
1773 call ext_flash_byte_read_plus ; Read last stop
1793 movff temp1,lo 1774 movff temp1,lo
1794 output_8 1775 output_8
1795 STRCAT_PRINT "%" 1776 STRCAT_PRINT "m"
1796 logbook_decomodel2: 1777
1797 ; Dive mode 1778 movlw color_lightblue
1798 LOG_POINT_TO log_divemode 1779 call TFT_set_color
1799 WIN_TINY log2_divemode_column,log2_divemode_row 1780 WIN_FRAME_COLOR16 .63,.220,.2,.105; Top, Bottom, Left, Right
1800 STRCPY_TEXT tDvMode 1781
1801 call ext_flash_byte_read_plus ; Read divemode 1782 ; Firmware
1783 call TFT_standard_color
1784 WIN_SMALL .110,.65
1785 STRCAT "V:"
1786 LOG_POINT_TO log_firmware
1787 call ext_flash_byte_read_plus ; read firmware xx
1802 movff temp1,lo 1788 movff temp1,lo
1803 call TFT_display_decotype_surface1 ; "strcat_print"s divemode (OC, CC, APNEA or GAUGE) 1789 bsf leftbind
1804 1790 output_8
1805 ; Last deco 1791 PUTC "."
1806 LOG_POINT_TO log_last_stop 1792 call ext_flash_byte_read_plus ; read firmware yy
1807 WIN_TINY log2_lastdeco_column,log2_lastdeco_row
1808 STRCPY_TEXT tLastDecostop
1809 call ext_flash_byte_read_plus ; Read last stop
1810 movff temp1,lo 1793 movff temp1,lo
1811 output_8 1794 output_99x
1812 STRCAT_PRINT "m" 1795 STRCAT_PRINT ""
1813 1796
1814 ; A frame around the details 1797 ; Battery voltage
1815 WIN_TINY log2_lastdeco_column,log2_salinity_row-.16 1798 WIN_SMALL .110,.90
1816 WIN_COLOR color_greenish 1799 STRCAT_PRINT "Batt:"
1817 STRCPY_TEXT_PRINT tLogbook 1800 WIN_SMALL .110,.115
1818 WIN_FRAME_STD log2_salinity_row-.18, MBAR_row+.15, 0, .85 ; Top, Bottom, Left, Right 1801 LOG_POINT_TO log_battery ; Battery voltage...
1802 call ext_flash_byte_read_plus ; read battery low
1803 movff temp1,lo
1804 call ext_flash_byte_read_plus ; read battery high
1805 movff temp1,hi
1806 output_16dp .2
1807 STRCAT_PRINT "V"
1808
1809 ; surface pressure in mbar
1810 LOG_POINT_TO log_surface_press
1811 call ext_flash_byte_read_plus ; read surface pressure
1812 movff temp1,lo
1813 call ext_flash_byte_read_plus ; read surface pressure
1814 movff temp1,hi
1815 WIN_SMALL .110,.140
1816 lfsr FSR2,buffer
1817 bsf leftbind
1818 output_16 ; Air pressure before dive
1819 STRCAT_TEXT tMBAR
1820 clrf WREG
1821 movff WREG,buffer+7 ; limit to 7 chars
1822 STRCAT_PRINT ""
1823
1824 movlw color_greenish
1825 call TFT_set_color
1826 WIN_FRAME_COLOR16 .63,.220,.107,.159; Top, Bottom, Left, Right
1827
1828
1829
1830
1831 ; ; OC/CC Gas List
1832 ; LOG_POINT_TO log_divemode
1833 ; call ext_flash_byte_read_plus ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into temp1
1834 ; WIN_TINY log2_title_column,log2_title_row1
1835 ; WIN_COLOR color_greenish
1836 ; STRCPY_TEXT_PRINT tGaslist
1837 ; WIN_FRAME_STD log2_title_row1-2, log2_gas_row3+.15, log2_title_column-2, .159 ; Top, Bottom, Left, Right
1838 ; bcf leftbind
1839 ; LOG_POINT_TO log_gas1
1840 ; movlw color_white ; Color for Gas 1
1841 ; call TFT_set_color ; Set Color...
1842 ; WIN_TINY log2_gas_column, log2_gas_row1
1843 ; rcall log_show_gas_common2
1844 ; movlw color_green ; Color for Gas 2
1845 ; call TFT_set_color ; Set Color...
1846 ; WIN_TINY log2_gas_column, log2_gas_row2
1847 ; rcall log_show_gas_common2
1848 ; movlw color_red ; Color for Gas 3
1849 ; call TFT_set_color ; Set Color...
1850 ; WIN_TINY log2_gas_column, log2_gas_row3
1851 ; rcall log_show_gas_common2
1852 ;; movlw color_yellow ; Color for Gas 4
1853 ;; call TFT_set_color ; Set Color...
1854 ;; WIN_TINY log2_gas_column, log2_gas_row4
1855 ;; rcall log_show_gas_common2
1856 ;; movlw color_cyan ; Color for Gas 5
1857 ;; call TFT_set_color ; Set Color...
1858 ;; WIN_TINY log2_gas_column, log2_gas_row5
1859 ;; rcall log_show_gas_common2
1860 ;
1861 ;
1862 ;
1819 1863
1820 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco 1864 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco
1821 display_details_loop: 1865 display_details_loop:
1822 btfsc switch_left ; SET/MENU? 1866 btfsc switch_left ; SET/MENU?
1823 goto display_profile2 ; Show the profile view again 1867 goto display_profile2 ; Show the profile view again