Fix temp-interrupt with LIN_ADVANCE #74
Closed
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.
Error mechanism:
Let's suppose we are in 'Temperature::isr()'.
The temperature-interrupt is disabled, but all others are enabled.
Now the temp-isr is interrupted by the
Stepper::advance_isr_scheduler()
temp-isr and stepper-isr are disabled.
When we leave the
Stepper::advance_isr_scheduler()
we executeEnable temp-isr and stepper-isr. In case we interrupted the temp-isr this does not restore the ISR settings, but enables the temp-isr falsely.
If its time for a fresh temp-isr now, this is entered before the still on the stack temp-isr ended - the temp-isr bites its tail.
Problems:
Is temp-isr is entered multiple times the stack may overflow.
temp-isr is not made for reentering.
Symptoms:
Sampling OVERSAMPLENR+1 (or more) instead of OVERSAMPLENR samples.
Even worse and unpredictable things when the stack overfolowes