Browse Source

Merge pull request #5109 from thinkyhead/rc_eeprom_M218_tool_offset

Save hotend_offset array (M218) in EEPROM
Scott Lahteine 8 years ago
parent
commit
47ad97c35e
4 changed files with 635 additions and 585 deletions
  1. 4
    0
      Marlin/Marlin.h
  2. 2
    8
      Marlin/Marlin_main.cpp
  3. 628
    575
      Marlin/configuration_store.cpp
  4. 1
    2
      Marlin/configuration_store.h

+ 4
- 0
Marlin/Marlin.h View File

@@ -278,6 +278,10 @@ extern float current_position[NUM_AXIS];
278 278
 extern float position_shift[XYZ];
279 279
 extern float home_offset[XYZ];
280 280
 
281
+#if HOTENDS > 1
282
+  extern float hotend_offset[XYZ][HOTENDS];
283
+#endif
284
+
281 285
 // Software Endstops
282 286
 void update_software_endstops(AxisEnum axis);
283 287
 #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)

+ 2
- 8
Marlin/Marlin_main.cpp View File

@@ -481,13 +481,7 @@ static uint8_t target_extruder;
481 481
 
482 482
 // Extruder offsets
483 483
 #if HOTENDS > 1
484
-  float hotend_offset[][HOTENDS] = {
485
-    HOTEND_OFFSET_X,
486
-    HOTEND_OFFSET_Y
487
-    #ifdef HOTEND_OFFSET_Z
488
-      , HOTEND_OFFSET_Z
489
-    #endif
490
-  };
484
+  float hotend_offset[XYZ][HOTENDS];
491 485
 #endif
492 486
 
493 487
 #if HAS_Z_SERVO_ENDSTOP
@@ -6129,7 +6123,7 @@ inline void gcode_M211() {
6129 6123
    *   Z<zoffset> - Available with DUAL_X_CARRIAGE and SWITCHING_EXTRUDER
6130 6124
    */
6131 6125
   inline void gcode_M218() {
6132
-    if (get_target_extruder_from_command(218)) return;
6126
+    if (get_target_extruder_from_command(218) || target_extruder == 0) return;
6133 6127
 
6134 6128
     if (code_seen('X')) hotend_offset[X_AXIS][target_extruder] = code_value_axis_units(X_AXIS);
6135 6129
     if (code_seen('Y')) hotend_offset[Y_AXIS][target_extruder] = code_value_axis_units(Y_AXIS);

+ 628
- 575
Marlin/configuration_store.cpp
File diff suppressed because it is too large
View File


+ 1
- 2
Marlin/configuration_store.h View File

@@ -26,6 +26,7 @@
26 26
 #include "MarlinConfig.h"
27 27
 
28 28
 void Config_ResetDefault();
29
+void Config_StoreSettings();
29 30
 
30 31
 #if DISABLED(DISABLE_M503)
31 32
   void Config_PrintSettings(bool forReplay=false);
@@ -34,10 +35,8 @@ void Config_ResetDefault();
34 35
 #endif
35 36
 
36 37
 #if ENABLED(EEPROM_SETTINGS)
37
-  void Config_StoreSettings();
38 38
   void Config_RetrieveSettings();
39 39
 #else
40
-  FORCE_INLINE void Config_StoreSettings() {}
41 40
   FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
42 41
 #endif
43 42
 

Loading…
Cancel
Save