From 2b1ce1aa0e12835a3d779094e2214ca27ed48118 Mon Sep 17 00:00:00 2001 From: SP2FET Date: Thu, 25 Feb 2021 12:34:42 +0100 Subject: [PATCH] [EGD-5879] Fix BT uart error To be able to properly send data via UART, the frequency has to be higher (to be fixed in the future) --- .../service-bluetooth/ServiceBluetooth.cpp | 11 ++++++++++- .../service-bluetooth/ServiceBluetooth.hpp | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/module-services/service-bluetooth/ServiceBluetooth.cpp b/module-services/service-bluetooth/ServiceBluetooth.cpp index 2a1ff4c897147dc8a642f60b10f564b77e4d2531..a31916cab32c20f1ec3a1b4a2862d10eb64d4029 100644 --- a/module-services/service-bluetooth/ServiceBluetooth.cpp +++ b/module-services/service-bluetooth/ServiceBluetooth.cpp @@ -16,6 +16,7 @@ #include #include +#include "SystemManager/messages/SentinelRegistrationMessage.hpp" #include #include @@ -42,7 +43,15 @@ ServiceBluetooth::~ServiceBluetooth() // this means it is an init point of bluetooth feature handling sys::ReturnCodes ServiceBluetooth::InitHandler() { - LOG_ERROR("Bluetooth experimental!"); + cpuSentinel = std::make_shared(service::name::bluetooth, this); + + auto sentinelRegistrationMsg = std::make_shared(cpuSentinel); + bus.sendUnicast(std::move(sentinelRegistrationMsg), service::name::system_manager); + + // temporarily limit the minimum CPU frequency + // due to problems with the UART of the BT module + cpuSentinel->HoldMinimumFrequency(bsp::CpuFrequencyHz::Level_6); + worker = std::make_unique(this); worker->run(); diff --git a/module-services/service-bluetooth/service-bluetooth/ServiceBluetooth.hpp b/module-services/service-bluetooth/service-bluetooth/ServiceBluetooth.hpp index c034df8e887e0f612e7770b5b14d418247d7a4b3..246928bb46ef8990ed100b5c9ed021197aca538c 100644 --- a/module-services/service-bluetooth/service-bluetooth/ServiceBluetooth.hpp +++ b/module-services/service-bluetooth/service-bluetooth/ServiceBluetooth.hpp @@ -13,6 +13,7 @@ #include #include "BluetoothMessage.hpp" #include "ProfileManager.hpp" +#include #include // for unique_ptr @@ -42,6 +43,7 @@ class ServiceBluetooth : public sys::Service private: std::unique_ptr worker; + std::shared_ptr cpuSentinel; bool enabledFromHarness = false; };