NiyaShy / XB1ControllerBatteryIndicator

A tray application that shows a battery indicator for an Xbox-ish controller and gives a notification when the battery level drops to (almost) empty.
GNU General Public License v2.0
710 stars 53 forks source link

Addition of (optional) notification for "low" battery state #89

Open StealthDragonJ opened 6 months ago

StealthDragonJ commented 6 months ago

I was using my Xbox Series Controller with the wireless adapter and I only got the warning notification by the time the vibration in the controller was no longer working and the connection seemed wonky (due to having an "almost empty" battery).

So I would like to have a notification appear when the battery is in the "low" battery state so have some time to get ready to charge or swap the batteries before I start having issues.

I'm not sure if everyone would want this so maybe consider making it a toggle.

NiyaShy commented 6 months ago

Hey, vibration no longer working is the only "official" way of telling that the battery is almost empty, so that's intended by Microsoft. A wonky connection should not be a result of that state since the battery usually still has enough "juice" to power the controller for 30+ minutes. Adding a notification for "low" would be possible but not very useful since that state is usually reached hours before it switches to "empty". If more people should request it I can look into it, but otherwise I'd not deem this a real issue.

StealthDragonJ commented 6 months ago

Hm... well perhaps the lack of vibration did give me the impression the connection was wonky even if it wasn't actually wonky.

The reason I downloaded this program was because I thought it would give me a notification before the vibration stops working so that I can swap or charge the batteries before that point. So personally I would still like to see the feature even with the few hours difference (perhaps the notification itself could mention you may still have a few hours left) but I suppose it's up to you if you want to add it or not.

StealthDragonJ commented 6 months ago

So I added some code to give me a notification when the battery hit "low" battery state and after testing it once there was only a 50 minute gap between that and the "almost empty" battery notification.

https://github.com/StealthDragonJ/XB1ControllerBatteryIndicator/tree/Low-Battery-State-Notificaiton

If you want to use that code then let me know and I can do a pull request but do note that the code is missing any toggles so in its current state the "low" battery status notification isn't optional.

NiyaShy commented 6 months ago

After looking through your changes/additions, I have to say: impressive. Didn't quite expect that you'd go so "deep" into the existing code to add the additional trigger/notification. But... sadly, you did all that on the code of the master branch, and that one hasn't been changed much since 2019. All the recent work (and additions like the overlay/popup as an alternative to toasts) went into the testing branch, and I definitely want to avoid big changes to the master code so the chance of successfully merging in the new stuff from testing (once 1.4 is ready) won't run into issues/conflicts.

Side note: interesting that you managed to raise the .NET version to 4.8. IIRC I tried that a while ago and ran into tons of conflicts and incompatible packages...

StealthDragonJ commented 6 months ago

It would have been nice to add the code but at least it can exist as proof of concept and I've only used C# to make games in Unity so it was fun to use it for something different.

And yeah I didn't have any issues trying to upgrade to .NET 4.8. I only had version 4.8 installed so when opening the project I was given the option to upgrade to 4.8 and it worked just fine from what I can tell.

But as you said this is the Master branch rather than the one your working on so maybe that's why I didn't have any issues.