|
@@ -156,7 +156,7 @@ unsigned char Query_Present_InputVoltage(unsigned char fd, unsigned char targetA
|
|
|
unsigned char chksum = 0x00;
|
|
|
unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
|
|
|
|
|
|
- if(len > 6)
|
|
|
+ if(len > 13)
|
|
|
{
|
|
|
if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
@@ -168,14 +168,24 @@ unsigned char Query_Present_InputVoltage(unsigned char fd, unsigned char targetA
|
|
|
if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
|
|
|
(rx[2] == tx[1]) &&
|
|
|
(rx[1] == tx[2]) &&
|
|
|
- (rx[3] == tx[3]))
|
|
|
+ (rx[3] == tx[3]) &&
|
|
|
+ chksum != 0)
|
|
|
{
|
|
|
Ret_Buf->inputType = rx[6];
|
|
|
Ret_Buf->L1N_L12 =(rx[7] | (rx[8]<<8))/10.0;
|
|
|
Ret_Buf->L2N_L23 =(rx[9] | (rx[10]<<8))/10.0;
|
|
|
Ret_Buf->L3N_L31 =(rx[11] | (rx[12]<<8))/10.0;
|
|
|
|
|
|
- result = PASS;
|
|
|
+ if(Ret_Buf->L1N_L12 >= 320 ||
|
|
|
+ Ret_Buf->L2N_L23 >= 320 ||
|
|
|
+ Ret_Buf->L3N_L31 >= 320)
|
|
|
+ {
|
|
|
+ result = FAIL;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result = PASS;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|