Skip to content

Commit

Permalink
1.43.99
Browse files Browse the repository at this point in the history
  • Loading branch information
Nibbels committed May 26, 2019
1 parent bfb68e2 commit 8df838d
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 36 deletions.
Binary file modified .vs/Repetier/v14/.suo
Binary file not shown.
2 changes: 1 addition & 1 deletion Repetier/Constants.h
Expand Up @@ -20,7 +20,7 @@
#define CONSTANTS_H


#define REPETIER_VERSION "1.43.98"
#define REPETIER_VERSION "1.43.99"
#define UI_PRINTER_COMPANY "Conrad Community"
#define UI_VERSION_STRING "V " REPETIER_VERSION

Expand Down
2 changes: 1 addition & 1 deletion Repetier/HAL.cpp
Expand Up @@ -832,7 +832,7 @@ ISR(TIMER1_COMPA_vect)
#if FEATURE_HEAT_BED_Z_COMPENSATION || FEATURE_WORK_PART_Z_COMPENSATION
if (PrintLine::cur == NULL && PrintLine::direct.task == TASK_NO_TASK)
{
PrintLine::stepSlowedZCompensation();
PrintLine::stepSlowedZCompensation(); // Z is free here.
// Wait if the z-CMP is under heavy workload
if (PrintLine::needCmpWait())
{
Expand Down
15 changes: 14 additions & 1 deletion Repetier/Printer.cpp
Expand Up @@ -116,7 +116,6 @@ volatile long Printer::staticCompensationZ = 0;
#endif // FEATURE_WORK_PART_Z_COMPENSATION

volatile long Printer::currentSteps[3] = { 0, 0, 0 };
volatile char Printer::stepperDirection[3] = { 0, 0, 0 };
volatile char Printer::blockAll = 0;

volatile long Printer::currentXSteps = 0; //das ist der X-Zähler der GCodes zum Zählen des tiefsten Schalterdruckpunkts /Schaltercrash.
Expand Down Expand Up @@ -436,6 +435,20 @@ inline bool isExtrusionAllowed(float e) {
return true;
}

bool Printer::isZMoveActive() {
if (PrintLine::direct.stepsRemaining && PrintLine::direct.isZMove()) {
return true;
}
if (PrintLine::cur == NULL) {
return false;
}
if (PrintLine::cur->isZMove()) {
return true;
}

return false;
}

/**
* Set the printers feedrate according to active unit settings
*/
Expand Down
8 changes: 1 addition & 7 deletions Repetier/Printer.h
Expand Up @@ -140,7 +140,6 @@ class Printer
#endif // FEATURE_WORK_PART_Z_COMPENSATION

static volatile long currentSteps[3];
static volatile char stepperDirection[3]; // this is the current x/y/z-direction from the processing of G-Codes
static volatile char blockAll;

static volatile long currentXSteps;
Expand Down Expand Up @@ -466,7 +465,6 @@ class Printer
#if FEATURE_TWO_XSTEPPER
WRITE(X2_DIR_PIN, !INVERT_X_DIR);
#endif // FEATURE_TWO_XSTEPPER
stepperDirection[X_AXIS] = 1;
}
else
{
Expand All @@ -475,7 +473,6 @@ class Printer
#if FEATURE_TWO_XSTEPPER
WRITE(X2_DIR_PIN, INVERT_X_DIR);
#endif // FEATURE_TWO_XSTEPPER
stepperDirection[X_AXIS] = -1;
}
} // setXDirection

Expand All @@ -488,7 +485,6 @@ class Printer
#if FEATURE_TWO_YSTEPPER
WRITE(Y2_DIR_PIN, !INVERT_Y_DIR);
#endif // FEATURE_TWO_YSTEPPER
stepperDirection[Y_AXIS] = 1;
}
else
{
Expand All @@ -497,7 +493,6 @@ class Printer
#if FEATURE_TWO_YSTEPPER
WRITE(Y2_DIR_PIN, INVERT_Y_DIR);
#endif // FEATURE_TWO_YSTEPPER
stepperDirection[Y_AXIS] = -1;
}
} // setYDirection

