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

Bangle.js: get poll interval #2308

Closed
notEvil opened this issue Dec 29, 2022 · 5 comments
Closed

Bangle.js: get poll interval #2308

notEvil opened this issue Dec 29, 2022 · 5 comments

Comments

@notEvil
Copy link

notEvil commented Dec 29, 2022

Hi,

the powerSave option triggers a change in poll interval but there is no way to detect this change except for timing the events triggered by the poll handler. Use case: use "low poll rate" ~= "inactivity" ~= "not worn" to disable certain actions (buzz, HRM, ...) in apps/widgets.

I'm happy to prepare a PR if requested.

@gfwilliams
Copy link
Member

Yes, that could be a good idea.

Does it make sense to just add this to Bangle.getOptions() ?

@notEvil
Copy link
Author

notEvil commented Jan 5, 2023

I tried this already but don't think its a good idea. Bangle.getOptions internally calls the same function as Bangle.setOptions, and options never change except by Bangle.setOptions (I think). Adding poll rate to the options would break those implicit rules.

What about just Bangle.getPollInterval()?

@gfwilliams
Copy link
Member

Good point. We could just add getPollInterval, I guess it's ok.

I'm just a bit anxious about adding a whole bunch of extra functions as it makes it harder to find what you're after. It's also basically impossible for me to remove a method after it's been added :)

There is http://www.espruino.com/Reference#l_Bangle_dbg which returns debug info. It would make a lot of sense to add it in there I guess

@notEvil
Copy link
Author

notEvil commented Jan 5, 2023

I agree. I'll prepare a PR with Bangle.dbg().pollInterval

@gfwilliams
Copy link
Member

brilliant - thanks!

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