comparison main.c @ 93:f18fd4257296

don't reset the wake time when btoff happens
author Matt Johnston <matt@ucc.asn.au>
date Mon, 16 Jul 2012 21:50:24 +0800
parents a1c1c2d475b0
children bf707a3775d2
comparison
equal deleted inserted replaced
92:c3eb67cd8b61 93:f18fd4257296
353 } 353 }
354 354
355 static void 355 static void
356 cmd_btoff() 356 cmd_btoff()
357 { 357 {
358 uint8_t rem;
359 uint16_t count_copy;
358 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) 360 ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
359 { 361 {
360 comms_count = 0; 362 count_copy = comms_count;
361 } 363 rem = TCNT2;
362 uint8_t rem = TCNT2; 364 }
363 printf_P(PSTR("next_wake=%hu,"), comms_wake); 365 printf_P(PSTR("next_wake=%hu,"), comms_wake-count_copy);
364 printf_P(PSTR("rem=%hhu,"), rem); 366 printf_P(PSTR("rem=%hhu,"), rem);
365 printf_P(PSTR("tick_secs=%hhu,"), TICK); 367 printf_P(PSTR("tick_secs=%hhu,"), TICK);
366 printf_P(PSTR("tick_wake=%hhu\n"), SLEEP_COMPARE); 368 printf_P(PSTR("tick_wake=%hhu\n"), SLEEP_COMPARE);
367 _delay_ms(100); 369 _delay_ms(100);
368 comms_timeout = 0; 370 comms_timeout = 0;