Save/restore the default feedrate correctly
Since the global feedrate can be similarly modified for moves ahead of time, save the original feedrate in the planner as we do for gcode_target. This avoids having to undo feedmultiply (and machine limits!) from "nominal_speed" as previously done. Thanks @leptun
This commit is contained in:
parent
4f0af648fb
commit
17176c1df2
@ -296,6 +296,7 @@ void setPwmFrequency(uint8_t pin, int val);
|
||||
extern bool fans_check_enabled;
|
||||
extern float homing_feedrate[];
|
||||
extern bool axis_relative_modes[];
|
||||
extern float feedrate;
|
||||
extern int feedmultiply;
|
||||
extern int extrudemultiply; // Sets extrude multiply factor (in percent) for all extruders
|
||||
extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually
|
||||
|
@ -331,7 +331,15 @@ float destination[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0};
|
||||
|
||||
// For tracing an arc
|
||||
static float offset[3] = {0.0, 0.0, 0.0};
|
||||
static float feedrate = 1500.0, next_feedrate, saved_feedrate;
|
||||
|
||||
// Current feedrate
|
||||
float feedrate = 1500.0;
|
||||
|
||||
// Feedrate for the next move
|
||||
static float next_feedrate;
|
||||
|
||||
// Original feedrate saved during homing moves
|
||||
static float saved_feedrate;
|
||||
|
||||
// Determines Absolute or Relative Coordinates.
|
||||
// Also there is bool axis_relative_modes[] per axis flag.
|
||||
@ -9612,11 +9620,18 @@ void uvlo_()
|
||||
if (sd_position < 0) sd_position = 0;
|
||||
}
|
||||
|
||||
// save the original target position of the current move
|
||||
// save the global state at planning time
|
||||
int feedrate_bckp;
|
||||
if (blocks_queued())
|
||||
{
|
||||
memcpy(saved_target, current_block->gcode_target, sizeof(saved_target));
|
||||
feedrate_bckp = current_block->gcode_feedrate;
|
||||
}
|
||||
else
|
||||
{
|
||||
saved_target[0] = SAVED_TARGET_UNSET;
|
||||
feedrate_bckp = feedrate;
|
||||
}
|
||||
|
||||
// After this call, the planner queue is emptied and the current_position is set to a current logical coordinate.
|
||||
// The logical coordinate will likely differ from the machine coordinate if the skew calibration and mesh bed leveling
|
||||
@ -9683,8 +9698,7 @@ void uvlo_()
|
||||
eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4), current_position[Y_AXIS]);
|
||||
eeprom_update_float((float*)EEPROM_UVLO_CURRENT_POSITION_Z , current_position[Z_AXIS]);
|
||||
// Store the current feed rate, temperatures, fan speed and extruder multipliers (flow rates)
|
||||
int i_feedrate = feedrate;
|
||||
EEPROM_save_B(EEPROM_UVLO_FEEDRATE, &i_feedrate);
|
||||
EEPROM_save_B(EEPROM_UVLO_FEEDRATE, &feedrate_bckp);
|
||||
EEPROM_save_B(EEPROM_UVLO_FEEDMULTIPLY, &feedmultiply);
|
||||
eeprom_update_byte((uint8_t*)EEPROM_UVLO_TARGET_HOTEND, target_temperature[active_extruder]);
|
||||
eeprom_update_byte((uint8_t*)EEPROM_UVLO_TARGET_BED, target_temperature_bed);
|
||||
@ -10170,15 +10184,20 @@ void stop_and_save_print_to_ram(float z_move, float e_move)
|
||||
}
|
||||
#endif
|
||||
|
||||
// save the original target position of the current move
|
||||
// save the global state at planning time
|
||||
if (blocks_queued())
|
||||
{
|
||||
memcpy(saved_target, current_block->gcode_target, sizeof(saved_target));
|
||||
saved_feedrate2 = current_block->gcode_feedrate;
|
||||
}
|
||||
else
|
||||
{
|
||||
saved_target[0] = SAVED_TARGET_UNSET;
|
||||
saved_feedrate2 = feedrate;
|
||||
}
|
||||
|
||||
planner_abort_hard(); //abort printing
|
||||
memcpy(saved_pos, current_position, sizeof(saved_pos));
|
||||
saved_feedrate2 = feedrate; //save feedrate
|
||||
saved_feedmultiply2 = feedmultiply; //save feedmultiply
|
||||
saved_active_extruder = active_extruder; //save active_extruder
|
||||
saved_extruder_temperature = degTargetHotend(active_extruder);
|
||||
|
@ -690,12 +690,12 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate
|
||||
// Prepare to set up new block
|
||||
block_t *block = &block_buffer[block_buffer_head];
|
||||
|
||||
// Set sdlen for calculating sd position
|
||||
block->sdlen = 0;
|
||||
|
||||
// Mark block as not busy (Not executed by the stepper interrupt, could be still tinkered with.)
|
||||
block->busy = false;
|
||||
|
||||
// Set sdlen for calculating sd position
|
||||
block->sdlen = 0;
|
||||
|
||||
// Save original destination of the move
|
||||
if (gcode_target)
|
||||
memcpy(block->gcode_target, gcode_target, sizeof(block_t::gcode_target));
|
||||
@ -707,6 +707,9 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate
|
||||
block->gcode_target[E_AXIS] = e;
|
||||
}
|
||||
|
||||
// Save the global feedrate at scheduling time
|
||||
block->gcode_feedrate = feedrate;
|
||||
|
||||
#ifdef ENABLE_AUTO_BED_LEVELING
|
||||
apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
|
||||
#endif // ENABLE_AUTO_BED_LEVELING
|
||||
|
@ -116,7 +116,9 @@ typedef struct {
|
||||
unsigned long abs_adv_steps_multiplier8; // Factorised by 2^8 to avoid float
|
||||
#endif
|
||||
|
||||
// Save/recovery state data
|
||||
float gcode_target[NUM_AXIS]; // Target (abs mm) of the original Gcode instruction
|
||||
float gcode_feedrate; // Original feedrate
|
||||
uint16_t sdlen; // Length of the Gcode instruction
|
||||
} block_t;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user