PlatformIO compilation errors

Hi!

I have switched to having each stepper wired individually to be able to have dual endstops in the future.

It seems like my Z probe is not working (M119 says it is OPEN and TRIGGERED when actually triggering) but the steppers does not respond accordingly (they just keep going when it triggers).

So I found this row:
//#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN

…which I am trying to enable (removing the comment) but if I do that, I can not build it anymore. The firmware compiles fine without the change. I am using V1CNC_Ramps_DualLR-2.0.9.2 and have a LowRider 2 with Ramps 1.4. PlatformIO 6.1.4.

 *  Executing task in folder Marlin: platformio run 

Warning! Ignore unknown configuration option `monitor_flags` in section [env]
Warning! `src_filter` configuration option in section [env:include_tree] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:DUE] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:esp32] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_build_flags` configuration option in section [env:linux_native] is deprecated and will be removed in the next release! Please use `build_src_flags` instead
Warning! `src_filter` configuration option in section [env:linux_native] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_build_flags` configuration option in section [env:simulator_windows] is deprecated and will be removed in the next release! Please use `build_src_flags` instead
Warning! `src_filter` configuration option in section [env:SAMD51_grandcentral_m4] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:malyan_M300] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:STM32F103CB_malyan] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy31] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy35] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy36] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Warning! `src_filter` configuration option in section [env:teensy41] is deprecated and will be removed in the next release! Please use `build_src_filter` instead
Processing mega2560 (platform: atmelavr; board: megaatmega2560; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/megaatmega2560.html
PLATFORM: Atmel AVR (3.0.0) > Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)
HARDWARE: ATMEGA2560 16MHz, 8KB RAM, 248KB Flash
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.1.0 
 - toolchain-atmelavr @ 1.50400.190710 (5.4.0)
Converting Marlin.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
Dependency Graph
|-- U8glib-HAL @ 0.5.2
|   |-- Wire @ 1.0
|   |-- SPI @ 1.0
|-- SPI @ 1.0
|-- Wire @ 1.0
Building in release mode
Compiling .pio/build/mega2560/src/src/inc/Warnings.cpp.o
Compiling .pio/build/mega2560/src/src/module/endstops.cpp.o
Compiling .pio/build/mega2560/src/src/module/tool_change.cpp.o
Compiling .pio/build/mega2560/src/src/sd/Sd2Card.cpp.o
Compiling .pio/build/mega2560/src/src/sd/SdBaseFile.cpp.o
Compiling .pio/build/mega2560/src/src/sd/SdFatUtil.cpp.o
Compiling .pio/build/mega2560/src/src/sd/SdFile.cpp.o
Marlin/src/inc/Warnings.cpp:43:4: warning: #warning "Auto-assigned X2 STEP/DIR/ENABLE_PINs to unused En_STEP/DIR/ENABLE_PINs." [-Wcpp]
   #warning "Auto-assigned X2 STEP/DIR/ENABLE_PINs to unused En_STEP/DIR/ENABLE_PINs."
    ^
Marlin/src/inc/Warnings.cpp:147:4: warning: #warning "Auto-assigned Z2 STEP/DIR/ENABLE_PINs to unused En_STEP/DIR/ENABLE_PINs." [-Wcpp]
   #warning "Auto-assigned Z2 STEP/DIR/ENABLE_PINs to unused En_STEP/DIR/ENABLE_PINs."
    ^
Compiling .pio/build/mega2560/src/src/sd/SdVolume.cpp.o
cc1plus: warning: unrecognized command line option '-Wno-register'
Compiling .pio/build/mega2560/src/src/sd/cardreader.cpp.o
In file included from Marlin/src/module/endstops.cpp:28:0:
Marlin/src/module/stepper.h: In static member function 'static bool Stepper::disable_extruder()':
Marlin/src/module/stepper.h:612:46: warning: no return statement in function returning non-void [-Wreturn-type]
       static inline bool disable_extruder() {}
                                              ^
In file included from Marlin/src/module/../inc/../HAL/./AVR/HAL.h:22:0,
                 from Marlin/src/module/../inc/../HAL/HAL.h:30,
                 from Marlin/src/module/../inc/MarlinConfig.h:31,
                 from Marlin/src/module/endstops.h:28,
                 from Marlin/src/module/endstops.cpp:27:
