comments to reading and buffering of HW-version 3
This commit is contained in:
@@ -302,6 +302,7 @@ void HardwareSetup::run() {
|
||||
}
|
||||
} // end HARDWARE_VERSION 2
|
||||
else if (HARDWARE_VERSION == 3) {
|
||||
|
||||
fd = open(PORT_PATH, O_RDONLY);
|
||||
while (this->fd < 0) {
|
||||
// wait 1 second
|
||||
@@ -310,25 +311,24 @@ void HardwareSetup::run() {
|
||||
fd = open(PORT_PATH, O_RDONLY);
|
||||
}
|
||||
cout << "Port opened" << endl;
|
||||
// port opened
|
||||
|
||||
// prepare buffer
|
||||
struct TransStruct * received;
|
||||
uint8_t uintBuf[4 * 6];
|
||||
void * voidBuf;
|
||||
|
||||
// flush existing data
|
||||
// configure among others non-canonical mode (important)
|
||||
struct termios config;
|
||||
tcgetattr(fd, &config);
|
||||
config.c_lflag = 0; // standard value is bad choosen
|
||||
|
||||
tcsetattr(fd, TCSANOW, &config);
|
||||
cout << "alles io" << endl;
|
||||
ssize_t length = read(fd, uintBuf, 24);
|
||||
if (length < 24) {
|
||||
|
||||
// read raw data to buffer
|
||||
ssize_t length = read(fd, uintBuf, 24);
|
||||
|
||||
// flush existing data
|
||||
if (length < 24) {
|
||||
tcflush(fd, TCIFLUSH);
|
||||
// length = read(fd, uintBuf, 24);
|
||||
}
|
||||
|
||||
while (!this->stop) {
|
||||
|
||||
Reference in New Issue
Block a user