(more) accurate DS battery meter

Discussion in 'NDS - Emulation and Homebrew' started by 0ddity, Oct 3, 2010.

Oct 3, 2010

(more) accurate DS battery meter by 0ddity at 9:51 PM (2,005 Views / 0 Likes) 8 replies

  1. 0ddity
    OP

    Member 0ddity GBAtemp Fan

    Joined:
    Aug 7, 2010
    Messages:
    438
    Location:
    Ontario
    Country:
    Canada
    To start off, I'll let you know I know nothing about programming, I just had an idea for how it might be possible to get a more accurate battery meter as a plugin for SCDS2 (don't think any other cards could support the kind of multitasking I was thinking about.)

    So you would need a few different elements, first, a battery benchmark. You'd run the program, leaving the DS on with a full charge, and the benchmark would count how long it takes to completely drain the battery. 2nd, you'd need a charging benchmark, to see how long it would take to charge 100% from a total dead battery. Using these two data points as references, a 3rd program could keep track of how long the DS is on, and comparing against the drain benchmark, could tell you with much greater accuracy how much time is left of the battery, and maybe draw this information as a battery icon. The charge benchmark would be used to calculate how much time is added to the battery if it's plugged in without a full discharge, and unplugged without a full charge.

    Anyways, like I said I know nothing about programming, or about the multitasking ability of cards like the DS2, but I was thinking about how to get a more accurate reading of the battery status and this was the only way I could think of.
     
  2. CannonFoddr

    Member CannonFoddr Regular GBATemp Lurker

    Joined:
    Sep 23, 2006
    Messages:
    4,106
    Location:
    Sitting by computer
    Country:
    United Kingdom
    Well I know nothing about programming either (well actually that's a lie - I know a VERY little bit) but I can see one or two small problems

    Firstly, I don't think the DS2 has 'multitasking capabilities' it either uses the CPU/Memory of the card OR it uses the DS CPU/Memory

    Next - IF you start a program up on a fully charged battery & the battery dies HOW would the program know when to stop ??

    The only way a program can determine how long something 'runs' is with a timer of some sort - you could start the timer up, but if the battery dies then you would lose the timer value
    - the best you could do is MONITOR the battery level & set a minimum limit

    IF the battery level goes below this level (which has to be higher than the DS(i) normal cut-off level) THEN stop the timer & record (somehow) the time. This would be the 'Battery life from fully charged'

    Another problem - with the 'charging benchmark' - If you had a fully flat battery, you won't have any power to start the program, which in turn won't be able to start a timer up

    Even if you COULD start the program up automatically when you had enough charge to run it - you would still need to monitor the battery level to determine when the battery is fully charged - which will never happen since you are using the battery to run a program which will always cause a drain
    (although you MIGHT get a blip into 100% at times)

    & Without the first 2 benchmarks times - you won't be able to do the 3rd program to 'monitor'

    --------------------
    The best anyone could do (IMHO) is a program that monitors the battery voltage on program startup, record when battery has reduced by 10%,20%,30% etc until voltage reaches a 'Minimum level' - & record the time @ each value
    THEN have the same program compare the original values with further tests to see how much they differ to give you an indication on how well your battery is or whether it's failing
     
  3. 0ddity
    OP

    Member 0ddity GBAtemp Fan

    Joined:
    Aug 7, 2010
    Messages:
    438
    Location:
    Ontario
    Country:
    Canada
    I think I explained how you could theoretically get the first 2 benchmarks to run.
     
  4. jurassicplayer

    Member jurassicplayer Completionist Themer

    Joined:
    Mar 7, 2009
    Messages:
    4,280
    Location:
    Pantsuland
    Country:
    United States
    I believe Moonshell2 is resuming based on increments of the audio/movie (maybe 5 second increments), meaning it is constantly saving a new resume point every 5 seconds (or maybe increasing a number by one every 5 seconds and then that number gets multiplied by 5 and made as the resume point).

    Supposing someone used this method, and attempt trying to get more accurate results by decreasing the length of each increment...I'm pretty sure it would require some memory accessing (which spikes the energy a bit and would definitely ruin the use of benchmarking the battery) to actually save the information somewhere. Not only that, but supposing you attempt getting a good benchmark and drain your battery, it supposedly isn't the best thing to do for prolonging your battery's lifespan.

    Quite frankly, I don't see the point in seeing the level of change still in the battery beyond "Need to charge" and "Don't need to charge"...I'm guessing Nintendo thought the same thing since the DS can only differentiate between three levels of charge apparently.
     
  5. omegasoul6

    Member omegasoul6 FFXIV Fanboy

    Joined:
    Aug 16, 2007
    Messages:
    399
    Location:
    Toronto
    Country:
    Canada
    Thats a good idea and it can use the extra ram
     
  6. twiztidsinz

    Member twiztidsinz Taiju Yamada Fan

    Joined:
    Dec 23, 2008
    Messages:
    4,981
    Country:
    United States
    If I'm not mistaken, the DS itself can get a capacity reading based on the battery charge, much like the 'self test' AA/AAA batteries that were popular a few years back, which actually is the most accurate way since it's based on the actual power levels and not just a set time since the battery capacity degrades over time, as it's used and as it's charged.

    Also the DS has, I believe, 4 levels of battery charge: Full (>75%), "2/3rds" (>50%) "1/3rd" (>25%) and Empty (
     
  7. trumpet-205

    Member trumpet-205 Embrace the darkness within

    Joined:
    Jan 14, 2009
    Messages:
    4,363
    Country:
    United States
    In order to measure how much charge is left, you must, in a way, find out the current voltage of the battery. Using voltage and mAh you can make an estimate of how much charge is left.
     
  8. tombot

    Member tombot GBAtemp Regular

    Joined:
    Aug 31, 2009
    Messages:
    154
    Country:
    United States
    Don't forget you need to take brightness and volume into consideration, so it can't simply be a timer.
     
  9. twiztidsinz

    Member twiztidsinz Taiju Yamada Fan

    Joined:
    Dec 23, 2008
    Messages:
    4,981
    Country:
    United States
    And WiFi usage as well.
    I've been on a low charge and had my DS turn red when updating the DQIX shop and back to green when WiFi disconnected.
     

Share This Page