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

Changing Datatypes of _pulse and _totalpulse to avoid overflow #3

Merged
merged 2 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/FlowSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ void FlowSensor::read(int calibration)
/**
* @brief
*
* @return int total pulse
* @return unsigned long _totalpulse
*/
int FlowSensor::getPulse()
unsigned long FlowSensor::getPulse()
{
return this->_totalpulse;
}
Expand Down
8 changes: 4 additions & 4 deletions src/FlowSensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class FlowSensor
private:
uint8_t _pin;
uint8_t _type;
volatile int _totalpulse;
volatile int _pulse;
volatile unsigned long _totalpulse;
volatile unsigned long _pulse;
float _pulse1liter;
float _flowrateminute;
float _flowratesecound;
Expand All @@ -42,10 +42,10 @@ class FlowSensor
void begin(void (*userFunc)(void));
void read(int calibration = 0);
void count();
int getPulse();
unsigned long getPulse();
float getFlowRate_m();
float getFlowRate_s();
float getVolume();
};

#endif
#endif