Compare commits
3 Commits
v0.3.1
...
11786b7a06
| Author | SHA1 | Date | |
|---|---|---|---|
| 11786b7a06 | |||
| 7c18ddcc04 | |||
| e8303a9418 |
180
.gitignore
vendored
180
.gitignore
vendored
@@ -1,111 +1,107 @@
|
|||||||
.config
|
# ---> C
|
||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Object files
|
||||||
*.o
|
*.o
|
||||||
*.pyc
|
*.ko
|
||||||
|
*.obj
|
||||||
|
*.elf
|
||||||
|
|
||||||
# gtags
|
# Linker output
|
||||||
GTAGS
|
*.ilk
|
||||||
GRTAGS
|
*.map
|
||||||
GPATH
|
*.exp
|
||||||
|
|
||||||
# emacs
|
# Precompiled Headers
|
||||||
.dir-locals.el
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
# emacs temp file suffixes
|
# Libraries
|
||||||
*~
|
*.lib
|
||||||
.#*
|
*.a
|
||||||
\#*#
|
*.la
|
||||||
|
*.lo
|
||||||
|
|
||||||
# eclipse setting
|
# Shared objects (inc. Windows DLLs)
|
||||||
.settings
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
|
||||||
# MacOS directory files
|
# Executables
|
||||||
.DS_Store
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
*.i*86
|
||||||
|
*.x86_64
|
||||||
|
*.hex
|
||||||
|
|
||||||
# cache dir
|
# Debug files
|
||||||
.cache/
|
*.dSYM/
|
||||||
|
*.su
|
||||||
|
*.idb
|
||||||
|
*.pdb
|
||||||
|
|
||||||
# Doc build artifacts
|
# Kernel Module Compile Results
|
||||||
docs/_build/
|
*.mod*
|
||||||
docs/doxygen_sqlite3.db
|
*.cmd
|
||||||
|
.tmp_versions/
|
||||||
|
modules.order
|
||||||
|
Module.symvers
|
||||||
|
Mkfile.old
|
||||||
|
dkms.conf
|
||||||
|
|
||||||
# Downloaded font files
|
# ---> C++
|
||||||
docs/_static/DejaVuSans.ttf
|
# Prerequisites
|
||||||
docs/_static/NotoSansSC-Regular.otf
|
*.d
|
||||||
|
|
||||||
# Components Unit Test Apps files
|
# Compiled Object files
|
||||||
components/**/build/
|
*.slo
|
||||||
components/**/build_*_*/
|
*.lo
|
||||||
components/**/sdkconfig
|
*.o
|
||||||
components/**/sdkconfig.old
|
*.obj
|
||||||
|
|
||||||
# Example project files
|
# Precompiled Headers
|
||||||
examples/**/build/
|
*.gch
|
||||||
examples/**/build_*_*/
|
*.pch
|
||||||
examples/**/sdkconfig
|
|
||||||
examples/**/sdkconfig.old
|
|
||||||
|
|
||||||
# Unit test app files
|
# Compiled Dynamic libraries
|
||||||
tools/unit-test-app/build
|
*.so
|
||||||
tools/unit-test-app/build_*_*/
|
*.dylib
|
||||||
tools/unit-test-app/sdkconfig
|
*.dll
|
||||||
tools/unit-test-app/sdkconfig.old
|
|
||||||
|
|
||||||
# test application build files
|
# Fortran module files
|
||||||
tools/test_apps/**/build/
|
*.mod
|
||||||
tools/test_apps/**/build_*_*/
|
*.smod
|
||||||
tools/test_apps/**/sdkconfig
|
|
||||||
tools/test_apps/**/sdkconfig.old
|
|
||||||
|
|
||||||
TEST_LOGS/
|
# Compiled Static libraries
|
||||||
build_summary_*.xml
|
*.lai
|
||||||
|
*.la
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
# gcov coverage reports
|
# Executables
|
||||||
*.gcda
|
*.exe
|
||||||
*.gcno
|
*.out
|
||||||
coverage.info
|
*.app
|
||||||
coverage_report/
|
|
||||||
|
|
||||||
test_multi_heap_host
|
# ---> CMake
|
||||||
|
CMakeLists.txt.user
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles
|
||||||
|
CMakeScripts
|
||||||
|
Testing
|
||||||
|
Makefile
|
||||||
|
cmake_install.cmake
|
||||||
|
install_manifest.txt
|
||||||
|
compile_commands.json
|
||||||
|
CTestTestfile.cmake
|
||||||
|
_deps
|
||||||
|
CMakeUserPresets.json
|
||||||
|
|
||||||
# VS Code Settings
|
# Build directory
|
||||||
.vscode/
|
|
||||||
|
|
||||||
# VIM files
|
|
||||||
*.swp
|
|
||||||
*.swo
|
|
||||||
|
|
||||||
# Sublime Text files
|
|
||||||
*.sublime-project
|
|
||||||
*.sublime-workspace
|
|
||||||
|
|
||||||
# Clion IDE CMake build & config
|
|
||||||
.idea/
|
|
||||||
cmake-build-*/
|
|
||||||
|
|
||||||
# Results for the checking of the Python coding style and static analysis
|
|
||||||
.mypy_cache
|
|
||||||
flake8_output.txt
|
|
||||||
|
|
||||||
# ESP-IDF default build directory name
|
|
||||||
build
|
build
|
||||||
|
|
||||||
# lock files for examples and components
|
# unity-app directory
|
||||||
dependencies.lock
|
unity-app
|
||||||
|
|
||||||
# managed_components for examples
|
|
||||||
managed_components
|
|
||||||
|
|
||||||
# pytest log
|
|
||||||
pytest-embedded/
|
|
||||||
# legacy one
|
|
||||||
pytest_embedded_log/
|
|
||||||
list_job*.txt
|
|
||||||
size_info*.txt
|
|
||||||
XUNIT_RESULT*.xml
|
|
||||||
.manifest_sha
|
|
||||||
|
|
||||||
# clang config (for LSP)
|
|
||||||
.clangd
|
|
||||||
|
|
||||||
# Vale
|
|
||||||
.vale/styles/*
|
|
||||||
@@ -15,7 +15,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_check.h"
|
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_task.h"
|
#include "esp_task.h"
|
||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
@@ -321,14 +320,14 @@ esp_err_t relay_chn_create(const gpio_num_t* gpio_map, uint8_t gpio_count)
|
|||||||
|
|
||||||
// Initialize the GPIOs
|
// Initialize the GPIOs
|
||||||
ret = gpio_reset_pin(forward_pin);
|
ret = gpio_reset_pin(forward_pin);
|
||||||
ESP_RETURN_ON_ERROR(ret, TAG, "Failed to reset GPIO forward pin for channel %d", i);
|
ret |= gpio_set_direction(forward_pin, GPIO_MODE_OUTPUT);
|
||||||
ret = gpio_set_direction(forward_pin, GPIO_MODE_OUTPUT);
|
|
||||||
ESP_RETURN_ON_ERROR(ret, TAG, "Failed to set GPIO direction for forward pin for channel %d", i);
|
|
||||||
|
|
||||||
ret = gpio_reset_pin(reverse_pin);
|
ret |= gpio_reset_pin(reverse_pin);
|
||||||
ESP_RETURN_ON_ERROR(ret, TAG, "Failed to reset GPIO reverse pin for channel %d", i);
|
ret |= gpio_set_direction(reverse_pin, GPIO_MODE_OUTPUT);
|
||||||
ret = gpio_set_direction(reverse_pin, GPIO_MODE_OUTPUT);
|
if (ret != ESP_OK) {
|
||||||
ESP_RETURN_ON_ERROR(ret, TAG, "Failed to set GPIO direction for reverse pin for channel %d", i);
|
ESP_LOGE(TAG, "Failed to initialize GPIOs relay channel %d!", i);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
// Initialize the GPIOs
|
// Initialize the GPIOs
|
||||||
|
|
||||||
// Initialize the relay channel
|
// Initialize the relay channel
|
||||||
@@ -340,22 +339,22 @@ esp_err_t relay_chn_create(const gpio_num_t* gpio_map, uint8_t gpio_count)
|
|||||||
relay_chn->state = RELAY_CHN_STATE_FREE;
|
relay_chn->state = RELAY_CHN_STATE_FREE;
|
||||||
relay_chn->pending_cmd = RELAY_CHN_CMD_NONE;
|
relay_chn->pending_cmd = RELAY_CHN_CMD_NONE;
|
||||||
relay_chn->run_info.last_run_cmd = RELAY_CHN_CMD_NONE;
|
relay_chn->run_info.last_run_cmd = RELAY_CHN_CMD_NONE;
|
||||||
ret = relay_chn_init_timer(relay_chn); // Create direction change inertia timer
|
ret |= relay_chn_init_timer(relay_chn); // Create direction change inertia timer
|
||||||
ESP_RETURN_ON_ERROR(ret, TAG, "Failed to create relay channel timer for channel %d", i);
|
|
||||||
#if RELAY_CHN_ENABLE_TILTING == 1
|
#if RELAY_CHN_ENABLE_TILTING == 1
|
||||||
ret = relay_chn_init_tilt_control(relay_chn);
|
ret |= relay_chn_init_tilt_control(relay_chn);
|
||||||
ESP_RETURN_ON_ERROR(ret, TAG, "Failed to initialize tilt control for channel %d", i);
|
|
||||||
#endif
|
#endif
|
||||||
|
if (ret != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Failed to initialize relay channel %d!", i);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create relay channel command event loop
|
// Create relay channel command event loop
|
||||||
ret = relay_chn_create_event_loop();
|
ret |= relay_chn_create_event_loop();
|
||||||
ESP_RETURN_ON_ERROR(ret, TAG, "Failed to create relay channel event loop");
|
|
||||||
|
|
||||||
#if RELAY_CHN_ENABLE_TILTING == 1
|
#if RELAY_CHN_ENABLE_TILTING == 1
|
||||||
// Must call after the event loop is initialized
|
// Must call after the event loop is initialized
|
||||||
ret = relay_chn_tilt_init(); // Initialize tilt feature
|
ret |= relay_chn_tilt_init(); // Initialize tilt feature
|
||||||
ESP_RETURN_ON_ERROR(ret, TAG, "Failed to initialize tilt feature");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Init the state listener manager
|
// Init the state listener manager
|
||||||
|
|||||||
@@ -1,8 +1,3 @@
|
|||||||
# The following lines of boilerplate have to be in your project's CMakeLists
|
idf_component_register(SRCS_DIRS "."
|
||||||
# in this exact order for cmake to work correctly
|
INCLUDE_DIRS "."
|
||||||
cmake_minimum_required(VERSION 3.5)
|
REQUIRES unity relay_chn)
|
||||||
|
|
||||||
set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/unit-test-app/components"
|
|
||||||
"../../relay_chn")
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
|
||||||
project(relay_chn_test)
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
idf_component_register(SRCS_DIRS "."
|
|
||||||
PRIV_INCLUDE_DIRS "."
|
|
||||||
PRIV_REQUIRES unity test_utils relay_chn)
|
|
||||||
@@ -75,21 +75,3 @@ TEST_CASE("Relay channels do not change state for invalid channel", "[relay_chn]
|
|||||||
relay_chn_flip_direction(relay_chn_count + 1); // Flip the direction
|
relay_chn_flip_direction(relay_chn_count + 1); // Flip the direction
|
||||||
check_channels_state_unchanged();
|
check_channels_state_unchanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void setUp(void)
|
|
||||||
{
|
|
||||||
// Run before each test
|
|
||||||
}
|
|
||||||
|
|
||||||
void tearDown(void)
|
|
||||||
{
|
|
||||||
// Run after each test
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test app entry point
|
|
||||||
void app_main(void)
|
|
||||||
{
|
|
||||||
// Run the Unity tests menu
|
|
||||||
unity_run_menu();
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user