[SOLVED] Tracker Edge Firmware: log to serial monitor from outside of main.cpp

I am looking to use Serial log output to verify which part of the code are run by the tracker firmware.
I am able to see Log.info() calls that I make in main.cpp

However, it seems like my calls the Log.info() in the library files don’t get recognized when I am reading the Serial Monitor of the Tracker One.

Have other folks been able to trigger custom log messages from places other than main.cpp in the Tracker Edge firmware?

Here is an addition I made to the Tracker Edge firmware in tracker.cpp

int Tracker::initCan()
    // CAN related GPIO
    digitalWrite(MCP_CAN_STBY_PIN, LOW);
    // Do not power the CAN interface on yet
    digitalWrite(MCP_CAN_RESETN_PIN, HIGH);
    pinMode(MCP_CAN_CS_PIN, OUTPUT);
    digitalWrite(MCP_CAN_CS_PIN, HIGH);
    Log.info("  **CAN Chip Power Cycles**  "); // <- I want to see this, but it doesn't show up on the Serial Monitor

Log.info should work in any file included within the application. The tracker.cpp file in the src directory should definitely be compatible, and there are Log.error calls in that file already.

That happens very early in initialization, I’d put at the beginning of setup() in main.cpp:

// Wait for a USB serial connection for up to 30 seconds
waitFor(Serial.isConnected, 30000);

It could be that the serial logging message is going out before USB serial has reconnected, even if you use the --follow option (especially on Windows).

That was it!
I’m on Windows and adding that in main allowed me to see the log statements for debugging.

1 Like