Take ADC resolution into account#17018
Take ADC resolution into account#17018thinkyhead merged 2 commits intoMarlinFirmware:bugfix-2.0.xfrom
Conversation
The best to read and likely most understandable version could be: Ideally the direct value for the ADC_REFERENCE_VOLTAGE 3.3 or 5.0 Volt should be taken from a define in the cores. Likely we have to define something like HAL_ADC_REFERENCE_VOLTAGE in the HALs because the cores, if they define something like that, don't name it uniformly. And likely it makes sense to make that over-writable by the configs. Every value, except RAW, in this calculation is constant. Maybe we should help the compiler to see that by pre-calculating. Then the actual runtime calculation can be abbreviated to |
No need. The compiler can easily reduce the constant parts to a single multiply and add on its own. I agree that if there's are reference values to be used —such as those at #14257— they would be better to define at the board level. |
Fixes thermocouple reading on LP1768 (which uses 12-bit resolution).
Description
Take the ADC resolution into account in the AD595 and AD8495 temperature formulas.
Benefits
Makes the AD595 and AD8495 formulas work correctly on boards with 12 bit ADCs.
Related Issues
Related to #16993.