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

Added HOME_POS. This adds the posibility to make the center 0

Updated the Xsteps ... settings via the LCD menu
Erik van der Zalm пре 13 година
родитељ
комит
ae3e7586c6
5 измењених фајлова са 58 додато и 34 уклоњено
  1. 6
    1
      Marlin/Configuration.h
  2. 3
    3
      Marlin/Marlin.pde
  3. 21
    1
      Marlin/language.h
  4. 3
    3
      Marlin/planner.cpp
  5. 25
    26
      Marlin/ultralcd.pde

+ 6
- 1
Marlin/Configuration.h Прегледај датотеку

@@ -146,6 +146,11 @@ const bool Z_ENDSTOPS_INVERTING = false; // set to true to invert the logic of t
146 146
 #define Y_MAX_LENGTH 185
147 147
 #define Z_MAX_LENGTH 90
148 148
 
149
+// The position of the homing switches. Use MAX_LENGTH * -0.5 if the center should be 0, 0, 0
150
+#define X_HOME_POS 0
151
+#define Y_HOME_POS 0
152
+#define Z_HOME_POS 0
153
+
149 154
 //// MOVEMENT SETTINGS
150 155
 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
151 156
 #define HOMING_FEEDRATE {1500, 1500, 80, 0} // {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
@@ -182,7 +187,7 @@ const bool Z_ENDSTOPS_INVERTING = false; // set to true to invert the logic of t
182 187
 //#define ULTRA_LCD  //general lcd support, also 16x2
183 188
 #define SDSUPPORT // Enable SD Card Support in Hardware Console
184 189
 
185
-//#define ULTIPANEL
190
+#define ULTIPANEL
186 191
 #ifdef ULTIPANEL
187 192
   #define NEWPANEL  //enable this if you have a click-encoder panel
188 193
   #define SDSUPPORT

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

