Skip to content

Commit

Permalink
πŸ”§ (os): Add NO_SLEEP_WAITING_DURATION to reduce all sleep duration to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
YannLocatelli committed Jul 16, 2024
1 parent 569b838 commit b6fb159
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions libs/RobotKit/include/RobotController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b6fb159

Please sign in to comment.