Pop state returning true if successful (i.e. no stack underrun)
| 1033 | |
| 1034 | // Pop state returning true if successful (i.e. no stack underrun) |
| 1035 | bool 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. |
no test coverage detected