Skip to content
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

Remove dependency on chrono module for further compatibility #2

Open
MarksBench opened this issue Apr 19, 2021 · 1 comment
Open

Remove dependency on chrono module for further compatibility #2

MarksBench opened this issue Apr 19, 2021 · 1 comment

Comments

@MarksBench
Copy link

Hello,

For your consideration - I'm using a Pi Pico and couldn't find the "chrono" module. I replaced the chrono timer usage with utime.ticks in perform_single_ref_calibration() and it seems to work. From:

def perform_single_ref_calibration(self, vhv_init_byte):
        chrono = Timer.Chrono()
        self._register(SYSRANGE_START, 0x01|vhv_init_byte)
        chrono.start()
                                    
        while self._register((RESULT_INTERRUPT_STATUS & 0x07) == 0):
            time_elapsed = chrono.read_ms()

To:

def perform_single_ref_calibration(self, vhv_init_byte):
        self._register(SYSRANGE_START, 0x01|vhv_init_byte)
        startTime = utime.ticks_ms()

        while self._register((RESULT_INTERRUPT_STATUS & 0x07) == 0):
            time_elapsed = utime.ticks_diff(utime.ticks_ms(), startTime)

I apologize for my poor GitHub usage - this (and the other issue) are my first two steps on this platform...

@2020gaurav
Copy link

Thanks, @MarksBench looks like Chrono is not available for in microphone 1.15.0 which i am using for my ESP32. you should raise a pull request with above fix.

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

No branches or pull requests

2 participants