From de01768c4932de6c54f5adca9089dd9bee835315 Mon Sep 17 00:00:00 2001 From: Zain Date: Wed, 31 Jan 2024 19:27:56 +0530 Subject: [PATCH] Refactor motor driver code and remove unnecessary imports --- examples/motor_driver_normal/main/main.c | 8 +++++--- src/mcpwm_interface.c | 4 ---- src/motor_driver.c | 2 -- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/examples/motor_driver_normal/main/main.c b/examples/motor_driver_normal/main/main.c index 9efb7d2..fef01e7 100644 --- a/examples/motor_driver_normal/main/main.c +++ b/examples/motor_driver_normal/main/main.c @@ -27,19 +27,21 @@ #include "freertos/task.h" #include "sra_board.h" +static const char* TAG = "MOTOR"; + void app_main(void) { motor_handle_t motor1; enable_motor_driver(&motor1, MOTOR_A_1); while(1){ set_motor_speed(motor1, MOTOR_FORWARD, 60); - ESP_LOGI("MOTOR", "Forward"); + ESP_LOGI(TAG, "Forward"); vTaskDelay(1000 / portTICK_PERIOD_MS); set_motor_speed(motor1, MOTOR_BACKWARD, 60); - ESP_LOGI("MOTOR", "Backward"); + ESP_LOGI(TAG, "Backward"); vTaskDelay(1000 / portTICK_PERIOD_MS); set_motor_speed(motor1, MOTOR_STOP, 0); - ESP_LOGI("MOTOR", "Stop"); + ESP_LOGI(TAG, "Stop"); vTaskDelay(1000 / portTICK_PERIOD_MS); } } diff --git a/src/mcpwm_interface.c b/src/mcpwm_interface.c index 6c84dba..86eac1b 100644 --- a/src/mcpwm_interface.c +++ b/src/mcpwm_interface.c @@ -22,11 +22,7 @@ * SOFTWARE. */ -#include -#include -#include -#include "esp_log.h" #include "driver/mcpwm_prelude.h" #include "esp_check.h" #include "mcpwm_interface.h" diff --git a/src/motor_driver.c b/src/motor_driver.c index 4aec5e3..f315345 100644 --- a/src/motor_driver.c +++ b/src/motor_driver.c @@ -22,8 +22,6 @@ * SOFTWARE. */ -#include "esp_log.h" -#include "esp_check.h" #include "motor_driver.h" #include "utils.h" #include "pin_defs.h"