Skip to content

Commit 31aa5db

Browse files
committed
[enhancement][monitoring]: Add a visual indicator for serial print operations using LED_BUILTIN.
- SerialPrinter: Set LED_BUILTIN HIGH before scheduling a print operation to indicate print activity. - PrintHandler: Set LED_BUILTIN LOW after printing to signal completion of the print operation. Signed-off-by: Goran Mišković <[email protected]>
1 parent 4919a28 commit 31aa5db

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/PrintHandler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace e5 {
3232
void PrintHandler::onWork() {
3333
if (!m_message->empty()) {
3434
Serial1.print(m_message->c_str());
35+
digitalWrite(LED_BUILTIN, LOW);
3536
}
3637
}
3738

src/SerialPrinter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010
#include "ContextManager.hpp"
1111
#include "MessageBuffer.hpp"
1212
#include "PrintHandler.hpp"
13-
13+
#include "pins_arduino.h"
1414
namespace e5 {
1515

1616
// Constructor implementation
1717
SerialPrinter::SerialPrinter(const AsyncCtx &ctx) : m_ctx(ctx) {}
1818

1919
// Print method implementation for std::string
2020
uint32_t SerialPrinter::print(std::unique_ptr<std::string> message) const {
21+
digitalWrite(LED_BUILTIN, HIGH);
2122
PrintHandler::create(m_ctx, std::move(message));
2223
return PICO_OK; // Return success code
2324
}

0 commit comments

Comments
 (0)