Skip to content

Commit c66b9ec

Browse files
authored
Merge pull request #246 from caternuson/misc_fixes
Fix ESP8266 WDT resets and DS3231 century bit issue
2 parents 3349ae1 + 313472d commit c66b9ec

File tree

13 files changed

+30
-30
lines changed

13 files changed

+30
-30
lines changed

examples/DS3231_alarm/DS3231_alarm.ino

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,42 +21,42 @@ void setup() {
2121
if(!rtc.begin()) {
2222
Serial.println("Couldn't find RTC!");
2323
Serial.flush();
24-
abort();
24+
while (1) delay(10);
2525
}
26-
26+
2727
if(rtc.lostPower()) {
2828
// this will adjust to the date and time at compilation
2929
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
3030
}
31-
31+
3232
//we don't need the 32K Pin, so disable it
3333
rtc.disable32K();
34-
34+
3535
// Making it so, that the alarm will trigger an interrupt
3636
pinMode(CLOCK_INTERRUPT_PIN, INPUT_PULLUP);
3737
attachInterrupt(digitalPinToInterrupt(CLOCK_INTERRUPT_PIN), onAlarm, FALLING);
38-
38+
3939
// set alarm 1, 2 flag to false (so alarm 1, 2 didn't happen so far)
4040
// if not done, this easily leads to problems, as both register aren't reset on reboot/recompile
4141
rtc.clearAlarm(1);
4242
rtc.clearAlarm(2);
43-
43+
4444
// stop oscillating signals at SQW Pin
4545
// otherwise setAlarm1 will fail
4646
rtc.writeSqwPinMode(DS3231_OFF);
47-
47+
4848
// turn off alarm 2 (in case it isn't off already)
4949
// again, this isn't done at reboot, so a previously set alarm could easily go overlooked
5050
rtc.disableAlarm(2);
51-
51+
5252
// schedule an alarm 10 seconds in the future
5353
if(!rtc.setAlarm1(
5454
rtc.now() + TimeSpan(10),
5555
DS3231_A1_Second // this mode triggers the alarm when the seconds match. See Doxygen for other options
5656
)) {
5757
Serial.println("Error, alarm wasn't set!");
5858
}else {
59-
Serial.println("Alarm will happen in 10 seconds!");
59+
Serial.println("Alarm will happen in 10 seconds!");
6060
}
6161
}
6262

@@ -76,14 +76,14 @@ void loop() {
7676
// control register values (see https://datasheets.maximintegrated.com/en/ds/DS3231.pdf page 13)
7777
// Serial.print(" Control: 0b");
7878
// Serial.println(read_i2c_register(DS3231_ADDRESS, DS3231_CONTROL), BIN);
79-
79+
8080
// resetting SQW and alarm 1 flag
8181
// using setAlarm1, the next alarm could now be configurated
8282
if(rtc.alarmFired(1)) {
8383
rtc.clearAlarm(1);
8484
Serial.println("Alarm cleared");
8585
}
86-
86+
8787
delay(2000);
8888
}
8989

