Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2020-04-12 12:05:26 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-04-12 12:05:26 +0300
commitf7c0d13a90dc0cddcfbb9eeec4857632a501818d (patch)
treed5eb3a47a398ffa48678b44b941c0b288d71b851 /src/GCodes/GCodeMachineState.h
parentf6f507c6b7576e3ead7d0d017535da5eecb05c35 (diff)
Fix to make 'result' constant correct after failing G30 commands
Also added restore points and some additional limits to object model
Diffstat (limited to 'src/GCodes/GCodeMachineState.h')
-rw-r--r--src/GCodes/GCodeMachineState.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/GCodes/GCodeMachineState.h b/src/GCodes/GCodeMachineState.h
index 38f8055d..8e176dd4 100644
--- a/src/GCodes/GCodeMachineState.h
+++ b/src/GCodes/GCodeMachineState.h
@@ -12,6 +12,7 @@
#include <Storage/FileData.h>
#include <General/FreelistManager.h>
#include <General/NamedEnum.h>
+#include <GCodes/GCodeResult.h>
// Enumeration to list all the possible states that the Gcode processing machine may be in
enum class GCodeState : uint8_t
@@ -162,7 +163,12 @@ public:
~GCodeMachineState() noexcept;
- GCodeMachineState *previous;
+ GCodeState GetState() const noexcept { return state; }
+ void SetState(GCodeState newState) noexcept;
+ inline void AdvanceState() noexcept { state = static_cast<GCodeState>(static_cast<uint8_t>(state) + 1); }
+
+ GCodeMachineState *GetPrevious() const noexcept { return previous; }
+
float feedRate;
#if HAS_MASS_STORAGE
FileData fileState;
@@ -172,7 +178,6 @@ public:
#endif
ResourceBitmap lockedResources;
BlockState blockStates[MaxBlockIndent];
- const char *errorMessage;
uint32_t lineNumber;
Compatibility compatibility;
@@ -199,7 +204,6 @@ public:
messageCancelled : 1;
uint8_t blockNesting;
- GCodeState state;
bool DoingFile() const noexcept;
void CloseFile() noexcept;
@@ -213,6 +217,11 @@ public:
bool UsingMachineCoordinates() const noexcept { return g53Active || runningSystemMacro; }
+ // Set the error message and associated state
+ void SetError(const char *msg) noexcept;
+ void SetWarning(const char *msg) noexcept;
+ void RetrieveStateMachineResult(GCodeResult& rslt, const StringRef& reply) const noexcept;
+
// Copy values that may have been altered into this state record
// Called after running config.g and after running resurrect.g
void CopyStateFrom(const GCodeMachineState& other) noexcept;
@@ -224,6 +233,12 @@ public:
bool CreateBlock(uint16_t indentLevel) noexcept;
void EndBlock() noexcept;
+
+private:
+ GCodeMachineState *previous;
+ const char *errorMessage;
+ GCodeState state;
+ GCodeResult stateMachineResult; // the worst status (ok, warning or error) that we encountered while running the state machine
};
#endif /* SRC_GCODES_GCODEMACHINESTATE_H_ */