Broke up planner.h
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Wed, 23 Mar 2016 22:06:28 +0000 (15:06 -0700)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Wed, 23 Mar 2016 22:06:28 +0000 (15:06 -0700)
src/plan/line.c
src/plan/line.h
src/plan/planner.c
src/plan/planner.h

index 0a1be46f04234e3001ffcd332c7ecf8512032d99..bf2658a23309fd3289978baaf67c47ebca78b8c9 100644 (file)
 #include <stdbool.h>
 #include <math.h>
 
+/// common variables for planning (move master)
+typedef struct mpMoveMasterSingleton {
+  float position[AXES];             // final move position for planning purposes
+
+  float jerk;                       // jerk values cached from previous block
+  float recip_jerk;
+  float cbrt_jerk;
+} mpMoveMasterSingleton_t;
+
+
+mpMoveMasterSingleton_t mm = {};     // context for line planning
+
+
+/// Set planner position for a single axis
+void mp_set_planner_position(uint8_t axis, const float position) {
+  mm.position[axis] = position;
+}
+
 
 /* Sonny's algorithm - simple
  *
index eca0dfc9b7cb13158008edfd1232ef24451622cb..11044ce827cc8883546ba501e601c4b409de9764 100644 (file)
@@ -29,5 +29,6 @@
 
 #include "buffer.h"
 
+void mp_set_planner_position(uint8_t axis, const float position);
 void mp_plan_block_list(mpBuf_t *bf, uint8_t *mr_flag);
 stat_t mp_aline(GCodeState_t *gm_in);
index af276a43fabe21bf48a181e795c48ab1930b646f..dbbb4d14598975788a4173ab2b4b780960b575dd 100644 (file)
 #include <stdio.h>
 
 
-mpMoveMasterSingleton_t mm;     // context for line planning
-mpMoveRuntimeSingleton_t mr;    // context for line runtime
+mpMoveRuntimeSingleton_t mr = {};    // context for line runtime
 
 
 void planner_init() {
-  // If you know all memory has been zeroed by a hard reset you don't need
-  // these next 2 lines
-  memset(&mr, 0, sizeof(mr));    // clear all values, pointers and status
-  memset(&mm, 0, sizeof(mm));    // clear all values, pointers and status
   mp_init_buffers();
 }
 
@@ -120,11 +115,6 @@ void mp_flush_planner() {
  * still close to the starting point.
  */
 
-/// Set planner position for a single axis
-void mp_set_planner_position(uint8_t axis, const float position) {
-  mm.position[axis] = position;
-}
-
 
 /// Set runtime position for a single axis
 void mp_set_runtime_position(uint8_t axis, const float position) {
index 439beb13005f291906f9ffdc9af63780d2716d56..c70413e2e6bba330677eabe68e9c7e2cc8c64b94 100644 (file)
@@ -63,16 +63,6 @@ typedef enum {
   ((MIN_SEGMENT_USEC + 1) / MICROSECONDS_PER_MINUTE)
 
 
-/// common variables for planning (move master)
-typedef struct mpMoveMasterSingleton {
-  float position[AXES];             // final move position for planning purposes
-
-  float jerk;                       // jerk values cached from previous block
-  float recip_jerk;
-  float cbrt_jerk;
-} mpMoveMasterSingleton_t;
-
-
 typedef struct mpMoveRuntimeSingleton { // persistent runtime variables
   uint8_t move_state;    // state of the overall move
   uint8_t section;       // what section is the move in?
@@ -141,13 +131,11 @@ typedef struct mpMoveRuntimeSingleton { // persistent runtime variables
 
 
 // Reference global scope structures
-extern mpMoveMasterSingleton_t mm;  // context for line planning
 extern mpMoveRuntimeSingleton_t mr; // context for line runtime
 
 
 void planner_init();
 void mp_flush_planner();
-void mp_set_planner_position(uint8_t axis, const float position);
 void mp_set_runtime_position(uint8_t axis, const float position);
 void mp_set_steps_to_runtime_position();
 float mp_get_runtime_velocity();