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

Method PopState

src/GCodes/GCodeBuffer/GCodeBuffer.cpp:1035–1056  ·  view source on GitHub ↗

Pop state returning true if successful (i.e. no stack underrun)

Source from the content-addressed store, hash-verified

1033
1034// Pop state returning true if successful (i.e. no stack underrun)
1035bool GCodeBuffer::PopState(bool withinSameFile) noexcept
1036{
1037 bool poppedFileState;
1038 do
1039 {
1040 GCodeMachineState * const ms = machineState;
1041 if (ms->GetPrevious() == nullptr)
1042 {
1043 ms->messageAcknowledged = false; // avoid getting stuck in a loop trying to pop
1044 ms->waitingForAcknowledgement = false;
1045 return false;
1046 }
1047
1048 poppedFileState = !ms->localPush;
1049 machineState = ms->Pop(); // get the previous state and copy down any error message
1050 delete ms;
1051 } while (!withinSameFile && !poppedFileState);
1052 IF_NOT_BINARY(stringParser.ResetIndentationAfterPop());
1053
1054 reprap.InputsUpdated();
1055 return true;
1056}
1057
1058// Abort execution of any files or macros being executed
1059// We now avoid popping the state if we were not executing from a file, so that if DWC or PanelDue is used to jog the axes before they are homed, we don't report stack underflow.

Callers 5

SpinGCodeBufferMethod · 0.80
PopMethod · 0.80
FileMacroCyclesReturnMethod · 0.80
ExchangeDataMethod · 0.80

Calls 4

InputsUpdatedMethod · 0.80
GetPreviousMethod · 0.45
PopMethod · 0.45

Tested by

no test coverage detected