Skip to content

Commit

Permalink
Job tweaks (#1253)
Browse files Browse the repository at this point in the history
* In status reports, use SD tag for macro progress

This makes various UI things work right

* Use Job leader for command output channel when appropriate

This fixes some crashes that could occur when messages were being
sent to file channels.
  • Loading branch information
MitchBradley authored Jul 11, 2024
1 parent 0682a4e commit 2131ef7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion FluidNC/src/Machine/Macros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Error MacroChannel::pollLine(char* line) {
float percent_complete = (float)_position * 100.0f / _macro->get().length();

std::ostringstream s;
s << name() << ":" << std::fixed << std::setprecision(2) << percent_complete;
s << "SD:" << std::fixed << std::setprecision(2) << percent_complete << "," << name();
_progress = s.str();
}
return Error::Ok;
Expand Down
3 changes: 2 additions & 1 deletion FluidNC/src/Protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ void protocol_main_loop() {
report_echo_line_received(activeLine, allChannels);
}

Error status_code = execute_line(activeLine, *activeChannel, WebUI::AuthenticationLevel::LEVEL_GUEST);
Channel* out_channel = Job::leader ? Job::leader : activeChannel;
Error status_code = execute_line(activeLine, *out_channel, WebUI::AuthenticationLevel::LEVEL_GUEST);

// Tell the channel that the line has been processed.
// If the line was aborted, the channel could be invalid
Expand Down

0 comments on commit 2131ef7

Please sign in to comment.