comparison code_part1/OSTC_code_asm_part1/menu_logbook.asm @ 427:04535df08575

Fixed -2?C .. +35?C scale for logbook display.
author JeanDo
date Wed, 03 Aug 2011 00:54:41 +0200
parents 07f5b0baaa57
children f36b93f2fbed b0f3ab805879
comparison
equal deleted inserted replaced
426:07f5b0baaa57 427:04535df08575
655 655
656 ;---- Draw Tp° curve, if any --------------------------------------------- 656 ;---- Draw Tp° curve, if any ---------------------------------------------
657 movf divisor_temperature,W 657 movf divisor_temperature,W
658 bz profile_display_skip_temp 658 bz profile_display_skip_temp
659 659
660 movlw LOW((.153*.8)/.100) ; fixed tp° scale: (10.0° * scale8 )/153pix 660 movlw LOW((.153*.256)/.370) ; fixed tp° scale: (-2 .. +35°C * scaleé56 )/153pix
661 movwf xB+0 661 movwf xB+0
662 movlw HIGH((.153*.8)/.100) 662 movlw HIGH((.153*.256)/.370)
663 movwf xB+1 663 movwf xB+1
664 664
665 movf logbook_cur_tp+0,W 665 movf logbook_cur_tp+0,W ; Current Tp° - (-2.0°C) == Tp° + 20.
666 subwf logbook_min_tp+0,W 666 addlw LOW(.20) ; Low byte.
667 movwf xA+0 667 movwf xA+0
668 movf logbook_cur_tp+1,W 668 movf logbook_cur_tp+1,W
669 subwfb logbook_min_tp+1,W 669 btfsc STATUS,C ; Propagate carry, if any
670 incf WREG
670 movwf xA+1 671 movwf xA+1
671 call mult16x16 ; xA*xB=xC 672 call mult16x16 ; xA*xB=xC
672 673
673 ; scale: divide by 8. Don't bother about CARRY for the high byte. 674 ; scale: divide by 256, ie. take just high byte.
674 rrcf xC+1,F 675 movf xC+1,W
675 rrcf xC+0,F 676 sublw .75+.153 ; Upside-down: Y = .75 + (.153 - result)
676 rrcf xC+1,F 677 movwf xC+0
677 rrcf xC+0,F
678 rrcf xC+1,F
679 rrcf xC+0,F
680
681 movlw .75
682 subwf xC+0,F ; Upside-down: Y = .75 + (.153 - result)
683 678
684 movlw color_pink 679 movlw color_pink
685 call PLED_set_color 680 call PLED_set_color
686 681
687 movff logbook_last_tp,xC+1 682 movff logbook_last_tp,xC+1
688 call profile_display_fill ; In this column between this row (xC+0) and the last row (apnoe_mins) 683 call profile_display_fill ; In this column between this row (xC+0) and the last row (xC+1)
689 movff xC+0,logbook_last_tp 684 movff xC+0,logbook_last_tp
690 PIXEL_WRITE timeout_counter3,xC+0 ; Set col(0..159) x row (0..239), put a std color pixel. 685
686 PIXEL_WRITE timeout_counter3,xC+0 ; Set col(0..159) x row (0..239), put a current color pixel.
687
691 profile_display_skip_temp: 688 profile_display_skip_temp:
692 689
693 ;---- Draw depth curve --------------------------------------------------- 690 ;---- Draw depth curve ---------------------------------------------------
694 movff sim_pressure+0,xB+0 ; devide pressure in mbar/quant for row offsett 691 movff sim_pressure+0,xB+0 ; devide pressure in mbar/quant for row offsett
695 movff sim_pressure+1,xB+1 692 movff sim_pressure+1,xB+1
701 698
702 btfsc STATUS,C ; Ignore potential profile errors 699 btfsc STATUS,C ; Ignore potential profile errors
703 movff apnoe_mins,xC+0 700 movff apnoe_mins,xC+0
704 701
705 rcall profile_display_color ; Back to normal profile color. 702 rcall profile_display_color ; Back to normal profile color.
703
706 movff apnoe_mins,xC+1 704 movff apnoe_mins,xC+1
707 call profile_display_fill ; In this column between this row (xC+0) and the last row (apnoe_mins) 705 call profile_display_fill ; In this column between this row (xC+0) and the last row (xC+1)
708 movff xC+0,apnoe_mins ; Store last row for fill routine 706 movff xC+0,apnoe_mins ; Store last row for fill routine
707 PIXEL_WRITE timeout_counter3,xC+0 ; Set col(0..159) x row (0..239), put a std color pixel.
708
709 incf timeout_counter3,F 709 incf timeout_counter3,F
710
711 PIXEL_WRITE timeout_counter3,xC+0 ; Set col(0..159) x row (0..239), put a std color pixel.
712 710
713 ;---- Draw CNS curve, if any --------------------------------------------- 711 ;---- Draw CNS curve, if any ---------------------------------------------
714 movf divisor_cns,W 712 movf divisor_cns,W
715 bz profile_display_skip_cns 713 bz profile_display_skip_cns
716 ; 714 ;
1083 cpfseq xC+1 ; xC+0 = apone_mins? 1081 cpfseq xC+1 ; xC+0 = apone_mins?
1084 bra profile_display_fill2 ; No! 1082 bra profile_display_fill2 ; No!
1085 return 1083 return
1086 1084
1087 profile_display_fill2: 1085 profile_display_fill2:
1086 ; Make sure to init X position.
1087 movf timeout_counter3,W
1088 mullw 2
1089 decf PRODL,F
1090 movlw 0
1091 subwfb PRODH,F
1092 call pixel_write_col320
1093
1094 movf xC+0,W
1088 cpfsgt xC+1 ; apnoe_mins>xC+0? 1095 cpfsgt xC+1 ; apnoe_mins>xC+0?
1089 bra profile_display_fill_up ; Yes! 1096 bra profile_display_fill_up ; Yes!
1090 1097
1091 profile_display_fill_down2: ; Loop 1098 profile_display_fill_down2: ; Loop
1092 decf xC+1,F 1099 decf xC+1,F