mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Moyoung: Add power saving mode preference
This commit is contained in:
parent
529daded7a
commit
d9e0e22aaa
@ -191,7 +191,8 @@ public abstract class AbstractMoyoungDeviceCoordinator extends AbstractBLEDevice
|
|||||||
new MoyoungSettingBool("DO_NOT_DISTURB_ONOFF", MoyoungConstants.CMD_QUERY_DO_NOT_DISTURB_TIME, MoyoungConstants.CMD_SET_DO_NOT_DISTURB_TIME),
|
new MoyoungSettingBool("DO_NOT_DISTURB_ONOFF", MoyoungConstants.CMD_QUERY_DO_NOT_DISTURB_TIME, MoyoungConstants.CMD_SET_DO_NOT_DISTURB_TIME),
|
||||||
// (*) new MoyoungSetting("PSYCHOLOGICAL_PERIOD", MoyoungConstants.CMD_QUERY_PSYCHOLOGICAL_PERIOD, MoyoungConstants.CMD_SET_PSYCHOLOGICAL_PERIOD),
|
// (*) new MoyoungSetting("PSYCHOLOGICAL_PERIOD", MoyoungConstants.CMD_QUERY_PSYCHOLOGICAL_PERIOD, MoyoungConstants.CMD_SET_PSYCHOLOGICAL_PERIOD),
|
||||||
|
|
||||||
new MoyoungSettingBool("BREATHING_LIGHT", MoyoungConstants.CMD_QUERY_BREATHING_LIGHT, MoyoungConstants.CMD_SET_BREATHING_LIGHT)
|
new MoyoungSettingBool("BREATHING_LIGHT", MoyoungConstants.CMD_QUERY_BREATHING_LIGHT, MoyoungConstants.CMD_SET_BREATHING_LIGHT),
|
||||||
|
new MoyoungSettingBool("POWER_SAVING", MoyoungConstants.CMD_QUERY_POWER_SAVING, MoyoungConstants.CMD_SET_POWER_SAVING)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -202,6 +203,7 @@ public abstract class AbstractMoyoungDeviceCoordinator extends AbstractBLEDevice
|
|||||||
generic.add(R.xml.devicesettings_moyoung_device_version);
|
generic.add(R.xml.devicesettings_moyoung_device_version);
|
||||||
generic.add(R.xml.devicesettings_timeformat);
|
generic.add(R.xml.devicesettings_timeformat);
|
||||||
generic.add(R.xml.devicesettings_moyoung_watchface);
|
generic.add(R.xml.devicesettings_moyoung_watchface);
|
||||||
|
generic.add(R.xml.devicesettings_power_saving);
|
||||||
generic.add(R.xml.devicesettings_liftwrist_display);
|
generic.add(R.xml.devicesettings_liftwrist_display);
|
||||||
// generic.add(R.xml.devicesettings_donotdisturb_no_auto); // not supported by Colmi i28 Ultra
|
// generic.add(R.xml.devicesettings_donotdisturb_no_auto); // not supported by Colmi i28 Ultra
|
||||||
generic.add(R.xml.devicesettings_donotdisturb_on_off_follow);
|
generic.add(R.xml.devicesettings_donotdisturb_on_off_follow);
|
||||||
|
@ -214,6 +214,9 @@ public class MoyoungConstants {
|
|||||||
public static final byte CMD_ADVANCED_QUERY = (byte) 0xb9;
|
public static final byte CMD_ADVANCED_QUERY = (byte) 0xb9;
|
||||||
public static final byte CMD_DAGPT = (byte) 0xbb;
|
public static final byte CMD_DAGPT = (byte) 0xbb;
|
||||||
|
|
||||||
|
public static final byte CMD_QUERY_POWER_SAVING = (byte) 0xa4;
|
||||||
|
public static final byte CMD_SET_POWER_SAVING = (byte) 0x94;
|
||||||
|
|
||||||
public static final byte ARG_ADVANCED_SET_ALARM = 0x05;
|
public static final byte ARG_ADVANCED_SET_ALARM = 0x05;
|
||||||
public static final byte ARG_ADVANCED_SET_CALENDAR = 0x08;
|
public static final byte ARG_ADVANCED_SET_CALENDAR = 0x08;
|
||||||
public static final byte ARG_ADVANCED_QUERY_STOCKS = 0x0e;
|
public static final byte ARG_ADVANCED_QUERY_STOCKS = 0x0e;
|
||||||
|
@ -452,6 +452,13 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (packetType == MoyoungConstants.CMD_QUERY_POWER_SAVING)
|
||||||
|
{
|
||||||
|
LOG.info("Power saving set to: {}", payload[0] == 0x01);
|
||||||
|
onReadConfigurationDone(getSetting("POWER_SAVING"), payload[0], null);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (packetType == MoyoungConstants.CMD_QUERY_DISPLAY_WATCH_FACE)
|
if (packetType == MoyoungConstants.CMD_QUERY_DISPLAY_WATCH_FACE)
|
||||||
{
|
{
|
||||||
LOG.info("Watchface changed on watch to nr {}", payload[0]);
|
LOG.info("Watchface changed on watch to nr {}", payload[0]);
|
||||||
@ -1671,6 +1678,11 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
sendSetting(getSetting("QUICK_VIEW_TIME"), quickViewTime);
|
sendSetting(getSetting("QUICK_VIEW_TIME"), quickViewTime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DeviceSettingsPreferenceConst.PREF_POWER_SAVING:
|
||||||
|
boolean powerSavingPref = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_POWER_SAVING, false);
|
||||||
|
sendSetting(getSetting("POWER_SAVING"), powerSavingPref);
|
||||||
|
break;
|
||||||
|
|
||||||
case MoyoungConstants.PREF_SEDENTARY_REMINDER:
|
case MoyoungConstants.PREF_SEDENTARY_REMINDER:
|
||||||
String sedentaryReminderPref = prefs.getString(MoyoungConstants.PREF_SEDENTARY_REMINDER, "off");
|
String sedentaryReminderPref = prefs.getString(MoyoungConstants.PREF_SEDENTARY_REMINDER, "off");
|
||||||
boolean sedentaryReminderEnabled = !sedentaryReminderPref.equals("off");
|
boolean sedentaryReminderEnabled = !sedentaryReminderPref.equals("off");
|
||||||
@ -1821,6 +1833,13 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
// changedProperties.put(MoyoungConstants.PREF_MOYOUNG_DEVICE_VERSION, String.valueOf(deviceVersion.value()));
|
// changedProperties.put(MoyoungConstants.PREF_MOYOUNG_DEVICE_VERSION, String.valueOf(deviceVersion.value()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "POWER_SAVING":
|
||||||
|
eventUpdatePreferences.withPreference(
|
||||||
|
DeviceSettingsPreferenceConst.PREF_POWER_SAVING,
|
||||||
|
(byte) value == 0x01
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
case "DO_NOT_DISTURB_ONOFF":
|
case "DO_NOT_DISTURB_ONOFF":
|
||||||
eventUpdatePreferences.withPreference(
|
eventUpdatePreferences.withPreference(
|
||||||
DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_BOOL,
|
DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_BOOL,
|
||||||
|
Loading…
Reference in New Issue
Block a user