mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-07-05 01:12:06 +02:00
1.2
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
#include "battery_utils.h"
|
||||
#include "pins_config.h"
|
||||
|
||||
extern String batteryVoltage;
|
||||
|
||||
float adcReadingTransformation = (4095/3.3);
|
||||
float adcReadingTransformation = (3.3/4095);
|
||||
float voltageDividerCorrection = 0.288;
|
||||
|
||||
namespace BATTERY_Utils {
|
||||
|
||||
String checkVoltages() {
|
||||
float checkVoltages() {
|
||||
float sample;
|
||||
int sampleSum = 0;
|
||||
for (int i=0; i<100; i++) {
|
||||
@@ -15,8 +14,7 @@ String checkVoltages() {
|
||||
sampleSum += sample;
|
||||
delayMicroseconds(50);
|
||||
}
|
||||
batteryVoltage = 2.1571 *(sampleSum/100) * adcReadingTransformation;
|
||||
return String(batteryVoltage);
|
||||
return (2 * (sampleSum/100) * adcReadingTransformation) + voltageDividerCorrection;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user