Procházet zdrojové kódy

Changed display format for some numbers.

Erik van der Zalm před 13 roky
rodič
revize
df1437bd86
3 změnil soubory, kde provedl 28 přidání a 27 odebrání
  1. 0
    6
      Marlin/Marlin.pde
  2. 1
    8
      Marlin/ultralcd.h
  3. 27
    13
      Marlin/ultralcd.pde

+ 0
- 6
Marlin/Marlin.pde Zobrazit soubor

586
         st_synchronize();
586
         st_synchronize();
587
         endstops_hit_on_purpose();
587
         endstops_hit_on_purpose();
588
       }
588
       }
589
-      else
590
-      {
591
       #endif
589
       #endif
592
       
590
       
593
       if((home_all_axis) || (code_seen(axis_codes[X_AXIS]))) 
591
       if((home_all_axis) || (code_seen(axis_codes[X_AXIS]))) 
599
        HOMEAXIS(Y);
597
        HOMEAXIS(Y);
600
       }
598
       }
601
       
599
       
602
-      #ifdef QUICK_HOME
603
-      }
604
-      #endif
605
-      
606
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
600
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
607
         HOMEAXIS(Z);
601
         HOMEAXIS(Z);
608
       }
602
       }

+ 1
- 8
Marlin/ultralcd.h Zobrazit soubor

9
   void beep();
9
   void beep();
10
   void buttons_check();
10
   void buttons_check();
11
 
11
 
12
-
13
   #define LCD_UPDATE_INTERVAL 100
12
   #define LCD_UPDATE_INTERVAL 100
14
   #define STATUSTIMEOUT 15000
13
   #define STATUSTIMEOUT 15000
15
-
16
-
17
-  
18
   extern LiquidCrystal lcd;
14
   extern LiquidCrystal lcd;
19
-
20
-
15
+  
21
   #ifdef NEWPANEL
16
   #ifdef NEWPANEL
22
-
23
-    
24
     #define EN_C (1<<BLEN_C)
17
     #define EN_C (1<<BLEN_C)
25
     #define EN_B (1<<BLEN_B)
18
     #define EN_B (1<<BLEN_B)
26
     #define EN_A (1<<BLEN_A)
19
     #define EN_A (1<<BLEN_A)

+ 27
- 13
Marlin/ultralcd.pde Zobrazit soubor

485
       MENUITEM(  lcdprintPGM(MSG_DISABLE_STEPPERS)  ,  BLOCK;enquecommand("M84");beepshort(); ) ;
485
       MENUITEM(  lcdprintPGM(MSG_DISABLE_STEPPERS)  ,  BLOCK;enquecommand("M84");beepshort(); ) ;
486
       break;
486
       break;
487
     case ItemP_home:
487
     case ItemP_home:
488
-      MENUITEM(  lcdprintPGM(MSG_AUTO_HOME)  ,  BLOCK;enquecommand("G28 X-105 Y-105 Z0");beepshort(); ) ;
488
+      MENUITEM(  lcdprintPGM(MSG_AUTO_HOME)  ,  BLOCK;enquecommand("G28 X0 Y0 Z0");beepshort(); ) ;
489
       break;
489
       break;
490
     case ItemP_origin:
490
     case ItemP_origin:
491
       MENUITEM(  lcdprintPGM(MSG_SET_ORIGIN)  ,  BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ;
491
       MENUITEM(  lcdprintPGM(MSG_SET_ORIGIN)  ,  BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ;
533
                   if(force_lcd_update)
533
                   if(force_lcd_update)
534
                   {
534
                   {
535
                     lcd.setCursor(0,line);lcdprintPGM(" X:");
535
                     lcd.setCursor(0,line);lcdprintPGM(" X:");
536
-                    lcd.setCursor(13,line);lcd.print(ftostr32(current_position[X_AXIS]));
536
+                    lcd.setCursor(11,line);lcd.print(ftostr52(current_position[X_AXIS]));
537
                   }
537
                   }
538
       
538
       
539
                   if((activeline!=line) )
539
                   if((activeline!=line) )
569
 			oldencoderpos=encoderpos;
569
 			oldencoderpos=encoderpos;
570
                         encoderpos=0;
570
                         encoderpos=0;
571
 		    }
571
 		    }
572
-                    lcd.setCursor(13,line);lcd.print(ftostr32(current_position[X_AXIS]));
572
+                    lcd.setCursor(11,line);lcd.print(ftostr52(current_position[X_AXIS]));
573
                   }
573
                   }
574
           }
574
           }
575
           break;
575
           break;
578
                   if(force_lcd_update)
578
                   if(force_lcd_update)
