Maslow startup error messages not being logged (e.g. Motor or Encoder disconnected)

(1.07 private build) Maslow begin() startup code checks whether encoders and motors are connected which is neat.

If one or more motors or encoders are disconnected then Maslow goes into an error state flashing the red led. If that happens, Users need to fix hardware/wiring issues then power cycle Maslow so that beginning startup checks are tried again. Fair enough.

Example of motor code and call graph (note how Maslow_::begin is called within loop() after setup() has been called already) :

Unexpected behavior… Am not seeing the begin detected motor and/or encoder errors being logged in the browser. It’s as though log messages called by Maslow.begin logic are not being written to the serial port/stream, even though setup() logic has executed already.

The Maslow_::update() main loop detects and logs last error, but, that seems to be cleared before the actual error is logged. Am working around to at least see the last message…

    if (error) {
        static unsigned long ledTimer = millis();
        static bool          st    = true; //This is used to blink the LED
        if (millis() - ledTimer > 300) {
            stopMotors();
            st = !st;
            digitalWrite(REDLED, st);
            ledTimer = millis();
        }

        static unsigned long errorMessageTimer = millis();
        if (millis() - errorMessageTimer > 5000) {
            if (errorMessage != "") {
                log_error("Error State: Latest Error: " << errorMessage.c_str());
            }
            //errorMessage = "";
            errorMessageTimer = millis();
        }

        return;
    }

But, I don’t know why the begin setup related info/warn/error traces are not being emitted and relayed back to the web browser. Am mentioning because seems like it’d be helpful for Users to see those MotorUnit related error messages so they can quickly self help to go fix a broken/disconnected wire or encoder.

Repro steps…

  • Power down Maslow
  • Disconnect one of the motor cables (to simulate wiring/motor issue)
  • Power on Maslow
  • Maslow starts flashing red LED every 300ms.

Expected behavior…

  • Related MSG:ERR entries visible in browser web UI.

Actual behavior…

  • Not seeing log content for Maslow_::Begin code. Can see other log content generated by /src/Main.cpp::setup() and Maslow_::Update()
Serial Messages
Index.html Version: 1.07
[MSG:INFO: Channel auto report interval set to 50 ms]
[MSG:INFO: FluidNC v3.0.x (Maslow-Main-28dd52e1-dirty)]
[MSG:INFO: Compiled with ESP32 SDK:v4.4.7-dirty]
[MSG:INFO: Local filesystem type is spiffs]
[MSG:INFO: Configuration file:maslow.yaml]
[MSG:WARN: Ignored key dc_servo]
[MSG:WARN: Ignored key cs_pin]
[MSG:WARN: microsteps value 0 constrained to range (1,256)]
[MSG:WARN: Ignored key cs_pin]
[MSG:WARN: microsteps value 0 constrained to range (1,256)]
[MSG:INFO: Machine Maslow S3 Board]
[MSG:INFO: Board Maslow]
[MSG:INFO: UART1 Tx:gpio.1 Rx:gpio.2 RTS:NO_PIN Baud:115200]
[MSG:INFO: SPI SCK:gpio.12 MOSI:gpio.11 MISO:gpio.13]
[MSG:INFO: SD Card cs_pin:gpio.10 detect:NO_PIN freq:8000000]
[MSG:INFO: Stepping:Timed Pulse:4us Dsbl Delay:0us Dir Delay:0us Idle Delay:240ms]
[MSG:INFO: Axis count 3]
[MSG:INFO: Axis X (-2438.400,0.000)]
[MSG:INFO:   Motor0]
[MSG:INFO: Axis Y (-1219.200,0.000)]
[MSG:INFO:   Motor0]
[MSG:INFO: Axis Z (-100.000,0.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     tmc_2209 UART1 Addr:0 Step:gpio.15 Dir:gpio.16 Disable:NO_PIN R:0.110]
[MSG:INFO:   Motor1]
[MSG:INFO:     tmc_2209 UART1 Addr:1 Step:gpio.46 Dir:gpio.38 Disable:NO_PIN R:0.110]
[MSG:INFO: Z Axis driver test passed]
[MSG:INFO: Z2 Axis driver test passed]
[MSG:INFO: Kinematic system: Cartesian]
[MSG:INFO: Using spindle NoSpindle]
[MSG:INFO: Connecting to STA SSID:...]
[MSG:INFO: Connecting.]
[MSG:INFO: Connecting..]
[MSG:INFO: Connected - IP is 192.168.0.46]
[MSG:INFO: WiFi on]
[MSG:INFO: Start mDNS with hostname:http://maslow.local/]
[MSG:INFO: SSDP Started]
[MSG:INFO: HTTP started on port 80]
[MSG:INFO: Telnet started on port 23]
[MSG:INFO: Channel auto report interval set to 50 ms]
1 Like

I have seen this too. I think that what is happening is that those error messages are being generated before the logging system has fully come online.

It was something that I wanted to look into but it hasn’t made it to the top of the list. The way FluidNC handles all of the communication is very murky and interconnected and it seems like it could be tricky to dig into.

That being said I have absolutely wasted HOURS debugging issues what would have been easy to understand if all of the boot log messages were available.

Also at least for me it seems to work sometimes but not always?

1 Like

Thanks for the context, I don’t have any good suggestions, I barely understand the code and only just starting compiling 1-2 days ago. Agree, that tight Dev inner loop is way more fun and productive to code/debug… So, I will try to contribute clear concrete edits if/when I think of something.

Am hoping others here more familiar with FluidNC, and the Maslow fork specifically will chime in too? Cheers!

1 Like