comparison src/logbook.asm @ 372:f8adb2d5d328

logbook work
author heinrichsweikamp
date Wed, 19 Aug 2015 18:40:01 +0200
parents fec5eec4c8b7
children e99bb91f6f92
comparison
equal deleted inserted replaced
371:fec5eec4c8b7 372:f8adb2d5d328
290 incf logbook_divenumber,F ; new header found, increase logbook_divenumber 290 incf logbook_divenumber,F ; new header found, increase logbook_divenumber
291 bra logbook4 ; Done with searching, display the header! 291 bra logbook4 ; Done with searching, display the header!
292 292
293 logbook3b: 293 logbook3b:
294 btfss logbook_page_not_empty ; Was there at least one dive? 294 btfss logbook_page_not_empty ; Was there at least one dive?
295 goto do_main_menu2 ; Not a single header was found, leave logbook. 295 bra exit_logbook ; Not a single header was found, leave logbook.
296 bra logbook_display_loop2 296 bra logbook_display_loop2
297 297
298 logbook_reset: 298 logbook_reset:
299 tstfsz logbook_divenumber ; Was there at least one dive? 299 tstfsz logbook_divenumber ; Was there at least one dive?
300 bra logbook_reset2 300 bra logbook_reset2
359 btfsc switch_right ; ENTER? 359 btfsc switch_right ; ENTER?
360 bra display_profile_or_exit ; view details/profile or exit logbook 360 bra display_profile_or_exit ; view details/profile or exit logbook
361 361
362 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second 362 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second
363 btfsc sleepmode ; Timeout? 363 btfsc sleepmode ; Timeout?
364 goto do_main_menu2 ; Yes 364 bra exit_logbook ; Yes
365 365
366 bra logbook_loop ; Wait for something to do 366 bra logbook_loop ; Wait for something to do
367 367
368 display_profile_or_exit: 368 display_profile_or_exit:
369 movlw logbook_row_number+.2 ; exit? 369 movlw logbook_row_number+.2 ; exit?
370 cpfseq menupos 370 cpfseq menupos
371 bra display_profile_or_exit2 ; No, check for "Next Page" 371 bra display_profile_or_exit2 ; No, check for "Next Page"
372 372
373 exit_logbook:
373 call TFT_DisplayOff 374 call TFT_DisplayOff
374 call TFT_boot 375 call TFT_boot
375
376 goto do_main_menu2 376 goto do_main_menu2
377 377
378 display_profile_or_exit2: 378 display_profile_or_exit2:
379 movlw logbook_row_number+.1 ; Next page? 379 movlw logbook_row_number+.1 ; Next page?
380 cpfseq menupos 380 cpfseq menupos
761 761
762 clrf timeout_counter2 ; here: used as counter for depth readings 762 clrf timeout_counter2 ; here: used as counter for depth readings
763 movlw profile_width_pixels+profile_left-.1 763 movlw profile_width_pixels+profile_left-.1
764 movwf ignore_digits ; here: used as counter for x-pixels 764 movwf ignore_digits ; here: used as counter for x-pixels
765 bcf end_of_profile ; clear flag 765 bcf end_of_profile ; clear flag
766 movlw profile_left 766
767 movlw profile_left+.1
767 movwf logbook_pixel_x_pos ; here: used as colum x2 (Start at Colum 5) 768 movwf logbook_pixel_x_pos ; here: used as colum x2 (Start at Colum 5)
768 movlw profile_top ; Zero-m row 769
770 movlw profile_top+.1 ; Zero-m row
769 movwf apnoe_mins ; here: used for fill between rows 771 movwf apnoe_mins ; here: used for fill between rows
770 movwf logbook_last_tp ; Initialise for Tp° curve too. 772 movwf logbook_last_tp ; Initialise for Tp° curve too.
771 773
772 movlw LOW(-.100) ; Initialize max tp° to -10.0 °C. 774 movlw LOW(-.100) ; Initialize max tp° to -10.0 °C.
773 movwf logbook_max_tp+0 775 movwf logbook_max_tp+0
776 778
777 setf logbook_cur_tp+0 ; Initialize Tp°, before the first recorded point. 779 setf logbook_cur_tp+0 ; Initialize Tp°, before the first recorded point.
778 setf logbook_cur_tp+1 780 setf logbook_cur_tp+1
779 clrf logbook_last_tp ; Also reset previous Y for Tp° 781 clrf logbook_last_tp ; Also reset previous Y for Tp°
780 clrf logbook_ceiling ; Ceiling = 0, correct value for no ceiling. 782 clrf logbook_ceiling ; Ceiling = 0, correct value for no ceiling.
781 movlw profile_top 783 movlw profile_top+.1
782 movwf logbook_min_temp_pos ; Initialize for displaying the lowest temperature 784 movwf logbook_min_temp_pos ; Initialize for displaying the lowest temperature
783 movlw profile_top+profile_height_pixels 785 movlw profile_top+profile_height_pixels
784 movwf logbook_max_temp_pos ; Initialize for displaying the highest temperature 786 movwf logbook_max_temp_pos ; Initialize for displaying the highest temperature
785 787
786 movlw profile_left 788 movlw profile_left
835 movff PRODH,xA+1 837 movff PRODH,xA+1
836 movff y_scale+0,xB+0 ; devide pressure in mbar/quant for row offsett 838 movff y_scale+0,xB+0 ; devide pressure in mbar/quant for row offsett
837 movff y_scale+1,xB+1 839 movff y_scale+1,xB+1
838 call div16x16 ; xA/xB=xC 840 call div16x16 ; xA/xB=xC
839 841
840 movlw profile_top+.1 ; Starts right after the top greenish line. 842 movlw profile_top+.1 ; Starts right after the top line.
841 movff WREG,win_top 843 movff WREG,win_top
842 movff logbook_pixel_x_pos,win_leftx2 ; Left border (0-159) 844 movff logbook_pixel_x_pos,win_leftx2 ; Left border (0-159)
843 movff xC+0,win_height 845 movff xC+0,win_height
844 call half_vertical_line ; Inputs: win_top, win_leftx2, win_height, win_color1, win_color2 846 call half_vertical_line ; Inputs: win_top, win_leftx2, win_height, win_color1, win_color2
845 847
871 movf xC+1,W 873 movf xC+1,W
872 sublw profile_top+profile_height_pixels-.10 ; Upside-down: Y = .75 + (.153 - result) 874 sublw profile_top+profile_height_pixels-.10 ; Upside-down: Y = .75 + (.153 - result)
873 movwf xC+0 875 movwf xC+0
874 876
875 ; Check limits 877 ; Check limits
876 movlw profile_top 878 movlw profile_top+.1
877 movwf xC+1 879 movwf xC+1
878 cpfsgt xC+0 880 cpfsgt xC+0
879 movff xC+1,xC+0 881 movff xC+1,xC+0
880 882
881 movlw color_orange 883 movlw color_orange
900 movff y_scale+0,xB+0 ; devide pressure in mbar/quant for row offsett 902 movff y_scale+0,xB+0 ; devide pressure in mbar/quant for row offsett
901 movff y_scale+1,xB+1 903 movff y_scale+1,xB+1
902 movff logbook_cur_depth+0,xA+0 904 movff logbook_cur_depth+0,xA+0
903 movff logbook_cur_depth+1,xA+1 905 movff logbook_cur_depth+1,xA+1
904 call div16x16 ; xA/xB=xC 906 call div16x16 ; xA/xB=xC
905 movlw profile_top 907 movlw profile_top+.1
906 addwf xC+0,F ; add 75 pixel offset to result 908 addwf xC+0,F ; add 75 pixel offset to result
907 909
908 btfsc STATUS,C ; Ignore potential profile errors 910 btfsc STATUS,C ; Ignore potential profile errors
909 movff apnoe_mins,xC+0 911 movff apnoe_mins,xC+0
910 912
912 914
913 movff apnoe_mins,xC+1 915 movff apnoe_mins,xC+1
914 call profile_display_fill ; In this column between this row (xC+0) and the last row (xC+1) 916 call profile_display_fill ; In this column between this row (xC+0) and the last row (xC+1)
915 movff xC+0,apnoe_mins ; Store last row for fill routine 917 movff xC+0,apnoe_mins ; Store last row for fill routine
916 918
917 PIXEL_WRITE logbook_pixel_x_pos,xC+0 ; Set col(0..159) x row (0..239), put a std color pixel. 919 PIXEL_WRITE logbook_pixel_x_pos,xC+0 ; Set col(0..159) x row (0..239), put a std color pixel.
918 incf logbook_pixel_x_pos,F ; Next row
919 920
920 ;---- Draw CNS curve, if any --------------------------------------------- 921 ;---- Draw CNS curve, if any ---------------------------------------------
921 movf divisor_cns,W 922 movf divisor_cns,W
922 bz profile_display_skip_cns 923 bz profile_display_skip_cns
923 ; 924 ;
930 bz profile_display_skip_gf 931 bz profile_display_skip_gf
931 ; 932 ;
932 ; TODO HERE 933 ; TODO HERE
933 ; 934 ;
934 profile_display_skip_gf: 935 profile_display_skip_gf:
936 incf logbook_pixel_x_pos,F ; Next column
935 937
936 ;---- All curves done. 938 ;---- All curves done.
937 939
938 profile_display_skip_loop1: ; skips readings! 940 profile_display_skip_loop1: ; skips readings!
939 dcfsnz profile_temp2+0,F 941 dcfsnz profile_temp2+0,F
1397 decf logbook_divenumber,F 1399 decf logbook_divenumber,F
1398 bcf all_dives_shown 1400 bcf all_dives_shown
1399 clrf menupos3 ; here: used row on current page 1401 clrf menupos3 ; here: used row on current page
1400 movlw logbook_row_number 1402 movlw logbook_row_number
1401 movwf menupos ; here: active row on current page 1403 movwf menupos ; here: active row on current page
1402 call TFT_DisplayOff 1404 ; call TFT_DisplayOff
1403 call TFT_boot 1405 ; call TFT_boot
1404 clrf CCP1CON ; stop PWM 1406 clrf CCP1CON ; stop PWM
1405 bcf PORTC,2 ; Pull PWM out to GND 1407 bcf PORTC,2 ; Pull PWM out to GND
1406 call TFT_ClearScreen ; clear details/profile 1408 call TFT_ClearScreen ; clear details/profile
1407 goto logbook2 ; start search 1409 goto logbook2 ; start search
1408 1410