comparison src/logbook.asm @ 392:32780516c8c6

NEW: Show actual dive count in logbook list view (If <1000)
author heinrichsweikamp
date Tue, 03 Nov 2015 11:35:29 +0100
parents 9175429bdeba
children a3a0f1fd7fc4
comparison
equal deleted inserted replaced
391:682199d87b5c 392:32780516c8c6
64 #DEFINE end_of_profile logbook_flags,3 64 #DEFINE end_of_profile logbook_flags,3
65 #DEFINE keep_cursor_new_page logbook_flags,4 65 #DEFINE keep_cursor_new_page logbook_flags,4
66 66
67 67
68 ; Logbook Coordinates 68 ; Logbook Coordinates
69 #DEFINE logbook_list_left .18 ; Column of dive# in list 69 #DEFINE logbook_list_left .10 ; Column of dive# in list
70 #DEFINE logbook_row_offset .28 ; Distance between rows of list 70 #DEFINE logbook_row_offset .28 ; Distance between rows of list
71 #DEFINE logbook_row_number .6 ; Amount of rows in the list 71 #DEFINE logbook_row_number .6 ; Amount of rows in the list
72 72
73 ; Profile display 73 ; Profile display
74 #DEFINE profile_height_pixels .157 ; Amount of pixels height for profile display 74 #DEFINE profile_height_pixels .157 ; Amount of pixels height for profile display
194 194
195 logbook code 195 logbook code
196 196
197 TFT_logbook_cursor: 197 TFT_logbook_cursor:
198 ; call speed_fastest 198 ; call speed_fastest
199 WIN_BOX_BLACK .0, .240-.16, logbook_list_left-.16, logbook_list_left-.1 ;top, bottom, left, right 199 WIN_BOX_BLACK .0, .240-.16, logbook_list_left-.8, logbook_list_left-.1 ;top, bottom, left, right
200 200
201 WIN_LEFT logbook_list_left-.16 201 WIN_LEFT logbook_list_left-.8
202 WIN_FONT FT_SMALL 202 WIN_FONT FT_SMALL
203 bcf win_invert ; Reset invert flag 203 ; bcf win_invert ; Reset invert flag
204 call TFT_standard_color 204 call TFT_standard_color
205 205
206 movff menupos,temp1 206 movff menupos,temp1
207 dcfsnz temp1,F 207 dcfsnz temp1,F
208 movlw d'0' 208 movlw d'0'
231 logbook: 231 logbook:
232 clrf logbook_flags 232 clrf logbook_flags
233 clrf CCP1CON ; stop PWM 233 clrf CCP1CON ; stop PWM
234 bcf PORTC,2 ; Pull PWM out to GND 234 bcf PORTC,2 ; Pull PWM out to GND
235 call TFT_ClearScreen ; Clear screen 235 call TFT_ClearScreen ; Clear screen
236 call TFT_standard_color 236 ; call TFT_standard_color
237 clrf menupos3 ; Here: used rows on current logbook-page 237 clrf menupos3 ; Here: used rows on current logbook-page
238 clrf logbook_page_number ; Here: # of current displayed page 238 clrf logbook_page_number ; Here: # of current displayed page
239 clrf logbook_divenumber ; # of dive in list during search 239 clrf logbook_divenumber ; # of dive in list during search
240 clrf divemins+0 ; Here: used as temp variables 240 clrf divemins+0 ; Here: used as temp variables
241 clrf divemins+1 241 clrf divemins+1
1116 btfsc rs232_recieve_overflow 1116 btfsc rs232_recieve_overflow
1117 return 1117 return
1118 movlw "l" 1118 movlw "l"
1119 cpfseq RCREG1 1119 cpfseq RCREG1
1120 return 1120 return
1121 call TFT_dump_screen ; Dump the screen contents 1121 goto TFT_dump_screen ; Dump the screen contents and return
1122 return
1123 1122
1124 log_show_gas_common: 1123 log_show_gas_common:
1125 extern customview_show_mix 1124 extern customview_show_mix
1126 lfsr FSR2,buffer 1125 lfsr FSR2,buffer
1127 call ext_flash_byte_read_plus ; Gas2 current O2 1126 call ext_flash_byte_read_plus ; Gas2 current O2
1129 call ext_flash_byte_read_plus ; Gas2 current He 1128 call ext_flash_byte_read_plus ; Gas2 current He
1130 movff temp1,hi 1129 movff temp1,hi
1131 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 1130 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2
1132 STRCAT_PRINT "" 1131 STRCAT_PRINT ""
1133 call ext_flash_byte_read_plus ; Gas2 change depth 1132 call ext_flash_byte_read_plus ; Gas2 change depth
1134 call ext_flash_byte_read_plus ; Gas2 Type 1133 goto ext_flash_byte_read_plus ; Gas2 Type and return
1135 return
1136 1134
1137 ;============================================================================= 1135 ;=============================================================================
1138 profile_display_color: 1136 profile_display_color:
1139 movff average_depth_hold_total+3,active_gas ; Restore gas color. 1137 movff average_depth_hold_total+3,active_gas ; Restore gas color.
1140 movlw color_white ; Default color 1138 movlw color_white ; Default color
1443 decf menupos3,W ; -1 into wreg 1441 decf menupos3,W ; -1 into wreg
1444 mullw logbook_row_offset 1442 mullw logbook_row_offset
1445 movff PRODL,win_top 1443 movff PRODL,win_top
1446 1444
1447 lfsr FSR2,buffer 1445 lfsr FSR2,buffer
1448 movff logbook_divenumber,lo 1446 call do_logoffset_common_read ; Read into lo:hi
1449 output_8 ; # of dive 1447 tstfsz lo ; lo=0?
1448 bra display_listdive1 ; No, adjust offset
1449 tstfsz hi ; hi=0?
1450 bra display_listdive1 ; No, adjust offset
1451 bra display_listdive1b ; Display now
1452
1453 display_listdive1:
1454 ; Check limit (lo:hi must be <1000)
1455 movlw LOW d'1000' ; Compare to 1000
1456 subwf lo,W
1457 movlw HIGH d'1000'
1458 subwfb hi,W
1459 bc display_listdive1b ; carry = no-borrow = > 1000, skip!
1460
1461 infsnz lo,F
1462 incf hi,F ; hi:lo = hi:lo + 1
1463 movff lo,sub_a+0
1464 movff hi,sub_a+1
1465 movff logbook_divenumber,sub_b+0
1466 clrf sub_b+1
1467 call subU16 ; sub_c = sub_a - sub_b
1468 movff sub_c+0,lo
1469 movff sub_c+1,hi
1470 bra display_listdive1a
1471
1472 display_listdive1b:
1473 clrf hi
1474 movff logbook_divenumber,lo ; lo=0 and hi=0 -> show without applied offset
1475 display_listdive1a:
1476 output_16_3 ; displays only last three figures from a 16Bit value (0-999), # of dive
1450 PUTC ' ' 1477 PUTC ' '
1451 LOG_POINT_TO log_date+1 ; Point to month 1478 LOG_POINT_TO log_date+1 ; Point to month
1452 call ext_flash_byte_read_plus 1479 call ext_flash_byte_read_plus
1453 movff temp1,lo ; read month 1480 movff temp1,lo ; read month
1454 1481
1490 call ext_flash_byte_read_plus 1517 call ext_flash_byte_read_plus
1491 movff temp1,hi 1518 movff temp1,hi
1492 output_16_3 ; Divetime minutes (0-999min) 1519 output_16_3 ; Divetime minutes (0-999min)
1493 STRCAT_TEXT tMinutes 1520 STRCAT_TEXT tMinutes
1494 clrf WREG 1521 clrf WREG
1495 movff WREG,buffer+.20 ; limit to 20 chars 1522 movff WREG,buffer+.21 ; limit to 21 chars
1496 STRCAT_PRINT "" ; Display header-row in list 1523 STRCAT_PRINT "" ; Display header-row in list
1497 return 1524 return
1498 1525
1499 logbook_show_divenumber: 1526 logbook_show_divenumber:
1500 call do_logoffset_common_read ; Read into lo:hi 1527 call do_logoffset_common_read ; Read into lo:hi
1777 call TFT_standard_color 1804 call TFT_standard_color
1778 bcf sleepmode ; clear some flags 1805 bcf sleepmode ; clear some flags
1779 bcf switch_right 1806 bcf switch_right
1780 bcf switch_left 1807 bcf switch_left
1781 clrf timeout_counter2 1808 clrf timeout_counter2
1782 call speed_normal 1809 goto speed_normal ; and return
1783 return
1784 1810
1785 log_show_sp_common: 1811 log_show_sp_common:
1786 lfsr FSR2,buffer 1812 lfsr FSR2,buffer
1787 call ext_flash_byte_read_plus ; Read setpoint 1813 call ext_flash_byte_read_plus ; Read setpoint
1788 movff temp1,lo 1814 movff temp1,lo