From e4c01f1c7e7331406902500d2b0e03472ca9d56e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 23 Jul 2015 18:24:37 -0700 Subject: [PATCH] Simplify init with ARRAY_BY_EXTRUDERS1 macro (PR#2507) --- Marlin/Conditionals.h | 2 ++ Marlin/Marlin_main.cpp | 6 +++--- Marlin/temperature.cpp | 10 +++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index b14ea2ad6..bed26bffd 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -406,6 +406,8 @@ #define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1 } #endif + #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_BY_EXTRUDERS(v1, v1, v1, v1) + /** * Shorthand for pin tests, used wherever needed */ diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 975dfece0..3df9a4f41 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -250,10 +250,10 @@ const float homing_feedrate[] = HOMING_FEEDRATE; bool axis_relative_modes[] = AXIS_RELATIVE_MODES; int feedrate_multiplier = 100; //100->1 200->2 int saved_feedrate_multiplier; -int extruder_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS(100, 100, 100, 100); +int extruder_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); bool volumetric_enabled = false; -float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS(DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA); -float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS(1.0, 1.0, 1.0, 1.0); +float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA); +float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0); float home_offset[3] = { 0 }; float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS }; float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS }; diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 25d891d23..236ddfc8f 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -130,11 +130,11 @@ static volatile bool temp_meas_ready = false; #ifdef PIDTEMP #ifdef PID_PARAMS_PER_EXTRUDER - float Kp[EXTRUDERS] = ARRAY_BY_EXTRUDERS(DEFAULT_Kp, DEFAULT_Kp, DEFAULT_Kp, DEFAULT_Kp); - float Ki[EXTRUDERS] = ARRAY_BY_EXTRUDERS(DEFAULT_Ki*PID_dT, DEFAULT_Ki*PID_dT, DEFAULT_Ki*PID_dT, DEFAULT_Ki*PID_dT); - float Kd[EXTRUDERS] = ARRAY_BY_EXTRUDERS(DEFAULT_Kd / PID_dT, DEFAULT_Kd / PID_dT, DEFAULT_Kd / PID_dT, DEFAULT_Kd / PID_dT); + float Kp[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kp); + float Ki[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Ki*PID_dT); + float Kd[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kd / PID_dT); #ifdef PID_ADD_EXTRUSION_RATE - float Kc[EXTRUDERS] = ARRAY_BY_EXTRUDERS(DEFAULT_Kc, DEFAULT_Kc, DEFAULT_Kc, DEFAULT_Kc); + float Kc[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kc); #endif // PID_ADD_EXTRUSION_RATE #else //PID_PARAMS_PER_EXTRUDER float Kp = DEFAULT_Kp; @@ -150,7 +150,7 @@ static volatile bool temp_meas_ready = false; static int minttemp_raw[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP, HEATER_3_RAW_LO_TEMP); static int maxttemp_raw[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_RAW_HI_TEMP , HEATER_1_RAW_HI_TEMP , HEATER_2_RAW_HI_TEMP, HEATER_3_RAW_HI_TEMP); static int minttemp[EXTRUDERS] = { 0 }; -static int maxttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS( 16383, 16383, 16383, 16383 ); +static int maxttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(16383); #ifdef BED_MINTEMP static int bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP; #endif