Expand All @@ -513,7 +508,6 @@ class Printer
#if FEATURE_CONFIGURABLE_Z_ENDSTOPS
lastZDirection = 1;
#endif // FEATURE_CONFIGURABLE_Z_ENDSTOPS
stepperDirection[Z_AXIS] = 1;
}
else
{
Expand All @@ -525,7 +519,6 @@ class Printer
#if FEATURE_CONFIGURABLE_Z_ENDSTOPS
lastZDirection = -1;
#endif // FEATURE_CONFIGURABLE_Z_ENDSTOPS
stepperDirection[Z_AXIS] = -1;
}
} // setZDirection

Expand Down Expand Up @@ -1097,6 +1090,7 @@ class Printer
static void updateDerivedParameter();
static void switchEverythingOff();
static void updateAdvanceActivated();
static bool isZMoveActive();

static INLINE void setXAxisSteps(int32_t x) {
InterruptProtectedBlock noInts;
Expand Down
3 changes: 1 addition & 2 deletions Repetier/RF.cpp
Expand Up @@ -5325,7 +5325,6 @@ void moveZ(int nSteps)

g_nZScanZPosition += (Printer::getZDirectionIsPos() ? 1 : -1);
}
Printer::stepperDirection[Z_AXIS] = 0; //stepper immer freigeben. moveZ läuft nie parallel zu anderen Z-Bewegungen!
} // moveZ


