MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / SelectTool

Method SelectTool

src/Movement/RawMove.cpp:229–241  ·  view source on GitHub ↗

Select the specified tool, putting the existing current tool into standby

Source from the content-addressed store, hash-verified

227
228// Select the specified tool, putting the existing current tool into standby
229void MovementState::SelectTool(int toolNumber, bool simulating) noexcept
230{
231 ReadLockedPointer<Tool> const newTool = Tool::GetLockedTool(toolNumber);
232 if (!simulating && currentTool != nullptr && currentTool != newTool.Ptr())
233 {
234 currentTool->Standby();
235 }
236 currentTool = newTool.Ptr(); // must do this first so that Activate() will always work
237 if (!simulating && newTool.IsNotNull())
238 {
239 newTool->Activate();
240 }
241}
242
243// Get a locked pointer to the current tool, or null if there is no current tool
244ReadLockedPointer<Tool> MovementState::GetLockedCurrentTool() const noexcept

Callers 6

THROWSFunction · 0.80
RunStateMachineMethod · 0.80
SelectPrimaryToolFunction · 0.80
GCodes2.cppFile · 0.80
THROWSFunction · 0.80

Calls 2

StandbyMethod · 0.80
ActivateMethod · 0.45

Tested by

no test coverage detected