add: support gcode estimated printing time for klipper

This commit is contained in:
Dmytro Chystiakov 2024-01-12 14:54:52 +02:00 committed by Lane.Wei
parent 603514b7a6
commit 5e0e675f7d
1 changed files with 12 additions and 7 deletions

View File

@ -478,9 +478,13 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
PrintEstimatedStatistics::ETimeMode mode = static_cast<PrintEstimatedStatistics::ETimeMode>(i); PrintEstimatedStatistics::ETimeMode mode = static_cast<PrintEstimatedStatistics::ETimeMode>(i);
if (mode == PrintEstimatedStatistics::ETimeMode::Normal || machine.enabled) { if (mode == PrintEstimatedStatistics::ETimeMode::Normal || machine.enabled) {
char buf[128]; char buf[128];
//sprintf(buf, "; estimated printing time (%s mode) = %s\n", if (!print.is_BBL_Printer()) {
// (mode == PrintEstimatedStatistics::ETimeMode::Normal) ? "normal" : "silent", // Klipper estimator
// get_time_dhms(machine.time).c_str()); sprintf(buf, "; estimated printing time (normal mode) = %s\n",
get_time_dhms(machine.time));
ret += buf;
} else {
// BBS estimator
sprintf(buf, "; model printing time: %s; total estimated time: %s\n", sprintf(buf, "; model printing time: %s; total estimated time: %s\n",
get_time_dhms(machine.time - machine.prepare_time).c_str(), get_time_dhms(machine.time - machine.prepare_time).c_str(),
get_time_dhms(machine.time).c_str()); get_time_dhms(machine.time).c_str());
@ -488,6 +492,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
} }
} }
} }
}
//BBS: write total layer number //BBS: write total layer number
else if (line == reserved_tag(ETags::Total_Layer_Number_Placeholder)) { else if (line == reserved_tag(ETags::Total_Layer_Number_Placeholder)) {
char buf[128]; char buf[128];