aqhome: Use baudrate of 19200 bps.
This commit is contained in:
@@ -80,6 +80,7 @@ int AQH_Serial_Open(AQH_SERIAL *sr)
|
|||||||
return GWEN_ERROR_IO;
|
return GWEN_ERROR_IO;
|
||||||
}
|
}
|
||||||
rv=cfsetispeed(&options, B19200);
|
rv=cfsetispeed(&options, B19200);
|
||||||
|
//rv=cfsetispeed(&options, B9600);
|
||||||
if (rv<0) {
|
if (rv<0) {
|
||||||
DBG_ERROR(NULL, "Error on cfsetispeed(%s): %s (%d)", sr->deviceName, strerror(errno), errno);
|
DBG_ERROR(NULL, "Error on cfsetispeed(%s): %s (%d)", sr->deviceName, strerror(errno), errno);
|
||||||
return GWEN_ERROR_IO;
|
return GWEN_ERROR_IO;
|
||||||
@@ -91,7 +92,7 @@ int AQH_Serial_Open(AQH_SERIAL *sr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
options.c_cflag &= ~PARENB;
|
options.c_cflag &= ~PARENB;
|
||||||
options.c_cflag &= ~CSTOPB;
|
options.c_cflag &= ~CSTOPB; /* use one stopbit insteadof 2 */
|
||||||
options.c_cflag &= ~CSIZE;
|
options.c_cflag &= ~CSIZE;
|
||||||
options.c_cflag |= CS8;
|
options.c_cflag |= CS8;
|
||||||
|
|
||||||
@@ -176,7 +177,7 @@ int AQH_Serial_Send(AQH_SERIAL *sr, const uint8_t *ptr, uint8_t len)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(10);
|
usleep(50);
|
||||||
|
|
||||||
rv=_writeForced(sr, ptr, len);
|
rv=_writeForced(sr, ptr, len);
|
||||||
if (rv<0) {
|
if (rv<0) {
|
||||||
@@ -222,15 +223,20 @@ int AQH_Serial_SendPacket(AQH_SERIAL *sr, uint8_t destAddr, const uint8_t *ptr,
|
|||||||
}
|
}
|
||||||
x^=len;
|
x^=len;
|
||||||
|
|
||||||
/* send message */
|
if (len>0) {
|
||||||
rv=_writeForced(sr, ptr, len);
|
uint8_t i;
|
||||||
if (rv<0) {
|
|
||||||
DBG_INFO(NULL, "here (%d)", rv);
|
|
||||||
_attnHigh(sr);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
x^=_calcChecksum(ptr, len);
|
/* send message */
|
||||||
|
rv=_writeForced(sr, ptr, len);
|
||||||
|
if (rv<0) {
|
||||||
|
DBG_INFO(NULL, "here (%d)", rv);
|
||||||
|
_attnHigh(sr);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0; i<len; i++)
|
||||||
|
x^=ptr[i];
|
||||||
|
}
|
||||||
|
|
||||||
/* send XOR checksum */
|
/* send XOR checksum */
|
||||||
rv=_writeForced(sr, &x, 1);
|
rv=_writeForced(sr, &x, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user