Sfoglia il codice sorgente

Ultimate followup to Stepper/Planner patch

- Search all symbols and apply prefixes where needed
- Encapsulate some private methods
- Inline some setters
- Make `microstep_mode` a public method
Scott Lahteine 8 anni fa
parent
commit
6398d497b3
4 ha cambiato i file con 27 aggiunte e 59 eliminazioni
  1. 4
    16
      Marlin/planner.cpp
  2. 18
    33
      Marlin/planner.h
  3. 0
    6
      Marlin/stepper.cpp
  4. 5
    4
      Marlin/stepper.h

+ 4
- 16
Marlin/planner.cpp Vedi File

@@ -21,24 +21,12 @@
21 21
  */
22 22
 
23 23
 /**
24
- * planner.cpp - Buffer movement commands and manage the acceleration profile plan
25
- * Part of Grbl
24
+ * planner.cpp
26 25
  *
27
- * Copyright (c) 2009-2011 Simen Svale Skogsrud
28
- *
29
- * Grbl is free software: you can redistribute it and/or modify
30
- * it under the terms of the GNU General Public License as published by
31
- * the Free Software Foundation, either version 3 of the License, or
32
- * (at your option) any later version.
33
- *
34
- * Grbl is distributed in the hope that it will be useful,
35
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
36
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
37
- * GNU General Public License for more details.
38
- *
39
- * You should have received a copy of the GNU General Public License
40
- * along with Grbl.  If not, see <http://www.gnu.org/licenses/>.
26
+ * Buffer movement commands and manage the acceleration profile plan
41 27
  *
28
+ * Derived from Grbl
29
+ * Copyright (c) 2009-2011 Simen Svale Skogsrud
42 30
  *
43 31
  * The ring buffer implementation gleaned from the wiring_serial library by David A. Mellis.
44 32
  *

+ 18
- 33
Marlin/planner.h Vedi File

@@ -21,27 +21,13 @@
21 21
  */
22 22
 
23 23
 /**
24
-  planner.h - buffers movement commands and manages the acceleration profile plan
25
-  Part of Grbl
26
-
27
-  Copyright (c) 2009-2011 Simen Svale Skogsrud
28
-
29
-  Grbl is free software: you can redistribute it and/or modify
30
-  it under the terms of the GNU General Public License as published by
31
-  the Free Software Foundation, either version 3 of the License, or
32
-  (at your option) any later version.
33
-
34
-  Grbl is distributed in the hope that it will be useful,
35
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
36
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
37
-  GNU General Public License for more details.
38
-
39
-  You should have received a copy of the GNU General Public License
40
-  along with Grbl.  If not, see <http://www.gnu.org/licenses/>.
41
-*/
42
-
43
-// This module is to be considered a sub-module of stepper.c. Please don't include
44
-// this file from any other module.
24
+ * planner.h
25
+ *
26
+ * Buffer movement commands and manage the acceleration profile plan
27
+ *
28
+ * Derived from Grbl
29
+ * Copyright (c) 2009-2011 Simen Svale Skogsrud
30
+ */
45 31
 
46 32
 #ifndef PLANNER_H
47 33
 #define PLANNER_H
@@ -268,6 +254,17 @@ class Planner {
268 254
         return NULL;
269 255
     }
270 256
 
257
+    #if ENABLED(AUTOTEMP)
258
+      float autotemp_max = 250;
259
+      float autotemp_min = 210;
260
+      float autotemp_factor = 0.1;
261
+      bool autotemp_enabled = false;
262
+      void getHighESpeed();
263
+      void autotemp_M109();
264
+    #endif
265
+
266
+  private:
267
+
271 268
     /**
272 269
      * Get the index of the next / previous block in the ring buffer
273 270
      */
@@ -305,18 +302,6 @@ class Planner {
305 302
       return sqrt(target_velocity * target_velocity - 2 * acceleration * distance);
306 303
     }
307 304
 
308
-
309
-    #if ENABLED(AUTOTEMP)
310
-      float autotemp_max = 250;
311
-      float autotemp_min = 210;
312
-      float autotemp_factor = 0.1;
313
-      bool autotemp_enabled = false;
314
-      void getHighESpeed();
315
-      void autotemp_M109();
316
-    #endif
317
-
318
-  private:
319
-
320 305
     void calculate_trapezoid_for_block(block_t* block, float entry_factor, float exit_factor);
321 306
 
322 307
     void reverse_pass_kernel(block_t* previous, block_t* current, block_t* next);

+ 0
- 6
Marlin/stepper.cpp Vedi File

@@ -979,9 +979,3 @@ void Stepper::microstep_readings() {
979 979
     SERIAL_PROTOCOLLN(digitalRead(E1_MS2_PIN));
980 980
   #endif
981 981
 }
982
-
983
-#if ENABLED(Z_DUAL_ENDSTOPS)
984
-  void Stepper::set_homing_flag(bool state) { performing_homing = state; }
985
-  void Stepper::set_z_lock(bool state) { locked_z_motor = state; }
986
-  void Stepper::set_z2_lock(bool state) { locked_z2_motor = state; }
987
-#endif

+ 5
- 4
Marlin/stepper.h Vedi File

@@ -224,9 +224,9 @@ class Stepper {
224 224
     void microstep_readings();
225 225
 
226 226
     #if ENABLED(Z_DUAL_ENDSTOPS)
227
-      void set_homing_flag(bool state);
228
-      void set_z_lock(bool state);
229
-      void set_z2_lock(bool state);
227
+      FORCE_INLINE void set_homing_flag(bool state) { performing_homing = state; }
228
+      FORCE_INLINE void set_z_lock(bool state) { locked_z_motor = state; }
229
+      FORCE_INLINE void set_z2_lock(bool state) { locked_z2_motor = state; }
230 230
     #endif
231 231
 
232 232
     #if ENABLED(BABYSTEPPING)
@@ -249,6 +249,8 @@ class Stepper {
249 249
       return endstops_trigsteps[axis] / planner.axis_steps_per_unit[axis];
250 250
     }
251 251
 
252
+  private:
253
+
252 254
     FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
253 255
       unsigned short timer;
254 256
 
@@ -324,7 +326,6 @@ class Stepper {
324 326
       // SERIAL_ECHOLN(current_block->final_advance/256.0);
325 327
     }
326 328
 
327
-  private:
328 329
     void digipot_init();
329 330
     void microstep_init();
330 331
 

Loading…
Annulla
Salva