diff --git a/drv/b15f.cpp b/drv/b15f.cpp index a76e5a2..582b947 100644 --- a/drv/b15f.cpp +++ b/drv/b15f.cpp @@ -10,7 +10,7 @@ void B15F::init() { std::cout << PRE << "Stelle Verbindung mit Adapter her... " << std::flush; - int code = system(std::string("stty 38400 -F " + SERIAL_DEVICE).c_str()); + int code = system(std::string("stty " + std::to_string(BAUDRATE) + " -F " + SERIAL_DEVICE).c_str()); if(code) { throw DriverException("Konnte serielle Verbindung nicht initialisieren. Ist der Adapter angeschlossen?"); @@ -19,11 +19,11 @@ void B15F::init() usart = open(SERIAL_DEVICE.c_str(), O_RDWR | O_NOCTTY | O_NDELAY); struct termios options; tcgetattr(usart, &options); - options.c_cflag = baudrate | CS8 | CLOCAL | CREAD; options.c_iflag = IGNPAR; options.c_oflag = 0; options.c_lflag = 0; - options.c_cc[VTIME]=30; + options.c_cc[VTIME]=1; // timeout in Dezisekunden + cfsetspeed(&options, BAUDRATE); tcsetattr(usart, TCSANOW, &options); tcflush(usart, TCIFLUSH); diff --git a/drv/b15f.h b/drv/b15f.h index d2c187c..65d0c53 100644 --- a/drv/b15f.h +++ b/drv/b15f.h @@ -49,7 +49,6 @@ public: private: int usart = -1; - uint32_t baudrate = 38400; uint16_t timeout = 1000; static B15F* instance; @@ -61,6 +60,7 @@ private: constexpr static uint8_t MSG_FAIL = 0xFE; constexpr static uint16_t RECONNECT_TIMEOUT = 32; // ms constexpr static uint8_t RECONNECT_TRIES = 3; + constexpr static uint32_t BAUDRATE = 115200; // REQUESTS constexpr static uint8_t RQ_DISC = 0; diff --git a/drv/b15f.o b/drv/b15f.o index fd40214..6a2d547 100644 Binary files a/drv/b15f.o and b/drv/b15f.o differ diff --git a/main b/main index 9f0ce44..9ffffd5 100755 Binary files a/main and b/main differ