From 30b4c1b8685cd5fb10957b82e27e0ead812d0657 Mon Sep 17 00:00:00 2001 From: vanous Date: Fri, 20 May 2022 22:10:16 +0200 Subject: [PATCH 1/4] AmazfitBand5: Enable extended HR monitoring --- .../devices/huami/amazfitband5/AmazfitBand5Coordinator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband5/AmazfitBand5Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband5/AmazfitBand5Coordinator.java index 735bda426..a0db606d4 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband5/AmazfitBand5Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband5/AmazfitBand5Coordinator.java @@ -101,7 +101,7 @@ public class AmazfitBand5Coordinator extends HuamiCoordinator { R.xml.devicesettings_amazfitband5, R.xml.devicesettings_vibrationpatterns, R.xml.devicesettings_wearlocation, - R.xml.devicesettings_heartrate_sleep, + R.xml.heartrate_sleep_alert_activity_stress, R.xml.devicesettings_goal_notification, R.xml.devicesettings_custom_emoji_font, R.xml.devicesettings_timeformat, From fa3bdd36d5e30c0b2f6ee2712032ca2f9109e2f2 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sun, 22 May 2022 00:27:35 +0200 Subject: [PATCH 2/4] Amazfit Bip U/Pro: enable hr alert and stress tracking setting --- .../devices/huami/amazfitband5/AmazfitBand5Coordinator.java | 2 +- .../devices/huami/amazfitbipu/AmazfitBipUCoordinator.java | 2 +- .../devices/huami/amazfitbipupro/AmazfitBipUProCoordinator.java | 2 +- .../gadgetbridge/devices/huami/miband5/MiBand5Coordinator.java | 2 +- .../gadgetbridge/devices/huami/miband6/MiBand6Coordinator.java | 2 +- ...=> devicesettings_heartrate_sleep_alert_activity_stress.xml} | 0 6 files changed, 5 insertions(+), 5 deletions(-) rename app/src/main/res/xml/{heartrate_sleep_alert_activity_stress.xml => devicesettings_heartrate_sleep_alert_activity_stress.xml} (100%) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband5/AmazfitBand5Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband5/AmazfitBand5Coordinator.java index a0db606d4..763c166e7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband5/AmazfitBand5Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband5/AmazfitBand5Coordinator.java @@ -101,7 +101,7 @@ public class AmazfitBand5Coordinator extends HuamiCoordinator { R.xml.devicesettings_amazfitband5, R.xml.devicesettings_vibrationpatterns, R.xml.devicesettings_wearlocation, - R.xml.heartrate_sleep_alert_activity_stress, + R.xml.devicesettings_heartrate_sleep_alert_activity_stress, R.xml.devicesettings_goal_notification, R.xml.devicesettings_custom_emoji_font, R.xml.devicesettings_timeformat, diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipu/AmazfitBipUCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipu/AmazfitBipUCoordinator.java index faa3dc412..7a9adbe0a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipu/AmazfitBipUCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipu/AmazfitBipUCoordinator.java @@ -112,7 +112,7 @@ public class AmazfitBipUCoordinator extends HuamiCoordinator { R.xml.devicesettings_timeformat, R.xml.devicesettings_world_clocks, R.xml.devicesettings_wearlocation, - R.xml.devicesettings_heartrate_sleep, + R.xml.devicesettings_heartrate_sleep_alert_activity_stress, R.xml.devicesettings_goal_notification, R.xml.devicesettings_custom_emoji_font, R.xml.devicesettings_liftwrist_display_sensitivity, diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipupro/AmazfitBipUProCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipupro/AmazfitBipUProCoordinator.java index 6a090b402..9d1484233 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipupro/AmazfitBipUProCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipupro/AmazfitBipUProCoordinator.java @@ -111,7 +111,7 @@ public class AmazfitBipUProCoordinator extends HuamiCoordinator { R.xml.devicesettings_timeformat, R.xml.devicesettings_world_clocks, R.xml.devicesettings_wearlocation, - R.xml.devicesettings_heartrate_sleep, + R.xml.devicesettings_heartrate_sleep_alert_activity_stress, R.xml.devicesettings_goal_notification, R.xml.devicesettings_custom_emoji_font, R.xml.devicesettings_liftwrist_display_sensitivity, diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5Coordinator.java index edf442680..0c40d3489 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5Coordinator.java @@ -106,7 +106,7 @@ public class MiBand5Coordinator extends HuamiCoordinator { R.xml.devicesettings_miband5, R.xml.devicesettings_vibrationpatterns, R.xml.devicesettings_wearlocation, - R.xml.heartrate_sleep_alert_activity_stress, + R.xml.devicesettings_heartrate_sleep_alert_activity_stress, R.xml.devicesettings_goal_notification, R.xml.devicesettings_custom_emoji_font, R.xml.devicesettings_timeformat, diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband6/MiBand6Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband6/MiBand6Coordinator.java index 8b3e2ead4..26f7e703f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband6/MiBand6Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband6/MiBand6Coordinator.java @@ -86,7 +86,7 @@ public class MiBand6Coordinator extends HuamiCoordinator { R.xml.devicesettings_miband6, R.xml.devicesettings_vibrationpatterns, R.xml.devicesettings_wearlocation, - R.xml.heartrate_sleep_alert_activity_stress, + R.xml.devicesettings_heartrate_sleep_alert_activity_stress, R.xml.devicesettings_goal_notification, R.xml.devicesettings_custom_emoji_font, R.xml.devicesettings_timeformat, diff --git a/app/src/main/res/xml/heartrate_sleep_alert_activity_stress.xml b/app/src/main/res/xml/devicesettings_heartrate_sleep_alert_activity_stress.xml similarity index 100% rename from app/src/main/res/xml/heartrate_sleep_alert_activity_stress.xml rename to app/src/main/res/xml/devicesettings_heartrate_sleep_alert_activity_stress.xml From cc28879ecce20a2b665e7e7fdce074f0197a182b Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sun, 22 May 2022 09:40:30 +0200 Subject: [PATCH 3/4] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6b97a598..d2e9976c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ### Changelog +### NEXT +* Amazfit Bip U/Pro/Band 5: enable extended HR/stress monitoring setting + ### 0.67.0 * Initial Support for Sony WF-1000XM3 * Initial Support for Galaxy Buds Pro From d08fe6ebf7813a63bc3006cd0c586797d95ec0af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Mon, 23 May 2022 23:52:58 +0100 Subject: [PATCH 4/4] Huami: Truncate MusicSpec data to 80 characters --- .../service/devices/huami/HuamiSupport.java | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java index a74f3079d..e421d9ea2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java @@ -1339,20 +1339,28 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport { return; } + String artist = ""; + String album = ""; + String track = ""; + byte flags = 0x00; flags |= 0x01; int length = 5; if (musicSpec != null) { - if (musicSpec.artist != null && musicSpec.artist.getBytes().length > 0) { - length += musicSpec.artist.getBytes().length + 1; + artist = StringUtils.truncate(musicSpec.artist, 80); + album = StringUtils.truncate(musicSpec.album, 80); + track = StringUtils.truncate(musicSpec.album, 80); + + if (artist.getBytes().length > 0) { + length += artist.getBytes().length + 1; flags |= 0x02; } - if (musicSpec.album != null && musicSpec.album.getBytes().length > 0) { - length += musicSpec.album.getBytes().length + 1; + if (album.getBytes().length > 0) { + length += album.getBytes().length + 1; flags |= 0x04; } - if (musicSpec.track != null && musicSpec.track.getBytes().length > 0) { - length += musicSpec.track.getBytes().length + 1; + if (track.getBytes().length > 0) { + length += track.getBytes().length + 1; flags |= 0x08; } if (musicSpec.duration != 0) { @@ -1379,16 +1387,16 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport { buf.putShort((short) musicStateSpec.position); if (musicSpec != null) { - if (musicSpec.artist != null && musicSpec.artist.getBytes().length > 0) { - buf.put(musicSpec.artist.getBytes()); + if (artist.getBytes().length > 0) { + buf.put(artist.getBytes()); buf.put((byte) 0); } - if (musicSpec.album != null && musicSpec.album.getBytes().length > 0) { - buf.put(musicSpec.album.getBytes()); + if (album.getBytes().length > 0) { + buf.put(album.getBytes()); buf.put((byte) 0); } - if (musicSpec.track != null && musicSpec.track.getBytes().length > 0) { - buf.put(musicSpec.track.getBytes()); + if (track.getBytes().length > 0) { + buf.put(track.getBytes()); buf.put((byte) 0); } if (musicSpec.duration != 0) {