Fix for issue #6, problem for test of reading SDHC cards (32GB or larger)#7
Open
ericzundel wants to merge 1 commit intoadafruit:masterfrom
Open
Fix for issue #6, problem for test of reading SDHC cards (32GB or larger)#7ericzundel wants to merge 1 commit intoadafruit:masterfrom
ericzundel wants to merge 1 commit intoadafruit:masterfrom
Conversation
Add missing cast in SdReader.h for the size() method. Added new error value for reading a card with unsupported header.
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.
Adds a missing cast in SdReader.h for the size() method. Added new error value for reading a card with unsupported header.
This is a minor change to SdReader.h and SdReader.cpp that fixes a bug in reading the size
of large SD cards. I imagine most code that uses the library doesn't depend on this function,
but the SdReadTest unit test does.
See the equivalent code in https://github.com/greiman/SdFat/blob/master/src/SdCard/SdCardInfo.h#L326
I ran all examples in the WaveHC library. I discovered this when vetting my change for fixing issue #3 and decided to break it out into a separate PR.
Before this fix, the card size reported by the test was insanely large, probably caused by the top bit being set in a 16 bit int implicitly used when 'mid' is not cast:
After this fix, the SdReader test reports a sane card size: