From 16bbc0fab37bc45f9051f250745c2d9330a2a6cb Mon Sep 17 00:00:00 2001 From: Adrian Del Grosso <10929341+ad3154@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:56:42 -0600 Subject: [PATCH] Fixed various compilation warnings on mac Increased size of milliseconds in time/date interface which could have been truncated. Removed some unused variables. Added some missing "override" keywords. Replaced "0b" with hex, since 0b is a C++14 extension. --- examples/seeder_example/vt_application.hpp | 2 -- .../section_control_implement_sim.cpp | 2 +- .../isobus/isobus_time_date_interface.hpp | 2 +- ..._virtual_terminal_client_state_tracker.hpp | 2 +- isobus/src/isobus_time_date_interface.cpp | 2 +- test/can_message_tests.cpp | 2 +- test/tc_server_tests.cpp | 22 +++++++++---------- test/transport_protocol_tests.cpp | 2 +- 8 files changed, 17 insertions(+), 19 deletions(-) diff --git a/examples/seeder_example/vt_application.hpp b/examples/seeder_example/vt_application.hpp index a10ec9e8c..1e7e8ec3f 100644 --- a/examples/seeder_example/vt_application.hpp +++ b/examples/seeder_example/vt_application.hpp @@ -136,9 +136,7 @@ class SeederVtApplication isobus::SpeedMessagesInterface speedMessages; ///< Interface for reading speed from the bus std::shared_ptr ddop = nullptr; ///< Stores our application's DDOP std::uint32_t slowUpdateTimestamp_ms = 0; ///< A timestamp to limit some polled data to 1Hz update rate - std::uint32_t lastMachineSpeed = 0; ///< Used to help track speed source timeouts bool languageDataRequested = false; ///< Stores if we've requested the current language data yet - bool alarmsEnabled = true; ///< Enables or disables showing alarms }; #endif // VT_APPLICATION_HPP diff --git a/examples/task_controller_client/section_control_implement_sim.cpp b/examples/task_controller_client/section_control_implement_sim.cpp index e429071ce..5f0c115b8 100644 --- a/examples/task_controller_client/section_control_implement_sim.cpp +++ b/examples/task_controller_client/section_control_implement_sim.cpp @@ -79,7 +79,7 @@ bool SectionControlImplementSimulator::create_ddop(std::shared_ptrclear(); // English, decimal point, 12 hour time, ddmmyyyy, all units imperial - constexpr std::array localizationData = { 'e', 'n', 0b01010000, 0x00, 0b01010101, 0b01010101, 0xFF }; + constexpr std::array localizationData = { 'e', 'n', 0x50, 0x00, 0x55, 0x55, 0xFF }; // Make a test pool as a 120ft sprayer with 16 sections, 1 liquid product // Set up device diff --git a/isobus/include/isobus/isobus/isobus_time_date_interface.hpp b/isobus/include/isobus/isobus/isobus_time_date_interface.hpp index fefc14397..7e9e5c5d0 100644 --- a/isobus/include/isobus/isobus/isobus_time_date_interface.hpp +++ b/isobus/include/isobus/isobus/isobus_time_date_interface.hpp @@ -33,7 +33,7 @@ namespace isobus /// We store it slightly differently than the PGN to make it easier to work with. struct TimeAndDate { - std::uint8_t milliseconds = 0; ///< Number of milliseconds. This has resolution of 0.25s, so it will be either 0, 250, 500, or 750 + std::uint16_t milliseconds = 0; ///< Number of milliseconds. This has resolution of 0.25s, so it will be either 0, 250, 500, or 750 std::uint8_t seconds = 0; ///< Number of seconds, range: 0 to 59s std::uint8_t minutes = 0; ///< Number of minutes, range: 0 to 59m std::uint8_t hours = 0; ///< Number of hours, range: 0 to 23h diff --git a/isobus/include/isobus/isobus/isobus_virtual_terminal_client_state_tracker.hpp b/isobus/include/isobus/isobus/isobus_virtual_terminal_client_state_tracker.hpp index e58f11c4b..c2fa4b1cb 100644 --- a/isobus/include/isobus/isobus/isobus_virtual_terminal_client_state_tracker.hpp +++ b/isobus/include/isobus/isobus/isobus_virtual_terminal_client_state_tracker.hpp @@ -80,7 +80,7 @@ namespace isobus /// @param[in] dataOrAlarmMaskId The data/alarm mask to remove the soft key mask from tracking for. void remove_tracked_soft_key_mask(std::uint16_t dataOrAlarmMaskId); - /// @brief Get the soft key mask currently active on thse server for this client. It may not be displayed if the working set is not active. + /// @brief Get the soft key mask currently active on the server for this client. It may not be displayed if the working set is not active. /// @return The soft key mask currently active on the server for this client. std::uint16_t get_active_soft_key_mask() const; diff --git a/isobus/src/isobus_time_date_interface.cpp b/isobus/src/isobus_time_date_interface.cpp index 392e45839..887701e2a 100644 --- a/isobus/src/isobus_time_date_interface.cpp +++ b/isobus/src/isobus_time_date_interface.cpp @@ -146,7 +146,7 @@ namespace isobus timeAndDateInformation.controlFunction = message.get_source_control_function(); timeAndDateInformation.timeAndDate.seconds = message.get_uint8_at(0) / 4; // This is SPN 959 - timeAndDateInformation.timeAndDate.milliseconds = (message.get_uint8_at(0) % 4) * 250; // This is also part of SPN 959 + timeAndDateInformation.timeAndDate.milliseconds = static_cast((message.get_uint8_at(0) % 4) * 250); // This is also part of SPN 959 timeAndDateInformation.timeAndDate.minutes = message.get_uint8_at(1); // This is SPN 960 timeAndDateInformation.timeAndDate.hours = message.get_uint8_at(2); // This is SPN 961 timeAndDateInformation.timeAndDate.month = message.get_uint8_at(3); // This is SPN 963 diff --git a/test/can_message_tests.cpp b/test/can_message_tests.cpp index 0f42be7ea..616108f42 100644 --- a/test/can_message_tests.cpp +++ b/test/can_message_tests.cpp @@ -14,7 +14,7 @@ using namespace isobus; std::uint64_t value64; std::uint16_t value16; -void callback(const CANMessage &message, void *parent) +void callback(const CANMessage &message, void *) { value16 = message.get_int16_at(0); EXPECT_EQ(value16, 513); diff --git a/test/tc_server_tests.cpp b/test/tc_server_tests.cpp index 2daa46ff2..cb3c37722 100644 --- a/test/tc_server_tests.cpp +++ b/test/tc_server_tests.cpp @@ -204,55 +204,55 @@ class DerivedTcServer : public TaskControllerServer return !failActivations; } - bool change_designator(std::shared_ptr, std::uint16_t, const std::vector &) + bool change_designator(std::shared_ptr, std::uint16_t, const std::vector &) override { return true; } - bool deactivate_object_pool(std::shared_ptr) + bool deactivate_object_pool(std::shared_ptr) override { return true; } - bool delete_device_descriptor_object_pool(std::shared_ptr, ObjectPoolDeletionErrors &) + bool delete_device_descriptor_object_pool(std::shared_ptr, ObjectPoolDeletionErrors &) override { return true; } - bool get_is_stored_device_descriptor_object_pool_by_structure_label(std::shared_ptr, const std::vector &, const std::vector &) + bool get_is_stored_device_descriptor_object_pool_by_structure_label(std::shared_ptr, const std::vector &, const std::vector &) override { return !testStructureLabel.empty(); } - bool get_is_stored_device_descriptor_object_pool_by_localization_label(std::shared_ptr, const std::array &) + bool get_is_stored_device_descriptor_object_pool_by_localization_label(std::shared_ptr, const std::array &) override { return 0 != testLocalizationLabel.at(0); } - bool get_is_enough_memory_available(std::uint32_t) + bool get_is_enough_memory_available(std::uint32_t) override { return enoughMemory; } - void identify_task_controller(std::uint8_t tcNumber) + void identify_task_controller(std::uint8_t tcNumber) override { identifyTC = tcNumber; } - void on_client_timeout(std::shared_ptr) + void on_client_timeout(std::shared_ptr) override { } - void on_process_data_acknowledge(std::shared_ptr, std::uint16_t, std::uint16_t, std::uint8_t, ProcessDataCommands) + void on_process_data_acknowledge(std::shared_ptr, std::uint16_t, std::uint16_t, std::uint8_t, ProcessDataCommands) override { } - bool on_value_command(std::shared_ptr, std::uint16_t, std::uint16_t, std::int32_t, std::uint8_t &) + bool on_value_command(std::shared_ptr, std::uint16_t, std::uint16_t, std::int32_t, std::uint8_t &) override { return true; } - bool store_device_descriptor_object_pool(std::shared_ptr, const std::vector &, bool) + bool store_device_descriptor_object_pool(std::shared_ptr, const std::vector &, bool) override { return true; } diff --git a/test/transport_protocol_tests.cpp b/test/transport_protocol_tests.cpp index 1e52223be..8052092e2 100644 --- a/test/transport_protocol_tests.cpp +++ b/test/transport_protocol_tests.cpp @@ -1136,7 +1136,7 @@ TEST(TRANSPORT_PROTOCOL_TESTS, DestinationSpecificConcurrentMessaging) std::uint32_t pgnToCheck; const std::uint8_t *dataToCheck; - std::size_t dataLengthToCheck; + std::size_t dataLengthToCheck = 0; if ((message.get_destination_control_function() == receiver1) || (message.get_source_control_function() == originator1)) {