Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/emc/motion-logger/motion-logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ int main(int argc, char* argv[]) {
c->pos.tran.x, c->pos.tran.y, c->pos.tran.z,
c->pos.a, c->pos.b, c->pos.c,
c->pos.u, c->pos.v, c->pos.w,
c->id, c->motion_type,
c->id.line_number, c->motion_type,
c->vel, c->ini_maxvel,
c->acc, c->turn
);
Expand All @@ -481,7 +481,7 @@ int main(int argc, char* argv[]) {
log_print(" center: x=%.6g, y=%.6g, z=%.6g\n", c->center.x, c->center.y, c->center.z);
log_print(" normal: x=%.6g, y=%.6g, z=%.6g\n", c->normal.x, c->normal.y, c->normal.z);
log_print(" id=%d, motion_type=%d, vel=%.6g, ini_maxvel=%.6g, acc=%.6g, turn=%d\n",
c->id, c->motion_type,
c->id.line_number, c->motion_type,
c->vel, c->ini_maxvel,
c->acc, c->turn
);
Expand Down
20 changes: 10 additions & 10 deletions src/emc/motion/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ void emcmotCommandHandler_locked(void *arg, long servo_period)
emcmotStatus->commandStatus = EMCMOT_COMMAND_INVALID_COMMAND;
SET_MOTION_ERROR_FLAG(1);
break;
} else if (!inRange(emcmotCommand->pos, emcmotCommand->id, "Linear")) {
} else if (!inRange(emcmotCommand->pos, emcmotCommand->id.line_number, "Linear")) {
reportError(_("invalid params in linear command"));
emcmotStatus->commandStatus = EMCMOT_COMMAND_INVALID_PARAMS;
tpAbort(&emcmotInternal->coord_tp);
Expand Down Expand Up @@ -1041,8 +1041,8 @@ void emcmotCommandHandler_locked(void *arg, long servo_period)
emcmotCommand->tag);
//KLUDGE ignore zero length line
if (res_addline < 0) {
reportError(_("can't add linear move at line %d, error code %d"),
emcmotCommand->id, res_addline);
reportError(_("can't add linear move id %ld at %s line %d, error code %d"),
emcmotCommand->id.id, emcmotCommand->tag.filename, emcmotCommand->tag.fields[0], res_addline);
emcmotStatus->commandStatus = EMCMOT_COMMAND_BAD_EXEC;
tpAbort(&emcmotInternal->coord_tp);
SET_MOTION_ERROR_FLAG(1);
Expand Down Expand Up @@ -1072,7 +1072,7 @@ void emcmotCommandHandler_locked(void *arg, long servo_period)
emcmotStatus->commandStatus = EMCMOT_COMMAND_INVALID_COMMAND;
SET_MOTION_ERROR_FLAG(1);
break;
} else if (!inRange(emcmotCommand->pos, emcmotCommand->id, "Circular")) {
} else if (!inRange(emcmotCommand->pos, emcmotCommand->id.line_number, "Circular")) {
emcmotStatus->commandStatus = EMCMOT_COMMAND_INVALID_PARAMS;
tpAbort(&emcmotInternal->coord_tp);
SET_MOTION_ERROR_FLAG(1);
Expand All @@ -1097,8 +1097,8 @@ void emcmotCommandHandler_locked(void *arg, long servo_period)
emcmotCommand->acc, emcmotCommand->ini_maxjerk, emcmotStatus->enables_new,
issue_atspeed, emcmotCommand->tag);
if (res_addcircle < 0) {
reportError(_("can't add circular move at line %d, error code %d"),
emcmotCommand->id, res_addcircle);
reportError(_("can't add circular move id %ld at %s line %d, error code %d"),
emcmotCommand->id.id, emcmotCommand->tag.filename, emcmotCommand->tag.fields[0], res_addcircle);
emcmotStatus->commandStatus = EMCMOT_COMMAND_BAD_EXEC;
tpAbort(&emcmotInternal->coord_tp);
SET_MOTION_ERROR_FLAG(1);
Expand Down Expand Up @@ -1449,7 +1449,7 @@ void emcmotCommandHandler_locked(void *arg, long servo_period)
emcmotStatus->commandStatus = EMCMOT_COMMAND_INVALID_COMMAND;
SET_MOTION_ERROR_FLAG(1);
break;
} else if (!inRange(emcmotCommand->pos, emcmotCommand->id, "Probe")) {
} else if (!inRange(emcmotCommand->pos, emcmotCommand->id.line_number, "Probe")) {
emcmotStatus->commandStatus = EMCMOT_COMMAND_INVALID_PARAMS;
tpAbort(&emcmotInternal->coord_tp);
SET_MOTION_ERROR_FLAG(1);
Expand Down Expand Up @@ -1519,7 +1519,7 @@ void emcmotCommandHandler_locked(void *arg, long servo_period)
emcmotStatus->commandStatus = EMCMOT_COMMAND_INVALID_COMMAND;
SET_MOTION_ERROR_FLAG(1);
break;
} else if (!inRange(emcmotCommand->pos, emcmotCommand->id, "Rigid tap")) {
} else if (!inRange(emcmotCommand->pos, emcmotCommand->id.line_number, "Rigid tap")) {
emcmotStatus->commandStatus = EMCMOT_COMMAND_INVALID_PARAMS;
tpAbort(&emcmotInternal->coord_tp);
SET_MOTION_ERROR_FLAG(1);
Expand All @@ -1545,8 +1545,8 @@ void emcmotCommandHandler_locked(void *arg, long servo_period)
emcmotCommand->tag);
if (res_addtap < 0) {
emcmotStatus->atspeed_next_feed = 0; /* rigid tap always waits for spindle to be at-speed */
reportError(_("can't add rigid tap move at line %d, error code %d"),
emcmotCommand->id, res_addtap);
reportError(_("can't add rigid tap move id %ld at %s line %d, error code %d"),
emcmotCommand->id.id, emcmotCommand->tag.filename, emcmotCommand->tag.fields[0], res_addtap);
tpAbort(&emcmotInternal->coord_tp);
SET_MOTION_ERROR_FLAG(1);
break;
Expand Down
4 changes: 2 additions & 2 deletions src/emc/motion/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -1947,7 +1947,7 @@ static void output_to_hal(void)
emcmotStatus->spindle_status[spindle_num].speed / 60.;
}

