diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/zeppos/services/ZeppOsConfigService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/zeppos/services/ZeppOsConfigService.java index e380b08cb..bc291b982 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/zeppos/services/ZeppOsConfigService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/zeppos/services/ZeppOsConfigService.java @@ -574,7 +574,21 @@ public class ZeppOsConfigService extends AbstractZeppOsService { switch (configArg) { case UPPER_BUTTON_LONG_PRESS: case LOWER_BUTTON_PRESS: - return MapUtils.reverse(Huami2021MenuType.displayItemNameLookup).get(value); + final String itemHex = MapUtils.reverse(Huami2021MenuType.displayItemNameLookup).get(value); + if (itemHex != null) { + return itemHex; + } + + // Unknown button press value - attempt to parse it as hex + final Matcher matcher = Pattern.compile("^([0-9A-F]{8})$").matcher(value); + if (matcher.matches()) { + LOG.debug("Sending unknown button press item {} as hex", value); + return value; + } + + LOG.warn("Failed to map button press value {}", value); + + return null; case DATE_FORMAT: return value.replace("/", "."); }