From 7cd8c8893ae6f5a4953e7461d66235acdf01eda9 Mon Sep 17 00:00:00 2001 From: Adrian Del Grosso <10929341+ad3154@users.noreply.github.com> Date: Sat, 28 Oct 2023 14:11:16 -0600 Subject: [PATCH] [NMEA2K]: Altered value change detection to ignore timestamp Fixed every NMEA2K message triggering a callback/event because the timestamp was being considered as something that changed. --- examples/nmea2000/fast_packet_protocol/CMakeLists.txt | 9 ++++++--- examples/nmea2000/nmea2000_generator/CMakeLists.txt | 9 ++++++--- examples/nmea2000/nmea2000_parser/CMakeLists.txt | 2 +- isobus/src/nmea2000_message_definitions.cpp | 10 +++++----- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/examples/nmea2000/fast_packet_protocol/CMakeLists.txt b/examples/nmea2000/fast_packet_protocol/CMakeLists.txt index 1a1374d4..83d1de9d 100644 --- a/examples/nmea2000/fast_packet_protocol/CMakeLists.txt +++ b/examples/nmea2000/fast_packet_protocol/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.16) project(fast_packet_protocol_example) -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - if(NOT BUILD_EXAMPLES) find_package(isobus REQUIRED) endif() @@ -11,6 +8,12 @@ find_package(Threads REQUIRED) add_executable(NMEA2KFastPacketTarget main.cpp) +set_target_properties( + NMEA2KFastPacketTarget + PROPERTIES CXX_STANDARD 14 + CXX_EXTENSIONS OFF + CXX_STANDARD_REQUIRED ON) + target_link_libraries( NMEA2KFastPacketTarget PRIVATE isobus::Isobus isobus::HardwareIntegration Threads::Threads isobus::Utility) diff --git a/examples/nmea2000/nmea2000_generator/CMakeLists.txt b/examples/nmea2000/nmea2000_generator/CMakeLists.txt index 31fa7c42..07338e13 100644 --- a/examples/nmea2000/nmea2000_generator/CMakeLists.txt +++ b/examples/nmea2000/nmea2000_generator/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.16) project(nmea2000_generator_example) -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - if(NOT BUILD_EXAMPLES) find_package(isobus REQUIRED) endif() @@ -11,6 +8,12 @@ find_package(Threads REQUIRED) add_executable(NMEA2KGeneratorTarget main.cpp) +set_target_properties( + NMEA2KGeneratorTarget + PROPERTIES CXX_STANDARD 14 + CXX_EXTENSIONS OFF + CXX_STANDARD_REQUIRED ON) + target_link_libraries( NMEA2KGeneratorTarget PRIVATE isobus::Isobus isobus::HardwareIntegration Threads::Threads isobus::Utility) diff --git a/examples/nmea2000/nmea2000_parser/CMakeLists.txt b/examples/nmea2000/nmea2000_parser/CMakeLists.txt index 5216cf85..69084ae1 100644 --- a/examples/nmea2000/nmea2000_parser/CMakeLists.txt +++ b/examples/nmea2000/nmea2000_parser/CMakeLists.txt @@ -9,7 +9,7 @@ find_package(Threads REQUIRED) add_executable(NMEA2KParserTarget main.cpp) set_target_properties( - NMEA2KExampleTarget + NMEA2KParserTarget PROPERTIES CXX_STANDARD 14 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON) diff --git a/isobus/src/nmea2000_message_definitions.cpp b/isobus/src/nmea2000_message_definitions.cpp index fb64ab5b..d68f94ec 100644 --- a/isobus/src/nmea2000_message_definitions.cpp +++ b/isobus/src/nmea2000_message_definitions.cpp @@ -143,7 +143,7 @@ namespace isobus retVal |= set_magnetic_deviation(receivedMessage.get_uint16_at(3)); retVal |= set_magnetic_variation(receivedMessage.get_uint16_at(5)); retVal |= set_sensor_reference(static_cast(receivedMessage.get_uint8_at(7) & 0x03)); - retVal |= set_timestamp(SystemTiming::get_timestamp_ms()); + set_timestamp(SystemTiming::get_timestamp_ms()); } else { @@ -234,7 +234,7 @@ namespace isobus turnRate |= (static_cast(receivedMessage.get_uint8_at(4)) << 24); retVal |= set_sequence_id(receivedMessage.get_uint8_at(0)); retVal |= set_rate_of_turn(turnRate); - retVal |= set_timestamp(SystemTiming::get_timestamp_ms()); + set_timestamp(SystemTiming::get_timestamp_ms()); } else { @@ -334,7 +334,7 @@ namespace isobus decodedLongitude |= (static_cast(receivedMessage.get_uint8_at(7)) << 24); retVal |= set_latitude(decodedLatitude); retVal |= set_longitude(decodedLongitude); - retVal |= set_timestamp(SystemTiming::get_timestamp_ms()); + set_timestamp(SystemTiming::get_timestamp_ms()); } else { @@ -452,7 +452,7 @@ namespace isobus retVal |= set_course_over_ground_reference(static_cast(receivedMessage.get_uint8_at(1) & 0x03)); retVal |= set_course_over_ground(receivedMessage.get_uint16_at(2)); retVal |= set_speed_over_ground(receivedMessage.get_uint16_at(4)); - retVal |= set_timestamp(SystemTiming::get_timestamp_ms()); + set_timestamp(SystemTiming::get_timestamp_ms()); } else { @@ -575,7 +575,7 @@ namespace isobus retVal |= set_time_delta(receivedMessage.get_uint8_at(1)); retVal |= set_latitude_delta(receivedMessage.get_uint24_at(2)); retVal |= set_longitude_delta(receivedMessage.get_uint24_at(5)); - retVal |= set_timestamp(SystemTiming::get_timestamp_ms()); + set_timestamp(SystemTiming::get_timestamp_ms()); } else {