Skip to content

Commit 03de787

Browse files
committed
Fixing uint conversion on gcc4.8 (centos)
1 parent a0c78be commit 03de787

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

beckMotorApp/BeckhoffSrc/BeckController.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ asynStatus BeckController::readUInt32DigitalArray(asynInt32ArrayClient *client,
210210
* writes only if necessary: a read is always performed
211211
* to avoid useless writings to static memory
212212
*/
213-
bool BeckController::writeWithPassword(asynInt32ArrayClient *client, int *value, uint mask, size_t nElem, const char *regName) {
214-
asynPrint(pasynUserSelf, ASYN_TRACE_BECK,"-%s(%p, %p, %d, %ld, %s)\n", __FUNCTION__, client, value, mask, nElem, regName);
213+
bool BeckController::writeWithPassword(asynInt32ArrayClient *client, int *value, uint mask, int nElem, const char *regName) {
214+
asynPrint(pasynUserSelf, ASYN_TRACE_BECK,"-%s(%p, %p, %d, %d, %s)\n", __FUNCTION__, client, value, mask, nElem, regName);
215215

216216
int password[numAxes_];
217217
int oldValue[nElem];
@@ -250,8 +250,8 @@ bool BeckController::writeWithPassword(asynInt32ArrayClient *client, int *value,
250250
/**
251251
* write the same value on all the registers pointed by a client
252252
*/
253-
bool BeckController::writeWithPassword(asynInt32ArrayClient *client, int value, uint mask, size_t nElem, const char *regName) {
254-
asynPrint(pasynUserSelf, ASYN_TRACE_BECK,"-%s(%p, %d, %d, %ld, %s)\n", __FUNCTION__, client, value, mask, nElem, regName);
253+
bool BeckController::writeWithPassword(asynInt32ArrayClient *client, int value, uint mask, int nElem, const char *regName) {
254+
asynPrint(pasynUserSelf, ASYN_TRACE_BECK,"-%s(%p, %d, %d, %d, %s)\n", __FUNCTION__, client, value, mask, nElem, regName);
255255
int values[nElem];
256256
std::fill_n(values, nElem, value);
257257
return writeWithPassword(client, values, mask, nElem, regName);
@@ -283,7 +283,7 @@ asynStatus BeckController::init(int firstAxis, int lastAxis, bool encoder, bool
283283
asynInt32ArrayClient *r46 = new asynInt32ArrayClient(beckDriverPName_, firstAxis, "R46");
284284
asynInt32ArrayClient *r52 = new asynInt32ArrayClient(beckDriverPName_, firstAxis, "R52");
285285

286-
size_t axisLen = lastAxis - firstAxis +1;
286+
int axisLen = lastAxis - firstAxis +1;
287287

288288
//reset precedent errors by putting 0 -> 1 -> 0 to bit 0x40 of control byte
289289
//and stop all the axis by putting 0 -> 1 -> 0 to bit 0x2 of control byte
@@ -338,7 +338,7 @@ asynStatus BeckController::initStepResolution(int firstAxis, int lastAxis, int m
338338
asynInt32ArrayClient *r46 = new asynInt32ArrayClient(beckDriverPName_, firstAxis, "R46");
339339
asynInt32ArrayClient *r33 = new asynInt32ArrayClient(beckDriverPName_, firstAxis, "R33");
340340

341-
size_t axisLen = lastAxis - firstAxis +1;
341+
int axisLen = lastAxis - firstAxis +1;
342342
int tobewritten[axisLen];
343343

344344
if (microstepPerStep>0) {
@@ -390,7 +390,7 @@ asynStatus BeckController::initCurrents(int firstAxis, int lastAxis, double maxA
390390
asynInt32ArrayClient *r43 = new asynInt32ArrayClient(beckDriverPName_, firstAxis, "R43");
391391
asynInt32ArrayClient *r44 = new asynInt32ArrayClient(beckDriverPName_, firstAxis, "R44");
392392

393-
size_t axisLen = lastAxis - firstAxis +1;
393+
int axisLen = lastAxis - firstAxis +1;
394394
epicsInt32 termType[numAxes_];
395395
double fullScaleCurr[axisLen];
396396
double setMaxAmp[axisLen];
@@ -400,22 +400,22 @@ asynStatus BeckController::initCurrents(int firstAxis, int lastAxis, double maxA
400400
//read controller code and convert ampere to %
401401
r_[8]->read(termType, numAxes_, &nIn);
402402

403-
for (size_t i=0; i<axisLen; i++) {
403+
for (int i=0; i<axisLen; i++) {
404404
switch (termType[firstAxis+i]) {
405405
case 2531: fullScaleCurr[i] = 1.5; break;
406406
case 2541: fullScaleCurr[i] = 5.0; break;
407407
default: {
408-
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,"-%02ld Error: Cannot recognize controller type %d\n", firstAxis+i, termType[firstAxis+i]);
408+
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,"-%02d Error: Cannot recognize controller type %d\n", firstAxis+i, termType[firstAxis+i]);
409409
return asynError;
410410
}
411411
}
412-
asynPrint(pasynUserSelf, ASYN_TRACE_BECK,"-%02ld Terminal: Beckhoff KL%d - Max available ampere: %.2lf\n", firstAxis+i, termType[firstAxis+i], fullScaleCurr[i]);
412+
asynPrint(pasynUserSelf, ASYN_TRACE_BECK,"-%02d Terminal: Beckhoff KL%d - Max available ampere: %.2lf\n", firstAxis+i, termType[firstAxis+i], fullScaleCurr[i]);
413413

414414
//R35: Maximum coil current A (in % to fullScale of device)
415415
//R36: Maximum coil current B (in % to fullScale of device)
416416
if (maxAmp>=0){
417417
if (maxAmp>fullScaleCurr[i]) {
418-
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,"-%02ld Warning: Cannot set max current higher than full scale, reverting to %.2lfA\n", firstAxis+i, fullScaleCurr[i]);
418+
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,"-%02d Warning: Cannot set max current higher than full scale, reverting to %.2lfA\n", firstAxis+i, fullScaleCurr[i]);
419419
}
420420
percent[i] = round( std::min(maxAmp, fullScaleCurr[i]) / fullScaleCurr[i] *100 ); //enforce here fullScaleCurr as higher limit
421421
setMaxAmp[i] = ((double) percent[i])/100.0*fullScaleCurr[i];
@@ -431,9 +431,9 @@ asynStatus BeckController::initCurrents(int firstAxis, int lastAxis, double maxA
431431

432432
//R44: Coil current, v = 0 (automatic) (in % to maxAmp)
433433
if (autoHoldinCurr>=0) {
434-
for (size_t i=0; i<axisLen; i++) {
434+
for (int i=0; i<axisLen; i++) {
435435
if (autoHoldinCurr>setMaxAmp[i]) {
436-
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,"-%02ld Warning: Cannot set holding current higher than maximum coil current, reverting to %.2lfA\n", firstAxis+i, setMaxAmp[i]);
436+
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,"-%02d Warning: Cannot set holding current higher than maximum coil current, reverting to %.2lfA\n", firstAxis+i, setMaxAmp[i]);
437437
}
438438
percent[i] = round( std::min(setMaxAmp[i], autoHoldinCurr) / setMaxAmp[i] *100 );
439439
}
@@ -442,9 +442,9 @@ asynStatus BeckController::initCurrents(int firstAxis, int lastAxis, double maxA
442442

443443
//R42: Coil current, a > ath (in % to maxAmp)
444444
if (highAccCurr>=0) {
445-
for (size_t i=0; i<axisLen; i++) {
445+
for (int i=0; i<axisLen; i++) {
446446
if (highAccCurr>setMaxAmp[i]) {
447-
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,"-%02ld Warning: Cannot set over acceleration current higher than maximum coil current, reverting to %.2lfA\n", firstAxis+i, setMaxAmp[i]);
447+
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,"-%02d Warning: Cannot set over acceleration current higher than maximum coil current, reverting to %.2lfA\n", firstAxis+i, setMaxAmp[i]);
448448
}
449449
percent[i] = round( std::min(setMaxAmp[i], highAccCurr) / setMaxAmp[i] *100 );
450450
}
@@ -453,9 +453,9 @@ asynStatus BeckController::initCurrents(int firstAxis, int lastAxis, double maxA
453453

454454
//R43: Coil current, a <= ath (in % to maxAmp)
455455
if (lowAccCurr>=0) {
456-
for (size_t i=0; i<axisLen; i++) {
456+
for (int i=0; i<axisLen; i++) {
457457
if (lowAccCurr>setMaxAmp[i]) {
458-
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,"-%02ld Warning: Cannot set sub acceleration current higher than maximum coil current, reverting to %.2lfA\n\n", firstAxis+i, setMaxAmp[i]);
458+
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,"-%02d Warning: Cannot set sub acceleration current higher than maximum coil current, reverting to %.2lfA\n\n", firstAxis+i, setMaxAmp[i]);
459459
}
460460
percent[i] = round( std::min(setMaxAmp[i], lowAccCurr) / setMaxAmp[i] *100 );
461461
}
@@ -481,7 +481,7 @@ asynStatus BeckController::initHomingParams(int firstAxis, int lastAxis, int ref
481481
asynInt32ArrayClient *r55 = new asynInt32ArrayClient(beckDriverPName_, firstAxis, "R55");
482482
asynInt32ArrayClient *r56 = new asynInt32ArrayClient(beckDriverPName_, firstAxis, "R56");
483483

484-
size_t axisLen = lastAxis - firstAxis +1;
484+
int axisLen = lastAxis - firstAxis +1;
485485
epicsUInt32 featureReg;
486486

487487
writeWithPassword(r55, refPosition & 0xFFFF, NO_MASK, axisLen, "R55 reference position (low word)");

beckMotorApp/BeckhoffSrc/BeckController.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ class epicsShareClass BeckController : public asynMotorController {
150150
asynStatus initStepResolution(int firstAxis, int lastAxis, int microstepPerStep, int stepPerRevolution);
151151
asynStatus readUInt32DigitalArray(asynInt32ArrayClient *client, int *value, uint mask, size_t nElements, size_t *nIn);
152152
asynStatus writeUInt32DigitalArray(asynInt32ArrayClient *client, int *value, uint mask, size_t nElements);
153-
bool writeWithPassword(asynInt32ArrayClient *client, int value, uint mask, size_t nElem, const char *regName);
154-
bool writeWithPassword(asynInt32ArrayClient *client, int *value, uint mask, size_t nElem, const char *regName);
153+
bool writeWithPassword(asynInt32ArrayClient *client, int value, uint mask, int nElem, const char *regName);
154+
bool writeWithPassword(asynInt32ArrayClient *client, int *value, uint mask, int nElem, const char *regName);
155155
bool axisRangeOk(int *begin, int *end);
156156

157157
friend class BeckAxis;

0 commit comments

Comments
 (0)