If the S (set) command fails it should be reported as an error.

r2920 | ffr | 2010-05-12 17:35:17 +1000 (Wed, 12 May 2010) | 2 lines
This commit is contained in:
Ferdi Franceschini
2010-05-12 17:35:17 +10:00
committed by Douglas Clowes
parent b0fd7636b4
commit bc3471bb98

View File

@@ -215,26 +215,29 @@ int RFAmpReading (Ascon *a)
strcpy(errMsg, "ANSRFAMP: Step size should be <= 5 for current");
GetReplyFailed = 1;
break;
}
} else if (data->transactInProg == txCheckReply) {
// TODO Compare rdBuffer to rfCmd if they match then set replyStr="OK" else set error message
char tmpCurr[3], tmpFreq[4];
unsigned char tmpSwitchs;
}
} else if (data->transactInProg == txCheckReply) {
// TODO Compare rdBuffer to rfCmd if they match then set replyStr="OK" else set error message
char tmpCurr[3], tmpFreq[4];
unsigned char tmpSwitchs;
strncpy(tmpCurr, &data->rfCmd[3], 2);
strncpy(tmpFreq, &data->rfCmd[5], 3);
tmpSwitchs = (unsigned char)data->rfCmd[8];
strncpy(tmpCurr, &data->rfCmd[3], 2);
strncpy(tmpFreq, &data->rfCmd[5], 3);
tmpSwitchs = (unsigned char)data->rfCmd[8];
if((atoi(curr) != atoi(tmpCurr)) ||
(atoi(freq) != atoi(tmpFreq)) ||
((switches & 0x7F) != (tmpSwitchs & 0x7F))){
DynStringReplace(a->rdBuffer, "Warning: Writting Device Error!", 0);
}else
DynStringReplace(a->rdBuffer, "OK", 0);
if( (atoi(curr) != atoi(tmpCurr)) ||
(atoi(freq) != atoi(tmpFreq)) ||
((switches & 0x7F) != (tmpSwitchs & 0x7F)) ) {
strcpy(errMsg, "ANSRFAMP: the (S)ET command failed");
GetReplyFailed = 1;
break;
} else {
DynStringReplace(a->rdBuffer, "OK", 0);
}
a->state = AsconReadDone;
data->transactInProg = txNormalRead;
} else if (data->transactInProg == txNormalRead) {
a->state = AsconReadDone;
data->transactInProg = txNormalRead;
} else if (data->transactInProg == txNormalRead) {
K3 = (switches & 0x08) >> 3;
K2 = (switches & 0x04) >> 2;
K1 = (switches & 0x02) >> 1;