Added a tolerance parameter for the current because the current on the RF generator fluctuates a bit.
r2926 | ffr | 2010-05-18 20:07:16 +1000 (Tue, 18 May 2010) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
eb7e4877cc
commit
9cb2ba5ed8
@@ -44,6 +44,7 @@ struct RFAmpData {
|
||||
int targetCurrent;
|
||||
char rfCmd[16];
|
||||
char statusCmd[5];
|
||||
int currTol;
|
||||
};
|
||||
|
||||
void RFAmpKill(void *private)
|
||||
@@ -206,7 +207,7 @@ int RFAmpReading (Ascon *a)
|
||||
|
||||
if (data->transactInProg == txPreSet) {
|
||||
data->transactInProg = txPostSet;
|
||||
if (abs(data->targetCurrent - atoi(curr)) <= 5) {
|
||||
if (abs(data->targetCurrent - atoi(curr)) <= (5 + data->currTol)) {
|
||||
DynStringReplaceWithLen(a->wrBuffer, data->rfCmd,0, SCMDLEN);
|
||||
a->state = AsconWriting;
|
||||
a->noResponse = 0;
|
||||
@@ -225,9 +226,9 @@ int RFAmpReading (Ascon *a)
|
||||
strncpy(tmpFreq, &data->rfCmd[5], 3);
|
||||
tmpSwitchs = (unsigned char)data->rfCmd[8];
|
||||
|
||||
if( (atoi(curr) != atoi(tmpCurr)) ||
|
||||
if( (abs(atoi(curr) - atoi(tmpCurr)) > data->currTol) ||
|
||||
(atoi(freq) != atoi(tmpFreq)) ||
|
||||
((switches & 0x7F) != (tmpSwitchs & 0x7F)) ) {
|
||||
((switches & 0x0F) != (tmpSwitchs & 0x0F)) ) {
|
||||
strcpy(errMsg, "ANSRFAMP: the (S)ET command failed");
|
||||
GetReplyFailed = 1;
|
||||
break;
|
||||
@@ -316,6 +317,7 @@ int RFAmpInit(Ascon *a, SConnection *con, int argc, char *argv[])
|
||||
data->targetCurrent = 0;
|
||||
data->rfCmd[0] = '\0';
|
||||
data->statusCmd[0] = '\0';
|
||||
data->currTol = 1; /* TODO This should be a configuration parameter */
|
||||
a->killPrivate = RFAmpKill;
|
||||
return AsconStdInit(a, con, argc, argv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user