Remove contitional on clock updating, it should always be done after a sleep!

This commit is contained in:
dak664 2010-12-22 17:09:03 +00:00
parent 44a2e34005
commit 013c3ac2f8
3 changed files with 13 additions and 10 deletions

View File

@ -41,6 +41,8 @@
The Raven has a 32768Hz watch crystal that can be used to clock the timer
while the 1284p is sleeping. The Jackdaw has pads for a crystal. The crystal
can be used to clock the 8 bit timer2.
The 1284p routine also uses TIMER2 to sleep a variable number of seconds.
It restores the values here after a wake.
*/
#if AVR_CONF_USE32KCRYSTAL
#define AVR_OUTPUT_COMPARE_INT TIMER2_COMPA_vect

View File

@ -31,19 +31,19 @@ extern uint8_t RF230_receive_on;
For longer intervals a 32 bit global is incremented every second.
clock-avr.h contains the specific setup code for each mcu.
The 1284p can use TIMER2 with external 32768 Hz clock at 125 ticks/sec.
The 1284p routine also uses TIMER2 to sleep a variable number of seconds.
It calls this routine to adjust the clock after a sleep.
*/
#if AVR_CONF_USE32KCRYSTAL
/*---------------------------------------------------------------------------*/
/* This routine can be called to add seconds to the clock after a sleep
* of an integral number of seconds.
* TODO:keep separate track of elapsed time, cpu ontime, and radioontime
*/
void clock_adjust_seconds(uint8_t howmany) {
seconds += howmany;
#if RADIOSTATS
if (RF230_receive_on) radioontime += howmany;
#endif
}
#endif
/*---------------------------------------------------------------------------*/
//SIGNAL(SIG_OUTPUT_COMPARE0)
ISR(AVR_OUTPUT_COMPARE_INT)

View File

@ -28,7 +28,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* $Id: raven-lcd.c,v 1.10 2010/12/22 16:50:31 dak664 Exp $
* $Id: raven-lcd.c,v 1.11 2010/12/22 17:09:03 dak664 Exp $
*/
/**
@ -163,10 +163,12 @@ char serial_char_received;
/* Sleep for howlong seconds, or until UART interrupt if howlong==0.
* Uses TIMER2 with external 32768 Hz crystal to sleep in 1 second multiples.
* TIMER2 may have already been set up for 125 ticks/second in clock.c
* If so the clock is adjusted to reflect the sleep time
*
* Until someone figures out how to get UART to wake from powerdown,
* a three second powersave cycle is used with exit based on any character received.
* The system clock is adjusted to reflect the sleep time.
*/
void micro_sleep(uint8_t howlong)
@ -209,8 +211,7 @@ void micro_sleep(uint8_t howlong)
serial_char_received=0; // Set when chars received by UART
sleep_mode(); // Sleep
/* Adjust clock.c for the time sleeping */
/* TODO:keep track of realtime, ontime, and radioontime */
/* Adjust clock.c for the time spent sleeping */
extern void clock_adjust_seconds(uint8_t howmany);
clock_adjust_seconds(howlong);