Revert "add direction control"

This reverts commit ed3c440ebc.
This commit is contained in:
soapysoltionss 2023-10-31 15:45:37 +08:00
parent 2a38789890
commit 2d0f17a4bc
2 changed files with 0 additions and 47 deletions

View File

@ -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

View File

@ -73,45 +73,3 @@ monitor_wheel_speed_task(void *pvParameters)
}
}
}
/*!
* @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);
}