# HG changeset patch # User Matt Johnston # Date 1342446624 -28800 # Node ID 744c3c7eb09d87842bf5c5ee6e3d9f1feb435bc3 # Parent c738a52e31e49b9d45e25f949df7d17525a07d45 don't reset the wake time when btoff happens diff -r c738a52e31e4 -r 744c3c7eb09d 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);