@@ -509,7 +509,7 @@ bool code_seen(char code)
509 509
     feedrate = homing_feedrate[LETTER##_AXIS]/2 ;  \
510 510
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
511 511
     \
512
-    current_position[LETTER##_AXIS] = (LETTER##_HOME_DIR == -1) ? 0 : LETTER##_MAX_LENGTH;\
512
+    current_position[LETTER##_AXIS] = (LETTER##_HOME_DIR == -1) ? LETTER##_HOME_POS : LETTER##_MAX_LENGTH;\
513 513
     destination[LETTER##_AXIS] = current_position[LETTER##_AXIS];\
514 514
     feedrate = 0.0;\
515 515
     st_synchronize();\
@@ -577,8 +577,8 @@ void process_commands()
577 577
           feedrate =homing_feedrate[Y_AXIS]; 
578 578
         prepare_move(); 
579 579
     
580
-        current_position[X_AXIS] = (X_HOME_DIR == -1) ? 0 : X_MAX_LENGTH;
581
-        current_position[Y_AXIS] = (Y_HOME_DIR == -1) ? 0 : Y_MAX_LENGTH;
580
+        current_position[X_AXIS] = (X_HOME_DIR == -1) ? X_HOME_POS : X_MAX_LENGTH;
581
+        current_position[Y_AXIS] = (Y_HOME_DIR == -1) ? Y_HOME_POS : Y_MAX_LENGTH;
582 582
         plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
583 583
         destination[X_AXIS] = current_position[X_AXIS];
584 584
         destination[Y_AXIS] = current_position[Y_AXIS];

+ 21
- 1
Marlin/language.h Прегледај датотеку

@@ -25,6 +25,7 @@
25 25
 	#define MSG_PREHEAT " Preheat"
26 26
 	#define MSG_COOLDOWN " Cooldown"
27 27
 	#define MSG_EXTRUDE " Extrude"
28
+        #define MSG_MOVE_AXIS " Move Axis      \x7E"
28 29
 	#define MSG_SPEED " Speed:"
29 30
 	#define MSG_NOZZLE " \002Nozzle:"
30 31
 	#define MSG_BED " \002Bed:"
@@ -52,6 +53,9 @@
52 53
 	#define MSG_VTRAV_MIN " VTrav min:"
53 54
 	#define MSG_AMAX " Amax "
54 55
 	#define MSG_A_RETRACT " A-retract:"
56
+	#define MSG_XSTEPS " Xsteps/mm:"
57
+	#define MSG_YSTEPS " Ysteps/mm:"
58
+	#define MSG_ZSTEPS " Zsteps/mm:"
55 59
 	#define MSG_ESTEPS " Esteps/mm:"
56 60
 	#define MSG_MAIN_WIDE " Main        \003"
57 61
 	#define MSG_TEMPERATURE_WIDE " Temperature \x7E"
@@ -86,6 +90,7 @@
86 90
 	#define MSG_PREHEAT " Preheat"
87 91
 	#define MSG_COOLDOWN " Cooldown"
88 92
 	#define MSG_EXTRUDE " Extrude"
93
+        #define MSG_MOVE_AXIS " Move Axis      \x7E"
89 94
 	#define MSG_SPEED " Speed:"
90 95
 	#define MSG_NOZZLE " \002Nozzle:"
91 96
 	#define MSG_BED " \002Bed:"
@@ -113,6 +118,9 @@
113 118
 	#define MSG_VTRAV_MIN " VTrav min:"
114 119
 	#define MSG_AMAX " Amax "
115 120
 	#define MSG_A_RETRACT " A-retract:"
121
+	#define MSG_XSTEPS " Xsteps/mm:"
122
+	#define MSG_YSTEPS " Ysteps/mm:"
123
+	#define MSG_ZSTEPS " Zsteps/mm:"
116 124
 	#define MSG_ESTEPS " Esteps/mm:"
117 125
 	#define MSG_MAIN_WIDE " Main        \003"
118 126
 	#define MSG_TEMPERATURE_WIDE " Temperature \x7E"
@@ -147,6 +155,7 @@
147 155
 	#define MSG_PREHEAT " Preheat"
148 156
 	#define MSG_COOLDOWN " Cooldown"
149 157
 	#define MSG_EXTRUDE " Extrude"
158
+        #define MSG_MOVE_AXIS " Move Axis      \x7E"
150 159
 	#define MSG_SPEED " Speed:"
151 160
 	#define MSG_NOZZLE " \002Nozzle:"
152 161
 	#define MSG_BED " \002Bed:"
@@ -174,6 +183,9 @@
174 183
 	#define MSG_VTRAV_MIN " VTrav min:"
175 184
 	#define MSG_AMAX " Amax "
176 185
 	#define MSG_A_RETRACT " A-retract:"
186
+	#define MSG_XSTEPS " Xsteps/mm:"
187
+	#define MSG_YSTEPS " Ysteps/mm:"
188
+	#define MSG_ZSTEPS " Zsteps/mm:"
177 189
 	#define MSG_ESTEPS " Esteps/mm:"
178 190
 	#define MSG_MAIN_WIDE " Main        \003"
179 191
 	#define MSG_TEMPERATURE_WIDE " Temperature \x7E"
@@ -208,6 +220,7 @@
208 220
 	#define MSG_PREHEAT " Preheat"
209 221
 	#define MSG_COOLDOWN " Cooldown"
210 222
 	#define MSG_EXTRUDE " Extrude"
223
+        #define MSG_MOVE_AXIS " Move Axis      \x7E"
211 224
 	#define MSG_SPEED " Speed:"
212 225
 	#define MSG_NOZZLE " \002Nozzle:"
213 226
 	#define MSG_BED " \002Bed:"
@@ -235,6 +248,9 @@
235 248
 	#define MSG_VTRAV_MIN " VTrav min:"
236 249
 	#define MSG_AMAX " Amax "
237 250
 	#define MSG_A_RETRACT " A-retract:"
251
+	#define MSG_XSTEPS " Xsteps/mm:"
252
+	#define MSG_YSTEPS " Ysteps/mm:"
253
+	#define MSG_ZSTEPS " Zsteps/mm:"
238 254
 	#define MSG_ESTEPS " Esteps/mm:"
239 255
 	#define MSG_MAIN_WIDE " Main        \003"
240 256
 	#define MSG_TEMPERATURE_WIDE " Temperature \x7E"
@@ -269,6 +285,7 @@
269 285
 	#define MSG_PREHEAT " Preheat"
270 286
 	#define MSG_COOLDOWN " Cooldown"
271 287
 	#define MSG_EXTRUDE " Extrude"
288
+        #define MSG_MOVE_AXIS " Move Axis      \x7E"
272 289
 	#define MSG_SPEED " Speed:"
273 290
 	#define MSG_NOZZLE " \002Nozzle:"
274 291
 	#define MSG_BED " \002Bed:"
@@ -296,6 +313,9 @@
296 313
 	#define MSG_VTRAV_MIN " VTrav min:"
297 314
 	#define MSG_AMAX " Amax "
298 315
 	#define MSG_A_RETRACT " A-retract:"
316
+	#define MSG_XSTEPS " Xsteps/mm:"
317
+	#define MSG_YSTEPS " Ysteps/mm:"
318
+	#define MSG_ZSTEPS " Zsteps/mm:"
299 319
 	#define MSG_ESTEPS " Esteps/mm:"
300 320
 	#define MSG_MAIN_WIDE " Main        \003"
301 321
 	#define MSG_TEMPERATURE_WIDE " Temperature \x7E"
@@ -315,4 +335,4 @@
315 335
 
316 336
 #endif
317 337
 
318
-#endif // ifndef LANGUAGE_H
338
+#endif // ifndef LANGUAGE_H

+ 3
- 3
Marlin/planner.cpp Прегледај датотеку

@@ -446,9 +446,9 @@ void plan_buffer_line(float &x, float &y, float &z, float &e, float feed_rate, u
446 446
 
447 447
   
448 448
   if (min_software_endstops) {
449
-    if (x < 0) x = 0;
450
-    if (y < 0) y = 0;
451
-    if (z < 0) z = 0;
449
+    if (x < X_HOME_POS) x = X_HOME_POS;
450
+    if (y < Y_HOME_POS) y = Y_HOME_POS;
451
+    if (z < Z_HOME_POS) z = Z_HOME_POS;
452 452
   }
453 453
 
454 454
   if (max_software_endstops) {

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

@@ -372,7 +372,7 @@ void MainMenu::showStatus()
372 372
   if((currentz!=oldzpos)||force_lcd_update)
373 373
   {
374 374
     lcd.setCursor(10,1);
375
-    lcdprintPGM("Z:");lcd.print(ftostr32(current_position[2]));
375
+    lcdprintPGM("Z:");lcd.print(ftostr52(current_position[2]));
376 376
     oldzpos=currentz;
377 377
   }
378 378
   static int oldfeedmultiply=0;
@@ -411,7 +411,6 @@ void MainMenu::showStatus()
411 411
      lcd.setCursor(7,2);
412 412
     lcd.print(itostr3((int)percent));
413 413
     lcdprintPGM("%SD");
414
-    
415 414
   }
416 415
   
417 416
 #else //smaller LCDS----------------------------------
@@ -485,7 +484,7 @@ void MainMenu::showPrepare()
485 484
       MENUITEM(  lcdprintPGM(MSG_DISABLE_STEPPERS)  ,  BLOCK;enquecommand("M84");beepshort(); ) ;
486 485
       break;
487 486
     case ItemP_home:
488
-      MENUITEM(  lcdprintPGM(MSG_AUTO_HOME)  ,  BLOCK;enquecommand("G28 X0 Y0 Z0");beepshort(); ) ;
487
+      MENUITEM(  lcdprintPGM(MSG_AUTO_HOME)  ,  BLOCK;enquecommand("G28");beepshort(); ) ;
489 488
       break;
490 489
     case ItemP_origin:
491 490
       MENUITEM(  lcdprintPGM(MSG_SET_ORIGIN)  ,  BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ;
@@ -500,7 +499,7 @@ void MainMenu::showPrepare()
500 499
   //    MENUITEM(  lcdprintPGM(" Extrude")  ,  BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E50");beepshort(); ) ;
501 500
     //  break;
502 501
     case ItemP_move:
503
-      MENUITEM(  lcdprintPGM(" Move Axis      \x7E") , BLOCK;status=Sub_PrepareMove;beepshort(); );
502
+      MENUITEM(  lcdprintPGM(MSG_MOVE_AXIS) , BLOCK;status=Sub_PrepareMove;beepshort(); );
504 503
       break;
505 504
         default:   
506 505
       break;
@@ -664,7 +663,7 @@ void MainMenu::showAxisMove()
664 663
           }
665 664
           break;
666 665
           case ItemAM_E:
667
-          MENUITEM(  lcdprintPGM(" Extrude")  ,  BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E5");beepshort(); ) ;
666
+          MENUITEM(  lcdprintPGM(MSG_EXTRUDE)  ,  BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E5");beepshort(); ) ;
668 667
           break;
669 668
           default:
670 669
           break;
@@ -703,7 +702,7 @@ void MainMenu::showTune()
703 702
       if((activeline!=line) )
704 703
         break;
705 704
       
706
-      if(CLICKED) //nalogWrite(FAN_PIN,  fanpwm);
705
+      if(CLICKED) //AnalogWrite(FAN_PIN,  fanpwm);
707 706
       {
708 707
         linechanging=!linechanging;
709 708
         if(linechanging)
@@ -1597,7 +1596,7 @@ void MainMenu::showControlMotion()
1597 1596
          {
1598 1597
       if(force_lcd_update)
1599 1598
         {
1600
-          lcd.setCursor(0,line);lcdprintPGM(" X steps/mm:");
1599
+          lcd.setCursor(0,line);lcdprintPGM(MSG_XSTEPS);
1601 1600
           lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[0]));
1602 1601
         }
1603 1602
         
@@ -1609,11 +1608,11 @@ void MainMenu::showControlMotion()
1609 1608
           linechanging=!linechanging;
1610 1609
           if(linechanging)
1611 1610
           {
1612
-              encoderpos=(int)axis_steps_per_unit[0];
1611
+              encoderpos=(int)(axis_steps_per_unit[0]*100.0);
1613 1612
           }
1614 1613
           else
1615 1614
           {
1616
-            float factor=float(encoderpos)/100/float(axis_steps_per_unit[0]);
1615
+            float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[0]);
1617 1616
             position[X_AXIS]=lround(position[X_AXIS]*factor);
1618 1617
             //current_position[3]*=factor;
1619 1618
             axis_steps_per_unit[X_AXIS]= encoderpos/100.0;
@@ -1634,8 +1633,8 @@ void MainMenu::showControlMotion()
1634 1633
          {
1635 1634
       if(force_lcd_update)
1636 1635
         {
1637
-          lcd.setCursor(0,line);lcdprintPGM(" Y steps/mm:");
1638
-          lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[1]));
1636
+          lcd.setCursor(0,line);lcdprintPGM(MSG_YSTEPS);
1637
+          lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[1]));
1639 1638
         }
1640 1639
         
1641 1640
         if((activeline!=line) )
@@ -1646,14 +1645,14 @@ void MainMenu::showControlMotion()
1646 1645
           linechanging=!linechanging;
1647 1646
           if(linechanging)
1648 1647
           {
1649
-              encoderpos=(int)axis_steps_per_unit[1];
1648
+              encoderpos=(int)(axis_steps_per_unit[1]*100.0);
1650 1649
           }
1651 1650
           else
1652 1651
           {
1653
-            float factor=float(encoderpos)/float(axis_steps_per_unit[1]);
1652
+            float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[1]);
1654 1653
             position[Y_AXIS]=lround(position[Y_AXIS]*factor);
1655 1654
             //current_position[3]*=factor;
1656
-            axis_steps_per_unit[Y_AXIS]= encoderpos;
1655
+            axis_steps_per_unit[Y_AXIS]= encoderpos/100.0;
1657 1656
             encoderpos=activeline*lcdslow;
1658 1657
               
1659 1658
           }
@@ -1664,7 +1663,7 @@ void MainMenu::showControlMotion()
1664 1663
         {
1665 1664
           if(encoderpos<5) encoderpos=5;
1666 1665
           if(encoderpos>9999) encoderpos=9999;
1667
-          lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
1666
+          lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
1668 1667
         }
1669 1668
         
1670 1669
       }break;
@@ -1672,8 +1671,8 @@ void MainMenu::showControlMotion()
1672 1671
          {
1673 1672
       if(force_lcd_update)
1674 1673
         {
1675
-          lcd.setCursor(0,line);lcdprintPGM(" Z steps/mm:");
1676
-          lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[2]));
1674
+          lcd.setCursor(0,line);lcdprintPGM(MSG_ZSTEPS);
1675
+          lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[2]));
1677 1676
         }
