Skip to content
Browse files

made it possible to have an intermediate M92 command without the extr…

…uder motor running wild.
  • Loading branch information...
1 parent 259a5ac commit 81202a8d303a848fc99c29a1f817a727f84450b1 @bkubicek committed Nov 3, 2011
Showing with 64 additions and 21 deletions.
  1. +16 −10 Marlin/Marlin.pde
  2. +48 −11 Marlin/ultralcd.pde
View
26 Marlin/Marlin.pde
@@ -178,6 +178,7 @@ float mintravelfeedrate;
// Manage heater variables.
#include "EEPROM.h"
+static long position[4]; //in steps
static block_t *current_block; // A pointer to the block currently being traced
@@ -1073,7 +1074,12 @@ inline void process_commands()
break;
case 92: // M92
for(int i=0; i < NUM_AXIS; i++) {
- if(code_seen(axis_codes[i])) axis_steps_per_unit[i] = code_value();
+ if(code_seen(axis_codes[i]))
+ {
+ float factor=float(code_value())/float(axis_steps_per_unit[3]);
+ position[E_AXIS]=lround(position[E_AXIS]*factor);
+ axis_steps_per_unit[i] = code_value();
+ }
}
break;
@@ -1729,7 +1735,6 @@ static volatile unsigned char block_buffer_head; // Index of the next
static volatile unsigned char block_buffer_tail; // Index of the block to process now
// The current position of the tool in absolute steps
-static long position[4];
#define ONE_MINUTE_OF_MICROSECONDS 60000000.0
@@ -2032,14 +2037,7 @@ void check_axes_activity() {
// mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration
// calculation the caller must also provide the physical length of the line in millimeters.
void plan_buffer_line(float x, float y, float z, float e, float feed_rate) {
-
- // The target position of the tool in absolute steps
- // Calculate target position in absolute steps
- long target[4];
- target[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]);
- target[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]);
- target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]);
- target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]);
+
// Calculate the buffer head after we push this byte
int next_buffer_head = (block_buffer_head + 1) %BLOCK_BUFFER_SIZE;
@@ -2051,6 +2049,14 @@ void plan_buffer_line(float x, float y, float z, float e, float feed_rate) {
manage_inactivity(1);
}
+ // The target position of the tool in absolute steps
+ // Calculate target position in absolute steps
+ long target[4];
+ target[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]);
+ target[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]);
+ target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]);
+ target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]);
+
// Prepare to set up new block
block_t *block = &block_buffer[block_buffer_head];
View
59 Marlin/ultralcd.pde
@@ -503,7 +503,7 @@ enum {
ItemC_fan,
ItemC_acc, ItemC_xyjerk,
ItemC_vmaxx, ItemC_vmaxy, ItemC_vmaxz, ItemC_vmaxe,
- ItemC_vmin,
+ ItemC_vtravmin,ItemC_vmin,
ItemC_amaxx, ItemC_amaxy, ItemC_amaxz, ItemC_amaxe,
ItemC_aret,ItemC_esteps, ItemC_store, ItemC_load,ItemC_failsafe
};
@@ -710,7 +710,7 @@ void MainMenu::showControl()
if(force_lcd_update)
{
lcd.setCursor(0,line);lcd.print(" PID-I: ");
- lcd.setCursor(13,line);lcd.print(itostr4(Ki));
+ lcd.setCursor(13,line);lcd.print(ftostr51(Ki));
}
if((activeline==line) )
@@ -720,11 +720,11 @@ void MainMenu::showControl()
linechanging=!linechanging;
if(linechanging)
{
- encoderpos=(int)Ki/5;
+ encoderpos=(int)(Ki*10);
}
else
{
- Ki= encoderpos*5;
+ Ki= encoderpos/10.;
encoderpos=activeline*lcdslow;
}
@@ -734,8 +734,8 @@ void MainMenu::showControl()
if(linechanging)
{
if(encoderpos<0) encoderpos=0;
- if(encoderpos>9990/5) encoderpos=9990/5;
- lcd.setCursor(13,line);lcd.print(itostr4(encoderpos*5));
+ if(encoderpos>9990) encoderpos=9990;
+ lcd.setCursor(13,line);lcd.print(ftostr51(encoderpos/10.));
}
}
}break;
@@ -867,7 +867,7 @@ void MainMenu::showControl()
linechanging=!linechanging;
if(linechanging)
{
- encoderpos=(int)minimumfeedrate/60;
+ encoderpos=(int)(minimumfeedrate/60.);
}
else
{
@@ -886,6 +886,40 @@ void MainMenu::showControl()
}
}
}break;
+ case ItemC_vtravmin:
+ {
+ if(force_lcd_update)
+ {
+ lcd.setCursor(0,line);lcd.print(" VTrav min:");
+ lcd.setCursor(13,line);lcd.print(itostr3(mintravelfeedrate/60));
+ }
+
+ if((activeline==line) )
+ {
+ if(CLICKED)
+ {
+ linechanging=!linechanging;
+ if(linechanging)
+ {
+ encoderpos=(int)mintravelfeedrate/60;
+ }
+ else
+ {
+ mintravelfeedrate= encoderpos*60;
+ encoderpos=activeline*lcdslow;
+
+ }
+ BLOCK;
+ beepshort();
+ }
+ if(linechanging)
+ {
+ if(encoderpos<0) encoderpos=0;
+ if(encoderpos>990) encoderpos=990;
+ lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
+ }
+ }
+ }break;
case ItemC_amaxx:
case ItemC_amaxy:
@@ -966,7 +1000,7 @@ void MainMenu::showControl()
if(force_lcd_update)
{
lcd.setCursor(0,line);lcd.print(" Esteps/mm:");
- lcd.setCursor(13,line);lcd.print(itostr3(axis_steps_per_unit[3]));
+ lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[3]));
}
if((activeline==line) )
@@ -980,7 +1014,10 @@ void MainMenu::showControl()
}
else
{
- axis_steps_per_unit[3]= encoderpos;
+ float factor=float(encoderpos)/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;
encoderpos=activeline*lcdslow;
}
@@ -990,8 +1027,8 @@ void MainMenu::showControl()
if(linechanging)
{
if(encoderpos<5) encoderpos=5;
- if(encoderpos>990) encoderpos=990;
- lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
+ if(encoderpos>9999) encoderpos=9999;
+ lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
}
}
}break;

0 comments on commit 81202a8

Please sign in to comment.
Something went wrong with that request. Please try again.