Changing Datatypes of _pulse and _totalpulse to avoid overflow #3
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 Hafidhh
During the tests of the library measuring running water in a residence, it was found that the variable _totalpulse periodically took negative values due an overflow.
I have made a change in the data types of the variables _pulse and _totalpulse, which were defined as "int" to type "unsigned long" to avoid overflow when reaching 32767. Now it is possible to measure up to 9.5 million liters (2^ 32-1=4E9, that is, 4294967295, which I divide by 450 pulses per liter, allows us to measure 4294967295/450=9.5444 million liters of water).
I first made 3 commits on outdated fork, then cancell it, and re-sync my fork to library v1.1.0 and then submit commits again and ask for this Pull.
Regards
Hugo