Skip to content

Conversation

@caternuson
Copy link
Contributor

Not perfect, but helps. Proposed fix for #27.

@caternuson caternuson requested a review from a team May 30, 2019 17:10
@ladyada
Copy link
Member

ladyada commented May 31, 2019

question - could we 'cache' the config register value, and if the pin has changed, send and if pin has not changed, skip that? then you dont have to have a separate 'fast' flag

@caternuson
Copy link
Contributor Author

Maybe. I was thinking the current way it works would be preserved. It's not efficient, but works. And if someone just loops on a single channel, nothing special happens. This would be single-shot / "slow". Nice and simple. How it currently works and hopefully should work for most cases.

for i in range(samples):
    data[i] = chan0.value

There are caveats to the fast read, so wanted to make it more explicit that it's being used, i.e. the context manager. This would be continuous / "fast". For more advanced uses.

with chan0 as chan:
    for i in range(samples):
        data[i] = chan.value

So you actually have to turn it on. It doesn't just kick in automagically.

Hmm. Could maybe move the fast parameter to a member variable of ADS1x15 and then turn it on/off with @property style access? Same general idea as what's currently in place, just changing the way it's triggered.

@caternuson
Copy link
Contributor Author

...but easy enough to try out. @ladyada checkout PR #33 which takes the caching approach.

@caternuson
Copy link
Contributor Author

Closing this. Going with the approach taken in PR #33 .

@caternuson caternuson closed this Jun 4, 2019
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.

2 participants