MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.28k stars 19.24k forks source link

[bugfix-1.1.x] 'TMC2208Stepper' does not name a type #11411

Closed yagona closed 6 years ago

yagona commented 6 years ago

Description

Setup:

Since the simplified stepper driver configuration was introduced, my configuration fails to compile successfully.

Steps to Reproduce

I could identify three representative tests to indicate the issue:

[Test 1] wanted configuration

Configuration.h:

define X_DRIVER_TYPE TMC2208_STANDALONE

define Y_DRIVER_TYPE TMC2208_STANDALONE

define Z_DRIVER_TYPE TMC2208_STANDALONE

define Z2_DRIVER_TYPE TMC2208_STANDALONE

define E0_DRIVER_TYPE TMC2208

=> compilation error:

stepper_indirection.h:300: error: 'TMC2208Stepper' does not name a type extern TMC2208Stepper stepperE0;

[Test 2] add another TMC2208 though not connected

Configuration.h:

define X_DRIVER_TYPE TMC2208

define Y_DRIVER_TYPE TMC2208_STANDALONE

define Z_DRIVER_TYPE TMC2208_STANDALONE

define Z2_DRIVER_TYPE TMC2208_STANDALONE

define E0_DRIVER_TYPE TMC2208

=> compilation successful

[Test 3] force library to be included

Configuration.h:

define X_DRIVER_TYPE TMC2208_STANDALONE

define Y_DRIVER_TYPE TMC2208_STANDALONE

define Z_DRIVER_TYPE TMC2208_STANDALONE

define Z2_DRIVER_TYPE TMC2208_STANDALONE

define E0_DRIVER_TYPE TMC2208

stepper_indirection.h: //#if HAS_DRIVER(TMC2208)

include

void tmc2208_serial_begin(); void tmc2208_init_to_defaults(); //#endif

=> compilation successful

Expected behavior: [compilation successful for Test 1]

Actual behavior: [compilation fails when E0 is the only TMC2208 and others are in STANDALONE mode]

Additional Information

Configuration.zip

teemuatlut commented 6 years ago

This is another case of drivers.h included before Configuration_adv.h, as it should be. But it also means they can't both depend on the other. driver.h should not depend on any settings from Configuration_adv.h.

teemuatlut commented 6 years ago

https://github.com/teemuatlut/Marlin/tree/bf1_fix_smart_drivers

yagona commented 6 years ago

The issue is fixed in the latest bugfix-1.1.x branch. Thank you very much!

github-actions[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.