Code Monkey home page Code Monkey logo

Comments (6)

Sapd avatar Sapd commented on July 19, 2024

Could be a simple flag/bitmask, because 222-94=128 (power of two). You could try it again with a different battery level, check the level, put the mic up and check the level again and subtract 128 to see if the result is the same.

from headsetcontrol.

kuchenstrudel avatar kuchenstrudel commented on July 19, 2024

Unplugged the headset, and spammed HeadsetControl -b

(mic up)

Battery: 222%

Failed to request battery. Error: -100: (null)

Battery: 223%

Battery: 223%

Battery: 223%

(mic down)

Battery: 95%

223-95 -> 128, will leave it unplugged for a while and report back once again.

from headsetcontrol.

kuchenstrudel avatar kuchenstrudel commented on July 19, 2024

(mic up)

Battery: 220%

(mic down)

Battery: 92%

220-92 -> 128, seems you are correct.

from headsetcontrol.

Sapd avatar Sapd commented on July 19, 2024

Then you can do something like this:

// on top of the c file
enum voidpro_battery_flags {
     VOIDPRO_BATTERY_MICUP = 128
}

// then inside the function
if (data_read[4] & VOIDPRO_BATTERY_MICUP)
    return data_read[4]-VOIDPRO_BATTERY_MICUP;

This will simply return the battery status. We could also pass it, however then the battery_status enum has to be updated.

from headsetcontrol.

kuchenstrudel avatar kuchenstrudel commented on July 19, 2024

I adjusted your code a bit and it looks good (as in working) now. See #14

from headsetcontrol.

kuchenstrudel avatar kuchenstrudel commented on July 19, 2024

Fixed in 5f49bd6, closing.

from headsetcontrol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.