From d75d41c63843581cfd113fd8ceac976d65bc06b4 Mon Sep 17 00:00:00 2001 From: Swapnil Patel Date: Mon, 27 Jun 2022 22:42:24 -0400 Subject: [PATCH] address warnings and errors --- include/create/serial_query.h | 1 + include/create/serial_stream.h | 1 + src/create.cpp | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/create/serial_query.h b/include/create/serial_query.h index b6b372b..ebd876a 100644 --- a/include/create/serial_query.h +++ b/include/create/serial_query.h @@ -68,6 +68,7 @@ namespace create { public: SerialQuery(std::shared_ptr data, bool install_signal_handler = true); + virtual ~SerialQuery() = default; }; } // namespace create diff --git a/include/create/serial_stream.h b/include/create/serial_stream.h index 2f21892..eeb2cb6 100644 --- a/include/create/serial_stream.h +++ b/include/create/serial_stream.h @@ -73,6 +73,7 @@ namespace create { std::shared_ptr data, const uint8_t& header = create::util::STREAM_HEADER, bool install_signal_handler = true); + virtual ~SerialStream() = default; }; } // namespace create diff --git a/src/create.cpp b/src/create.cpp index 21f71be..0517b4a 100644 --- a/src/create.cpp +++ b/src/create.cpp @@ -160,10 +160,10 @@ namespace create { prevTicksRight = totalTicksRight; // Handle wrap around - if (fabs(ticksLeft) > 0.9 * util::V_3_MAX_ENCODER_TICKS) { + if (std::abs(ticksLeft) > 0.9 * util::V_3_MAX_ENCODER_TICKS) { ticksLeft = (ticksLeft % util::V_3_MAX_ENCODER_TICKS) + 1; } - if (fabs(ticksRight) > 0.9 * util::V_3_MAX_ENCODER_TICKS) { + if (std::abs(ticksRight) > 0.9 * util::V_3_MAX_ENCODER_TICKS) { ticksRight = (ticksRight % util::V_3_MAX_ENCODER_TICKS) + 1; } @@ -373,7 +373,7 @@ namespace create { min > 59) return false; - uint8_t cmd[4] = { OC_DATE, day, hour, min }; + uint8_t cmd[4] = { OC_DATE, static_cast(day), hour, min }; return serial->send(cmd, 4); }