From 7d538cde6cef868c3c556c899b6a96176392c13d Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 19 Nov 2018 20:05:58 +0100 Subject: [PATCH] Retrieve settings (M501): initialize each item in feedrate and acceleration arrays separately --- Firmware/ConfigurationStore.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Firmware/ConfigurationStore.cpp b/Firmware/ConfigurationStore.cpp index 2aafdd44..fab1a830 100644 --- a/Firmware/ConfigurationStore.cpp +++ b/Firmware/ConfigurationStore.cpp @@ -248,18 +248,16 @@ bool Config_RetrieveSettings() bool initialized = false; for (uint8_t i = 0; i < (sizeof(cs.max_feedrate_silent)/sizeof(cs.max_feedrate_silent[0])); ++i) { + initialized = false; for(uint8_t j = 0; j < sizeof(float); ++j) { if(0xff != reinterpret_cast(&(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,&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)); - } + 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]) { + 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])); + } + } } #ifdef TMC2130