Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Initial implementation for Mi Band 2 'custom menu' #1453

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

mvallerie
Copy link

@mvallerie mvallerie commented Mar 12, 2019

Hi,

First of all, thanks for this great app.

This PR implements a "custom menu" feature using the func button of the Mi Band 2. Something very similar to what is shown in this YouTube video.

Here are the needed configuration steps :

  • Enable the Mi Band Action button
  • Set a minimum value for "Delay Button After Action" (otherwise, the first menu option may not display correctly on the band).
  • Enable the Custom Menu under "Button Action" > "Custom Menu" and set the "Menu Elements" (that's very gross for now...you have to input it as Label1:Message1;Label2:Message2;...).
  • Enable Text notifications in Mi Band 2 specific settings
  • You're good to go : now, the "Button Action" will trigger the custom menu opening. Then, single tap to move forward in the menu, double tap to move backwards, and triple tap to validate (so it will broadcast the associated message, which you can catch in any automation tool). If you don't do anything during 5 secs, the menu will close.

It's working great but :

  • The band vibrates every time it gets a "menu notification", i'm not sure why, and i couldn't find a way to get around.
  • I have no idea if this PR may or may not have impact on other existing devices support. It should not, but you never know. I hope i'm not adding more spaghettis :-).

Some improveable-s :

  • Custom separators / better UI for the "Menu Elements" string
  • Custom controls for the menu (easy one, but i don't have much time this week). Right now they're hardcoded.

Thanks in adv. for your feedback.

Edit : Also, after a day of testing, it seems as soon as the phone screen goes off, gadget bridge will stop talking to the band (or sometimes it will, but very, very slowly). Do you know if that could be related to my phone settings ? I thought disabling battery optimizations would be enough :-(.

@mvallerie
Copy link
Author

mvallerie commented Mar 14, 2019

I added configurable menu controls.

As said in my edit, the only issue i had so far using this is when the screen is off. Sometimes the menu becomes unresponsive (ie : the phone doesn't send the alert to the band immediately, there's a 5-10 secs delay).

Edit : I added a wakelock setting, and it seems to fix it when the phone is asleep or locked.

According to a few references, the Timers won't work well when the Android device is locked / asleep, unless you acquire a wake lock. I acquire the lock only while browsing the custom menu, so even if the device is asleep, the only delay you may have is when you open the menu (because we can't keep the wake lock 100% of the time). All the navigation will then be fluent. When the menu is exited (or after 5 secs timeout), the wakelock is released.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant