mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-14 09:25:30 -04:00
Merge branch 'pr/166' into Radiosonde-vaisala-add-temp-humidity-merge-conflicts-fix
This commit is contained in:
commit
3d9ce8a037
8 changed files with 247 additions and 74 deletions
|
@ -223,3 +223,13 @@ std::string unit_auto_scale(double n, const uint32_t base_nano, uint32_t precisi
|
|||
|
||||
return string;
|
||||
}
|
||||
|
||||
double get_decimals(double num, int16_t mult, bool round) {
|
||||
num -= int(num); //keep decimals only
|
||||
num *= mult; //Shift decimals into integers
|
||||
if (!round) return num;
|
||||
int16_t intnum = int(num); //Round it up if necessary
|
||||
num -= intnum; //Get decimal part
|
||||
if (num > .5) intnum++; //Round up
|
||||
return intnum;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue