Ensure ADC conversion is complete before reading (#11336)

The current Marlin implementation relies on a timer interrupt to start the ADC conversion and read it. However in some circumstances the interrupt can be delayed resulting in insufficient time being available for the ADC conversion. This results in a bad reading and false temperature fluctuations. These changes make sure that the conversion is complete (by checking the ADC hardware via the HAL) before reading a value.

See: https://github.com/MarlinFirmware/Marlin/issues/11323
This commit is contained in:
Andy Shaw authored and Scott Lahteine committed 2018-07-26 03:59:19 -05:00
1 parent e2aa635e70
commit 624986d423
10 files changed
+140 -111

No files matched your search

+2
View File
@@ -52,6 +52,7 @@
* States for ADC reading in the ISR
*/
enum ADCSensorState : char {
StartSampling,
#if HAS_TEMP_ADC_0
PrepareTemp_0,
MeasureTemp_0,
@@ -328,6 +329,7 @@ class Temperature {
/**
* Called from the Temperature ISR
*/
static void readings_ready();
static void isr();
/**