1678 1677
         
1679 1678
         if((activeline!=line) )
@@ -1684,14 +1683,14 @@ void MainMenu::showControlMotion()
1684 1683
           linechanging=!linechanging;
1685 1684
           if(linechanging)
1686 1685
           {
1687
-              encoderpos=(int)axis_steps_per_unit[2];
1686
+              encoderpos=(int)(axis_steps_per_unit[2]*100.0);
1688 1687
           }
1689 1688
           else
1690 1689
           {
1691
-            float factor=float(encoderpos)/float(axis_steps_per_unit[2]);
1690
+            float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[2]);
1692 1691
             position[Z_AXIS]=lround(position[Z_AXIS]*factor);
1693 1692
             //current_position[3]*=factor;
1694
-            axis_steps_per_unit[Z_AXIS]= encoderpos;
1693
+            axis_steps_per_unit[Z_AXIS]= encoderpos/100.0;
1695 1694
             encoderpos=activeline*lcdslow;
1696 1695
               
1697 1696
           }
@@ -1702,7 +1701,7 @@ void MainMenu::showControlMotion()
1702 1701
         {
1703 1702
           if(encoderpos<5) encoderpos=5;
1704 1703
           if(encoderpos>9999) encoderpos=9999;
1705
-          lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
1704
+          lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
1706 1705
         }
