Skip to content

removed reset() and MODE_IDLE from constructor #5

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 1 commit into from
Jul 15, 2024

Conversation

bablokb
Copy link
Contributor

@bablokb bablokb commented Jul 8, 2024

This PR removes the call to self.reset() and the switch to MODE_IDLE from the constructor.

Both statements are at best harmless, but in important use-cases harmful. The ENS160 has an internal timer for the warmup period after POR (three minutes). Resetting or switching to idle-mode resets this timer.

After power-on, the call to reset() is redundant, since the device is in reset mode anyhow. Otherwise, the call will reset the timer although this is not necessary. In my use-case, I sample data in intervals and use deep-sleep in between. Deep sleep keeps the device powered (at least on the Pico (W)), so only an initial warm up period is necessary. But after exiting from deep sleep the program (and the constructor) run again and this driver resets the timer causing a wait of three minutes every iteration.

If there is really a need for a reset, the method can be called any time explicitly.

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

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

This make sense to me, thank you for the fix and explanation @bablokb

I didn't test on hardware (don't have this sensor).

@FoamyGuy FoamyGuy merged commit 7dab2a9 into adafruit:main Jul 15, 2024
1 check passed
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jul 16, 2024
Updating https://github.com/adafruit/Adafruit_CircuitPython_ENS160 to 1.0.7 from 1.0.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_ENS160#5 from bablokb/no-reset

Updating https://github.com/adafruit/Adafruit_CircuitPython_ICM20X to 2.0.21 from 2.0.20:
  > Merge pull request adafruit/Adafruit_CircuitPython_ICM20X#24 from 42xnor/remove-accelrometer-sleep-calls

Updating https://github.com/adafruit/Adafruit_CircuitPython_PIOASM to 1.0.3 from 1.0.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_PIOASM#65 from adafruit/better-error-sideset-delay

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_HDC302x

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
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