From b6fb1594d6c8d4d045fc699ea84d0d5ba5bca2a1 Mon Sep 17 00:00:00 2001 From: Yann Locatelli Date: Tue, 16 Jul 2024 16:59:09 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20(os):=20Add=20NO=5FSLEEP=5FWAITI?= =?UTF-8?q?NG=5FDURATION=20to=20reduce=20all=20sleep=20duration=20to=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 7 +++++++ Makefile | 11 ++++++----- libs/RobotKit/include/RobotController.h | 6 ++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4594174064..497af5bfc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,13 @@ if(BUILD_TARGETS_TO_USE_WITH_BOOTLOADER) ) endif(BUILD_TARGETS_TO_USE_WITH_BOOTLOADER) +# OS +option(NO_SLEEP_WAITING_DURATION "NO SLEEP WAITING DURATION output" OFF) + +if(NO_SLEEP_WAITING_DURATION) + add_definitions(-DNO_SLEEP_WAITING_DURATION) +endif(NO_SLEEP_WAITING_DURATION) + # Logger option(ENABLE_LOG_DEBUG "Enable LogKit output" OFF) diff --git a/Makefile b/Makefile index d81aed65c7..3e2320c269 100644 --- a/Makefile +++ b/Makefile @@ -39,8 +39,9 @@ GCOV_EXEC ?= "" CI_UT_OPTIMIZATION_LEVEL ?= "" # os -ENABLE_LOG_DEBUG ?= ON -ENABLE_SYSTEM_STATS ?= ON +ENABLE_LOG_DEBUG ?= ON +ENABLE_SYSTEM_STATS ?= ON +NO_SLEEP_WAITING_DURATION ?= OFF # bootloader BUILD_TARGETS_TO_USE_WITH_BOOTLOADER ?= OFF @@ -148,7 +149,7 @@ config_cmake_target: mkdir_cmake_config config_cmake_build: mkdir_cmake_config @echo "" @echo "🏃 Running cmake configuration script for target $(TARGET_BOARD) 📝" - @cmake -S . -B $(TARGET_BOARD_BUILD_DIR) -GNinja -DCMAKE_CONFIG_DIR="$(TARGET_BOARD_CMAKE_CONFIG_DIR)" -DTARGET_BOARD="$(TARGET_BOARD)" -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_LOG_DEBUG=$(ENABLE_LOG_DEBUG) -DENABLE_SYSTEM_STATS=$(ENABLE_SYSTEM_STATS) -DBUILD_TARGETS_TO_USE_WITH_BOOTLOADER=$(BUILD_TARGETS_TO_USE_WITH_BOOTLOADER) + @cmake -S . -B $(TARGET_BOARD_BUILD_DIR) -GNinja -DCMAKE_CONFIG_DIR="$(TARGET_BOARD_CMAKE_CONFIG_DIR)" -DTARGET_BOARD="$(TARGET_BOARD)" -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_LOG_DEBUG=$(ENABLE_LOG_DEBUG) -DNO_SLEEP_WAITING_DURATION=$(NO_SLEEP_WAITING_DURATION) -DENABLE_SYSTEM_STATS=$(ENABLE_SYSTEM_STATS) -DBUILD_TARGETS_TO_USE_WITH_BOOTLOADER=$(BUILD_TARGETS_TO_USE_WITH_BOOTLOADER) # Firmware config config_firmware: config @@ -163,7 +164,7 @@ config_firmware_target: mkdir_firmware_config config_firmware_build: mkdir_firmware_config @echo "" @echo "🏃 Running cmake configuration script for firmware (os + bootloader) 📝" - @cmake -S . -B $(FIRMWARE_BUILD_DIR) -GNinja -DCMAKE_CONFIG_DIR="$(FIRMWARE_CONFIG_DIR)" -DTARGET_BOARD="$(TARGET_BOARD)" -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_LOG_DEBUG=$(ENABLE_LOG_DEBUG) -DENABLE_SYSTEM_STATS=$(ENABLE_SYSTEM_STATS) -DBUILD_TARGETS_TO_USE_WITH_BOOTLOADER=ON + @cmake -S . -B $(FIRMWARE_BUILD_DIR) -GNinja -DCMAKE_CONFIG_DIR="$(FIRMWARE_CONFIG_DIR)" -DTARGET_BOARD="$(TARGET_BOARD)" -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_LOG_DEBUG=$(ENABLE_LOG_DEBUG) -DNO_SLEEP_WAITING_DURATION=$(NO_SLEEP_WAITING_DURATION) -DENABLE_SYSTEM_STATS=$(ENABLE_SYSTEM_STATS) -DBUILD_TARGETS_TO_USE_WITH_BOOTLOADER=ON # Tools @@ -178,7 +179,7 @@ config_tools_target: mkdir_tools_config config_tools_build: mkdir_tools_config @echo "" @echo "🏃 Running cmake configuration script for target $(TARGET_BOARD) 📝" - @cmake -S . -B $(CMAKE_TOOLS_BUILD_DIR) -GNinja -DCMAKE_CONFIG_DIR="$(CMAKE_TOOLS_CONFIG_DIR)" -DTARGET_BOARD="$(TARGET_BOARD)" -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_LOG_DEBUG=ON -DENABLE_SYSTEM_STATS=ON + @cmake -S . -B $(CMAKE_TOOLS_BUILD_DIR) -GNinja -DCMAKE_CONFIG_DIR="$(CMAKE_TOOLS_CONFIG_DIR)" -DTARGET_BOARD="$(TARGET_BOARD)" -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_LOG_DEBUG=ON -DNO_SLEEP_WAITING_DURATION=$(NO_SLEEP_WAITING_DURATION) -DENABLE_SYSTEM_STATS=ON # # MARK: - Tests targets diff --git a/libs/RobotKit/include/RobotController.h b/libs/RobotKit/include/RobotController.h index 0e194a3a5d..8377f0278b 100644 --- a/libs/RobotKit/include/RobotController.h +++ b/libs/RobotKit/include/RobotController.h @@ -555,9 +555,15 @@ class RobotController : public interface::RobotController interface::Timeout &_timeout_state_internal; +#if defined(NO_SLEEP_WAITING_DURATION) + std::chrono::seconds _sleep_timeout_duration {1}; + std::chrono::seconds _idle_timeout_duration {1}; + std::chrono::seconds _deep_sleep_timeout_duration {1}; +#else std::chrono::seconds _sleep_timeout_duration {60}; std::chrono::seconds _idle_timeout_duration {600}; std::chrono::seconds _deep_sleep_timeout_duration {600}; +#endif interface::Timeout &_timeout_state_transition; interface::Timeout &_timeout_autonomous_activities;