Fix of calculate_extrusion_multipliers().

This is a fix of a bug made in the previous commit.
This commit is contained in:
bubnikv 2018-03-05 21:31:31 +01:00
parent ded0dcb254
commit fc3af0533a
2 changed files with 9 additions and 6 deletions

View file

@ -378,8 +378,8 @@ bool Config_RetrieveSettings(uint16_t offset, uint8_t level)
EEPROM_READ_VAR(i, extruder_advance_k); EEPROM_READ_VAR(i, extruder_advance_k);
EEPROM_READ_VAR(i, advance_ed_ratio); EEPROM_READ_VAR(i, advance_ed_ratio);
} }
calculate_volumetric_multipliers();
#endif //LIN_ADVANCE #endif //LIN_ADVANCE
calculate_extruder_multipliers();
// Call updatePID (similar to when we have processed M301) // Call updatePID (similar to when we have processed M301)
updatePID(); updatePID();

View file

@ -7026,11 +7026,14 @@ void save_statistics(unsigned long _total_filament_used, unsigned long _total_pr
} }
float calculate_extruder_multiplier(float diameter) { float calculate_extruder_multiplier(float diameter) {
bool enabled = volumetric_enabled && diameter > 0; float out = 1.f;
float area = enabled ? (M_PI * pow(diameter * .5, 2)) : 0; if (volumetric_enabled && diameter > 0.f) {
return (extrudemultiply == 100) ? float area = M_PI * diameter * diameter * 0.25;
(enabled ? (1.f / area) : 1.f) : out = 1.f / area;
(enabled ? ((float(extrudemultiply) * 0.01f) / area) : 1.f); }
if (extrudemultiply != 100)
out *= float(extrudemultiply) * 0.01f;
return out;
} }
void calculate_extruder_multipliers() { void calculate_extruder_multipliers() {