Skip to content

A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol

moded poor man's drawLogicTrace in UtilityController::handleLogicAnalyzer

fdufnews6a94216072c2
diff --git a/platformio.ini b/platformio.ini
index 8424e08d..0296c5b9 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -391,7 +391,7 @@ build_flags =
-DDEVICE_S3DEVKIT
- -D ENABLE_FASTLED_PROTOCOL_SWITCHES ; Only possible if you build it on linux
+; -D ENABLE_FASTLED_PROTOCOL_SWITCHES ; Only possible if you build it on linux
-Wl,-zmuldefs ; ieee80211_raw_frame_sanity_check override - needed for WiFi deauth
diff --git a/src/Controllers/UtilityController.cpp b/src/Controllers/UtilityController.cpp
index ce67c77a..48dcd7bd 100644
--- a/src/Controllers/UtilityController.cpp
+++ b/src/Controllers/UtilityController.cpp
@@ -238,7 +238,7 @@ void UtilityController::handleLogicAnalyzer(const TerminalCommand& cmd) {
lastCheck = millis();
char c = terminalInput.readChar();
if (c == '\r' || c == '\n') {
- // fdufnews 2025/10/22 added to manage drawLogicTrace() for NoScreenDevice
+ // fdufnews 2025/10/24 added to restore cursor position when leaving
if (state.getTerminalMode() == TerminalTypeEnum::Serial)
terminalView.print("\n\n\n\n\r"); // 4 lines down to place cursor just under the logic trace
terminalView.println("Logic Analyzer: Stopped by user.");
@@ -250,6 +250,21 @@ void UtilityController::handleLogicAnalyzer(const TerminalCommand& cmd) {
if (buffer.size() >= 240) {
buffer.resize(240);
deviceView.drawLogicTrace(pin, buffer);
+
+ // fdufnews 2025/10/24 added a poor man's drawLogicTrace() on terminal
+ // draw logic trace on 3 consecutive lines in order to be compatible with small 80x25 terminal window
+ if (state.getTerminalMode() == TerminalTypeEnum::Serial){
+ terminalView.println("Logic trace");
+ uint8_t pos = 0;
+ for(size_t i = 0; i < buffer.size(); i++, pos++){
+ if(pos > 79){
+ pos = 0;
+ terminalView.println("");
+ }
+ terminalView.print(buffer[i]?"-":"_");
+ }
+ terminalView.print("\r\x1b[3A"); // Up 3 lines to put cursor at the correct place for the next draw
+ }
buffer.clear();
}
diff --git a/src/Views/NoScreenDeviceView.cpp b/src/Views/NoScreenDeviceView.cpp
index 3887c0f7..33129766 100644
--- a/src/Views/NoScreenDeviceView.cpp
+++ b/src/Views/NoScreenDeviceView.cpp
@@ -16,21 +16,7 @@ void NoScreenDeviceView::loading() {}
void NoScreenDeviceView::clear() {}
-void NoScreenDeviceView::drawLogicTrace(uint8_t pin, const std::vector<uint8_t>& buffer) {
- // fdufnews 2025/10/22 added a poor man's drawLogicTrace() for Serial
- // draw logic trace on 3 consecutive lines in order to be compatible with small 80x25 terminal window
- Serial.println("Logic trace");
- uint8_t pos = 0;
- for(size_t i = 0; i < buffer.size(); i++, pos++){
- if(pos > 79){
- pos = 0;
- Serial.println();
- }
- Serial.write(buffer[i]?'-':'_');
- }
- uint8_t up3[] = {'\r', 0x1b, '[', '3', 'A'}; // move cursor 3 lines up
- Serial.write(up3, 5); // to put cursor at the correct place for the next draw
-}
+void NoScreenDeviceView::drawLogicTrace(uint8_t pin, const std::vector<uint8_t>& buffer) {}
void NoScreenDeviceView::setRotation(uint8_t rotation) {}
diff --git a/src/Views/NoScreenDeviceView.h b/src/Views/NoScreenDeviceView.h
index f4989880..61359f2d 100644
--- a/src/Views/NoScreenDeviceView.h
+++ b/src/Views/NoScreenDeviceView.h
@@ -1,6 +1,5 @@
#pragma once
-#include <Arduino.h>
#include "Interfaces/IDeviceView.h"
#include <iostream>
#include <SPI.h>