Add motor runtime to motor stopped log message
This commit is contained in:
@@ -40,6 +40,8 @@
|
|||||||
#define DECADIC_CREEP (10)
|
#define DECADIC_CREEP (10)
|
||||||
#define SPEED_ON_MOVE 1
|
#define SPEED_ON_MOVE 1
|
||||||
|
|
||||||
|
extern double DoubleTime(void);
|
||||||
|
|
||||||
/** \brief Used to ensure that the getDMCSetting function is called
|
/** \brief Used to ensure that the getDMCSetting function is called
|
||||||
* with valid values.
|
* with valid values.
|
||||||
* \see getDMCSetting
|
* \see getDMCSetting
|
||||||
@@ -181,7 +183,8 @@ struct __MoDriv {
|
|||||||
double lastPosition; /**< Position at last position check */
|
double lastPosition; /**< Position at last position check */
|
||||||
int lastSteps;
|
int lastSteps;
|
||||||
int lastCounts;
|
int lastCounts;
|
||||||
double origPosition; /**< Position at last position check */
|
double origPosition; /**< Position at motor start */
|
||||||
|
double origTime; /**< Time at motor start */
|
||||||
int origSteps;
|
int origSteps;
|
||||||
int origCounts;
|
int origCounts;
|
||||||
double minRatio;
|
double minRatio;
|
||||||
@@ -2234,6 +2237,7 @@ static void DMCState_MotorOn(pDMC2280Driv self, pEvtEvent event) {
|
|||||||
cmdPosition(self, absolute);
|
cmdPosition(self, absolute);
|
||||||
self->subState = 2;
|
self->subState = 2;
|
||||||
/* save pre-motion values for logging */
|
/* save pre-motion values for logging */
|
||||||
|
self->origTime = DoubleTime();
|
||||||
self->origPosition = self->currPosition;
|
self->origPosition = self->currPosition;
|
||||||
self->origCounts = self->currCounts;
|
self->origCounts = self->currCounts;
|
||||||
self->origSteps = self->currSteps;
|
self->origSteps = self->currSteps;
|
||||||
@@ -2551,17 +2555,19 @@ static void DMCState_Moving(pDMC2280Driv self, pEvtEvent event) {
|
|||||||
double units = self->currPosition - self->origPosition;
|
double units = self->currPosition - self->origPosition;
|
||||||
long int steps = self->currSteps - self->origSteps;
|
long int steps = self->currSteps - self->origSteps;
|
||||||
long int counts = self->currCounts - self->origCounts;
|
long int counts = self->currCounts - self->origCounts;
|
||||||
|
double time = DoubleTime() - self->origTime;
|
||||||
char line[CMDLEN];
|
char line[CMDLEN];
|
||||||
snprintf(line, CMDLEN, "Motor=%s stopped: units=%.6f,"
|
snprintf(line, CMDLEN, "Motor=%s stopped: units=%.6f,"
|
||||||
" steps=%ld, counts=%ld, stepsPerX=%.6f,"
|
" steps=%ld, counts=%ld, stepsPerX=%.6f,"
|
||||||
" minRatio=%.6f, maxRatio=%.6f",
|
" ratio=(%.6f-%.6f), time=%.3f",
|
||||||
self->name,
|
self->name,
|
||||||
units,
|
units,
|
||||||
steps,
|
steps,
|
||||||
counts,
|
counts,
|
||||||
(double) steps / units,
|
(double) steps / units,
|
||||||
self->minRatio,
|
self->minRatio,
|
||||||
self->maxRatio);
|
self->maxRatio,
|
||||||
|
time);
|
||||||
SICSLogWrite(line, eStatus);
|
SICSLogWrite(line, eStatus);
|
||||||
}
|
}
|
||||||
change_state(self, DMCState_OffTimer);
|
change_state(self, DMCState_OffTimer);
|
||||||
|
|||||||
Reference in New Issue
Block a user