浏览代码

Add variable for animated fan, add float conversion w/o sign

A new variable was introduced to allow fan animation on the GLCD.
Add additional float to string conversion routine without sign
character. This is used for the coordinates visualisation on the GLCD.
Dirk Eichel 12 年前
父节点
当前提交
a49c09a776
共有 2 个文件被更改,包括 18 次插入0 次删除
  1. 15
    0
      Marlin/ultralcd.cpp
  2. 3
    0
      Marlin/ultralcd.h

+ 15
- 0
Marlin/ultralcd.cpp 查看文件

893
   return conv;
893
   return conv;
894
 }
894
 }
895
 
895
 
896
+//  convert float to string with 123.4 format
897
+char *ftostr31ns(const float &x)
898
+{
899
+  int xx=x*10;
900
+  //conv[0]=(xx>=0)?'+':'-';
901
+  xx=abs(xx);
902
+  conv[0]=(xx/1000)%10+'0';
903
+  conv[1]=(xx/100)%10+'0';
904
+  conv[2]=(xx/10)%10+'0';
905
+  conv[3]='.';
906
+  conv[4]=(xx)%10+'0';
907
+  conv[5]=0;
908
+  return conv;
909
+}
910
+
896
 char *ftostr32(const float &x)
911
 char *ftostr32(const float &x)
897
 {
912
 {
898
   long xx=x*100;
913
   long xx=x*100;

+ 3
- 0
Marlin/ultralcd.h 查看文件

11
   void lcd_setstatuspgm(const char* message);
11
   void lcd_setstatuspgm(const char* message);
12
   void lcd_setalertstatuspgm(const char* message);
12
   void lcd_setalertstatuspgm(const char* message);
13
   void lcd_reset_alert_level();
13
   void lcd_reset_alert_level();
14
+  
15
+  static unsigned char blink = 0;	// Variable for visualisation of fan rotation in GLCD
14
 
16
 
15
   #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
17
   #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
16
   #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
18
   #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
71
 char *itostr4(const int &xx);
73
 char *itostr4(const int &xx);
72
 
74
 
73
 char *ftostr3(const float &x);
75
 char *ftostr3(const float &x);
76
+char *ftostr31ns(const float &x); // float to string without sign character
74
 char *ftostr31(const float &x);
77
 char *ftostr31(const float &x);
75
 char *ftostr32(const float &x);
78
 char *ftostr32(const float &x);
76
 char *ftostr5(const float &x);
79
 char *ftostr5(const float &x);

正在加载...
取消
保存