1707 1706
         
1708 1707
       }break;
@@ -1712,7 +1711,7 @@ void MainMenu::showControlMotion()
1712 1711
       if(force_lcd_update)
1713 1712
         {
1714 1713
           lcd.setCursor(0,line);lcdprintPGM(MSG_ESTEPS);
1715
-          lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[3]));
1714
+          lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[3]));
1716 1715
         }
1717 1716
         
1718 1717
         if((activeline!=line) )
@@ -1723,14 +1722,14 @@ void MainMenu::showControlMotion()
1723 1722
           linechanging=!linechanging;
1724 1723
           if(linechanging)
1725 1724
           {
1726
-              encoderpos=(int)axis_steps_per_unit[3];
1725
+              encoderpos=(int)(axis_steps_per_unit[3]*100.0);
1727 1726
           }
1728 1727
           else
1729 1728
           {
1730
-            float factor=float(encoderpos)/float(axis_steps_per_unit[3]);
1729
+            float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[3]);
1731 1730
             position[E_AXIS]=lround(position[E_AXIS]*factor);
1732 1731
             //current_position[3]*=factor;
1733
-            axis_steps_per_unit[E_AXIS]= encoderpos;
1732
+            axis_steps_per_unit[E_AXIS]= encoderpos/100.0;
1734 1733
             encoderpos=activeline*lcdslow;
1735 1734
               
1736 1735
           }
@@ -1741,7 +1740,7 @@ void MainMenu::showControlMotion()
1741 1740
         {
1742 1741
           if(encoderpos<5) encoderpos=5;
1743 1742
           if(encoderpos>9999) encoderpos=9999;
1744
-          lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
1743
+          lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
1745 1744
         }
1746 1745
         
1747 1746
       }break; 

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