perf: reduced min task values
This commit is contained in:
@@ -13,16 +13,16 @@
|
|||||||
/**
|
/**
|
||||||
* @brief Encoder initial default values.
|
* @brief Encoder initial default values.
|
||||||
*/
|
*/
|
||||||
#define ZH_ENCODER_INIT_CONFIG_DEFAULT() \
|
#define ZH_ENCODER_INIT_CONFIG_DEFAULT() \
|
||||||
{ \
|
{ \
|
||||||
.task_priority = 10, \
|
.task_priority = 1, \
|
||||||
.stack_size = 3072, \
|
.stack_size = configMINIMAL_STACK_SIZE, \
|
||||||
.queue_size = 10, \
|
.queue_size = 1, \
|
||||||
.a_gpio_number = 0, \
|
.a_gpio_number = GPIO_NUM_MAX, \
|
||||||
.b_gpio_number = 0, \
|
.b_gpio_number = GPIO_NUM_MAX, \
|
||||||
.encoder_min_value = -100, \
|
.encoder_min_value = -100, \
|
||||||
.encoder_max_value = 100, \
|
.encoder_max_value = 100, \
|
||||||
.encoder_step = 1, \
|
.encoder_step = 1, \
|
||||||
.encoder_number = 0}
|
.encoder_number = 0}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -37,9 +37,9 @@ extern "C"
|
|||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint8_t task_priority; /*!< Task priority for the encoder isr processing. @note It is not recommended to set a value less than 10. */
|
uint8_t task_priority; /*!< Task priority for the encoder isr processing. @note Minimum value is 1. */
|
||||||
uint16_t stack_size; /*!< Stack size for task for the encoder isr processing processing. @note The minimum size is 3072 bytes. */
|
uint16_t stack_size; /*!< Stack size for task for the encoder isr processing processing. @note The minimum size is configMINIMAL_STACK_SIZE. */
|
||||||
uint8_t queue_size; /*!< Queue size for task for the encoder processing. @note It is not recommended to set a value less than 10. */
|
uint8_t queue_size; /*!< Queue size for task for the encoder processing. @note Minimum value is 1. */
|
||||||
uint8_t a_gpio_number; /*!< Encoder A GPIO number. */
|
uint8_t a_gpio_number; /*!< Encoder A GPIO number. */
|
||||||
uint8_t b_gpio_number; /*!< Encoder B GPIO number. */
|
uint8_t b_gpio_number; /*!< Encoder B GPIO number. */
|
||||||
int32_t encoder_min_value; /*!< Encoder min value. @note Must be less than encoder_max_value. */
|
int32_t encoder_min_value; /*!< Encoder min value. @note Must be less than encoder_max_value. */
|
||||||
|
|||||||
@@ -127,8 +127,8 @@ void zh_encoder_reset_stats(void)
|
|||||||
static esp_err_t _zh_encoder_validate_config(const zh_encoder_init_config_t *config)
|
static esp_err_t _zh_encoder_validate_config(const zh_encoder_init_config_t *config)
|
||||||
{
|
{
|
||||||
ZH_ERROR_CHECK(config != NULL, ESP_ERR_INVALID_ARG, NULL, "Invalid configuration.");
|
ZH_ERROR_CHECK(config != NULL, ESP_ERR_INVALID_ARG, NULL, "Invalid configuration.");
|
||||||
ZH_ERROR_CHECK(config->task_priority >= 10 && config->stack_size >= 3072, ESP_ERR_INVALID_ARG, NULL, "Invalid task settings.");
|
ZH_ERROR_CHECK(config->task_priority >= 1 && config->stack_size >= configMINIMAL_STACK_SIZE, ESP_ERR_INVALID_ARG, NULL, "Invalid task settings.");
|
||||||
ZH_ERROR_CHECK(config->queue_size >= 10, ESP_ERR_INVALID_ARG, NULL, "Invalid queue size.");
|
ZH_ERROR_CHECK(config->queue_size >= 1, ESP_ERR_INVALID_ARG, NULL, "Invalid queue size.");
|
||||||
ZH_ERROR_CHECK(config->encoder_max_value > config->encoder_min_value, ESP_ERR_INVALID_ARG, NULL, "Invalid encoder min/max value.");
|
ZH_ERROR_CHECK(config->encoder_max_value > config->encoder_min_value, ESP_ERR_INVALID_ARG, NULL, "Invalid encoder min/max value.");
|
||||||
ZH_ERROR_CHECK(config->encoder_step > 0, ESP_ERR_INVALID_ARG, NULL, "Invalid encoder step.");
|
ZH_ERROR_CHECK(config->encoder_step > 0, ESP_ERR_INVALID_ARG, NULL, "Invalid encoder step.");
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user