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:
authorChristian Hammacher <bmasterc@gmail.com>2019-12-16 22:28:10 +0300
committerChristian Hammacher <bmasterc@gmail.com>2019-12-16 22:28:10 +0300
commita0b421e8757d8176db5dc172588c9b8243f50287 (patch)
tree40c74e6948c2b5213f200a660f32f01a8afcb0a5
parent198cb953840a1ce257cc5847e59854d9d2c43ee0 (diff)
Fixed filament functions for usage with SBC
-rw-r--r--src/GCodes/GCodes.cpp14
-rw-r--r--src/GCodes/GCodes2.cpp5
-rw-r--r--src/Linux/LinuxInterface.cpp9
-rw-r--r--src/Tools/Filament.cpp16
4 files changed, 33 insertions, 11 deletions
diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp
index 619363a0..7188e1e0 100644
--- a/src/GCodes/GCodes.cpp
+++ b/src/GCodes/GCodes.cpp
@@ -566,6 +566,12 @@ void GCodes::DoFilePrint(GCodeBuffer& gb, const StringRef& reply)
HandleReply(gb, GCodeResult::ok, "");
}
}
+ else if (gb.GetState() == GCodeState::loadingFilament && hadFileError)
+ {
+ // Don't perform final filament assignment if the load macro could not be processed
+ gb.SetState(GCodeState::normal);
+ HandleReply(gb, GCodeResult::ok, "");
+ }
else if (gb.GetState() == GCodeState::normal)
{
UnlockAll(gb);
@@ -3505,14 +3511,6 @@ GCodeResult GCodes::LoadFilament(GCodeBuffer& gb, const StringRef& reply)
return GCodeResult::error;
}
-#if HAS_MASS_STORAGE
- if (!platform.DirectoryExists(FILAMENTS_DIRECTORY, filamentName.c_str()))
- {
- reply.copy("Filament configuration directory not found");
- return GCodeResult::error;
- }
-#endif
-
if (Filament::IsInUse(filamentName.c_str()))
{
reply.copy("One filament type can be only assigned to a single tool");
diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp
index 3ed98edd..ca2f95e4 100644
--- a/src/GCodes/GCodes2.cpp
+++ b/src/GCodes/GCodes2.cpp
@@ -3997,10 +3997,11 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply)
case 703: // Configure Filament
if (reprap.GetCurrentTool() != nullptr)
{
- if (reprap.GetCurrentTool()->GetFilament() != nullptr)
+ const Filament *filament = reprap.GetCurrentTool()->GetFilament();
+ if (filament != nullptr && filament->IsLoaded())
{
String<ScratchStringLength> scratchString;
- scratchString.printf("%s%s/%s", FILAMENTS_DIRECTORY, reprap.GetCurrentTool()->GetFilament()->GetName(), CONFIG_FILAMENT_G);
+ scratchString.printf("%s%s/%s", FILAMENTS_DIRECTORY, filament->GetName(), CONFIG_FILAMENT_G);
DoFileMacro(gb, scratchString.c_str(), false, 703);
}
}
diff --git a/src/Linux/LinuxInterface.cpp b/src/Linux/LinuxInterface.cpp
index 3b9f73b7..3535b60c 100644
--- a/src/Linux/LinuxInterface.cpp
+++ b/src/Linux/LinuxInterface.cpp
@@ -294,7 +294,14 @@ void LinuxInterface::Spin()
Filament *filament = Filament::GetFilamentByExtruder(extruder);
if (filament != nullptr)
{
- filament->Load(filamentName.c_str());
+ if (filamentName.IsEmpty())
+ {
+ filament->Unload();
+ }
+ else
+ {
+ filament->Load(filamentName.c_str());
+ }
}
break;
}
diff --git a/src/Tools/Filament.cpp b/src/Tools/Filament.cpp
index e6321847..2ce3e7b9 100644
--- a/src/Tools/Filament.cpp
+++ b/src/Tools/Filament.cpp
@@ -42,6 +42,14 @@ void Filament::Unload() noexcept
void Filament::LoadAssignment() noexcept
{
#if HAS_MASS_STORAGE
+# if HAS_LINUX_INTERFACE
+ if (reprap.UsingLinuxInterface())
+ {
+ // Filament configuration is saved on the SBC
+ return;
+ }
+# endif
+
FileStore *file = reprap.GetPlatform().OpenSysFile(FilamentAssignmentFile, OpenMode::read);
if (file == nullptr)
{
@@ -81,6 +89,14 @@ void Filament::LoadAssignment() noexcept
/*static*/ void Filament::SaveAssignments() noexcept
{
#if HAS_MASS_STORAGE
+# if HAS_LINUX_INTERFACE
+ if (reprap.UsingLinuxInterface())
+ {
+ // Filament configuration is saved on the SBC
+ return;
+ }
+# endif
+
FileStore * const file = reprap.GetPlatform().OpenSysFile(FilamentAssignmentFile, OpenMode::write);
if (file == nullptr)
{