Simlified the extruder ticking code.

This commit is contained in:
bubnikv 2018-01-14 14:45:27 +01:00
parent e3dadfde71
commit a1fd50ea9a
2 changed files with 8 additions and 36 deletions

View file

@ -634,34 +634,20 @@ void isr() {
if ((out_bits & (1 << E_AXIS)) != 0)
{ // -direction
//AKU
WRITE(E0_DIR_PIN,
#ifdef SNMM
if (snmm_extruder == 0 || snmm_extruder == 2)
{
NORM_E_DIR();
}
else
{
REV_E_DIR();
}
#else
REV_E_DIR();
(snmm_extruder == 0 || snmm_extruder == 2) ? !INVERT_E0_DIR :
#endif // SNMM
INVERT_E0_DIR);
count_direction[E_AXIS] = -1;
}
else
{ // +direction
WRITE(E0_DIR_PIN,
#ifdef SNMM
if (snmm_extruder == 0 || snmm_extruder == 2)
{
REV_E_DIR();
}
else
{
NORM_E_DIR();
}
#else
NORM_E_DIR();
(snmm_extruder == 0 || snmm_extruder == 2) ? INVERT_E0_DIR :
#endif // SNMM
!INVERT_E0_DIR);
count_direction[E_AXIS] = 1;
}
@ -738,10 +724,10 @@ void isr() {
#ifndef LIN_ADVANCE
counter_e += current_block->steps_e;
if (counter_e > 0) {
WRITE_E_STEP(!INVERT_E_STEP_PIN);
WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN);
counter_e -= current_block->step_event_count;
count_position[E_AXIS]+=count_direction[E_AXIS];
WRITE_E_STEP(INVERT_E_STEP_PIN);
WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN);
#ifdef PAT9125
fsensor_counter++;
#endif //PAT9125

View file

@ -23,20 +23,6 @@
#include "planner.h"
#if EXTRUDERS > 2
#define WRITE_E_STEP(v) { if(current_block->active_extruder == 2) { WRITE(E2_STEP_PIN, v); } else { if(current_block->active_extruder == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}}
#define NORM_E_DIR() { if(current_block->active_extruder == 2) { WRITE(E2_DIR_PIN, !INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, !INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); }}}
#define REV_E_DIR() { if(current_block->active_extruder == 2) { WRITE(E2_DIR_PIN, INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, INVERT_E0_DIR); }}}
#elif EXTRUDERS > 1
#define WRITE_E_STEP(v) { if(current_block->active_extruder == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}
#define NORM_E_DIR() { if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, !INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); }}
#define REV_E_DIR() { if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, INVERT_E0_DIR); }}
#else
#define WRITE_E_STEP(v) WRITE(E0_STEP_PIN, v)
#define NORM_E_DIR() WRITE(E0_DIR_PIN, !INVERT_E0_DIR)
#define REV_E_DIR() WRITE(E0_DIR_PIN, INVERT_E0_DIR)
#endif
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
extern bool abort_on_endstop_hit;
#endif