diff options
Diffstat (limited to 'src/Platform/Platform.cpp')
-rw-r--r-- | src/Platform/Platform.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp index 7e003bf6..5dc74632 100644 --- a/src/Platform/Platform.cpp +++ b/src/Platform/Platform.cpp @@ -2677,12 +2677,30 @@ void Platform::SetDriversIdle() noexcept // Configure the brake port for a driver GCodeResult Platform::ConfigureDriverBrakePort(GCodeBuffer& gb, const StringRef& reply, size_t driver) noexcept { + bool seen = false; if (gb.Seen('C')) { - return GetGCodeResultFromSuccess(brakePorts[driver].AssignPort(gb, reply, PinUsedBy::gpout, PinAccess::write0)); + seen = true; + if (!brakePorts[driver].AssignPort(gb, reply, PinUsedBy::gpout, PinAccess::write0)) + { + return GCodeResult::error; + } + delayAfterBrakeOn[driver] = DefaultDelayAfterBrakeOn; + } + uint32_t val; + if (gb.TryGetLimitedUIValue('S', val, seen, 100)) + { + delayAfterBrakeOn[driver] = val; + } + + if (!seen) + { + reply.printf("Driver %u uses brake port ", driver); + brakePorts[driver].AppendPinName(reply); +#if 0 // don't print this bit until we have implemented it! + reply.catf(" and %ums delay after turning the brake on", delayAfterBrakeOn[driver]); +#endif } - reply.printf("Driver %u uses brake port ", driver); - brakePorts[driver].AppendPinName(reply); return GCodeResult::ok; } |