forum.getinpulse.com
http://www.getinpulse.com/hack/forum/

power_down... Not really powered down?
http://www.getinpulse.com/hack/forum/viewtopic.php?f=6&t=241
Page 1 of 1

Author:  MonkeyEnFuego [ Tue Apr 19, 2011 2:32 pm ]
Post subject:  power_down... Not really powered down?

I am confused. I have my watch app, and it displays for 10 seconds then goes to sleep. The idea is to preserve battery. I had a mental lapse and added code in the main_app_loop() to buzz on the hour and half-hour.

Then I realized, wait a min. I will be asleep. I can't buzz on the hour and half-hour this way (unless I am displaying (unlikely).

The weird thing, is that it appears to work. Now I am confused. When you call:

pulse_update_power_down_timer(10000);


and go asleep, does it just turn off the display and main_app_loop() is always being called? I figured it wouldn't be. If so, I will restructure the code so short circuit when "asleep".

Any other pointers on preserving battery would be great.

<confused>

Matt

Author:  Ryan [ Tue Apr 19, 2011 5:56 pm ]
Post subject:  Re: power_down... Not really powered down?

When pulse_update_power_down_timer() is called the screen is turned off and the processor is put into a low power sleep mode. During this time the main_app_loop() function should not be called, which suggests that your watch isn't in sleep mode. Only bluetooth, the alarm and the button can wake up the watch from sleep mode.

Also for your app I'd recommend using the alarm and registering a callback for it to buzz every half hour.

Author:  MonkeyEnFuego [ Tue Apr 19, 2011 7:59 pm ]
Post subject:  Re: power_down... Not really powered down?

You sure? This example buzzes every minute, even when asleep
static struct pulse_time_tm current_time;

void buzz () {
    pulse_vibe_on();
    pulse_mdelay(100);
    pulse_vibe_off();
}


void polite_buzz () {
   
    // We are confused and must have lost power with no time set
    if (current_time.tm_year < 100) return;
   
    // If it is before 8am or after 10pm, shhh!
    if (current_time.tm_hour < 8 || current_time.tm_hour >= 22) return;
   
    // Otherwise we are good to go
    buzz();
}

void handle_button_causing_wakeup ();

void main_app_init () {
    // Set a timer to go to sleep if we don't hear from anyone
    pulse_update_power_down_timer(10000);
   
    // Register a callback for the woke_from_button event
    pulse_register_callback(ACTION_WOKE_FROM_BUTTON, &handle_button_causing_wakeup);
}

void handle_button_causing_wakeup () {
   
    pulse_blank_canvas();
    pulse_update_power_down_timer(10000);
}

void main_app_handle_button_down() {
}

void main_app_handle_button_up() {
    // Reset any timer to go to sleep
    pulse_update_power_down_timer(10000);

}

void main_app_loop () {
   
    pulse_get_time_date(¤t_time);
   
    // Let's buzz every 1 minute to make a point
    if (current_time.tm_sec == 0) {
            polite_buzz();           
    }   
    printf("Awake\n");
}


void main_app_handle_doz() {

}


void main_app_handle_hardware_update(enum PulseHardwareEvent event) {

}

Author:  Ryan [ Wed Apr 20, 2011 12:32 am ]
Post subject:  Re: power_down... Not really powered down?

While in sleep mode the watch wakes up once a minute to check the alarm. The vibrations occur during these alarm checks.

Author:  MonkeyEnFuego [ Wed Apr 20, 2011 8:51 am ]
Post subject:  Re: power_down... Not really powered down?

Soooooo... The main_app_loop *IS* called, but only once per minute?

Author:  Ryan [ Wed Apr 20, 2011 1:50 pm ]
Post subject:  Re: power_down... Not really powered down?

You are correct. In most cases this is not noticeable, but you found one where it was apparent.

Author:  MonkeyEnFuego [ Wed Apr 20, 2011 2:38 pm ]
Post subject:  Re: power_down... Not really powered down?

Is there an easy way to see if you are "looping" while asleep to avoid any computation that is meant for display to help preserve battery. Of course I can manage my own boolean, but just curious if there is a baked in way to do it.

Thanks,

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/