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

Method GCodeMachineState

src/GCodes/GCodeMachineState.cpp:94–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92#if SUPPORT_ASYNC_MOVES
93
94GCodeMachineState::GCodeMachineState(GCodeMachineState& copyFrom, GCodeMachineState *prev, unsigned int oldExecuteQueue, unsigned int newExecuteQueue) noexcept
95 : feedRate(copyFrom.feedRate),
96#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
97 fileState(),
98#endif
99#if HAS_SBC_INTERFACE
100 fileId(copyFrom.fileId),
101#endif
102 lockedResources(copyFrom.lockedResources),
103 lineNumber(copyFrom.lineNumber),
104 selectedPlane(copyFrom.selectedPlane), drivesRelative(copyFrom.drivesRelative), axesRelative(copyFrom.axesRelative),
105 doingFileMacro(copyFrom.doingFileMacro), waitWhileCooling(copyFrom.waitWhileCooling), runningM501(copyFrom.runningM501), runningM502(copyFrom.runningM502),
106 volumetricExtrusion(false), g53Active(false), runningSystemMacro(copyFrom.runningSystemMacro), usingInches(copyFrom.usingInches),
107 waitingForAcknowledgement(false), messageAcknowledged(false), localPush(copyFrom.localPush),
108 macroRestartable(copyFrom.macroRestartable), firstCommandAfterRestart(copyFrom.firstCommandAfterRestart), commandRepeated(copyFrom.commandRepeated),
109 inverseTimeMode(copyFrom.inverseTimeMode),
110#if HAS_SBC_INTERFACE
111 lastCodeFromSbc(copyFrom.lastCodeFromSbc), macroStartedByCode(copyFrom.macroStartedByCode), fileFinished(copyFrom.fileFinished),
112#endif
113 compatibility(copyFrom.compatibility),
114 previous(prev), currentBlockState(new BlockState(nullptr)), errorMessage(nullptr),
115 blockNesting(copyFrom.blockNesting),
116 state(GCodeState::normal), stateMachineResult(GCodeResult::ok),
117 commandedQueueNumber(copyFrom.commandedQueueNumber), ownQueueNumber(newExecuteQueue), executeAllCommands(false)
118{
119#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
120 if (copyFrom.fileState.IsLive())
121 {
122 if (localPush)
123 {
124 fileState.CopyFrom(prev->fileState);
125 }
126 else
127 {
128 fileState.Set(MassStorage::DuplicateOpenHandle(copyFrom.fileState.GetUnderlyingFile()));
129 }
130 }
131#endif
132 copyFrom.ownQueueNumber = oldExecuteQueue;
133 copyFrom.executeAllCommands = false;
134
135 // Copy the block states from the previous MachineState to the new one
136 const BlockState *src = copyFrom.currentBlockState;
137 BlockState *dst = currentBlockState;
138 for (;;)
139 {
140 *dst = *src;
141 src = src->GetPrevious();
142 if (src == nullptr)
143 {
144 break;
145 }
146 BlockState *const newDst = new BlockState(nullptr);
147 dst->SetPrevious(newDst);
148 dst = newDst;
149 }
150}
151

Callers

nothing calls this directly

Calls 6

IsLiveMethod · 0.80
GetUnderlyingFileMethod · 0.80
CopyFromMethod · 0.45
SetMethod · 0.45
GetPreviousMethod · 0.45
SetPreviousMethod · 0.45

Tested by

no test coverage detected