comparison code_part1/OSTC_code_asm_part1/menu_logbook.asm @ 248:571626276aaa

Logbook now shows gas changes in depth profile
author heinrichsweikamp
date Tue, 29 Mar 2011 21:29:48 +0200
parents dee88c962653
children 544cc5d47755
comparison
equal deleted inserted replaced
247:ce869aad7440 248:571626276aaa
464 call word_processor ; display 3rd page of details 464 call word_processor ; display 3rd page of details
465 465
466 movff eeprom_address+0,average_depth_hold+0 466 movff eeprom_address+0,average_depth_hold+0
467 movff eeprom_address+1,average_depth_hold+1 ; Pointer to Gaslist (For Page 2) 467 movff eeprom_address+1,average_depth_hold+1 ; Pointer to Gaslist (For Page 2)
468 468
469 incf_eeprom_address d'18' ; Skip 18Bytes in EEPROM (faster) 469 ; incf_eeprom_address d'18' ; Skip 18Bytes in EEPROM (faster)
470 ; 18bytes gases, battery, firmware number 470 ; ;18bytes gases, battery, firmware number
471
472 incf_eeprom_address d'12' ; Skip 12 Bytes in EEPROM (faster) (Gaslist)
473 call I2CREAD2 ; Read start gas (1-5)
474 movff SSPBUF,active_gas ; Store
475 incf_eeprom_address d'5' ; Skip 5 Bytes in EEPROM (faster) (Battery, firmware)
476
471 call I2CREAD2 ; Read divisor 477 call I2CREAD2 ; Read divisor
472 movff SSPBUF,divisor_temperature ; Store divisor 478 movff SSPBUF,divisor_temperature ; Store divisor
473 bcf divisor_temperature,4 ; Clear information length 479 bcf divisor_temperature,4 ; Clear information length
474 bcf divisor_temperature,5 480 bcf divisor_temperature,5
475 bcf divisor_temperature,6 481 bcf divisor_temperature,6
567 movwf timeout_counter3 ; here: used as colum x2 (Start at Colum 5) 573 movwf timeout_counter3 ; here: used as colum x2 (Start at Colum 5)
568 movlw d'75' ; Zero-m row 574 movlw d'75' ; Zero-m row
569 movwf apnoe_mins ; here: used for fill between rows 575 movwf apnoe_mins ; here: used for fill between rows
570 incf timeout_counter3,W ; Init Column 576 incf timeout_counter3,W ; Init Column
571 577
572 INIT_PIXEL_WROTE timeout_counter3 ; pixel x2 578 INIT_PIXEL_WROTE timeout_counter3 ; pixel x2 (Also sets standard Color!)
579
580 dcfsnz active_gas,F
581 movlw color_white ; Color for Gas 1
582 dcfsnz active_gas,F
583 movlw color_green ; Color for Gas 2
584 dcfsnz active_gas,F
585 movlw color_red ; Color for Gas 3
586 dcfsnz active_gas,F
587 movlw color_yellow ; Color for Gas 4
588 dcfsnz active_gas,F
589 movlw color_violet ; Color for Gas 5
590 call PLED_set_color ; Set Color...
591
573 592
574 profile_display_loop: 593 profile_display_loop:
575 movff profile_temp+0,profile_temp2+0 594 movff profile_temp+0,profile_temp2+0
576 movff profile_temp+1,profile_temp2+1 ; 16Bit x-scaler 595 movff profile_temp+1,profile_temp2+1 ; 16Bit x-scaler
577 incf profile_temp2+1,F 596 incf profile_temp2+1,F
623 642
624 decfsz ignore_digits,F ; counts x-pixels to zero 643 decfsz ignore_digits,F ; counts x-pixels to zero
625 bra profile_display_loop ; Not ready yet 644 bra profile_display_loop ; Not ready yet
626 ; Done. 645 ; Done.
627 profile_display_loop_done: 646 profile_display_loop_done:
647 call PLED_standard_color ; Restore color
628 movlw d'159' 648 movlw d'159'
629 subfwb ignore_digits,W ; keep number of X-pixels (For average depth display on Page 3) 649 subfwb ignore_digits,W ; keep number of X-pixels (For average depth display on Page 3)
630 movwf average_divesecs+0 ; Store here for compatibility 650 movwf average_divesecs+0 ; Store here for compatibility
631 651
632 bcf sleepmode ; clear some flags 652 bcf sleepmode ; clear some flags
658 WIN_BOX_BLACK .0, .74, .0, .159 ;top, bottom, left, right 678 WIN_BOX_BLACK .0, .74, .0, .159 ;top, bottom, left, right
659 679
660 movff average_depth_hold+0,eeprom_address+0 680 movff average_depth_hold+0,eeprom_address+0
661 movff average_depth_hold+1,eeprom_address+1 ; Pointer to Gaslist 681 movff average_depth_hold+1,eeprom_address+1 ; Pointer to Gaslist
662 682
663 call PLED_standard_color 683 movlw color_white ; Color for Gas 1
684 call PLED_set_color ; Set Color...
664 bsf leftbind 685 bsf leftbind
665 WIN_TOP .0 686 WIN_TOP .0
666 WIN_LEFT .0 687 WIN_LEFT .0
667 STRCPY "G1:" 688 STRCPY "G1:"
668 call I2CREAD2 ; Gas1 current O2 689 call I2CREAD2 ; Gas1 current O2
672 call I2CREAD2 ; Gas1 current HE 693 call I2CREAD2 ; Gas1 current HE
673 movff SSPBUF,lo 694 movff SSPBUF,lo
674 output_8 695 output_8
675 call word_processor ; Display Gas information 696 call word_processor ; Display Gas information
676 697
698 movlw color_green ; Color for Gas 2
699 call PLED_set_color ; Set Color...
677 WIN_TOP .25 700 WIN_TOP .25
678 STRCPY "G2:" 701 STRCPY "G2:"
679 call I2CREAD2 ; Gas2 current O2 702 call I2CREAD2 ; Gas2 current O2
680 movff SSPBUF,lo 703 movff SSPBUF,lo
681 output_8 704 output_8
683 call I2CREAD2 ; Gas2 current HE 706 call I2CREAD2 ; Gas2 current HE
684 movff SSPBUF,lo 707 movff SSPBUF,lo
685 output_8 708 output_8
686 call word_processor ; Display Gas information 709 call word_processor ; Display Gas information
687 710
711 movlw color_red ; Color for Gas 3
712 call PLED_set_color ; Set Color...
688 WIN_TOP .50 713 WIN_TOP .50
689 STRCPY "G3:" 714 STRCPY "G3:"
690 call I2CREAD2 ; Gas3 current O2 715 call I2CREAD2 ; Gas3 current O2
691 movff SSPBUF,lo 716 movff SSPBUF,lo
692 output_8 717 output_8
694 call I2CREAD2 ; Gas3 current HE 719 call I2CREAD2 ; Gas3 current HE
695 movff SSPBUF,lo 720 movff SSPBUF,lo
696 output_8 721 output_8
697 call word_processor ; Display Gas information 722 call word_processor ; Display Gas information
698 723
724 movlw color_yellow ; Color for Gas 4
725 call PLED_set_color ; Set Color...
699 WIN_TOP .0 726 WIN_TOP .0
700 WIN_LEFT .60 727 WIN_LEFT .60
701 STRCPY "G4:" 728 STRCPY "G4:"
702 call I2CREAD2 ; Gas4 current O2 729 call I2CREAD2 ; Gas4 current O2
703 movff SSPBUF,lo 730 movff SSPBUF,lo
706 call I2CREAD2 ; Gas4 current HE 733 call I2CREAD2 ; Gas4 current HE
707 movff SSPBUF,lo 734 movff SSPBUF,lo
708 output_8 735 output_8
709 call word_processor ; Display Gas information 736 call word_processor ; Display Gas information
710 737
738 movlw color_violet ; Color for Gas 5
739 call PLED_set_color ; Set Color...
711 WIN_TOP .25 740 WIN_TOP .25
712 STRCPY "G5:" 741 STRCPY "G5:"
713 call I2CREAD2 ; Gas5 current O2 742 call I2CREAD2 ; Gas5 current O2
714 movff SSPBUF,lo 743 movff SSPBUF,lo
715 output_8 744 output_8
717 call I2CREAD2 ; Gas5 current HE 746 call I2CREAD2 ; Gas5 current HE
718 movff SSPBUF,lo 747 movff SSPBUF,lo
719 output_8 748 output_8
720 call word_processor ; Display Gas information 749 call word_processor ; Display Gas information
721 750
751 movlw color_cyan ; Color for Gas 6
752 call PLED_set_color ; Set Color...
722 WIN_TOP .50 753 WIN_TOP .50
723 STRCPY "G6:" 754 STRCPY "G6:"
724 call I2CREAD2 ; Gas6 current O2 755 call I2CREAD2 ; Gas6 current O2
725 movff SSPBUF,lo 756 movff SSPBUF,lo
726 output_8 757 output_8
728 call I2CREAD2 ; Gas6 current HE 759 call I2CREAD2 ; Gas6 current HE
729 movff SSPBUF,lo 760 movff SSPBUF,lo
730 output_8 761 output_8
731 call word_processor ; Display Gas information 762 call word_processor ; Display Gas information
732 763
764 call PLED_standard_color
733 WIN_TOP .0 765 WIN_TOP .0
734 WIN_LEFT .120 766 WIN_LEFT .120
735 STRCPY "1st:" 767 STRCPY "1st:"
736 call I2CREAD2 ; Start Gas 768 call I2CREAD2 ; Start Gas
737 movff SSPBUF,lo 769 movff SSPBUF,lo
928 bra profile_view_get_depth_new1 ; no 0xFD 960 bra profile_view_get_depth_new1 ; no 0xFD
929 bsf second_FD ; End found! Set Flag! Skip remaining pixels! 961 bsf second_FD ; End found! Set Flag! Skip remaining pixels!
930 return 962 return
931 963
932 profile_view_get_depth_new1: 964 profile_view_get_depth_new1:
965 btfsc event_occured ; Was there an event attached to this sample?
966 rcall profile_view_get_depth_new2 ; Yes, get information about this event
967
933 tstfsz timeout_counter2 ; Any bytes to ignore 968 tstfsz timeout_counter2 ; Any bytes to ignore
934 bra profile_view_get_depth_new3 ; Yes (1-127) 969 bra profile_view_get_depth_new3 ; Yes (1-127)
935 return ; No (0) 970 return ; No (0)
936 971
937 profile_view_get_depth_new3: 972 profile_view_get_depth_new3:
938 movf timeout_counter2,W ; number of additional bytes to ignore (0-127) 973 movf timeout_counter2,W ; number of additional bytes to ignore (0-127)
939 call incf_eeprom_address0 ; increases bytes in eeprom_address:2 with 0x8000 bank switching 974 call incf_eeprom_address0 ; increases bytes in eeprom_address:2 with 0x8000 bank switching
940 return 975 return
976
977 profile_view_get_depth_new2:
978 call I2CREAD2 ; Read Event byte
979 movff SSPBUF,EventByte ; store EventByte
980 decf timeout_counter2,F ; reduce counter
981 ; Check Event flags in the EventByte
982 btfsc EventByte,4 ; Manual Gas Changed?
983 bra logbook_event1 ; Yes!
984 btfss EventByte,5 ; Stored Gas Changed?
985 return ; No, return
986 ; Stored Gas changed!
987 call I2CREAD2 ; Read Gas#
988 movff SSPBUF,active_gas ; store gas#
989 decf timeout_counter2,F ; reduce counter
990 dcfsnz active_gas,F
991 movlw color_white ; Color for Gas 1
992 dcfsnz active_gas,F
993 movlw color_green ; Color for Gas 2
994 dcfsnz active_gas,F
995 movlw color_red ; Color for Gas 3
996 dcfsnz active_gas,F
997 movlw color_yellow ; Color for Gas 4
998 dcfsnz active_gas,F
999 movlw color_violet ; Color for Gas 5
1000 call PLED_set_color ; Set Color...
1001 return
1002
1003 logbook_event1:
1004 movlw color_cyan ; Color for Gas 6
1005 call PLED_set_color ; Set Color...
1006 return ;(The two bytes indicating the manual gas change will be ignored in the standard "ignore loop" above...)
1007
941 1008
942 ;Keep comments for future temperature graph 1009 ;Keep comments for future temperature graph
943 ; call I2CREAD2 ; ignore byte 1010 ; call I2CREAD2 ; ignore byte
944 ; decfsz timeout_counter2,F ; reduce counter 1011 ; decfsz timeout_counter2,F ; reduce counter
945 ; bra profile_view_get_depth_new3 ; Loop 1012 ; bra profile_view_get_depth_new3 ; Loop