Welcome! Log In Create A New Profile

Advanced

Marlin custom gcode - Serial.print gives error during compile

Posted by Cman 
Marlin custom gcode - Serial.print gives error during compile
February 10, 2025 09:58AM
Good day
I am trying to add custom Gcode to Marlin.
If I remove the Serial.Print the file compile and give the required result however if I include a Serial.print instruction the compiler fail, please help with direction as to what I need?

#include "../gcode.h"
#include "../../module/planner.h"
#include 

void GcodeSuite::G140() {  // G140
    if (!parser.seenval('R')) {
        Serial.println("Error: 'R' value not provided.");
        return;
    }

    queue.enqueue_now_P(PSTR("G28 Y"));
    Serial.println("Command received: G28 Y");
}

Marlin error message:

Linking .pio\build\mega2560\firmware.elf
HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':
(.text+0x0): multiple definition of `__vector_25'
.pio\build\mega2560\src\src\HAL\AVR\MarlinSerial.cpp.o (symbol from plugin)sad smiley.text+0x0): first defined here
Re: Marlin custom gcode - Serial.print gives error during compile
February 10, 2025 07:59PM
Don't use Serial directly.


Use the serial macros [marlinfw.org]
Re: Marlin custom gcode - Serial.print gives error during compile
February 11, 2025 12:58AM
Much appreciated, works and required output obtained.
Sorry, only registered users may post in this forum.

Click here to login