fix: update usb connection; fix: added missing start lights
This commit is contained in:
@@ -59,6 +59,7 @@ set(helloworld_SRCS
|
||||
racelistgenerator.cpp
|
||||
datahelper.cpp
|
||||
colorwidget.cpp
|
||||
qrc_resource.cpp
|
||||
|
||||
mainwindow.ui
|
||||
windowrace.ui
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user