Bläddra i källkod

Move z_endstop_adj to Endstops

Scott Lahteine 7 år sedan
förälder
incheckning
64dfb46461

+ 0
- 4
Marlin/src/Marlin.cpp Visa fil

179
 millis_t max_inactive_time = 0,
179
 millis_t max_inactive_time = 0,
180
          stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
180
          stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
181
 
181
 
182
-#if ENABLED(Z_DUAL_ENDSTOPS)
183
-  float z_endstop_adj;
184
-#endif
185
-
186
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
182
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
187
   static bool filament_ran_out = false;
183
   static bool filament_ran_out = false;
188
 #endif
184
 #endif

+ 0
- 4
Marlin/src/Marlin.h Visa fil

190
 // Inactivity shutdown timer
190
 // Inactivity shutdown timer
191
 extern millis_t max_inactive_time, stepper_inactive_time;
191
 extern millis_t max_inactive_time, stepper_inactive_time;
192
 
192
 
193
-#if ENABLED(Z_DUAL_ENDSTOPS)
194
-  extern float z_endstop_adj;
195
-#endif
196
-
197
 #if HAS_SERVOS
193
 #if HAS_SERVOS
198
   #include "HAL/servo.h"
194
   #include "HAL/servo.h"
199
   extern HAL_SERVO_LIB servo[NUM_SERVOS];
195
   extern HAL_SERVO_LIB servo[NUM_SERVOS];

+ 3
- 3
Marlin/src/gcode/calibrate/M666.cpp Visa fil

64
 
64
 
65
 #elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS)
65
 #elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS)
66
 
66
 
67
-  #include "../../Marlin.h" // for z_endstop_adj
67
+  #include "../../module/endstops.h"
68
 
68
 
69
   /**
69
   /**
70
    * M666: For Z Dual Endstop setup, set z axis offset to the z2 axis.
70
    * M666: For Z Dual Endstop setup, set z axis offset to the z2 axis.
71
    */
71
    */
72
   void GcodeSuite::M666() {
72
   void GcodeSuite::M666() {
73
-    if (parser.seen('Z')) z_endstop_adj = parser.value_linear_units();
74
-    SERIAL_ECHOLNPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj);
73
+    if (parser.seen('Z')) endstops.z_endstop_adj = parser.value_linear_units();
74
+    SERIAL_ECHOLNPAIR("Z Endstop Adjustment set to (mm):", endstops.z_endstop_adj);
75
   }
75
   }
76
 
76
 
77
 #endif
77
 #endif

+ 5
- 5
Marlin/src/module/configuration_store.cpp Visa fil

103
  *  ---  M665 Z    delta_tower_angle_trim[C]        (float) is always 0.0
103
  *  ---  M665 Z    delta_tower_angle_trim[C]        (float) is always 0.0
104
  *
104
  *
105
  * Z_DUAL_ENDSTOPS:                                 48 bytes
105
  * Z_DUAL_ENDSTOPS:                                 48 bytes
106
- *  348  M666 Z    z_endstop_adj                    (float)
106
+ *  348  M666 Z    endstops.z_endstop_adj           (float)
107
  *  ---            dummy data                       (float x11)
107
  *  ---            dummy data                       (float x11)
108
  *
108
  *
109
  * ULTIPANEL:                                       6 bytes
109
  * ULTIPANEL:                                       6 bytes
426
       dummy = 0.0f;
426
       dummy = 0.0f;
427
       for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy);
427
       for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy);
428
     #elif ENABLED(Z_DUAL_ENDSTOPS)
428
     #elif ENABLED(Z_DUAL_ENDSTOPS)
429
-      EEPROM_WRITE(z_endstop_adj);             // 1 float
429
+      EEPROM_WRITE(endstops.z_endstop_adj);    // 1 float
430
       dummy = 0.0f;
430
       dummy = 0.0f;
431
       for (uint8_t q = 11; q--;) EEPROM_WRITE(dummy);
431
       for (uint8_t q = 11; q--;) EEPROM_WRITE(dummy);
432
     #else
432
     #else
811
         dummy = 0.0f;
811
         dummy = 0.0f;
812
         for (uint8_t q=3; q--;) EEPROM_READ(dummy);
812
         for (uint8_t q=3; q--;) EEPROM_READ(dummy);
813
       #elif ENABLED(Z_DUAL_ENDSTOPS)
