Skip to content

Add MESH_CONSOLE_SERIAL macro to redirect repeater console/debug to Serial1 (RAK3401) #2628

@disq

Description

@disq

On RAK19007 + RAK3401 the WisBlock base exposes TX1/RX1 on the header. With the RAK13302 1W add-on we’d like to power the node from an third-party 5V supply (not the Pi’s USB) and talk to a Raspberry Pi over GPIO UART. Today that isn’t possible without code edits, because all console/debug output in simple_repeater is hardcoded to Serial (USB CDC).

Proposal

Add a single macro that selects which serial the repeater console + debug logging uses, defaulting to Serial so behaviour is unchanged.

In src/MeshCore.h:

#ifndef MESH_CONSOLE_SERIAL
  #define MESH_CONSOLE_SERIAL Serial
#endif

Use MESH_CONSOLE_SERIAL for:
MESH_DEBUG_PRINT / MESH_DEBUG_PRINTLN
BRIDGE_DEBUG_PRINTLN
examples/simple_repeater/main.cpp console I/O (boot ID, command loop, power-off msg)
examples/simple_repeater/MyMesh.cpp (logRxRaw, dumpLogFile, get acl)

Do:

MESH_CONSOLE_SERIAL.begin(115200);

Enable per-variant with:

-D MESH_CONSOLE_SERIAL=Serial1

Why not just use the bridge / USB

USB CDC requires powering the node from the Pi, which fights the 1W add-on's preferred third-party 5V supply path.
WITH_RS232_BRIDGE is a binary bridge protocol, not a debug/console.
Compile-time -D Serial=Serial1 collides with libraries that reference Serial.

Scope

Default behavior unchanged (MESH_CONSOLE_SERIAL falls back to Serial).
Only simple_repeater example touched in the first pass; other examples could follow the same pattern.
Happy to open a PR with the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions