diff --git a/.gitignore b/.gitignore index f384d63..ea865e6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,8 @@ src/C++/progr src/C++/Driver/odometry.txt src/C++/Driver/CMakeCache.txt src/C++/Driver/kobuki_control +src/C++/Driver/cmake_install.cmake +src/C++/Driver/vgcore.42436 +src/C++/Driver/vgcore.42611 +src/Socket/a.out +src/C++/Driver/cmake_install.cmake diff --git a/src/C++/Driver/cmake_install.cmake b/src/C++/Driver/cmake_install.cmake index 45179d9..fced060 100644 --- a/src/C++/Driver/cmake_install.cmake +++ b/src/C++/Driver/cmake_install.cmake @@ -12,7 +12,7 @@ if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") else() - set(CMAKE_INSTALL_CONFIG_NAME "") + set(CMAKE_INSTALL_CONFIG_NAME "DEBUG") endif() message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") endif() diff --git a/src/C++/Socket/a.out b/src/C++/Socket/a.out new file mode 100755 index 0000000..457375b Binary files /dev/null and b/src/C++/Socket/a.out differ diff --git a/src/Socket/main.cpp b/src/C++/Socket/main.cpp similarity index 100% rename from src/Socket/main.cpp rename to src/C++/Socket/main.cpp diff --git a/src/C++/main.cpp b/src/C++/main.cpp deleted file mode 100644 index d9f9787..0000000 --- a/src/C++/main.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//before running set right baudrate -//sudo stty -F /dev/ttyUSB0 speed 115200 cs8 -cstopb -parenb -//TODO: Fix the first output of the buffer -#include -#include -#include -#include -#include - - -int main() { - char byte; - bool foundAA = false; - std::vector buffer; - std::ifstream f("/dev/ttyUSB0", std::ios::binary); - if (!f.is_open()) { - std::cerr << "Failed to open the file" << std::endl; - return 1; - } - - while (f.read(&byte, 1)) { - unsigned char ubyte = static_cast(byte); - buffer.push_back(ubyte); - if (foundAA) { - if (ubyte == 0b01010101) { // 0x55 - std::cout << "Found 0xAA followed by 0x55" << std::endl; - // std::cout << "Buffer size" << buffer.size() << std::endl << std::endl; - // Print the buffer in hex values - for (int i = 0; i < 4; i++) { - std::cout << "0x" << std::hex << std::setw(2) << std::setfill('0') << static_cast(static_cast(buffer[i])) << " "; - } - //reset buffer after new 0XAA and 0x55 is found - buffer.clear(); - foundAA = false; // Reset the state - if (ubyte == 0b10101010) - foundAA = true; - } else { - foundAA = false; // Reset the state if the next byte is not 0x55 - } - } else if (ubyte == 0b10101010) { // 0xAA - foundAA = true; - } - - - } - - f.close(); - return 0; -} - - - -//Tomorrow -//Try to use vectors and store every byte in its own array object by dividing the buffer into 8 bits - - - - -//Tomorrow -//Try to use vectors and store every byte in its own array object by dividing the buffer into 8 bits \ No newline at end of file diff --git a/src/C++/main.o b/src/C++/main.o deleted file mode 100644 index d2cd5c5..0000000 Binary files a/src/C++/main.o and /dev/null differ diff --git a/src/C++/makefile b/src/C++/makefile deleted file mode 100644 index af7de6e..0000000 --- a/src/C++/makefile +++ /dev/null @@ -1,18 +0,0 @@ -#clean this up for seperate build folder -CPPFLAGS = -Wall -I./include -CC=g++ - -#target : main.o -# g++ * -Wall -progr: main.o - $(CC) $^ $(CPPFLAGS) -o progr #S^ stands for all dependencies - @echo "ready" - -main.o: main.cpp #may be omitted (implicit rule) - $(CC) $(CPPFLAGS) -c -o main.o main.cpp - -clean: - rm progr - rm *.o - - diff --git a/src/C++/progr b/src/C++/progr deleted file mode 100755 index 4984e9b..0000000 Binary files a/src/C++/progr and /dev/null differ