579
                   {
579
                   {
580
                     lcd.setCursor(0,line);lcdprintPGM(" Y:");
580
                     lcd.setCursor(0,line);lcdprintPGM(" Y:");
581
-                    lcd.setCursor(13,line);lcd.print(ftostr32(current_position[Y_AXIS]));
581
+                    lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Y_AXIS]));
582
                   }
582
                   }
583
       
583
       
584
                   if((activeline!=line) )
584
                   if((activeline!=line) )
614
 			oldencoderpos=encoderpos;
614
 			oldencoderpos=encoderpos;
615
                         encoderpos=0;
615
                         encoderpos=0;
616
 		    }
616
 		    }
617
-                    lcd.setCursor(13,line);lcd.print(ftostr32(current_position[Y_AXIS]));
617
+                    lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Y_AXIS]));
618
                   }
618
                   }
619
           }
619
           }
620
           break;
620
           break;
623
                   if(force_lcd_update)
623
                   if(force_lcd_update)
624
                   {
624
                   {
625
                     lcd.setCursor(0,line);lcdprintPGM(" Z:");
625
                     lcd.setCursor(0,line);lcdprintPGM(" Z:");
626
-                    lcd.setCursor(13,line);lcd.print(ftostr32(current_position[Z_AXIS]));
626
+                    lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Z_AXIS]));
627
                   }
627
                   }
628
       
628
       
629
                   if((activeline!=line) )
629
                   if((activeline!=line) )
659
 			oldencoderpos=encoderpos;
659
 			oldencoderpos=encoderpos;
660
                         encoderpos=0;
660
                         encoderpos=0;
661
 		    }
661
 		    }
662
-                    lcd.setCursor(13,line);lcd.print(ftostr32(current_position[Z_AXIS]));
662
+                    lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Z_AXIS]));
663
                   }
663
                   }
664
           }
664
           }
665
           break;
665
           break;
1598
       if(force_lcd_update)
1598
       if(force_lcd_update)
1599
         {
1599
         {
1600
           lcd.setCursor(0,line);lcdprintPGM(" X steps/mm:");
1600
           lcd.setCursor(0,line);lcdprintPGM(" X steps/mm:");
1601
-          lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[0]));
1601
+          lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[0]));
1602
         }
1602
         }
1603
         
1603
         
1604
         if((activeline!=line) )
1604
         if((activeline!=line) )
1613
           }
1613
           }
1614
           else
1614
           else
1615
           {
1615
           {
1616
-            float factor=float(encoderpos)/float(axis_steps_per_unit[0]);
1616
+            float factor=float(encoderpos)/100/float(axis_steps_per_unit[0]);
1617
             position[X_AXIS]=lround(position[X_AXIS]*factor);
1617
             position[X_AXIS]=lround(position[X_AXIS]*factor);
1618
             //current_position[3]*=factor;
1618
             //current_position[3]*=factor;
1619
-            axis_steps_per_unit[X_AXIS]= encoderpos;
1619
+            axis_steps_per_unit[X_AXIS]= encoderpos/100.0;
1620
             encoderpos=activeline*lcdslow;
1620
             encoderpos=activeline*lcdslow;
1621
-              
1622
           }
1621
           }
1623
           BLOCK;
1622
           BLOCK;
1624
           beepshort();
1623
           beepshort();
1626
         if(linechanging)
1625
         if(linechanging)
1627
         {
1626
         {
1628
           if(encoderpos<5) encoderpos=5;
1627
           if(encoderpos<5) encoderpos=5;
1629
-          if(encoderpos>9999) encoderpos=9999;
1630
-          lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
1628
+          if(encoderpos>99999) encoderpos=99999;
1629
+          lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
1631
         }
1630
         }
1632
         
1631
         
1633
       }break;
1632
       }break;
2223
   return conv;
2222
   return conv;
2224
 }
2223
 }
2225
 
2224
 
2225
+//  convert float to string with +123.45 format
2226
+char *ftostr52(const float &x)
2227
+{
2228
+  int xx=x*100;
2229
+  conv[0]=(xx>=0)?'+':'-';
2230
+  xx=abs(xx);
2231
+  conv[1]=(xx/10000)%10+'0';
2232
+  conv[2]=(xx/1000)%10+'0';
2233
+  conv[3]=(xx/100)%10+'0';
2234
+  conv[4]='.';
2235
+  conv[5]=(xx/10)%10+'0';
2236
+  conv[6]=(xx)%10+'0';
2237
+  conv[7]=0;
2238
+  return conv;
2239
+}
2226
 
2240
 
2227
 #endif //ULTRA_LCD
2241
 #endif //ULTRA_LCD
2228
 
2242
 

Loading…
Zrušit
Uložit