aqhome: Use baudrate of 19200 bps.

This commit is contained in:
Martin Preuss
2023-01-25 16:29:16 +01:00
parent 348d808706
commit 7c808715b4

View File

@@ -80,6 +80,7 @@ int AQH_Serial_Open(AQH_SERIAL *sr)
return GWEN_ERROR_IO;
}
rv=cfsetispeed(&options, B19200);
//rv=cfsetispeed(&options, B9600);
if (rv<0) {
DBG_ERROR(NULL, "Error on cfsetispeed(%s): %s (%d)", sr->deviceName, strerror(errno), errno);
return GWEN_ERROR_IO;
@@ -91,7 +92,7 @@ int AQH_Serial_Open(AQH_SERIAL *sr)
}
options.c_cflag &= ~PARENB;
options.c_cflag &= ~CSTOPB;
options.c_cflag &= ~CSTOPB; /* use one stopbit insteadof 2 */
options.c_cflag &= ~CSIZE;
options.c_cflag |= CS8;
@@ -176,7 +177,7 @@ int AQH_Serial_Send(AQH_SERIAL *sr, const uint8_t *ptr, uint8_t len)
return rv;
}
usleep(10);
usleep(50);
rv=_writeForced(sr, ptr, len);
if (rv<0) {
@@ -222,6 +223,9 @@ int AQH_Serial_SendPacket(AQH_SERIAL *sr, uint8_t destAddr, const uint8_t *ptr,
}
x^=len;
if (len>0) {
uint8_t i;
/* send message */
rv=_writeForced(sr, ptr, len);
if (rv<0) {
@@ -230,7 +234,9 @@ int AQH_Serial_SendPacket(AQH_SERIAL *sr, uint8_t destAddr, const uint8_t *ptr,
return rv;
}
x^=_calcChecksum(ptr, len);
for (i=0; i<len; i++)
x^=ptr[i];
}
/* send XOR checksum */
rv=_writeForced(sr, &x, 1);