changed more pointers to smart points

This commit is contained in:
2018-12-28 17:22:40 +01:00
parent 5229f5eec3
commit c2dc4b72a5
5 changed files with 37 additions and 22 deletions

View File

@@ -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 {