comparison code_part1/OSTC_code_asm_part1/menu_logbook.asm @ 245:dee88c962653

Some clean up and minor I2C speed improvements
author heinrichsweikamp
date Thu, 24 Mar 2011 21:51:36 +0100
parents 976260083540
children 571626276aaa
comparison
equal deleted inserted replaced
244:976260083540 245:dee88c962653
77 incf divemins+1,F 77 incf divemins+1,F
78 78
79 btfsc divemins+1,7 ; At 0x8000? 79 btfsc divemins+1,7 ; At 0x8000?
80 bra menu_logbook_reset ; yes, restart (if not empty) 80 bra menu_logbook_reset ; yes, restart (if not empty)
81 81
82 decf_eeprom_address d'2' ; +2 to eeprom address. 82 decf_eeprom_address d'2' ; -2 to eeprom address.
83 83
84 call I2CREAD ; reads one byte (Slow! Better use Blockread!) 84 call I2CREAD ; reads one byte (Slow! Better use Blockread!)
85 85
86 movlw 0xFA ; That was a FA ? 86 movlw 0xFA ; That was a FA ?
87 cpfseq SSPBUF 87 cpfseq SSPBUF
135 bra menu_logbook_display_loop ; No, display overwiev list 135 bra menu_logbook_display_loop ; No, display overwiev list
136 136
137 movf divesecs,W ; divenumber that is searched 137 movf divesecs,W ; divenumber that is searched
138 cpfseq divenumber ; current divenumber 138 cpfseq divenumber ; current divenumber
139 goto next_logbook ; No match, continue search 139 goto next_logbook ; No match, continue search
140 bra display_profile2 140 bra display_profile2 ; Match: Show header and profile
141 141
142 142
143 menu_logbook_display_loop: 143 menu_logbook_display_loop:
144 btfsc all_dives_shown ; All dives displayed? 144 btfsc all_dives_shown ; All dives displayed?
145 bra menu_logbook_display_loop2 ; Yes, but display first page again. 145 bra menu_logbook_display_loop2 ; Yes, but display first page again.
1036 1036
1037 lfsr FSR2,letter 1037 lfsr FSR2,letter
1038 movff divenumber,lo 1038 movff divenumber,lo
1039 output_99x ; # of dive 1039 output_99x ; # of dive
1040 PUTC ' ' 1040 PUTC ' '
1041 call I2CREAD2 ; logbook_profile_version (1st. byte of Header after the 0xFA, 0xFA) 1041 call I2CREAD3 ; logbook_profile_version (1st. byte of Header after the 0xFA, 0xFA) (Block read start)
1042 movff SSPBUF,lo 1042 movff SSPBUF,lo
1043 movlw d'13' 1043 movlw d'13'
1044 cpfsgt lo ; Skip if lo>13 1044 cpfsgt lo ; Skip if lo>13
1045 bra display_listdive2 ; use old format 1045 bra display_listdive2 ; use old format
1046 1046
1047 call I2CREAD2 ; Skip Profile version 1047 call I2CREAD4 ; Skip Profile version (Block read)
1048 movff SSPBUF,lo ; in new format, read month 1048 movff SSPBUF,lo ; in new format, read month
1049 1049
1050 display_listdive2: 1050 display_listdive2:
1051 movff lo,convert_value_temp+0 ; Month (in lo, see above) 1051 movff lo,convert_value_temp+0 ; Month (in lo, see above)
1052 call I2CREAD2 ; Day 1052 call I2CREAD4 ; Day (Block read)
1053 movff SSPBUF,convert_value_temp+1 1053 movff SSPBUF,convert_value_temp+1
1054 call I2CREAD2 ; Year 1054 call I2CREAD4 ; Year (Block read)
1055 movff SSPBUF,convert_value_temp+2 1055 movff SSPBUF,convert_value_temp+2
1056 call PLED_convert_date_short ; converts into "DD/MM" or "MM/DD" or "MM/DD" in s 1056 call PLED_convert_date_short ; converts into "DD/MM" or "MM/DD" or "MM/DD" in s
1057 1057
1058 1058
1059 incf_eeprom_address d'2' ; Skip Bytes in EEPROM (faster) 1059 incf_eeprom_address d'2' ; Skip Bytes in EEPROM (faster)
1060 ; call I2CREAD2 ; hours (Skip) 1060 ; call I2CREAD2 ; hours (Skip)
1061 ; call I2CREAD2 ; minutes (skip) 1061 ; call I2CREAD2 ; minutes (skip)
1062 1062
1063 PUTC ' ' 1063 PUTC ' '
1064 call I2CREAD2 ; Depth 1064 call I2CREAD3 ; Depth (Block read start)
1065 movff SSPBUF,lo 1065 movff SSPBUF,lo
1066 call I2CREAD2 1066 call I2CREAD4 ; Block read
1067 movff SSPBUF,hi 1067 movff SSPBUF,hi
1068 bsf leftbind 1068 bsf leftbind
1069 bsf ignore_digit5 ; Do not display 1cm figure 1069 bsf ignore_digit5 ; Do not display 1cm figure
1070 output_16dp d'3' ; max. depth 1070 output_16dp d'3' ; max. depth
1071 STRCAT "m " 1071 STRCAT "m "
1072 call I2CREAD2 1072 call I2CREAD4 ; Block read
1073 movff SSPBUF,lo ; read divetime in minutes 1073 movff SSPBUF,lo ; read divetime in minutes
1074 call I2CREAD2 1074 call I2CREAD4 ; Block read
1075 movff SSPBUF,hi ; read divetime in minutes 1075 movff SSPBUF,hi ; read divetime in minutes
1076 bsf leftbind 1076 bsf leftbind
1077 output_16 ; Divetime minutes 1077 output_16 ; Divetime minutes
1078 STRCAT_PRINT "'" ; Display header-row in list 1078 STRCAT_PRINT "'" ; Display header-row in list
1079 incf_eeprom_address d'37' ; 12 Bytes read from header, skip 37 Bytes in EEPROM (Remaining Header) 1079 incf_eeprom_address d'37' ; 12 Bytes read from header, skip 37 Bytes in EEPROM (Remaining Header)