Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/menu_logbook.asm @ 349:ed137d66ac65
Preparations for new "0x21" logbook format
author | heinrichsweikamp |
---|---|
date | Mon, 30 May 2011 19:28:59 +0200 |
parents | 6bdf80d7276c |
children | 7250ca7c8d24 |
comparison
equal
deleted
inserted
replaced
348:d722a820b675 | 349:ed137d66ac65 |
---|---|
286 movff divesecs,lo ; | 286 movff divesecs,lo ; |
287 output_99x ; # of dive | 287 output_99x ; # of dive |
288 | 288 |
289 display_profile_offset3: | 289 display_profile_offset3: |
290 PUTC ' ' | 290 PUTC ' ' |
291 call I2CREAD2 ; Skip Profile version | 291 call I2CREAD2 ; Read Profile version |
292 movff SSPBUF,lo ; store in lo | |
293 | |
294 bsf logbook_format_0x21 ; Set flag for new 0x21 Format | |
295 movlw 0x21 | |
296 cpfseq lo ; Skip if 0x21 | |
297 bcf logbook_format_0x21 ; Clear flag for new 0x21 Format | |
298 | |
292 call I2CREAD2 ; read month | 299 call I2CREAD2 ; read month |
293 movff SSPBUF,lo ; store in lo | 300 movff SSPBUF,lo ; store in lo |
294 | 301 |
295 ; Offset to SamplingRate | 302 ; Offset to SamplingRate |
296 incf_eeprom_address d'32' ; Macro, that adds 8Bit to eeprom_address:2 with banking at 0x8000 | 303 incf_eeprom_address d'32' ; Macro, that adds 8Bit to eeprom_address:2 with banking at 0x8000 |
440 call I2CREAD2 ; read Air pressure | 447 call I2CREAD2 ; read Air pressure |
441 movff SSPBUF,lo | 448 movff SSPBUF,lo |
442 call I2CREAD2 ; read Air pressure | 449 call I2CREAD2 ; read Air pressure |
443 movff SSPBUF,hi | 450 movff SSPBUF,hi |
444 | 451 |
445 movff lo,average_depth_hold+2 | 452 ; movff lo,average_depth_hold+2 |
446 movff hi,average_depth_hold+3 ; Store here for correct average | 453 ; movff hi,average_depth_hold+3 ; Store here for correct average |
447 | 454 |
448 bsf leftbind | 455 bsf leftbind |
449 output_16 ; Air pressure before dive | 456 output_16 ; Air pressure before dive |
450 STRCAT "mbar " | 457 STRCAT "mbar " |
451 OUTPUTTEXT .014 ; Desat | 458 OUTPUTTEXT .014 ; Desat |
502 ; 2 bytes salinity, GF | 509 ; 2 bytes salinity, GF |
503 | 510 |
504 display_profile2d: | 511 display_profile2d: |
505 ; Start Profile display | 512 ; Start Profile display |
506 | 513 |
507 clrf average_divesecs+0 | 514 ; clrf average_divesecs+0 |
508 clrf average_divesecs+1 ; Counts x-pixels for average | 515 ; clrf average_divesecs+1 ; Counts x-pixels for average |
509 clrf average_depth_hold_total+0 | 516 ; clrf average_depth_hold_total+0 |
510 clrf average_depth_hold_total+1 | 517 ; clrf average_depth_hold_total+1 |
511 clrf average_depth_hold_total+2 | 518 ; clrf average_depth_hold_total+2 |
512 clrf average_depth_hold_total+3 ; Track average depth here... | 519 ; clrf average_depth_hold_total+3 ; Track average depth here... |
513 | 520 ; |
514 ; Write 0m X-Line.. | 521 ; Write 0m X-Line.. |
515 movlw color_grey | 522 movlw color_grey |
516 call PLED_set_color ; Make this configurable? | 523 call PLED_set_color ; Make this configurable? |
517 | 524 |
518 movlw d'75' | 525 movlw d'75' |
854 STRCPY "CNS:" | 861 STRCPY "CNS:" |
855 output_8 | 862 output_8 |
856 STRCAT_PRINT "%" ; Display CNS % | 863 STRCAT_PRINT "%" ; Display CNS % |
857 | 864 |
858 logbook_skip_cns: | 865 logbook_skip_cns: |
866 btfss logbook_format_0x21 | |
867 bra skip_new_format_0x21_info ; Do not show remaining info from dive | |
868 | |
859 WIN_TOP .50 | 869 WIN_TOP .50 |
860 | 870 call I2CREAD2 ; Read average depth |
861 movff average_divesecs+0,xB+0 ; Number of samples in dive | 871 movff SSPBUF,lo |
862 movff average_divesecs+1,xB+1 ; Copy to xB:2 | 872 call I2CREAD2 ; Read average depth |
863 | 873 movff SSPBUF,hi |
864 movff average_depth_hold_total+0,xC+0 | |
865 movff average_depth_hold_total+1,xC+1 | |
866 movff average_depth_hold_total+2,xC+2 | |
867 movff average_depth_hold_total+3,xC+3 | |
868 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
869 STRCPY "Avr:" | 874 STRCPY "Avr:" |
870 movff xC+0,lo | 875 output_16dp d'3' ; Average depth |
871 movff xC+1,hi | |
872 output_16dp d'3' ; Average depth (Re-calculated from the drawn profile - not 100% exact!) | |
873 STRCAT_PRINT "m" | 876 STRCAT_PRINT "m" |
874 | 877 |
875 ; WIN_TOP .0 | 878 ; WIN_TOP .0 |
876 ; WIN_LEFT .75 | 879 ; WIN_LEFT .75 |
877 ; lfsr FSR2,letter | 880 |
878 ; movff average_divesecs+0,lo | 881 skip_new_format_0x21_info: |
879 ; output_8 | |
880 ; call word_processor | |
881 | |
882 | |
883 bcf menubit2 | 882 bcf menubit2 |
884 bcf menubit3 | 883 bcf menubit3 |
885 bcf switch_right | 884 bcf switch_right |
886 bcf switch_left | 885 bcf switch_left |
887 clrf timeout_counter2 | 886 clrf timeout_counter2 |
961 bra profile_view_get_depth_new1 ; no 0xFD | 960 bra profile_view_get_depth_new1 ; no 0xFD |
962 bsf second_FD ; End found! Set Flag! Skip remaining pixels! | 961 bsf second_FD ; End found! Set Flag! Skip remaining pixels! |
963 return | 962 return |
964 | 963 |
965 profile_view_get_depth_new1: | 964 profile_view_get_depth_new1: |
966 incf average_divesecs+0,F | 965 ; incf average_divesecs+0,F |
967 movlw d'0' | 966 ; movlw d'0' |
968 addwfc average_divesecs+1,F ; counter for average depth | 967 ; addwfc average_divesecs+1,F ; counter for average depth |
969 ; add depth to average registers | 968 ; ; add depth to average registers |
970 movf lo,W | 969 ; movf lo,W |
971 addwf average_depth_hold_total+0,F | 970 ; addwf average_depth_hold_total+0,F |
972 movf hi,W | 971 ; movf hi,W |
973 addwfc average_depth_hold_total+1,F | 972 ; addwfc average_depth_hold_total+1,F |
974 movlw d'0' | 973 ; movlw d'0' |
975 addwfc average_depth_hold_total+2,F | 974 ; addwfc average_depth_hold_total+2,F |
976 addwfc average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar | 975 ; addwfc average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar |
977 | 976 ; |
978 btfsc event_occured ; Was there an event attached to this sample? | 977 btfsc event_occured ; Was there an event attached to this sample? |
979 rcall profile_view_get_depth_new2 ; Yes, get information about this event | 978 rcall profile_view_get_depth_new2 ; Yes, get information about this event |
980 | 979 |
981 tstfsz timeout_counter2 ; Any bytes to ignore | 980 tstfsz timeout_counter2 ; Any bytes to ignore |
982 bra profile_view_get_depth_new3 ; Yes (1-127) | 981 bra profile_view_get_depth_new3 ; Yes (1-127) |
1125 PUTC ' ' | 1124 PUTC ' ' |
1126 call I2CREAD3 ; logbook_profile_version (1st. byte of Header after the 0xFA, 0xFA) (Block read start) | 1125 call I2CREAD3 ; logbook_profile_version (1st. byte of Header after the 0xFA, 0xFA) (Block read start) |
1127 movff SSPBUF,lo | 1126 movff SSPBUF,lo |
1128 movlw d'13' | 1127 movlw d'13' |
1129 cpfsgt lo ; Skip if lo>13 | 1128 cpfsgt lo ; Skip if lo>13 |
1130 bra display_listdive2 ; use old format | 1129 bra display_listdive2 ; use old (Pre 0x20) format |
1131 | 1130 |
1132 call I2CREAD4 ; Skip Profile version (Block read) | 1131 call I2CREAD4 ; Skip Profile version (Block read) |
1133 movff SSPBUF,lo ; in new format, read month | 1132 movff SSPBUF,lo ; in new format, read month |
1134 | 1133 |
1135 display_listdive2: | 1134 display_listdive2: |