From b2845c60d3c8ff93578526f6dbdb24574ae41eee Mon Sep 17 00:00:00 2001 From: TSC21 Date: Thu, 16 Jul 2020 19:18:48 +0100 Subject: [PATCH] microRTPS: move buffer size to transport --- msg/templates/urtps/microRTPS_agent.cpp.em | 2 -- msg/templates/urtps/microRTPS_transport.cpp | 2 -- msg/templates/urtps/microRTPS_transport.h | 5 ++++- .../micrortps_bridge/micrortps_client/microRTPS_client.h | 1 - 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/msg/templates/urtps/microRTPS_agent.cpp.em b/msg/templates/urtps/microRTPS_agent.cpp.em index 321e1863e0..ba59e47d00 100644 --- a/msg/templates/urtps/microRTPS_agent.cpp.em +++ b/msg/templates/urtps/microRTPS_agent.cpp.em @@ -73,8 +73,6 @@ recv_topics = [(alias[idx] if alias[idx] else s.short_name) for idx, s in enumer #include "microRTPS_timesync.h" #include "RtpsTopics.h" -#define BUFFER_SIZE 1024 - // Default values #define DEVICE "/dev/ttyACM0" #define SLEEP_US 1 diff --git a/msg/templates/urtps/microRTPS_transport.cpp b/msg/templates/urtps/microRTPS_transport.cpp index 1505e92569..0d6b0c241c 100644 --- a/msg/templates/urtps/microRTPS_transport.cpp +++ b/msg/templates/urtps/microRTPS_transport.cpp @@ -43,8 +43,6 @@ #include "microRTPS_transport.h" -#define DEFAULT_UART "/dev/ttyACM0" - /** CRC table for the CRC-16. The poly is 0x8005 (x^16 + x^15 + x^2 + 1) */ uint16_t const crc16_table[256] = { 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, diff --git a/msg/templates/urtps/microRTPS_transport.h b/msg/templates/urtps/microRTPS_transport.h index afc5b90a28..f179c4c863 100644 --- a/msg/templates/urtps/microRTPS_transport.h +++ b/msg/templates/urtps/microRTPS_transport.h @@ -38,6 +38,9 @@ #include #include +#define BUFFER_SIZE 1024 +#define DEFAULT_UART "/dev/ttyACM0" + class Transport_node { public: @@ -74,7 +77,7 @@ protected: protected: uint32_t rx_buff_pos; - char rx_buffer[1024] = {}; + char rx_buffer[BUFFER_SIZE] = {}; private: struct __attribute__((packed)) Header { diff --git a/src/modules/micrortps_bridge/micrortps_client/microRTPS_client.h b/src/modules/micrortps_bridge/micrortps_client/microRTPS_client.h index 856c369f19..685a8a45ca 100644 --- a/src/modules/micrortps_bridge/micrortps_client/microRTPS_client.h +++ b/src/modules/micrortps_bridge/micrortps_client/microRTPS_client.h @@ -49,7 +49,6 @@ #include #include -#define BUFFER_SIZE 1024 #define LOOPS -1 #define SLEEP_MS 1 #define BAUDRATE 460800