mirror of https://github.com/sqfmi/Watchy.git
fixed bugs and change temp. sensor
parent
7380c6b8f1
commit
ec26c84da2
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Watchy",
|
"name": "Watchy",
|
||||||
"version": "1.2.9",
|
"version": "1.2.10",
|
||||||
"description": "Watchy - An Open Source E-Paper Watch by SQFMI",
|
"description": "Watchy - An Open Source E-Paper Watch by SQFMI",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name=Watchy
|
name=Watchy
|
||||||
version=1.2.9
|
version=1.2.10
|
||||||
author=SQFMI
|
author=SQFMI
|
||||||
maintainer=SQFMI
|
maintainer=SQFMI
|
||||||
sentence=Watchy - An Open Source E-Paper Watch by SQFMI
|
sentence=Watchy - An Open Source E-Paper Watch by SQFMI
|
||||||
|
|
|
@ -565,8 +565,8 @@ weatherData Watchy::getWeatherData(){
|
||||||
//turn off radios
|
//turn off radios
|
||||||
WiFi.mode(WIFI_OFF);
|
WiFi.mode(WIFI_OFF);
|
||||||
btStop();
|
btStop();
|
||||||
}else{//No WiFi, use RTC Temperature
|
}else{//No WiFi, use internal temperature sensor
|
||||||
uint8_t temperature = RTC.temperature() / 4; //celsius
|
uint8_t temperature = sensor.readTemperature(); //celsius
|
||||||
if(strcmp(TEMP_UNIT, "imperial") == 0){
|
if(strcmp(TEMP_UNIT, "imperial") == 0){
|
||||||
temperature = temperature * 9. / 5. + 32.; //fahrenheit
|
temperature = temperature * 9. / 5. + 32.; //fahrenheit
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,11 @@ void WatchyRTC::set(tmElements_t tm){
|
||||||
rtc_ds.set(t);
|
rtc_ds.set(t);
|
||||||
}else{
|
}else{
|
||||||
rtc_pcf.setDate(tm.Day, _getDayOfWeek(tm.Day, tm.Month, tm.Year+YEAR_OFFSET_PCF), tm.Month, 0, tm.Year);
|
rtc_pcf.setDate(tm.Day, _getDayOfWeek(tm.Day, tm.Month, tm.Year+YEAR_OFFSET_PCF), tm.Month, 0, tm.Year);
|
||||||
rtc_pcf.setTime(tm.Hour, tm.Minute, tm.Second);
|
rtc_pcf.setTime(tm.Hour, tm.Minute, tm.Second);
|
||||||
|
rtc_pcf.clearAlarm();
|
||||||
|
int nextAlarmMinute = rtc_pcf.getMinute();
|
||||||
|
nextAlarmMinute = (nextAlarmMinute == 59) ? 0 : (nextAlarmMinute + 1);
|
||||||
|
rtc_pcf.setAlarm(nextAlarmMinute, 99, 99, 99);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,12 +74,12 @@ uint8_t WatchyRTC::temperature(){
|
||||||
if(rtcType == DS3231){
|
if(rtcType == DS3231){
|
||||||
return rtc_ds.temperature();
|
return rtc_ds.temperature();
|
||||||
}else{
|
}else{
|
||||||
return 25;
|
return 255; //error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchyRTC::_DSConfig(String datetime){
|
void WatchyRTC::_DSConfig(String datetime){
|
||||||
if(datetime != NULL){
|
if(datetime != ""){
|
||||||
tmElements_t tm;
|
tmElements_t tm;
|
||||||
tm.Year = _getValue(datetime, ':', 0).toInt() - YEAR_OFFSET_DS;//offset from 1970, since year is stored in uint8_t
|
tm.Year = _getValue(datetime, ':', 0).toInt() - YEAR_OFFSET_DS;//offset from 1970, since year is stored in uint8_t
|
||||||
tm.Month = _getValue(datetime, ':', 1).toInt();
|
tm.Month = _getValue(datetime, ':', 1).toInt();
|
||||||
|
@ -93,7 +97,8 @@ void WatchyRTC::_DSConfig(String datetime){
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchyRTC::_PCFConfig(String datetime){
|
void WatchyRTC::_PCFConfig(String datetime){
|
||||||
if(datetime != NULL){
|
rtc_pcf.initClock();
|
||||||
|
if(datetime != ""){
|
||||||
tmElements_t tm;
|
tmElements_t tm;
|
||||||
tm.Year = _getValue(datetime, ':', 0).toInt();
|
tm.Year = _getValue(datetime, ':', 0).toInt();
|
||||||
tm.Month = _getValue(datetime, ':', 1).toInt();
|
tm.Month = _getValue(datetime, ':', 1).toInt();
|
||||||
|
@ -102,12 +107,10 @@ void WatchyRTC::_PCFConfig(String datetime){
|
||||||
tm.Minute = _getValue(datetime, ':', 4).toInt();
|
tm.Minute = _getValue(datetime, ':', 4).toInt();
|
||||||
tm.Second = _getValue(datetime, ':', 5).toInt();
|
tm.Second = _getValue(datetime, ':', 5).toInt();
|
||||||
|
|
||||||
rtc_pcf.initClock();
|
|
||||||
//day, weekday, month, century(1=1900, 0=2000), year(0-99)
|
//day, weekday, month, century(1=1900, 0=2000), year(0-99)
|
||||||
rtc_pcf.setDate(tm.Day, _getDayOfWeek(tm.Day, tm.Month, tm.Year), tm.Month, 0, tm.Year - YEAR_OFFSET_PCF);//offset from 2000, since year is stored in uint8_t
|
rtc_pcf.setDate(tm.Day, _getDayOfWeek(tm.Day, tm.Month, tm.Year), tm.Month, 0, tm.Year - YEAR_OFFSET_PCF);//offset from 2000, since year is stored in uint8_t
|
||||||
//hr, min, sec
|
//hr, min, sec
|
||||||
rtc_pcf.setTime(tm.Hour, tm.Minute, tm.Second);
|
rtc_pcf.setTime(tm.Hour, tm.Minute, tm.Second);
|
||||||
|
|
||||||
}
|
}
|
||||||
rtc_pcf.clearAlarm();
|
rtc_pcf.clearAlarm();
|
||||||
int nextAlarmMinute = rtc_pcf.getMinute();
|
int nextAlarmMinute = rtc_pcf.getMinute();
|
||||||
|
|
Loading…
Reference in New Issue