Преглед изворни кода

add autotemp support to the lcd

Bernhard пре 13 година
родитељ
комит
6aecf80278
1 измењених фајлова са 141 додато и 2 уклоњено
  1. 141
    2
      Marlin/ultralcd.pde

+ 141
- 2
Marlin/ultralcd.pde Прегледај датотеку

@@ -660,7 +660,12 @@ void MainMenu::showTune()
660 660
 //   
661 661
 
662 662
 enum {
663
-  ItemCT_exit, ItemCT_nozzle, ItemCT_fan,
663
+  ItemCT_exit,ItemCT_nozzle,
664
+#ifdef AUTOTEMP
665
+  ItemCT_autotempactive,
666
+  ItemCT_autotempmin,ItemCT_autotempmax,ItemCT_autotempfact,
667
+#endif
668
+  ItemCT_fan,
664 669
   ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C
665 670
 };
666 671
 
@@ -708,7 +713,128 @@ void MainMenu::showControlTemp()
708 713
           }
709 714
         }
710 715
       }break;
711
-      
716
+      #ifdef AUTOTEMP
717
+      case ItemCT_autotempmin:
718
+      {
719
+        if(force_lcd_update)
720
+        {
721
+          lcd.setCursor(0,line);lcdprintPGM(" \002 Min:");
722
+          lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
723
+        }
724
+        
725
+        if((activeline==line) )
726
+        {
727
+          if(CLICKED)
728
+          {
729
+            linechanging=!linechanging;
730
+            if(linechanging)
731
+            {
732
+               encoderpos=intround(autotemp_max);
733
+            }
734
+            else
735
+            {
736
+              autotemp_max=encoderpos;
737
+              encoderpos=activeline*lcdslow;
738
+              beepshort();
739
+            }
740
+            BLOCK;
741
+          }
742
+          if(linechanging)
743
+          {
744
+            if(encoderpos<0) encoderpos=0;
745
+            if(encoderpos>260) encoderpos=260;
746
+            lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
747
+          }
748
+        }
749
+      }break;  
750
+      case ItemCT_autotempmax:
751
+      {
752
+        if(force_lcd_update)
753
+        {
754
+          lcd.setCursor(0,line);lcdprintPGM(" \002 Max:");
755
+          lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
756
+        }
757
+        
758
+        if((activeline==line) )
759
+        {
760
+          if(CLICKED)
761
+          {
762
+            linechanging=!linechanging;
763
+            if(linechanging)
764
+            {
765
+               encoderpos=intround(autotemp_max);
766
+            }
767
+            else
768
+            {
769
+              autotemp_max=encoderpos;
770
+              encoderpos=activeline*lcdslow;
771
+              beepshort();
772
+            }
773
+            BLOCK;
774
+          }
775
+          if(linechanging)
776
+          {
777
+            if(encoderpos<0) encoderpos=0;
778
+            if(encoderpos>260) encoderpos=260;
779
+            lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
780
+          }
781
+        }
782
+      }break;  
783
+      case ItemCT_autotempfact:
784
+      {
785
+        if(force_lcd_update)
786
+        {
787
+          lcd.setCursor(0,line);lcdprintPGM(" \002 Fact:");
788
+          lcd.setCursor(13,line);lcd.print(ftostr32(autotemp_factor));
789
+        }
790
+        
791
+        if((activeline==line) )
792
+        {
793
+          if(CLICKED)
794
+          {
795
+            linechanging=!linechanging;
796
+            if(linechanging)
797
+            {
798
+               encoderpos=intround(autotemp_factor*100);
799
+            }
800
+            else
801
+            {
802
+              autotemp_max=encoderpos;
803
+              encoderpos=activeline*lcdslow;
804
+              beepshort();
805
+            }
806
+            BLOCK;
807
+          }
808
+          if(linechanging)
809
+          {
810
+            if(encoderpos<0) encoderpos=0;
811
+            if(encoderpos>99) encoderpos=99;
812
+            lcd.setCursor(13,line);lcd.print(ftostr32(encoderpos/100.));
813
+          }
814
+        }
815
+      }break;
816
+      case ItemCT_autotempactive:
817
+      {
818
+        if(force_lcd_update)
819
+        {
820
+          lcd.setCursor(0,line);lcdprintPGM(" Autotemp:");
821
+          lcd.setCursor(13,line);
822
+	  if(autotemp_enabled)
823
+	    lcdprintPGM("On");
824
+	  else
825
+	    lcdprintPGM("Off");
826
+        }
827
+        
828
+        if((activeline==line) )
829
+        {
830
+          if(CLICKED)
831
+          {
832
+            autotemp_enabled=!autotemp_enabled;
833
+            BLOCK;
834
+          }
835
+        }
836
+      }break;  
837
+      #endif //autotemp
712 838
       case ItemCT_fan:
713 839
       {
714 840
         if(force_lcd_update)
@@ -1620,6 +1746,19 @@ char *ftostr31(const float &x)
1620 1746
   return conv;
1621 1747
 }
1622 1748
 
1749
+char *ftostr32(const float &x)
1750
+{
1751
+  int xx=x*100;
1752
+  conv[0]=(xx>=0)?'+':'-';
1753
+  xx=abs(xx);
1754
+  conv[1]=(xx/100)%10+'0';
1755
+  conv[2]='.';
1756
+  conv[3]=(xx/10)%10+'0';
1757
+  conv[4]=(xx)%10+'0';
1758
+  conv[6]=0;
1759
+  return conv;
1760
+}
1761
+
1623 1762
 char *itostr31(const int &xx)
1624 1763
 {
1625 1764
   conv[0]=(xx>=0)?'+':'-';

Loading…
Откажи
Сачувај