comparison src/logbook.asm @ 432:929feb0da4f5

hunting a bug in the logbook (Day 2)
author heinrichsweikamp
date Wed, 22 Jun 2016 12:36:15 +0200
parents 5604cd15c39f
children b22c732f858a
comparison
equal deleted inserted replaced
431:9500b2d3e32b 432:929feb0da4f5
720 call TFT_set_color ; Make this configurable? 720 call TFT_set_color ; Make this configurable?
721 ; Draw a frame around profile area 721 ; Draw a frame around profile area
722 WIN_FRAME_COLOR16 profile_top-1,profile_top+profile_height_pixels+1,profile_left-1,profile_left+profile_width_pixels+1 722 WIN_FRAME_COLOR16 profile_top-1,profile_top+profile_height_pixels+1,profile_left-1,profile_left+profile_width_pixels+1
723 723
724 movlw profile_top 724 movlw profile_top
725 movff WREG,win_top 725 movwf win_top
726 movlw profile_left 726 movlw profile_left
727 movff WREG,win_leftx2 ; Left border (0-159) 727 movwf win_leftx2 ; Left border (0-159)
728 movlw d'1' 728 movlw d'1'
729 movff WREG,win_height 729 movwf win_height
730 movlw profile_width_pixels+.1 730 movlw profile_width_pixels+.1
731 movff WREG,win_width ; Right border (0-159) 731 movwf win_width+0 ; Right border (0-159)
732 bra display_profile2f ; No 0m line 732 bra display_profile2f ; No 0m line
733 display_profile2e: 733 display_profile2e:
734 call TFT_box ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 734 call TFT_box ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2
735 display_profile2f: 735 display_profile2f:
736 movff win_top,WREG ; Get row 736 movf win_top,W ; Get row
737 addwf x_scale+0,W ; Add line interval distance to win_top 737 addwf x_scale+0,W ; Add line interval distance to win_top
738 tstfsz x_scale+1 ; >255? 738 tstfsz x_scale+1 ; >255?
739 movlw d'255' ; Yes, make win_top>239 -> Abort here 739 movlw d'255' ; Yes, make win_top>239 -> Abort here
740 btfsc STATUS,C ; A Cary from the addwf above? 740 btfsc STATUS,C ; A Cary from the addwf above?
741 movlw d'255' ; Yes, make win_top>239 -> Abort here 741 movlw d'255' ; Yes, make win_top>239 -> Abort here
742 movff WREG,win_top ; Result in win_top again 742 movwf win_top ; Result in win_top again
743 movff win_top,lo ; Get win_top in Bank1...
744 movlw profile_top+profile_height_pixels+.1 ; Limit 743 movlw profile_top+profile_height_pixels+.1 ; Limit
745 cpfsgt lo ; >239? 744 cpfsgt win_top ; >239?
746 bra display_profile2e ; No, draw another line 745 bra display_profile2e ; No, draw another line
747 746
748 clrf timeout_counter2 ; here: used as counter for depth readings 747 clrf timeout_counter2 ; here: used as counter for depth readings
749 movlw profile_width_pixels+profile_left-.1 748 movlw profile_width_pixels+profile_left-.1
750 movwf ignore_digits ; here: used as counter for x-pixels 749 movwf ignore_digits ; here: used as counter for x-pixels
770 movwf logbook_min_temp_pos ; Initialize for displaying the lowest temperature 769 movwf logbook_min_temp_pos ; Initialize for displaying the lowest temperature
771 movlw profile_top+profile_height_pixels 770 movlw profile_top+profile_height_pixels
772 movwf logbook_max_temp_pos ; Initialize for displaying the highest temperature 771 movwf logbook_max_temp_pos ; Initialize for displaying the highest temperature
773 772
774 movlw profile_left 773 movlw profile_left
775 movff WREG,win_leftx2 774 movwf win_leftx2
776 movlw profile_top 775 movlw profile_top
777 movff WREG,win_top 776 movwf win_top
778 movlw profile_height_pixels 777 movlw profile_height_pixels
779 movff WREG,win_height 778 movwf win_height
780 movlw LOW (profile_width_pixels*.2) 779 movlw LOW (profile_width_pixels*.2)
781 movff WREG,win_width+0 780 movwf win_width+0
782 movlw HIGH (profile_width_pixels*.2) 781 movlw HIGH (profile_width_pixels*.2)
783 movff WREG,win_width+1 782 movwf win_width+1
784 call TFT_box_write ; open box for d1 783 call TFT_box_write ; open box for d1
785 784
786 INIT_PIXEL_WRITE logbook_pixel_x_pos ; pixel x2 (Also sets standard Color!) 785 INIT_PIXEL_WRITE logbook_pixel_x_pos ; pixel x2 (Also sets standard Color!)
787 786
788 profile_display_loop: 787 profile_display_loop:
824 movff y_scale+0,xB+0 ; devide pressure in mbar/quant for row offsett 823 movff y_scale+0,xB+0 ; devide pressure in mbar/quant for row offsett
825 movff y_scale+1,xB+1 824 movff y_scale+1,xB+1
826 call div16x16 ; xA/xB=xC 825 call div16x16 ; xA/xB=xC
827 826
828 movlw profile_top+.1 ; Starts right after the top line. 827 movlw profile_top+.1 ; Starts right after the top line.
829 movff WREG,win_top 828 movwf win_top
830 movff logbook_pixel_x_pos,win_leftx2 ; Left border (0-159) 829 movff logbook_pixel_x_pos,win_leftx2 ; Left border (0-159)
831 movff xC+0,win_height 830 movff xC+0,win_height
832 call half_vertical_line ; Inputs: win_top, win_leftx2, win_height, win_color1, win_color2 831 call half_vertical_line ; Inputs: win_top, win_leftx2, win_height, win_color1, win_color2
833 832
834 profile_display_skip_deco: 833 profile_display_skip_deco:
909 btfss log_marker_found ; Any marker to draw? 908 btfss log_marker_found ; Any marker to draw?
910 bra profile_display_skip_marker ; No 909 bra profile_display_skip_marker ; No
911 910
912 ; 2x2 square 911 ; 2x2 square
913 incf apnoe_mins,W ; increase row (Y) 912 incf apnoe_mins,W ; increase row (Y)
914 movff WREG,win_top 913 movwf win_top
915 movlw .4 914 movlw .4
916 movff WREG,win_height 915 movwf win_height
917 movlw .2 916 movlw .2
918 movff WREG,win_width 917 movwf win_width+0
918 clrf win_width+1
919 decf logbook_pixel_x_pos,W ; decrease column (X) 919 decf logbook_pixel_x_pos,W ; decrease column (X)
920 movff WREG,win_leftx2 920 movwf win_leftx2
921 921
922 movlw color_orange 922 movlw color_orange
923 call TFT_set_color 923 call TFT_set_color
924 call TFT_box ; Draw 2x2 Box 924 call TFT_box ; Draw 2x2 Box
925 bcf log_marker_found ; Clear flag 925 bcf log_marker_found ; Clear flag
1005 addwf ext_flash_address+1,F 1005 addwf ext_flash_address+1,F
1006 movf PRODH,W 1006 movf PRODH,W
1007 addwfc ext_flash_address+2,F 1007 addwfc ext_flash_address+2,F
1008 ; pointer at the first 0xFA of header 1008 ; pointer at the first 0xFA of header
1009 1009
1010 ; movlw .2 ; negative offset
1011 ; addwf logbook_last_tp,W
1012 ; movff WREG,win_top ; Line below temp
1013 movff logbook_min_temp_pos,win_top ; Y position at lowest temperature 1010 movff logbook_min_temp_pos,win_top ; Y position at lowest temperature
1014 movff logbook_pixel_x_pos,lo 1011 movff logbook_pixel_x_pos,win_leftx2
1015 movlw .130 1012 movlw .130
1016 cpfslt lo ; limit left border to 130 1013 cpfslt win_leftx2 ; limit left border to 130
1017 movwf lo 1014 movwf win_leftx2
1018 movff lo,win_leftx2
1019 WIN_FONT FT_TINY 1015 WIN_FONT FT_TINY
1020 movlw color_orange ; Use same color as tp° curve 1016 movlw color_orange ; Use same color as tp° curve
1021 call TFT_set_color 1017 call TFT_set_color
1022 1018
1023 movff logbook_min_tp+0,lo 1019 movff logbook_min_tp+0,lo
1056 output_16dp d'2' ; temperature 1052 output_16dp d'2' ; temperature
1057 STRCAT_TEXT_PRINT tLogTunitC 1053 STRCAT_TEXT_PRINT tLogTunitC
1058 ; Now, the max. temperature 1054 ; Now, the max. temperature
1059 movlw .15 1055 movlw .15
1060 subwf logbook_max_temp_pos,W 1056 subwf logbook_max_temp_pos,W
1061 movff WREG,win_top ; Y position at max temperature 1057 movwf win_top ; Y position at max temperature
1062 movff logbook_max_tp+0,lo 1058 movff logbook_max_tp+0,lo
1063 movff logbook_max_tp+1,hi 1059 movff logbook_max_tp+1,hi
1064 lfsr FSR2,buffer 1060 lfsr FSR2,buffer
1065 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required 1061 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
1066 movlw d'3' 1062 movlw d'3'
1236 1232
1237 ; Vertical lines... 1233 ; Vertical lines...
1238 movlw color_deepblue 1234 movlw color_deepblue
1239 call TFT_set_color ; Make this configurable? 1235 call TFT_set_color ; Make this configurable?
1240 movlw profile_top+.1 1236 movlw profile_top+.1
1241 movff WREG,win_top 1237 movwf win_top
1242 incf logbook_pixel_x_pos,W ; draw one line to right to make sure it's the background of the profile 1238 incf logbook_pixel_x_pos,W ; draw one line to right to make sure it's the background of the profile
1243 movff WREG,win_leftx2 ; Left border (0-159) 1239 movwf win_leftx2 ; Left border (0-159)
1244 movlw profile_height_pixels 1240 movlw profile_height_pixels
1245 movff WREG,win_height 1241 movwf win_height
1246 movlw profile_height_pixels 1242 movlw profile_height_pixels
1247 movff WREG,win_width ; "Window" height 1243 movwf win_width ; "Window" height
1248 call half_horizontal_line ; Inputs: win_top, win_leftx2, win_width, win_color1, win_color2 1244 call half_horizontal_line ; Inputs: win_top, win_leftx2, win_width, win_color1, win_color2
1249 1245
1250 profile_view_get_depth_no_line: 1246 profile_view_get_depth_no_line:
1251 call ext_flash_byte_read_plus_0x20 ; read depth first 1247 call ext_flash_byte_read_plus_0x20 ; read depth first
1252 movff temp1,logbook_cur_depth+0 ; low value 1248 movff temp1,logbook_cur_depth+0 ; low value