Use cs.filament_size from ConfigurationStore.

This commit is contained in:
Marek Bel 2018-09-24 17:29:02 +02:00
parent e225e9cab0
commit ca179a2d18
4 changed files with 26 additions and 26 deletions

View File

@ -146,13 +146,13 @@ void Config_PrintSettings(uint8_t level)
#endif
if (cs.volumetric_enabled) {
printf_P(PSTR("%SFilament settings:\n%S M200 D%.2f\n"),
echomagic, echomagic, filament_size[0]);
echomagic, echomagic, cs.filament_size[0]);
#if EXTRUDERS > 1
printf_P(PSTR("%S M200 T1 D%.2f\n"),
echomagic, echomagic, filament_size[1]);
echomagic, echomagic, cs.filament_size[1]);
#if EXTRUDERS > 2
printf_P(PSTR("%S M200 T1 D%.2f\n"),
echomagic, echomagic, filament_size[2]);
echomagic, echomagic, cs.filament_size[2]);
#endif
#endif
} else {
@ -171,13 +171,17 @@ void Config_PrintSettings(uint8_t level)
#ifdef EEPROM_SETTINGS
static_assert (EXTRUDERS == 1, "ConfigurationStore M500_conf not implemented for more extruders.");
static_assert (NUM_AXIS == 4, "ConfigurationStore M500_conf not implemented for more axis.");
static_assert (EXTRUDERS == 1, "ConfigurationStore M500_conf not implemented for more extruders, fix filament_size array size.");
static_assert (NUM_AXIS == 4, "ConfigurationStore M500_conf not implemented for more axis."
"Fix axis_steps_per_unit max_feedrate_normal max_acceleration_units_per_sq_second_normal max_jerk max_feedrate_silent"
" max_acceleration_units_per_sq_second_silent array size.");
#ifdef ENABLE_AUTO_BED_LEVELING
static_assert (false, "zprobe_zoffset was not initialized in printers in field to -(Z_PROBE_OFFSET_FROM_EXTRUDER), so it contains"
"0.0, if this is not acceptable, increment EEPROM_VERSION to force use default_conf");
#endif
static_assert (sizeof(M500_conf) == 188, "sizeof(M500_conf) has changed, ensure that EEPROM_VERSION has been incremented, "
"or if you added members in the end of struct, ensure that historically uninitialized values will be initialized");
static const M500_conf default_conf PROGMEM =
{
@ -207,14 +211,18 @@ static const M500_conf default_conf PROGMEM =
RETRACT_RECOVER_LENGTH,
RETRACT_RECOVER_FEEDRATE,
false,
{DEFAULT_NOMINAL_FILAMENT_DIA},
{DEFAULT_NOMINAL_FILAMENT_DIA,
#if EXTRUDERS > 1
DEFAULT_NOMINAL_FILAMENT_DIA,
#if EXTRUDERS > 2
DEFAULT_NOMINAL_FILAMENT_DIA,
#endif
#endif
},
DEFAULT_MAX_FEEDRATE_SILENT,
DEFAULT_MAX_ACCELERATION_SILENT,
};
static_assert (sizeof(M500_conf) == 188, "sizeof(M500_conf) has changed, ensure that version has been incremented, "
"or if you added members in the end of struct, ensure that historically uninitialized values will be initialized");
//!
//! @retval true Stored or default settings retrieved
//! @retval false default settings retrieved, eeprom was erased.

View File

@ -32,7 +32,7 @@ typedef struct
float retract_recover_length;
float retract_recover_feedrate;
bool volumetric_enabled;
float filament_size[1];
float filament_size[1]; //!< cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
float max_feedrate_silent[4];
unsigned long max_acceleration_units_per_sq_second_silent[4];
} __attribute__ ((packed)) M500_conf;

View File

@ -270,7 +270,6 @@ extern bool axis_relative_modes[];
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
extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
extern float current_position[NUM_AXIS] ;
extern float destination[NUM_AXIS] ;

View File

@ -368,14 +368,7 @@ char dir_names[3][9];
bool sortAlpha = false;
float filament_size[EXTRUDERS] = { DEFAULT_NOMINAL_FILAMENT_DIA
#if EXTRUDERS > 1
, DEFAULT_NOMINAL_FILAMENT_DIA
#if EXTRUDERS > 2
, DEFAULT_NOMINAL_FILAMENT_DIA
#endif
#endif
};
float extruder_multiplier[EXTRUDERS] = {1.0
#if EXTRUDERS > 1
, 1.0
@ -5848,13 +5841,13 @@ Sigma_Exit:
// for all extruders
cs.volumetric_enabled = false;
} else {
filament_size[extruder] = (float)code_value();
cs.filament_size[extruder] = (float)code_value();
// make sure all extruders have some sane value for the filament size
filament_size[0] = (filament_size[0] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : filament_size[0]);
cs.filament_size[0] = (cs.filament_size[0] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : cs.filament_size[0]);
#if EXTRUDERS > 1
filament_size[1] = (filament_size[1] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : filament_size[1]);
cs.filament_size[1] = (cs.filament_size[1] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : cs.filament_size[1]);
#if EXTRUDERS > 2
filament_size[2] = (filament_size[2] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : filament_size[2]);
cs.filament_size[2] = (cs.filament_size[2] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : cs.filament_size[2]);
#endif
#endif
cs.volumetric_enabled = true;
@ -7655,11 +7648,11 @@ float calculate_extruder_multiplier(float diameter) {
}
void calculate_extruder_multipliers() {
extruder_multiplier[0] = calculate_extruder_multiplier(filament_size[0]);
extruder_multiplier[0] = calculate_extruder_multiplier(cs.filament_size[0]);
#if EXTRUDERS > 1
extruder_multiplier[1] = calculate_extruder_multiplier(filament_size[1]);
extruder_multiplier[1] = calculate_extruder_multiplier(cs.filament_size[1]);
#if EXTRUDERS > 2
extruder_multiplier[2] = calculate_extruder_multiplier(filament_size[2]);
extruder_multiplier[2] = calculate_extruder_multiplier(cs.filament_size[2]);
#endif
#endif
}