chiark / gitweb /
Added HOME_POS. This adds the posibility to make the center 0
authorErik van der Zalm <erik@vdzalm.eu>
Wed, 22 Feb 2012 17:07:56 +0000 (18:07 +0100)
committerErik van der Zalm <erik@vdzalm.eu>
Wed, 22 Feb 2012 17:07:56 +0000 (18:07 +0100)
Updated the Xsteps ... settings via the LCD menu

Marlin/Configuration.h
Marlin/Marlin.pde
Marlin/language.h
Marlin/planner.cpp
Marlin/ultralcd.pde

index 545b82b7a89abb07c9bf43c7e2c174daef643e4c..ef0d206a87279b6ea55f8eb4b4bc2daf01bffcc4 100644 (file)
@@ -146,6 +146,11 @@ const bool Z_ENDSTOPS_INVERTING = false; // set to true to invert the logic of t
 #define Y_MAX_LENGTH 185
 #define Z_MAX_LENGTH 90
 
+// The position of the homing switches. Use MAX_LENGTH * -0.5 if the center should be 0, 0, 0
+#define X_HOME_POS 0
+#define Y_HOME_POS 0
+#define Z_HOME_POS 0
+
 //// MOVEMENT SETTINGS
 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
 #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
 //#define ULTRA_LCD  //general lcd support, also 16x2
 #define SDSUPPORT // Enable SD Card Support in Hardware Console
 
-//#define ULTIPANEL
+#define ULTIPANEL
 #ifdef ULTIPANEL
   #define NEWPANEL  //enable this if you have a click-encoder panel
   #define SDSUPPORT
