adafruit / adafruit/RTClib

lostpower()

Open
#321 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
857
Forks
719
PR merge metrics
No merged PRs in 30d

Description

I don't care which RTC chip a user selects, but the code used rtc.lostpower() to check if it needs initializing. However the DS1307 doesn't have that function. Looking at the source code it seems like the isrunning() function is in fact the lostpower() function except that the user might have turned off the clock. So an implementation of lostpower() would be to check if it isrunning and if not, check the date for the value 01/01/00 01 00:00:00 which according to the datasheet is the date after initial power on.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the RTC source around the existing isrunning() implementation and the DS1307 support, then check the DS1307 datasheet details cited in the issue. Confirm how the other RTC chips expose lostpower() and identify the relevant tests or examples, if present. Done means DS1307 users can call lostpower() consistently without breaking the case where the clock was deliberately stopped.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.