813
       #elif ENABLED(Z_DUAL_ENDSTOPS)
814
-        EEPROM_READ(z_endstop_adj);
814
+        EEPROM_READ(endstops.z_endstop_adj);    // 1 float
815
         dummy = 0.0f;
815
         dummy = 0.0f;
816
         for (uint8_t q=11; q--;) EEPROM_READ(dummy);
816
         for (uint8_t q=11; q--;) EEPROM_READ(dummy);
817
       #else
817
       #else
1203
 
1203
 
1204
   #elif ENABLED(Z_DUAL_ENDSTOPS)
1204
   #elif ENABLED(Z_DUAL_ENDSTOPS)
1205
 
1205
 
1206
-    z_endstop_adj =
1206
+    endstops.z_endstop_adj =
1207
       #ifdef Z_DUAL_ENDSTOPS_ADJUSTMENT
1207
       #ifdef Z_DUAL_ENDSTOPS_ADJUSTMENT
1208
         Z_DUAL_ENDSTOPS_ADJUSTMENT
1208
         Z_DUAL_ENDSTOPS_ADJUSTMENT
1209
       #else
1209
       #else
1621
         SERIAL_ECHOLNPGM("Z2 Endstop adjustment:");
1621
         SERIAL_ECHOLNPGM("Z2 Endstop adjustment:");
1622
       }
1622
       }
1623
       CONFIG_ECHO_START;
1623
       CONFIG_ECHO_START;
1624
-      SERIAL_ECHOLNPAIR("  M666 Z", LINEAR_UNIT(z_endstop_adj));
1624
+      SERIAL_ECHOLNPAIR("  M666 Z", LINEAR_UNIT(endstops.z_endstop_adj));
1625
     #endif // DELTA
1625
     #endif // DELTA
1626
 
1626
 
1627
     #if ENABLED(ULTIPANEL)
1627
     #if ENABLED(ULTIPANEL)

+ 4
- 0
Marlin/src/module/endstops.cpp Visa fil

54
   volatile bool Endstops::z_probe_enabled = false;
54
   volatile bool Endstops::z_probe_enabled = false;
55
 #endif
55
 #endif
56
 
56
 
57
+#if ENABLED(Z_DUAL_ENDSTOPS)
58
+  float Endstops::z_endstop_adj;
59
+#endif
60
+
57
 /**
61
 /**
58
  * Class and Instance Methods
62
  * Class and Instance Methods
59
  */
63
  */

+ 1
- 0
Marlin/src/module/endstops.h Visa fil

50
     static volatile char endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT value
50
     static volatile char endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT value
51
 
51
 
52
     #if ENABLED(Z_DUAL_ENDSTOPS)
52
     #if ENABLED(Z_DUAL_ENDSTOPS)
53
+      static float z_endstop_adj;
53
       typedef uint16_t esbits_t;
54
       typedef uint16_t esbits_t;
54
     #else
55
     #else
55
       typedef byte esbits_t;
56
       typedef byte esbits_t;

+ 3
- 3
Marlin/src/module/motion.cpp Visa fil

1099
 
1099
 
1100
   #if ENABLED(Z_DUAL_ENDSTOPS)
1100
   #if ENABLED(Z_DUAL_ENDSTOPS)
1101
     if (axis == Z_AXIS) {
1101
     if (axis == Z_AXIS) {
1102
-      float adj = FABS(z_endstop_adj);
1102
+      float adj = FABS(endstops.z_endstop_adj);
1103
       bool lockZ1;
1103
       bool lockZ1;
1104
       if (axis_home_dir > 0) {
1104
       if (axis_home_dir > 0) {
1105
         adj = -adj;
1105
         adj = -adj;
1106
-        lockZ1 = (z_endstop_adj > 0);
1106
+        lockZ1 = (endstops.z_endstop_adj > 0);
1107
       }
1107
       }
1108
       else
1108
       else
1109
-        lockZ1 = (z_endstop_adj < 0);
1109
+        lockZ1 = (endstops.z_endstop_adj < 0);
1110
 
1110
 
1111
       if (lockZ1) stepper.set_z_lock(true); else stepper.set_z2_lock(true);
1111
       if (lockZ1) stepper.set_z_lock(true); else stepper.set_z2_lock(true);
1112
 
1112
 

Laddar…
Avbryt
Spara