diff --git a/apps/scout_monitor/src/ncolors.cpp b/apps/scout_monitor/src/ncolors.cpp index a3ea543..2d76168 100644 --- a/apps/scout_monitor/src/ncolors.cpp +++ b/apps/scout_monitor/src/ncolors.cpp @@ -54,6 +54,8 @@ short CursorColor(int fg) return (COLOR_YELLOW); case 7: /* 111 */ return (COLOR_WHITE); + default: + return COLOR_BLACK; } } } // namespace diff --git a/include/wrp_sdk/asyncio/async_serial.hpp b/include/wrp_sdk/asyncio/async_serial.hpp index 4c7e473..3dea233 100644 --- a/include/wrp_sdk/asyncio/async_serial.hpp +++ b/include/wrp_sdk/asyncio/async_serial.hpp @@ -23,7 +23,7 @@ class AsyncSerial : public AsyncListener, public std::enable_shared_from_this { public: using ReceiveCallback = - std::function; + std::function; public: AsyncSerial(std::string port_name, uint32_t baud_rate = 115200); @@ -56,7 +56,7 @@ class AsyncSerial : public AsyncListener, bool tx_in_progress_ = false; bool SetupPort(); - void DefaultReceiveCallback(uint8_t *data, size_t len, const size_t bufsize); + void DefaultReceiveCallback(uint8_t *data, const size_t bufsize, size_t len); void ReadFromPort(); void WriteToPort(bool check_if_busy); }; diff --git a/src/asyncio/async_serial.cpp b/src/asyncio/async_serial.cpp index 21104b6..1775f03 100644 --- a/src/asyncio/async_serial.cpp +++ b/src/asyncio/async_serial.cpp @@ -80,8 +80,8 @@ void AsyncSerial::StopService() { port_opened_ = false; } -void AsyncSerial::DefaultReceiveCallback(uint8_t *data, size_t len, - const size_t bufsize) {} +void AsyncSerial::DefaultReceiveCallback(uint8_t *data, const size_t bufsize, + size_t len) {} void AsyncSerial::ReadFromPort() { auto sthis = shared_from_this(); @@ -93,9 +93,13 @@ void AsyncSerial::ReadFromPort() { return; } - if (sthis->rcv_cb_ != nullptr) - sthis->rcv_cb_(sthis->rx_buf_.data(), bytes_transferred, - sthis->rx_buf_.size()); + if (sthis->rcv_cb_ != nullptr) { + sthis->rcv_cb_(sthis->rx_buf_.data(), sthis->rx_buf_.size(), + bytes_transferred); + } else { + sthis->DefaultReceiveCallback( + sthis->rx_buf_.data(), sthis->rx_buf_.size(), bytes_transferred); + } sthis->ReadFromPort(); }); }