add delay factor after sending a S command and before sending a L command
r2947 | jgn | 2010-06-01 15:10:12 +1000 (Tue, 01 Jun 2010) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
e8a0c8222f
commit
687ed01c01
@@ -44,7 +44,8 @@ struct RFAmpData {
|
||||
int targetCurrent;
|
||||
char rfCmd[16];
|
||||
char statusCmd[5];
|
||||
int currTol;
|
||||
int currTol;
|
||||
int timeout; // timeout delay before sending a L command after a S command is sent
|
||||
};
|
||||
|
||||
void RFAmpKill(void *private)
|
||||
@@ -165,16 +166,22 @@ int RFAmpReading (Ascon *a)
|
||||
char errMsg[ERRLEN];
|
||||
struct RFAmpData *data = a->private;
|
||||
|
||||
static int delay=0;
|
||||
|
||||
switches=opstate=K3=K2=K1=outOn=CC=CV=heat=0;
|
||||
|
||||
if(data->transactInProg == txPostSet){
|
||||
|
||||
data->transactInProg = txCheckReply;
|
||||
|
||||
//Jing: add delay to wait for ramping complete
|
||||
sleep(data->timeout);
|
||||
|
||||
DynStringReplaceWithLen(a->wrBuffer, data->statusCmd, 0, LCMDLEN);
|
||||
a->state = AsconWriting;
|
||||
a->noResponse = 0;
|
||||
a->wrPos = 0;
|
||||
delay = 0;
|
||||
}else{
|
||||
// Start reading when byte = 2 and stop when 3
|
||||
while ( ( rdChRet = AsconReadChar(a->fd, &chr) ) > 0) {
|
||||
@@ -210,6 +217,7 @@ int RFAmpReading (Ascon *a)
|
||||
data->transactInProg = txPostSet;
|
||||
if (abs(data->targetCurrent - atoi(curr)) <= (5 + data->currTol)) {
|
||||
DynStringReplaceWithLen(a->wrBuffer, data->rfCmd,0, SCMDLEN);
|
||||
delay = round(abs(data->targetCurrent - atoi(curr))/0.5 + 0.5);
|
||||
a->state = AsconWriting;
|
||||
a->noResponse = 0;
|
||||
a->wrPos = 0;
|
||||
@@ -227,7 +235,7 @@ int RFAmpReading (Ascon *a)
|
||||
strncpy(tmpFreq, &data->rfCmd[5], 3);
|
||||
tmpSwitchs = (unsigned char)data->rfCmd[8];
|
||||
|
||||
/* TODO SICS-405 ffr Removed check because the read values don't immediately match the set values
|
||||
// TODO SICS-405 ffr Removed check because the read values don't immediately match the set values
|
||||
if( (abs(atoi(curr) - atoi(tmpCurr)) > data->currTol) ||
|
||||
(atoi(freq) != atoi(tmpFreq)) ||
|
||||
((switches & 0x0F) != (tmpSwitchs & 0x0F)) ) {
|
||||
@@ -237,9 +245,9 @@ int RFAmpReading (Ascon *a)
|
||||
} else {
|
||||
DynStringReplace(a->rdBuffer, "OK", 0);
|
||||
}
|
||||
*/
|
||||
/* ffr Just report OK until we have a proper fix */
|
||||
DynStringReplace(a->rdBuffer, "OK", 0);
|
||||
|
||||
/* ffr Just report OK until we have a proper fix */
|
||||
//DynStringReplace(a->rdBuffer, "OK", 0);
|
||||
|
||||
a->state = AsconReadDone;
|
||||
data->transactInProg = txNormalRead;
|
||||
@@ -325,6 +333,7 @@ int RFAmpInit(Ascon *a, SConnection *con, int argc, char *argv[])
|
||||
data->rfCmd[0] = '\0';
|
||||
data->statusCmd[0] = '\0';
|
||||
data->currTol = 1; /* TODO This should be a configuration parameter */
|
||||
data->timeout = 1; /* TODO This should be a configuration parameter */
|
||||
a->killPrivate = RFAmpKill;
|
||||
return AsconStdInit(a, con, argc, argv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user