Mercurial > public > hwos_code
comparison src/logbook.asm @ 560:b7eb98dbd800
bump to 2.96beta (REFACTORED VERSION)
author | heinrichsweikamp |
---|---|
date | Wed, 31 Jan 2018 19:39:37 +0100 |
parents | 7c408bfaf2e8 |
children | 0039f057b90f |
comparison
equal
deleted
inserted
replaced
559:9cb967d844f0 | 560:b7eb98dbd800 |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File logbook.asm | 3 ; File logbook.asm REFACTORED VERSION V2.91 |
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 ;============================================================================= |
92 ; Max. Depth | 92 ; Max. Depth |
93 #DEFINE log_max_value_row .38 | 93 #DEFINE log_max_value_row .38 |
94 #DEFINE log_max_value_column .1 | 94 #DEFINE log_max_value_column .1 |
95 ; Divetime | 95 ; Divetime |
96 #DEFINE log_divetime_value_row .38 | 96 #DEFINE log_divetime_value_row .38 |
97 #DEFINE log_divetime_value_column .65 | 97 #DEFINE log_divetime_value_column .60 ; UPDATED, old value was .65 |
98 ; Gaslist below profile | 98 ; Gaslist below profile |
99 #DEFINE log_gas_row .225 | 99 #DEFINE log_gas_row .225 |
100 #DEFINE log_gas_column1 .0 | 100 #DEFINE log_gas_column1 .0 |
101 #DEFINE log_gas_column2 log_gas_column1+(.1*.32) | 101 #DEFINE log_gas_column2 log_gas_column1+(.1*.32) |
102 #DEFINE log_gas_column3 log_gas_column1+(.2*.32) | 102 #DEFINE log_gas_column3 log_gas_column1+(.2*.32) |
232 global logbook | 232 global logbook |
233 logbook: | 233 logbook: |
234 clrf logbook_flags | 234 clrf logbook_flags |
235 clrf CCP1CON ; stop PWM | 235 clrf CCP1CON ; stop PWM |
236 bcf PORTC,2 ; Pull PWM out to GND | 236 bcf PORTC,2 ; Pull PWM out to GND |
237 call TFT_boot | 237 call TFT_boot |
238 ; call TFT_standard_color | 238 ; call TFT_standard_color |
239 clrf menupos3 ; Here: used rows on current logbook-page | 239 clrf menupos3 ; Here: used rows on current logbook-page |
240 clrf logbook_page_number ; Here: # of current displayed page | 240 clrf logbook_page_number ; Here: # of current displayed page |
241 clrf logbook_divenumber ; # of dive in list during search | 241 clrf logbook_divenumber ; # of dive in list during search |
242 clrf divemins+0 ; Here: used as temp variables | 242 clrf divemins+0 ; Here: used as temp variables |
462 call ext_flash_byte_read_plus | 462 call ext_flash_byte_read_plus |
463 movff temp1,convert_value_temp+1 ; Day | 463 movff temp1,convert_value_temp+1 ; Day |
464 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | 464 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 |
465 STRCAT_PRINT "" | 465 STRCAT_PRINT "" |
466 | 466 |
467 ; NEW code block ## logbook look and feel | |
468 WIN_SMALL log_divetime_value_column,logbook_date_row ; align with surrounding data | |
469 LOG_POINT_TO log_divemode | |
470 call ext_flash_byte_read_plus ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into temp1 | |
471 movff temp1,lo | |
472 call TFT_display_decotype_surface1 ; "strcat_print"s divemode (OC, CC, APNEA or GAUGE) | |
473 | |
467 WIN_SMALL logbook_time_column, logbook_time_row | 474 WIN_SMALL logbook_time_column, logbook_time_row |
468 call ext_flash_byte_read_plus ; hour | 475 call ext_flash_byte_read_plus ; hour |
469 movff temp1,lo | 476 movff temp1,lo |
470 call ext_flash_byte_read_plus ; Minutes | 477 call ext_flash_byte_read_plus ; Minutes |
471 movff temp1,hi | 478 movff temp1,hi |
472 output_99x ; hour | 479 output_99x ; hour |
473 PUTC ':' | 480 PUTC ':' |
474 movff hi,lo | 481 movff hi,lo |
475 output_99x ; minute | 482 output_99x ; minute |
476 STRCAT_PRINT "" ; Display 1st row of details | 483 STRCAT_PRINT "" ; Display 1st row of details |
477 | 484 |
478 LOG_POINT_TO log_profile_version | 485 LOG_POINT_TO log_profile_version |
479 call ext_flash_byte_read_plus ; Profile version | 486 call ext_flash_byte_read_plus ; Profile version |
480 movlw 0x24 | 487 movlw 0x24 |
481 cpfslt temp1 ; <0x24? | 488 cpfslt temp1 ; <0x24? |
482 bra log_skip_extra_icon ; Yes, skip | 489 bra log_skip_extra_icon ; Yes, skip |
483 | 490 |
484 WIN_SMALL logbook_time_column-.8, logbook_time_row | 491 WIN_SMALL logbook_time_column-.8, logbook_time_row |
485 STRCPY_PRINT 0x94 ; "End of dive" icon | 492 STRCPY_PRINT 0x94 ; "End of dive" icon |
486 | 493 |
487 log_skip_extra_icon: | 494 log_skip_extra_icon: |
488 LOG_POINT_TO log_max_depth | 495 LOG_POINT_TO log_max_depth |
489 call ext_flash_byte_read_plus ; read max depth | 496 call ext_flash_byte_read_plus ; read max depth |
490 movff temp1,lo | 497 movff temp1,lo |
491 call ext_flash_byte_read_plus ; read max depth | 498 call ext_flash_byte_read_plus ; read max depth |
492 movff temp1,hi | 499 movff temp1,hi |
493 movff lo,xA+0 ; calculate y-scale for profile display | 500 movff lo,xA+0 ; calculate y-scale for profile display |
494 movff hi,xA+1 | 501 movff hi,xA+1 |
495 movlw profile_height_pixels ; pixel height available for profile | 502 movlw profile_height_pixels ; pixel height available for profile |
496 movwf xB+0 | 503 movwf xB+0 |
497 clrf xB+1 | 504 clrf xB+1 |
498 call div16x16 ; does xA/xB=xC | 505 call div16x16 ; does xA/xB=xC |
499 movff xC+0,y_scale+0 ; holds LOW byte of y-scale (mbar/pixel!) | 506 movff xC+0,y_scale+0 ; holds LOW byte of y-scale (mbar/pixel!) |
500 movff xC+1,y_scale+1 ; holds HIGH byte of y-scale (mbar/pixel!) | 507 movff xC+1,y_scale+1 ; holds HIGH byte of y-scale (mbar/pixel!) |
501 infsnz y_scale+0,F ; increase one, because there may be a remainder | 508 infsnz y_scale+0,F ; increase one, because there may be a remainder |
502 incf y_scale+1,F | 509 incf y_scale+1,F |
503 | 510 |
504 movlw LOW ((profile_height_pixels+1)*.1000) | 511 movlw LOW ((profile_height_pixels+1)*.1000) |
505 movwf xC+0 | 512 movwf xC+0 |
506 movlw HIGH (((profile_height_pixels+1)*.1000) & h'FFFF') | 513 movlw HIGH (((profile_height_pixels+1)*.1000) & h'FFFF') |
787 | 794 |
788 ; INIT_PIXEL_WRITE logbook_pixel_x_pos ; pixel x2 (Also sets standard Color!) | 795 ; INIT_PIXEL_WRITE logbook_pixel_x_pos ; pixel x2 (Also sets standard Color!) |
789 | 796 |
790 profile_display_loop: | 797 profile_display_loop: |
791 ; Init pixel write | 798 ; Init pixel write |
792 movf logbook_pixel_x_pos,W | 799 movf logbook_pixel_x_pos,W |
793 mullw 2 | 800 mullw 2 |
794 call pixel_write_col320 | 801 call pixel_write_col320 |
795 | 802 |
796 movff profile_temp+0,profile_temp2+0 | 803 movff profile_temp+0,profile_temp2+0 |
797 movff profile_temp+1,profile_temp2+1 ; 16Bit x-scaler | 804 movff profile_temp+1,profile_temp2+1 ; 16Bit x-scaler |
798 incf profile_temp2+1,F | 805 incf profile_temp2+1,F |
799 tstfsz profile_temp2+0 ; Must not be Zero | 806 tstfsz profile_temp2+0 ; Must not be Zero |
918 | 925 |
919 ; tiny "m" | 926 ; tiny "m" |
920 incf apnoe_mins,W ; increase row (Y) | 927 incf apnoe_mins,W ; increase row (Y) |
921 movwf win_top | 928 movwf win_top |
922 ; limit win_top to 220 | 929 ; limit win_top to 220 |
923 movlw .220 | 930 movlw .220 |
924 cpfslt win_top | 931 cpfslt win_top |
925 movwf win_top | 932 movwf win_top |
926 decf logbook_pixel_x_pos,W ; decrease column (X) | 933 decf logbook_pixel_x_pos,W ; decrease column (X) |
927 movwf win_leftx2 | 934 movwf win_leftx2 |
928 ; limit win_leftx2 to 151 | 935 ; limit win_leftx2 to 151 |
929 movlw .151 | 936 movlw .151 |
930 cpfslt win_leftx2 | 937 cpfslt win_leftx2 |
931 movwf win_leftx2 | 938 movwf win_leftx2 |
932 | 939 |
933 movlw color_orange | 940 movlw color_orange |
934 call TFT_set_color | 941 call TFT_set_color |
935 WIN_FONT FT_TINY | 942 WIN_FONT FT_TINY |
936 lfsr FSR2,buffer | 943 lfsr FSR2,buffer |
988 ; Done. | 995 ; Done. |
989 | 996 |
990 display_profile_no_profile: ; No profile available for this dive! | 997 display_profile_no_profile: ; No profile available for this dive! |
991 | 998 |
992 profile_display_loop_done: | 999 profile_display_loop_done: |
993 btfss is_bailout ; Bailout during the dive? | 1000 btfss is_bailout ; Bailout during the dive? |
994 bra profile_display_loop_done_nobail ; No | 1001 bra profile_display_loop_done_nobail ; No |
995 ; Yes, show "Bailout" | 1002 ; Yes, show "Bailout" |
996 movlw color_pink | 1003 movlw color_pink |
997 call TFT_set_color | 1004 call TFT_set_color |
998 WIN_TINY logbook_bailout_column,logbook_bailout_row | 1005 WIN_TINY logbook_bailout_column,logbook_bailout_row |
999 STRCPY_TEXT_PRINT tDiveBailout ; Bailout | 1006 STRCPY_TEXT_PRINT tDiveBailout ; Bailout |
1000 profile_display_loop_done_nobail: | 1007 profile_display_loop_done_nobail: |
1001 btfss gas6_changed ; Gas6 | 1008 btfss gas6_changed ; Gas6 |
1002 bra profile_display_loop_done_nogas6 ; No | 1009 bra profile_display_loop_done_nogas6 ; No |
1003 ; Yes, show "Gas 6!" | 1010 ; Yes, show "Gas 6!" |
1004 movlw color_pink | 1011 movlw color_pink |
1005 call TFT_set_color | 1012 call TFT_set_color |
1006 WIN_TINY logbook_bailout_column,logbook_bailout_row-.15 | 1013 WIN_TINY logbook_bailout_column,logbook_bailout_row-.15 |
1007 STRCPY_TEXT tGas ; Gas | 1014 STRCPY_TEXT tGas ; Gas |
1008 STRCAT_PRINT " 6!" | 1015 STRCAT_PRINT " 6!" |
1009 | 1016 |
1010 profile_display_loop_done_nogas6: | 1017 profile_display_loop_done_nogas6: |
1011 decf divesecs,F ;-1 | 1018 decf divesecs,F ;-1 |
1012 read_int_eeprom .2 | 1019 read_int_eeprom .2 |
1013 movf EEDATA,W | 1020 movf EEDATA,W |
1014 bcf STATUS,C | 1021 bcf STATUS,C |
1015 subfwb divesecs,W ; max. dives (low value) - divesecs | 1022 subfwb divesecs,W ; max. dives (low value) - divesecs |
1016 movwf lo ; result | 1023 movwf lo ; result |
1017 incf divesecs,F ;+1 | 1024 incf divesecs,F ;+1 |
1018 ; Set ext_flash_address:3 to TOC entry of this dive | 1025 ; Set ext_flash_address:3 to TOC entry of this dive |
1019 ; 1st: 200000h-200FFFh -> lo=0 | 1026 ; 1st: 200000h-200FFFh -> lo=0 |
1020 ; 2nd: 201000h-201FFFh -> lo=1 | 1027 ; 2nd: 201000h-201FFFh -> lo=1 |
1021 ; 3rd: 202000h-202FFFh -> lo=2 | 1028 ; 3rd: 202000h-202FFFh -> lo=2 |
1022 ; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...) | 1029 ; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...) |
1089 bsf leftbind | 1096 bsf leftbind |
1090 output_16dp d'2' ; temperature | 1097 output_16dp d'2' ; temperature |
1091 STRCAT_TEXT_PRINT tLogTunitC | 1098 STRCAT_TEXT_PRINT tLogTunitC |
1092 | 1099 |
1093 logbook_show_temp_common: | 1100 logbook_show_temp_common: |
1094 | |
1095 bcf leftbind | 1101 bcf leftbind |
1096 call TFT_standard_color | 1102 call TFT_standard_color |
1097 | 1103 |
1098 ; Get pointer to Gaslist | 1104 ; Get pointer to Gaslist |
1099 LOG_POINT_TO log_gas1 | 1105 LOG_POINT_TO log_gas1 |
1124 WIN_TINY log_gas_column5, log_gas_row | 1130 WIN_TINY log_gas_column5, log_gas_row |
1125 rcall log_show_gas_common | 1131 rcall log_show_gas_common |
1126 | 1132 |
1127 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco | 1133 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco |
1128 display_profile_loop: | 1134 display_profile_loop: |
1129 btfsc switch_left ; SET/MENU? | 1135 ; REPLACE ## logbook look and feel |
1136 ; btfsc switch_left ; SET/MENU? | |
1137 ; BY | |
1138 btfsc switch_right | |
1130 bra logbook_page2 ; Show more information | 1139 bra logbook_page2 ; Show more information |
1131 btfsc switch_right ; ENTER? | 1140 ; REPLACE ## logbook look and feel |
1141 ; btfsc switch_right ; ENTER? | |
1142 ; BY | |
1143 btfsc switch_left | |
1132 bra exit_profileview ; back to list | 1144 bra exit_profileview ; back to list |
1133 | 1145 |
1134 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second | 1146 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second |
1135 btfsc sleepmode ; Timeout? | 1147 btfsc sleepmode ; Timeout? |
1136 bra exit_profileview ; back to list | 1148 bra exit_profileview ; back to list |
1137 bra display_profile_loop ; wait for something to do | 1149 bra display_profile_loop ; wait for something to do |
1138 | 1150 |
1139 global log_screendump_and_onesecond | 1151 global log_screendump_and_onesecond |
1140 log_screendump_and_onesecond: ; Check if we need to make a screenshot and check for new second | 1152 log_screendump_and_onesecond: ; Check if we need to make a screenshot and check for new second |
1141 btfsc onesecupdate | 1153 btfsc onesecupdate |
1142 call timeout_surfmode ; Timeout | 1154 call timeout_surfmode ; Timeout |
1143 btfsc onesecupdate | 1155 btfsc onesecupdate |
1144 call set_dive_modes ; Check, if divemode must be entered | 1156 call set_dive_modes ; Check, if divemode must be entered |
1145 bcf onesecupdate ; one second update | 1157 bcf onesecupdate ; one second update |
1217 movf xC+0,W | 1229 movf xC+0,W |
1218 cpfsgt xC+1 ; apnoe_mins>xC+0? | 1230 cpfsgt xC+1 ; apnoe_mins>xC+0? |
1219 bra profile_display_fill_up ; Yes! | 1231 bra profile_display_fill_up ; Yes! |
1220 | 1232 |
1221 profile_display_fill_down2: ; Loop | 1233 profile_display_fill_down2: ; Loop |
1222 decf xC+1,F | 1234 decf xC+1,F |
1223 | 1235 |
1224 HALF_PIXEL_WRITE xC+1 ; Updates just row (0..239) | 1236 HALF_PIXEL_WRITE xC+1 ; Updates just row (0..239) |
1225 | 1237 |
1226 movf xC+0,W | 1238 movf xC+0,W |
1227 cpfseq xC+1 ; Loop until xC+1=xC+0 | 1239 cpfseq xC+1 ; Loop until xC+1=xC+0 |
1228 bra profile_display_fill_down2 | 1240 bra profile_display_fill_down2 |
1229 return ; apnoe_mins and xC+0 are untouched | 1241 return ; apnoe_mins and xC+0 are untouched |
1230 | 1242 |
1231 profile_display_fill_up: ; Fill upwards from xC+0 to apone_mins! | 1243 profile_display_fill_up: ; Fill upwards from xC+0 to apone_mins! |
1232 incf xC+1,F | 1244 incf xC+1,F |
1233 | 1245 |
1234 HALF_PIXEL_WRITE xC+1 ; Updates just row (0..239) | 1246 HALF_PIXEL_WRITE xC+1 ; Updates just row (0..239) |
1235 | 1247 |
1236 movf xC+0,W | 1248 movf xC+0,W |
1237 cpfseq xC+1 ; Loop until xC+1=apnoe_mins | 1249 cpfseq xC+1 ; Loop until xC+1=apnoe_mins |
1238 bra profile_display_fill_up | 1250 bra profile_display_fill_up |
1239 return ; apnoe_mins and xC+0 are untouched | 1251 return ; apnoe_mins and xC+0 are untouched |
1240 | 1252 |
1241 ;============================================================================= | 1253 ;============================================================================= |
1242 | 1254 |
1243 | 1255 |
1245 infsnz logbook_sample_counter+0,F | 1257 infsnz logbook_sample_counter+0,F |
1246 incf logbook_sample_counter+1,F ; Count read pixels | 1258 incf logbook_sample_counter+1,F ; Count read pixels |
1247 | 1259 |
1248 movf logbook_sample_counter+0,W | 1260 movf logbook_sample_counter+0,W |
1249 cpfseq average_depth_hold_total+0 | 1261 cpfseq average_depth_hold_total+0 |
1250 bra profile_view_get_depth_no_line ; no need to draw a 10min line, continue | 1262 bra profile_view_get_depth_no_line ; no need to draw a 10min line, continue |
1251 movf logbook_sample_counter+1,W | 1263 movf logbook_sample_counter+1,W |
1252 cpfseq average_depth_hold_total+1 | 1264 cpfseq average_depth_hold_total+1 |
1253 bra profile_view_get_depth_no_line ; no need to draw a 10min line, continue | 1265 bra profile_view_get_depth_no_line ; no need to draw a 10min line, continue |
1254 ; draw a new 10min line here... | 1266 ; draw a new 10min line here... |
1255 clrf logbook_sample_counter+0 | 1267 clrf logbook_sample_counter+0 |
1256 clrf logbook_sample_counter+1 ; clear counting registers for next line | 1268 clrf logbook_sample_counter+1 ; clear counting registers for next line |
1257 | 1269 |
1258 ; Vertical lines... | 1270 ; Vertical lines... |
1259 movlw color_deepblue | 1271 movlw color_deepblue |
1260 call TFT_set_color ; Make this configurable? | 1272 call TFT_set_color ; Make this configurable? |
1261 movlw profile_top+.1 | 1273 movlw profile_top+.1 |
1262 movwf win_top | 1274 movwf win_top |
1263 incf logbook_pixel_x_pos,W ; draw one line to right to make sure it's the background of the profile | 1275 incf logbook_pixel_x_pos,W ; draw one line to right to make sure it's the background of the profile |
1264 movwf win_leftx2 ; Left border (0-159) | 1276 movwf win_leftx2 ; Left border (0-159) |
1265 movlw profile_height_pixels | 1277 movlw profile_height_pixels |
1266 movwf win_height | 1278 movwf win_height |
1267 movlw profile_height_pixels | 1279 movlw profile_height_pixels |
1268 movwf win_width ; "Window" height | 1280 movwf win_width ; "Window" height |
1269 call half_horizontal_line ; Inputs: win_top, win_leftx2, win_width, win_color1, win_color2 | 1281 call half_horizontal_line ; Inputs: win_top, win_leftx2, win_width, win_color1, win_color2 |
1270 | 1282 |
1271 profile_view_get_depth_no_line: | 1283 profile_view_get_depth_no_line: |
1272 call ext_flash_byte_read_plus_0x20 ; read depth first | 1284 call ext_flash_byte_read_plus_0x20 ; read depth first |
1273 movff temp1,logbook_cur_depth+0 ; low value | 1285 movff temp1,logbook_cur_depth+0 ; low value |
1274 call ext_flash_byte_read_plus_0x20 ; read depth first | 1286 call ext_flash_byte_read_plus_0x20 ; read depth first |
1275 movff temp1,logbook_cur_depth+1 ; high value | 1287 movff temp1,logbook_cur_depth+1 ; high value |
1276 call ext_flash_byte_read_plus_0x20 ; read Profile Flag Byte | 1288 call ext_flash_byte_read_plus_0x20 ; read Profile Flag Byte |
1277 movff temp1,timeout_counter2 ; store Profile Flag Byte | 1289 movff temp1,timeout_counter2 ; store Profile Flag Byte |
1278 | 1290 |
1279 bcf event_occured ; clear flag | 1291 bcf event_occured ; clear flag |
1280 btfsc timeout_counter2,7 | 1292 btfsc timeout_counter2,7 |
1281 bsf event_occured ; We also have an Event byte! | 1293 bsf event_occured ; We also have an Event byte! |
1282 bcf timeout_counter2,7 ; Clear Event Byte Flag (If any) | 1294 bcf timeout_counter2,7 ; Clear Event Byte Flag (If any) |
1283 ; timeout_counter2 now holds the number of additional bytes to ignore (0-127) | 1295 ; timeout_counter2 now holds the number of additional bytes to ignore (0-127) |
1284 movlw 0xFD ; end of profile bytes? | 1296 movlw 0xFD ; end of profile bytes? |
1285 cpfseq logbook_cur_depth+0 | 1297 cpfseq logbook_cur_depth+0 |
1286 bra profile_view_get_depth_new1 ; no 1st. 0xFD | 1298 bra profile_view_get_depth_new1 ; no 1st. 0xFD |
1287 cpfseq logbook_cur_depth+1 | 1299 cpfseq logbook_cur_depth+1 |
1288 bra profile_view_get_depth_new1 ; no 2nd. 0xFD | 1300 bra profile_view_get_depth_new1 ; no 2nd. 0xFD |
1289 bsf end_of_profile ; End found! Set Flag! Skip remaining pixels! | 1301 bsf end_of_profile ; End found! Set Flag! Skip remaining pixels! |
1290 return | 1302 return |
1291 | 1303 |
1292 profile_view_get_depth_new1: | 1304 profile_view_get_depth_new1: |
1293 btfsc event_occured ; Was there an event attached to this sample? | 1305 btfsc event_occured ; Was there an event attached to this sample? |
1294 rcall profile_view_get_depth_events ; Yes, get information about this event(s) | 1306 rcall profile_view_get_depth_events ; Yes, get information about this event(s) |
1295 | 1307 |
1296 ;---- Read Tp°, if any AND divisor reached AND bytes available ----------- | 1308 ;---- Read Tp°, if any AND divisor reached AND bytes available ----------- |
1297 movf divisor_temperature,W ; Is Tp° divisor null ? | 1309 movf divisor_temperature,W ; Is Tp° divisor null ? |
1298 bz profile_view_get_depth_no_tp; Yes: no Tp° curve. | 1310 bz profile_view_get_depth_no_tp ; Yes: no Tp° curve. |
1299 decf count_temperature,F ; Decrement tp° counter | 1311 decf count_temperature,F ; Decrement tp° counter |
1300 bnz profile_view_get_depth_no_tp; No temperature this time | 1312 bnz profile_view_get_depth_no_tp ; No temperature this time |
1301 | 1313 |
1302 call ext_flash_byte_read_plus_0x20 ; Tp° low | 1314 call ext_flash_byte_read_plus_0x20 ; Tp° low |
1303 decf timeout_counter2,F | 1315 decf timeout_counter2,F |
1304 movff temp1,logbook_cur_tp+0 | 1316 movff temp1,logbook_cur_tp+0 |
1305 call ext_flash_byte_read_plus_0x20 ; Tp° high | 1317 call ext_flash_byte_read_plus_0x20 ; Tp° high |
1306 decf timeout_counter2,F | 1318 decf timeout_counter2,F |
1307 movff temp1,logbook_cur_tp+1 | 1319 movff temp1,logbook_cur_tp+1 |
1308 movff divisor_temperature,count_temperature ; Restart counter. | 1320 movff divisor_temperature,count_temperature ; Restart counter. |
1309 | 1321 |
1310 ; Compute Tp° max on the fly... | 1322 ; Compute Tp° max on the fly... |
1311 movff logbook_cur_tp+0,sub_a+0 ; Compare cur_tp > max_tp ? | 1323 movff logbook_cur_tp+0,sub_a+0 ; Compare cur_tp > max_tp ? |
1312 movff logbook_cur_tp+1,sub_a+1 | 1324 movff logbook_cur_tp+1,sub_a+1 |
1313 movff logbook_max_tp+0,sub_b+0 | 1325 movff logbook_max_tp+0,sub_b+0 |
1314 movff logbook_max_tp+1,sub_b+1 | 1326 movff logbook_max_tp+1,sub_b+1 |
1315 call sub16 ; SIGNED sub_a - sub_b | 1327 call sub16 ; SIGNED sub_a - sub_b |
1316 btfsc neg_flag | 1328 btfsc neg_flag |
1317 bra profile_view_get_depth_no_tp | 1329 bra profile_view_get_depth_no_tp |
1318 | 1330 |
1319 ; store max. temp only below start_dive_threshold (1,0m) | 1331 ; store max. temp only below start_dive_threshold (1,0m) |
1320 tstfsz logbook_cur_depth+1 ; > 2,56m? | 1332 tstfsz logbook_cur_depth+1 ; > 2,56m? |
1335 bnz profile_view_get_depth_no_deco | 1347 bnz profile_view_get_depth_no_deco |
1336 | 1348 |
1337 call ext_flash_byte_read_plus_0x20 | 1349 call ext_flash_byte_read_plus_0x20 |
1338 decf timeout_counter2,F | 1350 decf timeout_counter2,F |
1339 movff temp1,logbook_ceiling | 1351 movff temp1,logbook_ceiling |
1340 movff divisor_deco,count_deco ; Restart counter. | 1352 movff divisor_deco,count_deco ; Restart counter. |
1341 call ext_flash_byte_read_plus_0x20 ; Skip stop length | 1353 call ext_flash_byte_read_plus_0x20 ; Skip stop length |
1342 decf timeout_counter2,F | 1354 decf timeout_counter2,F |
1343 | 1355 |
1344 ;---- Read GF, if any AND divisor=0 AND bytes available ------------------ | 1356 ;---- Read GF, if any AND divisor=0 AND bytes available ------------------ |
1345 profile_view_get_depth_no_deco: | 1357 profile_view_get_depth_no_deco: |
1346 ; Then skip remaining bytes... | 1358 ; Then skip remaining bytes... |
1347 movf timeout_counter2,W ; number of additional bytes to ignore (0-127) | 1359 movf timeout_counter2,W ; number of additional bytes to ignore (0-127) |
1348 tstfsz timeout_counter2 ; Anything to skip? | 1360 tstfsz timeout_counter2 ; Anything to skip? |
1349 call incf_ext_flash_address0_0x20; Yes, increases bytes in ext_flash_address:3 with 0x200000 bank switching | 1361 call incf_ext_flash_address0_0x20 ; Yes, increases bytes in ext_flash_address:3 with 0x200000 bank switching |
1350 return | 1362 return |
1351 | 1363 |
1352 profile_view_get_depth_events: | 1364 profile_view_get_depth_events: |
1353 clrf EventByte2 ; Clear EventByte2 | 1365 clrf EventByte2 ; Clear EventByte2 |
1354 call ext_flash_byte_read_plus_0x20 ; Read Event byte | 1366 call ext_flash_byte_read_plus_0x20 ; Read Event byte |
1355 movff temp1,EventByte ; store EventByte | 1367 movff temp1,EventByte ; store EventByte |
1356 decf timeout_counter2,F ; reduce counter | 1368 decf timeout_counter2,F ; reduce counter |
1357 | 1369 |
1358 btfss EventByte,7 ; Another Event byte? | 1370 btfss EventByte,7 ; Another Event byte? |
1359 bra profile_no_second_eventbyte ; No | 1371 bra profile_no_second_eventbyte ; No |
1360 call ext_flash_byte_read_plus_0x20; Read Event byte2 | 1372 call ext_flash_byte_read_plus_0x20 ; Read Event byte2 |
1361 movff temp1,EventByte2 ; store EventByte2 | 1373 movff temp1,EventByte2 ; store EventByte2 |
1362 decf timeout_counter2,F ; reduce counter | 1374 decf timeout_counter2,F ; reduce counter |
1363 bcf EventByte,7 ; Clear flag | 1375 bcf EventByte,7 ; Clear flag |
1364 | 1376 |
1365 profile_no_second_eventbyte: | 1377 profile_no_second_eventbyte: |
1366 ; Check event flags in the EventBytes | 1378 ; Check event flags in the EventBytes |
1367 btfsc EventByte,4 ; Manual Gas Changed? | 1379 btfsc EventByte,4 ; Manual Gas Changed? |
1368 rcall logbook_event1 ; Yes! | 1380 rcall logbook_event1 ; Yes! |
1381 return ; No, return | 1393 return ; No, return |
1382 bsf log_marker_found ; Manual marker! Draw small yellow rectancle here | 1394 bsf log_marker_found ; Manual marker! Draw small yellow rectancle here |
1383 return | 1395 return |
1384 | 1396 |
1385 logbook_event4: ; Stored Gas changed! | 1397 logbook_event4: ; Stored Gas changed! |
1386 call ext_flash_byte_read_plus_0x20 ; Read Gas# | 1398 call ext_flash_byte_read_plus_0x20 ; Read Gas# |
1387 decf timeout_counter2,F ; reduce counter | 1399 decf timeout_counter2,F ; reduce counter |
1388 movff temp1,average_depth_hold_total+3 | 1400 movff temp1,average_depth_hold_total+3 |
1389 rcall profile_display_color ; Change profile color according to gas number | 1401 rcall profile_display_color ; Change profile color according to gas number |
1390 return | 1402 return |
1391 | 1403 |
1392 logbook_event1: ; Gas6 changed | 1404 logbook_event1: ; Gas6 changed |
1393 bsf gas6_changed | 1405 bsf gas6_changed |
1394 movlw 6 ; Just color backup to 6 | 1406 movlw 6 ; Just color backup to 6 |
1421 return | 1433 return |
1422 | 1434 |
1423 exit_profileview: | 1435 exit_profileview: |
1424 ; call speed_fastest | 1436 ; call speed_fastest |
1425 bcf sleepmode | 1437 bcf sleepmode |
1426 clrf timeout_counter2 ; restore all registers to build same page again | 1438 clrf timeout_counter2 ; restore all registers to build same page again |
1427 movff divemins_backup,divemins+0 | 1439 movff divemins_backup,divemins+0 |
1428 movff logbook_divenumber_temp, logbook_divenumber | 1440 movff logbook_divenumber_temp, logbook_divenumber |
1429 movff logbook_max_dive_counter_temp,logbook_max_dive_counter | 1441 movff logbook_max_dive_counter_temp,logbook_max_dive_counter |
1430 incf logbook_max_dive_counter,F | 1442 incf logbook_max_dive_counter,F |
1431 decf logbook_divenumber,F | 1443 decf logbook_divenumber,F |
1435 movwf menupos ; here: active row on current page | 1447 movwf menupos ; here: active row on current page |
1436 ; call TFT_DisplayOff | 1448 ; call TFT_DisplayOff |
1437 call TFT_boot | 1449 call TFT_boot |
1438 clrf CCP1CON ; stop PWM | 1450 clrf CCP1CON ; stop PWM |
1439 bcf PORTC,2 ; Pull PWM out to GND | 1451 bcf PORTC,2 ; Pull PWM out to GND |
1440 call TFT_boot | 1452 call TFT_boot |
1441 ; call TFT_ClearScreen ; clear details/profile | 1453 ; call TFT_ClearScreen ; clear details/profile |
1442 goto logbook2 ; start search | 1454 goto logbook2 ; start search |
1443 | 1455 |
1444 next_logbook2: | 1456 next_logbook2: |
1445 btfsc all_dives_shown ; all shown | 1457 btfsc all_dives_shown ; all shown |
1454 call TFT_boot | 1466 call TFT_boot |
1455 ;call TFT_ClearScreen | 1467 ;call TFT_ClearScreen |
1456 goto logbook2 ; start search | 1468 goto logbook2 ; start search |
1457 | 1469 |
1458 next_logbook3: | 1470 next_logbook3: |
1459 incf menupos,F ; +1 | 1471 incf menupos,F ; +1 |
1460 movlw logbook_row_number+.2 | 1472 movlw logbook_row_number+.2 |
1461 cpfsgt menupos ; =logbook_row_number+.3? | 1473 cpfsgt menupos ; =logbook_row_number+.3? |
1462 bra next_logbook3a ; No | 1474 bra next_logbook3a ; No |
1463 movlw .1 | 1475 movlw .1 |
1464 movwf menupos | 1476 movwf menupos |
1465 bra next_logbook3b | 1477 bra next_logbook3b |
1466 | 1478 |
1467 next_logbook3a: | 1479 next_logbook3a: |
1468 incf menupos3,W ; last entry in current page +1 | 1480 incf menupos3,W ; last entry in current page +1 |
1469 cpfseq menupos ; same as cursor pos.? | 1481 cpfseq menupos ; same as cursor pos.? |
1470 bra next_logbook3b ; No | 1482 bra next_logbook3b ; No |
1471 movlw logbook_row_number+.1 ; Yes, ... | 1483 movlw logbook_row_number+.1 ; Yes, ... |
1472 movwf menupos ; ... jump directly to "next page" if page is not full | 1484 movwf menupos ; ... jump directly to "next page" if page is not full |
1473 | 1485 |
1474 movlw logbook_row_number | 1486 movlw logbook_row_number |
1475 cpfseq menupos3 ; Last dive was row logbook_row_number? | 1487 cpfseq menupos3 ; Last dive was row logbook_row_number? |
1476 bsf all_dives_shown ; No, set flag to load first page again (full reset) | 1488 bsf all_dives_shown ; No, set flag to load first page again (full reset) |
1477 | 1489 |
1478 next_logbook3b: | 1490 next_logbook3b: |
1479 clrf timeout_counter2 | 1491 clrf timeout_counter2 |
1480 call TFT_logbook_cursor | 1492 call TFT_logbook_cursor |
1481 | 1493 |
1502 bra display_listdive1 ; No, adjust offset | 1514 bra display_listdive1 ; No, adjust offset |
1503 bra display_listdive1b ; Display now | 1515 bra display_listdive1b ; Display now |
1504 | 1516 |
1505 display_listdive1: | 1517 display_listdive1: |
1506 ; Check limit (lo:hi must be <1000) | 1518 ; Check limit (lo:hi must be <1000) |
1507 movlw LOW d'1000' ; Compare to 1000 | 1519 movlw LOW d'1000' ; Compare to 1000 |
1508 subwf lo,W | 1520 subwf lo,W |
1509 movlw HIGH d'1000' | 1521 movlw HIGH d'1000' |
1510 subwfb hi,W | 1522 subwfb hi,W |
1511 bc display_listdive1b ; carry = no-borrow = > 1000, skip! | 1523 bc display_listdive1b ; carry = no-borrow = > 1000, skip! |
1512 | 1524 |
1513 infsnz lo,F | 1525 infsnz lo,F |
1514 incf hi,F ; hi:lo = hi:lo + 1 | 1526 incf hi,F ; hi:lo = hi:lo + 1 |
1515 movff lo,sub_a+0 | 1527 movff lo,sub_a+0 |
1516 movff hi,sub_a+1 | 1528 movff hi,sub_a+1 |
1523 | 1535 |
1524 display_listdive1b: | 1536 display_listdive1b: |
1525 clrf hi | 1537 clrf hi |
1526 movff logbook_divenumber,lo ; lo=0 and hi=0 -> show without applied offset | 1538 movff logbook_divenumber,lo ; lo=0 and hi=0 -> show without applied offset |
1527 display_listdive1a: | 1539 display_listdive1a: |
1528 output_16_3 ; displays only last three figures from a 16Bit value (0-999), # of dive | 1540 output_16_3 ; displays only last three figures from a 16Bit value (0-999), # of dive |
1529 PUTC ' ' | 1541 PUTC ' ' |
1530 LOG_POINT_TO log_date+1 ; Point to month | 1542 LOG_POINT_TO log_date+1 ; Point to month |
1531 call ext_flash_byte_read_plus | 1543 call ext_flash_byte_read_plus |
1532 movff temp1,lo ; read month | 1544 movff temp1,lo ; read month |
1533 | 1545 |
1542 call ext_flash_byte_read_plus ; max. Depth | 1554 call ext_flash_byte_read_plus ; max. Depth |
1543 movff temp1,lo | 1555 movff temp1,lo |
1544 call ext_flash_byte_read_plus | 1556 call ext_flash_byte_read_plus |
1545 movff temp1,hi | 1557 movff temp1,hi |
1546 | 1558 |
1547 TSTOSS opt_units ; 0=Meters, 1=Feets | 1559 TSTOSS opt_units ; 0=Meters, 1=Feets |
1548 bra display_listdive2_metric | 1560 bra display_listdive2_metric |
1549 ;display_listdive2_imperial: | 1561 ;display_listdive2_imperial: |
1550 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | 1562 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
1551 PUTC ' ' | 1563 PUTC ' ' |
1552 bcf leftbind | 1564 bcf leftbind |
1553 output_16_3 ; limit to 999 and display only (0-999) | 1565 output_16_3 ; limit to 999 and display only (0-999) |
1554 STRCAT_TEXT tFeets1 | 1566 STRCAT_TEXT tFeets1 |
1555 bra display_listdive3 | 1567 bra display_listdive3 |
1556 | 1568 |
1557 display_listdive2_metric: | 1569 display_listdive2_metric: |
1558 bsf ignore_digit5 ; no cm... | 1570 bsf ignore_digit5 ; no cm... |
1559 movlw d'1' ; +1 | 1571 movlw d'1' ; +1 |
1560 movff WREG,ignore_digits ; no 1000m | 1572 movff WREG,ignore_digits ; no 1000m |
1561 bcf leftbind | 1573 bcf leftbind |
1562 output_16dp .3 ; xxx.y | 1574 output_16dp .3 ; xxx.y |
1563 STRCAT_TEXT tMeters | 1575 STRCAT_TEXT tMeters |
1564 PUTC ' ' | 1576 PUTC ' ' |
1565 | 1577 |
1566 display_listdive3: | 1578 display_listdive3: |
1567 call ext_flash_byte_read_plus | 1579 call ext_flash_byte_read_plus |
1568 movff temp1,lo ; read divetime minutes | 1580 movff temp1,lo ; read divetime minutes |
1569 call ext_flash_byte_read_plus | 1581 call ext_flash_byte_read_plus |
1570 movff temp1,hi | 1582 movff temp1,hi |
1571 output_16_3 ; Divetime minutes (0-999min) | 1583 output_16_3 ; Divetime minutes (0-999min) |
1572 STRCAT_TEXT tMinutes | 1584 STRCAT_TEXT tMinutes |
1573 clrf WREG | 1585 clrf WREG |
1574 movff WREG,buffer+.21 ; limit to 21 chars | 1586 movff WREG,buffer+.21 ; limit to 21 chars |
1575 STRCAT_PRINT "" ; Display header-row in list | 1587 STRCAT_PRINT "" ; Display header-row in list |
1576 return | 1588 return |
1577 | 1589 |
1578 logbook_show_divenumber: | 1590 logbook_show_divenumber: |
1579 call do_logoffset_common_read ; Read into lo:hi | 1591 call do_logoffset_common_read ; Read into lo:hi |
1589 incf hi,F ; hi:lo = hi:lo + 1 | 1601 incf hi,F ; hi:lo = hi:lo + 1 |
1590 movff lo,sub_a+0 | 1602 movff lo,sub_a+0 |
1591 movff hi,sub_a+1 | 1603 movff hi,sub_a+1 |
1592 movff divesecs,sub_b+0 | 1604 movff divesecs,sub_b+0 |
1593 clrf sub_b+1 | 1605 clrf sub_b+1 |
1594 call subU16 ; sub_c = sub_a - sub_b | 1606 call subU16 ; sub_c = sub_a - sub_b |
1595 movff sub_c+0,lo | 1607 movff sub_c+0,lo |
1596 movff sub_c+1,hi | 1608 movff sub_c+1,hi |
1597 | 1609 |
1598 logbook_show_divenumber3: | 1610 logbook_show_divenumber3: |
1599 WIN_MEDIUM logbook_divenumer_column, logbook_divenumer_row | 1611 WIN_MEDIUM logbook_divenumer_column, logbook_divenumer_row |
1600 bsf leftbind | 1612 bsf leftbind |
1601 output_16 ; # of dive in logbook | 1613 output_16 ; # of dive in logbook |
1602 bcf leftbind | 1614 bcf leftbind |
1603 STRCAT_PRINT "" | 1615 STRCAT_PRINT "" |
1604 return | 1616 return |
1605 | 1617 |
1606 | 1618 |
1607 logbook_page2: ; Show more info | 1619 logbook_page2: ; Show more info |
1608 rcall log_details_header ; Shows number, time/date and basic dive info | 1620 rcall log_details_header ; Shows number, time/date and basic dive info |
1609 | 1621 |
1610 ; Deco model | 1622 ; Deco model |
1611 WIN_SMALL .5,.65 | 1623 WIN_SMALL .5,.65 |
1612 LOG_POINT_TO log_decomodel | 1624 LOG_POINT_TO log_decomodel |
1613 call ext_flash_byte_read_plus ; read deco model | 1625 call ext_flash_byte_read_plus ; read deco model |
1614 movff temp1,lo | 1626 movff temp1,lo |
1615 decfsz temp1,F | 1627 decfsz temp1,F |
1616 bra logbook_decomodel1 | 1628 bra logbook_decomodel1 |
1617 ; Deco model GF Version | 1629 ; Deco model GF Version |
1618 STRCAT_TEXT_PRINT tZHL16GF | 1630 STRCAT_PRINT "ZH-L16+GF" |
1619 LOG_POINT_TO log_gf_lo | 1631 LOG_POINT_TO log_gf_lo |
1620 WIN_SMALL .5,.90 | 1632 WIN_SMALL .5,.90 |
1621 STRCPY_TEXT tGF | 1633 STRCPY_TEXT tGF |
1622 call ext_flash_byte_read_plus ; Read GF lo | 1634 call ext_flash_byte_read_plus ; Read GF lo |
1623 movff temp1,lo | 1635 movff temp1,lo |
1624 output_8 | 1636 output_8 |
1625 STRCAT "%/" | 1637 STRCAT "%/" |
1626 bra logbook_decomodel_common | 1638 bra logbook_decomodel_common |
1627 logbook_decomodel1: | 1639 logbook_decomodel1: |
1628 ; Deco model NON-GF Version | 1640 ; Deco model NON-GF Version |
1629 STRCAT_TEXT_PRINT tZHL16 | 1641 STRCAT_PRINT "ZH-L16" |
1630 LOG_POINT_TO log_sat_mult | 1642 LOG_POINT_TO log_sat_mult |
1631 WIN_SMALL .5,.90 | 1643 WIN_SMALL .5,.90 |
1632 call ext_flash_byte_read_plus ; Read sat_mult | 1644 call ext_flash_byte_read_plus ; Read sat_mult |
1633 movff temp1,lo | 1645 movff temp1,lo |
1634 output_8 | 1646 output_8 |
1635 STRCAT "%/" | 1647 STRCAT "%/" |
1636 logbook_decomodel_common: | 1648 logbook_decomodel_common: |
1637 call ext_flash_byte_read_plus ; Read desat_mult or GF_hi | 1649 call ext_flash_byte_read_plus ; Read desat_mult or GF_hi |
1638 movff temp1,lo | 1650 movff temp1,lo |
1639 output_8 | 1651 output_8 |
1640 STRCAT_PRINT "%" | 1652 STRCAT_PRINT "%" |
1641 | 1653 |
1642 ; CNS | 1654 ; CNS |
1643 LOG_POINT_TO log_cns_start | 1655 LOG_POINT_TO log_cns_start |
1644 WIN_SMALL .5,.115 | 1656 WIN_SMALL .5,.115 |
1645 STRCPY_TEXT tCNS2 | 1657 STRCPY_TEXT tCNS2 |
1646 call ext_flash_byte_read_plus ; read cns low | 1658 call ext_flash_byte_read_plus ; read cns low |
1647 movff temp1,lo | 1659 movff temp1,lo |
1648 call ext_flash_byte_read_plus ; read cns high | 1660 call ext_flash_byte_read_plus ; read cns high |
1649 movff temp1,hi | 1661 movff temp1,hi |
1650 output_16 | 1662 output_16 |
1651 LOG_POINT_TO log_cns_end | 1663 LOG_POINT_TO log_cns_end |
1652 STRCAT "->" | 1664 STRCAT "->" |
1653 call ext_flash_byte_read_plus ; read CNS low | 1665 call ext_flash_byte_read_plus ; read CNS low |
1654 movff temp1,lo | 1666 movff temp1,lo |
1655 call ext_flash_byte_read_plus ; read CNS high | 1667 call ext_flash_byte_read_plus ; read CNS high |
1656 movff temp1,hi | 1668 movff temp1,hi |
1657 output_16 | 1669 output_16 |
1658 STRCAT_PRINT "%" | 1670 STRCAT_PRINT "%" |
1659 | 1671 |
1660 ; Salinity | 1672 ; Salinity |
1661 WIN_SMALL .5,.140 | 1673 WIN_SMALL .5,.140 |
1662 LOG_POINT_TO log_salinity | 1674 LOG_POINT_TO log_salinity |
1663 STRCPY_TEXT tDvSalinity | 1675 STRCPY_TEXT tDvSalinity |
1664 bsf leftbind | 1676 bsf leftbind |
1665 call ext_flash_byte_read_plus ; read salinity | 1677 call ext_flash_byte_read_plus ; read salinity |
1666 movff temp1,lo | 1678 movff temp1,lo |
1667 movff temp1,total_divetime_seconds+1 ; backup for average depth display | 1679 movff temp1,total_divetime_seconds+1 ; backup for average depth display |
1668 output_8 | 1680 output_8 |
1669 STRCAT_PRINT "%" | 1681 STRCAT_PRINT "%" |
1670 | 1682 |
1671 ; Average depth | 1683 ; Average depth |
1672 WIN_SMALL .5,.165 | 1684 WIN_SMALL .5,.165 |
1673 STRCPY_TEXT tAVG | 1685 STRCPY_TEXT tAVG |
1674 LOG_POINT_TO log_avr_depth | 1686 LOG_POINT_TO log_avr_depth |
1675 call ext_flash_byte_read_plus ; read avr low | 1687 call ext_flash_byte_read_plus ; read avr low |
1676 movff temp1,lo | 1688 movff temp1,lo |
1677 call ext_flash_byte_read_plus ; read avr high | 1689 call ext_flash_byte_read_plus ; read avr high |
1678 movff temp1,hi | 1690 movff temp1,hi |
1679 movf total_divetime_seconds+1,W ; salinity for this dive | 1691 movf total_divetime_seconds+1,W ; salinity for this dive |
1680 call adjust_depth_with_salinity_log ; computes salinity setting (FROM WREG!) into lo:hi [mbar] | 1692 call adjust_depth_with_salinity_log ; computes salinity setting (FROM WREG!) into lo:hi [mbar] |
1681 output_16dp .3 | 1693 output_16dp .3 |
1682 STRCAT_PRINT "m" | 1694 STRCAT_PRINT "m" |
1683 | 1695 |
1684 ; Last deco | 1696 ; Last deco |
1685 LOG_POINT_TO log_last_stop | 1697 LOG_POINT_TO log_last_stop |
1686 WIN_SMALL .5,.190 | 1698 WIN_SMALL .5,.190 |
1687 STRCPY_TEXT tLastDecostop | 1699 STRCPY_TEXT tLastDecostop |
1688 call ext_flash_byte_read_plus ; Read last stop | 1700 call ext_flash_byte_read_plus ; Read last stop |
1689 movff temp1,lo | 1701 movff temp1,lo |
1690 output_8 | 1702 output_8 |
1691 STRCAT_PRINT "m" | 1703 STRCAT_PRINT "m" |
1692 | 1704 |
1693 movlw color_lightblue | 1705 movlw color_lightblue |
1694 call TFT_set_color | 1706 call TFT_set_color |
1695 WIN_FRAME_COLOR16 .63,.220,.2,.105; Top, Bottom, Left, Right | 1707 WIN_FRAME_COLOR16 .63,.220,.2,.105 ; Top, Bottom, Left, Right |
1696 | 1708 |
1697 ; Firmware | 1709 ; Firmware |
1698 call TFT_standard_color | 1710 call TFT_standard_color |
1699 WIN_SMALL .110,.65 | 1711 WIN_SMALL .110,.65 |
1700 STRCAT "V:" | 1712 STRCAT "V:" |
1701 LOG_POINT_TO log_firmware | 1713 LOG_POINT_TO log_firmware |
1702 call ext_flash_byte_read_plus ; read firmware xx | 1714 call ext_flash_byte_read_plus ; read firmware xx |
1703 movff temp1,lo | 1715 movff temp1,lo |
1704 bsf neg_flag ; set flag for 2.15 or newer | 1716 bsf neg_flag ; set flag for 2.15 or newer |
1705 movlw .1 | 1717 movlw .1 |
1706 cpfsgt lo ; >1? | 1718 cpfsgt lo ; >1? |
1707 bcf neg_flag ; No, clear flag | 1719 bcf neg_flag ; No, clear flag |
1708 movlw .9 | 1720 movlw .9 |
1709 cpfslt lo ; <9? | 1721 cpfslt lo ; <9? |
1710 bcf neg_flag ; No, clear flag (When unit was updgraded from hwOS Sport (10.xx)) | 1722 bcf neg_flag ; No, clear flag (When unit was updgraded from hwOS Sport (10.xx)) |
1711 bsf leftbind | 1723 bsf leftbind |
1712 output_8 | 1724 output_8 |
1713 PUTC "." | 1725 PUTC "." |
1714 call ext_flash_byte_read_plus ; read firmware yy | 1726 call ext_flash_byte_read_plus ; read firmware yy |
1715 movff temp1,lo | 1727 movff temp1,lo |
1716 movlw .14 | 1728 movlw .14 |
1717 cpfsgt lo ; >14? | 1729 cpfsgt lo ; >14? |
1718 bcf neg_flag ; No, clear flag | 1730 bcf neg_flag ; No, clear flag |
1719 output_99x | 1731 output_99x |
1720 STRCAT_PRINT "" | 1732 STRCAT_PRINT "" |
1721 | 1733 |
1722 btfss neg_flag ; set flag for 2.15 or newer | 1734 btfss neg_flag ; set flag for 2.15 or newer |
1723 bra logbook_no_batt_info | 1735 bra logbook_no_batt_info |
1724 | 1736 |
1725 ; Battery percent (for dives with 2.15 or newer) | 1737 ; Battery percent (for dives with 2.15 or newer) |
1726 WIN_SMALL .110,.140 | 1738 WIN_SMALL .110,.140 |
1727 LOG_POINT_TO log_batt_info ; Battery percent | 1739 LOG_POINT_TO log_batt_info ; Battery percent |
1728 call ext_flash_byte_read_plus ; read battery low | 1740 call ext_flash_byte_read_plus ; read battery low |
1729 movff temp1,lo | 1741 movff temp1,lo |
1730 output_8 | 1742 output_8 |
1731 STRCAT_PRINT "%" | 1743 STRCAT_PRINT "%" |
1732 | 1744 |
1733 logbook_no_batt_info: ; dives with firmware <2.15 | 1745 logbook_no_batt_info: ; dives with firmware <2.15 |
1734 | 1746 |
1735 ; Battery voltage | 1747 ; Battery voltage |
1736 WIN_SMALL .110,.90 | 1748 WIN_SMALL .110,.90 |
1737 STRCAT_PRINT "Batt:" | 1749 STRCAT_PRINT "Batt:" |
1738 WIN_SMALL .110,.115 | 1750 WIN_SMALL .110,.115 |
1739 LOG_POINT_TO log_battery ; Battery voltage... | 1751 LOG_POINT_TO log_battery ; Battery voltage... |
1740 call ext_flash_byte_read_plus ; read battery low | 1752 call ext_flash_byte_read_plus ; read battery low |
1741 movff temp1,lo | 1753 movff temp1,lo |
1742 call ext_flash_byte_read_plus ; read battery high | 1754 call ext_flash_byte_read_plus ; read battery high |
1743 movff temp1,hi | 1755 movff temp1,hi |
1744 output_16dp .2 | 1756 output_16dp .2 |
1745 STRCAT_PRINT "V" | 1757 STRCAT_PRINT "V" |
1746 | 1758 |
1747 ; surface pressure in mbar | 1759 ; surface pressure in mbar |
1748 LOG_POINT_TO log_surface_press | 1760 LOG_POINT_TO log_surface_press |
1749 call ext_flash_byte_read_plus ; read surface pressure | 1761 call ext_flash_byte_read_plus ; read surface pressure |
1750 movff temp1,lo | 1762 movff temp1,lo |
1751 call ext_flash_byte_read_plus ; read surface pressure | 1763 call ext_flash_byte_read_plus ; read surface pressure |
1752 movff temp1,hi | 1764 movff temp1,hi |
1753 WIN_SMALL .110,.165 | 1765 WIN_SMALL .110,.165 |
1754 lfsr FSR2,buffer | 1766 lfsr FSR2,buffer |
1755 bsf leftbind | 1767 bsf leftbind |
1756 output_16 ; Air pressure before dive | 1768 output_16 ; Air pressure before dive |
1757 STRCAT_TEXT tMBAR | 1769 STRCAT_TEXT tMBAR |
1758 clrf WREG | 1770 clrf WREG |
1759 movff WREG,buffer+7 ; limit to 7 chars | 1771 movff WREG,buffer+7 ; limit to 7 chars |
1760 STRCAT_PRINT "" | 1772 STRCAT_PRINT "" |
1761 | 1773 |
1762 movlw color_greenish | 1774 movlw color_greenish |
1763 call TFT_set_color | 1775 call TFT_set_color |
1764 WIN_FRAME_COLOR16 .63,.220,.107,.159; Top, Bottom, Left, Right | 1776 WIN_FRAME_COLOR16 .63,.220,.107,.159 ; Top, Bottom, Left, Right |
1765 | 1777 |
1766 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco | 1778 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco |
1767 display_details_loop: | 1779 display_details_loop: |
1768 btfsc switch_left ; SET/MENU? | 1780 ; REPLACE ## logbook look and feel |
1769 bra logbook_page3 ; Details, 2nd page | 1781 ; btfsc switch_left ; SET/MENU? |
1770 btfsc switch_right ; ENTER? | 1782 ; BY |
1771 bra exit_profileview ; back to list | 1783 btfsc switch_right |
1784 bra logbook_page3 ; Details, 2nd page | |
1785 ; REPLACE ## logbook look and feel | |
1786 ; btfsc switch_right ; ENTER? | |
1787 btfsc switch_left | |
1788 bra exit_profileview ; back to list | |
1772 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second | 1789 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second |
1773 btfsc sleepmode ; Timeout? | 1790 btfsc sleepmode ; Timeout? |
1774 bra exit_profileview ; back to list | 1791 bra exit_profileview ; back to list |
1775 bra display_details_loop ; wait for something to do | 1792 bra display_details_loop ; wait for something to do |
1776 | 1793 |
1777 global logbook_preloop_tasks | 1794 global logbook_preloop_tasks |
1778 logbook_preloop_tasks: | 1795 logbook_preloop_tasks: |
1779 movlw CCP1CON_VALUE ; See hwos.inc | 1796 movlw CCP1CON_VALUE ; See hwos.inc |
1780 movwf CCP1CON ; Power-on backlight | 1797 movwf CCP1CON ; Power-on backlight |
1781 call TFT_standard_color | 1798 call TFT_standard_color |
1782 bcf sleepmode ; clear some flags | 1799 bcf sleepmode ; clear some flags |
1783 bcf switch_right | 1800 bcf switch_right |
1784 bcf switch_left | 1801 bcf switch_left |
1785 clrf timeout_counter2 | 1802 clrf timeout_counter2 |
1786 goto speed_normal ; and return | 1803 goto speed_normal ; and return |
1787 | 1804 |
1788 | 1805 |
1789 logbook_page3: ; Show even more info | 1806 logbook_page3: ; Show even more info |
1790 rcall log_details_header ; Shows number, time/date and basic dive info | 1807 rcall log_details_header ; Shows number, time/date and basic dive info |
1791 | 1808 |
1792 ; OC/CC Gas List | 1809 ; REPLACE ## logbook look and feel |
1810 ; ; OC/CC Gas List | |
1811 ; LOG_POINT_TO log_divemode | |
1812 ; call ext_flash_byte_read_plus ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into temp1 | |
1813 ; WIN_SMALL .5,.65 | |
1814 ; WIN_COLOR color_greenish | |
1815 ; STRCPY_TEXT_PRINT tGaslist ; "OC Gas List" / tGaslistCC | |
1816 ; BY | |
1793 bcf leftbind | 1817 bcf leftbind |
1794 LOG_POINT_TO log_gas1 | 1818 LOG_POINT_TO log_gas1 |
1795 movlw color_white ; Color for Gas 1 | 1819 movlw color_white ; Color for Gas 1 |
1796 call TFT_set_color ; Set Color... | 1820 call TFT_set_color ; Set Color... |
1797 WIN_SMALL .5,.90 | 1821 WIN_SMALL .5,.90 |
1798 rcall log_show_gas_common2 | 1822 rcall log_show_gas_common2 |
1799 movlw color_green ; Color for Gas 2 | 1823 movlw color_green ; Color for Gas 2 |
1800 call TFT_set_color ; Set Color... | 1824 call TFT_set_color ; Set Color... |
1801 WIN_SMALL .5,.115 | 1825 WIN_SMALL .5,.115 |
1802 rcall log_show_gas_common2 | 1826 rcall log_show_gas_common2 |
1803 movlw color_red ; Color for Gas 3 | 1827 movlw color_red ; Color for Gas 3 |
1804 call TFT_set_color ; Set Color... | 1828 call TFT_set_color ; Set Color... |
1805 WIN_SMALL .5,.140 | 1829 WIN_SMALL .5,.140 |
1806 rcall log_show_gas_common2 | 1830 rcall log_show_gas_common2 |
1807 movlw color_yellow ; Color for Gas 4 | 1831 movlw color_yellow ; Color for Gas 4 |
1808 call TFT_set_color ; Set Color... | 1832 call TFT_set_color ; Set Color... |
1809 WIN_SMALL .5,.165 | 1833 WIN_SMALL .5,.165 |
1810 rcall log_show_gas_common2 | 1834 rcall log_show_gas_common2 |
1811 movlw color_cyan ; Color for Gas 5 | 1835 movlw color_cyan ; Color for Gas 5 |
1812 call TFT_set_color ; Set Color... | 1836 call TFT_set_color ; Set Color... |
1813 WIN_SMALL .5,.190 | 1837 WIN_SMALL .5,.190 |
1814 rcall log_show_gas_common2 | 1838 rcall log_show_gas_common2 |
1815 | |
1816 ; OC/CC Gas List | 1839 ; OC/CC Gas List |
1817 WIN_SMALL .5,.65 | 1840 WIN_SMALL .5,.65 |
1818 WIN_COLOR color_greenish | 1841 WIN_COLOR color_greenish |
1819 LOG_POINT_TO log_divemode | 1842 LOG_POINT_TO log_divemode |
1820 call ext_flash_byte_read_plus ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into temp1 | 1843 call ext_flash_byte_read_plus ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into temp1 |
1821 decfsz temp1,w ; =1 (CC)? | 1844 decfsz temp1,w ; =1 (CC)? |
1822 bra logbook_page3a | 1845 bra logbook_page3a |
1823 STRCPY_TEXT_PRINT tGaslistCC ; CC | 1846 STRCPY_TEXT_PRINT tGaslistCC |
1824 bra logbook_page3b | 1847 bra logbook_page3b |
1825 logbook_page3a: | 1848 logbook_page3a: |
1826 STRCPY_TEXT_PRINT tGaslist ; OC | 1849 STRCPY_TEXT_PRINT tGaslist |
1827 logbook_page3b: | 1850 logbook_page3b: |
1851 | |
1828 movlw color_lightblue | 1852 movlw color_lightblue |
1829 call TFT_set_color | 1853 call TFT_set_color |
1830 WIN_FRAME_COLOR16 .63,.220,.2,.90; Top, Bottom, Left, Right | 1854 WIN_FRAME_COLOR16 .63,.220,.2,.90 ; Top, Bottom, Left, Right |
1831 | 1855 |
1832 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco | 1856 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco |
1833 display_details2_loop: | 1857 display_details2_loop: |
1834 btfsc switch_left ; SET/MENU? | 1858 ; REPLACE ## logbook look and feel |
1835 goto logbook_page4 ; Show more info | 1859 ; btfsc switch_left ; SET/MENU? |
1836 btfsc switch_right ; ENTER? | 1860 ; BY |
1837 bra exit_profileview ; back to list | 1861 btfsc switch_right |
1862 goto logbook_page4 ; Show more info | |
1863 ; REPLACE ## logbook look and feel | |
1864 ; btfsc switch_right ; ENTER? | |
1865 ; BY | |
1866 btfsc switch_left | |
1867 bra exit_profileview ; back to list | |
1838 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second | 1868 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second |
1839 btfsc sleepmode ; Timeout? | 1869 btfsc sleepmode ; Timeout? |
1840 bra exit_profileview ; back to list | 1870 bra exit_profileview ; back to list |
1841 bra display_details2_loop ; wait for something to do | 1871 bra display_details2_loop ; wait for something to do |
1842 | 1872 |
1843 logbook_page4: ; Show even more info in CC mode | 1873 logbook_page4: ; Show even more info in CC mode |
1844 LOG_POINT_TO log_divemode | 1874 LOG_POINT_TO log_divemode |
1845 call ext_flash_byte_read ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into WREG and temp1 | 1875 call ext_flash_byte_read ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into WREG and temp1 |
1846 decfsz temp1,w ; =1 (CC)? | 1876 decfsz temp1,w ; =1 (CC)? |
1847 goto display_profile2 ; no | 1877 goto display_profile2 ; no |
1848 | 1878 |
1849 rcall log_details_header ; Shows number, time/date and basic dive info | 1879 rcall log_details_header ; Shows number, time/date and basic dive info |
1850 ; Setpoint list | 1880 ; Setpoint list |
1851 LOG_POINT_TO log_sp1 | 1881 LOG_POINT_TO log_sp1 |
1852 WIN_SMALL .5,.65 | 1882 WIN_SMALL .5,.65 |
1853 WIN_COLOR color_greenish | 1883 WIN_COLOR color_greenish |
1854 STRCPY_TEXT_PRINT tFixedSetpoints | 1884 STRCPY_TEXT_PRINT tFixedSetpoints |
1855 call TFT_standard_color | 1885 call TFT_standard_color |
1864 WIN_SMALL .5,.190 | 1894 WIN_SMALL .5,.190 |
1865 rcall log_show_sp_common | 1895 rcall log_show_sp_common |
1866 | 1896 |
1867 movlw color_greenish | 1897 movlw color_greenish |
1868 call TFT_set_color | 1898 call TFT_set_color |
1869 WIN_FRAME_COLOR16 .63,.220,.2,.112; Top, Bottom, Left, Right | 1899 WIN_FRAME_COLOR16 .63,.220,.2,.112 ; Top, Bottom, Left, Right |
1870 | 1900 |
1871 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco | 1901 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco |
1872 display_details3_loop: | 1902 display_details3_loop: |
1873 btfsc switch_left ; SET/MENU? | 1903 ; REPLACE ## logbook look and feel |
1874 goto display_profile2 ; Show the profile view again | 1904 ; btfsc switch_left ; SET/MENU? |
1875 btfsc switch_right ; ENTER? | 1905 ; BY |
1876 bra exit_profileview ; back to list | 1906 btfsc switch_right |
1907 goto display_profile2 ; Show the profile view again | |
1908 ; REPLACE ## logbook look and feel | |
1909 ; btfsc switch_right ; ENTER? | |
1910 ; BY | |
1911 btfsc switch_left | |
1912 bra exit_profileview ; back to list | |
1877 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second | 1913 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second |
1878 btfsc sleepmode ; Timeout? | 1914 btfsc sleepmode ; Timeout? |
1879 bra exit_profileview ; back to list | 1915 bra exit_profileview ; back to list |
1880 bra display_details3_loop ; wait for something to do | 1916 bra display_details3_loop ; wait for something to do |
1881 | |
1882 | 1917 |
1883 | 1918 |
1884 log_details_header: | 1919 log_details_header: |
1885 clrf CCP1CON ; stop PWM | 1920 clrf CCP1CON ; stop PWM |
1886 bcf PORTC,2 ; Pull PWM out to GND | 1921 bcf PORTC,2 ; Pull PWM out to GND |
1887 call TFT_boot | 1922 call TFT_boot |
1888 ;call TFT_ClearScreen ; Clear screen | 1923 ;call TFT_ClearScreen ; Clear screen |
1889 | 1924 |
1890 ; Set ext_flash pointer to "#divesecs-oldest" dive | 1925 ; Set ext_flash pointer to "#divesecs-oldest" dive |
1891 ; compute read_int_eeprom .2 - divesecs | 1926 ; compute read_int_eeprom .2 - divesecs |
1892 ; Read required header data for profile display | 1927 ; Read required header data for profile display |
1893 ; look in header for pointer to begin of diveprofile (Byte 2-4) | 1928 ; look in header for pointer to begin of diveprofile (Byte 2-4) |
1894 ; Set pointer (ext_flash_log_pointer:3) to this address, start drawing | 1929 ; Set pointer (ext_flash_log_pointer:3) to this address, start drawing |
1895 | 1930 |
1896 decf divesecs,F ;-1 | 1931 decf divesecs,F ;-1 |
1897 read_int_eeprom .2 | 1932 read_int_eeprom .2 |
1898 movf EEDATA,W | 1933 movf EEDATA,W |
1899 bcf STATUS,C | 1934 bcf STATUS,C |
1900 subfwb divesecs,W ; max. dives (low value) - divesecs | 1935 subfwb divesecs,W ; max. dives (low value) - divesecs |
1901 movwf lo ; result | 1936 movwf lo ; result |
1902 incf divesecs,F ;+1 | 1937 incf divesecs,F ;+1 |
1903 ; Set ext_flash_address:3 to TOC entry of this dive | 1938 ; Set ext_flash_address:3 to TOC entry of this dive |
1904 ; 1st: 200000h-200FFFh -> lo=0 | 1939 ; 1st: 200000h-200FFFh -> lo=0 |
1905 ; 2nd: 201000h-201FFFh -> lo=1 | 1940 ; 2nd: 201000h-201FFFh -> lo=1 |
1906 ; 3rd: 202000h-202FFFh -> lo=2 | 1941 ; 3rd: 202000h-202FFFh -> lo=2 |
1907 ; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...) | 1942 ; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...) |
1908 clrf ext_flash_address+0 | 1943 clrf ext_flash_address+0 |
1909 clrf ext_flash_address+1 | 1944 clrf ext_flash_address+1 |
1910 movlw 0x20 | 1945 movlw 0x20 |
1911 movwf ext_flash_address+2 | 1946 movwf ext_flash_address+2 |
1912 movlw .16 | 1947 movlw .16 |
1913 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) | 1948 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) |
1914 movf PRODL,W | 1949 movf PRODL,W |
1915 addwf ext_flash_address+1,F | 1950 addwf ext_flash_address+1,F |
1916 movf PRODH,W | 1951 movf PRODH,W |
1917 addwfc ext_flash_address+2,F | 1952 addwfc ext_flash_address+2,F |
1918 ; pointer at the first 0xFA of header | 1953 ; pointer at the first 0xFA of header |
1919 rcall logbook_show_divenumber ; Show the dive number in medium font | 1954 rcall logbook_show_divenumber ; Show the dive number in medium font |
1920 ; Show date and time in first row | 1955 ; Show date and time in first row |
1921 WIN_SMALL .59,.10 | 1956 WIN_SMALL .59,.10 |
1922 LOG_POINT_TO log_date | 1957 LOG_POINT_TO log_date |
1923 call ext_flash_byte_read_plus | 1958 call ext_flash_byte_read_plus |
1924 movff temp1,convert_value_temp+2 ; Year | 1959 movff temp1,convert_value_temp+2 ; Year |
1925 call ext_flash_byte_read_plus | 1960 call ext_flash_byte_read_plus |
1926 movff temp1,convert_value_temp+0 ; Month | 1961 movff temp1,convert_value_temp+0 ; Month |
1927 call ext_flash_byte_read_plus | 1962 call ext_flash_byte_read_plus |
1928 movff temp1,convert_value_temp+1 ; Day | 1963 movff temp1,convert_value_temp+1 ; Day |
1929 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | 1964 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 |
1930 PUTC "-" | 1965 PUTC "-" |
1931 call ext_flash_byte_read_plus ; hour | 1966 call ext_flash_byte_read_plus ; hour |
1932 movff temp1,lo | 1967 movff temp1,lo |
1933 call ext_flash_byte_read_plus ; Minutes | 1968 call ext_flash_byte_read_plus ; Minutes |
1934 movff temp1,hi | 1969 movff temp1,hi |
1935 output_99x ; hour | 1970 output_99x ; hour |
1936 PUTC ':' | 1971 PUTC ':' |
1937 movff hi,lo | 1972 movff hi,lo |
1938 output_99x ; minute | 1973 output_99x ; minute |
1939 STRCAT_PRINT "" ; Display 1st row of details | 1974 STRCAT_PRINT "" ; Display 1st row of details |
1940 | 1975 |
1941 ; Show max depth and dive time | 1976 ; Show max depth and dive time |
1942 WIN_SMALL .5,.35 | 1977 WIN_SMALL .5,.35 |
1943 STRCAT "Max:" | 1978 STRCAT "Max:" |
1944 LOG_POINT_TO log_max_depth | 1979 LOG_POINT_TO log_max_depth |
1945 call ext_flash_byte_read_plus ; read max depth | 1980 call ext_flash_byte_read_plus ; read max depth |
1946 movff temp1,lo | 1981 movff temp1,lo |
1947 call ext_flash_byte_read_plus ; read max depth | 1982 call ext_flash_byte_read_plus ; read max depth |
1948 movff temp1,hi | 1983 movff temp1,hi |
1949 | 1984 |
1950 TSTOSS opt_units ; 0=Meters, 1=Feets | 1985 TSTOSS opt_units ; 0=Meters, 1=Feets |
1951 bra logbook_page2_depth_metric | 1986 bra logbook_page2_depth_metric |
1952 ; imperial | 1987 ; imperial |
1953 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | 1988 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
1954 PUTC ' ' | 1989 PUTC ' ' |
1955 bcf leftbind | 1990 bcf leftbind |
1956 output_16_3 | 1991 output_16_3 |
1957 STRCAT_TEXT tFeets | 1992 STRCAT_TEXT tFeets |
1958 bra logbook_page2_depth_common | 1993 bra logbook_page2_depth_common |
1959 | 1994 |
1960 logbook_page2_depth_metric: | 1995 logbook_page2_depth_metric: |
1961 bsf leftbind | 1996 bsf leftbind |
1962 output_16dp d'3' ; max. depth | 1997 output_16dp d'3' ; max. depth |
1963 STRCAT_TEXT tMeters | 1998 STRCAT_TEXT tMeters |
1964 | 1999 |
1965 logbook_page2_depth_common: | 2000 logbook_page2_depth_common: |
1966 STRCAT " - " | 2001 STRCAT " - " |
1967 call ext_flash_byte_read_plus ; divetime in minutes | 2002 call ext_flash_byte_read_plus ; divetime in minutes |
1968 movff temp1,lo | 2003 movff temp1,lo |
1969 call ext_flash_byte_read_plus | 2004 call ext_flash_byte_read_plus |
1970 movff temp1,hi ; divetime in minutes | 2005 movff temp1,hi ; divetime in minutes |
1971 | 2006 |
1972 bsf leftbind | 2007 bsf leftbind |
1973 output_16 ; divetime minutes | 2008 output_16 ; divetime minutes |
1974 PUTC "m" | 2009 PUTC "m" |
1975 LOG_POINT_TO log_divetime+.2 | 2010 LOG_POINT_TO log_divetime+.2 |
1976 call ext_flash_byte_read_plus ; read divetime seconds | 2011 call ext_flash_byte_read_plus ; read divetime seconds |
1977 movff temp1,lo | 2012 movff temp1,lo |
1978 bsf leftbind | 2013 bsf leftbind |
1979 output_99x ; divetime seconds | 2014 output_99x ; divetime seconds |
1980 call TFT_standard_color | 2015 call TFT_standard_color |
1981 STRCAT_PRINT "s" | 2016 STRCAT_PRINT "s" |
1982 ; ; Dive mode | 2017 ; ; Dive mode |
1983 ; LOG_POINT_TO log_divemode | 2018 ; LOG_POINT_TO log_divemode |
1984 ; call ext_flash_byte_read_plus ; Read divemode | 2019 ; call ext_flash_byte_read_plus ; Read divemode |
1985 ; movff temp1,lo | 2020 ; movff temp1,lo |
1986 ; call TFT_display_decotype_surface1 ; "strcat_print"s divemode (OC, CC, APNEA or GAUGE) | 2021 ; call TFT_display_decotype_surface1 ; "strcat_print"s divemode (OC, CC, APNEA or GAUGE) |
1987 return | 2022 return |
1988 | 2023 |
1989 | 2024 |
1990 log_show_sp_common: | 2025 log_show_sp_common: |
1991 lfsr FSR2,buffer | 2026 lfsr FSR2,buffer |
1992 call ext_flash_byte_read_plus ; Read setpoint | 2027 call ext_flash_byte_read_plus ; Read setpoint |
1993 movff temp1,lo | 2028 movff temp1,lo |
1994 clrf hi | 2029 clrf hi |
1995 bsf leftbind | 2030 bsf leftbind |
1996 output_16dp d'3' | 2031 output_16dp d'3' |
1997 bcf leftbind | 2032 bcf leftbind |
1998 STRCAT_TEXT tbar | 2033 STRCAT_TEXT tbar |
1999 PUTC " " | 2034 PUTC " " |
2000 call ext_flash_byte_read_plus ; change depth | 2035 call ext_flash_byte_read_plus ; change depth |
2001 movff temp1,lo | 2036 movff temp1,lo |
2002 | 2037 |
2003 TSTOSS opt_units ; 0=Meters, 1=Feets | 2038 TSTOSS opt_units ; 0=Meters, 1=Feets |
2004 bra log_show_sp_common_metric | 2039 bra log_show_sp_common_metric |
2005 movf lo,W | 2040 movf lo,W |
2006 mullw .100 ; convert meters to mbar | 2041 mullw .100 ; convert meters to mbar |
2007 movff PRODL,lo | 2042 movff PRODL,lo |
2008 movff PRODH,hi | 2043 movff PRODH,hi |
2009 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | 2044 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
2010 output_16 | 2045 output_16 |
2011 STRCAT_TEXT tFeets ; "ft" | 2046 STRCAT_TEXT tFeets ; "ft" |
2012 bra log_show_sp_common_common | 2047 bra log_show_sp_common_common |
2013 log_show_sp_common_metric: | 2048 log_show_sp_common_metric: |
2014 output_8 | 2049 output_8 |
2015 STRCAT_TEXT tMeters ; "m" | 2050 STRCAT_TEXT tMeters ; "m" |
2016 log_show_sp_common_common: | 2051 log_show_sp_common_common: |
2017 STRCAT_PRINT "" | 2052 STRCAT_PRINT "" |
2018 return | 2053 return |
2019 | 2054 |
2020 log_show_gas_common2: ; as log_show_gas_common but with change depth | 2055 log_show_gas_common2: ; as log_show_gas_common but with change depth |
2021 lfsr FSR2,buffer | 2056 lfsr FSR2,buffer |
2022 call ext_flash_byte_read_plus ; current O2 | 2057 call ext_flash_byte_read_plus ; current O2 |
2023 movff temp1,lo | 2058 movff temp1,lo |
2024 call ext_flash_byte_read_plus ; current He | 2059 call ext_flash_byte_read_plus ; current He |
2025 movff temp1,hi | 2060 movff temp1,hi |
2026 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | 2061 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 |
2027 call ext_flash_byte_read_plus ; change depth | 2062 call ext_flash_byte_read_plus ; change depth |
2028 movff temp1,lo | 2063 movff temp1,lo |
2029 | 2064 |
2030 TSTOSS opt_units ; 0=Meters, 1=Feets | 2065 TSTOSS opt_units ; 0=Meters, 1=Feets |
2031 bra log_show_gas_common2_metric | 2066 bra log_show_gas_common2_metric |
2032 movf lo,W | 2067 movf lo,W |
2033 mullw .100 ; convert meters to mbar | 2068 mullw .100 ; convert meters to mbar |
2034 movff PRODL,lo | 2069 movff PRODL,lo |
2035 movff PRODH,hi | 2070 movff PRODH,hi |
2036 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | 2071 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
2037 output_16 | 2072 output_16 |
2038 STRCAT_TEXT tFeets ; "ft" | 2073 STRCAT_TEXT tFeets ; "ft" |
2039 bra log_show_gas_common2_common | 2074 bra log_show_gas_common2_common |
2040 log_show_gas_common2_metric: | 2075 log_show_gas_common2_metric: |
2041 output_8 | 2076 output_8 |
2042 STRCAT_TEXT tMeters ; "m" | 2077 STRCAT_TEXT tMeters ; "m" |
2043 log_show_gas_common2_common: | 2078 log_show_gas_common2_common: |
2044 bcf leftbind | 2079 bcf leftbind |
2045 call ext_flash_byte_read_plus ; Gas Type | 2080 call ext_flash_byte_read_plus ; Gas Type |
2046 STRCAT_PRINT "" | 2081 STRCAT_PRINT "" |
2047 return | 2082 return |
2048 | 2083 |
2049 END | 2084 END |