mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-12 02:45:49 +01:00
Zepp OS: Fix setting of unknown configuration values
Unknown configuration values are displayed in the UI as "Unknown (0x*)". We can then attempt to parse them as hex and send the value.
This commit is contained in:
parent
f0a05ded91
commit
443f13c11d
@ -52,6 +52,8 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.SettingsActivity;
|
||||
@ -1763,6 +1765,12 @@ public class ZeppOsConfigService extends AbstractZeppOsService {
|
||||
}
|
||||
}
|
||||
|
||||
// Byte doesn't match a known enum value, attempt to parse it as hex
|
||||
final Matcher matcher = Pattern.compile("^0[xX]([0-9a-fA-F]{1,2})$").matcher(val);
|
||||
if (matcher.find()) {
|
||||
return (byte) Integer.parseInt(matcher.group(1), 16);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user