[2.0.x] Ensure ADC conversion is complete before reading#11336
Merged
thinkyhead merged 1 commit intoMarlinFirmware:bugfix-2.0.xfrom Jul 26, 2018
Merged
[2.0.x] Ensure ADC conversion is complete before reading#11336thinkyhead merged 1 commit intoMarlinFirmware:bugfix-2.0.xfrom
thinkyhead merged 1 commit intoMarlinFirmware:bugfix-2.0.xfrom
Conversation
Contributor
Author
|
@thinkyhead I have no idea why this pull request includes changes committed by you on the 25th June to the configuration files. Sorry about that. Do I need to revert them from my fork and then resubmit this? |
Contributor
Author
|
Currently investigation a potential issue with this, please do not merge. |
Contributor
Author
|
Latest changes have been tested and it looks pretty good. No glitches on hotend, or heated bed. Should be OK to merge I hope. |
Member
|
I can fix this up — just needs a rebase, as the source branch probably got rebased. |
69b50e6 to
45eee00
Compare
1229af6 to
fc80036
Compare
The current Marlin implementation makes 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 availabe 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: MarlinFirmware#11323
fc80036 to
b366323
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR extends the HAL interface to allow code to check if the ADC conversion is complete and uses this to ensure correct temperature and other ADC based readings.
The current implementation relies on an interrupt timer to start the conversion and read the ADC value. However in some circumstances other interrupts can delay the start point which can result in the conversion not being complete by the time the ADC value is read. This PR checks to see if the conversion has been completed and if not it delays the read until the next timer interrupt.
Note: This PR only provides HAL implementations for AVR and LPC1768 variants, place holders are provided for other HALs and these may need to be modified (but without any change things are essentially as before).
Benefits
With the current implementation invalid temperature readings can be made in some circumstances (particularly on AVR based systems) resulting in fluctuations in the hotend (and to a lesser extent) bed temperature. This change provides a more consistent temperature.
Related Issues
See issue: #11323