-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using CommonHelpers; | ||
|
||
namespace PowerControl.Options | ||
{ | ||
public static class BatteryChargeLimit | ||
{ | ||
public static Menu.MenuItemWithOptions Instance = new Menu.MenuItemWithOptions() | ||
{ | ||
Name = "Charge Limit", | ||
ApplyDelay = 1000, | ||
Options = { "70%", "80%", "90%", "100%" }, | ||
ActiveOption = "?", | ||
ApplyValue = (selected) => | ||
{ | ||
var value = int.Parse(selected.ToString().TrimEnd('%')); | ||
|
||
using (var vlv0100 = new Vlv0100()) | ||
{ | ||
if (!vlv0100.Open()) | ||
return null; | ||
|
||
vlv0100.SetMaxBatteryCharge(value); | ||
|
||
var newValue = vlv0100.GetMaxBatteryCharge(); | ||
if (newValue is null) | ||
return null; | ||
return newValue.ToString() + "%"; | ||
} | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters