]> git.scottworley.com Git - tattlekey/blobdiff - client/tattlekey.c
server: Only write CSV headers when initially creating the log file
[tattlekey] / client / tattlekey.c
index 9d255856b74a41cc93dc8d2a5a927dff6571e4ba..5e829d1654e608f307923efc6ec10a0ba1ce120d 100644 (file)
@@ -94,7 +94,7 @@ void service_sleeps(int alarm, press_pile_t *pp) {
     press_t press;
     if (!get_press_due_for_resend(pp, now, &press))
       signal_error_by_blinking();
     press_t press;
     if (!get_press_due_for_resend(pp, now, &press))
       signal_error_by_blinking();
-    uint32_t ago = now - press.timestamp;
+    u32_t ago = now - press.timestamp;
     send_report_packet(press.seq, ago);
     press.send_count++;
     if (press.send_count < config_resend_count) {
     send_report_packet(press.seq, ago);
     press.send_count++;
     if (press.send_count < config_resend_count) {
@@ -119,6 +119,8 @@ void service_queue() {
     switch (e.type) {
     case NEW_BUTTON_PRESS: {
       add_press(pp, &(press_t){e.buttonpress.timestamp, seq++, 0});
     switch (e.type) {
     case NEW_BUTTON_PRESS: {
       add_press(pp, &(press_t){e.buttonpress.timestamp, seq++, 0});
+      if (seq == 0)
+        new_epoch();
     } break;
     case RESEND_TIME: {
       /* OK, we're awake. Cool. Thanks! (We actually do the sends in the
     } break;
     case RESEND_TIME: {
       /* OK, we're awake. Cool. Thanks! (We actually do the sends in the