From 2d0f17a4bc4072aefe7bf00cd70f277cf0c2ee5e Mon Sep 17 00:00:00 2001 From: soapysoltionss <2200754@sit.singaporetech.edu.sg> Date: Tue, 31 Oct 2023 15:45:37 +0800 Subject: [PATCH] Revert "add direction control" This reverts commit ed3c440ebc75ec94c5ad7f7a0314c07860f48d6f. --- frtos/config/motor_config.h | 5 ----- frtos/motor/motor_speed.h | 42 ------------------------------------- 2 files changed, 47 deletions(-) diff --git a/frtos/config/motor_config.h b/frtos/config/motor_config.h index 6d2cf0e..267d672 100644 --- a/frtos/config/motor_config.h +++ b/frtos/config/motor_config.h @@ -18,11 +18,6 @@ #define DIRECTION_LEFT_FORWARD (1U << DIRECTION_PIN_LEFT_IN4) #define DIRECTION_LEFT_BACKWARD (1U << DIRECTION_PIN_LEFT_IN3) -#define DIRECTION_FORWARD (DIRECTION_RIGHT_FORWARD | DIRECTION_LEFT_FORWARD) -#define DIRECTION_BACKWARD (DIRECTION_RIGHT_BACKWARD | DIRECTION_LEFT_BACKWARD) -#define DIRECTION_LEFT (DIRECTION_RIGHT_FORWARD | DIRECTION_LEFT_BACKWARD) -#define DIRECTION_RIGHT (DIRECTION_RIGHT_BACKWARD | DIRECTION_LEFT_FORWARD) - #define SPEED_PIN_RIGHT 15U #define SPEED_PIN_LEFT 16U diff --git a/frtos/motor/motor_speed.h b/frtos/motor/motor_speed.h index d573276..520fbee 100644 --- a/frtos/motor/motor_speed.h +++ b/frtos/motor/motor_speed.h @@ -72,46 +72,4 @@ monitor_wheel_speed_task(void *pvParameters) p_motor->speed.current_cms = 0.f; } } -} - - -/*! - * @brief Set the distance to travel before stopping, must be called after - * setting the speed and direction. - * @param distance_cm distance to travel in cm - */ -void -distance_to_stop(float distance_cm) -{ - float initial = g_motor_right.speed.distance_cm; - printf("initial: %f\n", initial); - - for (;;) - { - if (g_motor_right.speed.distance_cm - initial >= distance_cm) - { - g_motor_right.pwm.level = 0; - g_motor_left.pwm.level = 0; - break; - } - // vTaskDelay(pdMS_TO_TICKS(50)); - } -} - -/*! - * @brief Set the speed of the wheels - * @param pwm_level The pwm_level of the wheels, from 0 to 5000 - */ -void -set_wheel_speed(uint32_t pwm_level) -{ - g_motor_right.pwm.level = pwm_level; - g_motor_left.pwm.level = pwm_level; - - pwm_set_chan_level(g_motor_right.pwm.slice_num, - g_motor_right.pwm.channel, - g_motor_right.pwm.level); - pwm_set_chan_level(g_motor_left.pwm.slice_num, - g_motor_left.pwm.channel, - g_motor_left.pwm.level); } \ No newline at end of file