diff --git a/README.md b/README.md index d548781..d89a6e9 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,9 @@ void loop() else sawtooth = 0; set_u32trace("Main.Sawtooth", sawtooth, false); - if (sawtooth == 4711) Serial.write("I can still be used with regular text."); + if (sawtooth == 4711) Serial.println("I can still be used with regular text."); - set_output(0, true); //send unlimited traces compressed + set_output(0, true, true); //send unlimited traces, compressed and clear console set_diagtrace(); // add diagnostic traces } ```` diff --git a/set.c b/set.c index f19a96a..ab80e6a 100644 --- a/set.c +++ b/set.c @@ -153,7 +153,7 @@ size_t set_tty_rubout(char buffer[], const size_t buffer_size) return buffer_pos; } -size_t set_output(size_t n, const bool compress) +size_t set_output(size_t n, const bool compress, const bool rubout) { const size_t render_number_items = 4; const size_t render_max_size = SET_MAX_RENDER_SIZE(render_number_items); @@ -170,8 +170,11 @@ size_t set_output(size_t n, const bool compress) set_out(packet_bytes, packet_size); } - packet_size = set_tty_rubout(packet_bytes, render_max_size); - set_out(packet_bytes, packet_size); + if (rubout) + { + packet_size = set_tty_rubout(packet_bytes, render_max_size); + set_out(packet_bytes, packet_size); + } return i; } diff --git a/set.h b/set.h index 1c7c7af..62b55b5 100644 --- a/set.h +++ b/set.h @@ -126,9 +126,10 @@ void set_clear(void); * This function is for basic usage where the output function writes into a managed stream such as stdout * @param[in] n Number of tracebuffer items to render, or 0 for the current size of the tracebuffer * @param[in] compress if true, render the packets compressed + * @param[in] rubout if true, sends a rubout packet at the end clearing the trace output on a terminal * @return None */ -size_t set_output(size_t n, const bool compress); +size_t set_output(size_t n, const bool compress, const bool rubout); /** @brief Render a set amount of tracebuffer items and store them in the provided buffer * This advanced function is intended to be used with DMA buffers.