diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 0e45fe1f..f34c8aba 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -27,7 +27,7 @@ jobs: sudo apt-get install python3.6 -y sudo rm /usr/bin/python3 sudo ln -s /usr/bin/python3.6 /usr/bin/python3 - wget https://bootstrap.pypa.io/get-pip.py + wget https://bootstrap.pypa.io/pip/3.6/get-pip.py sudo python3 get-pip.py sudo apt-get install -qq -y libsubunit-dev sudo apt-get install python-apt diff --git a/src/pipeline.cpp b/src/pipeline.cpp index f2c8ad8d..f9c84abd 100644 --- a/src/pipeline.cpp +++ b/src/pipeline.cpp @@ -194,6 +194,14 @@ void openxc::pipeline::publish(openxc_VehicleMessage* message, } else { debug("Trying to serialize unrecognized type: %d", message->type); } + + // Send a SYNC Message Jan 2022!!! + + static int msgCounter = 0; + if ((msgCounter & 0x3f) == 0x3f) { // Send a sync message every 63 messages + sendSyncMessage(pipeline); + } + msgCounter++; } void openxc::pipeline::sendMessage(Pipeline* pipeline, uint8_t* message, @@ -314,3 +322,14 @@ void openxc::pipeline::logStatistics(Pipeline* pipeline) { } } } + + +void openxc::pipeline::sendSyncMessage(Pipeline* pipeline) { + unsigned char syncMessagePayload[] = {0x07, 'S', 'Y', 'N', 'C', 'M', 'S', 'G' }; + + MessageClass messageClass = MessageClass::CAN; + + sendMessage(pipeline, syncMessagePayload, sizeof(syncMessagePayload), messageClass); + debug("Sent Sync Message"); + +} diff --git a/src/pipeline.h b/src/pipeline.h index fc93fa16..d4cbdc57 100644 --- a/src/pipeline.h +++ b/src/pipeline.h @@ -97,6 +97,7 @@ void sendMessage(Pipeline* pipeline, uint8_t* message, int messageSize, void process(Pipeline* pipeline); void logStatistics(Pipeline* pipeline); +void sendSyncMessage(Pipeline* pipeline); } // namespace interface } // namespace openxc