+ safe height gcode parameter

This commit is contained in:
MX_Master 2021-10-13 23:16:55 +06:00 committed by phkahler
parent 2cd0ee4b33
commit a45e84a2ff
5 changed files with 24 additions and 11 deletions

View File

@ -161,6 +161,11 @@ void TextWindow::ScreenChangeGCodeParameter(int link, uint32_t v) {
buf += SS.MmToString(SS.gCode.depth, true);
break;
case 'h':
SS.TW.edit.meaning = Edit::G_CODE_SAFE_HEIGHT;
buf += SS.MmToString(SS.gCode.safeHeight, true);
break;
case 's':
SS.TW.edit.meaning = Edit::G_CODE_PASSES;
buf += std::to_string(SS.gCode.passes);
@ -492,6 +497,11 @@ bool TextWindow::EditControlDoneForConfiguration(const std::string &s) {
if(e) SS.gCode.depth = (float)SS.ExprToMm(e);
break;
}
case Edit::G_CODE_SAFE_HEIGHT: {
Expr *e = Expr::From(s, /*popUpError=*/true);
if(e) SS.gCode.safeHeight = (float)SS.ExprToMm(e);
break;
}
case Edit::G_CODE_PASSES: {
Expr *e = Expr::From(s, /*popUpError=*/true);
if(e) SS.gCode.passes = (int)(e->Eval());

View File

@ -1308,9 +1308,9 @@ void GCodeFileWriter::FinishAndCloseFile() {
SS.MmToString(pt->p.x).c_str(), SS.MmToString(pt->p.y).c_str(),
SS.MmToString(SS.gCode.feed).c_str());
}
// Move up to a clearance plane 5mm above the work.
// Move up to a clearance plane above the work.
fprintf(f, "G00 Z%s\r\n",
SS.MmToString(SS.gCode.depth < 0 ? +5 : -5).c_str());
SS.MmToString(SS.gCode.safeHeight).c_str());
}
}

View File

@ -105,6 +105,7 @@ void SolveSpaceUI::Init() {
exportCanvas.dy = settings->ThawFloat("ExportCanvas_Dy", 5.0);
// Extra parameters when exporting G code
gCode.depth = settings->ThawFloat("GCode_Depth", 10.0);
gCode.safeHeight = settings->ThawFloat("GCode_SafeHeight", 5.0);
gCode.passes = settings->ThawInt("GCode_Passes", 1);
gCode.feed = settings->ThawFloat("GCode_Feed", 10.0);
gCode.plungeFeed = settings->ThawFloat("GCode_PlungeFeed", 10.0);

View File

@ -598,6 +598,7 @@ public:
} exportCanvas;
struct {
double depth;
double safeHeight;
int passes;
double feed;
double plungeFeed;

View File

@ -314,13 +314,14 @@ public:
EXPORT_OFFSET = 110,
CANVAS_SIZE = 111,
G_CODE_DEPTH = 112,
G_CODE_PASSES = 113,
G_CODE_FEED = 114,
G_CODE_PLUNGE_FEED = 115,
AUTOSAVE_INTERVAL = 116,
LIGHT_AMBIENT = 117,
FIND_CONSTRAINT_TIMEOUT = 118,
EXPLODE_DISTANCE = 119,
G_CODE_SAFE_HEIGHT = 113,
G_CODE_PASSES = 114,
G_CODE_FEED = 115,
G_CODE_PLUNGE_FEED = 116,
AUTOSAVE_INTERVAL = 117,
LIGHT_AMBIENT = 118,
FIND_CONSTRAINT_TIMEOUT = 119,
EXPLODE_DISTANCE = 120,
// For TTF text
TTF_TEXT = 300,
// For the step dimension screen