Skip to content
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

Remove unused I2CDriver properties and memory fixes #219

Merged
merged 14 commits into from
Feb 23, 2022

Conversation

brentru
Copy link
Member

@brentru brentru commented Feb 22, 2022

  • Removes unused DriverType_t enum
  • Makes sensorAddress a getter/setter within I2CDriver base class: setI2CAddress and getI2CAddress
  • Properly allocates and deallocates memory for each sensor driver.
    • Destructors do not unnecessarily reset variables or set pointers within drivers to NULL.
  • Sensor drivers pointers are properly deleted and removed from the vector, instead of simply being erased.

@ladyada
Copy link
Member

ladyada commented Feb 22, 2022

im a little paranoid about having public variables because people could set them by accident, unless you mean that?

@brentru
Copy link
Member Author

brentru commented Feb 22, 2022

@ladyada I wanted to simplify the src/drivers/WipperSnapper_I2C_Driver.h interface, but I can also refactor it to utilize getters/setters to wrap these variables (sensorAddress, isInitialized) as private members.

@ladyada
Copy link
Member

ladyada commented Feb 22, 2022

i think its best to do so, in case something else comes up! its too easy for folks to accidentally set em especially as we get contributors!

@brentru brentru changed the title Remove unused I2CDriver properties Remove unused I2CDriver properties and memory fixes Feb 23, 2022
@brentru brentru requested a review from ladyada February 23, 2022 21:57
@brentru
Copy link
Member Author

brentru commented Feb 23, 2022

@ladyada I've made a good # of modifications since the original PR comments and am requesting a re-review.

@brentru brentru merged commit 2666698 into main Feb 23, 2022
@brentru brentru deleted the remove-old-drivertype branch February 23, 2022 22:45
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.

2 participants