Skip to content

add configurable EEPROM length #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 19, 2020
Merged

add configurable EEPROM length #127

merged 5 commits into from
Mar 19, 2020

Conversation

oclyke
Copy link
Contributor

@oclyke oclyke commented Feb 14, 2020

since the flashContent buffer is declared on the stack it may be dynamically sized the user can take advantage of this to allow for any size EEPROM up to the allocated 1 page of flash

  • added 'allowedSize' member to EEPROMClass

  • added setter for allowedSize 'setLength'

  • adjusted 'length' to return allowedSize

  • adjusted 'writeBlockToEEPROM' to use the allowedSize of the EEPROM structure when checking flash memory.

  • added example usage to Example2_AllFunctions

since the flashContent buffer is declared on the stack it may be dynamically sized. the user can take advantage of this to allow for any size EEPROM up to the allocated 1 page of flash.

- added 'allowedSize' member to EEPROMClass
- added setter for allowedSize 'setLength'
- adjusted 'length' to return allowedSize

- adjusted 'writeBlockToEEPROM' to use the allowedSize of the EEPROM structure when checking flash memory.

- added example usage to Example2_AllFunctions
@oclyke oclyke requested a review from nseidle February 14, 2020 20:41
@oclyke
Copy link
Contributor Author

oclyke commented Feb 14, 2020

In response to #126

@oclyke
Copy link
Contributor Author

oclyke commented Feb 17, 2020

@rustycoat thanks for the comments. I've updated the notes in the header file and implemented the ternary consition in setLength(). Since you were asking (?) here's how you could have made a pull request:

  1. Use GitHub to "fork" our repo
  2. Clone your own repo to your workspace
  3. Create a new branch for your suggestions
  4. Make the changes you'd like to see
  5. Commit those changes to your branch on your fork
  6. Open a pull request (asks to merge your branch into our repo)
  7. Once the PR is accepted you can destroy your fork of the project (or keep it around for future PRs)

@rustycoat
Copy link

Thanks @oclyke. I'm a homesteader living off grid without much technology or time for things like contributing to open source, but I greatly value the open source way of doing things. 20 years ago I was a software developer, but back then it was CVS not git and, even so, I barely remember that process :). Thanks for the instructions, hopefully I'll have some time to do my part the next time I spot a potential bug.

writing to 8176 and above seems likely to cause a crash with 32 and 64-bit wide data types. restricting the size of EEPROM a little bit seems to nearly eliminate these problems. while this is not a true solution or a good fix it is good enough for now
@nseidle
Copy link
Member

nseidle commented Mar 18, 2020

Looks good and tests good. Thanks for expanding this!

@oclyke oclyke merged commit 9a42ce0 into master Mar 19, 2020
@oclyke oclyke deleted the eeprom-variable-size branch March 19, 2020 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants