Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP-IDF 5 ADC Implementation Updates for Wall-E #140

Merged
merged 3 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions 2_LSA/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions 6_line_following/main/line_following.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion components/sra-board-component