Widget: Battery Gauge

Former Member
Former Member
Battery Gauge

Battery Gauge Widget v2.1




Widget showing battery history for a selected period. Currently it is a bit limited, since it isn't possible to have a process running in the background storing the battery state continuosly. The way the widget currently works is that every time the widget is started, the battery charge value is read and saved. The value is compared to the previous one, and the graph is updated. Each bar in the graph represents an hour (in week view), so if the widget for instance is started at 12 o'clock and later at 4 o'clock, the values at 12 and 4 are real values. The values at 1, 2 and 3 o'clock are calculated based on the difference between 12 and 4. If one starts the widget at regular intervals, the graph should give a quite good representation of the battery state.

Widget menu (press Start/Enter button)
  • Statistics screen, showing battery drain the last hour, the last day, since a user defined time and since last log reset.
  • Switch the graph scale between 1 month, 2 weeks, 1 week, 4 days and 1 day (Log data is no longer deleted when changing scale).
  • Switch between no graph markers, high/low markers or markers for each step on the x-axis.
  • Switch between black or white background.
  • Reset the log.

Please note:
  • Since each bar represents one hour, there will be no data visible for the first hour after the widget is run the first time. If after several hours no graph is visible, try clearing the log from the widget menu.
  • It is recommended to clear the log after installing a new version.
  • If after clearing the log problems still persist, it may be necessary to manually delete the log file. Instructions in this post: Deleting log file manually


Updates:

Version 2.1 - September 18, 2016
  • Support for Vivoactive HR
  • Fixed layout issues on new Forerunner and Fenix series watches
  • Improved the ability to scroll past the widget in the widget list


Version 1.9b - November 23, 2015
  • Added experimental support for FR230, FR235 and FR630. Please regard this as beta software for the time being.

Version 1.8 - June 24, 2015
  • Updated to Connect IQ v1.1.2.
  • Added support for D2 Bravo.

Version 1.7 - May 27, 2015
  • Improved precision on statistics calculations.
  • Added version number to statistics screen.

Version 1.6.5 - May 17, 2015
  • Fixed a bug regarding 'last hour' and 'last day' statistics.

Version 1.6.2 - May 10, 2015
  • Increased size of graph marker font.

Version 1.6 - May 9, 2015
  • Thanks to Gigios (Vivoactive) andMourk.D (Fenix 3) for beta testing!
  • Added 'Statistics' screen, showing battery drain over various periods.
  • Added experimental Vivoactive support. Please regard this as beta software for the time being.
  • Added ForeAthlete 920XTJ support.
  • Renamed 'Clear Log' to 'Reset Log'
  • Bug fixes.

Version 1.2 - April 28, 2015
  • Added option to select between graph markers.
  • Added 1 month scale option.

Version 1.1 - April 17, 2015
  • Data is no longer cleared when changing scale.
  • When selecting a new scale in the menu, view is immediately returned to graph.
  • Added 2 week scale option.

Version 1.0 - April 13, 2015
  • Added possibility to change graph scale.
  • Added possibility to change background color.
  • Added marker showing highest value of graph.
  • Bug fixes.

Version 0.8 beta - April 08, 2015
  • Forerunner 920XT support - NOTE: Only tested in simulator.
  • Added possibility to delete log file via widget menu.
  • Small tweaks to graph.

Version 0.7 beta - April 07, 2015
  • Bug fixes.
  • Added version number to screen.

