TMC2130 old style limits removed

+menu draw_edit fix
This commit is contained in:
Robert Pelnar 2018-07-19 17:42:59 +02:00
parent b46953c790
commit c3e28b490c
4 changed files with 16 additions and 80 deletions

View File

@ -247,7 +247,7 @@ void menu_draw_float31(char chr, const char* str, float val)
char spaces[21];
strcpy_P(spaces, menu_20x_space);
spaces[12 - text_len] = 0;
lcd_printf_P(menu_draw_float31, chr, str, spaces, val);
lcd_printf_P(menu_fmt_float31, chr, str, spaces, val);
}
#define _menu_data (*((menu_data_edit_t*)menu_data))

View File

@ -953,32 +953,8 @@ Having the real displacement of the head, we can calculate the total movement le
for(int i=0; i < 4; i++)
{
current_speed[i] = delta_mm[i] * inverse_second;
#ifdef TMC2130
#ifdef FEEDRATE_LIMIT
float max_fr = max_feedrate[i];
if (i < 2) // X, Y
{
if (tmc2130_mode == TMC2130_MODE_SILENT)
{
if (max_fr > SILENT_MAX_FEEDRATE)
max_fr = SILENT_MAX_FEEDRATE;
}
else
{
if (max_fr > NORMAL_MAX_FEEDRATE)
max_fr = NORMAL_MAX_FEEDRATE;
}
}
if(fabs(current_speed[i]) > max_fr)
speed_factor = min(speed_factor, max_fr / fabs(current_speed[i]));
#else //FEEDRATE_LIMIT
if(fabs(current_speed[i]) > max_feedrate[i])
if(fabs(current_speed[i]) > max_feedrate[i])
speed_factor = min(speed_factor, max_feedrate[i] / fabs(current_speed[i]));
#endif //FEEDRATE_LIMIT
#else //TMC2130
if(fabs(current_speed[i]) > max_feedrate[i])
speed_factor = min(speed_factor, max_feedrate[i] / fabs(current_speed[i]));
#endif //TMC2130
}
// Correct the speed
@ -1003,45 +979,6 @@ Having the real displacement of the head, we can calculate the total movement le
else
{
block->acceleration_st = ceil(acceleration * steps_per_mm); // convert to: acceleration steps/sec^2
#ifdef TMC2130
#ifdef SIMPLE_ACCEL_LIMIT // in some cases can be acceleration limited inproperly
if (tmc2130_mode == TMC2130_MODE_SILENT)
{
if (block->steps_x.wide || block->steps_y.wide)
if (block->acceleration_st > SILENT_MAX_ACCEL_ST) block->acceleration_st = SILENT_MAX_ACCEL_ST;
}
else
{
if (block->steps_x.wide || block->steps_y.wide)
if (block->acceleration_st > NORMAL_MAX_ACCEL_ST) block->acceleration_st = NORMAL_MAX_ACCEL_ST;
}
if (block->steps_x.wide && (block->acceleration_st > axis_steps_per_sqr_second[X_AXIS])) block->acceleration_st = axis_steps_per_sqr_second[X_AXIS];
if (block->steps_y.wide && (block->acceleration_st > axis_steps_per_sqr_second[Y_AXIS])) block->acceleration_st = axis_steps_per_sqr_second[Y_AXIS];
if (block->steps_z.wide && (block->acceleration_st > axis_steps_per_sqr_second[Z_AXIS])) block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
if (block->steps_e.wide && (block->acceleration_st > axis_steps_per_sqr_second[E_AXIS])) block->acceleration_st = axis_steps_per_sqr_second[E_AXIS];
#else // SIMPLE_ACCEL_LIMIT
#ifdef ACCEL_LIMIT
if (tmc2130_mode == TMC2130_MODE_SILENT)
{
if ((block->steps_x.wide > block->step_event_count.wide / 2) || (block->steps_y.wide > block->step_event_count.wide / 2))
if (block->acceleration_st > SILENT_MAX_ACCEL_ST) block->acceleration_st = SILENT_MAX_ACCEL_ST;
}
else
{
if ((block->steps_x.wide > block->step_event_count.wide / 2) || (block->steps_y.wide > block->step_event_count.wide / 2))
if (block->acceleration_st > NORMAL_MAX_ACCEL_ST) block->acceleration_st = NORMAL_MAX_ACCEL_ST;
}
if(((float)block->acceleration_st * (float)block->steps_x.wide / (float)block->step_event_count.wide) > axis_steps_per_sqr_second[X_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[X_AXIS];
if(((float)block->acceleration_st * (float)block->steps_y.wide / (float)block->step_event_count.wide) > axis_steps_per_sqr_second[Y_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[Y_AXIS];
if(((float)block->acceleration_st * (float)block->steps_z.wide / (float)block->step_event_count.wide) > axis_steps_per_sqr_second[Z_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
if(((float)block->acceleration_st * (float)block->steps_e.wide / (float)block->step_event_count.wide) > axis_steps_per_sqr_second[E_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[E_AXIS];
#endif // ACCEL_LIMIT
#endif // SIMPLE_ACCEL_LIMIT
#else //TMC2130
// Limit acceleration per axis
//FIXME Vojtech: One shall rather limit a projection of the acceleration vector instead of using the limit.
if(((float)block->acceleration_st * (float)block->steps_x.wide / (float)block->step_event_count.wide) > axis_steps_per_sqr_second[X_AXIS])
@ -1052,7 +989,6 @@ Having the real displacement of the head, we can calculate the total movement le
block->acceleration_st = axis_steps_per_sqr_second[E_AXIS];
if(((float)block->acceleration_st * (float)block->steps_z.wide / (float)block->step_event_count.wide ) > axis_steps_per_sqr_second[Z_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
#endif //TMC2130
}
// Acceleration of the segment, in mm/sec^2
block->acceleration = block->acceleration_st / steps_per_mm;

View File

@ -2665,7 +2665,7 @@ static void lcd_move_e()
if (lcd_draw_update)
{
lcd_set_cursor(0, 1);
menu_draw_float31(' ', name, current_position[E_AXIS]);
menu_draw_float31(' ', PSTR("Extruder"), current_position[E_AXIS]);
}
if (LCD_CLICKED) menu_back();
}
@ -2856,7 +2856,10 @@ static void _lcd_babystep(int axis, const char *msg)
lcd_draw_update = 1;
}
if (lcd_draw_update)
lcd_drawedit_2(msg, ftostr13ns(menuData.babyStep.babystepMemMM[axis]));
{
lcd_set_cursor(0, 1);
menu_draw_float31(' ', msg, menuData.babyStep.babystepMemMM[axis]);
}
if (LCD_CLICKED || menuExiting)
{
// Only update the EEPROM when leaving the menu.

View File

@ -86,8 +86,11 @@
*/
#define SHEET_PRINT_ZERO_REF_Y -2.f
#define DEFAULT_MAX_FEEDRATE {200, 200, 12, 120} // (mm/sec) max feedrate (M203)
#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // (mm/sec^2) max acceleration (M201)
#define DEFAULT_MAX_FEEDRATE {200, 200, 12, 120} // (mm/sec) max feedrate (M203)
#define DEFAULT_MAX_FEEDRATE_SILENT {172, 172, 12, 120} // (mm/sec) max feedrate (M203), silent mode
#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // (mm/sec^2) max acceleration (M201)
#define DEFAULT_MAX_ACCELERATION_SILENT {960, 960, 200, 5000} // (mm/sec^2) max acceleration (M201), silent mode
#define DEFAULT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for printing moves (M204S)
@ -96,18 +99,12 @@
#define MANUAL_FEEDRATE {2700, 2700, 1000, 100} // set the speeds for manual moves (mm/min)
//Silent mode limits
//#define SILENT_MAX_ACCEL 960 // max axxeleration in silent mode in mm/s^2
//#define SILENT_MAX_ACCEL_ST (100*SILENT_MAX_ACCEL) // max accel in steps/s^2
//#define SILENT_MAX_FEEDRATE 172 //max feedrate in mm/s, because mode switched to normal for homming , this value limits also homing, it should be greater (172mm/s=9600mm/min>2700mm/min)
#define SILENT_MAX_ACCEL_XY 960 // max acceleration in silent mode in mm/s^2
#define SILENT_MAX_FEEDRATE_XY 172 // max feedrate in mm/s
//Normal mode limits
//#define NORMAL_MAX_ACCEL 2500 // Y-axis max axxeleration in normal mode in mm/s^2
//#define NORMAL_MAX_ACCEL_ST (100*NORMAL_MAX_ACCEL) // max accel in steps/s^2
//#define NORMAL_MAX_FEEDRATE 200 //max feedrate in mm/s, because mode switched to normal for homming , this value limits also homing, it should be greater (172mm/s=9600mm/min>2700mm/min)
//#define FEEDRATE_LIMIT //limitation method for normal/silent
//#define ACCEL_LIMIT //limitation method for normal/silent
//#define SIMPLE_ACCEL_LIMIT //new limitation method for normal/silent
#define NORMAL_MAX_ACCEL_XY 2500 // max acceleration in normal mode in mm/s^2
#define NORMAL_MAX_FEEDRATE_XY 200 // max feedrate in mm/s
//number of bytes from end of the file to start check
#define END_FILE_SECTION 10000