mirror of https://github.com/sqfmi/Watchy.git
add board revision function
parent
acbb6eeece
commit
2da3fd9ede
|
@ -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": [
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -315,9 +315,8 @@ void Watchy::showAbout() {
|
|||
display.print("LibVer: ");
|
||||
display.println(WATCHY_LIB_VER);
|
||||
|
||||
const char *RTC_HW[3] = {"<UNKNOWN>", "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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue