src-avr: Move logging printfs out of ISR call chain
authorKeith Packard <keithp@keithp.com>
Mon, 23 May 2011 22:20:30 +0000 (16:20 -0600)
committerKeith Packard <keithp@keithp.com>
Mon, 23 May 2011 22:20:30 +0000 (16:20 -0600)
Probably not the best plan to call printf from an interrupt handler.

Signed-off-by: Keith Packard <keithp@keithp.com>
src-avr/ao_log_telescience.c

index bda8912922160d3aa33bae0723c5fd9095616e95..04e494fdc39aacd8070ed4a5eaf9cd43f2dc05e3 100644 (file)
@@ -88,7 +88,6 @@ ao_log_valid(struct ao_log_telescience *log)
 void
 ao_log_start(void)
 {
-       printf("Log goes from %ld to %ld\n", ao_log_current_pos, ao_log_end_pos);
        ao_log_running = 1;
        ao_wakeup(&ao_log_running);
 }
@@ -96,7 +95,6 @@ ao_log_start(void)
 void
 ao_log_stop(void)
 {
-       printf ("Log stopped at %ld\n", ao_log_current_pos);
        ao_log_running = 0;
        ao_wakeup((void *) &ao_adc_head);
 }
@@ -159,10 +157,13 @@ ao_log_set(void)
 {
        ao_cmd_hex();
        if (ao_cmd_status == ao_cmd_success) {
-               if (ao_cmd_lex_i)
+               if (ao_cmd_lex_i) {
+                       printf("Logging from %ld to %ld\n", ao_log_current_pos, ao_log_end_pos);
                        ao_log_start();
-               else
+               } else {
+                       printf ("Log stopped at %ld\n", ao_log_current_pos);
                        ao_log_stop();
+               }
        }
 }