-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pad_settings: show ds4 battery status in UI; use LED as an indicator #7236
Conversation
Adiost
commented
Jan 12, 2020
•
edited
edited
- Add a battery indicator in pad settings dialog for Dualshock 4
- Add a new LED settings dialog
- Add an option to use DS4 LED as a battery indicator
- Fix pad settings dialog window size inconsistency
the led already blinks when it's low. why the gradient ? |
LED only blinks at 20% and lower. This is fine, but there's currently no way to tell the battery level anywhere above 20% when in-game. It's intended to be strictly optional, doesn't replace the blinking and allows users to make at least some use of the LED which is otherwise non-functional. |
LED color is meant to be an indicator for players in coop mode. So it is far from non-functional. But maybe people like it |
Static LED color is indeed useful to differentiate multiple connected controllers, which is, however, not relevant for single player use cases. The preset gradient currently goes from green at 100% to yellow at 50% to red at 0%. The function as it is right now works as intended, but is disabled (and thus optimized away) as there's no corresponding setting at this moment. If it is to be off by default, it shouldn't interfere with co-op experience, especially since every controller's LED is set to blue and needs to be manually set to a color of choice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some style changes
NGL this looks dope :v |
Everything that was planned in this PR is now implemented. The LED battery indicator mode now supports configurable brightness (0-100), properly works with multiple controllers and is no longer limited to in-game. The pre-existing block that blinks the LED is now also user configurable. The LED button/color sample in
|
Works for me, color changed properly. Battery indicator seems to be limited to green which i guess is intended? I had DS4Windows open when i first changed the color, and it changed properly, but then about 5 seconds later went back to the default blue. But, it works fine when ds4windows isn't running. I didn't get to test the battery light actually changing when battery is low, since I'm using it wired. |
I have to say that I really don't understand the latest changes |
d475644 disables LED battery indication outside of To make it even more consistent, I'll make it so the LED is reset back to a static color when pad thread is terminated. |
The explanation is missing as comment in the code. |
btw you need to rebase and fix the conflict |
@@ -728,6 +751,7 @@ ds4_pad_handler::DS4DataStatus ds4_pad_handler::GetRawData(const std::shared_ptr | |||
return DS4DataStatus::NoNewData; | |||
|
|||
int battery_offset = offset + DS4_INPUT_REPORT_BATTERY_OFFSET; | |||
device->is_initialized = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you never set this to false (for example before the second ReadError return above)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's declared as false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
devices can disconnect and reconnect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, thanks!
|
||
connect(&m_timer_ds4_battery, &QTimer::timeout, [this]() | ||
{ | ||
if(m_handler->get_device_init(m_device_name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(m_handler->get_device_init(m_device_name)) | |
if (m_handler->get_device_init(m_device_name)) |
ups.. wrong button |
I think you messed up the formatting in the filters file. ;) |
Where? o: Regarding the timer, I'll play around with it some more, but I have to say that it seems to be the most optimal solution. It's basically a finite cycle in a separate thread with a time limit between ticks. As soon as we get what we want it terminates. Still, I'll experiment some more. |
what i mean is that you don't have to poll it with a timer if you can just append it to the already existing callback that is called with a timer anyway |
This is very useful, please rebase and get this merged :) |
I'll get back to it in a couple of weeks. |
This doesn't need more than 5 commits to address something. Needs squishing + rebase |
I can squish during merging. |
No luck with rebase, sorry. |
I'll rebase myself in a week or so. Don't have the time atm. |
@Adiost the rebase wasn't as trivial due to massive changes in the project structure. You can just use my branch and push that code with your name. Btw: I didn't change anything in your code apart from the ui stuff (which also didn't change anything visually). |
removes ds4 timer workaround
@Megamouse Thank you for rebasing and finishing the necessary changes! |