From 8d7e859077999d22a5b0a44353c5ac14113207db Mon Sep 17 00:00:00 2001 From: George Kushnir Date: Sat, 5 May 2018 22:54:19 -0400 Subject: [PATCH] Support power bridge systems. --- FakeSlice.cs | 16 ++++++++-------- README.md | 4 ---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/FakeSlice.cs b/FakeSlice.cs index c95f4b4..b009615 100644 --- a/FakeSlice.cs +++ b/FakeSlice.cs @@ -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); } } } \ No newline at end of file diff --git a/README.md b/README.md index 6e06e87..ed7ebba 100644 --- a/README.md +++ b/README.md @@ -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.