diff options
Diffstat (limited to 'src/Platform/Platform.cpp')
-rw-r--r-- | src/Platform/Platform.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp index a92df70d..e12dd579 100644 --- a/src/Platform/Platform.cpp +++ b/src/Platform/Platform.cpp @@ -4191,12 +4191,23 @@ float Platform::GetLaserPwm() const noexcept bool Platform::AssignLaserPin(GCodeBuffer& gb, const StringRef& reply) { - const bool ok = laserPort.AssignPort(gb, reply, PinUsedBy::laser, PinAccess::pwm); - if (ok) + if (!laserPort.AssignPort(gb, reply, PinUsedBy::laser, PinAccess::pwm)) { - SetLaserPwm(0); + return false; } - return ok; + +#ifdef DUET_NG + // We can't use DueX fan pins because we need to set the PWM from within the tick ISR + if (laserPort.GetPin() >= DueXnExpansionStart) + { + reply.copy("DueX fan or GPIO pins may not be used to control lasers"); + laserPort.Release(); + return false; + } +#endif + + SetLaserPwm(0); + return true; } void Platform::SetLaserPwmFrequency(PwmFrequency freq) noexcept |