More consistent variable naming style
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Mon, 5 Sep 2016 23:09:05 +0000 (16:09 -0700)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Mon, 5 Sep 2016 23:09:05 +0000 (16:09 -0700)
37 files changed:
src/command.c
src/command.h
src/config.h
src/gcode_parser.c
src/homing.c
src/huanyang.c
src/huanyang.h
src/machine.c
src/machine.h
src/motor.c
src/motor.h
src/plan/arc.c
src/plan/buffer.c
src/plan/buffer.h
src/plan/calibrate.c
src/plan/command.c
src/plan/command.h
src/plan/dwell.c
src/plan/exec.c
src/plan/exec.h
src/plan/jog.c
src/plan/line.c
src/plan/line.h
src/plan/planner.c
src/plan/planner.h
src/plan/state.c
src/plan/state.h
src/probing.c
src/pwm_spindle.c
src/pwm_spindle.h
src/spindle.c
src/spindle.h
src/stepper.c
src/stepper.h
src/tmc2660.c
src/util.c
src/util.h

index 81ddbc33c72d36db3b6bb9cff4b1dd87e2c00ca8..d618d828f412ac56114d1a1ca4162c82fe6f4544 100644 (file)
@@ -133,11 +133,11 @@ int command_exec(int argc, char *argv[]) {
 
   int i = command_find(argv[0]);
   if (i != -1) {
-    uint8_t minArgs = pgm_read_byte(&commands[i].minArgs);
-    uint8_t maxArgs = pgm_read_byte(&commands[i].maxArgs);
+    uint8_t min_args = pgm_read_byte(&commands[i].min_args);
+    uint8_t max_args = pgm_read_byte(&commands[i].max_args);
 
-    if (argc <= minArgs) return STAT_TOO_FEW_ARGUMENTS;
-    else if (maxArgs < argc - 1) return STAT_TOO_MANY_ARGUMENTS;
+    if (argc <= min_args) return STAT_TOO_FEW_ARGUMENTS;
+    else if (max_args < argc - 1) return STAT_TOO_MANY_ARGUMENTS;
     else {
       command_cb_t cb = pgm_read_word(&commands[i].cb);
       return cb(argc, argv);
index c5ef5babd04efa3663b53673ba75f3f37f3ae544..cecc572868e1f78384dfd2e25cf22b1915a13b1a 100644 (file)
@@ -38,8 +38,8 @@ typedef uint8_t (*command_cb_t)(int argc, char *argv[]);
 typedef struct {
   const char *name;
   command_cb_t cb;
-  uint8_t minArgs;
-  uint8_t maxArgs;
+  uint8_t min_args;
+  uint8_t max_args;
   const char *help;
 } command_t;
 
index 7dc92cf969c7dba8db5d96327ddf3c45424a4580..82b895f6d71cc280418b8a68c0bfd542798fbceb 100644 (file)
@@ -157,7 +157,6 @@ typedef enum {
 
 // Machine settings
 #define CHORDAL_TOLERANCE        0.01   // chordal accuracy for arc drawing
-#define SOFT_LIMIT_ENABLE        false
 #define JERK_MAX                 50     // yes, that's km/min^3
 #define JUNCTION_DEVIATION       0.05   // default value, in mm
 #define JUNCTION_ACCELERATION    100000 // centripetal corner acceleration
index 0ada698afa25a3219d8b71970cedf655875d6263..ed239a5a05815e8d0129085ce77aab0deef37bae 100644 (file)
@@ -362,8 +362,8 @@ static stat_t _parse_gcode_block(char *buf) {
 
   // set initial state for new move
   memset(modals, 0, sizeof(modals));              // clear all parser values
-  memset(&mach.gf, 0, sizeof(GCodeState_t));      // clear all next-state flags
-  memset(&mach.gn, 0, sizeof(GCodeState_t));      // clear all next-state values
+  memset(&mach.gf, 0, sizeof(gcode_state_t));     // clear all next-state flags
+  memset(&mach.gn, 0, sizeof(gcode_state_t));     // clear all next-state values
 
   // get motion mode from previous block
   mach.gn.motion_mode = mach_get_motion_mode();
index 876dd24a924e1a86bdd76094f44784a696e807a4..046361d277a4bfe2c622645c292a5b197532cb4a 100644 (file)
@@ -51,12 +51,12 @@ typedef enum {
   HOMING_NOT_HOMED,     // machine is not homed
   HOMING_HOMED,         // machine is homed
   HOMING_WAITING,       // machine waiting to be homed
-} homingState_t;
+} homing_state_t;
 
 
 /// persistent homing runtime variables
-struct hmHomingSingleton {
-  homingState_t state;            // homing cycle sub-state machine
+typedef struct {
+  homing_state_t state;           // homing cycle sub-state machine
   bool homed[AXES];               // individual axis homing flags
 
   // controls for homing cycle
@@ -92,10 +92,10 @@ struct hmHomingSingleton {
   uint8_t saved_feed_rate_mode;   // G93,G94 global setting
   float saved_feed_rate;          // F setting
   float saved_jerk;               // saved and restored for each axis homed
-};
+} homing_t;
 
 
-static struct hmHomingSingleton hm = {0};
+static homing_t hm = {0};
 
 
 // G28.2 homing cycle
index 7c3e51854378d0bfce2596ba5999f5da157ac2aa..639b8075cd7f41afcc8d1f4d56e7022312645282 100644 (file)
@@ -114,7 +114,7 @@ typedef struct {
   bool connected;
   bool changed;
   bool estop;
-  machSpindleMode_t mode;
+  spindle_mode_t mode;
   float speed;
 
   float actual_freq;
@@ -450,7 +450,7 @@ void huanyang_init() {
 }
 
 
-void huanyang_set(machSpindleMode_t mode, float speed) {
+void huanyang_set(spindle_mode_t mode, float speed) {
   if ((ha.mode != mode || ha.speed != speed) && !ha.estop) {
     if (ha.debug) STATUS_DEBUG("huanyang: mode=%d, speed=%0.2f", mode, speed);
 
@@ -474,7 +474,7 @@ void huanyang_reset() {
 
   // Save settings
   uint8_t id = ha.id;
-  machSpindleMode_t mode = ha.mode;
+  spindle_mode_t mode = ha.mode;
   float speed = ha.speed;
   bool debug = ha.debug;
 
index 6defa889bf2d54428863253f85bf08d7855aff21..46efeac84781618bd8d6c82656f07c09eb7fd8b6 100644 (file)
@@ -31,7 +31,7 @@
 
 
 void huanyang_init();
-void huanyang_set(machSpindleMode_t mode, float speed);
+void huanyang_set(spindle_mode_t mode, float speed);
 void huanyang_reset();
 void huanyang_rtc_callback();
 void huanyang_estop();
index aaff4f7343612168189848bbdcdae8adce179855..1c159fc59db8db61664f3100ad3175f996c11ae3 100644 (file)
@@ -194,19 +194,19 @@ machine_t mach = {
 
 // Machine State functions
 uint32_t mach_get_line() {return mach.gm.line;}
-machMotionMode_t mach_get_motion_mode() {return mach.gm.motion_mode;}
-machCoordSystem_t mach_get_coord_system() {return mach.gm.coord_system;}
-machUnitsMode_t mach_get_units_mode() {return mach.gm.units_mode;}
-machPlane_t mach_get_select_plane() {return mach.gm.select_plane;}
-machPathControlMode_t mach_get_path_control() {return mach.gm.path_control;}
-machDistanceMode_t mach_get_distance_mode() {return mach.gm.distance_mode;}
-machFeedRateMode_t mach_get_feed_rate_mode() {return mach.gm.feed_rate_mode;}
+motion_mode_t mach_get_motion_mode() {return mach.gm.motion_mode;}
+coord_system_t mach_get_coord_system() {return mach.gm.coord_system;}
+units_mode_t mach_get_units_mode() {return mach.gm.units_mode;}
+plane_t mach_get_select_plane() {return mach.gm.select_plane;}
+path_mode_t mach_get_path_control() {return mach.gm.path_control;}
+distance_mode_t mach_get_distance_mode() {return mach.gm.distance_mode;}
+feed_rate_mode_t mach_get_feed_rate_mode() {return mach.gm.feed_rate_mode;}
 uint8_t mach_get_tool() {return mach.gm.tool;}
-machSpindleMode_t mach_get_spindle_mode() {return mach.gm.spindle_mode;}
+spindle_mode_t mach_get_spindle_mode() {return mach.gm.spindle_mode;}
 float mach_get_feed_rate() {return mach.gm.feed_rate;}
 
 
-PGM_P mp_get_units_mode_pgmstr(machUnitsMode_t mode) {
+PGM_P mp_get_units_mode_pgmstr(units_mode_t mode) {
   switch (mode) {
   case INCHES:      return PSTR("IN");
   case MILLIMETERS: return PSTR("MM");
@@ -217,12 +217,12 @@ PGM_P mp_get_units_mode_pgmstr(machUnitsMode_t mode) {
 }
 
 
-void mach_set_motion_mode(machMotionMode_t motion_mode) {
+void mach_set_motion_mode(motion_mode_t motion_mode) {
   mach.gm.motion_mode = motion_mode;
 }
 
 
-void mach_set_spindle_mode(machSpindleMode_t spindle_mode) {
+void mach_set_spindle_mode(spindle_mode_t spindle_mode) {
   mach.gm.spindle_mode = spindle_mode;
 }
 
@@ -573,21 +573,19 @@ void mach_set_model_target(float target[], float flag[]) {
  * be tested w/the other disabled, should that requirement ever arise.
  */
 stat_t mach_test_soft_limits(float target[]) {
-#ifdef SOFT_LIMIT_ENABLE
-    for (int axis = 0; axis < AXES; axis++) {
-      if (!mach_get_homed(axis)) continue; // don't test axes that arent homed
+  for (int axis = 0; axis < AXES; axis++) {
+    if (!mach_get_homed(axis)) continue; // don't test axes that arent homed
 
-      if (fp_EQ(mach.a[axis].travel_min, mach.a[axis].travel_max)) continue;
+    if (fp_EQ(mach.a[axis].travel_min, mach.a[axis].travel_max)) continue;
 
-      if (mach.a[axis].travel_min > DISABLE_SOFT_LIMIT &&
-          target[axis] < mach.a[axis].travel_min)
-        return STAT_SOFT_LIMIT_EXCEEDED;
+    if (mach.a[axis].travel_min > DISABLE_SOFT_LIMIT &&
+        target[axis] < mach.a[axis].travel_min)
+      return STAT_SOFT_LIMIT_EXCEEDED;
 
-      if (mach.a[axis].travel_max > DISABLE_SOFT_LIMIT &&
-          target[axis] > mach.a[axis].travel_max)
-        return STAT_SOFT_LIMIT_EXCEEDED;
-    }
-#endif
+    if (mach.a[axis].travel_max > DISABLE_SOFT_LIMIT &&
+        target[axis] > mach.a[axis].travel_max)
+      return STAT_SOFT_LIMIT_EXCEEDED;
+  }
 
   return STAT_OK;
 }
@@ -636,15 +634,15 @@ stat_t mach_alarm(const char *location, stat_t code) {
 // These functions assume input validation occurred upstream.
 
 /// G17, G18, G19 select axis plane
-void mach_set_plane(machPlane_t plane) {mach.gm.select_plane = plane;}
+void mach_set_plane(plane_t plane) {mach.gm.select_plane = plane;}
 
 
 /// G20, G21
-void mach_set_units_mode(machUnitsMode_t mode) {mach.gm.units_mode = mode;}
+void mach_set_units_mode(units_mode_t mode) {mach.gm.units_mode = mode;}
 
 
 /// G90, G91
-void mach_set_distance_mode(machDistanceMode_t mode) {
+void mach_set_distance_mode(distance_mode_t mode) {
   mach.gm.distance_mode = mode;
 }
 
@@ -657,7 +655,7 @@ void mach_set_distance_mode(machDistanceMode_t mode) {
  * accomplished by calling mach_set_work_offsets() immediately
  * afterwards.
  */
-void mach_set_coord_offsets(machCoordSystem_t coord_system, float offset[],
+void mach_set_coord_offsets(coord_system_t coord_system, float offset[],
                             float flag[]) {
   if (coord_system < G54 || MAX_COORDS <= coord_system) return;
 
@@ -668,7 +666,7 @@ void mach_set_coord_offsets(machCoordSystem_t coord_system, float offset[],
 
 
 /// G54-G59
-void mach_set_coord_system(machCoordSystem_t coord_system) {
+void mach_set_coord_system(coord_system_t coord_system) {
   mach.gm.coord_system = coord_system;
   mach_set_work_offsets(); // set work offsets in the Gcode model
 }
@@ -730,8 +728,8 @@ void mach_set_absolute_origin(float origin[], float flag[]) {
   for (int axis = 0; axis < AXES; axis++)
     if (fp_TRUE(flag[axis])) {
       value[axis] = TO_MILLIMETERS(origin[axis]);
-      mach.position[axis] = value[axis];         // set model position
-      mach.ms.target[axis] = value[axis];            // reset model target
+      mach.position[axis] = value[axis];           // set model position
+      mach.ms.target[axis] = value[axis];          // reset model target
       mp_set_planner_position(axis, value[axis]);  // set mm position
     }
 
@@ -854,14 +852,14 @@ void mach_set_feed_rate(float feed_rate) {
 }
 
 
-/// G93, G94 See machFeedRateMode
-void mach_set_feed_rate_mode(machFeedRateMode_t mode) {
+/// G93, G94
+void mach_set_feed_rate_mode(feed_rate_mode_t mode) {
   mach.gm.feed_rate_mode = mode;
 }
 
 
 /// G61, G61.1, G64
-void mach_set_path_control(machPathControlMode_t mode) {
+void mach_set_path_control(path_mode_t mode) {
   mach.gm.path_control = mode;
 }
 
index 58a1f1cd3161f17153eade8ccb1f3b83a46b7d1d..50378c734d7c9e006edf40e90593274f1994a269 100644 (file)
@@ -41,9 +41,9 @@
 #define TO_MILLIMETERS(a) (mach.gm.units_mode == INCHES ? (a) * MM_PER_INCH : a)
 
 
-/* The difference between machNextAction_t and machMotionMode_ is that
- * machNextAction_t is used by the current block, and may carry non-modal
- * commands, whereas machMotionMode_t persists across blocks as G modal group 1
+/* The difference between next_action_t and motion_mode_t is that
+ * next_action_t is used by the current block, and may carry non-modal
+ * commands, whereas motion_mode_t persists across blocks as G modal group 1
  */
 
 /// these are in order to optimized CASE statement
@@ -63,7 +63,7 @@ typedef enum {
   NEXT_ACTION_RESUME_ORIGIN_OFFSETS,  // G92.3
   NEXT_ACTION_DWELL,                  // G4
   NEXT_ACTION_STRAIGHT_PROBE,         // G38.2
-} machNextAction_t;
+} next_action_t;
 
 
 typedef enum {                        // G Modal Group 1
@@ -82,7 +82,7 @@ typedef enum {                        // G Modal Group 1
   MOTION_MODE_CANNED_CYCLE_87,        // G87 - back boring
   MOTION_MODE_CANNED_CYCLE_88,        // G88 - boring, spindle stop, manual out
   MOTION_MODE_CANNED_CYCLE_89,        // G89 - boring, dwell, feed out
-} machMotionMode_t;
+} motion_mode_t;
 
 
 typedef enum {   // Used for detecting gcode errors. See NIST section 3.4
@@ -102,7 +102,7 @@ typedef enum {   // Used for detecting gcode errors. See NIST section 3.4
   MODAL_GROUP_M7,     // {M3,M4,M5}                spindle turning
   MODAL_GROUP_M8,     // {M7,M8,M9}                coolant
   MODAL_GROUP_M9,     // {M48,M49}                 speed/feed override switches
-} machModalGroup_t;
+} modal_group_t;
 
 #define MODAL_GROUP_COUNT (MODAL_GROUP_M9 + 1)
 
@@ -114,21 +114,21 @@ typedef enum { // plane - translates to:
   PLANE_XY,     // G17    X         Y         Z
   PLANE_XZ,     // G18    X         Z         Y
   PLANE_YZ,     // G19    Y         Z         X
-} machPlane_t;
+} plane_t;
 
 
 typedef enum {
   INCHES,        // G20
   MILLIMETERS,   // G21
   DEGREES,       // ABC axes (this value used for displays only)
-} machUnitsMode_t;
+} units_mode_t;
 
 
 typedef enum {
   ABSOLUTE_COORDS,                // machine coordinate system
   G54, G55, G56, G57, G58, G59,
   MAX_COORDS,
-} machCoordSystem_t;
+} coord_system_t;
 
 /// G Modal Group 13
 typedef enum {
@@ -136,20 +136,20 @@ typedef enum {
   PATH_EXACT_PATH,
   PATH_EXACT_STOP,                // G61.1 - stops at all corners
   PATH_CONTINUOUS,                // G64 and typically the default mode
-} machPathControlMode_t;
+} path_mode_t;
 
 
 typedef enum {
   ABSOLUTE_MODE,                  // G90
   INCREMENTAL_MODE,               // G91
-} machDistanceMode_t;
+} distance_mode_t;
 
 
 typedef enum {
   INVERSE_TIME_MODE,              // G93
   UNITS_PER_MINUTE_MODE,          // G94
   UNITS_PER_REVOLUTION_MODE,      // G95 (unimplemented)
-} machFeedRateMode_t;
+} feed_rate_mode_t;
 
 
 typedef enum {
@@ -157,7 +157,7 @@ typedef enum {
   ORIGIN_OFFSET_CANCEL,   // G92.1 - zero out origin offsets
   ORIGIN_OFFSET_SUSPEND,  // G92.2 - do not apply offsets, but preserve values
   ORIGIN_OFFSET_RESUME,   // G92.3 - resume application of the suspended offsets
-} machOriginOffset_t;
+} origin_offset_t;
 
 
 typedef enum {
@@ -165,7 +165,7 @@ typedef enum {
   PROGRAM_OPTIONAL_STOP,
   PROGRAM_PALLET_CHANGE_STOP,
   PROGRAM_END,
-} machProgramFlow_t;
+} program_flow_t;
 
 
 /// spindle state settings
@@ -173,7 +173,7 @@ typedef enum {
   SPINDLE_OFF,
   SPINDLE_CW,
   SPINDLE_CCW,
-} machSpindleMode_t;
+} spindle_mode_t;
 
 
 /// mist and flood coolant states
@@ -182,14 +182,14 @@ typedef enum {
   COOLANT_ON,         // request coolant on or indicate both coolants are on
   COOLANT_MIST,       // indicates mist coolant on
   COOLANT_FLOOD,      // indicates flood coolant on
-} machCoolantState_t;
+} coolant_state_t;
 
 
 /// used for spindle and arc dir
 typedef enum {
   DIRECTION_CW,
   DIRECTION_CCW,
-} machDirection_t;
+} direction_t;
 
 
 /// axis modes (ordered: see _mach_get_feed_time())
@@ -199,7 +199,7 @@ typedef enum {
   AXIS_INHIBITED,             // axis is computed but not activated
   AXIS_RADIUS,                // rotary axis calibrated to circumference
   AXIS_MODE_MAX,
-} machAxisMode_t; // ordering must be preserved.
+} axis_mode_t; // ordering must be preserved.
 
 
 /* Gcode model - The following GCodeModel/GCodeInput structs are used:
@@ -228,7 +228,7 @@ typedef struct {
   float target[AXES];        // XYZABC where the move should go
   float work_offset[AXES];   // offset from work coordinate system
   float move_time;           // optimal time for move given axis constraints
-} MoveState_t;
+} move_state_t;
 
 
 /// Gcode model state
@@ -239,33 +239,33 @@ typedef struct {
   uint8_t tool_select;                // T - sets this value
 
   float feed_rate;                    // F - in mm/min or inverse time mode
-  machFeedRateMode_t feed_rate_mode;
-  float feed_rate_override_factor;    // 1.0000 x F feed rate.
+  feed_rate_mode_t feed_rate_mode;
+  float feed_rate_override_factor;    // 1.0000 x F feed rate
   bool feed_rate_override_enable;     // M48, M49
   float traverse_override_factor;     // 1.0000 x traverse rate
   bool traverse_override_enable;
 
   float spindle_speed;                // in RPM
-  machSpindleMode_t spindle_mode;
+  spindle_mode_t spindle_mode;
   float spindle_override_factor;      // 1.0000 x S spindle speed
   bool spindle_override_enable;       // true = override enabled
 
-  machMotionMode_t motion_mode;       // Group 1 modal motion
-  machPlane_t select_plane;           // G17, G18, G19
-  machUnitsMode_t units_mode;         // G20, G21
-  machCoordSystem_t coord_system;     // G54-G59 - select coordinate system 1-9
+  motion_mode_t motion_mode;          // Group 1 modal motion
+  plane_t select_plane;               // G17, G18, G19
+  units_mode_t units_mode;            // G20, G21
+  coord_system_t coord_system;        // G54-G59 - select coordinate system 1-9
   bool absolute_override;             // G53 true = move in machine coordinates
-  machPathControlMode_t path_control;   // G61
-  machDistanceMode_t distance_mode;     // G91
-  machDistanceMode_t arc_distance_mode; // G91.1
+  path_mode_t path_control;           // G61
+  distance_mode_t distance_mode;      // G91
+  distance_mode_t arc_distance_mode;  // G91.1
 
   bool mist_coolant;                  // true = mist on (M7), false = off (M9)
   bool flood_coolant;                 // true = flood on (M8), false = off (M9)
 
-  machNextAction_t next_action;       // handles G group 1 moves & non-modals
-  machProgramFlow_t program_flow;     // used only by the gcode_parser
+  next_action_t next_action;          // handles G group 1 moves & non-modals
+  program_flow_t program_flow;        // used only by the gcode_parser
 
-  // unimplemented gcode parameters
+  // TODO unimplemented gcode parameters
   // float cutter_radius;           // D - cutter radius compensation (0 is off)
   // float cutter_length;           // H - cutter length compensation (0 is off)
 
@@ -275,14 +275,13 @@ typedef struct {
   bool tool_change;                   // M6 tool change flag
 
   float parameter;                    // P - dwell time in sec, G10 coord select
-
   float arc_radius;                   // R - radius value in arc radius mode
   float arc_offset[3];                // IJK - used by arc commands
-} GCodeState_t;
+} gcode_state_t;
 
 
 typedef struct {
-  machAxisMode_t axis_mode;
+  axis_mode_t axis_mode;
   float feedrate_max;    // max velocity in mm/min or deg/min
   float velocity_max;    // max velocity in mm/min or deg/min
   float travel_max;      // max work envelope for soft limits
@@ -296,7 +295,7 @@ typedef struct {
   float latch_velocity;  // homing latch velocity
   float latch_backoff;   // backoff from switches prior to homing latch movement
   float zero_backoff;    // backoff from switches for machine zero
-} AxisConfig_t;
+} axis_config_t;
 
 
 typedef struct { // struct to manage mach globals and cycles
@@ -309,11 +308,11 @@ typedef struct { // struct to manage mach globals and cycles
   float g28_position[AXES];            // stored machine position for G28
   float g30_position[AXES];            // stored machine position for G30
 
-  AxisConfig_t a[AXES];                // settings for axes
-  MoveState_t ms;
-  GCodeState_t gm;                     // core gcode model state
-  GCodeState_t gn;                     // gcode input values
-  GCodeState_t gf;                     // gcode input flags
+  axis_config_t a[AXES];               // settings for axes
+  move_state_t ms;
+  gcode_state_t gm;                    // core gcode model state
+  gcode_state_t gn;                    // gcode input values
+  gcode_state_t gf;                    // gcode input flags
 } machine_t;
 
 
@@ -322,22 +321,22 @@ extern machine_t mach;                 // machine controller singleton
 
 // Model state getters and setters
 uint32_t mach_get_line();
-machMotionMode_t mach_get_motion_mode();
-machCoordSystem_t mach_get_coord_system();
-machUnitsMode_t mach_get_units_mode();
-machPlane_t mach_get_select_plane();
-machPathControlMode_t mach_get_path_control();
-machDistanceMode_t mach_get_distance_mode();
-machFeedRateMode_t mach_get_feed_rate_mode();
+motion_mode_t mach_get_motion_mode();
+coord_system_t mach_get_coord_system();
+units_mode_t mach_get_units_mode();
+plane_t mach_get_select_plane();
+path_mode_t mach_get_path_control();
+distance_mode_t mach_get_distance_mode();
+feed_rate_mode_t mach_get_feed_rate_mode();
 uint8_t mach_get_tool();
-machSpindleMode_t mach_get_spindle_mode();
+spindle_mode_t mach_get_spindle_mode();
 inline float mach_get_spindle_speed() {return mach.gm.spindle_speed;}
 float mach_get_feed_rate();
 
-PGM_P mp_get_units_mode_pgmstr(machUnitsMode_t mode);
+PGM_P mp_get_units_mode_pgmstr(units_mode_t mode);
 
-void mach_set_motion_mode(machMotionMode_t motion_mode);
-void mach_set_spindle_mode(machSpindleMode_t spindle_mode);
+void mach_set_motion_mode(motion_mode_t motion_mode);
+void mach_set_spindle_mode(spindle_mode_t spindle_mode);
 void mach_set_spindle_speed_parameter(float speed);
 void mach_set_tool_number(uint8_t tool);
 void mach_set_absolute_override(bool absolute_override);
@@ -372,16 +371,16 @@ stat_t mach_alarm(const char *location, stat_t status);
   do {if (!(COND)) CM_ALARM(STAT_INTERNAL_ERROR);} while (0)
 
 // Representation (4.3.3)
-void mach_set_plane(machPlane_t plane);
-void mach_set_units_mode(machUnitsMode_t mode);
-void mach_set_distance_mode(machDistanceMode_t mode);
-void mach_set_coord_offsets(machCoordSystem_t coord_system, float offset[],
-                          float flag[]);
+void mach_set_plane(plane_t plane);
+void mach_set_units_mode(units_mode_t mode);
+void mach_set_distance_mode(distance_mode_t mode);
+void mach_set_coord_offsets(coord_system_t coord_system, float offset[],
+                            float flag[]);
 
 void mach_set_position(int axis, float position);
 void mach_set_absolute_origin(float origin[], float flag[]);
 
-void mach_set_coord_system(machCoordSystem_t coord_system);
+void mach_set_coord_system(coord_system_t coord_system);
 void mach_set_origin_offsets(float offset[], float flag[]);
 void mach_reset_origin_offsets();
 void mach_suspend_origin_offsets();
@@ -396,8 +395,8 @@ stat_t mach_goto_g30_position(float target[], float flags[]);
 
 // Machining Attributes (4.3.5)
 void mach_set_feed_rate(float feed_rate);
-void mach_set_feed_rate_mode(machFeedRateMode_t mode);
-void mach_set_path_control(machPathControlMode_t mode);
+void mach_set_feed_rate_mode(feed_rate_mode_t mode);
+void mach_set_path_control(path_mode_t mode);
 
 // Machining Functions (4.3.6)
 stat_t mach_straight_feed(float target[], float flags[]);
index 47c53e1c88a19cb1463735d511a87073cbeb0b2d..e6335d9016d77cc19976c3079b4ec94ac1623c12 100644 (file)
 
 
 typedef enum {
-  MOTOR_IDLE,                   // motor stopped and may be partially energized
+  MOTOR_IDLE,                    // motor stopped and may be partially energized
   MOTOR_ENERGIZING,
   MOTOR_ACTIVE
-} motorPowerState_t;
+} motor_power_state_t;
 
 
 typedef struct {
   // Config
   uint8_t motor_map;             // map motor to axis
   uint16_t microsteps;           // microsteps per full step
-  machMotorPolarity_t polarity;
-  machMotorPowerMode_t power_mode;
+  motor_polarity_t polarity;
+  motor_power_mode_t power_mode;
   float step_angle;              // degrees per whole step
   float travel_rev;              // mm or deg of travel per motor revolution
   uint8_t step_pin;
@@ -71,9 +71,9 @@ typedef struct {
   uint8_t dma_trigger;
 
   // Runtime state
-  motorPowerState_t power_state; // state machine for managing motor power
+  motor_power_state_t power_state; // state machine for managing motor power
   uint32_t timeout;
-  machMotorFlags_t flags;
+  motor_flags_t flags;
   int32_t encoder;
   uint16_t steps;
   uint8_t last_clock;
@@ -82,7 +82,7 @@ typedef struct {
   uint8_t timer_clock;           // clock divisor setting or zero for off
   uint16_t timer_period;         // clock period counter
   bool positive;                 // step sign
-  machDirection_t direction;       // travel direction corrected for polarity
+  direction_t direction;         // travel direction corrected for polarity
 
   // Step error correction
   int32_t correction_holdoff;    // count down segments between corrections
@@ -311,7 +311,7 @@ stat_t motor_rtc_callback() { // called by controller
 void print_status_flags(uint8_t flags);
 
 
-void motor_error_callback(int motor, machMotorFlags_t errors) {
+void motor_error_callback(int motor, motor_flags_t errors) {
   if (motors[motor].power_state != MOTOR_ACTIVE) return;
 
   motors[motor].flags |= errors;
index ba678e7eb978b48e7cf7f39162e2d86cf65e87fd..123289e63d9df51e7d784dccf6fd354256274116 100644 (file)
@@ -44,7 +44,7 @@ typedef enum {
                                  MOTOR_FLAG_OVERTEMP_WARN_bm |
                                  MOTOR_FLAG_OVERTEMP_bm |
                                  MOTOR_FLAG_SHORTED_bm)
-} machMotorFlags_t;
+} motor_flags_t;
 
 
 typedef enum {
@@ -54,13 +54,13 @@ typedef enum {
                                   // de-powered out of cycle
   MOTOR_POWERED_ONLY_WHEN_MOVING, // idles shortly after stopped, even in cycle
   MOTOR_POWER_MODE_MAX_VALUE      // for input range checking
-} machMotorPowerMode_t;
+} motor_power_mode_t;
 
 
 typedef enum {
   MOTOR_POLARITY_NORMAL,
   MOTOR_POLARITY_REVERSED
-} machMotorPolarity_t;
+} motor_polarity_t;
 
 
 void motor_init();
@@ -78,7 +78,7 @@ bool motor_energizing();
 
 void motor_driver_callback(int motor);
 stat_t motor_rtc_callback();
-void motor_error_callback(int motor, machMotorFlags_t errors);
+void motor_error_callback(int motor, motor_flags_t errors);
 
 void motor_load_move(int motor);
 void motor_end_move(int motor);
index f24b7b8e8965bae17f5f98bf651dd0fd62c19829..42b3008380f4c212e02f0b186ea43299b095af7c 100644 (file)
@@ -46,8 +46,8 @@
 
 // See planner.h for MM_PER_ARC_SEGMENT and other arc setting #defines
 
-typedef struct arArcSingleton {     // persistent planner and runtime variables
-  uint8_t run_state;                // runtime state machine sequence
+typedef struct {
+  run_state_t run_state;            // runtime state machine sequence
 
   float position[AXES];             // accumulating runtime position
   float offset[3];                  // IJK offsets
@@ -74,7 +74,7 @@ typedef struct arArcSingleton {     // persistent planner and runtime variables
   float center_0;           // center of circle at plane axis 0 (e.g. X for G17)
   float center_1;           // center of circle at plane axis 1 (e.g. Y for G17)
 
-  MoveState_t ms;
+  move_state_t ms;
 } arc_t;
 
 arc_t arc = {0};
@@ -437,15 +437,15 @@ stat_t mach_arc_feed(float target[], float flags[], // arc endpoints
 
   // now get down to the rest of the work setting up the arc for execution
   mach.gm.motion_mode = motion_mode;
-  mach_set_work_offsets();                        // Update resolved offsets
-  mach.ms.line = mach.gm.line;                    // copy line number
-  memcpy(&arc.ms, &mach.ms, sizeof(MoveState_t)); // context to arc singleton
+  mach_set_work_offsets();                         // Update resolved offsets
+  mach.ms.line = mach.gm.line;                     // copy line number
+  memcpy(&arc.ms, &mach.ms, sizeof(move_state_t)); // context to arc singleton
 
-  copy_vector(arc.position, mach.position);       // arc pos from gcode model
+  copy_vector(arc.position, mach.position);        // arc pos from gcode model
 
-  arc.radius = TO_MILLIMETERS(radius);            // set arc radius or zero
+  arc.radius = TO_MILLIMETERS(radius);             // set arc radius or zero
 
-  arc.offset[0] = TO_MILLIMETERS(i);              // offsets canonical form (mm)
+  arc.offset[0] = TO_MILLIMETERS(i);               // offsets in mm
   arc.offset[1] = TO_MILLIMETERS(j);
   arc.offset[2] = TO_MILLIMETERS(k);
 
index 0028e4c6be18659cb9d9fc4d9209d94d51c195b9..8e70599dac7d5f90e617cb6459e3fbc6215689db 100644 (file)
 #include <string.h>
 
 
-typedef struct mpBufferPool {           // ring buffer for sub-moves
-  volatile uint8_t buffers_available;   // running count of available buffers
-  mpBuf_t *w;                           // get_write_buffer pointer
-  mpBuf_t *q;                           // queue_write_buffer pointer
-  mpBuf_t *r;                           // get/end_run_buffer pointer
-  mpBuf_t bf[PLANNER_BUFFER_POOL_SIZE]; // buffer storage
-} mpBufferPool_t;
+typedef struct {                            // ring buffer for sub-moves
+  volatile uint8_t buffers_available;       // count of available buffers
+  mp_buffer_t *w;                           // get_write_buffer pointer
+  mp_buffer_t *q;                           // queue_write_buffer pointer
+  mp_buffer_t *r;                           // get/end_run_buffer pointer
+  mp_buffer_t bf[PLANNER_BUFFER_POOL_SIZE]; // buffer storage
+} buffer_pool_t;
 
 
-mpBufferPool_t mb; // move buffer queue
+buffer_pool_t mb; // move buffer queue
 
 
 uint8_t mp_get_planner_buffer_room() {
@@ -85,7 +85,7 @@ void mp_wait_for_buffer() {
 
 /// Initializes or resets buffers
 void mp_init_buffers() {
-  mpBuf_t *pv;
+  mp_buffer_t *pv;
 
   memset(&mb, 0, sizeof(mb));      // clear all values, pointers and status
 
@@ -110,13 +110,13 @@ bool mp_queue_empty() {return mb.w == mb.r;}
 
 /// Get pointer to next available write buffer
 /// Returns pointer or 0 if no buffer available.
-mpBuf_t *mp_get_write_buffer() {
+mp_buffer_t *mp_get_write_buffer() {
   // get & clear a buffer
   if (mb.w->buffer_state == MP_BUFFER_EMPTY) {
-    mpBuf_t *w = mb.w;
-    mpBuf_t *nx = mb.w->nx;                   // save linked list pointers
-    mpBuf_t *pv = mb.w->pv;
-    memset(mb.w, 0, sizeof(mpBuf_t));         // clear all values
+    mp_buffer_t *w = mb.w;
+    mp_buffer_t *nx = mb.w->nx;               // save linked list pointers
+    mp_buffer_t *pv = mb.w->pv;
+    memset(mb.w, 0, sizeof(mp_buffer_t));     // clear all values
     w->nx = nx;                               // restore pointers
     w->pv = pv;
     w->buffer_state = MP_BUFFER_LOADING;
@@ -139,12 +139,12 @@ mpBuf_t *mp_get_write_buffer() {
  * buffer once it has been queued. Action may start on the buffer immediately,
  * invalidating its contents
  */
-void mp_commit_write_buffer(uint32_t line, moveType_t type) {
+void mp_commit_write_buffer(uint32_t line, move_type_t type) {
   mp_state_running();
 
   mb.q->ms.line = line;
   mb.q->move_type = type;
-  mb.q->move_state = MOVE_NEW;
+  mb.q->run_state = MOVE_NEW;
   mb.q->buffer_state = MP_BUFFER_QUEUED;
   mb.q = mb.q->nx; // advance the queued buffer pointer
 }
@@ -156,7 +156,7 @@ void mp_commit_write_buffer(uint32_t line, moveType_t type) {
  * Returns 0 if no buffer available
  * The behavior supports continuations (iteration)
  */
-mpBuf_t *mp_get_run_buffer() {
+mp_buffer_t *mp_get_run_buffer() {
   switch (mb.r->buffer_state) {
   case MP_BUFFER_QUEUED: // fresh buffer; becomes running if queued or pending
     mb.r->buffer_state = MP_BUFFER_RUNNING;
@@ -182,32 +182,32 @@ void mp_free_run_buffer() {           // EMPTY current run buf & adv to next
 
 
 /// Returns pointer to last buffer, i.e. last block (zero)
-mpBuf_t *mp_get_last_buffer() {
-  mpBuf_t *bf = mp_get_run_buffer();
-  mpBuf_t *bp;
+mp_buffer_t *mp_get_last_buffer() {
+  mp_buffer_t *bf = mp_get_run_buffer();
+  mp_buffer_t *bp;
 
   for (bp = bf; bp && bp->nx != bf; bp = mp_get_next_buffer(bp))
-    if (bp->nx->move_state == MOVE_OFF) break;
+    if (bp->nx->run_state == MOVE_OFF) break;
 
   return bp;
 }
 
 
 /// Zeroes the contents of the buffer
-void mp_clear_buffer(mpBuf_t *bf) {
-  mpBuf_t *nx = bf->nx;            // save pointers
-  mpBuf_t *pv = bf->pv;
-  memset(bf, 0, sizeof(mpBuf_t));
-  bf->nx = nx;                     // restore pointers
+void mp_clear_buffer(mp_buffer_t *bf) {
+  mp_buffer_t *nx = bf->nx;            // save pointers
+  mp_buffer_t *pv = bf->pv;
+  memset(bf, 0, sizeof(mp_buffer_t));
+  bf->nx = nx;                         // restore pointers
   bf->pv = pv;
 }
 
 
 ///  Copies the contents of bp into bf - preserves links
-void mp_copy_buffer(mpBuf_t *bf, const mpBuf_t *bp) {
-  mpBuf_t *nx = bf->nx;            // save pointers
-  mpBuf_t *pv = bf->pv;
-  memcpy(bf, bp, sizeof(mpBuf_t));
-  bf->nx = nx;                     // restore pointers
+void mp_copy_buffer(mp_buffer_t *bf, const mp_buffer_t *bp) {
+  mp_buffer_t *nx = bf->nx;            // save pointers
+  mp_buffer_t *pv = bf->pv;
+  memcpy(bf, bp, sizeof(mp_buffer_t));
+  bf->nx = nx;                         // restore pointers
   bf->pv = pv;
 }
index 0e317eed4d139bdd6f2a6abeb30d96d18da47aa1..cde47846bade92bbf4172bbfd567d9c4be18bf88 100644 (file)
@@ -38,41 +38,41 @@ typedef enum {
   MOVE_TYPE_ALINE,         // acceleration planned line
   MOVE_TYPE_DWELL,         // delay with no movement
   MOVE_TYPE_COMMAND,       // general command
-} moveType_t;
+} move_type_t;
 
 
 typedef enum {
   MOVE_OFF,                // move inactive (MUST BE ZERO)
   MOVE_NEW,                // initial value
   MOVE_RUN,                // general run state (for non-acceleration moves)
-} moveState_t;
+} run_state_t;
 
 
 // All the enums that equal zero must be zero. Don't change this
-typedef enum {                    // bf->buffer_state values
+typedef enum {
   MP_BUFFER_EMPTY,                // struct is available for use (MUST BE 0)
   MP_BUFFER_LOADING,              // being written ("checked out")
   MP_BUFFER_QUEUED,               // in queue
-  MP_BUFFER_RUNNING               // current running buffer
-} bufferState_t;
+  MP_BUFFER_RUNNING,              // current running buffer
+} buffer_state_t;
 
 
 // Callbacks
 typedef void (*mach_exec_t)(float[], float[]);
-struct mpBuffer;
-typedef stat_t (*bf_func_t)(struct mpBuffer *bf);
+struct mp_buffer_t;
+typedef stat_t (*bf_func_t)(struct mp_buffer_t *bf);
 
 
-typedef struct mpBuffer {         // See Planning Velocity Notes
-  struct mpBuffer *pv;            // pointer to previous buffer
-  struct mpBuffer *nx;            // pointer to next buffer
+typedef struct mp_buffer_t {      // See Planning Velocity Notes
+  struct mp_buffer_t *pv;         // pointer to previous buffer
+  struct mp_buffer_t *nx;         // pointer to next buffer
 
   bf_func_t bf_func;              // callback to buffer exec function
   mach_exec_t mach_func;          // callback to machine
 
-  bufferState_t buffer_state;     // used to manage queuing/dequeuing
-  moveType_t move_type;           // used to dispatch to run routine
-  moveState_t move_state;         // move state machine sequence
+  buffer_state_t buffer_state;    // used to manage queuing/dequeuing
+  move_type_t move_type;          // used to dispatch to run routine
+  run_state_t run_state;          // run state machine sequence
   bool replannable;               // true if move can be re-planned
 
   float unit[AXES];               // unit vector for axis scaling & planning
@@ -97,22 +97,22 @@ typedef struct mpBuffer {         // See Planning Velocity Notes
   float recip_jerk;               // 1/Jm used for planning (computed & cached)
   float cbrt_jerk;                // cube root of Jm (computed & cached)
 
-  MoveState_t ms;
-} mpBuf_t;
+  move_state_t ms;
+} mp_buffer_t;
 
 
 uint8_t mp_get_planner_buffer_room();
 void mp_wait_for_buffer();
 void mp_init_buffers();
 bool mp_queue_empty();
-mpBuf_t *mp_get_write_buffer();
-void mp_commit_write_buffer(uint32_t line, moveType_t type);
-mpBuf_t *mp_get_run_buffer();
+mp_buffer_t *mp_get_write_buffer();
+void mp_commit_write_buffer(uint32_t line, move_type_t type);
+mp_buffer_t *mp_get_run_buffer();
 void mp_free_run_buffer();
-mpBuf_t *mp_get_last_buffer();
+mp_buffer_t *mp_get_last_buffer();
 /// Returns pointer to prev buffer in linked list
 #define mp_get_prev_buffer(b) (b->pv)
 /// Returns pointer to next buffer in linked list
 #define mp_get_next_buffer(b) (b->nx)
-void mp_clear_buffer(mpBuf_t *bf);
-void mp_copy_buffer(mpBuf_t *bf, const mpBuf_t *bp);
+void mp_clear_buffer(mp_buffer_t *bf);
+void mp_copy_buffer(mp_buffer_t *bf, const mp_buffer_t *bp);
index 9346b9d7fd6b1f2a583120d1a0fe3d03e1bd40a1..0709f480788a89d09c11c9d731f4ff9786d1c34a 100644 (file)
@@ -76,11 +76,11 @@ typedef struct {
 static calibrate_t cal = {0};
 
 
-static stat_t _exec_calibrate(mpBuf_t *bf) {
-  if (bf->move_state == MOVE_NEW) bf->move_state = MOVE_RUN;
+static stat_t _exec_calibrate(mp_buffer_t *bf) {
+  if (bf->run_state == MOVE_NEW) bf->run_state = MOVE_RUN;
 
   const float time = MIN_SEGMENT_TIME; // In minutes
-  const float maxDeltaV = JOG_ACCELERATION * time;
+  const float max_delta_v = JOG_ACCELERATION * time;
 
   if (rtc_expired(cal.wait))
     switch (cal.state) {
@@ -102,7 +102,7 @@ static stat_t _exec_calibrate(mpBuf_t *bf) {
       if (CAL_MIN_VELOCITY < cal.velocity) cal.stall_valid = true;
 
       if (cal.velocity < CAL_MIN_VELOCITY || CAL_TARGET_SG < cal.stallguard)
-        cal.velocity += maxDeltaV;
+        cal.velocity += max_delta_v;
 
       if (cal.stalled) {
         if (cal.reverse) {
@@ -167,7 +167,7 @@ uint8_t command_calibrate(int argc, char *argv[]) {
   if (mp_get_cycle() != CYCLE_MACHINING || mp_get_state() != STATE_READY)
     return 0;
 
-  mpBuf_t *bf = mp_get_write_buffer();
+  mp_buffer_t *bf = mp_get_write_buffer();
   if (!bf) {
     CM_ALARM(STAT_BUFFER_FULL_FATAL);
     return 0;
index b043887aa713fdfa34c2435c6d09bc693a4896f1..8778f7f5627e0919bfa9f9d3e17030acc6fc6b0f 100644 (file)
@@ -53,7 +53,7 @@
 
 
 /// Callback to execute command
-static stat_t _exec_command(mpBuf_t *bf) {
+static stat_t _exec_command(mp_buffer_t *bf) {
   st_prep_command(bf);
   return STAT_OK;
 }
@@ -61,7 +61,7 @@ static stat_t _exec_command(mpBuf_t *bf) {
 
 /// Queue a synchronous Mcode, program control, or other command
 void mp_queue_command(mach_exec_t mach_exec, float *value, float *flag) {
-  mpBuf_t *bf = mp_get_write_buffer();
+  mp_buffer_t *bf = mp_get_write_buffer();
 
   if (!bf) {
     CM_ALARM(STAT_BUFFER_FULL_FATAL);
@@ -82,7 +82,7 @@ void mp_queue_command(mach_exec_t mach_exec, float *value, float *flag) {
 }
 
 
-void mp_command_callback(mpBuf_t *bf) {
+void mp_command_callback(mp_buffer_t *bf) {
   // Use values & flags stored in mp_queue_command()
   bf->mach_func(bf->ms.target, bf->unit);
 
index a337a300f38824a8e5d6eb0e72b14b77da5f286d..8395f58a75efd8cda404f1e5854230798efda7ac 100644 (file)
@@ -30,4 +30,4 @@
 #include "plan/buffer.h"
 
 void mp_queue_command(mach_exec_t mach_exec, float *value, float *flag);
-void mp_command_callback(mpBuf_t *bf);
+void mp_command_callback(mp_buffer_t *bf);
index 385f002d6a87f63cb94fe945409eb79da95af8bb..8eda647b71f1ff193c9d19af4066fbc2fa2edaae 100644 (file)
@@ -38,7 +38,7 @@
 
 
 /// Dwell execution
-static stat_t _exec_dwell(mpBuf_t *bf) {
+static stat_t _exec_dwell(mp_buffer_t *bf) {
   st_prep_dwell(bf->ms.move_time); // in seconds
 
   // free buffer & perform cycle_end if planner is empty
@@ -50,14 +50,14 @@ static stat_t _exec_dwell(mpBuf_t *bf) {
 
 /// Queue a dwell
 stat_t mp_dwell(float seconds, int32_t line) {
-  mpBuf_t *bf = mp_get_write_buffer();
+  mp_buffer_t *bf = mp_get_write_buffer();
 
   // never supposed to fail
   if (!bf) return CM_ALARM(STAT_BUFFER_FULL_FATAL);
 
   bf->bf_func = _exec_dwell;  // register callback to dwell start
   bf->ms.move_time = seconds; // in seconds, not minutes
-  bf->move_state = MOVE_NEW;
+  bf->run_state = MOVE_NEW;
 
   // must be final operation before exit
   mp_commit_write_buffer(line, MOVE_TYPE_DWELL);
index 180c9052991c7ea69db9f4a657609ff36239d0fc..648e712716ad47a558a5e11fd5793c8f4b7d775e 100644 (file)
@@ -59,7 +59,7 @@ typedef struct {
   float segment_time;           // actual time increment per aline segment
   float forward_diff[5];        // forward difference levels
   bool hold_planned;            // true when a feedhold has been planned
-  moveSection_t section;        // what section is the move in?
+  move_section_t section;       // what section is the move in?
   bool section_new;             // true if it's a new section
 } mp_exec_t;
 
@@ -246,7 +246,7 @@ static stat_t _exec_aline_section(float length, float vin, float vout) {
 
     // len / avg. velocity
     float move_time = 2 * length / (vin + vout);
-    ex.segments = ceil(uSec(move_time) / NOM_SEGMENT_USEC);
+    ex.segments = ceil(usec(move_time) / NOM_SEGMENT_USEC);
     ex.segment_time = move_time / ex.segments;
     ex.segment_count = (uint32_t)ex.segments;
 
@@ -348,7 +348,7 @@ static float _compute_next_segment_velocity() {
  * speed.
  */
 static void _plan_hold() {
-  mpBuf_t *bp = mp_get_run_buffer(); // working buffer pointer
+  mp_buffer_t *bp = mp_get_run_buffer(); // working buffer pointer
   if (!bp) return; // Oops! nothing's running
 
   // Examine and process current buffer and compute length left for decel
@@ -384,7 +384,7 @@ static void _plan_hold() {
     bp->length = available_length - braking_length;
     bp->delta_vmax = mp_get_target_velocity(0, bp->length, bp);
     bp->entry_vmax = 0;        // set bp+0 as hold point
-    bp->move_state = MOVE_NEW; // tell _exec to re-use the bf buffer
+    bp->run_state = MOVE_NEW;  // tell _exec to re-use the bf buffer
 
   } else { // Case 2: deceleration exceeds length remaining in buffer
     // Replan to minimum (but non-zero) exit velocity
@@ -396,7 +396,7 @@ static void _plan_hold() {
 
 
 /// Initializes move runtime with a new planner buffer
-static stat_t _exec_aline_init(mpBuf_t *bf) {
+static stat_t _exec_aline_init(mp_buffer_t *bf) {
   // Remove zero length lines.  Short lines have already been removed.
   if (fp_ZERO(bf->length)) {
     mp_runtime_set_busy(false);
@@ -407,7 +407,7 @@ static stat_t _exec_aline_init(mpBuf_t *bf) {
   }
 
   // Take control of buffer
-  bf->move_state = MOVE_RUN;
+  bf->run_state = MOVE_RUN;
   bf->replannable = false;
 
   // Initialize move
@@ -504,13 +504,13 @@ static stat_t _exec_aline_init(mpBuf_t *bf) {
  *
  * State transitions - hierarchical state machine:
  *
- * bf->move_state transitions:
+ * bf->run_state transitions:
  *
  *  from _NEW to _RUN on first call (sub_state set to _OFF)
  *  from _RUN to _OFF on final call or just remain _OFF
  */
-stat_t mp_exec_aline(mpBuf_t *bf) {
-  if (bf->move_state == MOVE_OFF) return STAT_NOOP; // No more moves
+stat_t mp_exec_aline(mp_buffer_t *bf) {
+  if (bf->run_state == MOVE_OFF) return STAT_NOOP; // No more moves
 
   stat_t status = STAT_OK;
 
@@ -530,7 +530,7 @@ stat_t mp_exec_aline(mpBuf_t *bf) {
 
   // There are 3 things that can happen here depending on return conditions:
   //
-  //   status        bf->move_state      Description
+  //   status        bf->run_state       Description
   //   -----------   --------------      ----------------------------------
   //   STAT_EAGAIN   <don't care>        buffer has more segments to run
   //   STAT_OK       MOVE_RUN            ex and bf buffers are done
@@ -540,9 +540,9 @@ stat_t mp_exec_aline(mpBuf_t *bf) {
     mp_runtime_set_busy(false);
     bf->nx->replannable = false;    // prevent overplanning (Note 2)
     if (fp_ZERO(ex.exit_velocity)) ex.segment_velocity = 0;
-    // Note, _plan_hold() may change bf->move_state to reuse this buffer so it
+    // Note, _plan_hold() may change bf->run_state to reuse this buffer so it
     // can plan the deceleration.
-    if (bf->move_state == MOVE_RUN) mp_free_run_buffer();
+    if (bf->run_state == MOVE_RUN) mp_free_run_buffer();
   }
 
   if (mp_get_state() == STATE_STOPPING &&
@@ -560,7 +560,7 @@ stat_t mp_exec_move() {
   if (mp_get_state() == STATE_ESTOPPED) return STAT_MACHINE_ALARMED;
   if (mp_get_state() == STATE_HOLDING) return STAT_NOOP;
 
-  mpBuf_t *bf = mp_get_run_buffer();
+  mp_buffer_t *bf = mp_get_run_buffer();
   if (!bf) return STAT_NOOP; // nothing running
   if (!bf->bf_func) return CM_ALARM(STAT_INTERNAL_ERROR);
 
index cc9d174fb14a5b6b0b88836aee37b56c01eb4cb2..00972b260c07dee364ecf9bb41f0a960ea34bbba 100644 (file)
@@ -31,4 +31,4 @@
 
 
 stat_t mp_exec_move();
-stat_t mp_exec_aline(mpBuf_t *bf);
+stat_t mp_exec_aline(mp_buffer_t *bf);
index 57fbfc634cde007a35eb31a2933cc3d42161190e..bd29da20f2ef4618bc14af7a238755689280691a 100644 (file)
@@ -46,15 +46,15 @@ typedef struct {
   float next_velocity[AXES];
   float target_velocity[AXES];
   float current_velocity[AXES];
-} jogRuntime_t;
+} jog_runtime_t;
 
 
-static jogRuntime_t jr;
+static jog_runtime_t jr;
 
 
-static stat_t _exec_jog(mpBuf_t *bf) {
-  if (bf->move_state == MOVE_OFF) return STAT_NOOP;
-  if (bf->move_state == MOVE_NEW) bf->move_state = MOVE_RUN;
+static stat_t _exec_jog(mp_buffer_t *bf) {
+  if (bf->run_state == MOVE_OFF) return STAT_NOOP;
+  if (bf->run_state == MOVE_NEW) bf->run_state = MOVE_RUN;
 
   // Load next velocity
   if (!jr.writing)
@@ -64,18 +64,19 @@ static stat_t _exec_jog(mpBuf_t *bf) {
   // Compute next line segment
   float target[AXES];
   const float time = MIN_SEGMENT_TIME; // In minutes
-  const float maxDeltaV = JOG_ACCELERATION * time;
-  float velocitySqr = 0;
+  const float max_delta_v = JOG_ACCELERATION * time;
+  float velocity_sqr = 0;
   bool done = true;
 
   // Compute new axis velocities and target
   for (int axis = 0; axis < AXES; axis++) {
-    float targetV = jr.target_velocity[axis] * mach.a[axis].velocity_max;
-    float deltaV = targetV - jr.current_velocity[axis];
-    float sign = deltaV < 0 ? -1 : 1;
+    float target_v = jr.target_velocity[axis] * mach.a[axis].velocity_max;
+    float delta_v = target_v - jr.current_velocity[axis];
+    float sign = delta_v < 0 ? -1 : 1;
 
-    if (maxDeltaV < fabs(deltaV)) jr.current_velocity[axis] += maxDeltaV * sign;
-    else jr.current_velocity[axis] = targetV;
+    if (max_delta_v < fabs(delta_v))
+      jr.current_velocity[axis] += max_delta_v * sign;
+    else jr.current_velocity[axis] = target_v;
 
     if (!fp_ZERO(jr.current_velocity[axis])) done = false;
 
@@ -84,7 +85,7 @@ static stat_t _exec_jog(mpBuf_t *bf) {
       mp_runtime_get_position(axis) + time * jr.current_velocity[axis];
 
     // Accumulate velocities squared
-    velocitySqr += square(jr.current_velocity[axis]);
+    velocity_sqr += square(jr.current_velocity[axis]);
   }
 
   // Check if we are done
@@ -101,7 +102,7 @@ static stat_t _exec_jog(mpBuf_t *bf) {
     return STAT_NOOP;
   }
 
-  return mp_runtime_move_to_target(target, sqrt(velocitySqr), time);
+  return mp_runtime_move_to_target(target, sqrt(velocity_sqr), time);
 }
 
 
@@ -129,7 +130,7 @@ uint8_t command_jog(int argc, char *argv[]) {
 
   if (!mp_jog_busy()) {
     // Should always be at least one free buffer
-    mpBuf_t *bf = mp_get_write_buffer();
+    mp_buffer_t *bf = mp_get_write_buffer();
     if (!bf) return STAT_BUFFER_FULL_FATAL;
 
     // Start
index eccfb46bcf15fc7c2203a7d6846b946bba4442ab..dc4b5b3d1bac306a94d919a8678c8aaab794491b 100644 (file)
@@ -49,10 +49,10 @@ typedef struct {
   float jerk;                       // jerk values cached from previous block
   float recip_jerk;
   float cbrt_jerk;
-} mpMoveMaster_t;
+} move_master_t;
 
 
-mpMoveMaster_t mm = {{0}}; // context for line planning
+move_master_t mm = {{0}}; // context for line planning
 
 
 /// Set planner position for a single axis
@@ -178,7 +178,7 @@ static float _get_junction_vmax(const float a_unit[], const float b_unit[]) {
  * accumulate and get executed once the accumulated error exceeds
  * the minimums.
  */
-stat_t mp_aline(MoveState_t *ms) {
+stat_t mp_aline(move_state_t *ms) {
   // Compute some reusable terms
   float axis_length[AXES];
   float axis_square[AXES];
@@ -220,7 +220,7 @@ stat_t mp_aline(MoveState_t *ms) {
     float delta_velocity = pow(length, 0.66666666) * mm.cbrt_jerk;
     float entry_velocity = 0; // pre-set as if no previous block
 
-    mpBuf_t *bf = mp_get_run_buffer();
+    mp_buffer_t *bf = mp_get_run_buffer();
     if (bf) {
       if (bf->replannable) // not optimally planned
         entry_velocity = bf->entry_velocity + bf->delta_vmax;
@@ -234,7 +234,7 @@ stat_t mp_aline(MoveState_t *ms) {
 
   // Get a *cleared* buffer and setup move variables
   // Note, mp_free_run_buffer() initializes all buffer variables to zero
-  mpBuf_t *bf = mp_get_write_buffer(); // current move pointer
+  mp_buffer_t *bf = mp_get_write_buffer(); // current move pointer
   if (!bf) return CM_ALARM(STAT_BUFFER_FULL_FATAL); // never fails
 
   // Register callback to exec function
@@ -242,7 +242,7 @@ stat_t mp_aline(MoveState_t *ms) {
   bf->length = length;
 
   // Copy model state into planner buffer
-  memcpy(&bf->ms, ms, sizeof(MoveState_t));
+  memcpy(&bf->ms, ms, sizeof(move_state_t));
 
   // Compute the unit vector and find the right jerk to use (combined
   // operations) To determine the jerk value to use for the block we
index d6b008b8e82db276bb82b0223bcbec15c91917d5..b49d44668dfa5ab562f7f41ca61c40cd5f405c6a 100644 (file)
@@ -30,4 +30,4 @@
 #include "machine.h"
 
 void mp_set_planner_position(int axis, const float position);
-stat_t mp_aline(MoveState_t *ms);
+stat_t mp_aline(move_state_t *ms);
index 2fd1cb6e2972bf2e478ebaf291319aef9bf44b04..b6090afa1d12464f3028f0f5334bc6ed9389c6c6 100644 (file)
@@ -222,7 +222,7 @@ void mp_kinematics(const float travel[], float steps[]) {
  * of the tests, but it reduces execution time when you need it most - when
  * tons of pathologically short Gcode blocks are being thrown at you.
  */
-void mp_calculate_trapezoid(mpBuf_t *bf) {
+void mp_calculate_trapezoid(mp_buffer_t *bf) {
   // RULE #1 of mp_calculate_trapezoid(): Don't change bf->length
   //
   // F case: Block is too short - run time < minimum segment time
@@ -446,7 +446,7 @@ void mp_calculate_trapezoid(mpBuf_t *bf) {
  * (effective) first block and the bf.  It sets entry, exit and
  * cruise v's from vmax's then calls trapezoid generation.
  *
- * Variables that must be provided in the mpBuffers that will be processed:
+ * Variables that must be provided in the mp_buffer_ts that will be processed:
  *
  *   bf (function arg)     - end of block list (last block in time)
  *   bf->replannable       - start of block list set by last FALSE value
@@ -476,7 +476,7 @@ void mp_calculate_trapezoid(mpBuf_t *bf) {
  *
  * Variables that are ignored but here's what you would expect them to be:
  *
- *   bf->move_state        - NEW for all blocks but the earliest
+ *   bf->run_state         - NEW for all blocks but the earliest
  *   bf->ms.target[]       - block target position
  *   bf->unit[]            - block unit vector
  *   bf->time              - gets set later
@@ -498,8 +498,8 @@ void mp_calculate_trapezoid(mpBuf_t *bf) {
  *     replannable so the list can be recomputed regardless of
  *     exact stops and previous replanning optimizations.
  */
-void mp_plan_block_list(mpBuf_t *bf) {
-  mpBuf_t *bp = bf;
+void mp_plan_block_list(mp_buffer_t *bf) {
+  mp_buffer_t *bp = bf;
 
   // Backward planning pass.  Find first block and update braking velocities.
   // By the end bp points to the buffer before the first block.
@@ -539,12 +539,12 @@ void mp_plan_block_list(mpBuf_t *bf) {
 
 
 void mp_replan_blocks() {
-  mpBuf_t *bf = mp_get_run_buffer();
-  mpBuf_t *bp = bf;
+  mp_buffer_t *bf = mp_get_run_buffer();
+  mp_buffer_t *bp = bf;
 
   // Mark all blocks replanable
   while (true) {
-    if (bp->move_state != MOVE_OFF || fp_ZERO(bp->exit_velocity)) break;
+    if (bp->run_state != MOVE_OFF || fp_ZERO(bp->exit_velocity)) break;
     bp->replannable = true;
 
     bp = mp_get_next_buffer(bp);
@@ -600,7 +600,8 @@ void mp_replan_blocks() {
  * [2] Cannot assume Vf >= Vi due to rounding errors and use of
  *     PLANNER_VELOCITY_TOLERANCE necessitating the introduction of fabs()
  */
-float mp_get_target_length(const float Vi, const float Vf, const mpBuf_t *bf) {
+float mp_get_target_length(const float Vi, const float Vf,
+                           const mp_buffer_t *bf) {
   return fabs(Vi - Vf) * sqrt(fabs(Vi - Vf) * bf->recip_jerk);
 }
 
@@ -671,7 +672,8 @@ float mp_get_target_length(const float Vi, const float Vf, const mpBuf_t *bf) {
  *
  *   J'(x) = (2 * Vi * x - Vi^2 + 3 * x^2) / L^2
  */
-float mp_get_target_velocity(const float Vi, const float L, const mpBuf_t *bf) {
+float mp_get_target_velocity(const float Vi, const float L,
+                             const mp_buffer_t *bf) {
   // 0 iterations (a reasonable estimate)
   float x = pow(L, 0.66666666) * bf->cbrt_jerk + Vi; // First estimate
 
index e64308b4acd10b6e73274262f7258f197a7a7a1e..e5b620e547444ef7c20e3e1dcc90e7e9d1035734 100644 (file)
@@ -30,7 +30,7 @@
 #pragma once
 
 
-#include "machine.h" // used for GCodeState_t
+#include "machine.h" // used for gcode_state_t
 #include "buffer.h"
 #include "util.h"
 
@@ -70,13 +70,15 @@ typedef enum {
   SECTION_HEAD,           // acceleration
   SECTION_BODY,           // cruise
   SECTION_TAIL,           // deceleration
-} moveSection_t;
+} move_section_t;
 
 
 void planner_init();
 void mp_flush_planner();
 void mp_kinematics(const float travel[], float steps[]);
-void mp_plan_block_list(mpBuf_t *bf);
+void mp_plan_block_list(mp_buffer_t *bf);
 void mp_replan_blocks();
-float mp_get_target_length(const float Vi, const float Vf, const mpBuf_t *bf);
-float mp_get_target_velocity(const float Vi, const float L, const mpBuf_t *bf);
+float mp_get_target_length(const float Vi, const float Vf,
+                           const mp_buffer_t *bf);
+float mp_get_target_velocity(const float Vi, const float L,
+                             const mp_buffer_t *bf);
index bd160bb01ed359e98379ce1959a217568233db4a..f700b793b06ab80f4044eac0814e0184fb62c787 100644 (file)
@@ -41,8 +41,8 @@
 
 
 typedef struct {
-  plannerState_t state;
-  plannerCycle_t cycle;
+  mp_state_t state;
+  mp_cycle_t cycle;
 
   bool hold_requested;
   bool flush_requested;
@@ -54,11 +54,11 @@ typedef struct {
 static planner_state_t ps = {0};
 
 
-plannerState_t mp_get_state() {return ps.state;}
-plannerCycle_t mp_get_cycle() {return ps.cycle;}
+mp_state_t mp_get_state() {return ps.state;}
+mp_cycle_t mp_get_cycle() {return ps.cycle;}
 
 
-PGM_P mp_get_state_pgmstr(plannerState_t state) {
+PGM_P mp_get_state_pgmstr(mp_state_t state) {
   switch (state) {
   case STATE_READY:     return PSTR("READY");
   case STATE_ESTOPPED:  return PSTR("ESTOPPED");
@@ -71,7 +71,7 @@ PGM_P mp_get_state_pgmstr(plannerState_t state) {
 }
 
 
-PGM_P mp_get_cycle_pgmstr(plannerCycle_t cycle) {
+PGM_P mp_get_cycle_pgmstr(mp_cycle_t cycle) {
   switch (cycle) {
   case CYCLE_MACHINING:   return PSTR("MACHINING");
   case CYCLE_HOMING:      return PSTR("HOMING");
@@ -84,7 +84,7 @@ PGM_P mp_get_cycle_pgmstr(plannerCycle_t cycle) {
 }
 
 
-static void _set_state(plannerState_t state) {
+static void _set_state(mp_state_t state) {
   if (ps.state == state) return; // No change
   if (ps.state == STATE_ESTOPPED) return; // Can't leave EStop state
   ps.state = state;
@@ -92,7 +92,7 @@ static void _set_state(plannerState_t state) {
 }
 
 
-void mp_set_cycle(plannerCycle_t cycle) {
+void mp_set_cycle(mp_cycle_t cycle) {
   if (ps.cycle == cycle) return; // No change
 
   if (ps.state != STATE_READY) {
index a8ca4a97a0727e2602aa07f41c1a4b7d18491a60..5708f1c5db67f80c3a4bd0f0649ac7bff45fb312 100644 (file)
@@ -40,7 +40,7 @@ typedef enum {
   STATE_RUNNING,
   STATE_STOPPING,
   STATE_HOLDING,
-} plannerState_t;
+} mp_state_t;
 
 
 typedef enum {
@@ -49,16 +49,16 @@ typedef enum {
   CYCLE_PROBING,
   CYCLE_CALIBRATING,
   CYCLE_JOGGING,
-} plannerCycle_t;
+} mp_cycle_t;
 
 
-plannerState_t mp_get_state();
-plannerCycle_t mp_get_cycle();
+mp_state_t mp_get_state();
+mp_cycle_t mp_get_cycle();
 
-void mp_set_cycle(plannerCycle_t cycle);
+void mp_set_cycle(mp_cycle_t cycle);
 
-PGM_P mp_get_state_pgmstr(plannerState_t state);
-PGM_P mp_get_cycle_pgmstr(plannerCycle_t cycle);
+PGM_P mp_get_state_pgmstr(mp_state_t state);
+PGM_P mp_get_cycle_pgmstr(mp_cycle_t cycle);
 
 bool mp_is_flushing();
 bool mp_is_resuming();
index 69eee2b4d7fb10aae55066dab31d3144c790635d..3c1dc5a0c4de0ad136bfd2442bb6f46c68bccd82 100644 (file)
@@ -50,17 +50,17 @@ typedef enum {
   PROBE_FAILED,         // probe reached endpoint without triggering
   PROBE_SUCCEEDED,      // probe was triggered, pb.results has position
   PROBE_WAITING,        // probe is waiting to be started
-} probeState_t;
+} probe_state_t;
 
 
-struct pbProbingSingleton {       // persistent probing runtime variables
-  probeState_t state;
+typedef struct {
+  probe_state_t state;
   float results[AXES];            // probing results
 
   void (*func)();                 // binding for callback function state machine
 
   // state saved from gcode model
-  uint8_t saved_distance_mode;    // G90,G91 global setting
+  uint8_t saved_distance_mode;    // G90, G91 global setting
   uint8_t saved_coord_system;     // G54 - G59 setting
   float saved_jerk[AXES];         // saved and restored for each axis
 
@@ -68,10 +68,10 @@ struct pbProbingSingleton {       // persistent probing runtime variables
   float start_position[AXES];
   float target[AXES];
   float flags[AXES];
-};
+} probing_t;
 
 
-static struct pbProbingSingleton pb = {0};
+static probing_t pb = {0};
 
 
 /* Note: When coding a cycle (like this one) you get to perform one
index 7960d7a0511fa88729da6a3dd56f75c6de0815f0..89fb74a3e82581d66162dbe28e25b998d64d5bda 100644 (file)
@@ -40,10 +40,10 @@ typedef struct {
   bool reverse;
   bool enable_invert;
   bool estop;
-} spindle_t;
+} pwm_spindle_t;
 
 
-static spindle_t spindle = {
+static pwm_spindle_t spindle = {
   .freq          = SPINDLE_PWM_FREQUENCY,
   .min_rpm       = SPINDLE_MIN_RPM,
   .max_rpm       = SPINDLE_MAX_RPM,
@@ -55,7 +55,7 @@ static spindle_t spindle = {
 };
 
 
-static void _spindle_set_pwm(machSpindleMode_t mode, float speed) {
+static void _spindle_set_pwm(spindle_mode_t mode, float speed) {
   if (mode == SPINDLE_OFF || speed < spindle.min_rpm || spindle.estop) {
     TIMER_PWM.CTRLA = 0;
     return;
@@ -122,7 +122,7 @@ void pwm_spindle_init() {
 }
 
 
-void pwm_spindle_set(machSpindleMode_t mode, float speed) {
+void pwm_spindle_set(spindle_mode_t mode, float speed) {
   _spindle_set_dir(mode == SPINDLE_CW);
   _spindle_set_pwm(mode, speed);
   _spindle_set_enable(mode != SPINDLE_OFF && TIMER_PWM.CTRLA);
index cb3ff68f741d160afb84eb7c68aee6be5b1694e8..2177876146aeb40bd30594c09d3339148ef4fdc8 100644 (file)
@@ -31,5 +31,5 @@
 
 
 void pwm_spindle_init();
-void pwm_spindle_set(machSpindleMode_t mode, float speed);
+void pwm_spindle_set(spindle_mode_t mode, float speed);
 void pwm_spindle_estop();
index 24f8dfcaa76cb73a7691ab7e7d71352f4c562a94..9209b0b55c84e6f8600d0cd7a8b1920a77cdf5c2 100644 (file)
 typedef enum {
   SPINDLE_TYPE_PWM,
   SPINDLE_TYPE_HUANYANG,
-} spindleType_t;
+} spindle_type_t;
 
-static spindleType_t spindle_type = SPINDLE_TYPE;
+static spindle_type_t spindle_type = SPINDLE_TYPE;
 
 
-static void _spindle_set(machSpindleMode_t mode, float speed) {
+static void _spindle_set(spindle_mode_t mode, float speed) {
   switch (spindle_type) {
   case SPINDLE_TYPE_PWM: pwm_spindle_set(mode, speed); break;
   case SPINDLE_TYPE_HUANYANG: huanyang_set(mode, speed); break;
@@ -53,7 +53,7 @@ static void _spindle_set(machSpindleMode_t mode, float speed) {
 
 /// execute the spindle command (called from planner)
 static void _exec_spindle_control(float *value, float *flag) {
-  machSpindleMode_t mode = value[0];
+  spindle_mode_t mode = value[0];
   mach_set_spindle_mode(mode);
   _spindle_set(mode, mach.gm.spindle_speed);
 }
@@ -74,7 +74,7 @@ void mach_spindle_init() {
 
 
 /// Queue the spindle command to the planner buffer
-void mach_spindle_control(machSpindleMode_t mode) {
+void mach_spindle_control(spindle_mode_t mode) {
   float value[AXES] = {mode};
   mp_queue_command(_exec_spindle_control, value, value);
 }
index 2ea2fcd99c6b93a848569636868030b91fe5b5b9..f4313c7675bfaf21f9c429aef80c39a545925989 100644 (file)
@@ -32,6 +32,6 @@
 
 
 void mach_spindle_init();
-void mach_set_spindle_speed(float speed);                     // S parameter
-void mach_spindle_control(machSpindleMode_t spindle_mode);    // M3, M4, M5
+void mach_set_spindle_speed(float speed);                  // S parameter
+void mach_spindle_control(spindle_mode_t spindle_mode);    // M3, M4, M5
 void mach_spindle_estop();
index 15cb87110bffc0fc1cdf7bbcfa3ace0f15f068a8..f4db85b5de21558c31f9688fdd1e4f4c7a3a6f75 100644 (file)
@@ -51,11 +51,11 @@ typedef struct {
   uint16_t dwell;
 
   // Move prep
-  bool move_ready;      // prepped move ready for loader
-  moveType_t move_type;
+  bool move_ready;       // prepped move ready for loader
+  move_type_t move_type;
   uint16_t seg_period;
   uint32_t prep_dwell;
-  struct mpBuffer *bf;  // used for command moves
+  mp_buffer_t *bf;       // used for command moves
 } stepper_t;
 
 
@@ -147,8 +147,8 @@ ISR(STEP_TIMER_ISR) {
 
   // We are done with this move
   st.move_type = MOVE_TYPE_NULL;
-  st.seg_period = 0; // clear timer
-  st.prep_dwell = 0; // clear dwell
+  st.seg_period = 0;      // clear timer
+  st.prep_dwell = 0;      // clear dwell
   st.move_ready = false;  // flip the flag back
 
   // Request next move if not currently in a dwell.  Requesting the next move
@@ -198,7 +198,7 @@ stat_t st_prep_line(float travel_steps[], float error[], float seg_time) {
 
 
 /// Stage command to execution
-void st_prep_command(mpBuf_t *bf) {
+void st_prep_command(mp_buffer_t *bf) {
   if (st.move_ready) CM_ALARM(STAT_INTERNAL_ERROR);
   st.move_type = MOVE_TYPE_COMMAND;
   st.bf = bf;
index ec9c37b824ba844179670ab920885fb49589ef11..60ff1c9443d030f9e41404278a275156d0bc1e8e 100644 (file)
@@ -40,5 +40,5 @@ void st_shutdown();
 uint8_t st_is_busy();
 stat_t st_prep_line(float travel_steps[], float following_error[],
                     float segment_time);
-void st_prep_command(mpBuf_t *bf);
+void st_prep_command(mp_buffer_t *bf);
 void st_prep_dwell(float seconds);
index 55c252397f26c86375f3a7de615e2c2d185d001a..59382e678ee0e3c4ab41ac5c80bebeef9c4983fd 100644 (file)
@@ -215,11 +215,11 @@ static bool _driver_read(int driver) {
 
 
 static void _spi_next() {
-  bool hasMore = _driver_read(spi.driver);
+  bool has_move = _driver_read(spi.driver);
 
-  //if (!hasMore) drivers[spi.driver].reg_valid = 0;
+  //if (!has_move) drivers[spi.driver].reg_valid = 0;
 
-  if (!hasMore && ++spi.driver == MOTORS) {
+  if (!has_move && ++spi.driver == MOTORS) {
     spi.driver = 0;
     TMC2660_TIMER.CTRLA = TMC2660_TIMER_ENABLE;
     return;
index ad4cea541647bb549e0329d25dc2f2316cbdeb51..a092782da2f888683cca25a45bc94f66cf8f41ad 100644 (file)
@@ -105,8 +105,8 @@ float *set_vector_by_axis(float value, uint8_t axis) {
  * Implementation tip: Order the min and max values from most to least likely
  * in the calling args
  *
- * (*) Macro min4 is about 20uSec, inline function version is closer to 10
- *     uSec (Xmega 32 MHz)
+ * (*) Macro min4 is about 20usec, inline function version is closer to 10
+ *     usec (Xmega 32 MHz)
  *    #define min3(a,b,c) (min(min(a,b),c))
  *    #define min4(a,b,c,d) (min(min(a,b),min(c,d)))
  *    #define max3(a,b,c) (max(max(a,b),c))
index 332642bec5466b6ffd02cd3c188bfcb0c96001e1..d2e164e45fe0fcf56897c6c12d20e6ffd80785dd 100644 (file)
@@ -117,7 +117,7 @@ uint16_t compute_checksum(char const *string, const uint16_t length);
 #define MM_PER_INCH 25.4
 #define INCHES_PER_MM (1 / 25.4)
 #define MICROSECONDS_PER_MINUTE 60000000.0
-#define uSec(a) ((a) * MICROSECONDS_PER_MINUTE)
+#define usec(a) ((a) * MICROSECONDS_PER_MINUTE)
 
 #define RADIAN 57.2957795
 #ifndef M_SQRT3