Skip to content

Commit

Permalink
auto switch ADC pin
Browse files Browse the repository at this point in the history
  • Loading branch information
sqfmi committed Nov 29, 2021
1 parent c6085ad commit 6363cae
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -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": [
{
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/Watchy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6363cae

Please sign in to comment.