Skip to content

Commit

Permalink
Merge pull request #1871 from smartin015/add_target_machine
Browse files Browse the repository at this point in the history
Add TARGET_MACHINE.NAME header comments
  • Loading branch information
casperlamboo authored Jun 9, 2023
2 parents 2d1da38 + e476bd7 commit 5ab93c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/gcodeExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ std::string GCodeExport::getFileHeader(const std::vector<bool>& extruder_is_used
break;
default:
prefix << ";FLAVOR:" << flavorToString(flavor) << new_line;
prefix << ";TARGET_MACHINE.NAME:" << transliterate(machine_name) << new_line;
prefix << ";TIME:" << ((print_time) ? static_cast<int>(*print_time) : 6666) << new_line;
if (flavor == EGCodeFlavor::ULTIGCODE)
{
Expand Down
10 changes: 5 additions & 5 deletions tests/GCodeExportTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ TEST_F(GCodeExportTest, HeaderUltiGCode)
std::string result = gcode.getFileHeader(extruder_is_used, &print_time, filament_used);

EXPECT_EQ(result,
";FLAVOR:UltiGCode\n;TIME:1337\n;MATERIAL:100\n;MATERIAL2:200\n;NOZZLE_DIAMETER:0.4\n;MINX:0\n;MINY:0\n;MINZ:0\n;MAXX:1\n;"
";FLAVOR:UltiGCode\n;TARGET_MACHINE.NAME:Your favourite 3D printer\n;TIME:1337\n;MATERIAL:100\n;MATERIAL2:200\n;NOZZLE_DIAMETER:0.4\n;MINX:0\n;MINY:0\n;MINZ:0\n;MAXX:1\n;"
"MAXY:1\n;MAXZ:1\n");
}

Expand All @@ -349,7 +349,7 @@ TEST_F(GCodeExportTest, HeaderRepRap)
std::string result = gcode.getFileHeader(extruder_is_used, &print_time, filament_used);

EXPECT_EQ(result,
";FLAVOR:RepRap\n;TIME:1337\n;Filament used: 0.02m, 0.05m\n;Layer height: "
";FLAVOR:RepRap\n;TARGET_MACHINE.NAME:Your favourite 3D printer\n;TIME:1337\n;Filament used: 0.02m, 0.05m\n;Layer height: "
"0.123\n;MINX:0\n;MINY:0\n;MINZ:0\n;MAXX:1\n;MAXY:1\n;MAXZ:1\n");
}

Expand All @@ -368,7 +368,7 @@ TEST_F(GCodeExportTest, HeaderMarlin)
std::string result = gcode.getFileHeader(extruder_is_used, &print_time, filament_used);

EXPECT_EQ(result,
";FLAVOR:Marlin\n;TIME:1337\n;Filament used: 0.02m, 0.05m\n;Layer height: "
";FLAVOR:Marlin\n;TARGET_MACHINE.NAME:Your favourite 3D printer\n;TIME:1337\n;Filament used: 0.02m, 0.05m\n;Layer height: "
"0.123\n;MINX:0\n;MINY:0\n;MINZ:0\n;MAXX:1\n;MAXY:1\n;MAXZ:1\n");
}

Expand All @@ -385,7 +385,7 @@ TEST_F(GCodeExportTest, HeaderMarlinVolumetric)
std::string result = gcode.getFileHeader(extruder_is_used, &print_time, filament_used);

EXPECT_EQ(result,
";FLAVOR:Marlin(Volumetric)\n;TIME:1337\n;Filament used: 100mm3, 200mm3\n;Layer height: "
";FLAVOR:Marlin(Volumetric)\n;TARGET_MACHINE.NAME:Your favourite 3D printer\n;TIME:1337\n;Filament used: 100mm3, 200mm3\n;Layer height: "
"0.123\n;MINX:0\n;MINY:0\n;MINZ:0\n;MAXX:1\n;MAXY:1\n;MAXZ:1\n");
}

Expand Down Expand Up @@ -711,4 +711,4 @@ TEST_F(GCodeExportTest, insertWipeScriptHopEnable)
EXPECT_EQ(std::string(";WIPE_SCRIPT_END"), token) << "Wipe script should always end with tag.";
}
} // namespace cura
// NOLINTEND(*-magic-numbers)
// NOLINTEND(*-magic-numbers)

0 comments on commit 5ab93c0

Please sign in to comment.