comparison code_part1/OSTC_code_asm_part1/menu_logbook.asm @ 266:ba109a7948df

OSTC 2N uses exchanged switches...
author heinrichsweikamp
date Tue, 12 Apr 2011 08:11:50 +0200
parents 3a4096f32526
children 7d24c9d62095
comparison
equal deleted inserted replaced
265:ab8ce7de2b46 266:ba109a7948df
439 439
440 call I2CREAD2 ; read Air pressure 440 call I2CREAD2 ; read Air pressure
441 movff SSPBUF,lo 441 movff SSPBUF,lo
442 call I2CREAD2 ; read Air pressure 442 call I2CREAD2 ; read Air pressure
443 movff SSPBUF,hi 443 movff SSPBUF,hi
444
445 movff lo,average_depth_hold+2
446 movff hi,average_depth_hold+3 ; Store here for correct average
447
444 bsf leftbind 448 bsf leftbind
445 output_16 ; Air pressure before dive 449 output_16 ; Air pressure before dive
446 STRCAT "mbar " 450 STRCAT "mbar "
447 OUTPUTTEXT .014 ; Desat 451 OUTPUTTEXT .014 ; Desat
448 PUTC ' ' 452 PUTC ' '
596 incf profile_temp2+0,F ; Zero, Increase! 600 incf profile_temp2+0,F ; Zero, Increase!
597 601
598 profile_display_loop2: 602 profile_display_loop2:
599 rcall profile_view_get_depth ; reads depth, ignores temp and profile data -> hi, lo 603 rcall profile_view_get_depth ; reads depth, ignores temp and profile data -> hi, lo
600 604
601 movf lo,w 605 ; Subtract Surface pressure
606 movff average_depth_hold+2,sub_b+0
607 movff average_depth_hold+3,sub_b+1 ; ambient pressure in mBar
608 movff lo,sub_a+0
609 movff hi,sub_a+1 ; depth in mBar
610 call sub16 ; sub_c = sub_a - sub_b
611
612 ; add depth to average registers
613 movf sub_c+0,W
602 addwf average_depth_hold_total+0,F 614 addwf average_depth_hold_total+0,F
603 movf hi,w 615 movf sub_c+1,W
604 addwfc average_depth_hold_total+1,F 616 addwfc average_depth_hold_total+1,F
605 movlw d'0' 617 movlw d'0'
606 addwfc average_depth_hold_total+2,F 618 addwfc average_depth_hold_total+2,F
607 addwfc average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar 619 addwfc average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar
608 620
641 bra profile_display_loop ; Not ready yet 653 bra profile_display_loop ; Not ready yet
642 ; Done. 654 ; Done.
643 profile_display_loop_done: 655 profile_display_loop_done:
644 call PLED_standard_color ; Restore color 656 call PLED_standard_color ; Restore color
645 movlw d'159' 657 movlw d'159'
658 ; movlw d'200'
646 subfwb ignore_digits,W ; keep number of X-pixels (For average depth display on Page 3) 659 subfwb ignore_digits,W ; keep number of X-pixels (For average depth display on Page 3)
647 movwf average_divesecs+0 ; Store here for compatibility 660 movwf average_divesecs+0 ; Store here for compatibility
648 661
649 bcf sleepmode ; clear some flags 662 bcf sleepmode ; clear some flags
650 bcf menubit2 663 bcf menubit2
860 output_8 873 output_8
861 STRCAT_PRINT "%" ; Display CNS % 874 STRCAT_PRINT "%" ; Display CNS %
862 875
863 logbook_skip_cns: 876 logbook_skip_cns:
864 WIN_TOP .50 877 WIN_TOP .50
865 movff average_divesecs+0,xB+0 878
879 btfsc average_divesecs+0,0 ; Number of drawn pixels even?
880 incf average_divesecs+0,W ; No, add +1 -> WREG
881 movwf xB+0 ; Copy W to xB+0
866 clrf xB+1 ; Number of x-pixels displayed 882 clrf xB+1 ; Number of x-pixels displayed
867 movff average_depth_hold_total+0,xC+0 883 movff average_depth_hold_total+0,xC+0
868 movff average_depth_hold_total+1,xC+1 884 movff average_depth_hold_total+1,xC+1
869 movff average_depth_hold_total+2,xC+2 885 movff average_depth_hold_total+2,xC+2
870 movff average_depth_hold_total+3,xC+3 886 movff average_depth_hold_total+3,xC+3