summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWolfgang (Wolle) Ewald <wolfgang.ewald@wolles-elektronikkiste.de>2020-08-15 12:05:01 +0200
committerGitHub <noreply@github.com>2020-08-15 12:05:01 +0200
commitcac77a29c68c093bb29478c5eff530f2e9564baa (patch)
tree62e3e797ed7cb351e818ad66f582654172a30adf /src
parentMerge pull request #10 from thijstriemstra/patch-2 (diff)
downloadADS1115_WE-cac77a29c68c093bb29478c5eff530f2e9564baa.tar
ADS1115_WE-cac77a29c68c093bb29478c5eff530f2e9564baa.tar.gz
ADS1115_WE-cac77a29c68c093bb29478c5eff530f2e9564baa.tar.bz2
ADS1115_WE-cac77a29c68c093bb29478c5eff530f2e9564baa.tar.lz
ADS1115_WE-cac77a29c68c093bb29478c5eff530f2e9564baa.tar.xz
ADS1115_WE-cac77a29c68c093bb29478c5eff530f2e9564baa.tar.zst
ADS1115_WE-cac77a29c68c093bb29478c5eff530f2e9564baa.zip
Diffstat (limited to '')
-rw-r--r--src/ADS1115_WE.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ADS1115_WE.cpp b/src/ADS1115_WE.cpp
index 6ccd3f4..c07b610 100644
--- a/src/ADS1115_WE.cpp
+++ b/src/ADS1115_WE.cpp
@@ -179,7 +179,7 @@ int16_t ADS1115_WE::getResultWithRange(int16_t min, int16_t max, int16_t maxMill
int16_t rawResult = readRegister(ADS1115_CONV_REG);
int16_t result = 0;
result = map(rawResult, -32767, 32767, min, max);
- result = (int16_t) (1.0 * result * voltageRange / maxMillivolt);
+ result = (int16_t) ((1.0 * result * voltageRange / maxMillivolt) + 0.999);
return result;
}