auto switch ADC pin

pull/113/head v1.2.9
sqfmi 2021-11-29 17:01:25 -05:00
parent c6085ad483
commit 6363caeac2
4 changed files with 9 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{
"name": "Watchy",
"version": "1.2.8",
"version": "1.2.9",
"description": "Watchy - An Open Source E-Paper Watch by SQFMI",
"authors": [
{

View File

@ -1,5 +1,5 @@
name=Watchy
version=1.2.8
version=1.2.9
author=SQFMI
maintainer=SQFMI
sentence=Watchy - An Open Source E-Paper Watch by SQFMI

View File

@ -581,8 +581,11 @@ weatherData Watchy::getWeatherData(){
}
float Watchy::getBatteryVoltage(){
// Battery voltage goes through a 1/2 divider.
return analogReadMilliVolts(ADC_PIN) / 1000.0f * 2.0f;
if(RTC.rtcType == DS3231){
return analogReadMilliVolts(V10_ADC_PIN) / 1000.0f * 2.0f; // Battery voltage goes through a 1/2 divider.
}else{
return analogReadMilliVolts(V15_ADC_PIN) / 1000.0f * 2.0f;
}
}
uint16_t Watchy::_readRegister(uint8_t address, uint8_t reg, uint8_t *data, uint16_t len)

View File

@ -4,8 +4,8 @@
//pins
#define SDA 21
#define SCL 22
//#define ADC_PIN 33
#define ADC_PIN 35
#define V10_ADC_PIN 33 //OG v1.0 Watchy
#define V15_ADC_PIN 35 //v1.5 Watchy with PCF8563 RTC
#define RTC_PIN GPIO_NUM_27
#define CS 5
#define DC 10