Unified Version 1.3.4.

This commit is contained in:
GuruSR 2021-11-29 19:57:51 -05:00 committed by GitHub
parent 2e192d0a60
commit 547f99787f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View File

@ -2234,14 +2234,13 @@ void WatchyGSR::_bmaConfig() {
// sensor.enableWakeupInterrupt();
}
float WatchyGSR::getBatteryVoltage(){
float A, B, C, D;
WatchyBatt Batt;
A = Batt.Read(RTC) - 0.0125;
B = Batt.Read(RTC) - 0.0125;
C = Batt.Read(RTC) - 0.0125;
D = Batt.Read(RTC) - 0.0125;
return (((A + B + C + D) / 16384.0) * 7.23);
float WatchyGSR::getBatteryVoltage(){ return ((BatteryRead() - 0.0125) + (BatteryRead() - 0.0125) + (BatteryRead() - 0.0125) + (BatteryRead() - 0.0125)) / 4; }
float WatchyGSR::BatteryRead(){
if (RTC.rtcType == DS3231)
return analogReadMilliVolts(V10_ADC_PIN) / 500.0f; // Battery voltage goes through a 1/2 divider.
else if (RTC.rtcType == PCF8563)
return analogReadMilliVolts(V15_ADC_PIN) / 500.0f;
return 0.0;
}
uint16_t WatchyGSR::_readRegister(uint8_t address, uint8_t reg, uint8_t *data, uint16_t len) {

View File

@ -17,7 +17,6 @@
#include <Arduino_JSON.h>
#include <DS3232RTC.h>
#include <Rtc_Pcf8563.h>
#include "WatchyBattery.h"
#include "GxEPD2_BW.h"
#include <mbedtls/base64.h>
#include <Wire.h>
@ -49,6 +48,7 @@ class WatchyGSR{
void handleButtonPress(uint8_t Pressed);
virtual void deepSleep();
float getBatteryVoltage();
float BatteryRead();
bool IsDark();
IRAM_ATTR void handleInterrupt();
private: