From f5ca825c2682d6d861e8511eadc6b7f765ccb26f Mon Sep 17 00:00:00 2001 From: Ryota Suzuki Date: Tue, 30 Jul 2019 12:43:19 +0900 Subject: [PATCH 1/2] add other serial communication options Otherwize, it can be happened that Operation "7" (0x07) turns to be "135" (0x87) --- src/serial.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/serial.cpp b/src/serial.cpp index 3894b9e..3717c70 100644 --- a/src/serial.cpp +++ b/src/serial.cpp @@ -21,7 +21,10 @@ namespace create { bool Serial::connect(const std::string& portName, const int& baud, boost::function cb) { using namespace boost::asio; port.open(portName); - port.set_option(serial_port::baud_rate(baud)); + port.set_option(serial_port::baud_rate(baud)); + port.set_option(serial_port::character_size(8)); + port.set_option(serial_port::parity(serial_port::parity::none)); + port.set_option(serial_port::stop_bits(serial_port::stop_bits::one)); port.set_option(serial_port::flow_control(serial_port::flow_control::none)); usleep(1000000); From 27946f8e995e2181f051d378e712d7f3e8911d18 Mon Sep 17 00:00:00 2001 From: Ryota Suzuki Date: Tue, 30 Jul 2019 12:53:35 +0900 Subject: [PATCH 2/2] add initializer of a variable for compiler compatibility --- src/serial_stream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/serial_stream.cpp b/src/serial_stream.cpp index aac3184..ccc70f5 100644 --- a/src/serial_stream.cpp +++ b/src/serial_stream.cpp @@ -5,7 +5,7 @@ namespace create { - SerialStream::SerialStream(boost::shared_ptr d, const uint8_t& header) : Serial(d), headerByte(header){ + SerialStream::SerialStream(boost::shared_ptr d, const uint8_t& header) : Serial(d), headerByte(header), readState(READ_HEADER){ } bool SerialStream::startSensorStream() {