Browse Source

Silent mode limits
+ cannot compile "END_FILE_SECTION"

Robert Pelnar 7 years ago
parent
commit
995801c967
2 changed files with 49 additions and 9 deletions
  1. 16 9
      Firmware/Configuration_prusa.h
  2. 33 0
      Firmware/planner.cpp

+ 16 - 9
Firmware/Configuration_prusa.h

@@ -63,17 +63,26 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
 #define Z_PAUSE_LIFT 20
 
 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
-#define HOMING_FEEDRATE {2500, 3000, 800, 0}  // set the homing speeds (mm/min) // 3000 is also valid for stallGuard homing. Valid range: 2200 - 3000
+#define HOMING_FEEDRATE {3000, 3000, 800, 0}  // set the homing speeds (mm/min) // 3000 is also valid for stallGuard homing. Valid range: 2200 - 3000
 
-//#define DEFAULT_MAX_FEEDRATE          {400, 400, 12, 120}    // (mm/sec)
-#define DEFAULT_MAX_FEEDRATE          {500, 500, 12, 120}    // (mm/sec)
-#define DEFAULT_MAX_ACCELERATION      {1000, 1000, 200, 5000}    // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot.
+#define DEFAULT_MAX_FEEDRATE          {500, 500, 12, 120}      // (mm/sec)   max feedrate (M203)
+#define DEFAULT_MAX_ACCELERATION      {1000, 1000, 200, 5000}  // (mm/sec^2) max acceleration (M201)
 
-#define DEFAULT_ACCELERATION          1250   // X, Y, Z and E max acceleration in mm/s^2 for printing moves
-#define DEFAULT_RETRACT_ACCELERATION  1250   // X, Y, Z and E max acceleration in mm/s^2 for retracts
+
+#define DEFAULT_ACCELERATION          1250   // X, Y, Z and E max acceleration in mm/s^2 for printing moves (M204S)
+#define DEFAULT_RETRACT_ACCELERATION  1250   // X, Y, Z and E max acceleration in mm/s^2 for retracts (M204T)
 
 #define MANUAL_FEEDRATE {2700, 2700, 1000, 100}   // set the speeds for manual moves (mm/min)
-//#define MAX_SILENT_FEEDRATE           2700   // 
+
+//Silent mode limits
+#define SILENT_MAX_ACCEL_X  800 // X-axis max acceleration in silent mode in mm/s^2
+#define SILENT_MAX_ACCEL_Y  800 // Y-axis max axxeleration in silent mode in mm/s^2
+#define SILENT_MAX_ACCEL_X_ST (100*SILENT_MAX_ACCEL_X) // X max accel in steps/s^2
+#define SILENT_MAX_ACCEL_Y_ST (100*SILENT_MAX_ACCEL_Y) // Y max accel in steps/s^2
+#define SILENT_MAX_FEEDRATE 80  //because mode switched to normal for homming in mm/s, this value limits also homing, it should be greater (80mm/s=4800mm/min>2700mm/min)
+
+//cannot compile (ultralcd.cpp, line 6165), please FIX
+#define END_FILE_SECTION 0
 
 #define Z_AXIS_ALWAYS_ON 1
 
@@ -512,8 +521,6 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
 #define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
 #endif
 
-#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
-
 // How much shall the print head be lifted on power panic?
 // Ideally the Z axis will reach a zero phase of the stepper driver on power outage. To simplify this,
 // UVLO_Z_AXIS_SHIFT shall be an integer multiply of the stepper driver cycle, that is 4x full step.

+ 33 - 0
Firmware/planner.cpp

@@ -63,6 +63,10 @@
 #include "mesh_bed_calibration.h"
 #endif
 
+#ifdef TMC2130
+#include "tmc2130.h"
+#endif //TMC2130
+
 //===========================================================================
 //=============================public variables ============================
 //===========================================================================
@@ -997,8 +1001,16 @@ 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
+	float max_fr = max_feedrate[i];
+	if ((tmc2130_mode == TMC2130_MODE_SILENT) && (i < 2))
+		max_fr = SILENT_MAX_FEEDRATE;
+    if(fabs(current_speed[i]) > max_fr)
+      speed_factor = min(speed_factor, max_fr / fabs(current_speed[i]));
+#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  
@@ -1023,6 +1035,26 @@ 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
+	if (tmc2130_mode == TMC2130_MODE_SILENT)
+	{
+		if(((float)block->acceleration_st * (float)block->steps_x / (float)block->step_event_count) > SILENT_MAX_ACCEL_X_ST)
+		  block->acceleration_st = SILENT_MAX_ACCEL_X_ST;
+		if(((float)block->acceleration_st * (float)block->steps_y / (float)block->step_event_count) > SILENT_MAX_ACCEL_Y_ST)
+		  block->acceleration_st = SILENT_MAX_ACCEL_Y_ST;
+	}
+	else
+	{
+		if(((float)block->acceleration_st * (float)block->steps_x / (float)block->step_event_count) > 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 / (float)block->step_event_count) > 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_e / (float)block->step_event_count) > axis_steps_per_sqr_second[E_AXIS])
+	  block->acceleration_st = axis_steps_per_sqr_second[E_AXIS];
+	if(((float)block->acceleration_st * (float)block->steps_z / (float)block->step_event_count ) > axis_steps_per_sqr_second[Z_AXIS])
+	  block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
+#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 / (float)block->step_event_count) > axis_steps_per_sqr_second[X_AXIS])
@@ -1033,6 +1065,7 @@ 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 / (float)block->step_event_count ) > 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;