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

GVH5184 - Refactor probeset #18

Merged
merged 8 commits into from
Jan 11, 2022
Merged

Conversation

ElksInNC
Copy link
Contributor

Refactoring - tighter / better aesthetic / easier to intuit what code is doing with bit/hex comparison.
Lines 60-78
Before: 605 characters - Compiled Driver: 2616
After: 583 characters - Compiled Driver: 2535 - 3% reduction in size

I have no idea how you would compare it from a computational efficiency perspective but should be slightly more efficient b/c the calculations/lookups for status, probetemp, and probeset are only performed once. probeset is declared with values set and then only 2 IF statements required instead of 3 to set the first two flags.

Tested on ESP32Solo1 with both live device and spoofer. All readings coming int MQTT and HA as expected.

Tighter / better aesthetic / easier to intuit what code is doing with bit/hex comparison.
Lines 60-74
Before: 605 characters - Compiled Driver: 2616
After: 583 characters - Compiled Driver: 2535 - 3% reduction in size

I have no idea how you would compare it from a computational efficiency perspective but should be slightly more efficient b/c the calculations/lookups for status, probetemp, and probeset are only performed once. probeset is declared with values set and then only 2 IF statements required instead of 3 to set the first two flags.
@tony-fav tony-fav merged commit b5b5b91 into tony-fav:main Jan 11, 2022
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.

None yet

2 participants