1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-24 15:43:46 +02:00

Mi Band 3: Fix setting menu items with 2.4 firmware and add support for the new timer menu

This commit is contained in:
Andreas Shimokawa 2019-05-29 15:53:44 +02:00
parent fb04e0b48f
commit 78dd7ef153
3 changed files with 8 additions and 2 deletions

View File

@ -22,7 +22,7 @@ import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiService.EN
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiService.ENDPOINT_DISPLAY_ITEMS; import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiService.ENDPOINT_DISPLAY_ITEMS;
public class MiBand3Service { public class MiBand3Service {
public static final byte[] COMMAND_CHANGE_SCREENS = new byte[]{ENDPOINT_DISPLAY_ITEMS, DISPLAY_ITEM_BIT_CLOCK, 0x30, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00}; public static final byte[] COMMAND_CHANGE_SCREENS = new byte[]{ENDPOINT_DISPLAY_ITEMS, DISPLAY_ITEM_BIT_CLOCK, 0x30, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00};
public static final byte[] COMMAND_ENABLE_BAND_SCREEN_UNLOCK = new byte[]{ENDPOINT_DISPLAY, 0x16, 0x00, 0x01}; public static final byte[] COMMAND_ENABLE_BAND_SCREEN_UNLOCK = new byte[]{ENDPOINT_DISPLAY, 0x16, 0x00, 0x01};
public static final byte[] COMMAND_DISABLE_BAND_SCREEN_UNLOCK = new byte[]{ENDPOINT_DISPLAY, 0x16, 0x00, 0x00}; public static final byte[] COMMAND_DISABLE_BAND_SCREEN_UNLOCK = new byte[]{ENDPOINT_DISPLAY, 0x16, 0x00, 0x00};
public static final byte[] COMMAND_NIGHT_MODE_OFF = new byte[]{0x1a, 0x00}; public static final byte[] COMMAND_NIGHT_MODE_OFF = new byte[]{0x1a, 0x00};

View File

@ -86,9 +86,13 @@ public class MiBand3Support extends AmazfitBipSupport {
command[1] |= 0x40; command[1] |= 0x40;
command[9] = pos++; command[9] = pos++;
} }
if (pages.contains("timer")) {
command[1] |= 0x80;
command[10] = pos++;
}
} }
for (int i = 4; i <= 9; i++) { for (int i = 4; i <= 10; i++) {
if (command[i] == 0) { if (command[i] == 0) {
command[i] = pos++; command[i] = pos++;
} }

View File

@ -223,6 +223,7 @@
<item>@string/menuitem_more</item> <item>@string/menuitem_more</item>
<item>@string/menuitem_status</item> <item>@string/menuitem_status</item>
<item>@string/heart_rate</item> <item>@string/heart_rate</item>
<item>@string/menuitem_timer</item>
</string-array> </string-array>
<string-array name="pref_miband3_display_items_values"> <string-array name="pref_miband3_display_items_values">
@ -232,6 +233,7 @@
<item>@string/p_menuitem_more</item> <item>@string/p_menuitem_more</item>
<item>@string/p_menuitem_status</item> <item>@string/p_menuitem_status</item>
<item>@string/p_heart_rate</item> <item>@string/p_heart_rate</item>
<item>@string/p_menuitem_timer</item>
</string-array> </string-array>
<string-array name="pref_miband3_display_items_default"> <string-array name="pref_miband3_display_items_default">