Skip to content

Commit f9ab815

Browse files
committed
Add snippet to handle non-callback alarm
1 parent e47ff70 commit f9ab815

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: src/Board.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,13 @@ bool Board::enableWakeupFromRTC(uint32_t hours, uint32_t minutes, uint32_t secon
160160
match.addMatchHour(); // Trigger the alarm when the hours match
161161

162162
// Set the alarm callback (assuming you have a callback function named alarmCallback)
163-
if (!rtc -> setAlarmCallback(callbackFunction, alarmTime, match)) {
163+
if (callbackFunction && !rtc -> setAlarmCallback(callbackFunction, alarmTime, match)) {
164164
return false; // Failed to set the alarm
165+
} else {
166+
// Set the alarm without a callback
167+
// if (!rtc -> setAlarm(alarmTime, match)) {
168+
// return false; // Failed to set the alarm
169+
// }
165170
}
166171
delay(1);
167172
return true;

0 commit comments

Comments
 (0)