mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Zendure SolarFlow: allow setting target power to grid
This commit is contained in:
+1
@@ -679,6 +679,7 @@ public class DeviceSettingsPreferenceConst {
|
||||
public static final String PREF_BATTERY_MINIMUM_CHARGE = "battery_minimum_charge";
|
||||
public static final String PREF_BATTERY_MAXIMUM_CHARGE = "battery_maximum_charge";
|
||||
public static final String PREF_BATTERY_ALLOW_PASS_THROUGH = "battery_allow_pass_through";
|
||||
public static final String PREF_OUTPUT_POWER_GRID = "output_power_grid";
|
||||
|
||||
public static final String PREF_DISPLAY_ENABLED = "display_enabled";
|
||||
public static final String PREF_DISPLAY_ENABLED_ALL_DAY = "display_all_day";
|
||||
|
||||
+9
-5
@@ -1003,6 +1003,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
|
||||
addPreferenceHandlerFor(PREF_BATTERY_MINIMUM_CHARGE);
|
||||
addPreferenceHandlerFor(PREF_BATTERY_MAXIMUM_CHARGE);
|
||||
addPreferenceHandlerFor(PREF_BATTERY_ALLOW_PASS_THROUGH);
|
||||
addPreferenceHandlerFor(PREF_OUTPUT_POWER_GRID);
|
||||
|
||||
addPreferenceHandlerFor(PREF_DISPLAY_ENABLED);
|
||||
addPreferenceHandlerFor(PREF_DISPLAY_ENABLED_ALL_DAY);
|
||||
@@ -1363,12 +1364,15 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
|
||||
setInputTypeFor(PREF_CALENDAR_SYNC_EVENTS_AMOUNT, InputType.TYPE_CLASS_NUMBER);
|
||||
setInputTypeFor(PREF_CALENDAR_MAX_TITLE_LENGTH, InputType.TYPE_CLASS_NUMBER);
|
||||
setInputTypeFor(PREF_CALENDAR_MAX_DESC_LENGTH, InputType.TYPE_CLASS_NUMBER);
|
||||
setNumericInputTypeWithRangeFor(DeviceSettingsPreferenceConst.PREF_BATTERY_DISCHARGE_INTERVAL1_WATT, 80, 800, false);
|
||||
setNumericInputTypeWithRangeFor(DeviceSettingsPreferenceConst.PREF_BATTERY_DISCHARGE_INTERVAL2_WATT, 80, 800, false);
|
||||
setNumericInputTypeWithRangeFor(DeviceSettingsPreferenceConst.PREF_BATTERY_DISCHARGE_INTERVAL3_WATT, 80, 800, false);
|
||||
setNumericInputTypeWithRangeFor(DeviceSettingsPreferenceConst.PREF_BATTERY_DISCHARGE_INTERVAL4_WATT, 80, 800, false);
|
||||
setNumericInputTypeWithRangeFor(DeviceSettingsPreferenceConst.PREF_BATTERY_DISCHARGE_INTERVAL5_WATT, 80, 800, false);
|
||||
setNumericInputTypeWithRangeFor(PREF_BATTERY_DISCHARGE_INTERVAL1_WATT, 80, 800, false);
|
||||
setNumericInputTypeWithRangeFor(PREF_BATTERY_DISCHARGE_INTERVAL2_WATT, 80, 800, false);
|
||||
setNumericInputTypeWithRangeFor(PREF_BATTERY_DISCHARGE_INTERVAL3_WATT, 80, 800, false);
|
||||
setNumericInputTypeWithRangeFor(PREF_BATTERY_DISCHARGE_INTERVAL4_WATT, 80, 800, false);
|
||||
setNumericInputTypeWithRangeFor(PREF_BATTERY_DISCHARGE_INTERVAL5_WATT, 80, 800, false);
|
||||
setNumericInputTypeWithRangeFor(PREF_OUTPUT_POWER_GRID, 0, 2400, false);
|
||||
|
||||
setNumericInputTypeWithRangeFor(PREF_BATTERY_MINIMUM_CHARGE, 0, 100, false);
|
||||
setNumericInputTypeWithRangeFor(PREF_BATTERY_MAXIMUM_CHARGE, 0, 100, false);
|
||||
|
||||
new PasswordCapabilityImpl().registerPreferences(getContext(), coordinator.getPasswordCapability(), this);
|
||||
new HeartRateCapability().registerPreferences(getContext(), coordinator.getHeartRateMeasurementIntervals(), this);
|
||||
|
||||
+1
@@ -92,6 +92,7 @@ public class SolarFlowDeviceCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
return new int[]{
|
||||
R.xml.devicesettings_battery_minimum_charge,
|
||||
R.xml.devicesettings_battery_maximum_charge,
|
||||
R.xml.devicesettings_output_power_grid,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+7
@@ -18,6 +18,7 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.zendure;
|
||||
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_BATTERY_MAXIMUM_CHARGE;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_BATTERY_MINIMUM_CHARGE;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_OUTPUT_POWER_GRID;
|
||||
|
||||
import android.bluetooth.BluetoothGatt;
|
||||
import android.bluetooth.BluetoothGattCharacteristic;
|
||||
@@ -162,6 +163,12 @@ public class SolarFlowDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
if (socSet > 100) socSet = 100;
|
||||
sendWriteProperty("socSet", socSet * 10);
|
||||
}
|
||||
case PREF_OUTPUT_POWER_GRID -> {
|
||||
int outputLimit = devicePrefs.getInt(PREF_OUTPUT_POWER_GRID, 800);
|
||||
if (outputLimit < 0) outputLimit = 0;
|
||||
if (outputLimit > 2400) outputLimit = 2400;
|
||||
sendWriteProperty("outputLimit", outputLimit);
|
||||
}
|
||||
default -> LOG.warn("Unknown config changed: {}", config);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2184,6 +2184,7 @@
|
||||
<string name="devicetype_coospo_hw807" translatable="false">Coospo HW807</string>
|
||||
<string name="devicetype_garmin_hrm_200" translatable="false">Garmin HRM 200</string>
|
||||
<string name="devicetype_coospo_h9z" translatable="false">Coospo H9Z</string>
|
||||
<string name="devicetype_solarflow">SolarFlow</string>
|
||||
<!-- Menus on the smart device -->
|
||||
<string name="menuitem_nothing">Nothing</string>
|
||||
<string name="menuitem_status">Status</string>
|
||||
@@ -4133,6 +4134,7 @@
|
||||
<string name="discharge_interval_4">Discharge interval 4</string>
|
||||
<string name="discharge_interval_5">Discharge interval 5</string>
|
||||
<string name="power_w">Power in W</string>
|
||||
<string name="output_power_grid">Output power to grid in W</string>
|
||||
<string name="manual_discharge_summary">when disabled, this assumes intelligent discharge controlled by an external power meter (not supported by Gadgetbridge)</string>
|
||||
<string name="manual_discharge">Manual discharge intervals</string>
|
||||
<string name="summary_battery_discharge_intervals_set">Send configuration below to device</string>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<EditTextPreference
|
||||
android:defaultValue="800"
|
||||
android:inputType="number"
|
||||
android:key="output_power_grid"
|
||||
android:title="@string/output_power_grid"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
</androidx.preference.PreferenceScreen>
|
||||
Reference in New Issue
Block a user