fix: update usb connection; fix: added missing start lights

This commit is contained in:
2018-12-27 17:21:08 +01:00
parent 12fd6da5f4
commit 954ed988ab
2 changed files with 11 additions and 7 deletions

View File

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

View File

@@ -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<unsigned long>(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<void *>(uintBuf);
received = static_cast<struct TransCheck *>(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<int>(received->data[i].time)
<< " update: "
<< static_cast<int>(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<int>(received->data[i].time)
<< endl;
emit Shell(static_cast<int>(received->data[i].time),