From 397e6fe33150ae069a86eb432bc9644491c4ec98 Mon Sep 17 00:00:00 2001 From: Tim Zeuner Date: Thu, 23 Feb 2023 20:39:28 +0100 Subject: [PATCH] Let signals to stop always pass --- Communication/uart_communication.cpp | 4 ++-- Communication/uart_communication.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Communication/uart_communication.cpp b/Communication/uart_communication.cpp index 46edb81..b310111 100644 --- a/Communication/uart_communication.cpp +++ b/Communication/uart_communication.cpp @@ -16,7 +16,7 @@ void LFR_UART::openFile(const char *fileName) { int LFR_UART::writeDataToFile(int8_t *buff, uint32_t bufferLength) { //std::cout << "Sending uart: " << std::bitset<8>(buff[0]) << std::endl; - std::cout << "Sending uart: " << std::bitset<8>(buff[0]) << ", " << std::bitset<8>(buff[1]) << ", " << std::bitset<8>(buff[2]) << ", " << std::bitset<8>(buff[3]) << " csum: " << std::bitset<8>(buff[4]) << std::endl; + std::cout << "Sending Uart: " << std::bitset<8>(buff[0]) << ", " << std::bitset<8>(buff[1]) << ", " << std::bitset<8>(buff[2]) << ", " << std::bitset<8>(buff[3]) << " csum: " << std::bitset<8>(buff[4]) << std::endl; return write(this->fileDescriptor, buff, bufferLength); } @@ -66,7 +66,7 @@ double LFR_UART::byteToDouble(int8_t in){ void LFR_UART::sendTelegram(double wheel1, double wheel2, double wheel3, double wheel4){ std::chrono::milliseconds now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()); unsigned int deltaMs = static_cast((now-last).count()); - if (deltaMs < 250) + if (deltaMs < 250 && (std::fabs(wheel1)+std::fabs(wheel2)+std::fabs(wheel3)+std::fabs(wheel4)) > 0.0005) { std::cout << "Too fast" << std::endl; return; diff --git a/Communication/uart_communication.h b/Communication/uart_communication.h index 6c84a7f..42086c9 100644 --- a/Communication/uart_communication.h +++ b/Communication/uart_communication.h @@ -12,6 +12,7 @@ #include #include #include +#include #include