Merge pull request #9122 from thinkyhead/bf1_eeprom_debug

[1.1.x] More EEPROM field debugging, 2.0.x parity
This commit is contained in:
Scott Lahteine 2018-01-09 18:33:24 -06:00 committed by GitHub
commit d7651ea0d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,7 @@
*/ */
// Change EEPROM version if the structure changes // Change EEPROM version if the structure changes
#define EEPROM_VERSION "V49" #define EEPROM_VERSION "V50"
#define EEPROM_OFFSET 100 #define EEPROM_OFFSET 100
// Check the integrity of data offsets. // Check the integrity of data offsets.
@ -165,9 +165,6 @@ typedef struct SettingsDataStruct {
float x_endstop_adj, // M666 X float x_endstop_adj, // M666 X
y_endstop_adj, // M666 Y y_endstop_adj, // M666 Y
z_endstop_adj; // M666 Z z_endstop_adj; // M666 Z
float xyz_dual_reserved[8];
#else
float xyz_dual_placeholder[11];
#endif #endif
// //
@ -300,13 +297,16 @@ void MarlinSettings::postprocess() {
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
refresh_bed_level(); refresh_bed_level();
//set_bed_leveling_enabled(leveling_is_on);
#endif #endif
#if HAS_MOTOR_CURRENT_PWM #if HAS_MOTOR_CURRENT_PWM
stepper.refresh_motor_power(); stepper.refresh_motor_power();
#endif #endif
#if ENABLED(FWRETRACT)
fwretract.refresh_autoretract();
#endif
// Refresh steps_to_mm with the reciprocal of axis_steps_per_mm // Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
// and init stepper.count[], planner.position[] with current_position // and init stepper.count[], planner.position[] with current_position
planner.refresh_positioning(); planner.refresh_positioning();
@ -525,7 +525,9 @@ void MarlinSettings::postprocess() {
// 11 floats for DELTA / [XYZ]_DUAL_ENDSTOPS // 11 floats for DELTA / [XYZ]_DUAL_ENDSTOPS
#if ENABLED(DELTA) #if ENABLED(DELTA)
_FIELD_TEST(delta_height); _FIELD_TEST(delta_height);
EEPROM_WRITE(delta_height); // 1 float EEPROM_WRITE(delta_height); // 1 float
EEPROM_WRITE(delta_endstop_adj); // 3 floats EEPROM_WRITE(delta_endstop_adj); // 3 floats
EEPROM_WRITE(delta_radius); // 1 float EEPROM_WRITE(delta_radius); // 1 float
@ -535,7 +537,9 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(delta_tower_angle_trim); // 3 floats EEPROM_WRITE(delta_tower_angle_trim); // 3 floats
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS) #elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
_FIELD_TEST(x_endstop_adj); _FIELD_TEST(x_endstop_adj);
// Write dual endstops in X, Y, Z order. Unused = 0.0 // Write dual endstops in X, Y, Z order. Unused = 0.0
dummy = 0.0f; dummy = 0.0f;
#if ENABLED(X_DUAL_ENDSTOPS) #if ENABLED(X_DUAL_ENDSTOPS)
@ -556,11 +560,6 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(dummy); EEPROM_WRITE(dummy);
#endif #endif
for (uint8_t q = 8; q--;) EEPROM_WRITE(dummy);
#else
dummy = 0.0f;
for (uint8_t q = 11; q--;) EEPROM_WRITE(dummy);
#endif #endif
_FIELD_TEST(lcd_preheat_hotend_temp); _FIELD_TEST(lcd_preheat_hotend_temp);
@ -600,6 +599,8 @@ void MarlinSettings::postprocess() {
} // Hotends Loop } // Hotends Loop
_FIELD_TEST(lpq_len);
#if DISABLED(PID_EXTRUSION_SCALING) #if DISABLED(PID_EXTRUSION_SCALING)
int lpq_len = 20; int lpq_len = 20;
#endif #endif
@ -641,7 +642,9 @@ void MarlinSettings::postprocess() {
// //
// Volumetric & Filament Size // Volumetric & Filament Size
// //
_FIELD_TEST(parser_volumetric_enabled); _FIELD_TEST(parser_volumetric_enabled);
#if DISABLED(NO_VOLUMETRICS) #if DISABLED(NO_VOLUMETRICS)
EEPROM_WRITE(parser.volumetric_enabled); EEPROM_WRITE(parser.volumetric_enabled);
@ -664,7 +667,9 @@ void MarlinSettings::postprocess() {
// //
// Save TMC2130 or TMC2208 Configuration, and placeholder values // Save TMC2130 or TMC2208 Configuration, and placeholder values
// //
_FIELD_TEST(tmc_stepper_current); _FIELD_TEST(tmc_stepper_current);
uint16_t currents[11] = { uint16_t currents[11] = {
#if HAS_TRINAMIC #if HAS_TRINAMIC
#if X_IS_TRINAMIC #if X_IS_TRINAMIC
@ -753,7 +758,9 @@ void MarlinSettings::postprocess() {
// //
// Linear Advance // Linear Advance
// //
_FIELD_TEST(planner_extruder_advance_k); _FIELD_TEST(planner_extruder_advance_k);
#if ENABLED(LIN_ADVANCE) #if ENABLED(LIN_ADVANCE)
EEPROM_WRITE(planner.extruder_advance_k); EEPROM_WRITE(planner.extruder_advance_k);
EEPROM_WRITE(planner.advance_ed_ratio); EEPROM_WRITE(planner.advance_ed_ratio);
@ -763,6 +770,8 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(dummy); EEPROM_WRITE(dummy);
#endif #endif
_FIELD_TEST(motor_current_setting);
#if HAS_MOTOR_CURRENT_PWM #if HAS_MOTOR_CURRENT_PWM
for (uint8_t q = 3; q--;) EEPROM_WRITE(stepper.motor_current_setting[q]); for (uint8_t q = 3; q--;) EEPROM_WRITE(stepper.motor_current_setting[q]);
#else #else
@ -773,7 +782,9 @@ void MarlinSettings::postprocess() {
// //
// CNC Coordinate Systems // CNC Coordinate Systems
// //
_FIELD_TEST(coordinate_system); _FIELD_TEST(coordinate_system);
#if ENABLED(CNC_COORDINATE_SYSTEMS) #if ENABLED(CNC_COORDINATE_SYSTEMS)
EEPROM_WRITE(coordinate_system); // 27 floats EEPROM_WRITE(coordinate_system); // 27 floats
#else #else
@ -784,7 +795,9 @@ void MarlinSettings::postprocess() {
// //
// Skew correction factors // Skew correction factors
// //
_FIELD_TEST(planner_xy_skew_factor); _FIELD_TEST(planner_xy_skew_factor);
#if ENABLED(SKEW_CORRECTION) #if ENABLED(SKEW_CORRECTION)
EEPROM_WRITE(planner.xy_skew_factor); EEPROM_WRITE(planner.xy_skew_factor);
EEPROM_WRITE(planner.xz_skew_factor); EEPROM_WRITE(planner.xz_skew_factor);
@ -797,7 +810,9 @@ void MarlinSettings::postprocess() {
// //
// Advanced Pause filament load & unload lengths // Advanced Pause filament load & unload lengths
// //
_FIELD_TEST(filament_change_unload_length); _FIELD_TEST(filament_change_unload_length);
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) { for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
if (q < COUNT(filament_change_unload_length)) dummy = filament_change_unload_length[q]; if (q < COUNT(filament_change_unload_length)) dummy = filament_change_unload_length[q];
@ -884,6 +899,8 @@ void MarlinSettings::postprocess() {
working_crc = 0; // Init to 0. Accumulated by EEPROM_READ working_crc = 0; // Init to 0. Accumulated by EEPROM_READ
_FIELD_TEST(esteppers);
// Number of esteppers may change // Number of esteppers may change
uint8_t esteppers; uint8_t esteppers;
EEPROM_READ_ALWAYS(esteppers); EEPROM_READ_ALWAYS(esteppers);
@ -919,6 +936,8 @@ void MarlinSettings::postprocess() {
// Home Offset (M206) // Home Offset (M206)
// //
_FIELD_TEST(home_offset);
#if !HAS_HOME_OFFSET #if !HAS_HOME_OFFSET
float home_offset[XYZ]; float home_offset[XYZ];
#endif #endif
@ -948,9 +967,7 @@ void MarlinSettings::postprocess() {
// Mesh (Manual) Bed Leveling // Mesh (Manual) Bed Leveling
// //
bool leveling_is_on;
uint8_t mesh_num_x, mesh_num_y; uint8_t mesh_num_x, mesh_num_y;
EEPROM_READ_ALWAYS(leveling_is_on);
EEPROM_READ(dummy); EEPROM_READ(dummy);
EEPROM_READ_ALWAYS(mesh_num_x); EEPROM_READ_ALWAYS(mesh_num_x);
EEPROM_READ_ALWAYS(mesh_num_y); EEPROM_READ_ALWAYS(mesh_num_y);
@ -971,6 +988,8 @@ void MarlinSettings::postprocess() {
for (uint16_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_READ(dummy); for (uint16_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_READ(dummy);
#endif // MESH_BED_LEVELING #endif // MESH_BED_LEVELING
_FIELD_TEST(zprobe_zoffset);
#if !HAS_BED_PROBE #if !HAS_BED_PROBE
float zprobe_zoffset; float zprobe_zoffset;
#endif #endif
@ -1014,6 +1033,8 @@ void MarlinSettings::postprocess() {
// Unified Bed Leveling active state // Unified Bed Leveling active state
// //
_FIELD_TEST(planner_leveling_active);
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(AUTO_BED_LEVELING_UBL)
EEPROM_READ(planner.leveling_active); EEPROM_READ(planner.leveling_active);
EEPROM_READ(ubl.storage_slot); EEPROM_READ(ubl.storage_slot);
@ -1028,6 +1049,9 @@ void MarlinSettings::postprocess() {
// //
#if ENABLED(DELTA) #if ENABLED(DELTA)
_FIELD_TEST(delta_height);
EEPROM_READ(delta_height); // 1 float EEPROM_READ(delta_height); // 1 float
EEPROM_READ(delta_endstop_adj); // 3 floats EEPROM_READ(delta_endstop_adj); // 3 floats
EEPROM_READ(delta_radius); // 1 float EEPROM_READ(delta_radius); // 1 float
@ -1038,6 +1062,8 @@ void MarlinSettings::postprocess() {
#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS) #elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
_FIELD_TEST(x_endstop_adj);
#if ENABLED(X_DUAL_ENDSTOPS) #if ENABLED(X_DUAL_ENDSTOPS)
EEPROM_READ(x_endstop_adj); // 1 float EEPROM_READ(x_endstop_adj); // 1 float
#else #else
@ -1054,18 +1080,14 @@ void MarlinSettings::postprocess() {
EEPROM_READ(dummy); EEPROM_READ(dummy);
#endif #endif
for (uint8_t q=8; q--;) EEPROM_READ(dummy);
#else
for (uint8_t q=11; q--;) EEPROM_READ(dummy);
#endif #endif
// //
// LCD Preheat settings // LCD Preheat settings
// //
_FIELD_TEST(lcd_preheat_hotend_temp);
#if DISABLED(ULTIPANEL) #if DISABLED(ULTIPANEL)
int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2]; int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
#endif #endif
@ -1109,6 +1131,8 @@ void MarlinSettings::postprocess() {
// PID Extrusion Scaling // PID Extrusion Scaling
// //
_FIELD_TEST(lpq_len);
#if DISABLED(PID_EXTRUSION_SCALING) #if DISABLED(PID_EXTRUSION_SCALING)
int lpq_len; int lpq_len;
#endif #endif
@ -1133,6 +1157,8 @@ void MarlinSettings::postprocess() {
// LCD Contrast // LCD Contrast
// //
_FIELD_TEST(lcd_contrast);
#if !HAS_LCD_CONTRAST #if !HAS_LCD_CONTRAST
uint16_t lcd_contrast; uint16_t lcd_contrast;
#endif #endif
@ -1160,6 +1186,9 @@ void MarlinSettings::postprocess() {
// //
// Volumetric & Filament Size // Volumetric & Filament Size
// //
_FIELD_TEST(parser_volumetric_enabled);
#if DISABLED(NO_VOLUMETRICS) #if DISABLED(NO_VOLUMETRICS)
EEPROM_READ(parser.volumetric_enabled); EEPROM_READ(parser.volumetric_enabled);
@ -1180,10 +1209,13 @@ void MarlinSettings::postprocess() {
// //
// TMC2130 Stepper Current // TMC2130 Stepper Current
// //
_FIELD_TEST(tmc_stepper_current);
#if HAS_TRINAMIC #if HAS_TRINAMIC
#define SET_CURR(N,Q) stepper##Q.setCurrent(val[N] ? val[N] : Q##_CURRENT, R_SENSE, HOLD_MULTIPLIER) #define SET_CURR(N,Q) stepper##Q.setCurrent(currents[N] ? currents[N] : Q##_CURRENT, R_SENSE, HOLD_MULTIPLIER)
uint16_t val[11]; uint16_t currents[11];
EEPROM_READ(val); EEPROM_READ(currents);
if (!validating) { if (!validating) {
#if X_IS_TRINAMIC #if X_IS_TRINAMIC
SET_CURR(0, X); SET_CURR(0, X);
@ -1257,6 +1289,8 @@ void MarlinSettings::postprocess() {
// Linear Advance // Linear Advance
// //
_FIELD_TEST(planner_extruder_advance_k);
#if ENABLED(LIN_ADVANCE) #if ENABLED(LIN_ADVANCE)
EEPROM_READ(planner.extruder_advance_k); EEPROM_READ(planner.extruder_advance_k);
EEPROM_READ(planner.advance_ed_ratio); EEPROM_READ(planner.advance_ed_ratio);
@ -1269,6 +1303,8 @@ void MarlinSettings::postprocess() {
// Motor Current PWM // Motor Current PWM
// //
_FIELD_TEST(motor_current_setting);
#if HAS_MOTOR_CURRENT_PWM #if HAS_MOTOR_CURRENT_PWM
for (uint8_t q = 3; q--;) EEPROM_READ(stepper.motor_current_setting[q]); for (uint8_t q = 3; q--;) EEPROM_READ(stepper.motor_current_setting[q]);
#else #else
@ -1280,6 +1316,8 @@ void MarlinSettings::postprocess() {
// CNC Coordinate System // CNC Coordinate System
// //
_FIELD_TEST(coordinate_system);
#if ENABLED(CNC_COORDINATE_SYSTEMS) #if ENABLED(CNC_COORDINATE_SYSTEMS)
if (!validating) (void)select_coordinate_system(-1); // Go back to machine space if (!validating) (void)select_coordinate_system(-1); // Go back to machine space
EEPROM_READ(coordinate_system); // 27 floats EEPROM_READ(coordinate_system); // 27 floats
@ -1291,6 +1329,8 @@ void MarlinSettings::postprocess() {
// Skew correction factors // Skew correction factors
// //
_FIELD_TEST(planner_xy_skew_factor);
#if ENABLED(SKEW_CORRECTION_GCODE) #if ENABLED(SKEW_CORRECTION_GCODE)
EEPROM_READ(planner.xy_skew_factor); EEPROM_READ(planner.xy_skew_factor);
#if ENABLED(SKEW_CORRECTION_FOR_Z) #if ENABLED(SKEW_CORRECTION_FOR_Z)
@ -1308,6 +1348,8 @@ void MarlinSettings::postprocess() {
// Advanced Pause filament load & unload lengths // Advanced Pause filament load & unload lengths
// //
_FIELD_TEST(filament_change_unload_length);
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) { for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
EEPROM_READ(dummy); EEPROM_READ(dummy);