comparison src/logbook.asm @ 162:95d05cc14736

NEW: Safe tissue data, date and time during firmware update CHANGE: Postion of min. and (NEW:) max. temperature in logbook
author heinrichsweikamp
date Tue, 09 Sep 2014 21:17:25 +0200
parents 40ff64d60054
children 4d71549dcf6c
comparison
equal deleted inserted replaced
161:99065ef2d18e 162:95d05cc14736
28 #include "divemode.inc" 28 #include "divemode.inc"
29 #include "ghostwriter.inc" 29 #include "ghostwriter.inc"
30 30
31 extern do_main_menu2,comm_mode 31 extern do_main_menu2,comm_mode
32 32
33 CBLOCK tmp+0x40 ; Keep space for menu processor. 33 CBLOCK tmp+0x35 ; Keep space for menu processor.
34 count_temperature ; Current sample count for temperature divisor 34 count_temperature ; Current sample count for temperature divisor
35 count_deco ; Current sample count for deco (ceiling) divisor 35 count_deco ; Current sample count for deco (ceiling) divisor
36 logbook_cur_depth:2 ; Current depth, for drawing profile. 36 logbook_cur_depth:2 ; Current depth, for drawing profile.
37 logbook_cur_tp:2 ; Current temperature, for drawing profile. 37 logbook_cur_tp:2 ; Current temperature, for drawing profile.
38 logbook_last_tp ; Y of the last item in Tp° curve. 38 logbook_last_tp ; Y of the last item in Tp° curve.
51 logbook_sample_counter:2 ; Amount of read samples 51 logbook_sample_counter:2 ; Amount of read samples
52 divemins_backup ; Backup of divemins+0 52 divemins_backup ; Backup of divemins+0
53 y_scale:2 ; y-scale (The horizontal lines) 53 y_scale:2 ; y-scale (The horizontal lines)
54 x_scale:2 ; x-scale (The vertical lines) 54 x_scale:2 ; x-scale (The vertical lines)
55 logbook_pixel_x_pos ; x2 position of current pixel in X-direction 55 logbook_pixel_x_pos ; x2 position of current pixel in X-direction
56 ; Reserved to tmp+0x5F 56 logbook_min_temp_pos ; lowest row in the temp graph
57 logbook_max_temp_pos ; lowest row in the temp graph
58 ;+.33, reserved to tmp+0x56
57 ENDC 59 ENDC
58 60
59 #DEFINE return_from_profileview logbook_flags,0 61 #DEFINE return_from_profileview logbook_flags,0
60 #DEFINE all_dives_shown logbook_flags,1 62 #DEFINE all_dives_shown logbook_flags,1
61 #DEFINE logbook_page_not_empty logbook_flags,2 63 #DEFINE logbook_page_not_empty logbook_flags,2
761 763
762 setf logbook_cur_tp+0 ; Initialize Tp°, before the first recorded point. 764 setf logbook_cur_tp+0 ; Initialize Tp°, before the first recorded point.
763 setf logbook_cur_tp+1 765 setf logbook_cur_tp+1
764 clrf logbook_last_tp ; Also reset previous Y for Tp° 766 clrf logbook_last_tp ; Also reset previous Y for Tp°
765 clrf logbook_ceiling ; Ceiling = 0, correct value for no ceiling. 767 clrf logbook_ceiling ; Ceiling = 0, correct value for no ceiling.
768 movlw profile_top
769 movwf logbook_min_temp_pos ; Initialize for displaying the lowest temperature
770 movlw profile_top+profile_height_pixels
771 movwf logbook_max_temp_pos ; Initialize for displaying the highest temperature
766 772
767 INIT_PIXEL_WROTE logbook_pixel_x_pos ; pixel x2 (Also sets standard Color!) 773 INIT_PIXEL_WROTE logbook_pixel_x_pos ; pixel x2 (Also sets standard Color!)
768 774
769 profile_display_loop: 775 profile_display_loop:
770 movff profile_temp+0,profile_temp2+0 776 movff profile_temp+0,profile_temp2+0
852 858
853 movf logbook_last_tp,W ; do we have a valid previous value ? 859 movf logbook_last_tp,W ; do we have a valid previous value ?
854 bz profile_display_temp_1 ; No: skip the vertical line. 860 bz profile_display_temp_1 ; No: skip the vertical line.
855 movwf xC+1 861 movwf xC+1
856 call profile_display_fill ; In this column between this row (xC+0) and the last row (xC+1) 862 call profile_display_fill ; In this column between this row (xC+0) and the last row (xC+1)
857 profile_display_temp_1: 863 profile_display_temp_1:
864 movf xC+0,W ; current row
865 cpfsgt logbook_min_temp_pos ; check limit
866 movwf logbook_min_temp_pos ; lowest row in the temp graph
867 cpfslt logbook_max_temp_pos ; check limit
868 movwf logbook_max_temp_pos ; lowest row in the temp graph
869
858 movff xC+0,logbook_last_tp 870 movff xC+0,logbook_last_tp
859 PIXEL_WRITE logbook_pixel_x_pos,xC+0 ; Set col(0..159) x row (0..239), put a current color pixel. 871 PIXEL_WRITE logbook_pixel_x_pos,xC+0 ; Set col(0..159) x row (0..239), put a current color pixel.
860 872
861 profile_display_skip_temp: 873 profile_display_skip_temp:
862 ;---- Draw depth curve --------------------------------------------------- 874 ;---- Draw depth curve ---------------------------------------------------
956 addwf ext_flash_address+1,F 968 addwf ext_flash_address+1,F
957 movf PRODH,W 969 movf PRODH,W
958 addwfc ext_flash_address+2,F 970 addwfc ext_flash_address+2,F
959 ; pointer at the first 0xFA of header 971 ; pointer at the first 0xFA of header
960 972
961 movlw .2 ; negative offset 973 ; movlw .2 ; negative offset
962 addwf logbook_last_tp,W 974 ; addwf logbook_last_tp,W
963 movff WREG,win_top ; Line below temp 975 ; movff WREG,win_top ; Line below temp
976 movff logbook_min_temp_pos,win_top ; Y position at lowest temperature
964 movff logbook_pixel_x_pos,lo 977 movff logbook_pixel_x_pos,lo
965 movlw .130 978 movlw .130
966 cpfslt lo ; limit left border to 130 979 cpfslt lo ; limit left border to 130
967 movwf lo 980 movwf lo
968 movff lo,win_leftx2 981 movff lo,win_leftx2
980 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required 993 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
981 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit 994 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit
982 lfsr FSR2,buffer ; Overwrite "-" 995 lfsr FSR2,buffer ; Overwrite "-"
983 bsf ignore_digit5 ; Full degrees only 996 bsf ignore_digit5 ; Full degrees only
984 output_16 997 output_16
998 STRCAT_TEXT_PRINT tLogTunitF
999 ; Now, the max. temperature
1000 movlw .15
1001 subwf logbook_max_temp_pos,W
1002 movff WREG,win_top ; Y position at max temperature
1003 movff logbook_max_tp+0,lo
1004 movff logbook_max_tp+1,hi
1005 lfsr FSR2,buffer
1006 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
1007 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit
1008 output_16
985 bcf ignore_digit5 1009 bcf ignore_digit5
986 STRCAT_TEXT_PRINT tLogTunitF 1010 STRCAT_TEXT_PRINT tLogTunitF
1011
987 bra logbook_show_temp_common 1012 bra logbook_show_temp_common
988 1013
989 logbook_show_temp_metric: 1014 logbook_show_temp_metric:
990 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required 1015 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
991 movlw d'3' 1016 movlw d'3'
992 movwf ignore_digits 1017 movwf ignore_digits
993 bsf leftbind 1018 bsf leftbind
994 output_16dp d'2' ; temperature 1019 output_16dp d'2' ; temperature
995 STRCAT_TEXT_PRINT tLogTunitC 1020 STRCAT_TEXT_PRINT tLogTunitC
1021 ; Now, the max. temperature
1022 movlw .15
1023 subwf logbook_max_temp_pos,W
1024 movff WREG,win_top ; Y position at max temperature
1025 movff logbook_max_tp+0,lo
1026 movff logbook_max_tp+1,hi
1027 lfsr FSR2,buffer
1028 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
1029 movlw d'3'
1030 movwf ignore_digits
1031 bsf leftbind
1032 output_16dp d'2' ; temperature
1033 STRCAT_TEXT_PRINT tLogTunitC
996 1034
997 logbook_show_temp_common: 1035 logbook_show_temp_common:
1036
998 bcf leftbind 1037 bcf leftbind
999 call TFT_standard_color 1038 call TFT_standard_color
1000 1039
1001 ; Get pointer to Gaslist 1040 ; Get pointer to Gaslist
1002 LOG_POINT_TO log_gas1 1041 LOG_POINT_TO log_gas1
1219 movff logbook_max_tp+0,sub_b+0 1258 movff logbook_max_tp+0,sub_b+0
1220 movff logbook_max_tp+1,sub_b+1 1259 movff logbook_max_tp+1,sub_b+1
1221 call sub16 ; SIGNED sub_a - sub_b 1260 call sub16 ; SIGNED sub_a - sub_b
1222 btfsc neg_flag 1261 btfsc neg_flag
1223 bra profile_view_get_depth_no_tp 1262 bra profile_view_get_depth_no_tp
1224 1263
1264 ; store max. temp only below start_dive_threshold (1,0m)
1265 tstfsz logbook_cur_depth+1 ; > 2,56m?
1266 bra profile_view_compute_max_temp ; Yes, include in max. temp measurement
1267 movlw start_dive_threshold ; 1,0m
1268 cpfsgt logbook_cur_depth+0 ; low value
1269 bra profile_view_get_depth_no_tp ; above 1,0m, ignore temp
1270
1271 profile_view_compute_max_temp:
1225 movff logbook_cur_tp+0,logbook_max_tp+0 1272 movff logbook_cur_tp+0,logbook_max_tp+0
1226 movff logbook_cur_tp+1,logbook_max_tp+1 1273 movff logbook_cur_tp+1,logbook_max_tp+1
1227 1274
1228 ;---- Read deco, if any AND divisor=0 AND bytes available ---------------- 1275 ;---- Read deco, if any AND divisor=0 AND bytes available ----------------
1229 profile_view_get_depth_no_tp: 1276 profile_view_get_depth_no_tp: