Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» Includes in Conditionals (for code dimming) (MarlinFirmware#27387)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored Sep 2, 2024
1 parent 97b9fe8 commit 162ea81
Show file tree
Hide file tree
Showing 20 changed files with 221 additions and 86 deletions.
4 changes: 2 additions & 2 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2560,7 +2560,7 @@

/**
* Minimum stepper driver pulse width (in ns)
* If undefined, these defaults (from Conditionals_adv.h) apply:
* If undefined, these defaults (from Conditionals-4-adv.h) apply:
* 100 : Minimum for TMC2xxx stepper drivers
* 500 : Minimum for LV8729
* 1000 : Minimum for A4988 and A5984 stepper drivers
Expand All @@ -2574,7 +2574,7 @@

/**
* Maximum stepping rate (in Hz) the stepper driver allows
* If undefined, these defaults (from Conditionals_adv.h) apply:
* If undefined, these defaults (from Conditionals-4-adv.h) apply:
* 5000000 : Maximum for TMC2xxx stepper drivers
* 1000000 : Maximum for LV8729 stepper driver
* 500000 : Maximum for A4988 stepper driver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@
#pragma once

/**
* Conditionals_axes.h
* Conditionals-1-axes.h
* Conditionals that need to be set before Configuration_adv.h or pins.h
*/

//========================================================
// Get requirements for the benefit of IntelliSense, etc.
//
#include "MarlinConfigPre-1-axes.h"
//========================================================

/**
* Extruders have some combination of stepper motors and hotends
* so we separate these concepts into the defines:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@
#pragma once

/**
* Conditionals_LCD.h
* Conditionals-2-LCD.h
* Conditionals that need to be set before Configuration_adv.h or pins.h
*/

//========================================================
// Get requirements for the benefit of IntelliSense, etc.
//
#include "Conditionals-1-axes.h"
//========================================================

// Support for SD Card and other file storage
#if ENABLED(SDSUPPORT)
#define HAS_MEDIA 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@
#pragma once

/**
* Conditionals_etc.h
* Conditionals-3-etc.h
* Conditionals that need to be set before Configuration_adv.h or pins.h
*/

//========================================================
// Get requirements for the benefit of IntelliSense, etc.
//
#include "Conditionals-2-LCD.h"
//========================================================

#ifndef STRING_CONFIG_H_AUTHOR
#define STRING_CONFIG_H_AUTHOR "(anonymous)"
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@
#pragma once

/**
* Conditionals_adv.h
* Conditionals-4-adv.h
* Conditionals set before pins.h and which depend on Configuration_adv.h.
*/

//========================================================
// Get requirements for the benefit of IntelliSense, etc.
//
#include "MarlinConfigPre-4-adv.h"
//========================================================

#if ENABLED(MARLIN_SMALL_BUILD)
#undef EEPROM_CHITCHAT
#undef CAPABILITIES_REPORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@
#pragma once

/**
* Conditionals_post.h
* Conditionals-5-post.h
* Internal defines that depend on Configurations and Pins but are not user-editable.
*/

//========================================================
// Get requirements for the benefit of IntelliSense, etc.
//
#include "MarlinConfigPre-5-post.h"
//========================================================

#ifdef GITHUB_ACTIONS
// Extras for CI testing
#endif
Expand All @@ -50,7 +56,7 @@
// Determine which type of 'EEPROM' is in use
#if ENABLED(EEPROM_SETTINGS)
// EEPROM type may be defined by compile flags, configs, HALs, or pins
// Set additional flags to let HALs choose in their Conditionals_post.h
// Set additional flags to let HALs choose in their Conditionals-5-post.h
#if ANY(FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION, SDCARD_EEPROM_EMULATION, QSPI_EEPROM)
#define USE_EMULATED_EEPROM 1
#elif ANY(I2C_EEPROM, SPI_EEPROM)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@
#pragma once

/**
* Conditionals_type.h
* Conditionals-6-type.h
* Internal defines that depend on Configurations and Pins but are not user-editable.
* Define conditionals in this file if they depend on core/types.h.
*/

//========================================================
// Get requirements for the benefit of IntelliSense, etc.
//
#include "MarlinConfigPre-6-type.h"
//========================================================

#ifdef GITHUB_ACTIONS
// Extras for CI testing
#endif
Expand Down
23 changes: 2 additions & 21 deletions Marlin/src/inc/MarlinConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,11 @@
// Prefix header for all Marlin sources
//

#include "MarlinConfigPre.h"

#ifdef __MARLIN_DEPS__
#include "../HAL/shared/fauxpins.h"
#else
#include "../HAL/HAL.h"
#endif

#include "../pins/pins.h"
#include "MarlinConfigPre-6-type.h" // Include even with __MARLIN_DEPS__

#ifndef __MARLIN_DEPS__
#include HAL_PATH(.., timers.h)
#include HAL_PATH(.., spi_pins.h)
#endif

#include "Conditionals_post.h"

#ifndef __MARLIN_DEPS__

#include HAL_PATH(.., inc/Conditionals_post.h)

#include "../core/types.h" // Ahead of sanity-checks

#include "Conditionals_type.h"
#include "Conditionals-6-type.h"
#include HAL_PATH(.., inc/Conditionals_type.h)

#include "Changes.h"
Expand Down
53 changes: 53 additions & 0 deletions Marlin/src/inc/MarlinConfigPre-1-axes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once

#ifndef __MARLIN_FIRMWARE__
#define __MARLIN_FIRMWARE__
#endif

#if __has_include("../../Config.h")
#include "../../Config.h"
#else
#define USE_STD_CONFIGS 1
#endif

#include <stdint.h>

#ifndef __MARLIN_DEPS__
#include "../HAL/platforms.h"
#endif

#include "../core/macros.h"
#include "../core/boards.h"

#if USE_STD_CONFIGS
#include "../../Configuration.h"
#endif

#ifdef CUSTOM_VERSION_FILE
#if __has_include(STRINGIFY(../../CUSTOM_VERSION_FILE))
#include STRINGIFY(../../CUSTOM_VERSION_FILE)
#endif
#endif

#include "Version.h"
34 changes: 34 additions & 0 deletions Marlin/src/inc/MarlinConfigPre-4-adv.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once

#include "Conditionals-3-etc.h"

#ifndef __MARLIN_DEPS__
#include HAL_PATH(.., inc/Conditionals_LCD.h)
#endif

#include "../core/drivers.h"

#if USE_STD_CONFIGS
#include "../../Configuration_adv.h"
#endif
37 changes: 37 additions & 0 deletions Marlin/src/inc/MarlinConfigPre-5-post.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once

#include "MarlinConfigPre.h"

#ifdef __MARLIN_DEPS__
#include "../HAL/shared/fauxpins.h"
#else
#include "../HAL/HAL.h"
#endif

#include "../pins/pins.h"

#ifndef __MARLIN_DEPS__
#include HAL_PATH(.., timers.h)
#include HAL_PATH(.., spi_pins.h)
#endif
30 changes: 30 additions & 0 deletions Marlin/src/inc/MarlinConfigPre-6-type.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once

#include "MarlinConfigPre-5-post.h"
#include "Conditionals-5-post.h"

#ifndef __MARLIN_DEPS__
#include HAL_PATH(.., inc/Conditionals_post.h)
#include "../core/types.h" // Ahead of sanity-checks
#endif
50 changes: 4 additions & 46 deletions Marlin/src/inc/MarlinConfigPre.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,55 +21,13 @@
*/
#pragma once

#ifndef __MARLIN_FIRMWARE__
#define __MARLIN_FIRMWARE__
#endif

#if __has_include("../../Config.h")
#include "../../Config.h"
#else
#define USE_STD_CONFIGS 1
#endif

//
// Prefix header to acquire configurations
//
#include <stdint.h>

#ifndef __MARLIN_DEPS__
#include "../HAL/platforms.h"
#endif

#include "../core/macros.h"
#include "../core/boards.h"

#if USE_STD_CONFIGS
#include "../../Configuration.h"
#endif

#ifdef CUSTOM_VERSION_FILE
#if __has_include(STRINGIFY(../../CUSTOM_VERSION_FILE))
#include STRINGIFY(../../CUSTOM_VERSION_FILE)
#endif
#endif

#include "Version.h"

#include "Conditionals_axes.h"
#include "Conditionals_LCD.h"
#include "Conditionals_etc.h"

#ifndef __MARLIN_DEPS__
#include HAL_PATH(.., inc/Conditionals_LCD.h)
#endif

#include "../core/drivers.h"

#if USE_STD_CONFIGS
#include "../../Configuration_adv.h"
#endif

#include "Conditionals_adv.h"
#include "Conditionals-1-axes.h"
#include "Conditionals-2-LCD.h"
#include "Conditionals-3-etc.h"
#include "Conditionals-4-adv.h"

#ifndef __MARLIN_DEPS__
#include HAL_PATH(.., inc/Conditionals_adv.h)
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
* Test configuration values for errors at compile-time.
*/

//========================================================
// Get requirements for the benefit of IntelliSense, etc.
//
#include "MarlinConfig.h"
//========================================================

/**
* Require gcc 4.7 or newer (first included with Arduino 1.6.8) for C++11 features.
*/
Expand Down
Loading

0 comments on commit 162ea81

Please sign in to comment.