Browse Source

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 years ago
parent
commit
a49c09a776
2 changed files with 18 additions and 0 deletions
  1. 15
    0
      Marlin/ultralcd.cpp
  2. 3
    0
      Marlin/ultralcd.h

+ 15
- 0
Marlin/ultralcd.cpp View File

@@ -893,6 +893,21 @@ char *ftostr31(const float &x)
893 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 911
 char *ftostr32(const float &x)
897 912
 {
898 913
   long xx=x*100;

+ 3
- 0
Marlin/ultralcd.h View File

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

Loading…
Cancel
Save