1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-03 00:43:02 +01:00

Xiaomi: Fix sleep mode schedule, spo2 and stress support detection

This commit is contained in:
José Rebelo 2023-12-10 12:31:19 +00:00
parent 8d1c243297
commit a3e2997f26
2 changed files with 8 additions and 1 deletions

View File

@ -373,7 +373,13 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
// Health
//
settings.add(R.xml.devicesettings_header_health);
if (supportsStressMeasurement() && supports(device, FEAT_STRESS) && supportsSpo2() && supports(device, FEAT_SPO2)) {
settings.add(R.xml.devicesettings_heartrate_sleep_alert_activity_stress_spo2);
} else if (supportsStressMeasurement() && supports(device, FEAT_STRESS)) {
settings.add(R.xml.devicesettings_heartrate_sleep_alert_activity_stress);
} else {
settings.add(R.xml.devicesettings_heartrate_sleep_activity);
}
if (supports(device, FEAT_INACTIVITY)) {
settings.add(R.xml.devicesettings_inactivity_dnd_no_threshold);
}

View File

@ -591,6 +591,7 @@ public class XiaomiScheduleService extends AbstractXiaomiService {
final String end = XiaomiPreferences.prefFromHourMin(sleepMode.getSchedule().getEnd());
final GBDeviceEventUpdatePreferences eventUpdatePreferences = new GBDeviceEventUpdatePreferences()
.withPreference(XiaomiPreferences.FEAT_SLEEP_MODE_SCHEDULE, true)
.withPreference("prefs_enable_sleep_time", null)
.withPreference(DeviceSettingsPreferenceConst.PREF_SLEEP_MODE_SCHEDULE_ENABLED, sleepMode.getEnabled())
.withPreference(DeviceSettingsPreferenceConst.PREF_SLEEP_MODE_SCHEDULE_START, start)