Merge pull request from wavexx/m204_travel_acceleration

Implement M204 T (separate travel acceleration)
This commit is contained in:
DRracer 2021-02-05 16:27:50 +01:00 committed by GitHub
commit 2dfe21358f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 71 additions and 36 deletions

View file

@ -7260,7 +7260,7 @@ Sigma_Exit:
// Legacy acceleration format. This format is used by the legacy Marlin, MK2 or MK3 firmware,
// and it is also generated by Slic3r to control acceleration per extrusion type
// (there is a separate acceleration settings in Slicer for perimeter, first layer etc).
cs.acceleration = code_value();
cs.acceleration = cs.travel_acceleration = code_value();
// Interpret the T value as retract acceleration in the old Marlin format.
if(code_seen('T'))
cs.retract_acceleration = code_value();
@ -7270,13 +7270,8 @@ Sigma_Exit:
cs.acceleration = code_value();
if(code_seen('R'))
cs.retract_acceleration = code_value();
if(code_seen('T')) {
// Interpret the T value as the travel acceleration in the new Marlin format.
/*!
@todo Prusa3D firmware currently does not support travel acceleration value independent from the extruding acceleration value.
*/
// travel_acceleration = code_value();
}
if(code_seen('T'))
cs.travel_acceleration = code_value();
}
}
break;
@ -10970,6 +10965,10 @@ void uvlo_()
#endif
eeprom_update_word((uint16_t*)(EEPROM_EXTRUDEMULTIPLY), (uint16_t)extrudemultiply);
eeprom_update_float((float*)(EEPROM_UVLO_ACCELL), cs.acceleration);
eeprom_update_float((float*)(EEPROM_UVLO_RETRACT_ACCELL), cs.retract_acceleration);
eeprom_update_float((float*)(EEPROM_UVLO_TRAVEL_ACCELL), cs.travel_acceleration);
// Store the saved target
eeprom_update_float((float*)(EEPROM_UVLO_SAVED_TARGET+0*4), saved_target[X_AXIS]);
eeprom_update_float((float*)(EEPROM_UVLO_SAVED_TARGET+1*4), saved_target[Y_AXIS]);
@ -11314,6 +11313,13 @@ void restore_print_from_eeprom(bool mbl_was_active) {
sprintf_P(cmd, PSTR("G1 Z%f"), eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)));
enquecommand(cmd);
// Restore acceleration settings
float acceleration = eeprom_read_float((float*)(EEPROM_UVLO_ACCELL));
float retract_acceleration = eeprom_read_float((float*)(EEPROM_UVLO_RETRACT_ACCELL));
float travel_acceleration = eeprom_read_float((float*)(EEPROM_UVLO_TRAVEL_ACCELL));
sprintf_P(cmd, PSTR("M204 P%f R%f T%f"), acceleration, retract_acceleration, travel_acceleration);
enquecommand(cmd);
// Unretract.
sprintf_P(cmd, PSTR("G1 E%0.3f F2700"), default_retraction);
enquecommand(cmd);