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>2021-07-31 12:30:17 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-07-31 12:30:17 +0300
commitde65e3e848ba79a1563eabea60175d9194bf1c41 (patch)
treee0663700d05702862fdd428116ec09090d9358c6 /src/GCodes
parentadadbb13da2c74ced1c5830fdd685e3118310dba (diff)
More work on embedded readonly file support
Diffstat (limited to 'src/GCodes')
-rw-r--r--src/GCodes/GCodeBuffer/GCodeBuffer.cpp6
-rw-r--r--src/GCodes/GCodeBuffer/GCodeBuffer.h4
-rw-r--r--src/GCodes/GCodeInput.cpp2
-rw-r--r--src/GCodes/GCodeInput.h2
-rw-r--r--src/GCodes/GCodeMachineState.h2
-rw-r--r--src/GCodes/GCodes.cpp6
-rw-r--r--src/GCodes/GCodes2.cpp7
7 files changed, 16 insertions, 13 deletions
diff --git a/src/GCodes/GCodeBuffer/GCodeBuffer.cpp b/src/GCodes/GCodeBuffer/GCodeBuffer.cpp
index fcfdd147..ce063e9c 100644
--- a/src/GCodes/GCodeBuffer/GCodeBuffer.cpp
+++ b/src/GCodes/GCodeBuffer/GCodeBuffer.cpp
@@ -87,7 +87,7 @@ const char *GCodeBuffer::GetStateText() const noexcept
// Create a default GCodeBuffer
GCodeBuffer::GCodeBuffer(GCodeChannel::RawType channel, GCodeInput *normalIn, FileGCodeInput *fileIn, MessageType mt, Compatibility::RawType c) noexcept
: codeChannel(channel), normalInput(normalIn),
-#if HAS_MASS_STORAGE
+#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
fileInput(fileIn),
#endif
responseMessageType(mt), lastResult(GCodeResult::ok),
@@ -820,7 +820,7 @@ void GCodeBuffer::AbortFile(bool abortAll, bool requestAbort) noexcept
{
if (machineState->DoingFile())
{
-#if HAS_MASS_STORAGE
+#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
# if HAS_LINUX_INTERFACE
if (!reprap.UsingLinuxInterface())
# endif
@@ -1039,7 +1039,7 @@ void GCodeBuffer::FinishWritingBinary() noexcept
void GCodeBuffer::RestartFrom(FilePosition pos) noexcept
{
-#if HAS_MASS_STORAGE
+#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
fileInput->Reset(machineState->fileState); // clear the buffered data
machineState->fileState.Seek(pos); // replay the abandoned instructions when we resume
#endif
diff --git a/src/GCodes/GCodeBuffer/GCodeBuffer.h b/src/GCodes/GCodeBuffer/GCodeBuffer.h
index b9e513b6..c984ec5f 100644
--- a/src/GCodes/GCodeBuffer/GCodeBuffer.h
+++ b/src/GCodes/GCodeBuffer/GCodeBuffer.h
@@ -218,7 +218,7 @@ public:
void RestartFrom(FilePosition pos) noexcept;
-#if HAS_MASS_STORAGE
+#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
FileGCodeInput *GetFileInput() const noexcept { return fileInput; }
#endif
GCodeInput *GetNormalInput() const noexcept { return normalInput; }
@@ -253,7 +253,7 @@ private:
const GCodeChannel codeChannel; // Channel number of this instance
GCodeInput *normalInput; // Our normal input stream, or nullptr if there isn't one
-#if HAS_MASS_STORAGE
+#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
FileGCodeInput *fileInput; // Our file input stream for when we are reading from a print file or a macro file, may be shared with other GCodeBuffers
#endif
diff --git a/src/GCodes/GCodeInput.cpp b/src/GCodes/GCodeInput.cpp
index f5699419..ed5241c6 100644
--- a/src/GCodes/GCodeInput.cpp
+++ b/src/GCodes/GCodeInput.cpp
@@ -246,7 +246,7 @@ bool NetworkGCodeInput::FillBuffer(GCodeBuffer *gb) noexcept /*override*/
return lock && RegularGCodeInput::FillBuffer(gb);
}
-#if HAS_MASS_STORAGE
+#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
// File-based G-code input source
diff --git a/src/GCodes/GCodeInput.h b/src/GCodes/GCodeInput.h
index 2d54547e..8cfe8259 100644
--- a/src/GCodes/GCodeInput.h
+++ b/src/GCodes/GCodeInput.h
@@ -101,7 +101,7 @@ private:
enum class GCodeInputReadResult : uint8_t { haveData, noData, error };
-#if HAS_MASS_STORAGE
+#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
// This class is an expansion of the RegularGCodeInput class to buffer G-codes and to rewind file positions when
// nested G-code files are started. However buffered codes are not explicitly checked for M112.
diff --git a/src/GCodes/GCodeMachineState.h b/src/GCodes/GCodeMachineState.h
index 31fafdbe..eb388738 100644
--- a/src/GCodes/GCodeMachineState.h
+++ b/src/GCodes/GCodeMachineState.h
@@ -196,7 +196,7 @@ public:
VariableSet variables; // local variables and parameters
float feedRate;
-#if HAS_MASS_STORAGE
+#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
FileData fileState;
#endif
#if HAS_LINUX_INTERFACE
diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp
index 9c716f3b..208f0b05 100644
--- a/src/GCodes/GCodes.cpp
+++ b/src/GCodes/GCodes.cpp
@@ -2782,7 +2782,7 @@ bool GCodes::DoFileMacro(GCodeBuffer& gb, const char* fileName, bool reportMissi
else
#endif
{
-#if HAS_MASS_STORAGE
+#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
FileStore * const f = platform.OpenSysFile(fileName, OpenMode::read);
if (f == nullptr)
{
@@ -2812,7 +2812,7 @@ bool GCodes::DoFileMacro(GCodeBuffer& gb, const char* fileName, bool reportMissi
#endif
}
-#if HAS_LINUX_INTERFACE || HAS_MASS_STORAGE
+#if HAS_LINUX_INTERFACE || HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
gb.LatestMachineState().doingFileMacro = true;
gb.LatestMachineState().runningM501 = (codeRunning == 501);
gb.LatestMachineState().runningM502 = (codeRunning == 502);
@@ -2844,7 +2844,7 @@ void GCodes::FileMacroCyclesReturn(GCodeBuffer& gb) noexcept
else
#endif
{
-#if HAS_MASS_STORAGE
+#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
FileData &file = gb.LatestMachineState().fileState;
gb.GetFileInput()->Reset(file);
file.Close();
diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp
index 6bb56c5a..e3f656e1 100644
--- a/src/GCodes/GCodes2.cpp
+++ b/src/GCodes/GCodes2.cpp
@@ -732,7 +732,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx
}
break;
-#if HAS_MASS_STORAGE
+#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
case 20: // List files on SD card
if (!LockFileSystem(gb)) // don't allow more than one at a time to avoid contention on output buffers
{
@@ -809,6 +809,9 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx
}
}
break;
+#endif
+
+#if HAS_MASS_STORAGE
case 21: // Initialise SD card
if (!LockFileSystem(gb)) // don't allow more than one at a time to avoid contention on output buffers
@@ -2979,7 +2982,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx
}
break;
-#if HAS_MASS_STORAGE
+#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
case 503: // List variable settings
{
if (!LockFileSystem(gb))