From 94f5f5a382315444cad05022251c5f963cbddf6d Mon Sep 17 00:00:00 2001 From: marios8543 Date: Tue, 13 May 2025 02:08:40 +0300 Subject: [PATCH] fix button injection --- openauto/Service/InputService.cpp | 2 +- openauto/Service/ServiceFactory.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/openauto/Service/InputService.cpp b/openauto/Service/InputService.cpp index 9a0a502..e1c3733 100644 --- a/openauto/Service/InputService.cpp +++ b/openauto/Service/InputService.cpp @@ -169,7 +169,7 @@ void InputService::sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonC if(buttonCode == aasdk::proto::enums::ButtonCode::SCROLL_WHEEL) { onButtonEvent({projection::ButtonEventType::NONE, wheelDirection, buttonCode}); - + OPENAUTO_LOG(info) << "[InputService] SENDING WHEEL "; } else { diff --git a/openauto/Service/ServiceFactory.cpp b/openauto/Service/ServiceFactory.cpp index 65e531f..681d8b7 100644 --- a/openauto/Service/ServiceFactory.cpp +++ b/openauto/Service/ServiceFactory.cpp @@ -266,7 +266,13 @@ void ServiceFactory::sendButtonPressFromString(const std::string& btn, const int { aasdk::proto::enums::ButtonCode::Enum buttonCode; projection::WheelDirection wheelDirection = projection::WheelDirection::NONE; - projection::ButtonEventType buttonEventType = state == 0 ? projection::ButtonEventType::PRESS : projection::ButtonEventType::RELEASE; + projection::ButtonEventType buttonEventType = buttonEventType; + if (state == 2) { + buttonEventType = projection::ButtonEventType::NONE; + } + else { + buttonEventType = state == 0 ? projection::ButtonEventType::PRESS : projection::ButtonEventType::RELEASE; + } if (btn == "ENTER") { buttonCode = aasdk::proto::enums::ButtonCode::ENTER;