summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang (Wolle) Ewald <wolfgang.ewald@wolles-elektronikkiste.de>2021-05-15 12:32:16 +0200
committerGitHub <noreply@github.com>2021-05-15 12:32:16 +0200
commit4d32443a67164d5c67af1b9053b7d0082ebe3f31 (patch)
tree08941470a017d69f08ac8e709125a0bab26db449
parentUpdate library.properties (diff)
downloadADS1115_WE-4d32443a67164d5c67af1b9053b7d0082ebe3f31.tar
ADS1115_WE-4d32443a67164d5c67af1b9053b7d0082ebe3f31.tar.gz
ADS1115_WE-4d32443a67164d5c67af1b9053b7d0082ebe3f31.tar.bz2
ADS1115_WE-4d32443a67164d5c67af1b9053b7d0082ebe3f31.tar.lz
ADS1115_WE-4d32443a67164d5c67af1b9053b7d0082ebe3f31.tar.xz
ADS1115_WE-4d32443a67164d5c67af1b9053b7d0082ebe3f31.tar.zst
ADS1115_WE-4d32443a67164d5c67af1b9053b7d0082ebe3f31.zip
-rw-r--r--src/ADS1115_WE.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/ADS1115_WE.cpp b/src/ADS1115_WE.cpp
index dad4c41..d00cdfc 100644
--- a/src/ADS1115_WE.cpp
+++ b/src/ADS1115_WE.cpp
@@ -261,8 +261,8 @@ void ADS1115_WE::startSingleMeasurement(){
}
float ADS1115_WE::getResult_V(){
- int16_t rawResult = getRawResult();
- float result = (rawResult * 1.0 / ADS1115_REG_FACTOR) * voltageRange/1000;
+ float result = getResult_mV();
+ result /= 1000;
return result;
}
@@ -295,9 +295,7 @@ int16_t ADS1115_WE::getResultWithRange(int16_t min, int16_t max){
}
int16_t ADS1115_WE::getResultWithRange(int16_t min, int16_t max, int16_t maxMillivolt){
- int16_t rawResult = getRawResult();
- int16_t result = 0;
- result = map(rawResult, -32767, 32767, min, max);
+ int16_t result = getResultWithRange(min, max);
result = (int16_t) ((1.0 * result * voltageRange / maxMillivolt) + 0.5);
return result;
}