Overridable Options - Part 10 (PR#2562)
Apply `ENABLED` / `DISABLED` macros to planner files.
This commit is contained in:
parent
51e89a269c
commit
bf6eb93c61
|
@ -55,7 +55,7 @@
|
|||
#include "ultralcd.h"
|
||||
#include "language.h"
|
||||
|
||||
#ifdef MESH_BED_LEVELING
|
||||
#if ENABLED(MESH_BED_LEVELING)
|
||||
#include "mesh_bed_leveling.h"
|
||||
#endif
|
||||
|
||||
|
@ -77,7 +77,7 @@ float max_e_jerk;
|
|||
float mintravelfeedrate;
|
||||
unsigned long axis_steps_per_sqr_second[NUM_AXIS];
|
||||
|
||||
#ifdef ENABLE_AUTO_BED_LEVELING
|
||||
#if ENABLED(ENABLE_AUTO_BED_LEVELING)
|
||||
// Transform required to compensate for bed level
|
||||
matrix_3x3 plan_bed_level_matrix = {
|
||||
1.0, 0.0, 0.0,
|
||||
|
@ -86,7 +86,7 @@ unsigned long axis_steps_per_sqr_second[NUM_AXIS];
|
|||
};
|
||||
#endif // ENABLE_AUTO_BED_LEVELING
|
||||
|
||||
#ifdef AUTOTEMP
|
||||
#if ENABLED(AUTOTEMP)
|
||||
float autotemp_max = 250;
|
||||
float autotemp_min = 210;
|
||||
float autotemp_factor = 0.1;
|
||||
|
@ -121,7 +121,7 @@ unsigned char g_uc_extruder_last_move[4] = {0,0,0,0};
|
|||
static long axis_segment_time[2][3] = { {MAX_FREQ_TIME+1,0,0}, {MAX_FREQ_TIME+1,0,0} };
|
||||
#endif
|
||||
|
||||
#ifdef FILAMENT_SENSOR
|
||||
#if ENABLED(FILAMENT_SENSOR)
|
||||
static char meas_sample; //temporary variable to hold filament measurement sample
|
||||
#endif
|
||||
|
||||
|
@ -178,7 +178,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi
|
|||
plateau_steps = 0;
|
||||
}
|
||||
|
||||
#ifdef ADVANCE
|
||||
#if ENABLED(ADVANCE)
|
||||
volatile long initial_advance = block->advance * entry_factor * entry_factor;
|
||||
volatile long final_advance = block->advance * exit_factor * exit_factor;
|
||||
#endif // ADVANCE
|
||||
|
@ -191,7 +191,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi
|
|||
block->decelerate_after = accelerate_steps+plateau_steps;
|
||||
block->initial_rate = initial_rate;
|
||||
block->final_rate = final_rate;
|
||||
#ifdef ADVANCE
|
||||
#if ENABLED(ADVANCE)
|
||||
block->initial_advance = initial_advance;
|
||||
block->final_advance = final_advance;
|
||||
#endif
|
||||
|
@ -361,7 +361,7 @@ void plan_init() {
|
|||
}
|
||||
|
||||
|
||||
#ifdef AUTOTEMP
|
||||
#if ENABLED(AUTOTEMP)
|
||||
void getHighESpeed() {
|
||||
static float oldt = 0;
|
||||
|
||||
|
@ -394,7 +394,7 @@ void plan_init() {
|
|||
void check_axes_activity() {
|
||||
unsigned char axis_active[NUM_AXIS] = { 0 },
|
||||
tail_fan_speed = fanSpeed;
|
||||
#ifdef BARICUDA
|
||||
#if ENABLED(BARICUDA)
|
||||
unsigned char tail_valve_pressure = ValvePressure,
|
||||
tail_e_to_p_pressure = EtoPPressure;
|
||||
#endif
|
||||
|
@ -404,7 +404,7 @@ void check_axes_activity() {
|
|||
if (blocks_queued()) {
|
||||
uint8_t block_index = block_buffer_tail;
|
||||
tail_fan_speed = block_buffer[block_index].fan_speed;
|
||||
#ifdef BARICUDA
|
||||
#if ENABLED(BARICUDA)
|
||||
block = &block_buffer[block_index];
|
||||
tail_valve_pressure = block->valve_pressure;
|
||||
tail_e_to_p_pressure = block->e_to_p_pressure;
|
||||
|
@ -441,23 +441,23 @@ void check_axes_activity() {
|
|||
fan_kick_end = 0;
|
||||
}
|
||||
#endif //FAN_KICKSTART_TIME
|
||||
#ifdef FAN_MIN_PWM
|
||||
#if ENABLED(FAN_MIN_PWM)
|
||||
#define CALC_FAN_SPEED (tail_fan_speed ? ( FAN_MIN_PWM + (tail_fan_speed * (255 - FAN_MIN_PWM)) / 255 ) : 0)
|
||||
#else
|
||||
#define CALC_FAN_SPEED tail_fan_speed
|
||||
#endif // FAN_MIN_PWM
|
||||
#ifdef FAN_SOFT_PWM
|
||||
#if ENABLED(FAN_SOFT_PWM)
|
||||
fanSpeedSoftPwm = CALC_FAN_SPEED;
|
||||
#else
|
||||
analogWrite(FAN_PIN, CALC_FAN_SPEED);
|
||||
#endif // FAN_SOFT_PWM
|
||||
#endif // HAS_FAN
|
||||
|
||||
#ifdef AUTOTEMP
|
||||
#if ENABLED(AUTOTEMP)
|
||||
getHighESpeed();
|
||||
#endif
|
||||
|
||||
#ifdef BARICUDA
|
||||
#if ENABLED(BARICUDA)
|
||||
#if HAS_HEATER_1
|
||||
analogWrite(HEATER_1_PIN,tail_valve_pressure);
|
||||
#endif
|
||||
|
@ -472,7 +472,7 @@ float junction_deviation = 0.1;
|
|||
// Add a new linear movement to the buffer. steps[X_AXIS], _y and _z is the absolute position in
|
||||
// mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration
|
||||
// calculation the caller must also provide the physical length of the line in millimeters.
|
||||
#if defined(ENABLE_AUTO_BED_LEVELING) || defined(MESH_BED_LEVELING)
|
||||
#if ENABLED(ENABLE_AUTO_BED_LEVELING) || ENABLED(MESH_BED_LEVELING)
|
||||
void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate, const uint8_t extruder)
|
||||
#else
|
||||
void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t extruder)
|
||||
|
@ -485,9 +485,9 @@ float junction_deviation = 0.1;
|
|||
// Rest here until there is room in the buffer.
|
||||
while (block_buffer_tail == next_buffer_head) idle();
|
||||
|
||||
#ifdef MESH_BED_LEVELING
|
||||
#if ENABLED(MESH_BED_LEVELING)
|
||||
if (mbl.active) z += mbl.get_z(x, y);
|
||||
#elif defined(ENABLE_AUTO_BED_LEVELING)
|
||||
#elif ENABLED(ENABLE_AUTO_BED_LEVELING)
|
||||
apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
|
||||
#endif
|
||||
|
||||
|
@ -510,7 +510,7 @@ float junction_deviation = 0.1;
|
|||
|
||||
float de = target[E_AXIS] - position[E_AXIS];
|
||||
|
||||
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
||||
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
|
||||
if (de) {
|
||||
if (degHotend(extruder) < extrude_min_temp) {
|
||||
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
||||
|
@ -518,7 +518,7 @@ float junction_deviation = 0.1;
|
|||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
|
||||
}
|
||||
#ifdef PREVENT_LENGTHY_EXTRUDE
|
||||
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
||||
if (labs(de) > axis_steps_per_unit[E_AXIS] * EXTRUDE_MAXLENGTH) {
|
||||
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
||||
de = 0; // no difference
|
||||
|
@ -536,7 +536,7 @@ float junction_deviation = 0.1;
|
|||
block->busy = false;
|
||||
|
||||
// Number of steps for each axis
|
||||
#ifdef COREXY
|
||||
#if ENABLED(COREXY)
|
||||
// corexy planning
|
||||
// these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
|
||||
block->steps[A_AXIS] = labs(dx + dy);
|
||||
|
@ -564,14 +564,14 @@ float junction_deviation = 0.1;
|
|||
if (block->step_event_count <= dropsegments) return;
|
||||
|
||||
block->fan_speed = fanSpeed;
|
||||
#ifdef BARICUDA
|
||||
#if ENABLED(BARICUDA)
|
||||
block->valve_pressure = ValvePressure;
|
||||
block->e_to_p_pressure = EtoPPressure;
|
||||
#endif
|
||||
|
||||
// Compute direction bits for this block
|
||||
uint8_t db = 0;
|
||||
#ifdef COREXY
|
||||
#if ENABLED(COREXY)
|
||||
if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
|
||||
if (dy < 0) db |= BIT(Y_HEAD); // ...and Y
|
||||
if (dz < 0) db |= BIT(Z_AXIS);
|
||||
|
@ -594,7 +594,7 @@ float junction_deviation = 0.1;
|
|||
block->active_extruder = extruder;
|
||||
|
||||
//enable active axes
|
||||
#ifdef COREXY
|
||||
#if ENABLED(COREXY)
|
||||
if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
|
||||
enable_x();
|
||||
enable_y();
|
||||
|
@ -693,7 +693,7 @@ float junction_deviation = 0.1;
|
|||
* So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
|
||||
* Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
|
||||
*/
|
||||
#ifdef COREXY
|
||||
#if ENABLED(COREXY)
|
||||
float delta_mm[6];
|
||||
delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
|
||||
delta_mm[Y_HEAD] = dy / axis_steps_per_unit[B_AXIS];
|
||||
|
@ -720,9 +720,9 @@ float junction_deviation = 0.1;
|
|||
}
|
||||
else {
|
||||
block->millimeters = sqrt(
|
||||
#ifdef COREXY
|
||||
#if ENABLED(COREXY)
|
||||
square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD]) + square(delta_mm[Z_AXIS])
|
||||
#elif defined(COREXZ)
|
||||
#elif ENABLED(COREXZ)
|
||||
square(delta_mm[X_HEAD]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_HEAD])
|
||||
#else
|
||||
square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS])
|
||||
|
@ -737,12 +737,12 @@ float junction_deviation = 0.1;
|
|||
int moves_queued = movesplanned();
|
||||
|
||||
// Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill
|
||||
#if defined(OLD_SLOWDOWN) || defined(SLOWDOWN)
|
||||
#if ENABLED(OLD_SLOWDOWN) || ENABLED(SLOWDOWN)
|
||||
bool mq = moves_queued > 1 && moves_queued < BLOCK_BUFFER_SIZE / 2;
|
||||
#ifdef OLD_SLOWDOWN
|
||||
#if ENABLED(OLD_SLOWDOWN)
|
||||
if (mq) feed_rate *= 2.0 * moves_queued / BLOCK_BUFFER_SIZE;
|
||||
#endif
|
||||
#ifdef SLOWDOWN
|
||||
#if ENABLED(SLOWDOWN)
|
||||
// segment time im micro seconds
|
||||
unsigned long segment_time = lround(1000000.0/inverse_second);
|
||||
if (mq) {
|
||||
|
@ -760,7 +760,7 @@ float junction_deviation = 0.1;
|
|||
block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0
|
||||
block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0
|
||||
|
||||
#ifdef FILAMENT_SENSOR
|
||||
#if ENABLED(FILAMENT_SENSOR)
|
||||
//FMM update ring buffer used for delay with filament measurements
|
||||
|
||||
if (extruder == FILAMENT_SENSOR_EXTRUDER_NUM && delay_index2 > -1) { //only for extruder with filament sensor and if ring buffer is initialized
|
||||
|
@ -956,7 +956,7 @@ float junction_deviation = 0.1;
|
|||
for (int i = 0; i < NUM_AXIS; i++) previous_speed[i] = current_speed[i];
|
||||
previous_nominal_speed = block->nominal_speed;
|
||||
|
||||
#ifdef ADVANCE
|
||||
#if ENABLED(ADVANCE)
|
||||
// Calculate advance rate
|
||||
if (!bse || (!bsx && !bsy && !bsz)) {
|
||||
block->advance_rate = 0;
|
||||
|
@ -991,7 +991,7 @@ float junction_deviation = 0.1;
|
|||
|
||||
} // plan_buffer_line()
|
||||
|
||||
#if defined(ENABLE_AUTO_BED_LEVELING) && !defined(DELTA)
|
||||
#if ENABLED(ENABLE_AUTO_BED_LEVELING) && DISABLED(DELTA)
|
||||
vector_3 plan_get_position() {
|
||||
vector_3 position = vector_3(st_get_position_mm(X_AXIS), st_get_position_mm(Y_AXIS), st_get_position_mm(Z_AXIS));
|
||||
|
||||
|
@ -1006,15 +1006,15 @@ float junction_deviation = 0.1;
|
|||
}
|
||||
#endif // ENABLE_AUTO_BED_LEVELING && !DELTA
|
||||
|
||||
#if defined(ENABLE_AUTO_BED_LEVELING) || defined(MESH_BED_LEVELING)
|
||||
#if ENABLED(ENABLE_AUTO_BED_LEVELING) || ENABLED(MESH_BED_LEVELING)
|
||||
void plan_set_position(float x, float y, float z, const float &e)
|
||||
#else
|
||||
void plan_set_position(const float &x, const float &y, const float &z, const float &e)
|
||||
#endif // ENABLE_AUTO_BED_LEVELING || MESH_BED_LEVELING
|
||||
{
|
||||
#ifdef MESH_BED_LEVELING
|
||||
#if ENABLED(MESH_BED_LEVELING)
|
||||
if (mbl.active) z += mbl.get_z(x, y);
|
||||
#elif defined(ENABLE_AUTO_BED_LEVELING)
|
||||
#elif ENABLED(ENABLE_AUTO_BED_LEVELING)
|
||||
apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef struct {
|
|||
long acceleration_rate; // The acceleration rate used for acceleration calculation
|
||||
unsigned char direction_bits; // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
|
||||
unsigned char active_extruder; // Selects the active extruder
|
||||
#ifdef ADVANCE
|
||||
#if ENABLED(ADVANCE)
|
||||
long advance_rate;
|
||||
volatile long initial_advance;
|
||||
volatile long final_advance;
|
||||
|
@ -60,7 +60,7 @@ typedef struct {
|
|||
unsigned long final_rate; // The minimal rate at exit
|
||||
unsigned long acceleration_st; // acceleration steps/sec^2
|
||||
unsigned long fan_speed;
|
||||
#ifdef BARICUDA
|
||||
#if ENABLED(BARICUDA)
|
||||
unsigned long valve_pressure;
|
||||
unsigned long e_to_p_pressure;
|
||||
#endif
|
||||
|
@ -79,9 +79,9 @@ extern volatile unsigned char block_buffer_head;
|
|||
extern volatile unsigned char block_buffer_tail;
|
||||
FORCE_INLINE uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); }
|
||||
|
||||
#if defined(ENABLE_AUTO_BED_LEVELING) || defined(MESH_BED_LEVELING)
|
||||
#if ENABLED(ENABLE_AUTO_BED_LEVELING) || ENABLED(MESH_BED_LEVELING)
|
||||
|
||||
#if defined(ENABLE_AUTO_BED_LEVELING)
|
||||
#if ENABLED(ENABLE_AUTO_BED_LEVELING)
|
||||
#include "vector_3.h"
|
||||
|
||||
// Transform required to compensate for bed level
|
||||
|
@ -133,7 +133,7 @@ extern float max_e_jerk;
|
|||
extern float mintravelfeedrate;
|
||||
extern unsigned long axis_steps_per_sqr_second[NUM_AXIS];
|
||||
|
||||
#ifdef AUTOTEMP
|
||||
#if ENABLED(AUTOTEMP)
|
||||
extern bool autotemp_enabled;
|
||||
extern float autotemp_max;
|
||||
extern float autotemp_min;
|
||||
|
|
Loading…
Reference in a new issue