mirror of
https://github.com/Binary-Coalescence/motorDSM.git
synced 2025-08-04 21:55:40 -05:00
Fixed incorrectly reading ints as doubles.
This commit is contained in:
@@ -262,7 +262,7 @@ asynStatus MD90Axis::poll(bool *moving)
|
|||||||
{
|
{
|
||||||
int replyStatus;
|
int replyStatus;
|
||||||
char replyString[256];
|
char replyString[256];
|
||||||
double replyValue;
|
int replyValue;
|
||||||
int done;
|
int done;
|
||||||
int driveOn;
|
int driveOn;
|
||||||
int home;
|
int home;
|
||||||
@@ -276,8 +276,7 @@ asynStatus MD90Axis::poll(bool *moving)
|
|||||||
comStatus = pC_->writeReadController();
|
comStatus = pC_->writeReadController();
|
||||||
if (comStatus) goto skip;
|
if (comStatus) goto skip;
|
||||||
// The response string is of the form "0: Current position in encoder counts: 1000"
|
// The response string is of the form "0: Current position in encoder counts: 1000"
|
||||||
sscanf (pC_->inString_, "%d: %[^:]: %lf", &replyStatus, replyString, &replyValue);
|
sscanf (pC_->inString_, "%d: %[^:]: %lf", &replyStatus, replyString, &position);
|
||||||
position = replyValue;
|
|
||||||
setDoubleParam(pC_->motorPosition_, position);
|
setDoubleParam(pC_->motorPosition_, position);
|
||||||
|
|
||||||
// Read the moving status of this motor
|
// Read the moving status of this motor
|
||||||
@@ -285,7 +284,7 @@ asynStatus MD90Axis::poll(bool *moving)
|
|||||||
comStatus = pC_->writeReadController();
|
comStatus = pC_->writeReadController();
|
||||||
if (comStatus) goto skip;
|
if (comStatus) goto skip;
|
||||||
// The response string is of the form "0: Current status value: 0"
|
// The response string is of the form "0: Current status value: 0"
|
||||||
sscanf (pC_->inString_, "%d: %[^:]: %lf", &replyStatus, replyString, &replyValue);
|
sscanf (pC_->inString_, "%d: %[^:]: %d", &replyStatus, replyString, &replyValue);
|
||||||
done = (replyValue == '2') ? 0:1;
|
done = (replyValue == '2') ? 0:1;
|
||||||
setIntegerParam(pC_->motorStatusDone_, done);
|
setIntegerParam(pC_->motorStatusDone_, done);
|
||||||
*moving = done ? false:true;
|
*moving = done ? false:true;
|
||||||
@@ -295,7 +294,7 @@ asynStatus MD90Axis::poll(bool *moving)
|
|||||||
comStatus = pC_->writeReadController();
|
comStatus = pC_->writeReadController();
|
||||||
if (comStatus) goto skip;
|
if (comStatus) goto skip;
|
||||||
// The response string is of the form "0: Home status: 1"
|
// The response string is of the form "0: Home status: 1"
|
||||||
sscanf (pC_->inString_, "%d: %[^:]: %lf", &replyStatus, replyString, &replyValue);
|
sscanf (pC_->inString_, "%d: %[^:]: %d", &replyStatus, replyString, &replyValue);
|
||||||
home = (replyValue == '1') ? 1:0;
|
home = (replyValue == '1') ? 1:0;
|
||||||
setIntegerParam(pC_->motorStatusAtHome_, home);
|
setIntegerParam(pC_->motorStatusAtHome_, home);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user