Version 0.6 beta - April 07, 2015
  • Initial version.
  • Former Member
    Former Member over 8 years ago
    Battery status does not seem to be updated properly on Fenix 3 HR.

    I recharge my Fenix 3 HR every 2 or 3 days when I get the message "battery low"... that's great. Now, when I look at the battery gauge it always shows a line with a steady increasing slope with percentage above 60%. This is true wether I use a scale of 1 day, 4 days, 1 week or 1 month. It was working before...

    Am I not understanding something?

    Thanks,

    PA 😊
  • Connect IQ 2.3.1 - Background Service

    Would it be possible now to update the battery level regularly using the new background service introduced in IQ 2.3.1?
  • *EDIT*

    Apparently I was just too impatient, if I wait a bit on the main screen (to let the calculations finish properly) and THEN go into statistics it seems to work consistently...

    I'll leave the post below in case the developer maybe wants to handle this error in a different way (catch it instead of crashing the app) but now that I figured out what is causing it it is no big issue for me anymore at least


    --------------------










    Thanks for the great work, I have an issue on my Forerunner 935 though. When going into the statistics I get the connect-iq-error screen (exclamation mark). After resetting the stats if works for a short bit, I can see the detailed stats, but shortly after it goes to the error screen again.

    Checking the CIQ_LOG.TXT I see this:

    UnexpectedTypeException: Expected Number/Float/Long/Double, given null/Number

    Which unfortunately doesn't help much I'm afraid ... I'll try creating the .TXT file for the app itself to see if more detailed info is written there.

    If I can do any testing for you, please let me know!

    *EDIT*

    Log from the app-specific log text file:
    ​​​​​​​
    onShow() called... (1500899909)
    ----------------------------
    Device: hires
    App version: v2.3b
    Log file version: v2.3b
    Initializing property GRAPH_VALUES with default: 0
    Initializing property 4 with default: 16777215
    Initializing property 5 with default: 0
    Initializing property 6 with default: 11184810
    No data
    No data
    Stats onLayout() called...
    Current charge: 97.869560
    Current charge: 97.869560
    onShow() called... (1500899909)
    ----------------------------
    Device: hires
    App version: v2.3b
    Log file version: v2.3b
    Initializing property GRAPH_VALUES with default: 0
    Initializing property 4 with default: 16777215
    Initializing property 5 with default: 0
    Initializing property 6 with default: 11184810
    onShow() called... (1500900149)
    ----------------------------
    Device: hires
    App version: v2.3b
    Log file version: v2.3b
    Initializing property GRAPH_VALUES with default: 0
    Initializing property 4 with default: 16777215
    Initializing property 5 with default: 0
    Initializing property 6 with default: 11184810
    No data
    No data
    No data
    Stats onLayout() called...
    Current charge: 97.975098
    UnexpectedTypeException: Expected Number/Float/Long/Double, given null/Number
  • Former Member
    Former Member over 8 years ago
    Thanks for the feedback! I have been on holiday the last few weeks, so I missed your messages...
    I can recreate the error on my fenix 5, and will handle the error better when the next update is ready :)

    -Torstein
  • Awesome, thank you! I noticed with the latest fw beta it acts a bit weird again (5.09b for my 935). Pressing the marker button in the statistics page results in a crash now... Used to work fine.
  • Former Member
    Former Member over 8 years ago
    If you could provide a log that would be super useful. I usually prefer not running beta firmware myself, as that may or may not introduce other problems...
  • Sure!

    One of the changes in the firmware is:
    • Added support for Connect IQ SDK 2.3.2.
    So my guess is that has something to do with it?

    About the logs... The last few errors in the CIQ_LOG.TXT:

    ERROR: Unhandled Exception
    DETAILS: NONE
    STORE_ID: 4370b941487441f482d1d10924eb4bfa
    CALLSTACK:
    UnexpectedTypeException: Expected Number/Float/Long/Double, given null/Number

    ERROR: System Error
    DETAILS: Failed invoking <symbol>
    STORE_ID: 4370b941487441f482d1d10924eb4bfa
    CALLSTACK:
    @PC = 0x100003db

    ERROR: System Error
    DETAILS: Failed invoking <symbol>
    STORE_ID: 4370b941487441f482d1d10924eb4bfa
    CALLSTACK:
    @PC = 0x100003db

    ERROR: Unhandled Exception
    DETAILS: NONE
    STORE_ID: 4370b941487441f482d1d10924eb4bfa
    CALLSTACK:
    UnexpectedTypeException: Expected Number/Float/Long/Double, given null/Number

    ERROR: System Error
    DETAILS: Failed invoking <symbol>
    STORE_ID: 4370b941487441f482d1d10924eb4bfa
    CALLSTACK:
    @PC = 0x100003db

    ERROR: System Error
    DETAILS: Failed invoking <symbol>
    STORE_ID: 4370b941487441f482d1d10924eb4bfa
    CALLSTACK:
    @PC = 0x100003db


    And here the app-specific debug log:

    No data
    Stats onLayout() called...
    Current charge: 100.000000
    Current charge: 100.000000
    Current charge: 100.000000
    onShow() called... (1501961968)
    ----------------------------
    Device: hires
    App version: v2.3b
    Log file version: v2.3b
    Initializing property 4 with default: 16777215
    Initializing property 5 with default: 0
    Initializing property 6 with default: 11184810
    No data
    No data
    Stats onLayout() called...
    Current charge: 100.000000
    Current charge: 100.000000
    Current charge: 100.000000
    onShow() called... (1501961985)
    ----------------------------
    Device: hires
    App version: v2.3b
    Log file version: v2.3b
    Initializing property 4 with default: 16777215
    Initializing property 5 with default: 0
    Initializing property 6 with default: 11184810
    No data
    No data
    Stats onLayout() called...
    Current charge: 100.000000
    Current charge: 100.000000
    YES
    onShow() called... (1501961985)
    Initializing property APP_VERSION with default: N/A
    ----------------------------
    Device: hires
    App version: v2.3b
    Log file version: N/A
    Initializing property 14 with default: 1501961471
    Initializing property 13 with default: 1501959928
    Initializing property 12 with default: 1501958321
    Initializing property 11 with default: 1501954657
    Initializing property 16 with default: 1501947329
    Initializing property 15 with default: null
    Initializing property 7 with default: null
    Initializing property 8 with default: null
    Initializing property 9 with default: null
    Initializing property 10 with default: null
    Initializing property 4 with default: 16777215
    Initializing property 5 with default: 0
    Initializing property 6 with default: 11184810
    onShow() called... (1501961999)
    ----------------------------
    Device: hires
    App version: v2.3b
    Log file version: v2.3b
    Initializing property 4 with default: 16777215
    Initializing property 5 with default: 0
    Initializing property 6 with default: 11184810
    No data
    No data
    No data
    Stats onLayout() called...
    Current charge: 100.000000
    UnexpectedTypeException: Expected Number/Float/Long/Double, given null/Number
    onShow() called... (1501962006)
    ----------------------------
    Device: hires
    App version: v2.3b
    Log file version: v2.3b
    Initializing property 4 with default: 16777215
    Initializing property 5 with default: 0
    Initializing property 6 with default: 11184810
    No data
    No data
    Stats onLayout() called...
    Current charge: 100.000000
    Current charge: 100.000000
    Current charge: 100.000000
    Stats onLayout() called...
    Current charge: 100.000000
    Current charge: 100.000000
    onShow() called... (1501962006)
    ----------------------------
    Device: hires
    App version: v2.3b
    Log file version: v2.3b
    Initializing property 4 with default: 16777215
    Initializing property 5 with default: 0
    Initializing property 6 with default: 11184810
    onShow() called... (1502035182)
    ----------------------------
    Device: hires
    App version: v2.3b
    Log file version: v2.3b
    Initializing property 4 with default: 16777215
    Initializing property 5 with default: 0
    Initializing property 6 with default: 11184810
    No data
    No data
    Stats onLayout() called...
    Current charge: 90.510292
    Current charge: 90.510292
    onShow() called... (1502035182)
    ----------------------------
    Device: hires
    App version: v2.3b
    Log file version: v2.3b
    Initializing property 4 with default: 16777215
    Initializing property 5 with default: 0
    Initializing property 6 with default: 11184810
    onShow() called... (1502098709)
    ----------------------------
    Device: hires
    App version: v2.3b
    Log file version: v2.3b
    Initializing property 4 with default: 16777215
    Initializing property 5 with default: 0
    Initializing property 6 with default: 11184810
    No data
    No data
    Stats onLayout() called...
    Current charge: 87.843391
    Current charge: 87.843391
    Current charge: 87.843391
    onShow() called... (1502115664)
    ----------------------------
    Device: hires
    App version: v2.3b
    Log file version: v2.3b
    Initializing property 4 with default: 16777215
    Initializing property 5 with default: 0
    Initializing property 6 with default: 11184810
    No data
    No data
    Stats onLayout() called...
    Current charge: 87.097916
    Current charge: 87.097916
    Current charge: 87.097916
  • Former Member
    Former Member over 8 years ago
    Thanks!
    I'll look into this, hopefully rather soon :)
  • Thanks!
    I'll look into this, hopefully rather soon :)


    Any news about this by any chance? I now reset all stats every now and then to keep proper track of battery usage but would like to be able to use the marker button...

    If there is anything I can test or help with, please let me know!

    (I also programmed a bit in ConnectIQ myself, so I could try testing/debugging the code itself directly on my watch if you would feel comfortable with that. If not I completely understand of course, but just mentioning it as an option ;) ).
  • Former Member
    Former Member over 8 years ago
    Sorry, I'm busy training and preparing for this season's last races, so CIQ programming isn't really a priority for the next few weeks.
    That being said, I'll see if I can manage to take a quick look at the bug this week to see if it is an easy fix.

    -Torstein