Merge pull request #1348 from PavelSindler/eeprom_fix
EEPROM M501 initialization
This commit is contained in:
commit
b809182c23
@ -241,24 +241,19 @@ bool Config_RetrieveSettings()
|
|||||||
if (cs.max_jerk[Y_AXIS] > DEFAULT_YJERK) cs.max_jerk[Y_AXIS] = DEFAULT_YJERK;
|
if (cs.max_jerk[Y_AXIS] > DEFAULT_YJERK) cs.max_jerk[Y_AXIS] = DEFAULT_YJERK;
|
||||||
calculate_extruder_multipliers();
|
calculate_extruder_multipliers();
|
||||||
|
|
||||||
|
|
||||||
//if max_feedrate_silent and max_acceleration_units_per_sq_second_silent were never stored to eeprom, use default values:
|
//if max_feedrate_silent and max_acceleration_units_per_sq_second_silent were never stored to eeprom, use default values:
|
||||||
|
for (uint8_t i = 0; i < (sizeof(cs.max_feedrate_silent)/sizeof(cs.max_feedrate_silent[0])); ++i)
|
||||||
{
|
{
|
||||||
const uint32_t erased = 0xffffffff;
|
const uint32_t erased = 0xffffffff;
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
for (uint8_t i = 0; i < (sizeof(cs.max_feedrate_silent)/sizeof(cs.max_feedrate_silent[0])); ++i)
|
|
||||||
{
|
|
||||||
for(uint8_t j = 0; j < sizeof(float); ++j)
|
for(uint8_t j = 0; j < sizeof(float); ++j)
|
||||||
{
|
{
|
||||||
if(0xff != reinterpret_cast<uint8_t*>(&(cs.max_feedrate_silent[i]))[j]) initialized = true;
|
if(0xff != reinterpret_cast<uint8_t*>(&(cs.max_feedrate_silent[i]))[j]) initialized = true;
|
||||||
}
|
}
|
||||||
if(erased != cs.max_acceleration_units_per_sq_second_silent[i]) initialized = true;
|
if (!initialized) memcpy_P(&cs.max_feedrate_silent[i],&default_conf.max_feedrate_silent[i], sizeof(cs.max_feedrate_silent[i]));
|
||||||
}
|
if (erased == cs.max_acceleration_units_per_sq_second_silent[i]) {
|
||||||
if (!initialized)
|
memcpy_P(&cs.max_acceleration_units_per_sq_second_silent[i],&default_conf.max_acceleration_units_per_sq_second_silent[i],sizeof(cs.max_acceleration_units_per_sq_second_silent[i]));
|
||||||
{
|
|
||||||
memcpy_P(&cs.max_feedrate_silent,&default_conf.max_feedrate_silent, sizeof(cs.max_feedrate_silent));
|
|
||||||
memcpy_P(&cs.max_acceleration_units_per_sq_second_silent,&default_conf.max_acceleration_units_per_sq_second_silent,
|
|
||||||
sizeof(cs.max_acceleration_units_per_sq_second_silent));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user