From 444623e2ae8268c153ee26b83cc6f4e3c6fcbc6e Mon Sep 17 00:00:00 2001 From: "Rentschler, Andreas" Date: Wed, 13 May 2026 18:38:14 +0200 Subject: [PATCH] SILKIT-1966 LIN service: put master to sleep only after sleep frame received in detailed simulation Signed-off-by: Rentschler, Andreas --- SilKit/source/services/lin/LinController.cpp | 14 ++++++++++---- docs/changelog/versions/latest.md | 5 +++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/SilKit/source/services/lin/LinController.cpp b/SilKit/source/services/lin/LinController.cpp index 3952f7eab..48777b6ae 100644 --- a/SilKit/source/services/lin/LinController.cpp +++ b/SilKit/source/services/lin/LinController.cpp @@ -515,11 +515,9 @@ void LinController::GoToSleep() return; } - // Detailed: Send LinSendFrameRequest with GoToSleep-Frame and set LinControllerStatus::SleepPending. BusSim will trigger LinTransmission. + // Detailed: Send LinSendFrameRequest with GoToSleep-Frame and set LinControllerStatus::SleepPending. BusSim will trigger LinTransmission. Sleep after frame is received. // Trivial: Directly send LinTransmission with GoToSleep-Frame and call GoToSleepInternal() on this controller. _simulationBehavior.GoToSleep(); - - _controllerStatus = LinControllerStatus::Sleep; } void LinController::GoToSleepInternal() @@ -784,11 +782,19 @@ void LinController::ReceiveMsg(const IServiceEndpoint* from, const LinTransmissi // Dispatch GoToSleep frames to dedicated handlers if (isGoToSleepFrame) { - // only call GoToSleepHandlers for slaves, i.e., not for the master that issued the GoToSleep command. if (_controllerMode == LinControllerMode::Slave) { + // Only call GoToSleepHandlers for slaves, i.e., not for the master that issued the GoToSleep command. CallHandlers(LinGoToSleepEvent{msg.timestamp}); } + // Detailed: Go to sleep after go-to-sleep frame was received by master + else if (_controllerMode == LinControllerMode::Master) + { + if (_controllerStatus == LinControllerStatus::SleepPending) + { + _controllerStatus = LinControllerStatus::Sleep; + } + } } } diff --git a/docs/changelog/versions/latest.md b/docs/changelog/versions/latest.md index 6992b924f..5691ab6de 100644 --- a/docs/changelog/versions/latest.md +++ b/docs/changelog/versions/latest.md @@ -1,5 +1,10 @@ # [5.0.5] - UNRELEASED +## Fixed + +- `lin`: fixed missing reception of the Go-To-Sleep frame by the master after `GoToSleep()` in detailed simulation + + ## Changed - `cmake`: merged almost all internal CMake `INTERFACE` libraries into `I_SilKit`