From 266c2085296f7369f7a4c4571e544e31258b4c7b Mon Sep 17 00:00:00 2001 From: Wojtek Rzepecki Date: Fri, 11 Jun 2021 08:35:39 +0200 Subject: [PATCH] [EGD-6790] Fix cellular sleep mode Fix of cmux communication in order to prevent polling thus provide sufficient time of inactivity to get into sleep mode --- module-bsp/board/rt1051/bsp/cellular/rt1051_cellular.cpp | 2 +- module-cellular/modem/mux/CellularMux.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module-bsp/board/rt1051/bsp/cellular/rt1051_cellular.cpp b/module-bsp/board/rt1051/bsp/cellular/rt1051_cellular.cpp index 413bec0e32eb24c1ec12beb89f7eac763936bbfc..156ea7c25c8d95bd6a25cddd8a33514c2149142d 100644 --- a/module-bsp/board/rt1051/bsp/cellular/rt1051_cellular.cpp +++ b/module-bsp/board/rt1051/bsp/cellular/rt1051_cellular.cpp @@ -318,7 +318,7 @@ namespace bsp exitSleep(); auto timeoutTicks = pdMS_TO_TICKS(timeoutMs.count()); - if (timeoutTicks > portMAX_DELAY) { + if ((timeoutTicks > portMAX_DELAY) || (timeoutMs == std::chrono::milliseconds::max())) { timeoutTicks = portMAX_DELAY; } diff --git a/module-cellular/modem/mux/CellularMux.cpp b/module-cellular/modem/mux/CellularMux.cpp index 891ee01b786083c786097a8d7b60a83eebf9db3a..b8597b2b44b3f80bb4e8735f4d4b230d6c43fd2c 100644 --- a/module-cellular/modem/mux/CellularMux.cpp +++ b/module-cellular/modem/mux/CellularMux.cpp @@ -549,7 +549,7 @@ void CellularMux::processData(bsp::cellular::CellularDMAResultStruct &result) { LOG_DEBUG("Worker start"); - constexpr auto readTimeout = std::chrono::seconds{1}; + constexpr auto waitForDataIndefinitely = std::chrono::milliseconds::max(); CellularMux *inst = static_cast(ptr); bsp::cellular::CellularDMAResultStruct result{}; @@ -557,7 +557,7 @@ void CellularMux::processData(bsp::cellular::CellularDMAResultStruct &result) while (true) { result.resultCode = bsp::cellular::CellularResultCode::ReceivedNoData; - inst->cellular->read(&result, bsp::cellular::CellularDMAResultStruct::getMaxSize(), readTimeout); + inst->cellular->read(&result, bsp::cellular::CellularDMAResultStruct::getMaxSize(), waitForDataIndefinitely); switch (result.resultCode) { case bsp::cellular::CellularResultCode::ReceivedAndFull: