From bc22304e367bd7a8e01edf7dc4ce141883a9806a Mon Sep 17 00:00:00 2001 From: Zain Date: Thu, 1 Feb 2024 16:40:24 +0530 Subject: [PATCH 1/3] Refactor line sensor initialization and reading --- 2_LSA/main/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/2_LSA/main/main.c b/2_LSA/main/main.c index 7b7a5f1f..bbd89ef9 100644 --- a/2_LSA/main/main.c +++ b/2_LSA/main/main.c @@ -23,7 +23,8 @@ static const char *TAG = "LSA_READINGS"; void app_main(void) { // enable line sensor after checking optimal working state of ESP - ESP_ERROR_CHECK(enable_line_sensor()); + adc_handle_t line_sensor; + ESP_ERROR_CHECK(enable_line_sensor(&line_sensor)); // Union containing line sensor readings line_sensor_array line_sensor_readings; @@ -41,7 +42,7 @@ void app_main(void) while (1) { // get line sensor readings from the LSA sensors - line_sensor_readings = read_line_sensor(); + line_sensor_readings = read_line_sensor(line_sensor); for (int i = 0; i < 5; i++) { // constrain lsa readings between BLACK_MARGIN and WHITE_MARGIN From 67f212dcb08529da261e0ed88e1edfe4f162b63e Mon Sep 17 00:00:00 2001 From: Zain Date: Thu, 1 Feb 2024 16:40:43 +0530 Subject: [PATCH 2/3] Refractor to use adc handles --- 6_line_following/main/line_following.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/6_line_following/main/line_following.c b/6_line_following/main/line_following.c index 96717f03..a601b0f9 100644 --- a/6_line_following/main/line_following.c +++ b/6_line_following/main/line_following.c @@ -110,7 +110,8 @@ void line_follow_task(void* arg) motor_handle_t motor_a_0, motor_a_1; ESP_ERROR_CHECK(enable_motor_driver(&motor_a_0, MOTOR_A_0)); ESP_ERROR_CHECK(enable_motor_driver(&motor_a_1, MOTOR_A_1)); - ESP_ERROR_CHECK(enable_line_sensor()); + adc_handle_t line_sensor; + ESP_ERROR_CHECK(enable_line_sensor(&line_sensor)); ESP_ERROR_CHECK(enable_bar_graph()); #ifdef CONFIG_ENABLE_OLED // Initialising the OLED @@ -124,7 +125,7 @@ void line_follow_task(void* arg) while(true) { - line_sensor_readings = read_line_sensor(); + line_sensor_readings = read_line_sensor(line_sensor); for(int i = 0; i < 5; i++) { line_sensor_readings.adc_reading[i] = bound(line_sensor_readings.adc_reading[i], WHITE_MARGIN, BLACK_MARGIN); From 04c20e70040c893f481f032651fb8de12f412ef8 Mon Sep 17 00:00:00 2001 From: Zain Date: Thu, 1 Feb 2024 16:41:13 +0530 Subject: [PATCH 3/3] Update sra-board-component to latest --- components/sra-board-component | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/sra-board-component b/components/sra-board-component index 619695fc..c9180acb 160000 --- a/components/sra-board-component +++ b/components/sra-board-component @@ -1 +1 @@ -Subproject commit 619695fc33119a7647b7febe024e52022134d8bd +Subproject commit c9180acbbfe6f17e1aac47ca0ffb249e1684a717