Improve debug printing
This commit is contained in:
@@ -679,6 +679,12 @@ static int motCreep(pDMC2280Driv self, double target) {
|
||||
|
||||
if (self->debug) {
|
||||
char line[CMDLEN];
|
||||
snprintf(line, CMDLEN, "CREEP: Motor=%s, preseek=%d, creep_val=%d, cur_steps=%d",
|
||||
self->name, self->preseek, self->creep_val, self->currSteps);
|
||||
SICSLogWrite(line, eStatus);
|
||||
snprintf(line, CMDLEN, "CREEP: Motor=%s, fPreseek=%f, fTarget=%f, target=%f, tgt_steps=%d",
|
||||
self->name, self->fPreseek, self->fTarget, target, target_steps);
|
||||
SICSLogWrite(line, eStatus);
|
||||
snprintf(line, CMDLEN, "CREEP: cur=%d, target=%d, offset=%d, new=%d",
|
||||
self->currSteps, target_steps, offset, self->currSteps + offset);
|
||||
SICSLogWrite(line, eStatus);
|
||||
@@ -2593,17 +2599,33 @@ static void DMCState_Moving(pDMC2280Driv self, pEvtEvent event) {
|
||||
}
|
||||
else if (self->preseek) {
|
||||
absolute = motCreep(self, target);
|
||||
if (self->debug) {
|
||||
char line[CMDLEN];
|
||||
snprintf(line, CMDLEN, "Motor=%s unchanged direction: "
|
||||
"preseek=%d, fPreseek=%f, steps=%d, creep_val=%d",
|
||||
self->name,
|
||||
self->preseek,
|
||||
self->fPreseek,
|
||||
absolute - self->currSteps,
|
||||
self->creep_val);
|
||||
SICSLogWrite(line, eStatus);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* change of direction, reset motion check */
|
||||
if (self->debug) {
|
||||
char line[CMDLEN];
|
||||
snprintf(line, CMDLEN, "Motor=%s changed direction",
|
||||
self->name);
|
||||
SICSLogWrite(line, eStatus);
|
||||
}
|
||||
set_lastMotion(self, self->currSteps, self->currCounts);
|
||||
absolute = motCreep(self, target);
|
||||
if (self->debug) {
|
||||
char line[CMDLEN];
|
||||
snprintf(line, CMDLEN, "Motor=%s changed direction: "
|
||||
"preseek=%d, fPreseek=%f, steps=%d, creep_val=%d",
|
||||
self->name,
|
||||
self->preseek,
|
||||
self->fPreseek,
|
||||
absolute - self->currSteps,
|
||||
self->creep_val);
|
||||
SICSLogWrite(line, eStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user