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(); // sensor.enableWakeupInterrupt();
} }
float WatchyGSR::getBatteryVoltage(){ float WatchyGSR::getBatteryVoltage(){ return ((BatteryRead() - 0.0125) + (BatteryRead() - 0.0125) + (BatteryRead() - 0.0125) + (BatteryRead() - 0.0125)) / 4; }
float A, B, C, D; float WatchyGSR::BatteryRead(){
WatchyBatt Batt; if (RTC.rtcType == DS3231)
A = Batt.Read(RTC) - 0.0125; return analogReadMilliVolts(V10_ADC_PIN) / 500.0f; // Battery voltage goes through a 1/2 divider.
B = Batt.Read(RTC) - 0.0125; else if (RTC.rtcType == PCF8563)
C = Batt.Read(RTC) - 0.0125; return analogReadMilliVolts(V15_ADC_PIN) / 500.0f;
D = Batt.Read(RTC) - 0.0125; return 0.0;
return (((A + B + C + D) / 16384.0) * 7.23);
} }
uint16_t WatchyGSR::_readRegister(uint8_t address, uint8_t reg, uint8_t *data, uint16_t len) { 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 <Arduino_JSON.h>
#include <DS3232RTC.h> #include <DS3232RTC.h>
#include <Rtc_Pcf8563.h> #include <Rtc_Pcf8563.h>
#include "WatchyBattery.h"
#include "GxEPD2_BW.h" #include "GxEPD2_BW.h"
#include <mbedtls/base64.h> #include <mbedtls/base64.h>
#include <Wire.h> #include <Wire.h>
@ -49,6 +48,7 @@ class WatchyGSR{
void handleButtonPress(uint8_t Pressed); void handleButtonPress(uint8_t Pressed);
virtual void deepSleep(); virtual void deepSleep();
float getBatteryVoltage(); float getBatteryVoltage();
float BatteryRead();
bool IsDark(); bool IsDark();
IRAM_ATTR void handleInterrupt(); IRAM_ATTR void handleInterrupt();
private: private: