Skip to content

Remove verification check #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 15, 2019
Merged

Remove verification check #20

merged 3 commits into from
Nov 15, 2019

Conversation

caternuson
Copy link
Contributor

Possible fix for #15

Uses approach proposed by @gritnix in issue thread which checks for elapsed time. This slows down the constructor, but avoids relying on a register value that may not be as expected due to regular use.

@caternuson caternuson requested a review from a team November 14, 2019 23:29

if (buf[1] & 0b00011000) != 0b00011000:
# Try and verify this is the RTC we expect by checking change in secs
check = self.datetime_register.tm_sec
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could it be stopped?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an interesting question. It's possible, if the EOSC bit at 0x0E is set to 0 and the clock is on battery power only, then the clock would be stopped. I think maybe go back to the idea of a parameter being given to the constructor...verify_running=true? If true (default), the constructor verifies that the time is changing and so we have a running clock. If false, then the user clearly wants to be ok just having an item on 0x68.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. could be. hmmm. can be checked with OSF in status reg? but makes me question this general approach?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete it all, use just the addr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so no "is it a DS3231" check? just "yep. something's at 0x68"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. address check covered by I2CDevice init.

@caternuson caternuson changed the title Change verification check to be based on seconds Remove verification check Nov 15, 2019
@caternuson caternuson merged commit 1bf2707 into adafruit:master Nov 15, 2019
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Nov 15, 2019
Updating https://github.com/adafruit/Adafruit_CircuitPython_DS3231 to 2.2.1 from 2.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_DS3231#20 from caternuson/iss15
  > Merge pull request adafruit/Adafruit_CircuitPython_DS3231#19 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_TCS34725 to 3.2.3 from 3.2.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_TCS34725#24 from caternuson/iss20
  > Merge pull request adafruit/Adafruit_CircuitPython_TCS34725#23 from adafruit/dherrada-patch-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants