diff --git a/CMakeLists.txt b/CMakeLists.txt index ff1b2fe..deb4686 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ set(helloworld_SRCS racelistgenerator.cpp datahelper.cpp colorwidget.cpp + qrc_resource.cpp mainwindow.ui windowrace.ui @@ -69,7 +70,7 @@ set(helloworld_SRCS evaluation.ui ) # Tell CMake to create the helloworld executable -add_executable(Rennbahn ${helloworld_SRCS}) +add_executable(Rennbahn ${helloworld_SRCS} ) # Use the Widgets module from Qt 5 target_link_libraries(Rennbahn Qt5::Widgets Qt5::Core Qt5::Sql) diff --git a/hardwaresetup.cpp b/hardwaresetup.cpp index 217a4eb..713e51c 100644 --- a/hardwaresetup.cpp +++ b/hardwaresetup.cpp @@ -324,7 +324,7 @@ void HardwareSetup::run() { // prepare buffer struct TransCheck * received; - uint8_t uintBuf[4 * 6 + 2]; + uint8_t uintBuf[sizeof(struct TransCheck)]; void * voidBuf; // configure among others non-canonical mode (important) @@ -334,10 +334,10 @@ void HardwareSetup::run() { tcsetattr(fd, TCSANOW, &config); // read raw data to buffer - ssize_t length = read(fd, uintBuf, 24 + 2); + ssize_t length = read(fd, uintBuf, sizeof(struct TransCheck)); // flush existing data - if (length < 24) { + if (static_cast(length) < sizeof(struct TransCheck)) { tcflush(fd, TCIFLUSH); } @@ -345,7 +345,7 @@ void HardwareSetup::run() { // read data cout << "try to read data" << endl; - read(this->fd, uintBuf, 4 * 6 + 2); + read(this->fd, uintBuf, sizeof(struct TransCheck)); cout << "data read" << endl; voidBuf = static_cast(uintBuf); received = static_cast(voidBuf); @@ -354,7 +354,10 @@ void HardwareSetup::run() { for (int i = 0; i < 6; i++) { if (received->begin == '#' && received->end == '!') { - + cout << "i: " << i << " time: " + << static_cast(received->data[i].time) + << " update: " + << static_cast(received->data[i].update) << endl; if (received->data[i].update != 0) { switch (received->data[i].id) { case 0: @@ -386,7 +389,7 @@ void HardwareSetup::run() { 2); break; case 4: - cout << "Shell Zeit 2: " + cout << "Shell Zeit 3: " << static_cast(received->data[i].time) << endl; emit Shell(static_cast(received->data[i].time),