index bf31df24564decc759c2914804759cc5f2995b54..49753fb45d493853f5b7a365f26732080708bc42 100644 (file)
@@ -509,7 +509,7 @@ bool code_seen(char code)
     feedrate = homing_feedrate[LETTER##_AXIS]/2 ;  \
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
     \
-    current_position[LETTER##_AXIS] = (LETTER##_HOME_DIR == -1) ? 0 : LETTER##_MAX_LENGTH;\
+    current_position[LETTER##_AXIS] = (LETTER##_HOME_DIR == -1) ? LETTER##_HOME_POS : LETTER##_MAX_LENGTH;\
     destination[LETTER##_AXIS] = current_position[LETTER##_AXIS];\
     feedrate = 0.0;\
     st_synchronize();\
@@ -577,8 +577,8 @@ void process_commands()
           feedrate =homing_feedrate[Y_AXIS]; 
         prepare_move(); 
     
-        current_position[X_AXIS] = (X_HOME_DIR == -1) ? 0 : X_MAX_LENGTH;
-        current_position[Y_AXIS] = (Y_HOME_DIR == -1) ? 0 : Y_MAX_LENGTH;
+        current_position[X_AXIS] = (X_HOME_DIR == -1) ? X_HOME_POS : X_MAX_LENGTH;
+        current_position[Y_AXIS] = (Y_HOME_DIR == -1) ? Y_HOME_POS : Y_MAX_LENGTH;
         plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
         destination[X_AXIS] = current_position[X_AXIS];
         destination[Y_AXIS] = current_position[Y_AXIS];
index 78fe30e989494746cbf4cc12eff410b846a02132..c87851401133e7f25b8534afed0577a775f8f435 100644 (file)
@@ -25,6 +25,7 @@
        #define MSG_PREHEAT " Preheat"
        #define MSG_COOLDOWN " Cooldown"
        #define MSG_EXTRUDE " Extrude"
+        #define MSG_MOVE_AXIS " Move Axis      \x7E"
        #define MSG_SPEED " Speed:"
        #define MSG_NOZZLE " \002Nozzle:"
        #define MSG_BED " \002Bed:"
@@ -52,6 +53,9 @@
        #define MSG_VTRAV_MIN " VTrav min:"
        #define MSG_AMAX " Amax "
        #define MSG_A_RETRACT " A-retract:"
+       #define MSG_XSTEPS " Xsteps/mm:"
+       #define MSG_YSTEPS " Ysteps/mm:"
+       #define MSG_ZSTEPS " Zsteps/mm:"
        #define MSG_ESTEPS " Esteps/mm:"
        #define MSG_MAIN_WIDE " Main        \003"
        #define MSG_TEMPERATURE_WIDE " Temperature \x7E"
@@ -86,6 +90,7 @@
        #define MSG_PREHEAT " Preheat"
        #define MSG_COOLDOWN " Cooldown"
        #define MSG_EXTRUDE " Extrude"
+        #define MSG_MOVE_AXIS " Move Axis      \x7E"
        #define MSG_SPEED " Speed:"
        #define MSG_NOZZLE " \002Nozzle:"
        #define MSG_BED " \002Bed:"
        #define MSG_VTRAV_MIN " VTrav min:"
        #define MSG_AMAX " Amax "
        #define MSG_A_RETRACT " A-retract:"
+       #define MSG_XSTEPS " Xsteps/mm:"
+       #define MSG_YSTEPS " Ysteps/mm:"
+       #define MSG_ZSTEPS " Zsteps/mm:"
        #define MSG_ESTEPS " Esteps/mm:"
        #define MSG_MAIN_WIDE " Main        \003"
        #define MSG_TEMPERATURE_WIDE " Temperature \x7E"
        #define MSG_PREHEAT " Preheat"
        #define MSG_COOLDOWN " Cooldown"
        #define MSG_EXTRUDE " Extrude"
+        #define MSG_MOVE_AXIS " Move Axis      \x7E"
        #define MSG_SPEED " Speed:"
        #define MSG_NOZZLE " \002Nozzle:"
        #define MSG_BED " \002Bed:"
        #define MSG_VTRAV_MIN " VTrav min:"
        #define MSG_AMAX " Amax "
        #define MSG_A_RETRACT " A-retract:"
+       #define MSG_XSTEPS " Xsteps/mm:"
+       #define MSG_YSTEPS " Ysteps/mm:"
+       #define MSG_ZSTEPS " Zsteps/mm:"
        #define MSG_ESTEPS " Esteps/mm:"
        #define MSG_MAIN_WIDE " Main        \003"
        #define MSG_TEMPERATURE_WIDE " Temperature \x7E"
        #define MSG_PREHEAT " Preheat"
        #define MSG_COOLDOWN " Cooldown"
        #define MSG_EXTRUDE " Extrude"
+        #define MSG_MOVE_AXIS " Move Axis      \x7E"
        #define MSG_SPEED " Speed:"
        #define MSG_NOZZLE " \002Nozzle:"
        #define MSG_BED " \002Bed:"
        #define MSG_VTRAV_MIN " VTrav min:"
        #define MSG_AMAX " Amax "
        #define MSG_A_RETRACT " A-retract:"
+       #define MSG_XSTEPS " Xsteps/mm:"
+       #define MSG_YSTEPS " Ysteps/mm:"
+       #define MSG_ZSTEPS " Zsteps/mm:"
        #define MSG_ESTEPS " Esteps/mm:"
        #define MSG_MAIN_WIDE " Main        \003"
        #define MSG_TEMPERATURE_WIDE " Temperature \x7E"
        #define MSG_PREHEAT " Preheat"
        #define MSG_COOLDOWN " Cooldown"
        #define MSG_EXTRUDE " Extrude"
+        #define MSG_MOVE_AXIS " Move Axis      \x7E"
        #define MSG_SPEED " Speed:"
        #define MSG_NOZZLE " \002Nozzle:"
        #define MSG_BED " \002Bed:"
        #define MSG_VTRAV_MIN " VTrav min:"
        #define MSG_AMAX " Amax "
        #define MSG_A_RETRACT " A-retract:"
+       #define MSG_XSTEPS " Xsteps/mm:"
+       #define MSG_YSTEPS " Ysteps/mm:"
+       #define MSG_ZSTEPS " Zsteps/mm:"
        #define MSG_ESTEPS " Esteps/mm:"
        #define MSG_MAIN_WIDE " Main        \003"
        #define MSG_TEMPERATURE_WIDE " Temperature \x7E"
 
 #endif
 
-#endif // ifndef LANGUAGE_H
\ No newline at end of file
+#endif // ifndef LANGUAGE_H
index b631eb45aa4003322239307e5788cc7c89ad3eb9..468d9fcac20da5168876690c659369248e285380 100644 (file)
@@ -446,9 +446,9 @@ void plan_buffer_line(float &x, float &y, float &z, float &e, float feed_rate, u
 
   
   if (min_software_endstops) {
-    if (x < 0) x = 0;
-    if (y < 0) y = 0;
-    if (z < 0) z = 0;
+    if (x < X_HOME_POS) x = X_HOME_POS;
+    if (y < Y_HOME_POS) y = Y_HOME_POS;
+    if (z < Z_HOME_POS) z = Z_HOME_POS;
   }
 
   if (max_software_endstops) {
index ff3cbc758bac8a93838a9d05de65c7c49cd73595..8c5033c7da21ff3d7a301a98ee5ecdef2e116ed6 100644 (file)
@@ -372,7 +372,7 @@ void MainMenu::showStatus()
   if((currentz!=oldzpos)||force_lcd_update)
   {
     lcd.setCursor(10,1);
-    lcdprintPGM("Z:");lcd.print(ftostr32(current_position[2]));
+    lcdprintPGM("Z:");lcd.print(ftostr52(current_position[2]));
     oldzpos=currentz;
   }
   static int oldfeedmultiply=0;
@@ -411,7 +411,6 @@ void MainMenu::showStatus()
      lcd.setCursor(7,2);
     lcd.print(itostr3((int)percent));
     lcdprintPGM("%SD");
-    
   }
   
 #else //smaller LCDS----------------------------------
@@ -485,7 +484,7 @@ void MainMenu::showPrepare()
       MENUITEM(  lcdprintPGM(MSG_DISABLE_STEPPERS)  ,  BLOCK;enquecommand("M84");beepshort(); ) ;
       break;
     case ItemP_home:
-      MENUITEM(  lcdprintPGM(MSG_AUTO_HOME)  ,  BLOCK;enquecommand("G28 X0 Y0 Z0");beepshort(); ) ;
+      MENUITEM(  lcdprintPGM(MSG_AUTO_HOME)  ,  BLOCK;enquecommand("G28");beepshort(); ) ;
       break;
     case ItemP_origin:
       MENUITEM(  lcdprintPGM(MSG_SET_ORIGIN)  ,  BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ;
@@ -500,7 +499,7 @@ void MainMenu::showPrepare()
   //    MENUITEM(  lcdprintPGM(" Extrude")  ,  BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E50");beepshort(); ) ;
     //  break;
     case ItemP_move:
-      MENUITEM(  lcdprintPGM(" Move Axis      \x7E") , BLOCK;status=Sub_PrepareMove;beepshort(); );
+      MENUITEM(  lcdprintPGM(MSG_MOVE_AXIS) , BLOCK;status=Sub_PrepareMove;beepshort(); );
       break;
         default:   
       break;
@@ -664,7 +663,7 @@ void MainMenu::showAxisMove()
           }
           break;
           case ItemAM_E:
-          MENUITEM(  lcdprintPGM(" Extrude")  ,  BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E5");beepshort(); ) ;
+          MENUITEM(  lcdprintPGM(MSG_EXTRUDE)  ,  BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E5");beepshort(); ) ;
           break;
           default:
           break;
@@ -703,7 +702,7 @@ void MainMenu::showTune()
       if((activeline!=line) )
         break;
       
-      if(CLICKED) //nalogWrite(FAN_PIN,  fanpwm);
+      if(CLICKED) //AnalogWrite(FAN_PIN,  fanpwm);
       {
         linechanging=!linechanging;
         if(linechanging)
@@ -1597,7 +1596,7 @@ void MainMenu::showControlMotion()
          {
       if(force_lcd_update)
         {
-          lcd.setCursor(0,line);lcdprintPGM(" X steps/mm:");
+          lcd.setCursor(0,line);lcdprintPGM(MSG_XSTEPS);
           lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[0]));
         }
         
@@ -1609,11 +1608,11 @@ void MainMenu::showControlMotion()
           linechanging=!linechanging;
           if(linechanging)
           {
-              encoderpos=(int)axis_steps_per_unit[0];
+              encoderpos=(int)(axis_steps_per_unit[0]*100.0);
           }
           else
           {
-            float factor=float(encoderpos)/100/float(axis_steps_per_unit[0]);
+            float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[0]);
             position[X_AXIS]=lround(position[X_AXIS]*factor);
             //current_position[3]*=factor;
             axis_steps_per_unit[X_AXIS]= encoderpos/100.0;
@@ -1634,8 +1633,8 @@ void MainMenu::showControlMotion()
          {
       if(force_lcd_update)
         {
-          lcd.setCursor(0,line);lcdprintPGM(" Y steps/mm:");
-          lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[1]));
+          lcd.setCursor(0,line);lcdprintPGM(MSG_YSTEPS);
+          lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[1]));
         }
         
         if((activeline!=line) )
@@ -1646,14 +1645,14 @@ void MainMenu::showControlMotion()
           linechanging=!linechanging;
           if(linechanging)
           {
-              encoderpos=(int)axis_steps_per_unit[1];
+              encoderpos=(int)(axis_steps_per_unit[1]*100.0);
           }
           else
           {
-            float factor=float(encoderpos)/float(axis_steps_per_unit[1]);
+            float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[1]);
             position[Y_AXIS]=lround(position[Y_AXIS]*factor);
             //current_position[3]*=factor;
-            axis_steps_per_unit[Y_AXIS]= encoderpos;
+            axis_steps_per_unit[Y_AXIS]= encoderpos/100.0;
             encoderpos=activeline*lcdslow;
               
           }
@@ -1664,7 +1663,7 @@ void MainMenu::showControlMotion()
         {
           if(encoderpos<5) encoderpos=5;
           if(encoderpos>9999) encoderpos=9999;
-          lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
+          lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
         }
         
       }break;
@@ -1672,8 +1671,8 @@ void MainMenu::showControlMotion()
          {
       if(force_lcd_update)
         {
-          lcd.setCursor(0,line);lcdprintPGM(" Z steps/mm:");
-          lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[2]));
+          lcd.setCursor(0,line);lcdprintPGM(MSG_ZSTEPS);
+          lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[2]));
         }
         
         if((activeline!=line) )
