changed more pointers to smart points
This commit is contained in:
@@ -313,6 +313,7 @@ void HardwareSetup::run() {
|
||||
} // end HARDWARE_VERSION 2
|
||||
|
||||
else if (HARDWARE_VERSION == 3) {
|
||||
uint8_t dummy[sizeof(struct TransCheck)] = {0};
|
||||
|
||||
fd = open(PORT_PATH, O_RDONLY);
|
||||
while (this->fd < 0) {
|
||||
@@ -360,8 +361,8 @@ void HardwareSetup::run() {
|
||||
|
||||
usleep(50000); // 150ms
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (received->begin == '#' && received->end == '!') {
|
||||
if (received->begin == '#' && received->end == '!') {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
cout << "i: " << i << " time: "
|
||||
<< static_cast<int>(received->data[i].time)
|
||||
<< " update: "
|
||||
@@ -412,12 +413,16 @@ void HardwareSetup::run() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // dataframe ok
|
||||
else {
|
||||
// dataframe not ok
|
||||
tcflush(fd, TCIFLUSH);
|
||||
}
|
||||
} // dataframe ok
|
||||
else {
|
||||
// dataframe not ok
|
||||
tcflush(fd, TCIFLUSH);
|
||||
}
|
||||
|
||||
// overwrite received data to prevent same data gets read one more
|
||||
// time; dummy data is array of zeros
|
||||
memcpy(received.get(), dummy, sizeof(struct TransCheck));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user