examples/ds1307/ds1307.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void setup () {
1515
if (! rtc.begin()) {
1616
Serial.println("Couldn't find RTC");
1717
Serial.flush();
18-
abort();
18+
while (1) delay(10);
1919
}
2020

2121
if (! rtc.isrunning()) {

examples/ds1307SqwPin/ds1307SqwPin.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void setup () {
4545
if (! rtc.begin()) {
4646
Serial.println("Couldn't find RTC");
4747
Serial.flush();
48-
abort();
48+
while (1) delay(10);
4949
}
5050

5151
print_mode();

examples/ds1307nvram/ds1307nvram.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void setup () {
2323
if (! rtc.begin()) {
2424
Serial.println("Couldn't find RTC");
2525
Serial.flush();
26-
abort();
26+
while (1) delay(10);
2727
}
2828

2929
// Print old RAM contents on startup.

examples/ds3231/ds3231.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void setup () {
1515
if (! rtc.begin()) {
1616
Serial.println("Couldn't find RTC");
1717
Serial.flush();
18-
abort();
18+
while (1) delay(10);
1919
}
2020

2121
if (rtc.lostPower()) {

examples/interrupts1Hz/interrupts1Hz.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void setup() {
5959
if (! rtc.begin()) {
6060
Serial.println("Couldn't find RTC");
6161
Serial.flush();
62-
abort();
62+
while (1) delay(10);
6363
}
6464
if (!rtc.initialized() || rtc.lostPower()) {
6565
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

examples/pcf8523/pcf8523.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void setup () {
1515
if (! rtc.begin()) {
1616
Serial.println("Couldn't find RTC");
1717
Serial.flush();
18-
abort();
18+
while (1) delay(10);
1919
}
2020

2121
if (! rtc.initialized() || rtc.lostPower()) {
@@ -44,7 +44,7 @@ void setup () {
4444
// to be restarted by clearing the STOP bit. Let's do this to ensure
4545
// the RTC is running.
4646
rtc.start();
47-
47+
4848
// The PCF8523 can be calibrated for:
4949
// - Aging adjustment
5050
// - Temperature compensation

examples/pcf8523Countdown/pcf8523Countdown.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void setup () {
4242
if (! rtc.begin()) {
4343
Serial.println("Couldn't find RTC");
4444
Serial.flush();
45-
abort();
45+
while (1) delay(10);
4646
}
4747

4848
pinMode(LED_BUILTIN, OUTPUT);

examples/pcf8563/pcf8563.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void setup () {
1515
if (! rtc.begin()) {
1616
Serial.println("Couldn't find RTC");
1717
Serial.flush();
18-
abort();
18+
while (1) delay(10);
1919
}
2020

2121
if (rtc.lostPower()) {

examples/pcf8563_interrupt/pcf8563_interrupt.ino

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RTC_PCF8563 rtc;
66
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
77

88
// use D2 for INT0; attach to CLKOUT pin on RTC
9-
const uint8_t INT_PIN = 2;
9+
const uint8_t INT_PIN = 2;
1010

1111
// flag to update serial; set in interrupt callback
1212
volatile uint8_t tick_tock = 1;
@@ -23,7 +23,7 @@ void setup () {
2323
while (!Serial); // wait for serial port to connect. Needed for native USB
2424
#endif
2525

26-
26+
2727
pinMode(INT_PIN, INPUT); // set up interrupt pin
2828
digitalWrite(INT_PIN, HIGH); // turn on pullup resistors
2929
// attach interrupt to set_tick_tock callback on rising edge of INT0
@@ -32,7 +32,7 @@ void setup () {
3232
if (! rtc.begin()) {
3333
Serial.println("Couldn't find RTC");
3434
Serial.flush();
35-
abort();
35+
while (1) delay(10);
3636
}
3737

3838
if (rtc.lostPower()) {
@@ -51,7 +51,7 @@ void setup () {
5151
}
5252

5353

54-
54+
5555
// When time needs to be re-set on a previously configured device, the
5656
// following line sets the RTC to the date & time this sketch was compiled
5757
// rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
@@ -63,7 +63,7 @@ void setup () {
6363
// to be restarted by clearing the STOP bit. Let's do this to ensure
6464
// the RTC is running.
6565
rtc.start();
66-
66+
6767
// turn on 1Hz clock out, used as INT0 for serial update every second
6868
rtc.writeSqwPinMode(PCF8563_SquareWave1Hz);
6969
}
@@ -72,7 +72,7 @@ void loop () {
7272

7373
// check if time display should be output
7474
if(tick_tock) {
75-
75+
7676
DateTime now = rtc.now();
7777

7878
char time_format[] = "hh:mm:ss AP";
@@ -81,7 +81,7 @@ void loop () {
8181
Serial.println(now.toString(time_format));
8282
Serial.println(now.toString(date_format));
8383
Serial.println();
84-
84+
8585
tick_tock = 0;
8686

8787
}

0 commit comments

Comments
 (0)