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-06-03 22:58:04 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-06-03 22:58:04 +0300
commite5438fe8e622e6316356249c15634028bd4382f8 (patch)
treea4e623494be4eea48eb7b25d4c86079439ff7395
parentbe278a6c0b6a1670d63651e808457a60f5afd25e (diff)
Increased SPI timeout, also fixed race condition
-rw-r--r--src/Linux/LinuxInterface.cpp8
-rw-r--r--src/Linux/LinuxMessageFormats.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/Linux/LinuxInterface.cpp b/src/Linux/LinuxInterface.cpp
index 9545a8f0..598ddaef 100644
--- a/src/Linux/LinuxInterface.cpp
+++ b/src/Linux/LinuxInterface.cpp
@@ -352,9 +352,9 @@ void LinuxInterface::Init() noexcept
// Return heightmap as generated by G29 S0
case LinuxRequest::GetHeightMap:
{
- if (!reprap.GetMove().heightMapLock.IsLocked())
+ ConditionalReadLocker locker(reprap.GetMove().heightMapLock);
+ if (locker.IsLocked())
{
- ReadLocker locker(reprap.GetMove().heightMapLock);
packetAcknowledged = transfer.WriteHeightMap();
}
else
@@ -367,9 +367,9 @@ void LinuxInterface::Init() noexcept
// Set heightmap via G29 S1
case LinuxRequest::SetHeightMap:
{
- if (!reprap.GetMove().heightMapLock.IsLocked())
+ ConditionalWriteLocker locker(reprap.GetMove().heightMapLock);
+ if (locker.IsLocked())
{
- WriteLocker locker(reprap.GetMove().heightMapLock);
if (!transfer.ReadHeightMap())
{
reprap.GetPlatform().Message(ErrorMessage, "Failed to set height map - bad data?\n");
diff --git a/src/Linux/LinuxMessageFormats.h b/src/Linux/LinuxMessageFormats.h
index 9c690684..98d5110f 100644
--- a/src/Linux/LinuxMessageFormats.h
+++ b/src/Linux/LinuxMessageFormats.h
@@ -29,7 +29,7 @@ static_assert(MaxCodeBufferSize >= GCODE_LENGTH, "MaxCodeBufferSize must be at l
constexpr uint32_t SpiMacroRequestTimeout = 3000; // maximum time to wait a macro file
constexpr uint32_t SpiTransferTimeout = 500; // maximum allowed delay between data exchanges during a full transfer (in ms)
-constexpr uint32_t SpiConnectionTimeout = 4000; // maximum time to wait for the next transfer (in ms)
+constexpr uint32_t SpiConnectionTimeout = 8000; // maximum time to wait for the next transfer (in ms)
constexpr uint16_t SpiCodeBufferSize = 4096; // number of bytes available for G-code caching
// Shared structures