fix line sensor
This commit is contained in:
parent
0e3e481a2c
commit
16ea617052
|
@ -31,7 +31,7 @@ SemaphoreHandle_t g_left_sensor_sem = NULL;
|
||||||
static inline void
|
static inline void
|
||||||
line_sensor_init(car_struct_t *p_car_struct)
|
line_sensor_init(car_struct_t *p_car_struct)
|
||||||
{
|
{
|
||||||
p_car_struct->obs->line_detected = false;
|
p_car_struct->obs->left_sensor_detected, p_car_struct->obs->left_sensor_detected = false;
|
||||||
|
|
||||||
g_left_sensor_sem = xSemaphoreCreateBinary();
|
g_left_sensor_sem = xSemaphoreCreateBinary();
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ bool
|
||||||
check_collision(void *params)
|
check_collision(void *params)
|
||||||
{
|
{
|
||||||
car_struct_t *car_struct = (car_struct_t *)params;
|
car_struct_t *car_struct = (car_struct_t *)params;
|
||||||
return ((car_struct->obs->left_line_detected << 1) | (car_struct->obs->right_line_detected))
|
return ((car_struct->obs->left_sensor_detected << 1) | (car_struct->obs->right_sensor_detected))
|
||||||
|| car_struct->obs->ultrasonic_detected;
|
|| car_struct->obs->ultrasonic_detected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ check_line_touch(void *params)
|
||||||
{
|
{
|
||||||
car_struct_t *car_struct = (car_struct_t *)params;
|
car_struct_t *car_struct = (car_struct_t *)params;
|
||||||
|
|
||||||
return (car_struct->obs->left_line_detected << 1) | (car_struct->obs->right_line_detected);
|
return (car_struct->obs->left_sensor_detected << 1) | (car_struct->obs->right_sensor_detected);
|
||||||
|
}
|
||||||
void
|
void
|
||||||
motor_control_task(void *params)
|
motor_control_task(void *params)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue