Browse Source

build: Add Configuration_var.h as a configuration wrapper

Instead of including Configuration_prusa.h directly, include
Configuration_var which then includes the proper variant file though a
preprocessor macro.

This allows to keep the existing build system intact, but also redefine
at compile time the final header without having to make copies on the
file system.
Yuri D'Elia 1 year ago
parent
commit
1d3ee1caba

+ 1 - 1
Firmware/Configuration.cpp

@@ -1,5 +1,5 @@
 #include "Configuration.h"
 #include "Configuration.h"
-#include "Configuration_prusa.h"
+#include "Configuration_var.h"
 
 
 const uint16_t _nPrinterType PROGMEM=PRINTER_TYPE;
 const uint16_t _nPrinterType PROGMEM=PRINTER_TYPE;
 const char _sPrinterName[] PROGMEM=PRINTER_NAME;
 const char _sPrinterName[] PROGMEM=PRINTER_NAME;

+ 1 - 1
Firmware/Configuration.h

@@ -70,7 +70,7 @@ extern PGM_P sPrinterName;
 #define SOURCE_TIME_EPOCH __TIME__
 #define SOURCE_TIME_EPOCH __TIME__
 #endif
 #endif
 
 
-#include "Configuration_prusa.h"
+#include "Configuration_var.h"
 
 
 #define FW_PRUSA3D_MAGIC "PRUSA3DFW"
 #define FW_PRUSA3D_MAGIC "PRUSA3DFW"
 #define FW_PRUSA3D_MAGIC_LEN 10
 #define FW_PRUSA3D_MAGIC_LEN 10

+ 1 - 1
Firmware/ConfigurationStore.cpp

@@ -5,7 +5,7 @@
 #include "temperature.h"
 #include "temperature.h"
 #include "ultralcd.h"
 #include "ultralcd.h"
 #include "ConfigurationStore.h"
 #include "ConfigurationStore.h"
-#include "Configuration_prusa.h"
+#include "Configuration_var.h"
 
 
 #ifdef MESH_BED_LEVELING
 #ifdef MESH_BED_LEVELING
 #include "mesh_bed_leveling.h"
 #include "mesh_bed_leveling.h"

+ 10 - 0
Firmware/Configuration_var.h

@@ -0,0 +1,10 @@
+// Include the printer's variant configuration header
+#pragma once
+
+// This is set by the cmake build to be able to take control of
+// the variant header without breaking existing build mechanisms.
+#ifndef CMAKE_CONTROL
+#include "Configuration_prusa.h"
+#else
+#include FW_VARIANT
+#endif

+ 1 - 1
Firmware/config.h

@@ -2,7 +2,7 @@
 #define _CONFIG_H
 #define _CONFIG_H
 
 
 
 
-#include "Configuration_prusa.h"
+#include "Configuration_var.h"
 #include "pins.h"
 #include "pins.h"
 
 
 #if (defined(VOLT_IR_PIN) && defined(IR_SENSOR))
 #if (defined(VOLT_IR_PIN) && defined(IR_SENSOR))

+ 1 - 1
Firmware/first_lay_cal.cpp

@@ -4,7 +4,7 @@
 //! @brief First layer (Z offset) calibration
 //! @brief First layer (Z offset) calibration
 
 
 #include "first_lay_cal.h"
 #include "first_lay_cal.h"
-#include "Configuration_prusa.h"
+#include "Configuration_var.h"
 #include "language.h"
 #include "language.h"
 #include "Marlin.h"
 #include "Marlin.h"
 #include "cmdqueue.h"
 #include "cmdqueue.h"

+ 2 - 2
Firmware/messages.cpp

@@ -1,8 +1,8 @@
 //messages.c
 //messages.c
 #include "language.h"
 #include "language.h"
 
 
-//this is because we need include Configuration_prusa.h (CUSTOM_MENDEL_NAME)
-#include "Configuration_prusa.h"
+//this is because we need CUSTOM_MENDEL_NAME
+#include "Configuration_var.h"
 
 
 //internationalized messages
 //internationalized messages
 const char MSG_ALWAYS[] PROGMEM_I1 = ISTR("Always"); ////MSG_ALWAYS c=6
 const char MSG_ALWAYS[] PROGMEM_I1 = ISTR("Always"); ////MSG_ALWAYS c=6

+ 1 - 1
Firmware/mmu2_power.cpp

@@ -1,5 +1,5 @@
 #include "mmu2_power.h"
 #include "mmu2_power.h"
-#include "Configuration_prusa.h"
+#include "Configuration_var.h"
 #include "pins.h"
 #include "pins.h"
 #include "fastio.h"
 #include "fastio.h"
 #include <util/delay.h>
 #include <util/delay.h>

+ 1 - 1
Firmware/pat9125.cpp

@@ -4,7 +4,7 @@
 #include <avr/pgmspace.h>
 #include <avr/pgmspace.h>
 #include "config.h"
 #include "config.h"
 #include <stdio.h>
 #include <stdio.h>
-#include "Configuration_prusa.h"
+#include "Configuration_var.h"
 
 
 #if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
 #if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
 
 

+ 1 - 1
Firmware/sm4.c

@@ -9,7 +9,7 @@
 #include "boards.h"
 #include "boards.h"
 #define false 0
 #define false 0
 #define true 1
 #define true 1
-#include "Configuration_prusa.h"
+#include "Configuration_var.h"
 
 
 
 
 #ifdef NEW_XYZCAL
 #ifdef NEW_XYZCAL

+ 1 - 1
Firmware/swi2c.c

@@ -4,7 +4,7 @@
 #include <util/delay.h>
 #include <util/delay.h>
 #include <avr/pgmspace.h>
 #include <avr/pgmspace.h>
 #include "stdbool.h"
 #include "stdbool.h"
-#include "Configuration_prusa.h"
+#include "Configuration_var.h"
 #include "pins.h"
 #include "pins.h"
 #include "fastio.h"
 #include "fastio.h"
 
 

+ 1 - 1
Firmware/temperature.cpp

@@ -44,7 +44,7 @@
 #include "adc.h"
 #include "adc.h"
 #include "ConfigurationStore.h"
 #include "ConfigurationStore.h"
 #include "Timer.h"
 #include "Timer.h"
-#include "Configuration_prusa.h"
+#include "Configuration_var.h"
 #include "Prusa_farm.h"
 #include "Prusa_farm.h"
 
 
 #if (ADC_OVRSAMPL != OVERSAMPLENR)
 #if (ADC_OVRSAMPL != OVERSAMPLENR)

+ 1 - 1
Firmware/tone04.c

@@ -3,7 +3,7 @@
 // timer2 is used for System timer.
 // timer2 is used for System timer.
 
 
 #include "system_timer.h"
 #include "system_timer.h"
-#include "Configuration_prusa.h"
+#include "Configuration_var.h"
 
 
 #ifdef SYSTEM_TIMER_2
 #ifdef SYSTEM_TIMER_2
 
 

+ 1 - 1
Firmware/xyzcal.cpp

@@ -1,6 +1,6 @@
 //xyzcal.cpp - xyz calibration with image processing
 //xyzcal.cpp - xyz calibration with image processing
 
 
-#include "Configuration_prusa.h"
+#include "Configuration_var.h"
 #ifdef NEW_XYZCAL
 #ifdef NEW_XYZCAL
 
 
 #include "xyzcal.h"
 #include "xyzcal.h"