Expand Down Expand Up @@ -6447,7 +6446,7 @@ void handleStrainGaugeFeatures(millis_t uTime) {
g_nEmergencyESkip = true;

// Block if we are driving Z rightnow
if (Printer::stepperDirection[Z_AXIS] && !Extruder::current->stepperDirection)
if (Printer::isZMoveActive() && !Extruder::current->stepperDirection)
{
// the pressure is outside the allowed range, we must perform the emergency stop
doEmergencyStop(STOP_BECAUSE_OF_Z_BLOCK);
Expand Down
3 changes: 0 additions & 3 deletions Repetier/RF.h
Expand Up @@ -443,9 +443,6 @@ The following variables are used for movements in x/y/z direction:
- holds the position which has been reached through the movements from the queue
- the value of currentSteps represents the current position of the printer in x, y and z direction
- Printer::stepperDirection[x/y/z]
- holds the direction of the axes as it is requested by the currently processed movement from the queue
- Printer::directDestinationSteps[x/y/z]
- unit is [steps]
- holds the position which shall be reached through direct movements, e.g. from the manual buttons or from the direct pause/continue functionality
Expand Down
29 changes: 15 additions & 14 deletions Repetier/motion.cpp
Expand Up @@ -1040,7 +1040,7 @@ void PrintLine::stepSlowedZCompensation() {
if (Printer::blockAll) {
return;
}

// We do not want the zCMP to have a total axis dependand constant speed.
// Constant jerky speedup and speeddowns sound awfull and we suspect that to cause the z-lift problematic.

Expand All @@ -1056,19 +1056,21 @@ void PrintLine::stepSlowedZCompensation() {
waitSteps--;
return;
}

int32_t cmpDiff = Printer::compensatedPositionTargetStepsZ - Printer::compensatedPositionCurrentStepsZ;

if (cmpDiff > 0)
{
// here we shall move the z-axis only in case performQueueMove() is not moving into the other direction at the moment
if (!Printer::stepperDirection[Z_AXIS])
bool posZ = Printer::getZDirectionIsPos();
if (!posZ)
{
posZ = true;
// set the direction only in case it is not set already
Printer::setZDirection(true);
Printer::setZDirection(posZ);
}
// we must move the heat bed do the bottom
if (Printer::getZDirectionIsPos())
if (posZ)
{
Printer::startZStep();
#if STEPPER_HIGH_DELAY>0
Expand All @@ -1090,13 +1092,15 @@ void PrintLine::stepSlowedZCompensation() {
if (cmpDiff < 0)
{
// here we shall move the z-axis only in case performQueueMove() is not moving into the other direction at the moment
if (!Printer::stepperDirection[Z_AXIS])
bool posZ = Printer::getZDirectionIsPos();
if (posZ)
{
posZ = false;
// set the direction only in case it is not set already
Printer::setZDirection(false);
Printer::setZDirection(posZ);
}
// we must move the heat bed to the top
if (!Printer::getZDirectionIsPos())
if (!posZ)
{
Printer::startZStep();
#if STEPPER_HIGH_DELAY>0
Expand Down Expand Up @@ -1673,7 +1677,7 @@ long PrintLine::performMove(PrintLine* move, uint8_t forQueue)
}
#if FEATURE_HEAT_BED_Z_COMPENSATION || FEATURE_WORK_PART_Z_COMPENSATION
else if (move->isXOrYMove()) {
PrintLine::stepSlowedZCompensation();
PrintLine::stepSlowedZCompensation(); // Z is free here. This is no Z-Move
}
#endif // FEATURE_HEAT_BED_Z_COMPENSATION || FEATURE_WORK_PART_Z_COMPENSATION

Expand Down Expand Up @@ -1767,12 +1771,9 @@ long PrintLine::performMove(PrintLine* move, uint8_t forQueue)

if (move->stepsRemaining <= 0 || move->isNoMove()) // line finished
{
if (move->stepsRemaining <= 0) { //Wenn keine Steps mehr da, sollten alle Achsen die benutzt wurden wieder freigegeben werden. Bei Z ist der Sonderfall, dass die Z-Kompensation sich reinschummeln könnte.
move->setXYMoveFinished();
move->setZMoveFinished(); // Wichtig, das die Z-Kompensation wieder weiterarbeiten kann, auch wichtig bei PrintLine::direct!
//Wenn keine Steps mehr da, sollten alle Achsen die benutzt wurden wieder freigegeben werden. Bei Z ist der Sonderfall, dass die Z-Kompensation sich reinschummeln könnte.
move->setXYZEMoveFinished(); // Wichtig, das die Z-Kompensation wieder weiterarbeiten kann, auch wichtig bei PrintLine::direct!
// Auch wenn kein Z-Move, könnte die Z-Kompensation die Achse Z benutzt haben.
move->setEMoveFinished();
}

if (forQueue) {
removeCurrentLineForbidInterrupt();
Expand Down
14 changes: 7 additions & 7 deletions Repetier/motion.h
Expand Up @@ -201,19 +201,16 @@ class PrintLine
inline void setXMoveFinished()
{
dir &= ~16;
Printer::stepperDirection[X_AXIS] = 0;
} // setXMoveFinished

inline void setYMoveFinished()
{
dir &= ~32;
Printer::stepperDirection[Y_AXIS] = 0;
} // setYMoveFinished

inline void setZMoveFinished()
{
dir &= ~64;
Printer::stepperDirection[Z_AXIS] = 0;
} // setZMoveFinished

inline void setEMoveFinished()
Expand All @@ -225,8 +222,12 @@ class PrintLine
inline void setXYMoveFinished()
{
dir &= ~48;
Printer::stepperDirection[Y_AXIS] = 0;
Printer::stepperDirection[X_AXIS] = 0;
} // setXYMoveFinished

inline void setXYZEMoveFinished()
{
dir &= ~240;
Extruder::current->stepperDirection = 0;
} // setXYMoveFinished

inline bool isXPositiveMove()
Expand Down Expand Up @@ -317,7 +318,6 @@ class PrintLine
inline void setMoveOfAxisFinished(uint8_t axis)
{
dir &= ~(16 << axis);
Printer::stepperDirection[axis] = 0;
} // setMoveOfAxisFinished

inline bool isPositiveMoveOfAxis(uint8_t axis)
Expand Down Expand Up @@ -412,10 +412,10 @@ class PrintLine

static INLINE void removeCurrentLineForbidInterrupt()
{
HAL::forbidInterrupts();
nextPlannerIndex(linesPos);
cur->task = TASK_NO_TASK;
cur = NULL;
HAL::forbidInterrupts();
--linesCount;
} // removeCurrentLineForbidInterrupt

Expand Down
6 changes: 6 additions & 0 deletions changelog.txt
Expand Up @@ -21,6 +21,12 @@ TODO:
# milling mode: test or rework milling functions
# pause @RF1000: test if z max-endstop is respected while moving in dual-endstop circular setting

V 01.43.99.Mod (2019-05-26)
- fixed a bug that sometimes caused the zcompensation to "hang" when the printlines were long.
The problem was that the compensation was only able to drive into one direction per move
because it did not free Z direction afterwards and blocked itself on direction changes.
That produced some weired looking first layers when printing some gcodes.

V 01.43.98.Mod (2019-05-01)
- At the end of a M3912 startline the speed adjustment is now reset to 100%
to gain a faster travel to the start point (instead of auto accelerating due to normal digits).
Expand Down

0 comments on commit 8df838d

Please sign in to comment.