comparison src/logbook.asm @ 629:237931377539

3.07 stable release
author heinrichsweikamp
date Fri, 29 Nov 2019 18:48:11 +0100
parents cd58f7fc86db
children 185ba2f91f59
comparison
equal deleted inserted replaced
628:cd58f7fc86db 629:237931377539
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File logbook.asm combined next generation V3.03.5 3 ; File logbook.asm combined next generation V3.06.1
4 ; 4 ;
5 ; Logbook 5 ; Logbook
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
49 49
50 CBLOCK local2 ; max size is 16 byte !!! 50 CBLOCK local2 ; max size is 16 byte !!!
51 profile_temp1:2 ; temp for profile display 51 profile_temp1:2 ; temp for profile display
52 profile_temp2:2 ; temp for profile display 52 profile_temp2:2 ; temp for profile display
53 logbook_sample_counter:2 ; amount of read samples 53 logbook_sample_counter:2 ; amount of read samples
54 y_scale:2 ; y-scale (The horizontal lines) 54 y_scale:2 ; y-scale (the horizontal lines)
55 x_scale:2 ; x-scale (The vertical lines) 55 x_scale:2 ; x-scale (the vertical lines)
56 logbook_pixel_x_pos ; x2 position of current pixel in X-direction 56 logbook_pixel_x_pos ; x2 position of current pixel in X-direction
57 logbook_min_temp_pos ; lowest row in the temp graph 57 logbook_min_temp_pos ; lowest row in the temp graph
58 logbook_max_temp_pos ; lowest row in the temp graph 58 logbook_max_temp_pos ; lowest row in the temp graph
59 logbook_menupos_temp ; last position of cursor 59 logbook_menupos_temp ; last position of cursor
60 logbook_divenumber_temp ; used to back-up dive number 60 logbook_divenumber_temp ; used to back-up dive number
64 CBLOCK local3 ; max size is 16 byte !!! 64 CBLOCK local3 ; max size is 16 byte !!!
65 divenumber ; used for accessing dives 65 divenumber ; used for accessing dives
66 vertical_interval:2 ; holds interval of samples for vertical 10min line 66 vertical_interval:2 ; holds interval of samples for vertical 10min line
67 backup_color1 ; used for restoring drawing color 67 backup_color1 ; used for restoring drawing color
68 backup_color2 ; used for restoring drawing color 68 backup_color2 ; used for restoring drawing color
69 backup_divedata ; used to backup depth and salinity 69 salinity ; salinity during the dive
70 fill_between_rows ; used for fill between rows 70 fill_between_rows ; used for fill between rows
71 logbook_temp ; used as temp 71 logbook_temp ; used as temp
72 logbook_temp_backup ; used as backup for temp 72 logbook_temp_backup ; used as backup for temp
73 divisor_temperature ; divisor used while sampling of the dive data 73 divisor_temperature ; divisor used while sampling of the dive data
74 divisor_deco ; divisor used while sampling of the dive data 74 divisor_deco ; divisor used while sampling of the dive data
759 movwf logbook_max_tp+1 759 movwf logbook_max_tp+1
760 760
761 setf logbook_cur_tp+0 ; initialize Tp°, before the first recorded point 761 setf logbook_cur_tp+0 ; initialize Tp°, before the first recorded point
762 setf logbook_cur_tp+1 762 setf logbook_cur_tp+1
763 clrf logbook_last_tp ; also reset previous Y for Tp° 763 clrf logbook_last_tp ; also reset previous Y for Tp°
764 clrf logbook_ceiling ; Ceiling = 0, correct value for no ceiling 764 clrf logbook_ceiling ; ceiling = 0, correct value for no ceiling
765 movlw profile_top+.1 765 movlw profile_top+.1
766 movwf logbook_min_temp_pos ; initialize for displaying the lowest temperature 766 movwf logbook_min_temp_pos ; initialize for displaying the lowest temperature
767 movlw profile_top+profile_height_pixels 767 movlw profile_top+profile_height_pixels
768 movwf logbook_max_temp_pos ; initialize for displaying the highest temperature 768 movwf logbook_max_temp_pos ; initialize for displaying the highest temperature
769 769
834 bz profile_display_skip_temp 834 bz profile_display_skip_temp
835 835
836 movf logbook_cur_tp+0,W ; did we had already a valid Tp°C record? 836 movf logbook_cur_tp+0,W ; did we had already a valid Tp°C record?
837 andwf logbook_cur_tp+1,W 837 andwf logbook_cur_tp+1,W
838 incf WREG 838 incf WREG
839 bz profile_display_skip_temp ; NO - just skip drawing. 839 bz profile_display_skip_temp ; NO - just skip drawing
840 840
841 movlw LOW (((profile_height_pixels-.10)*.256)/.370) ; fixed tp° scale: (-2 .. +35°C * scale256 )/153pix 841 movlw LOW (((profile_height_pixels-.10)*.256)/.370) ; fixed tp° scale: (-2 .. +35°C * scale256 )/153pix
842 movwf xB+0 842 movwf xB+0
843 movlw HIGH (((profile_height_pixels-.10)*.256)/.370) 843 movlw HIGH (((profile_height_pixels-.10)*.256)/.370)
844 movwf xB+1 844 movwf xB+1
855 ; scale: divide by 256, ie. take just high byte. 855 ; scale: divide by 256, ie. take just high byte.
856 movf xC+1,W 856 movf xC+1,W
857 sublw profile_top+profile_height_pixels-.10 ; upside-down: Y = .75 + (.153 - result) 857 sublw profile_top+profile_height_pixels-.10 ; upside-down: Y = .75 + (.153 - result)
858 movwf xC+0 858 movwf xC+0
859 859
860 ; Check limits 860 ; check limits
861 movlw profile_top+.1 861 movlw profile_top+.1
862 movwf xC+1 862 movwf xC+1
863 cpfsgt xC+0 863 cpfsgt xC+0
864 movff xC+1,xC+0 864 movff xC+1,xC+0
865 865
866 movlw color_orange 866 movlw color_orange ; select color for temperature curve
867 call TFT_set_color 867 call TFT_set_color ; set color
868 868
869 movf logbook_last_tp,W ; do we have a valid previous value? 869 movf logbook_last_tp,W ; do we have a valid previous value?
870 bz profile_display_temp_1 ; NO - skip the vertical line 870 bz profile_display_temp_1 ; NO - skip the vertical line
871 movwf xC+1 871 movwf xC+1
872 call profile_display_fill ; in this column between this row (xC+0) and the last row (xC+1) 872 call profile_display_fill ; in this column between this row (xC+0) and the last row (xC+1)
1024 movff logbook_pixel_x_pos,win_leftx2 1024 movff logbook_pixel_x_pos,win_leftx2
1025 movlw .130 1025 movlw .130
1026 cpfslt win_leftx2 ; limit left border to 130 1026 cpfslt win_leftx2 ; limit left border to 130
1027 movwf win_leftx2 1027 movwf win_leftx2
1028 WIN_FONT FT_TINY 1028 WIN_FONT FT_TINY
1029 movlw color_orange ; use same color as tp° curve 1029 movlw color_yellow ; changed from color_orange to color_yellow for better readability
1030 call TFT_set_color 1030 call TFT_set_color
1031 1031
1032 MOVII logbook_min_tp,mpr 1032 MOVII logbook_min_tp,mpr
1033 lfsr FSR2,buffer 1033 lfsr FSR2,buffer
1034 1034
1535 STRCAT_PRINT "%" 1535 STRCAT_PRINT "%"
1536 1536
1537 logbook_page2_1: 1537 logbook_page2_1:
1538 1538
1539 ; Salinity 1539 ; Salinity
1540 WIN_SMALL .5,.140 1540 WIN_SMALL .5,.165 ; ex WIN_SMALL .5,.140
1541 LOG_POINT_TO log_salinity 1541 LOG_POINT_TO log_salinity
1542 STRCPY_TEXT tDvSalinity 1542 STRCPY_TEXT tDvSalinity
1543 bsf leftbind 1543 bsf leftbind
1544 call ext_flash_byte_read_plus ; read salinity 1544 call ext_flash_byte_read_plus ; read salinity
1545 movff ext_flash_rw,lo 1545 movff ext_flash_rw,lo
1546 movff ext_flash_rw,backup_divedata ; backup for average depth display 1546 movff ext_flash_rw,salinity ; store salinity for later use
1547 output_8 1547 output_8
1548 STRCAT_PRINT "%" 1548 STRCAT_PRINT "%"
1549 1549
1550 ; Average depth 1550 ; Average depth
1551 WIN_SMALL .5,.165 1551 WIN_SMALL .5,.140 ; ex WIN_SMALL .5,.165
1552 STRCPY_TEXT tAVG 1552 STRCPY_TEXT tAVG
1553 LOG_POINT_TO log_avr_depth 1553 LOG_POINT_TO log_avr_depth
1554 call ext_flash_byte_read_plus ; read average low 1554 call ext_flash_byte_read_plus ; read average low
1555 movff ext_flash_rw,lo 1555 movff ext_flash_rw,lo
1556 call ext_flash_byte_read_plus ; read average high 1556 call ext_flash_byte_read_plus ; read average high
1557 movff ext_flash_rw,hi 1557 movff ext_flash_rw,hi
1558 movf backup_divedata,W ; salinity for this dive 1558 movf salinity,W ; salinity for this dive
1559 call adjust_depth_with_salinity_log ; compute salinity setting (FROM WREG!) into lo:hi [mbar] 1559 call adjust_depth_with_salinity_log ; compute salinity into lo:hi [mbar]
1560 output_16dp .3 1560 bsf ignore_digit5 ; no cm (flag will be cleared by output_16)
1561 movlw .1 ; no 1000 meters
1562 movwf ignore_digits ; ...
1563 output_16dp .3 ; xxx.y
1561 STRCAT_PRINT "m" 1564 STRCAT_PRINT "m"
1562 1565
1563 btfss aux_flag ; dive done in a deco mode? 1566 btfss aux_flag ; dive done in a deco mode?
1564 bra logbook_page2_2 ; NO 1567 bra logbook_page2_2 ; NO
1565 1568
1812 PUTC ':' 1815 PUTC ':'
1813 movff hi,lo 1816 movff hi,lo
1814 output_99x ; minute 1817 output_99x ; minute
1815 STRCAT_PRINT "" ; display 1st row of details 1818 STRCAT_PRINT "" ; display 1st row of details
1816 1819
1820 ; Get salinity for this dive
1821 LOG_POINT_TO log_salinity
1822 call ext_flash_byte_read_plus ; read salinity
1823 movff ext_flash_rw,salinity ; store salinity
1824
1817 ; Show max depth and dive time 1825 ; Show max depth and dive time
1818 WIN_SMALL .5,.35 1826 WIN_SMALL .5,.35
1819 STRCAT "Max:" 1827 STRCAT "Max:"
1820 LOG_POINT_TO log_max_depth 1828 LOG_POINT_TO log_max_depth
1821 call ext_flash_byte_read_plus ; read max depth 1829 call ext_flash_byte_read_plus ; read max depth, low byte
1822 movff ext_flash_rw,lo 1830 movff ext_flash_rw,lo
1823 call ext_flash_byte_read_plus ; read max depth 1831 call ext_flash_byte_read_plus ; read max depth, high byte
1824 movff ext_flash_rw,hi 1832 movff ext_flash_rw,hi
1833
1834 movf salinity,W ; salinity for this dive
1835 call adjust_depth_with_salinity_log ; compute salinity setting into lo:hi [mbar]
1825 1836
1826 TSTOSS opt_units ; 0=Meters, 1=Feets 1837 TSTOSS opt_units ; 0=Meters, 1=Feets
1827 bra logbook_page2_depth_metric ; 1 - do metric 1838 bra logbook_page2_depth_metric ; 1 - do metric
1828 ; 0 - do imperial 1839 ; 0 - do imperial
1829 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet 1840 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet