round real value with 2 decimal on server sync data json

This commit is contained in:
Phat Nguyen committed 2024-02-17 12:47:51 +07:00
1 parent 7c63af5ba9
commit 8c94cea764
5 files changed
+30 -22

No files matched your search

+4
View File
@@ -36,3 +36,7 @@ int AirGradient::getI2cSclPin(void) {
String AirGradient::getVersion(void) { return AG_LIB_VER; }
BoardType AirGradient::getBoardType(void) { return boardType; }
double AirGradient::round2(double value) {
return (int)(value * 100 + 0.5) / 100.0;
}
+8
View File
@@ -107,6 +107,14 @@ public:
*/
String getVersion(void);
/**
* @brief Round double value with for 2 decimal
*
* @param valuem Round value
* @return double
*/
double round2(double value);
private:
BoardType boardType;
};