dogfood-timer improved time keeping accuracy even more

master
Cole Deck 7 years ago
parent f09abf967f
commit 415a5f8484

@ -192,7 +192,7 @@ void setuptime() {
} }
delay(250); delay(250);
unsigned long oldtime = 0; unsigned long oldtime = 0;
unsigned long secper20 = now(); unsigned long clockoffset = now();
check = false; check = false;
while(1 == 1) { while(1 == 1) {
time_t t = now(); time_t t = now();
@ -232,7 +232,7 @@ void setuptime() {
if(now() != oldtime) { if(now() != oldtime) {
//if(check == false) { //if(check == false) {
//Serial.println(analogRead(3)); //Serial.println(analogRead(3));
if(now()-1200 >= secper20) { if(now()-1500 >= clockoffset) {
if(now()-15 >= wait && analogRead(3) < 100) { if(now()-15 >= wait && analogRead(3) < 100) {
digitalWrite(10, LOW); // just in case the arduino skips a second at the wrong time digitalWrite(10, LOW); // just in case the arduino skips a second at the wrong time
} }
@ -240,7 +240,7 @@ void setuptime() {
today = 0; today = 0;
} }
setTime(now() + 1); setTime(now() + 1);
secper20 = now(); clockoffset = now();
} }
if(now()-15 >= wait && analogRead(3) < 100) { if(now()-15 >= wait && analogRead(3) < 100) {
digitalWrite(10, LOW); digitalWrite(10, LOW);

Loading…
Cancel
Save