@@ -1684,14 +1683,14 @@ void MainMenu::showControlMotion()
           linechanging=!linechanging;
           if(linechanging)
           {
-              encoderpos=(int)axis_steps_per_unit[2];
+              encoderpos=(int)(axis_steps_per_unit[2]*100.0);
           }
           else
           {
-            float factor=float(encoderpos)/float(axis_steps_per_unit[2]);
+            float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[2]);
             position[Z_AXIS]=lround(position[Z_AXIS]*factor);
             //current_position[3]*=factor;
-            axis_steps_per_unit[Z_AXIS]= encoderpos;
+            axis_steps_per_unit[Z_AXIS]= encoderpos/100.0;
             encoderpos=activeline*lcdslow;
               
           }
@@ -1702,7 +1701,7 @@ void MainMenu::showControlMotion()
         {
           if(encoderpos<5) encoderpos=5;
           if(encoderpos>9999) encoderpos=9999;
-          lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
+          lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
         }
         
       }break;
@@ -1712,7 +1711,7 @@ void MainMenu::showControlMotion()
       if(force_lcd_update)
         {
           lcd.setCursor(0,line);lcdprintPGM(MSG_ESTEPS);
-          lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[3]));
+          lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[3]));
         }
         
         if((activeline!=line) )
@@ -1723,14 +1722,14 @@ void MainMenu::showControlMotion()
           linechanging=!linechanging;
           if(linechanging)
           {
-              encoderpos=(int)axis_steps_per_unit[3];
+              encoderpos=(int)(axis_steps_per_unit[3]*100.0);
           }
           else
           {
-            float factor=float(encoderpos)/float(axis_steps_per_unit[3]);
+            float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[3]);
             position[E_AXIS]=lround(position[E_AXIS]*factor);
             //current_position[3]*=factor;
-            axis_steps_per_unit[E_AXIS]= encoderpos;
+            axis_steps_per_unit[E_AXIS]= encoderpos/100.0;
             encoderpos=activeline*lcdslow;
               
           }
@@ -1741,7 +1740,7 @@ void MainMenu::showControlMotion()
         {
           if(encoderpos<5) encoderpos=5;
           if(encoderpos>9999) encoderpos=9999;
-          lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
+          lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
         }
         
       }break;