# HG changeset patch # User heinrichsweikamp # Date 1306776539 -7200 # Node ID ed137d66ac654961d7113455861092d0b38102ea # Parent d722a820b6756d8c5969ae54b1553b81afeddf51 Preparations for new "0x21" logbook format diff -r d722a820b675 -r ed137d66ac65 code_part1/OSTC_code_asm_part1/definitions.asm --- a/code_part1/OSTC_code_asm_part1/definitions.asm Sun May 29 20:03:30 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/definitions.asm Mon May 30 19:28:59 2011 +0200 @@ -391,7 +391,7 @@ #DEFINE uart_dump_screen flag1,1 ; Screen copy to USB. #DEFINE pre_zero_flag flag1,2 ; leading zeros #DEFINE neg_flag flag1,3 ; e.g. Sub_16 (sub_c = sub_a - sub_b) -#DEFINE FLAG_3 flag1,4 ; unused +#DEFINE logbook_format_0x21 flag1,4 ; =1: New 0x21 Logbook header format #DEFINE leading_zeros flag1,5 ; display leading zeros? #DEFINE show_last3 flag1,6 ; show only three figures #DEFINE leftbind flag1,7 ; leftbinded output diff -r d722a820b675 -r ed137d66ac65 code_part1/OSTC_code_asm_part1/divemode.asm --- a/code_part1/OSTC_code_asm_part1/divemode.asm Sun May 29 20:03:30 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/divemode.asm Mon May 30 19:28:59 2011 +0200 @@ -1162,7 +1162,7 @@ call write_external_eeprom movlw 0xFA call write_external_eeprom - movlw logbook_profile_version ; Defined in definitions_vxyy.asm + movlw logbook_profile_version ; Defined in definitions.asm call write_external_eeprom movf month,W ; Date call write_external_eeprom @@ -1333,6 +1333,8 @@ movff char_O_CNS_fraction,WREG ; copy into bank1 call write_external_eeprom ; Stores CNS% +; Add additional 10bytes here.... mH + movlw 0xFB ; Header stop call write_external_eeprom movlw 0xFB diff -r d722a820b675 -r ed137d66ac65 code_part1/OSTC_code_asm_part1/menu_logbook.asm --- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm Sun May 29 20:03:30 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm Mon May 30 19:28:59 2011 +0200 @@ -288,7 +288,14 @@ display_profile_offset3: PUTC ' ' - call I2CREAD2 ; Skip Profile version + call I2CREAD2 ; Read Profile version + movff SSPBUF,lo ; store in lo + + bsf logbook_format_0x21 ; Set flag for new 0x21 Format + movlw 0x21 + cpfseq lo ; Skip if 0x21 + bcf logbook_format_0x21 ; Clear flag for new 0x21 Format + call I2CREAD2 ; read month movff SSPBUF,lo ; store in lo @@ -442,8 +449,8 @@ call I2CREAD2 ; read Air pressure movff SSPBUF,hi - movff lo,average_depth_hold+2 - movff hi,average_depth_hold+3 ; Store here for correct average +; movff lo,average_depth_hold+2 +; movff hi,average_depth_hold+3 ; Store here for correct average bsf leftbind output_16 ; Air pressure before dive @@ -504,13 +511,13 @@ display_profile2d: ; Start Profile display - clrf average_divesecs+0 - clrf average_divesecs+1 ; Counts x-pixels for average - clrf average_depth_hold_total+0 - clrf average_depth_hold_total+1 - clrf average_depth_hold_total+2 - clrf average_depth_hold_total+3 ; Track average depth here... - +; clrf average_divesecs+0 +; clrf average_divesecs+1 ; Counts x-pixels for average +; clrf average_depth_hold_total+0 +; clrf average_depth_hold_total+1 +; clrf average_depth_hold_total+2 +; clrf average_depth_hold_total+3 ; Track average depth here... +; ; Write 0m X-Line.. movlw color_grey call PLED_set_color ; Make this configurable? @@ -856,30 +863,22 @@ STRCAT_PRINT "%" ; Display CNS % logbook_skip_cns: - WIN_TOP .50 - - movff average_divesecs+0,xB+0 ; Number of samples in dive - movff average_divesecs+1,xB+1 ; Copy to xB:2 + btfss logbook_format_0x21 + bra skip_new_format_0x21_info ; Do not show remaining info from dive - movff average_depth_hold_total+0,xC+0 - movff average_depth_hold_total+1,xC+1 - movff average_depth_hold_total+2,xC+2 - movff average_depth_hold_total+3,xC+3 - call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + WIN_TOP .50 + call I2CREAD2 ; Read average depth + movff SSPBUF,lo + call I2CREAD2 ; Read average depth + movff SSPBUF,hi STRCPY "Avr:" - movff xC+0,lo - movff xC+1,hi - output_16dp d'3' ; Average depth (Re-calculated from the drawn profile - not 100% exact!) + output_16dp d'3' ; Average depth STRCAT_PRINT "m" ; WIN_TOP .0 ; WIN_LEFT .75 -; lfsr FSR2,letter -; movff average_divesecs+0,lo -; output_8 -; call word_processor - +skip_new_format_0x21_info: bcf menubit2 bcf menubit3 bcf switch_right @@ -963,18 +962,18 @@ return profile_view_get_depth_new1: - incf average_divesecs+0,F - movlw d'0' - addwfc average_divesecs+1,F ; counter for average depth - ; add depth to average registers - movf lo,W - addwf average_depth_hold_total+0,F - movf hi,W - addwfc average_depth_hold_total+1,F - movlw d'0' - addwfc average_depth_hold_total+2,F - addwfc average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar - +; incf average_divesecs+0,F +; movlw d'0' +; addwfc average_divesecs+1,F ; counter for average depth +; ; add depth to average registers +; movf lo,W +; addwf average_depth_hold_total+0,F +; movf hi,W +; addwfc average_depth_hold_total+1,F +; movlw d'0' +; addwfc average_depth_hold_total+2,F +; addwfc average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar +; btfsc event_occured ; Was there an event attached to this sample? rcall profile_view_get_depth_new2 ; Yes, get information about this event @@ -1127,7 +1126,7 @@ movff SSPBUF,lo movlw d'13' cpfsgt lo ; Skip if lo>13 - bra display_listdive2 ; use old format + bra display_listdive2 ; use old (Pre 0x20) format call I2CREAD4 ; Skip Profile version (Block read) movff SSPBUF,lo ; in new format, read month