More cleanup and fixes from testing failures

This commit is contained in:
Eric Katzfey
2023-07-20 15:43:07 -07:00
parent 9c5b1477d4
commit 81ab314a4c
7 changed files with 167 additions and 106 deletions
+32 -13
View File
@@ -1,3 +1,35 @@
/****************************************************************************
*
* Copyright (C) 2023 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#include <SerialImpl.hpp>
#include <string.h> // strncpy
@@ -132,8 +164,6 @@ ssize_t SerialImpl::read(uint8_t *buffer, size_t buffer_size)
if (ret_read < 0) {
PX4_DEBUG("%s read error %d", _port, ret_read);
} else {
_bytes_read += ret_read;
}
return ret_read;
@@ -216,8 +246,6 @@ ssize_t SerialImpl::write(const void *buffer, size_t buffer_size)
if (ret_write < 0) {
PX4_ERR("%s write error %d", _port, ret_write);
} else {
_bytes_written += ret_write;
}
return ret_write;
@@ -228,15 +256,6 @@ const char *SerialImpl::getPort() const
return _port;
}
bool SerialImpl::setPort(const char *port)
{
if (strcmp(port, _port) == 0) {
return true;
}
return false;
}
uint32_t SerialImpl::getBaudrate() const
{
return _baudrate;