mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-08-25 16:50:44 +02:00
Pixoo: support "clap hands to turn off screen" and "sleep after silence" settings
Also fix crc calculation :P
This commit is contained in:
parent
198800e087
commit
81c9aa5faf
@ -396,4 +396,6 @@ public class DeviceSettingsPreferenceConst {
|
||||
public static final String PREF_DEVICE_ACTION_WOKE_UP_BROADCAST = "prefs_events_forwarding_wokeup_broadcast";
|
||||
public static final String PREF_DEVICE_ACTION_START_NON_WEAR_SELECTIONS = "events_forwarding_startnonwear_action_selections";
|
||||
public static final String PREF_DEVICE_ACTION_START_NON_WEAR_BROADCAST = "prefs_events_forwarding_startnonwear_broadcast";
|
||||
public static final String PREF_CLAP_HANDS_TO_WAKEUP_DEVICE = "pref_key_clap_hands_to_wakeup_device";
|
||||
public static final String PREF_POWER_SAVING = "pref_key_power_saving";
|
||||
}
|
||||
|
@ -324,7 +324,6 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
|
||||
}
|
||||
|
||||
|
||||
|
||||
addPreferenceHandlerFor(PREF_SWIPE_UNLOCK);
|
||||
addPreferenceHandlerFor(PREF_MI2_DATEFORMAT);
|
||||
addPreferenceHandlerFor(PREF_DATEFORMAT);
|
||||
@ -566,6 +565,9 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
|
||||
addPreferenceHandlerFor(PREF_SLEEP_MODE_SCHEDULE_START);
|
||||
addPreferenceHandlerFor(PREF_SLEEP_MODE_SCHEDULE_END);
|
||||
|
||||
addPreferenceHandlerFor(PREF_CLAP_HANDS_TO_WAKEUP_DEVICE);
|
||||
addPreferenceHandlerFor(PREF_POWER_SAVING);
|
||||
|
||||
addPreferenceHandlerFor("lock");
|
||||
|
||||
String sleepTimeState = prefs.getString(PREF_SLEEP_TIME, PREF_DO_NOT_DISTURB_OFF);
|
||||
|
@ -79,6 +79,7 @@ public class PixooCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
@Override
|
||||
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
|
||||
return new int[]{
|
||||
R.xml.devicesettings_pixoo,
|
||||
R.xml.devicesettings_screen_brightness,
|
||||
R.xml.devicesettings_timeformat,
|
||||
};
|
||||
|
@ -174,6 +174,20 @@ public class PixooProtocol extends GBDeviceProtocol {
|
||||
0x2d,
|
||||
(byte) (is24hour ? 1 : 0),
|
||||
});
|
||||
case DeviceSettingsPreferenceConst.PREF_CLAP_HANDS_TO_WAKEUP_DEVICE:
|
||||
boolean clap = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_CLAP_HANDS_TO_WAKEUP_DEVICE, false);
|
||||
|
||||
return encodeProtocol(new byte[]{
|
||||
(byte) 0xa7,
|
||||
(byte) (clap ? 1 : 0),
|
||||
});
|
||||
case DeviceSettingsPreferenceConst.PREF_POWER_SAVING:
|
||||
boolean power_saving = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_POWER_SAVING, false);
|
||||
|
||||
return encodeProtocol(new byte[]{
|
||||
(byte) 0xb2,
|
||||
(byte) (power_saving ? 1 : 0),
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -363,7 +377,7 @@ public class PixooProtocol extends GBDeviceProtocol {
|
||||
msgBuf.put(payload);
|
||||
short crc = (short) (((payload.length + 2) & 0xff) + ((payload.length + 2) >> 8));
|
||||
for (byte b : payload) {
|
||||
crc += b;
|
||||
crc += (b & 0xff);
|
||||
}
|
||||
msgBuf.putShort(crc);
|
||||
msgBuf.put((byte) 0x02);
|
||||
|
@ -493,6 +493,10 @@
|
||||
<string name="zetime_signaling_beep_once">Beep once</string>
|
||||
<string name="zetime_signaling_beep_twice">Beep twice</string>
|
||||
<string name="zetime_signaling_vibrate_beep_once">Vibrate and beep once</string>
|
||||
<!-- pixoo specific settings -->
|
||||
<string name="clap_hands_to_wakeup_device">Clap hands to turn up screen</string>"
|
||||
<string name="clap_hands_to_wakeup_device_summary">Clapping again will turn off the screen</string>"
|
||||
<string name="pixoo_power_saving_summary">The screen will turn off after the microphone has detected silence for a while</string>
|
||||
<!-- Device specific settings -->
|
||||
<string name="title_activity_device_specific_settings">Device specific settings</string>
|
||||
<string name="pref_title_authkey">Auth Key</string>
|
||||
|
Loading…
Reference in New Issue
Block a user