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
path: root/src/GPIO
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2020-03-10 15:33:52 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-03-10 15:33:52 +0300
commit24f99490aa2be4fb14f7aeee454ede55e3dfb919 (patch)
tree4c1d18f73679fea7748e34d6d59acc70fd77fbcb /src/GPIO
parent5de9c86f303c680a41f4e7692014226b47ccf181 (diff)
Implemented seqs.directories, seqs.heat, seqs.inputs, seqs.job
Diffstat (limited to 'src/GPIO')
-rw-r--r--src/GPIO/GpioPorts.cpp43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/GPIO/GpioPorts.cpp b/src/GPIO/GpioPorts.cpp
index 7c9cafba..708ae893 100644
--- a/src/GPIO/GpioPorts.cpp
+++ b/src/GPIO/GpioPorts.cpp
@@ -85,12 +85,14 @@ GCodeResult GpInputPort::Configure(uint32_t gpinNumber, GCodeBuffer &gb, const S
port.Release();
currentState = false;
+ GCodeResult rslt;
+
#if SUPPORT_CAN_EXPANSION
const CanAddress newBoard = IoPort::RemoveBoardAddress(pinName.GetRef());
if (newBoard != CanId::MasterAddress)
{
handle.Set(RemoteInputHandle::typeGpIn, gpinNumber, 0);
- const GCodeResult rslt = CanInterface::CreateHandle(newBoard, handle, pinName.c_str(), 0, MinimumGpinReportInterval, currentState, reply);
+ rslt = CanInterface::CreateHandle(newBoard, handle, pinName.c_str(), 0, MinimumGpinReportInterval, currentState, reply);
if (rslt == GCodeResult::ok)
{
boardAddress = newBoard;
@@ -99,14 +101,22 @@ GCodeResult GpInputPort::Configure(uint32_t gpinNumber, GCodeBuffer &gb, const S
{
currentState = false;
}
- return rslt;
}
+ else
#endif
- if (!port.AssignPort(pinName.c_str(), reply, PinUsedBy::gpin, PinAccess::read))
{
- return GCodeResult::error;
+ if (port.AssignPort(pinName.c_str(), reply, PinUsedBy::gpin, PinAccess::read))
+ {
+ currentState = port.Read();
+ }
+ else
+ {
+ rslt = GCodeResult::error;
+ }
}
- currentState = port.Read();
+
+ reprap.InputsUpdated();
+ return rslt;
}
else
{
@@ -168,6 +178,8 @@ GCodeResult GpOutputPort::Configure(uint32_t gpioNumber, bool isServo, GCodeBuff
freq = (isServo) ? ServoRefreshFrequency : DefaultPinWritePwmFreq;
}
+ GCodeResult rslt;
+
#if SUPPORT_CAN_EXPANSION
boardAddress = IoPort::RemoveBoardAddress(pinName.GetRef());
if (boardAddress != CanId::MasterAddress)
@@ -177,14 +189,25 @@ GCodeResult GpOutputPort::Configure(uint32_t gpioNumber, bool isServo, GCodeBuff
cons.AddUParam('Q', freq);
cons.AddUParam('S', (isServo) ? 1 : 0);
cons.AddStringParam('C', pinName.c_str());
- return cons.SendAndGetResponse(CanMessageType::m950Gpio, boardAddress, reply);
+ rslt = cons.SendAndGetResponse(CanMessageType::m950Gpio, boardAddress, reply);
}
+ else
#endif
- if (!port.AssignPort(pinName.c_str(), reply, PinUsedBy::gpout, (isServo) ? PinAccess::servo : PinAccess::pwm))
{
- return GCodeResult::error;
+ if (port.AssignPort(pinName.c_str(), reply, PinUsedBy::gpout, (isServo) ? PinAccess::servo : PinAccess::pwm))
+ {
+ rslt = GCodeResult::ok;
+ port.SetFrequency(freq);
+ }
+ else
+ {
+ rslt = GCodeResult::error;
+ }
}
- port.SetFrequency(freq);
+
+ // GPOut pins are not yet in the object model
+ // reprap.OutputsUpdated();
+ return rslt;
}
else if (seenFreq)
{
@@ -194,10 +217,12 @@ GCodeResult GpOutputPort::Configure(uint32_t gpioNumber, bool isServo, GCodeBuff
CanMessageGenericConstructor cons(M950GpioParams);
cons.AddUParam('P', gpioNumber);
cons.AddUParam('Q', freq);
+ // reprap.OutputsUpdated();
return cons.SendAndGetResponse(CanMessageType::m950Gpio, boardAddress, reply);
}
#endif
port.SetFrequency(freq);
+ // reprap.OutputsUpdated();
}
else
{