Marlin/src/module/endstops.cpp: In static member function 'static void Endstops::update()':
Marlin/src/module/endstops.cpp:932:60: error: 'Z2_MIN' was not declared in this scope
     #define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_DUAL_ENDSTOP(Z, MINMAX)
                                                            ^
Marlin/src/module/../inc/../HAL/./AVR/../shared/Marduino.h:42:25: note: in definition of macro '_BV'
 #define _BV(b) (1UL << (b))
                         ^
Marlin/src/module/endstops.cpp:860:34: note: in expansion of macro 'TEST'
   #define TEST_ENDSTOP(ENDSTOP) (TEST(state(), ENDSTOP))
                                  ^
Marlin/src/module/endstops.cpp:884:64: note: in expansion of macro 'TEST_ENDSTOP'
     const byte dual_hit = TEST_ENDSTOP(_ENDSTOP(A, MINMAX)) | (TEST_ENDSTOP(_ENDSTOP(A##2, MINMAX)) << 1); \
                                                                ^
Marlin/src/module/endstops.cpp:607:32: note: in expansion of macro '__ENDSTOP'
 #define _ENDSTOP(AXIS, MINMAX) __ENDSTOP(AXIS, MINMAX)
                                ^
Marlin/src/module/endstops.cpp:884:77: note: in expansion of macro '_ENDSTOP'
     const byte dual_hit = TEST_ENDSTOP(_ENDSTOP(A, MINMAX)) | (TEST_ENDSTOP(_ENDSTOP(A##2, MINMAX)) << 1); \
                                                                             ^
Marlin/src/module/endstops.cpp:932:39: note: in expansion of macro 'PROCESS_DUAL_ENDSTOP'
     #define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_DUAL_ENDSTOP(Z, MINMAX)
                                       ^
Marlin/src/module/endstops.cpp:1023:13: note: in expansion of macro 'PROCESS_ENDSTOP_Z'
           ) PROCESS_ENDSTOP_Z(MIN);
             ^
At global scope:
cc1plus: warning: unrecognized command line option '-Wno-register'
*** [.pio/build/mega2560/src/src/module/endstops.cpp.o] Error 1
================================================================= [FAILED] Took 4.54 seconds =================================================================

Environment    Status    Duration
-------------  --------  ------------
mega2560       FAILED    00:00:04.541
============================================================ 1 failed, 0 succeeded in 00:00:04.541 ============================================================

 *  The terminal process "platformio 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

These are my settings in the PP in Fusion 360:

This procedure runs, but the touch plate doesn’t stop the steppers.

The dual LR firmware doesn’t use G28 for the probe. I don’t use fusion, so I don’t know if you can convince it to use G38.2 or not.

IIRC, the command is G38.2 Z0 to make it probe with the Z probe. Otherwise G28 Z goes up and uses the Z endstops, not the probe plugged into zmin

1 Like

Aha, okey. And this is something that is different from the regular firmware? Because this worked well before I switched to the dual endstop firmware.

Is this how the procedure should look like for dual endstops firmware?

M0 Attach ZProbe
G38.2 Z0 (was G28 Z)
G92 Z1.31
G0 Z40 F300
M400
M0 Detach ZProbe

EDIT: If I run G38.2 Z0 the Z axis goes upwards. Is that correct?

Yes. Because the LR has dual Z and homes up.

It looks about right to me. I haven’t actually done it myself. If you search for G38.2, you will see a bunch of topics on it.

Nope. Does a positive Z move raise the bit? Are you using firmware without editing it? It sounds like you just have the Z motors on backwards.

Does a positive Z move raise the bit? Are you using firmware without editing it? It sounds like you just have the Z motors on backwards.

Yes. If I move the Z axis positive it moves up.

EDIT: Aaah, but sir, maybe I need to seek like this:

G38.2 Z-50 F100

And that way I get the bit to move downward instead. Maybe I had my Z0 above when running it pure like G38.2 Z0. That must be it.

1 Like

Ok. I think it is common to do a G28 first, which sets the Z to +200mm (the hard coded bed size). So a Z0 should try to point it down. If changing that to Z-50 makes more sense, I will start using that.