mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-04-06 15:05:57 +00:00
1.2
This commit is contained in:
parent
d40057ebbd
commit
8e85da253c
7 changed files with 29 additions and 18 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue