diff --git a/library.json b/library.json index 53f5ef0..5c35af1 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "Watchy", - "version": "1.4.9", + "version": "1.4.10", "description": "Watchy - An Open Source E-Paper Watch by SQFMI", "authors": [ { diff --git a/library.properties b/library.properties index bf1303d..49709c0 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Watchy -version=1.4.9 +version=1.4.10 author=SQFMI maintainer=SQFMI sentence=Watchy - An Open Source E-Paper Watch by SQFMI diff --git a/src/Watchy.cpp b/src/Watchy.cpp index 334224e..8353011 100644 --- a/src/Watchy.cpp +++ b/src/Watchy.cpp @@ -315,9 +315,8 @@ void Watchy::showAbout() { display.print("LibVer: "); display.println(WATCHY_LIB_VER); - const char *RTC_HW[3] = {"", "DS3231", "PCF8563"}; - display.print("RTC: "); - display.println(RTC_HW[RTC.rtcType]); // 0 = UNKNOWN, 1 = DS3231, 2 = PCF8563 + display.print("Rev: v"); + display.println(getBoardRevision()); display.print("Batt: "); float voltage = getBatteryVoltage(); @@ -702,6 +701,31 @@ float Watchy::getBatteryVoltage() { } } +uint8_t Watchy::getBoardRevision() { + esp_chip_info_t chip_info; + esp_chip_info(&chip_info); + if(chip_info.model == CHIP_ESP32){ //Revision 1.0 - 2.0 + Wire.beginTransmission(0x68); //v1.0 has DS3231 + if (Wire.endTransmission() == 0){ + return 10; + } + delay(1); + Wire.beginTransmission(0x51); //v1.5 and v2.0 have PCF8563 + if (Wire.endTransmission() == 0){ + pinMode(35, INPUT); + if(digitalRead(35) == 0){ + return 20; //in rev 2.0, pin 35 is BTN 3 and has a pulldown + }else{ + return 15; //in rev 1.5, pin 35 is the battery ADC + } + } + } + if(chip_info.model == CHIP_ESP32S3){ //Revision 3.0 + return 30; + } + return -1; +} + uint16_t Watchy::_readRegister(uint8_t address, uint8_t reg, uint8_t *data, uint16_t len) { Wire.beginTransmission(address); diff --git a/src/Watchy.h b/src/Watchy.h index 15465a6..d056d50 100644 --- a/src/Watchy.h +++ b/src/Watchy.h @@ -16,6 +16,7 @@ #include "BLE.h" #include "bma.h" #include "config.h" +#include "esp_chip_info.h" typedef struct weatherData { int8_t temperature; @@ -56,6 +57,7 @@ public: void init(String datetime = ""); void deepSleep(); float getBatteryVoltage(); + uint8_t getBoardRevision(); void vibMotor(uint8_t intervalMs = 100, uint8_t length = 20); virtual void handleButtonPress(); diff --git a/src/config.h b/src/config.h index 15db957..22fa99c 100644 --- a/src/config.h +++ b/src/config.h @@ -2,7 +2,7 @@ #define CONFIG_H // Versioning -#define WATCHY_LIB_VER "1.4.9" +#define WATCHY_LIB_VER "1.4.10" //pins #if !defined(ARDUINO_WATCHY_V10) && !defined(ARDUINO_WATCHY_V15) && !defined(ARDUINO_WATCHY_V20)