Communications optimize battery usage

Hi.

I am trying to develop a companion app that will get data (historic HR) from the Garmin Vivofit HR and show historic calories graph on the phone app. I also want to send back the calorie values to the vivofit (including the intake calories logged by the user, to be shown on the vivofit display as a graph).

On my current prof of concept, the battery power usage is about 4x than a watchface and I believe the issue is with the communications (here is the code: https://github.com/DailyWeightFatControl/garmin_watchface/tree/watchapp1). Can someone please help me with suggestions for optimizations?

I plan to have the phone app asking at any time the Garmim device app for the historic HR and send back the users logged intake calories. Maybe I can define define some specific frequency and not have the communications always on? would that be possible?

NOTE: I am an ex Pebble user and I were starting to develop this app when they shutdown and were bought by Fitbit :-( :-(
  • Do you really need to transmit the data every 2 minutes? Could you just collect data as frequently as you need and do the transmit every 10/15/30 minutes? It seems that would make a big difference.

    Well, I am using an app that read the battery and I am following that values. I made some more tests and found that not even doing comms and updating the watch at each 5 minutes only, the battery usage is the same :-( -- maybe the app is not showing me correct values or maybe the battery system needs some kind of calibration?

    I'll take a peek at the code after work this evening. I'm not sure if I'll come up with something or not, but I'll take a peek.

    Thanks!!
  • I'm sorry, I failed to look at this over the whole weekend. I'm getting ready to go to sleep, but I will put a reminder in my phone to look at it tomorrow.

    Travis
  • I just updated the code to use Comm.registerForPhoneAppMessages(phoneMethod);

    https://github.com/DailyFatControl/garmin_watchface/tree/watchapp-test_comm1/source

    I did follow the app samples. I will be testing to today and see if the battery usage improves.
  • The code is pretty simple. I think I'd avoid registering for and deregistering from receiving phone messages until you can prove that doing so has any advantage. It seems that it shouldn't have any effect on battery unless messages are coming in from the phone more frequently than the app would allow with the timer in place. If that is happening, it seems you should throttle the phone app back a bit. I'd also think that sending data less frequently, or on demand only, would reduce battery usage as well.

    Other than that, nothing really sticks out to me as something that should have a significant impact on battery.

    Travis
  • I just did some more tests:
    - using Comm.registerForPhoneAppMessages(phoneMethod); didn't improve battery usage
    - running a very simple app (without any comms) that just shows minutes in text every 10 minutes, used also the ~2% of battery ever 1h --> full battery only for 2 days :-(

    So maybe just because it is an app, the system draws constantly the about ~2% / hours... :-( :-(
  • In your app, how often do you update the screen, etc? (with comm out of the picture). If you're redrawing every second and doing the message every 10 minutes, maybe try again doing the screen update every minute? (or as a test, even every 5 or 10 minutes). That might help to see how much of an impact doing the screen updates comes into play.
  • I will be testing again, this time using this very simple code:

    ---
    using Toybox.Application as App;
    using Toybox.WatchUi as Ui;
    using Toybox.Graphics as Gfx;

    class TestApp extends Ui.View
    {
    //! Constructor
    function initialize()
    {
    View.initialize();
    Ui.requestUpdate();
    }

    //! Handle the update event
    function onUpdate(dc)
    {
    dc.setColor(Gfx.COLOR_BLACK, Gfx.COLOR_BLACK);
    dc.clear();

    dc.setColor(Gfx.COLOR_WHITE, Gfx.COLOR_TRANSPARENT );

    dc.drawText(50, 50, Gfx.FONT_LARGE, "test battery", Gfx.TEXT_JUSTIFY_CENTER);
    }
    }

    //! main is the primary start point for a Monkeybrains application
    class Test extends App.AppBase
    {
    function initialize() {
    AppBase.initialize();
    }

    function onStart(state)
    {
    return false;
    }

    function getInitialView()
    {
    return [new TestApp()];
    }

    function onStop(state)
    {
    return false;
    }
    }
  • I am not get consistent results... seems that during night values are lower but higher during day... maybe this is due to system reading my HR, maybe I should disable HR and have the device in the table (no movement) to measure the battery usage.

    For now I will keep developing my app and in later stage try do measure, that will be difficult, with a lot of work to do.
  • Depending on device, 2% an hour for an app doesn't seem to bad, especially one that does communication. My app that I use as my everyday watch face ranges from 1.5% to 2.5%. Never quite sure what makes the difference. But in any case, running an app 24/7 is never going to come close to what a standard watch face does, mostly because you don't have access to the low power mode.

    I've found that changing my query for online data from every minute, to every 30 minutes only makes a margin difference in battery usage. So I've just come to accept that I will need to charge every other day. I'm using an FR630.
  • Depending on device, 2% an hour for an app doesn't seem to bad, especially one that does communication. My app that I use as my everyday watch face ranges from 1.5% to 2.5%. Never quite sure what makes the difference. But in any case, running an app 24/7 is never going to come close to what a standard watch face does, mostly because you don't have access to the low power mode.

    I've found that changing my query for online data from every minute, to every 30 minutes only makes a margin difference in battery usage. So I've just come to accept that I will need to charge every other day. I'm using an FR630.

    Thanks for reporting!! That's inline with my experiencies - it is really great to have this information. Now lets hope that Garmin can ear us and improve this situation.

    I am now using Sensors for HR reading, when I click on Enter button and I don't see a big impact also. I am also on the 1.5 up to 2.5% per hour.