Sync isPositionAllowed and printCurrentPosition functions
rodzic
db25a431dc
commit
832ddaf6cf
|
@ -383,7 +383,7 @@ bool runBedLeveling(GCode *com) {
|
|||
EEPROM::storeDataIntoEEPROM();
|
||||
}
|
||||
Printer::updateCurrentPosition(true);
|
||||
Commands::printCurrentPosition(PSTR("G32 "));
|
||||
Commands::printCurrentPosition();
|
||||
#if DISTORTION_CORRECTION
|
||||
if(distEnabled)
|
||||
Printer::distortion.enable(false); // if level has changed, distortion is also invalid
|
||||
|
|
|
@ -254,12 +254,9 @@ void Commands::waitUntilEndOfAllBuffers() {
|
|||
}
|
||||
}
|
||||
|
||||
void Commands::printCurrentPosition(FSTRINGPARAM(s)) {
|
||||
void Commands::printCurrentPosition() {
|
||||
float x, y, z;
|
||||
Printer::realPosition(x, y, z);
|
||||
if (isnan(x) || isinf(x) || isnan(y) || isinf(y) || isnan(z) || isinf(z)) {
|
||||
Com::printErrorFLN(s); // flag where the error condition came from
|
||||
}
|
||||
x += Printer::coordinateOffset[X_AXIS];
|
||||
y += Printer::coordinateOffset[Y_AXIS];
|
||||
z += Printer::coordinateOffset[Z_AXIS];
|
||||
|
@ -267,8 +264,16 @@ void Commands::printCurrentPosition(FSTRINGPARAM(s)) {
|
|||
Com::printF(Com::tSpaceYColon, y * (Printer::unitIsInches ? 0.03937 : 1), 2);
|
||||
Com::printF(Com::tSpaceZColon, z * (Printer::unitIsInches ? 0.03937 : 1), 3);
|
||||
Com::printFLN(Com::tSpaceEColon, Printer::currentPositionSteps[E_AXIS] * Printer::invAxisStepsPerMM[E_AXIS] * (Printer::unitIsInches ? 0.03937 : 1), 4);
|
||||
//Com::printF(PSTR("OffX:"),Printer::offsetX); // to debug offset handling
|
||||
//Com::printFLN(PSTR(" OffY:"),Printer::offsetY);
|
||||
#ifdef DEBUG_POS
|
||||
Com::printF(PSTR("OffX:"), Printer::offsetX); // to debug offset handling
|
||||
Com::printF(PSTR(" OffY:"), Printer::offsetY);
|
||||
Com::printF(PSTR(" OffZ:"), Printer::offsetZ);
|
||||
Com::printF(PSTR(" OffZ2:"), Printer::offsetZ2);
|
||||
Com::printF(PSTR(" XS:"), Printer::currentPositionSteps[X_AXIS]);
|
||||
Com::printF(PSTR(" YS:"), Printer::currentPositionSteps[Y_AXIS]);
|
||||
Com::printFLN(PSTR(" ZS:"), Printer::currentPositionSteps[Z_AXIS]);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void Commands::printTemperatures(bool showRaw) {
|
||||
|
@ -1190,7 +1195,7 @@ void Commands::processGCode(GCode *com) {
|
|||
EEPROM::storeDataIntoEEPROM();
|
||||
}
|
||||
Printer::updateCurrentPosition(true);
|
||||
printCurrentPosition(PSTR("G29 "));
|
||||
printCurrentPosition();
|
||||
Printer::finishProbing();
|
||||
Printer::feedrate = oldFeedrate;
|
||||
if(!ok) {
|
||||
|
@ -1532,7 +1537,7 @@ void Commands::processGCode(GCode *com) {
|
|||
#endif
|
||||
Printer::updateCurrentPosition();
|
||||
Com::printF(PSTR("PosFromSteps:"));
|
||||
printCurrentPosition(PSTR("G134 "));
|
||||
printCurrentPosition();
|
||||
break;
|
||||
|
||||
#endif // DRIVE_SYSTEM
|
||||
|
@ -2035,7 +2040,7 @@ void Commands::processMCode(GCode *com) {
|
|||
Printer::reportPrinterMode();
|
||||
break;
|
||||
case 114: // M114
|
||||
printCurrentPosition(PSTR("M114 "));
|
||||
printCurrentPosition();
|
||||
if(com->hasS() && com->S) {
|
||||
Com::printF(PSTR("XS:"),Printer::currentPositionSteps[X_AXIS]);
|
||||
Com::printF(PSTR(" YS:"),Printer::currentPositionSteps[Y_AXIS]);
|
||||
|
@ -2232,7 +2237,7 @@ void Commands::processMCode(GCode *com) {
|
|||
EEPROM::storeDataIntoEEPROM(false);
|
||||
Com::printFLN(Com::tEEPROMUpdated);
|
||||
#endif
|
||||
Commands::printCurrentPosition(PSTR("M251 "));
|
||||
Commands::printCurrentPosition();
|
||||
break;
|
||||
#endif
|
||||
#if FEATURE_DITTO_PRINTING
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
static void executeGCode(GCode *com);
|
||||
static void waitUntilEndOfAllMoves();
|
||||
static void waitUntilEndOfAllBuffers();
|
||||
static void printCurrentPosition(FSTRINGPARAM(s));
|
||||
static void printCurrentPosition();
|
||||
static void printTemperatures(bool showRaw = false);
|
||||
static void setFanSpeed(int speed, bool immediately = false); /// Set fan speed 0..255
|
||||
static void setFan2Speed(int speed); /// Set fan speed 0..255
|
||||
|
|
|
@ -488,41 +488,38 @@ void Printer::toggleNoMoves() {
|
|||
void Printer::toggleEndStop() {
|
||||
setDebugLevel(debugLevel ^ 64);
|
||||
}
|
||||
|
||||
bool Printer::isPositionAllowed(float x,float y,float z)
|
||||
{
|
||||
|
||||
bool Printer::isPositionAllowed(float x, float y, float z) {
|
||||
if(isNoDestinationCheck()) return true;
|
||||
bool allowed = true;
|
||||
#if DRIVE_SYSTEM == DELTA
|
||||
if(!isHoming()) {
|
||||
allowed = allowed && (z >= 0) && (z <= zLength + 0.05 + ENDSTOP_Z_BACK_ON_HOME);
|
||||
allowed = allowed && (x * x + y * y <= deltaMaxRadiusSquared);
|
||||
}
|
||||
#else // DRIVE_SYSTEM
|
||||
if(!isHoming()) {
|
||||
allowed = allowed && x >= xMin;
|
||||
allowed = allowed && x <= xMin + xLength;
|
||||
allowed = allowed && y >= yMin;
|
||||
allowed = allowed && y <= yMin + yLength;
|
||||
allowed = allowed && z >= zMin;
|
||||
allowed = allowed && z <= zMin + zLength + ENDSTOP_Z_BACK_ON_HOME;
|
||||
}
|
||||
#endif
|
||||
#if DUAL_X_AXIS
|
||||
// Prevent carriage hit by disallowing moves inside other parking direction.
|
||||
if(Extruder::current->id == 0) {
|
||||
if(x > xMin + xLength)
|
||||
allowed = false;
|
||||
} else {
|
||||
if(x < xMin)
|
||||
allowed = false;
|
||||
}
|
||||
if(!isHoming()) {
|
||||
allowed = allowed && (z >= 0) && (z <= zLength + 0.05 + ENDSTOP_Z_BACK_ON_HOME);
|
||||
allowed = allowed && (x * x + y * y <= deltaMaxRadiusSquared);
|
||||
}
|
||||
#else // DRIVE_SYSTEM
|
||||
if(!isHoming()) {
|
||||
allowed = allowed && x >= xMin - 0.01;
|
||||
allowed = allowed && x <= xMin + xLength + 0.01;
|
||||
allowed = allowed && y >= yMin - 0.01;
|
||||
allowed = allowed && y <= yMin + yLength + 0.01;
|
||||
allowed = allowed && z >= zMin - 0.01;
|
||||
allowed = allowed && z <= zMin + zLength + ENDSTOP_Z_BACK_ON_HOME + 0.01;
|
||||
}
|
||||
#endif
|
||||
if(!allowed)
|
||||
{
|
||||
Com::printFLN(PSTR("x3"));
|
||||
/*#if DUAL_X_AXIS
|
||||
// Prevent carriage hit by disallowing moves inside other parking direction.
|
||||
if(Extruder::current->id == 0) {
|
||||
if(x > xMin + xLength + 0.01)
|
||||
allowed = false;
|
||||
} else {
|
||||
if(x < xMin - 0.01)
|
||||
allowed = false;
|
||||
}
|
||||
#endif*/
|
||||
if(!allowed) {
|
||||
Printer::updateCurrentPosition(true);
|
||||
Commands::printCurrentPosition(PSTR("isPositionAllowed "));
|
||||
Commands::printCurrentPosition();
|
||||
}
|
||||
return allowed;
|
||||
}
|
||||
|
@ -1407,7 +1404,7 @@ PULLUP(Z2_MINMAX_PIN, HIGH);
|
|||
currentPositionSteps[i] = 0;
|
||||
}
|
||||
currentPosition[X_AXIS] = currentPosition[Y_AXIS]= currentPosition[Z_AXIS] = 0.0;
|
||||
//Commands::printCurrentPosition(PSTR("Printer::setup 0 "));
|
||||
//Commands::printCurrentPosition();
|
||||
#if DISTORTION_CORRECTION
|
||||
distortion.init();
|
||||
#endif // DISTORTION_CORRECTION
|
||||
|
@ -1422,7 +1419,7 @@ PULLUP(Z2_MINMAX_PIN, HIGH);
|
|||
homeAxis(true,true,true);
|
||||
#endif
|
||||
setAutoretract(EEPROM_BYTE(AUTORETRACT_ENABLED));
|
||||
Commands::printCurrentPosition(PSTR("Printer::setup "));
|
||||
Commands::printCurrentPosition();
|
||||
#endif // DRIVE_SYSTEM
|
||||
Extruder::selectExtruderById(0);
|
||||
|
||||
|
@ -1655,7 +1652,7 @@ LaserDriver::laserOn = false;
|
|||
updateCurrentPosition(true);
|
||||
updateHomedAll();
|
||||
UI_CLEAR_STATUS
|
||||
Commands::printCurrentPosition(PSTR("homeAxis "));
|
||||
Commands::printCurrentPosition();
|
||||
setAutolevelActive(autoLevel);
|
||||
#if defined(SUPPORT_LASER) && SUPPORT_LASER
|
||||
LaserDriver::laserOn = oldLaser;
|
||||
|
@ -2089,7 +2086,7 @@ void Printer::homeAxis(bool xaxis,bool yaxis,bool zaxis) // home non-delta print
|
|||
updateHomedAll();
|
||||
//Davinci Specific
|
||||
//UI_CLEAR_STATUS
|
||||
Commands::printCurrentPosition(PSTR("homeAxis "));
|
||||
Commands::printCurrentPosition();
|
||||
#if defined(SUPPORT_LASER) && SUPPORT_LASER
|
||||
LaserDriver::laserOn = oldLaser;
|
||||
#endif
|
||||
|
|
|
@ -3281,7 +3281,7 @@ bool UIDisplay::nextPreviousAction(int16_t next, bool allowMoves)
|
|||
#else
|
||||
PrintLine::moveRelativeDistanceInStepsReal(increment,0,0,0,Printer::homingFeedrate[X_AXIS],false,false);
|
||||
#endif
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_XPOSITION "));
|
||||
Commands::printCurrentPosition();
|
||||
break;
|
||||
case UI_ACTION_YPOSITION:
|
||||
if(!allowMoves) return false;
|
||||
|
@ -3297,7 +3297,7 @@ bool UIDisplay::nextPreviousAction(int16_t next, bool allowMoves)
|
|||
#else
|
||||
PrintLine::moveRelativeDistanceInStepsReal(0,increment,0,0,Printer::homingFeedrate[Y_AXIS],false,false);
|
||||
#endif
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_YPOSITION "));
|
||||
Commands::printCurrentPosition();
|
||||
break;
|
||||
case UI_ACTION_ZPOSITION_NOTEST:
|
||||
if(!allowMoves) return false;
|
||||
|
@ -3319,17 +3319,17 @@ ZPOS1:
|
|||
PrintLine::moveRelativeDistanceInStepsReal(0, 0, ((long)increment * Printer::axisStepsPerMM[Z_AXIS]) / 100, 0, Printer::homingFeedrate[Z_AXIS],false,false);
|
||||
#endif
|
||||
Printer::setNoDestinationCheck(false);
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_ZPOSITION "));
|
||||
Commands::printCurrentPosition();
|
||||
break;
|
||||
case UI_ACTION_XPOSITION_FAST:
|
||||
if(!allowMoves) return false;
|
||||
PrintLine::moveRelativeDistanceInStepsReal(Printer::axisStepsPerMM[X_AXIS] * increment,0,0,0,Printer::homingFeedrate[X_AXIS],true,false);
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_XPOSITION_FAST "));
|
||||
Commands::printCurrentPosition();
|
||||
break;
|
||||
case UI_ACTION_YPOSITION_FAST:
|
||||
if(!allowMoves) return false;
|
||||
PrintLine::moveRelativeDistanceInStepsReal(0,Printer::axisStepsPerMM[Y_AXIS] * increment,0,0,Printer::homingFeedrate[Y_AXIS],true,false);
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_YPOSITION_FAST "));
|
||||
Commands::printCurrentPosition();
|
||||
break;
|
||||
case UI_ACTION_ZPOSITION_FAST_NOTEST:
|
||||
if(!allowMoves) return false;
|
||||
|
@ -3340,12 +3340,12 @@ ZPOS1:
|
|||
ZPOS2:
|
||||
PrintLine::moveRelativeDistanceInStepsReal(0,0,Printer::axisStepsPerMM[Z_AXIS] * increment,0,Printer::homingFeedrate[Z_AXIS],true,false);
|
||||
Printer::setNoDestinationCheck(false);
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_ZPOSITION_FAST "));
|
||||
Commands::printCurrentPosition();
|
||||
break;
|
||||
case UI_ACTION_EPOSITION:
|
||||
if(!allowMoves) return false;
|
||||
PrintLine::moveRelativeDistanceInSteps(0,0,0,Printer::axisStepsPerMM[E_AXIS]*increment / Printer::extrusionFactor,UI_SET_EXTRUDER_FEEDRATE,true,false,false);
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_EPOSITION "));
|
||||
Commands::printCurrentPosition();
|
||||
break;
|
||||
#if FEATURE_RETRACTION
|
||||
case UI_ACTION_WIZARD_FILAMENTCHANGE: // filament change is finished
|
||||
|
@ -3463,7 +3463,7 @@ ZPOS2:
|
|||
}
|
||||
//we move under control range or not homed
|
||||
PrintLine::moveRelativeDistanceInStepsReal(Printer::axisStepsPerMM[X_AXIS]*increment*istep,0,0,0,Printer::homingFeedrate[X_AXIS],true);
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_XPOSITION "));
|
||||
Commands::printCurrentPosition();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3496,7 +3496,7 @@ ZPOS2:
|
|||
}
|
||||
//we move under control range or not homed
|
||||
PrintLine::moveRelativeDistanceInStepsReal(0,Printer::axisStepsPerMM[Y_AXIS]*increment*istep,0,0,Printer::homingFeedrate[Y_AXIS],true);
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_YPOSITION "));
|
||||
Commands::printCurrentPosition();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3528,7 +3528,7 @@ ZPOS2:
|
|||
}
|
||||
//we move under control range or not homed
|
||||
PrintLine::moveRelativeDistanceInStepsReal(0,0,Printer::axisStepsPerMM[Z_AXIS]*increment*istep,0,Printer::homingFeedrate[Z_AXIS],true);
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_ZPOSITION "));
|
||||
Commands::printCurrentPosition();
|
||||
break;
|
||||
}
|
||||
case UI_ACTION_E_1:
|
||||
|
@ -3564,7 +3564,7 @@ ZPOS2:
|
|||
#endif
|
||||
//we move
|
||||
PrintLine::moveRelativeDistanceInSteps(0,0,0,Printer::axisStepsPerMM[E_AXIS]*increment*istep,UI_SET_EXTRUDER_FEEDRATE,true,false);
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_EPOSITION "));
|
||||
Commands::printCurrentPosition();
|
||||
//restore autoreturn function
|
||||
#if UI_AUTORETURN_TO_MENU_AFTER!=0
|
||||
if (btmp_autoreturn)//if was activated restore it - if not do nothing - stay desactivate
|
||||
|
@ -3894,7 +3894,7 @@ void UIDisplay::menuAdjustHeight(const UIMenu *men,float offset)
|
|||
pushMenu(men, false);
|
||||
BEEP_SHORT;
|
||||
Printer::homeAxis(true, true, true);
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_HOMEALL "));
|
||||
Commands::printCurrentPosition();
|
||||
menuLevel = 0;
|
||||
activeAction = 0;
|
||||
UI_STATUS_UPD_F(Com::translatedF(UI_TEXT_PRINTER_READY_ID));
|
||||
|
@ -4153,7 +4153,7 @@ int UIDisplay::executeAction(unsigned int action, bool allowMoves)
|
|||
menuPos[0] = 0;
|
||||
refreshPage();
|
||||
Printer::homeAxis(true, true, true);
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_HOMEALL "));
|
||||
Commands::printCurrentPosition();
|
||||
menuLevel=tmpmenu;
|
||||
menuPos[menuLevel]=tmpmenupos;
|
||||
menu[menuLevel]=tmpmen;
|
||||
|
@ -4171,7 +4171,7 @@ int UIDisplay::executeAction(unsigned int action, bool allowMoves)
|
|||
menuPos[0] = 0;
|
||||
refreshPage();
|
||||
Printer::homeAxis(true, false, false);
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_HOME_X "));
|
||||
Commands::printCurrentPosition();
|
||||
menuLevel=tmpmenu;
|
||||
menuPos[menuLevel]=tmpmenupos;
|
||||
menu[menuLevel]=tmpmen;
|
||||
|
@ -4189,7 +4189,7 @@ int UIDisplay::executeAction(unsigned int action, bool allowMoves)
|
|||
menuPos[0] = 0;
|
||||
refreshPage();
|
||||
Printer::homeAxis(false, true, false);
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_HOME_Y "));
|
||||
Commands::printCurrentPosition();
|
||||
menuLevel=tmpmenu;
|
||||
menuPos[menuLevel]=tmpmenupos;
|
||||
menu[menuLevel]=tmpmen;
|
||||
|
@ -4207,7 +4207,7 @@ int UIDisplay::executeAction(unsigned int action, bool allowMoves)
|
|||
menuPos[0] = 0;
|
||||
refreshPage();
|
||||
Printer::homeAxis(false, false, true);
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_HOME_Z "));
|
||||
Commands::printCurrentPosition();
|
||||
menuLevel=tmpmenu;
|
||||
menuPos[menuLevel]=tmpmenupos;
|
||||
menu[menuLevel]=tmpmen;
|
||||
|
@ -4381,7 +4381,7 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
Printer::moveToReal(IGNORE_COORDINATE,IGNORE_COORDINATE,Printer::zMin+Printer::zMin+Printer::zLength,IGNORE_COORDINATE,Printer::homingFeedrate[Z_AXIS]);
|
||||
Printer::updateCurrentPosition();
|
||||
Commands::waitUntilEndOfAllMoves();
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_ZPOSITION "));
|
||||
Commands::printCurrentPosition();
|
||||
UI_STATUS_F(Com::translatedF(UI_TEXT_BED_DOWN_ID));
|
||||
}
|
||||
Printer::setMenuMode(MENU_MODE_PRINTING,false);
|
||||
|
@ -6548,7 +6548,7 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
EEPROM::storeDataIntoEEPROM(false);
|
||||
Com::printFLN(Com::tEEPROMUpdated);
|
||||
#endif
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_SET_MEASURED_ORIGIN "));
|
||||
Commands::printCurrentPosition();
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
|
Ładowanie…
Reference in New Issue