Patch for Timer 1 and negative time-delta's#1
Open
szihlmann wants to merge 4 commits intoevankale:masterfrom
Open
Patch for Timer 1 and negative time-delta's#1szihlmann wants to merge 4 commits intoevankale:masterfrom
szihlmann wants to merge 4 commits intoevankale:masterfrom
Conversation
Allow negative differences of (storedTimeDelta - signalTimeDelta) by using a long datatype and using abs() of the difference. This accounts for metals that decrease the colpitts oscillator frequency.
Clarified that TCNT1 is the counter variable. OCR1A is the register TCNT1 will be compared to. TCNT1 is increasing NOT decreasing.
TIMER1_COMPA_vect was executed immediately after enabling timer compare interrupt A since the interrupt flag was not cleared. Because the OCR1A value was set to 1 AFTER enabling compare interrupt, wrong values for storedTimeDelta were obtained during Arduino startup.
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.
Hi Evan
I've been using your code for my own metal detector project and made some changes which I believe will make your code more reliable, clear and useful.
Please check the individual commits to understand the changes. Due to a change in line-end formatting all code appears deleted/inserted.
Serge