Skip to content

Commit

Permalink
Support power bridge systems.
Browse files Browse the repository at this point in the history
  • Loading branch information
n4ru committed May 6, 2018
1 parent 63ef5aa commit 8d7e859
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
16 changes: 8 additions & 8 deletions FakeSlice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@ namespace ThinkBattery
{
class Program
{

static void Main(string[] args)
{

var batInterface = new BatteryInterface();
var chargeStatus = batInterface.QueryBattery(1).SmartBatteryStatus.ChargeStatus.GetValue();
var bat = new ChargeThreshold
{
var chargeStatusTwo = batInterface.QueryBattery(2).SmartBatteryStatus.ChargeStatus.GetValue();
var bat = new ChargeThreshold {
IsEnabled = true,
SlotNumber = 1,
StartValue = 0,
StopValue = 1
StopValue = 0
};
if (chargeStatus == "NoActivity") {
bat.StopValue = 0;
if (chargeStatus == "Charging" || chargeStatusTwo == "Charging") {
bat.StopValue = 1;
}
if (args.Length == 1 && args[0] == "on")
{
if (args.Length == 1 && args[0] == "on") {
bat.StopValue = 1;
} else if (args.Length == 1 && args[0] == "off") {
bat.StopValue = 0;
}
batInterface.SetChargeThreshold(bat);
bat.SlotNumber = 2;
batInterface.SetChargeThreshold(bat);
}
}
}
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,4 @@ Just throw `FakeSlice.cs` into your favorite C# compiler, target .NET Framework

The included release binary will toggle your setting when launched without any commandline arguments. Running the application with the argument `on` will turn the FakeSlice "on" - which will disable charging and run off your Power Bank. Running the application with the argument `off` will turn the FakeSlice "off" and charge the internal battery. This should allow you to use FakeSlice in your scripts with ease, and without any arguments FakeSlice works great when bound to a hotkey (ike `Fn + F12`) using Lenovo Vantage.

## To-Do

Fakeslice currently only supports single battery ThinkPads. Support for Power Bridge enabled systems should be coming in a few days, which will allow you to disable internal battery charging. The current version will only disable charging the battery internally marked as the primary.

### Credits to [Ciastix](https://github.com/Ciastex) for helping expose Lenovo's proprietary interface.

0 comments on commit 8d7e859

Please sign in to comment.