var names
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Tue, 9 May 2017 18:47:59 +0000 (11:47 -0700)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Tue, 9 May 2017 18:47:59 +0000 (11:47 -0700)
avr/src/report.c

index b403965dbb5601865fd0ae0d6ed35d7d8654fa3a..bb04f63ae479ad2a3c270f7879e98fcae9d175d5 100644 (file)
 #include <stdbool.h>
 
 
-static bool report_requested = false;
-static bool report_full = false;
-static uint32_t last_report = 0;
+static bool _requested = false;
+static bool _full = false;
+static uint32_t _last = 0;
 
 
-void report_request() {
-  report_requested = true;
-}
-
-
-void report_request_full() {
-  report_requested = report_full = true;
-}
+void report_request() {_requested = true;}
+void report_request_full() {_requested = _full = true;}
 
 
 void report_callback() {
-  if (usart_tx_full()) return; // Wait for buffer space
-
-  if (report_requested && usart_tx_empty()) {
+  if (_requested && usart_tx_empty()) {
     uint32_t now = rtc_get_time();
-    if (now - last_report < 100) return;
-    last_report = now;
+    if (now - _last < 250) return;
+    _last = now;
 
-    vars_report(report_full);
-    report_requested = report_full = false;
+    vars_report(_full);
+    _requested = _full = false;
   }
 }