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
 extern float position_shift[XYZ];
278
 extern float position_shift[XYZ];
279
 extern float home_offset[XYZ];
279
 extern float home_offset[XYZ];
280
 
280
 
281
+#if HOTENDS > 1
282
+  extern float hotend_offset[XYZ][HOTENDS];
283
+#endif
284
+
281
 // Software Endstops
285
 // Software Endstops
282
 void update_software_endstops(AxisEnum axis);
286
 void update_software_endstops(AxisEnum axis);
283
 #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
287
 #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)

+ 2
- 8
Marlin/Marlin_main.cpp View File

481
 
481
 
482
 // Extruder offsets
482
 // Extruder offsets
483
 #if HOTENDS > 1
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
 #endif
485
 #endif
492
 
486
 
493
 #if HAS_Z_SERVO_ENDSTOP
487
 #if HAS_Z_SERVO_ENDSTOP
6129
    *   Z<zoffset> - Available with DUAL_X_CARRIAGE and SWITCHING_EXTRUDER
6123
    *   Z<zoffset> - Available with DUAL_X_CARRIAGE and SWITCHING_EXTRUDER
6130
    */
6124
    */
6131
   inline void gcode_M218() {
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
     if (code_seen('X')) hotend_offset[X_AXIS][target_extruder] = code_value_axis_units(X_AXIS);
6128
     if (code_seen('X')) hotend_offset[X_AXIS][target_extruder] = code_value_axis_units(X_AXIS);
6135
     if (code_seen('Y')) hotend_offset[Y_AXIS][target_extruder] = code_value_axis_units(Y_AXIS);
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
 #include "MarlinConfig.h"
26
 #include "MarlinConfig.h"
27
 
27
 
28
 void Config_ResetDefault();
28
 void Config_ResetDefault();
29
+void Config_StoreSettings();
29
 
30
 
30
 #if DISABLED(DISABLE_M503)
31
 #if DISABLED(DISABLE_M503)
31
   void Config_PrintSettings(bool forReplay=false);
32
   void Config_PrintSettings(bool forReplay=false);
34
 #endif
35
 #endif
35
 
36
 
36
 #if ENABLED(EEPROM_SETTINGS)
37
 #if ENABLED(EEPROM_SETTINGS)
37
-  void Config_StoreSettings();
38
   void Config_RetrieveSettings();
38
   void Config_RetrieveSettings();
39
 #else
39
 #else
40
-  FORCE_INLINE void Config_StoreSettings() {}
41
   FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
40
   FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
42
 #endif
41
 #endif
43
 
42
 

Loading…
Cancel
Save