update code base to Marlin 2.0.9.2
This commit is contained in:
40
Marlin/src/gcode/eeprom/M500-M504.cpp
Executable file → Normal file
40
Marlin/src/gcode/eeprom/M500-M504.cpp
Executable file → Normal file
@@ -16,12 +16,12 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/configuration_store.h"
|
||||
#include "../../module/settings.h"
|
||||
#include "../../core/serial.h"
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -58,11 +58,47 @@ void GcodeSuite::M502() {
|
||||
#endif // !DISABLE_M503
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
#include "../../libs/hex_print.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M504: Validate EEPROM Contents
|
||||
*/
|
||||
void GcodeSuite::M504() {
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
const bool dowrite = parser.seenval('W');
|
||||
if (dowrite || parser.seenval('R')) {
|
||||
uint8_t val = 0;
|
||||
int addr = parser.value_ushort();
|
||||
if (dowrite) {
|
||||
val = parser.byteval('V');
|
||||
persistentStore.write_data(addr, &val);
|
||||
SERIAL_ECHOLNPGM("Wrote address ", addr, " with ", val);
|
||||
}
|
||||
else {
|
||||
if (parser.seenval('T')) {
|
||||
const int endaddr = parser.value_ushort();
|
||||
while (addr <= endaddr) {
|
||||
persistentStore.read_data(addr, &val);
|
||||
SERIAL_ECHOLNPGM("0x", hex_word(addr), ":", hex_byte(val));
|
||||
addr++;
|
||||
safe_delay(10);
|
||||
}
|
||||
SERIAL_EOL();
|
||||
}
|
||||
else {
|
||||
persistentStore.read_data(addr, &val);
|
||||
SERIAL_ECHOLNPGM("Read address ", addr, " and got ", val);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (settings.validate())
|
||||
SERIAL_ECHO_MSG("EEPROM OK");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user