code cleanup
This commit is contained in:
@@ -14,6 +14,8 @@ find_package(Qt5Widgets CONFIG REQUIRED)
|
||||
|
||||
find_package(Qt5Sql REQUIRED)
|
||||
|
||||
|
||||
|
||||
# Populate a CMake variable with the sources
|
||||
set(helloworld_SRCS
|
||||
main.cpp
|
||||
@@ -27,6 +29,8 @@ set(helloworld_SRCS
|
||||
database.cpp
|
||||
windowrennliste.cpp
|
||||
training.cpp
|
||||
timemodel.cpp
|
||||
qvectorhelper.cpp
|
||||
|
||||
mainwindow.ui
|
||||
windowrace.ui
|
||||
@@ -36,5 +40,6 @@ set(helloworld_SRCS
|
||||
)
|
||||
# Tell CMake to create the helloworld executable
|
||||
add_executable(Rennbahn ${helloworld_SRCS})
|
||||
|
||||
# Use the Widgets module from Qt 5
|
||||
target_link_libraries(Rennbahn Qt5::Widgets Qt5::Core Qt5::Sql)
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
#include <string.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <usb.h>
|
||||
#ifdef ATMEGA
|
||||
#include <usb.h>
|
||||
#endif
|
||||
|
||||
#define USB_LED_ON 1
|
||||
#define USB_LED_OFF 0
|
||||
@@ -32,7 +34,9 @@ HardwareSetup::HardwareSetup() {
|
||||
// //perror("ioperm");
|
||||
// }
|
||||
this->stop = 0;
|
||||
#ifdef ATMEGA
|
||||
this->handle = nullptr;
|
||||
#endif
|
||||
this->fd = 0;
|
||||
}
|
||||
void HardwareSetup::setStop() {
|
||||
@@ -48,10 +52,12 @@ HardwareSetup::~HardwareSetup() {
|
||||
this->stop = 1;
|
||||
|
||||
if (HARDWARE_VERSION == 2) {
|
||||
#ifdef ATMEGA
|
||||
if (this->handle) {
|
||||
usb_close(this->handle);
|
||||
}
|
||||
this->handle = NULL;
|
||||
#endif
|
||||
}
|
||||
else if (HARDWARE_VERSION == 3) {
|
||||
// close filedescriptor
|
||||
@@ -63,6 +69,7 @@ HardwareSetup::~HardwareSetup() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef ATMEGA
|
||||
|
||||
/* Used to get descriptor strings for device identification */
|
||||
int HardwareSetup::usbGetDescriptorString(usb_dev_handle * dev, int index,
|
||||
@@ -158,12 +165,14 @@ usb_dev_handle * HardwareSetup::usbOpenDevice(int vendor, char * vendorName,
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
void HardwareSetup::run() {
|
||||
|
||||
struct TransStruct buffer[6];
|
||||
|
||||
if (HARDWARE_VERSION == 2) {
|
||||
#ifdef ATMEGA
|
||||
int testmode = 0;
|
||||
|
||||
int nBytes = 0;
|
||||
@@ -300,7 +309,9 @@ void HardwareSetup::run() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} // end HARDWARE_VERSION 2
|
||||
|
||||
else if (HARDWARE_VERSION == 3) {
|
||||
|
||||
fd = open(PORT_PATH, O_RDONLY);
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <usb.h>
|
||||
|
||||
#ifdef ATMEGA
|
||||
#include <usb.h>
|
||||
#endif
|
||||
struct TransStruct {
|
||||
uint16_t time;
|
||||
uint8_t id;
|
||||
@@ -21,17 +22,19 @@ class HardwareSetup : public QThread {
|
||||
private:
|
||||
bool shellBefore;
|
||||
bool deaBefore;
|
||||
#ifdef ATMEGA
|
||||
usb_dev_handle * handle;
|
||||
int usbGetDescriptorString(usb_dev_handle * dev, int index, int langid,
|
||||
char * buf, int buflen);
|
||||
usb_dev_handle * usbOpenDevice(int vendor, char * vendorName, int product,
|
||||
char * productName);
|
||||
#endif
|
||||
int fd;
|
||||
|
||||
bool getShell();
|
||||
bool getDea();
|
||||
int * findBit(int * array, int zahl);
|
||||
bool stop;
|
||||
int usbGetDescriptorString(usb_dev_handle * dev, int index, int langid,
|
||||
char * buf, int buflen);
|
||||
usb_dev_handle * usbOpenDevice(int vendor, char * vendorName, int product,
|
||||
char * productName);
|
||||
|
||||
public:
|
||||
void setStop();
|
||||
|
||||
Reference in New Issue
Block a user