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

Update xsns_02_analog.ino for calibrated values on ESP32 #19732

Merged
merged 1 commit into from
Oct 15, 2023

Conversation

lalo-uy
Copy link
Contributor

@lalo-uy lalo-uy commented Oct 13, 2023

ESP32 ADC has variables errors, but calibrations values are put in eFuses at factory test. analogReadMilliVolts() from api correct the ADC reading with tata values. Since now the value are mV and not ADC numbers, the fast solution is to revert it back to ADC numbers: divide by Vcc => ANALOG_V33*1000 and multiply by ANALOG_RANGE Other way is to modify all sensor cases to account for the different unit.

Description:

Related issue (if applicable): fixes #

Checklist:

  • The pull request is done against the latest development branch
  • [X ] Only relevant files were touched
  • [X ] Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.4.9
  • [X ] The code change is tested and works with Tasmota core ESP32 V.2.0.14
  • [X ] I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

ESP32  ADC has variables errors, but calibrations values are put in eFuses at factory test.
analogReadMilliVolts() from api correct the ADC reading with tata values.
Since now the value are mV and not ADC numbers, the fast solution is to revert it back to ADC numbers:
divide by Vcc  => ANALOG_V33*1000  and multiply by ANALOG_RANGE
Other way is to modify all sensor cases to account for the different unit.
@lalo-uy
Copy link
Contributor Author

lalo-uy commented Oct 14, 2023 via email

@arendst
Copy link
Owner

arendst commented Oct 14, 2023

Thx.

I can see what you aim for but am not sure if ANALOG_RANGE is ALWAYS the fixed value or, in some cases a user entered value (AdcParam 2 for ADC_RANGE)

@Jason2866
Copy link
Collaborator

@arendst The idea to use calibrated values is nice. Do you think there is a way to implement it?

@arendst
Copy link
Owner

arendst commented Oct 15, 2023

Let's merge and see what happens.

@arendst arendst merged commit b63a061 into arendst:development Oct 15, 2023
63 checks passed
@lalo-uy lalo-uy deleted the patch-1 branch October 15, 2023 12:48
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.

3 participants