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

Fix analogWidth for ESP32S2 in esp32-hal-adc.c #5711

Merged
merged 2 commits into from
Oct 1, 2021

Conversation

caternuson
Copy link
Contributor

Summary

Potential fix for #5691 and #5658.

Impact

Sets a different default value for analogWidth in esp32-hal-adc.c for ESP32S2 based boards. This fixes issue with performing analogRead on that platform.

Test sketch run on an Adafruit FunHouse which has an analog light sensor attached to A3:

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println(analogRead(A3));
  delay(100);
}

Screenshot from 2021-09-27 08-35-21

@CLAassistant
Copy link

CLAassistant commented Sep 27, 2021

CLA assistant check
All committers have signed the CLA.

@ladyada
Copy link
Contributor

ladyada commented Sep 27, 2021

@atanisoft
Copy link
Collaborator

As noted in #5691 (comment) this will break ESP32-C3 ADC support.

static uint8_t __analogWidth = 3;//12 bits
#elif CONFIG_IDF_TARGET_ESP32S2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be listed first and have an #else with the existing 12bit analog value. With the proposed change this will fail to compile on the ESP32-C3.

@caternuson
Copy link
Contributor Author

@atanisoft What changes are needed? Can update the PR.

@me-no-dev me-no-dev merged commit 1688b7c into espressif:master Oct 1, 2021
@me-no-dev
Copy link
Member

thanks @caternuson

@VojtechBartoska
Copy link
Contributor

close #5691

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants