summaryrefslogtreecommitdiffstats
path: root/src/ADS1115_WE.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ADS1115_WE.cpp')
-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;
}