|
|
@ -45,6 +45,17 @@
|
|
|
|
//#define DEBUG_EEPROM_READWRITE
|
|
|
|
//#define DEBUG_EEPROM_READWRITE
|
|
|
|
|
|
|
|
|
|
|
|
#include "configuration_store.h"
|
|
|
|
#include "configuration_store.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ADD_PORT_ARG
|
|
|
|
|
|
|
|
#define PORTARG_SOLO const int8_t port
|
|
|
|
|
|
|
|
#define PORTARG_AFTER ,const int8_t port
|
|
|
|
|
|
|
|
#define PORTVAR_SOLO port
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define PORTARG_SOLO
|
|
|
|
|
|
|
|
#define PORTARG_AFTER
|
|
|
|
|
|
|
|
#define PORTVAR_SOLO
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include "endstops.h"
|
|
|
|
#include "endstops.h"
|
|
|
|
#include "planner.h"
|
|
|
|
#include "planner.h"
|
|
|
|
#include "stepper.h"
|
|
|
|
#include "stepper.h"
|
|
|
@ -345,11 +356,7 @@ void MarlinSettings::postprocess() {
|
|
|
|
|
|
|
|
|
|
|
|
bool MarlinSettings::eeprom_error, MarlinSettings::validating;
|
|
|
|
bool MarlinSettings::eeprom_error, MarlinSettings::validating;
|
|
|
|
|
|
|
|
|
|
|
|
bool MarlinSettings::size_error(const uint16_t size
|
|
|
|
bool MarlinSettings::size_error(const uint16_t size PORTARG_AFTER) {
|
|
|
|
#if ADD_PORT_ARG
|
|
|
|
|
|
|
|
, const int8_t port/*=-1*/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
if (size != datasize()) {
|
|
|
|
if (size != datasize()) {
|
|
|
|
#if ENABLED(EEPROM_CHITCHAT)
|
|
|
|
#if ENABLED(EEPROM_CHITCHAT)
|
|
|
|
SERIAL_ERROR_START_P(port);
|
|
|
|
SERIAL_ERROR_START_P(port);
|
|
|
@ -363,11 +370,7 @@ void MarlinSettings::postprocess() {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* M500 - Store Configuration
|
|
|
|
* M500 - Store Configuration
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
bool MarlinSettings::save(
|
|
|
|
bool MarlinSettings::save(PORTARG_SOLO) {
|
|
|
|
#if ADD_PORT_ARG
|
|
|
|
|
|
|
|
const int8_t port/*=-1*/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
float dummy = 0.0f;
|
|
|
|
float dummy = 0.0f;
|
|
|
|
char ver[4] = "ERR";
|
|
|
|
char ver[4] = "ERR";
|
|
|
|
|
|
|
|
|
|
|
@ -853,11 +856,7 @@ void MarlinSettings::postprocess() {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* M501 - Retrieve Configuration
|
|
|
|
* M501 - Retrieve Configuration
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
bool MarlinSettings::_load(
|
|
|
|
bool MarlinSettings::_load(PORTARG_SOLO) {
|
|
|
|
#if ADD_PORT_ARG
|
|
|
|
|
|
|
|
const int8_t port/*=-1*/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
uint16_t working_crc = 0;
|
|
|
|
uint16_t working_crc = 0;
|
|
|
|
|
|
|
|
|
|
|
|
EEPROM_START();
|
|
|
|
EEPROM_START();
|
|
|
@ -1431,46 +1430,22 @@ void MarlinSettings::postprocess() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(EEPROM_CHITCHAT) && DISABLED(DISABLE_M503)
|
|
|
|
#if ENABLED(EEPROM_CHITCHAT) && DISABLED(DISABLE_M503)
|
|
|
|
if (!validating) report(
|
|
|
|
if (!validating) report(PORTVAR_SOLO);
|
|
|
|
#if ADD_PORT_ARG
|
|
|
|
|
|
|
|
port
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
EEPROM_FINISH();
|
|
|
|
EEPROM_FINISH();
|
|
|
|
|
|
|
|
|
|
|
|
return !eeprom_error;
|
|
|
|
return !eeprom_error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MarlinSettings::validate(
|
|
|
|
bool MarlinSettings::validate(PORTARG_SOLO) {
|
|
|
|
#if ADD_PORT_ARG
|
|
|
|
|
|
|
|
const int8_t port/*=-1*/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
validating = true;
|
|
|
|
validating = true;
|
|
|
|
const bool success = _load(
|
|
|
|
const bool success = _load(PORTVAR_SOLO);
|
|
|
|
#if ADD_PORT_ARG
|
|
|
|
|
|
|
|
port
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
validating = false;
|
|
|
|
validating = false;
|
|
|
|
return success;
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MarlinSettings::load(
|
|
|
|
bool MarlinSettings::load(PORTARG_SOLO) {
|
|
|
|
#if ADD_PORT_ARG
|
|
|
|
if (validate(PORTVAR_SOLO)) return _load(PORTVAR_SOLO);
|
|
|
|
const int8_t port/*=-1*/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
if (validate(
|
|
|
|
|
|
|
|
#if ADD_PORT_ARG
|
|
|
|
|
|
|
|
port
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
)) return _load(
|
|
|
|
|
|
|
|
#if ADD_PORT_ARG
|
|
|
|
|
|
|
|
port
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
reset();
|
|
|
|
reset();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1581,11 +1556,7 @@ void MarlinSettings::postprocess() {
|
|
|
|
|
|
|
|
|
|
|
|
#else // !EEPROM_SETTINGS
|
|
|
|
#else // !EEPROM_SETTINGS
|
|
|
|
|
|
|
|
|
|
|
|
bool MarlinSettings::save(
|
|
|
|
bool MarlinSettings::save(PORTARG_SOLO) {
|
|
|
|
#if ADD_PORT_ARG
|
|
|
|
|
|
|
|
const int8_t port/*=-1*/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
#if ENABLED(EEPROM_CHITCHAT)
|
|
|
|
#if ENABLED(EEPROM_CHITCHAT)
|
|
|
|
SERIAL_ERROR_START_P(port);
|
|
|
|
SERIAL_ERROR_START_P(port);
|
|
|
|
SERIAL_ERRORLNPGM_P(port, "EEPROM disabled");
|
|
|
|
SERIAL_ERRORLNPGM_P(port, "EEPROM disabled");
|
|
|
@ -1598,11 +1569,7 @@ void MarlinSettings::postprocess() {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* M502 - Reset Configuration
|
|
|
|
* M502 - Reset Configuration
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void MarlinSettings::reset(
|
|
|
|
void MarlinSettings::reset(PORTARG_SOLO) {
|
|
|
|
#if ADD_PORT_ARG
|
|
|
|
|
|
|
|
const int8_t port/*=-1*/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
static const float tmp1[] PROGMEM = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] PROGMEM = DEFAULT_MAX_FEEDRATE;
|
|
|
|
static const float tmp1[] PROGMEM = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] PROGMEM = DEFAULT_MAX_FEEDRATE;
|
|
|
|
static const uint32_t tmp3[] PROGMEM = DEFAULT_MAX_ACCELERATION;
|
|
|
|
static const uint32_t tmp3[] PROGMEM = DEFAULT_MAX_ACCELERATION;
|
|
|
|
LOOP_XYZE_N(i) {
|
|
|
|
LOOP_XYZE_N(i) {
|
|
|
@ -1860,11 +1827,7 @@ void MarlinSettings::reset(
|
|
|
|
|
|
|
|
|
|
|
|
#if DISABLED(DISABLE_M503)
|
|
|
|
#if DISABLED(DISABLE_M503)
|
|
|
|
|
|
|
|
|
|
|
|
#if ADD_PORT_ARG
|
|
|
|
#define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START_P(PORTVAR_SOLO); }while(0)
|
|
|
|
#define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START_P(port); }while(0)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START(); }while(0)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* M503 - Report current settings in RAM
|
|
|
|
* M503 - Report current settings in RAM
|
|
|
@ -2129,11 +2092,7 @@ void MarlinSettings::reset(
|
|
|
|
SERIAL_ECHOLNPGM_P(port, " meshes.\n");
|
|
|
|
SERIAL_ECHOLNPGM_P(port, " meshes.\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ubl.report_current_mesh(
|
|
|
|
ubl.report_current_mesh(PORTVAR_SOLO);
|
|
|
|
#if ADD_PORT_ARG
|
|
|
|
|
|
|
|
port
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
|
|
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
|
|
|
|
|
|
|
|
|
|