Reorganisation

This commit is contained in:
2024-09-24 15:10:42 +02:00
parent 4bef1a61fe
commit 92ca442431
8 changed files with 6 additions and 79 deletions

5
.gitignore vendored
View File

@@ -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

View File

@@ -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()

BIN
src/C++/Socket/a.out Executable file

Binary file not shown.

View File

@@ -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 <fstream>
#include <iostream>
#include <cstring>
#include <vector>
#include <iomanip>
int main() {
char byte;
bool foundAA = false;
std::vector<char> 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<unsigned char>(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<int>(static_cast<unsigned char>(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

Binary file not shown.

View File

@@ -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

Binary file not shown.