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
2018-07-26 09:59:19 +01:00
committed by Scott Lahteine
parent e2aa635e70
commit 624986d423
10 changed files with 140 additions and 111 deletions

View File

@ -214,7 +214,8 @@ void eeprom_update_block (const void *__src, void *__dst, size_t __n);
inline void HAL_adc_init(void) {}
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
#define HAL_READ_ADC HAL_adc_result
#define HAL_READ_ADC() HAL_adc_result
#define HAL_ADC_READY() true
void HAL_adc_start_conversion(const uint8_t adc_pin);