It is currently Wed Jul 06, 2011 7:43 pm

All times are UTC - 8 hours




 Page 1 of 1 [ 7 posts ] 
Author Message
 Post subject: power_down... Not really powered down?
PostPosted: Tue Apr 19, 2011 2:32 pm 

Joined: Wed Mar 23, 2011 9:35 am
Posts: 54
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


Offline
 Profile  
 
 Post subject: Re: power_down... Not really powered down?
PostPosted: Tue Apr 19, 2011 5:56 pm 

Joined: Tue Feb 15, 2011 10:35 pm
Posts: 42
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.


Offline
 Profile  
 
 Post subject: Re: power_down... Not really powered down?
PostPosted: Tue Apr 19, 2011 7:59 pm 

Joined: Wed Mar 23, 2011 9:35 am
Posts: 54
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) {

}


Offline
 Profile  
 
 Post subject: Re: power_down... Not really powered down?
PostPosted: Wed Apr 20, 2011 12:32 am 

Joined: Tue Feb 15, 2011 10:35 pm
Posts: 42
While in sleep mode the watch wakes up once a minute to check the alarm. The vibrations occur during these alarm checks.


Offline
 Profile  
 
 Post subject: Re: power_down... Not really powered down?
PostPosted: Wed Apr 20, 2011 8:51 am 

Joined: Wed Mar 23, 2011 9:35 am
Posts: 54
Soooooo... The main_app_loop *IS* called, but only once per minute?


Offline
 Profile  
 
 Post subject: Re: power_down... Not really powered down?
PostPosted: Wed Apr 20, 2011 1:50 pm 

Joined: Tue Feb 15, 2011 10:35 pm
Posts: 42
You are correct. In most cases this is not noticeable, but you found one where it was apparent.


Offline
 Profile  
 
 Post subject: Re: power_down... Not really powered down?
PostPosted: Wed Apr 20, 2011 2:38 pm 

Joined: Wed Mar 23, 2011 9:35 am
Posts: 54
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,


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 7 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: