Voltage measuring function gives incorrect result if calling from a component

Paul_Rodopi
Posts: 4
Joined: Wed Oct 02, 2024 3:01 am

Voltage measuring function gives incorrect result if calling from a component

Postby Paul_Rodopi » Mon Oct 21, 2024 8:56 pm

I use the same function, similar to one in ESP example esp_battery_reading_single to measure the ESP board battery voltage.
It resides in a separate component.

I call this function directly from my project main() function and from a second separate component C file function, called from main().
If called from main() only, it gives a correct, consistent voltage value (3.17 V). If called from the second component C file function only,
(called from main()), it gives a consistent but incorrect voltage value (0.14 V). If the same voltage measuring function is called from both main() and the second component file function, it gives in both cases correct consistent values of 3.17 V.

I need to access this function in main() from the second component C file function only. Please explain what should be the problem and how to fix it. Thanks.

Who is online

Users browsing this forum: No registered users and 34 guests