*(emcmot_hal_data->program_line) = emcmotStatus->id;
*(emcmot_hal_data->program_line) = emcmotStatus->id.line_number;
*(emcmot_hal_data->tp_reverse) = emcmotStatus->reverse_run;
*(emcmot_hal_data->motion_type) = emcmotStatus->motionType;
*(emcmot_hal_data->distance_to_go) = emcmotStatus->distance_to_go;
Expand Down Expand Up @@ -2179,7 +2179,7 @@ static void update_status(void)
/* check to see if we should pause in order to implement
single emcmotStatus->stepping */

if (emcmotStatus->stepping && emcmotInternal->idForStep != emcmotStatus->id) {
if (emcmotStatus->stepping && emcmotInternal->idForStep.id != emcmotStatus->id.id) {
tpPause(&emcmotInternal->coord_tp);
emcmotStatus->stepping = 0;
emcmotStatus->paused = 1;
Expand Down
18 changes: 18 additions & 0 deletions src/emc/motion/emcmotcfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef EMCMOTCFG_H
#define EMCMOTCFG_H

#include <stdint.h>

/* default name of EMCMOT INI file */
#define DEFAULT_EMCMOT_INIFILE "emc.ini" /* same as for EMC-- we're in
touch */
Expand Down Expand Up @@ -72,4 +74,20 @@
/* max following error */
#define DEFAULT_MAX_FERROR 100

#ifdef __cplusplus
extern "C" {
#endif
typedef union {
// note: CMS can't deal with 64bit values nor with bitfields
int64_t id;
struct {
int line_number;
unsigned filename_hash;
};
} emcmot_motion_id_t;

#ifdef __cplusplus
}
#endif

#endif
2 changes: 1 addition & 1 deletion src/emc/motion/motion.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ static int init_comm_buffers(void)
override, and feed hold are on */
emcmotStatus->enables_new = FS_ENABLED | SS_ENABLED | FH_ENABLED;
emcmotStatus->enables_queued = emcmotStatus->enables_new;
emcmotStatus->id = 0;
emcmotStatus->id.id = 0;
emcmotStatus->depth = 0;
emcmotStatus->activeDepth = 0;
emcmotStatus->paused = 0;
Expand Down
9 changes: 5 additions & 4 deletions src/emc/motion/motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ to another.
#include "simple_tp.h"
#include "rtapi_limits.h"
#include <stdarg.h>
#include <stdint.h>
#include "rtapi_bool.h"
#include "state_tag.h"
#include "tp_types.h"
Expand All @@ -77,7 +78,7 @@ to another.
// this should be really be tested for in command.c

#define MOTION_INVALID_ID INT_MIN
#define MOTION_ID_VALID(x) ((x) != MOTION_INVALID_ID)
#define MOTION_ID_VALID(x) ((x.line_number) != MOTION_INVALID_ID)

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -222,7 +223,7 @@ extern "C" {
double ini_maxjerk;
int planner_type; /* planner type: 0 = trapezoidal, 1 = S-curve */
double backlash; /* amount of backlash */
int id; /* id for motion */
emcmot_motion_id_t id; /* id for motion */
int termCond; /* termination condition */
double tolerance; /* tolerance for path deviation in CONTINUOUS mode */
int joint; /* which joint index to use for below */
Expand Down Expand Up @@ -626,7 +627,7 @@ Suggestion: Split this in to an Error and a Status flag register..
unsigned int heartbeat;
int config_num; /* incremented whenever configuration
changed. */
int id; /* id for executing motion */
emcmot_motion_id_t id; /* id for executing motion */
int depth; /* motion queue depth */
int activeDepth; /* depth of active blend elements */
int queueFull; /* Flag to indicate the tc queue is full */
Expand Down Expand Up @@ -751,7 +752,7 @@ typedef struct emcmot_internal_t {
int overriding; /* non-zero means we've initiated an joint
move while overriding limits */
TP_STRUCT coord_tp; /* coordinated mode planner */
int idForStep; /* status id while stepping */
emcmot_motion_id_t idForStep; /* status id while stepping */
} emcmot_internal_t;

/* error ring buffer access functions */
Expand Down
8 changes: 4 additions & 4 deletions src/emc/motion/usrmotintf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int usrmotWriteEmcmotCommand(emcmot_command_t * c)
double end;

if (!MOTION_ID_VALID(c->id)) {
rcs_print("USRMOT: ERROR: invalid motion id: %d\n",c->id);
rcs_print("USRMOT: ERROR: invalid motion id: %d %u\n", c->id.line_number, c->id.filename_hash);
return EMCMOT_COMM_INVALID_MOTION_ID;
}

Expand Down Expand Up @@ -256,8 +256,8 @@ void printTPstruct(TP_STRUCT * tp)
printf("vLimit=%f\n", tp->vLimit);
printf("wMax=%f\n", tp->wMax);
printf("wDotMax=%f\n", tp->wDotMax);
printf("nextId=%d\n", tp->nextId);
printf("execId=%d\n", tp->execId);
printf("nextId=%ld\n", tp->nextId.id);
printf("execId=%ld\n", tp->execId.id);
printf("termCond=%d\n", tp->termCond);
printf("currentPos :");
printEmcPose(&tp->currentPos);
Expand Down Expand Up @@ -425,7 +425,7 @@ void usrmotPrintEmcmotStatus(emcmot_status_t *s, int which)
#endif
printf("velocity: \t%f\n", s->vel);
printf("accel: \t%f\n", s->acc);
printf("id: \t%d\n", s->id);
printf("id: \t%ld\n", s->id.id);
printf("depth: \t%d\n", s->depth);
printf("active depth: \t%d\n", s->activeDepth);
printf("inpos: \t%d\n",
Expand Down
3 changes: 2 additions & 1 deletion src/emc/nml_intf/emc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1702,7 +1702,8 @@ void EMC_TRAJ_STAT::update(CMS * cms)
cms->update(queue);
cms->update(activeQueue);
cms->update(queueFull);
cms->update(id);
cms->update(id.line_number);
cms->update(id.filename_hash);
cms->update(paused);
cms->update(single_stepping);
cms->update(scale);
Expand Down
2 changes: 1 addition & 1 deletion src/emc/nml_intf/emc.hh
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ extern int emcTrajSetFHEnable(unsigned char mode); //feed hold enable
extern int emcTrajSetSpindleScale(int spindle, double scale);
extern int emcTrajSetSOEnable(unsigned char mode); //spindle speed override enable
extern int emcTrajSetAFEnable(unsigned char enable); //adaptive feed enable
extern int emcTrajSetMotionId(int id);
extern int emcTrajSetMotionId(emcmot_motion_id_t id);
extern double emcTrajGetLinearUnits();
extern double emcTrajGetAngularUnits();

Expand Down
2 changes: 1 addition & 1 deletion src/emc/nml_intf/emc_nml.hh
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ class EMC_TRAJ_STAT:public EMC_TRAJ_STAT_MSG {
// current
int activeQueue; // number of motions blending
bool queueFull; // non-zero means can't accept another motion
int id; // id of the currently executing motion
emcmot_motion_id_t id; // id of the currently executing motion
bool paused; // non-zero means motion paused
bool single_stepping; // non-zero means motion stepping single block
double scale; // velocity scale factor
Expand Down
2 changes: 1 addition & 1 deletion src/emc/nml_intf/emcglb.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ typedef struct TrajConfig_t {
int AxisMask;
double LinearUnits;
double AngularUnits;
int MotionId;
emcmot_motion_id_t MotionId;
} TrajConfig_t;

#ifdef __cplusplus
Expand Down
12 changes: 11 additions & 1 deletion src/emc/nml_intf/interpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,17 @@ int NML_INTERP_LIST::len()
return ((int)linked_list.size());
}

int NML_INTERP_LIST::get_line_number()
int NML_INTERP_LIST::get_line_number() const
{
return line_number;
}

void NML_INTERP_LIST::set_filename(const std::string& s)
{
filename = s;
}

const std::string& NML_INTERP_LIST::get_filename() const
{
return filename;
}
6 changes: 5 additions & 1 deletion src/emc/nml_intf/interpl.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <deque>
#include <memory>
#include <string>

class NMLmsg;

Expand All @@ -35,7 +36,9 @@ class NML_INTERP_LIST
{
public:
void set_line_number(int line);
int get_line_number();
int get_line_number() const;
void set_filename(const std::string& s);
const std::string& get_filename() const;
int append(std::unique_ptr<NMLmsg>&& command);
std::unique_ptr<NMLmsg> get();
void clear();
Expand All @@ -47,6 +50,7 @@ private:
int next_line_number = 0; // line number used to fill temp_node
int line_number = 0; // line number of node from get()
// NML_INTERP_LIST_NODE node; // pointer returned by get
std::string filename;
};

extern NML_INTERP_LIST interp_list; /* NML Union, for interpreter */
Expand Down
Loading
Loading