# HG changeset patch # User Matt Johnston # Date 1342446624 -28800 # Node ID f18fd4257296d2b6d42726b7927e4349c4082615 # Parent c3eb67cd8b61bc66cd67ea9c305d1ea675614d53 don't reset the wake time when btoff happens diff -r c3eb67cd8b61 -r f18fd4257296 main.c --- a/main.c Mon Jul 16 21:28:49 2012 +0800 +++ b/main.c Mon Jul 16 21:50:24 2012 +0800 @@ -355,12 +355,14 @@ static void cmd_btoff() { + uint8_t rem; + uint16_t count_copy; ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { - comms_count = 0; + count_copy = comms_count; + rem = TCNT2; } - uint8_t rem = TCNT2; - printf_P(PSTR("next_wake=%hu,"), comms_wake); + printf_P(PSTR("next_wake=%hu,"), comms_wake-count_copy); printf_P(PSTR("rem=%hhu,"), rem); printf_P(PSTR("tick_secs=%hhu,"), TICK); printf_P(PSTR("tick_wake=%hhu\n"), SLEEP_COMPARE);