Skip to content
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

PRO X Wireless Headset #197

Merged
merged 11 commits into from
Jan 17, 2022
Merged

PRO X Wireless Headset #197

merged 11 commits into from
Jan 17, 2022

Conversation

jaypikay
Copy link
Contributor

@jaypikay jaypikay commented Jan 5, 2022

Logitech devices seem a bit strange when reporting their voltage. As far as I could see the PRO X reports the voltage capacity.

  • Battery status
    • charging
    • discharging (returns voltage)
  • Set inactivity time

src/devices/logitech_gpro.c Outdated Show resolved Hide resolved
@jaypikay
Copy link
Contributor Author

jaypikay commented Jan 6, 2022

Just noticed that #131 is related.

@jaypikay
Copy link
Contributor Author

jaypikay commented Jan 6, 2022

Just noticed some quirks with the voltage. When it gets lower the percentage isn't correct anymore

@Sapd
Copy link
Owner

Sapd commented Jan 6, 2022

Yes, you used a linear formular for the voltage. However LI-Ions usually hold their voltage for a long time (slowley decreasing) and then suddenly decreasing when they are nearing under 20%.

E.g. here are examples: https://hobbygraderc.com/lipo-voltage-chart/

You can use a polynomial regression calculator to make a mathematical curve: https://arachnoid.com/polysolve/ (the website will even generate C code)

Or you can use simple splines:
Simply set p and v to your liking, which comes nearest to your headset

static float estimate_battery_level(uint16_t voltage) {
    int p[] = { 100, 60, 10, 0 };
    int v[] = { 4200, 3870, 3690, 3270 };
    int size = 4;
    
    float percent = 0;
    for(int i = 0; i < size; ++i) {
        // if >= then 100%
        if(voltage >= v[i]) {
            percent = p[i];
            break;
        } 
        
        // if not last
        if(i < size-1 && voltage >= v[i+1]) {
            percent = p[i+1] + (voltage-v[i+1])/(v[i]-v[i+1])*(p[i]-p[i+1]);
            break;
        }
       return percent;
}

We can put the function in utility.h with p and v as parameters, so every headset can use it if it wants to use that method.

You can try it with some parameters, and insert it into your code. I can then make another commit to put it properly in conjunction with utility.h

It would not be reached if it is charging.
Adding support for Windows with MSYS2. Helps observing the
percentage in G Hub and the raw voltage readings.
@jaypikay
Copy link
Contributor Author

jaypikay commented Jan 7, 2022

I have observed the discharging until it turned off now. The best option is using a polynomial regression function for the discharging. I have added support for a Windows MSYS2 environment, and could monitor the raw values with the percentage displayed from G Hub side-by-side. I need to collect some values from the higher end, but it looks promising.

@Sapd Sapd merged commit fbc7fe2 into Sapd:master Jan 17, 2022
@Arcitec
Copy link

Arcitec commented Feb 17, 2022

@jaypikay @Sapd You are both seriously awesome for creating this tool and for figuring out ProX Wireless support.

  1. Does this mean that Pro X wireless now supports Sidetone, setting inactivity timeout, and battery level? (edit: Oh btw this projects Readme is outdated and doesn't mention PRO X).

  2. Can the timeout be set to specific amounts of minutes, or is it an on/off?

Also, I have some general questions about PRO X Wireless on Linux:

  1. Is there any problem with the headset's built-in inactivity handling? Or does the headset accurately put itself to sleep when no audio is playing for a while? I basically wish to know if the headset "auto standby after silence inactivity" works properly on Linux, to ensure the battery preserves its life automatically.

  2. How good is the audio quality of the headset (music etc) and microphone on Linux when using the USB dongle?

  3. Just a general question: In all videos I have seen of this headset it looks like the "forks" that hold the headband to the ear cups are made of plastic? I just wanna know if it is some kinda painted aluminum. Otherwise it looks like a part that may break..

Anyway I am heavily leaning towards buying G PRO X Wireless, and am really grateful that you figured out support for it and did such a great job matching the official Windows battery indicator.

The other alternative I have been looking at is the Arctis Pro Wireless (see thread here discussing it on Linux) which has a standalone breakout box that means no need to run any software at all, it is all handled on the box with physical battery indicator and automatic charging.

But the Logitech Pro X Wireless looks more appealing physically: No bulky "breakout box dongle", has double battery life at 20+ h instead of 10 h (meaning no need to swap Logitech batteries constantly, whereas Arctis is made for constantly switching battery every 10 hours), and in fact Logitech has no ability to swap battery at all (which is just a hassle anyway), and you can plug in a USB C charger cable from anywhere and charge it while using it (and I just happen to have a loose USB C charger exactly where I sit!). So in the end, if the PRO X Wireless is now a good experience on Linux then I lean towards picking that one! It has a long battery life, no annoying box, and it can permanently sit next to me either being used or charging itself. Seems really great.

Thanks again and thanks in advance if you are able to answer any of these short questions. 😊 I am okay with short yes/no answers. Any help would be greatly appreciated.

@jaypikay jaypikay deleted the gpro branch February 22, 2022 11:13
@jaypikay
Copy link
Contributor Author

Hey thank you, for you post.

  1. Inactivity timeout: I don't know, haven't looked into this, but it's an idea. I can try to look into it.
  2. Need to look into it.
  3. Does not look like this could be a problem, the head set manages the standby by itself.
  4. There shouldn't be any differences. Except the microphone stuff. Logitech uses this Blue thing stuff, but it should be possible to achieve similar microphone quality using different audio filter tools, for Pulseaudio/Pipewire or Alsa and Jack. I do not have more details on this topic, as I do not care.
  5. The "forks" are metal

@Sapd Sapd mentioned this pull request Jan 10, 2023
@Arcitec
Copy link

Arcitec commented Jan 19, 2023

@jaypikay Thank you so much for your answers. I apologize, I thought I had replied earlier. I am really grateful that you took the time.

I'm glad to hear that the automatic standby works on Linux too, so the battery doesn't go empty constantly.

And I see now in the code that inactivity timeout is configurable for G Pro. Awesome.

And you're right, Logitech uses some Blue plugins on Windows. But I discovered that we can get really good audio quality on Linux too by using the EasyEffects app: https://github.com/wwmm/easyeffects

Thanks for everything. You're a fantastic person. :)

rpbaptist pushed a commit to rpbaptist/HeadsetControl that referenced this pull request May 31, 2024
* Logitech PRO battery status support
* Added Support for setting the inactivity timeout
* Fine tuned battery status
* Support Windows MSYS2 environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants