G6EJD / ESP32-e-Paper-Weather-Display

An ESP32 and 2.9", 4.2" or 7.5" ePaper Display reads Weather Underground data via their API and then displays the weather
Other
946 stars 206 forks source link

Update Waveshare_7_5_T7.ino #187

Closed reiyawea closed 1 year ago

reiyawea commented 1 year ago

Make analog read function return voltage instead of raw ADC data, so as to achieve compatibility across ESP32 series.

G6EJD commented 1 year ago

Why have you added /2 to the results if they are in mV?

reiyawea commented 1 year ago

Why have you added /2 to the results if they are in mV?

The analog pin has a 100K+100K voltage divider connected to the battery terminals. So the voltage returned in mV should first /1000 then *2 to be the value of battery voltage in Volt.

G6EJD commented 1 year ago

Have you tested the result to confirm: Serial.println("Voltage = " + String(voltage)); That result is identical to the original code?

Also only the latest compiler version has added analogreadmillivolts but have you tested all the code with the latest compiler as this no changes the baseline dependencies?

reiyawea commented 1 year ago

I have tested this code on wemos S2 mini with ESP32 library V2.0.4 and confirmed that nothing changed. All functions are as expected.

reiyawea commented 1 year ago

Since I'm using a new model of ESP32 board (with new ESP32-S2F chip), the result of the original code is incorrect. So I have to change the code into the one of this PR.

G6EJD commented 1 year ago

Yea but now the code has to be separated out to an S2 version but also the default ADC resolution is 4096 meaning the original code will still function plus not all boards have the same voltage divider resistor values and therefore the ADC input current offset is varying per board, at the moment I’m leaning towards leaving the code as is because the platform complexity is growing, then adding some readme notes to cover different variants of the ESP32 there is also the C3 version too.

reiyawea commented 1 year ago

OK I understand the situation. Thank you for your explanation.