Skip to content

Commit

Permalink
Merge branch '3.5-dev' into outgoing_connections
Browse files Browse the repository at this point in the history
  • Loading branch information
dc42 authored Feb 5, 2023
2 parents 851bea4 + c5a4a73 commit 82b1fee
Show file tree
Hide file tree
Showing 207 changed files with 5,494 additions and 4,680 deletions.
340 changes: 13 additions & 327 deletions .cproject

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Upload release assets

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-22.04
steps:
# Download release assets
- name: Download assets
run: |
mkdir assets
cd assets
gh release download -R Duet3D/RepRapFirmware $GITHUB_REF_NAME -p "*.bin" -p "*.uf2"
env:
GH_TOKEN: ${{ github.token }}

# Clean up unused files
- name: Remove unused files
run: |
cd assets
rm -f Duet2CombinedFirmware.bin DuetMaestroFirmware.bin Duet*_SD*.bin Duet3_CAN*.bin DuetWiFi*.bin
# Upload assets to dev feed on pkg.duet3d.com
- name: Upload files to dev feed
uses: Creepios/[email protected]
with:
host: pkg.duet3d.com
port: 22
username: ${{ secrets.PKG_SSH_USER }}
password: ${{ secrets.PKG_SSH_PASS }}
privateKey: ${{ secrets.PKG_SSH_KEY }}
localPath: ./assets
remotePath: /var/rrf-pkg/dev

# Upload assets to (un)stable feed on pkg.duet3d.com
- name: Upload files to primary feed
uses: Creepios/[email protected]
with:
host: pkg.duet3d.com
port: 22
username: ${{ secrets.PKG_SSH_USER }}
password: ${{ secrets.PKG_SSH_PASS }}
privateKey: ${{ secrets.PKG_SSH_KEY }}
localPath: ./assets
remotePath: /var/rrf-pkg/${{ (github.event.release.prerelease && 'unstable') || 'stable' }}

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# Misc
/.settings/language.settings.xml

# Emacs backup and auto-save files
*~
\#*\#

# Output folders
/Duet2/
/Duet2_SBC/
Expand Down
1 change: 1 addition & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ eclipse.preferences.version=1
encoding//src/Display/Lcd/Fonts/glcd11x14.cpp=UTF-8
encoding//src/Display/Lcd/Fonts/glcd7x11.cpp=UTF-8
encoding//src/Movement/StepperDrivers/TMC51xx.cpp=UTF-8
encoding/<project>=UTF-8
2 changes: 2 additions & 0 deletions .settings/org.eclipse.core.runtime.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
line.separator=\n
Binary file added Tools/CrcAppender/linux-x86_64/CrcAppender
Binary file not shown.
Binary file added Tools/CrcAppender/macos-x86_64/CrcAppender
Binary file not shown.
Binary file added Tools/CrcAppender/win-x86-64/CrcAppender.exe
Binary file not shown.
39 changes: 0 additions & 39 deletions Tools/crc32appender/crc32appender.go

This file was deleted.

Binary file removed Tools/crc32appender/linux-x86_64/crc32appender
Binary file not shown.
Binary file removed Tools/crc32appender/macos-x86_64/crc32appender
Binary file not shown.
Binary file removed Tools/crc32appender/win-x86_64/crc32appender.exe
Binary file not shown.
16 changes: 8 additions & 8 deletions src/CAN/CanInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ GCodeResult CanInterface::SendRequestAndGetStandardReply(CanMessageBuffer *buf,
}

// Send a request to an expansion board and append the response to 'reply'. The response may either be a standard reply or 'replyType'.
GCodeResult CanInterface::SendRequestAndGetCustomReply(CanMessageBuffer *buf, CanRequestId rid, const StringRef& reply, uint8_t *extra, CanMessageType replyType, function_ref<void(const CanMessageBuffer*) /*noexcept*/> callback) noexcept
GCodeResult CanInterface::SendRequestAndGetCustomReply(CanMessageBuffer *buf, CanRequestId rid, const StringRef& reply, uint8_t *extra, CanMessageType replyType, function_ref_noexcept<void(const CanMessageBuffer*) noexcept> callback) noexcept
{
if (can0dev == nullptr)
{
Expand Down Expand Up @@ -794,7 +794,7 @@ GCodeResult CanInterface::SendRequestAndGetCustomReply(CanMessageBuffer *buf, Ca
break;
}

if (reprap.Debug(moduleCan))
if (reprap.Debug(Module::Can))
{
buf->DebugPrint("Rx1:");
}
Expand Down Expand Up @@ -906,7 +906,7 @@ extern "C" [[noreturn]] void CanReceiverLoop(void *) noexcept
{
if (can0dev->ReceiveMessage(RxBufferIndexRequest, TaskBase::TimeoutUnlimited, &buf))
{
if (reprap.Debug(moduleCan))
if (reprap.Debug(Module::Can))
{
buf.DebugPrint("Rx0:");
}
Expand All @@ -919,7 +919,7 @@ extern "C" [[noreturn]] void CanReceiverLoop(void *) noexcept
// This one is used by ATE
GCodeResult CanInterface::EnableRemoteDrivers(const CanDriversList& drivers, const StringRef& reply) noexcept
{
return SetRemoteDriverStates(drivers, reply, DriverStateControl(DriverStateControl::driverActive));
return SetRemoteDriverStates(drivers, reply, DriverStateControl(DriverStateControl::driverActive, reprap.GetGCodes().GetMotorBrakeOffDelay()));
}

// This one is used by Prepare and by M17
Expand All @@ -932,7 +932,7 @@ void CanInterface::EnableRemoteDrivers(const CanDriversList& drivers) noexcept
// This one is used by ATE
GCodeResult CanInterface::DisableRemoteDrivers(const CanDriversList& drivers, const StringRef& reply) noexcept
{
return SetRemoteDriverStates(drivers, reply, DriverStateControl(DriverStateControl::driverDisabled));
return SetRemoteDriverStates(drivers, reply, DriverStateControl(DriverStateControl::driverDisabled, reprap.GetGCodes().GetMotorBrakeOnDelay()));
}

// This one is used by Prepare
Expand All @@ -945,7 +945,7 @@ void CanInterface::DisableRemoteDrivers(const CanDriversList& drivers) noexcept
void CanInterface::SetRemoteDriversIdle(const CanDriversList& drivers, float idleCurrentFactor) noexcept
{
String<1> dummy;
(void)SetRemoteDriverStates(drivers, dummy.GetRef(), DriverStateControl(DriverStateControl::driverIdle, lrintf(idleCurrentFactor * 100)));
(void)SetRemoteDriverStates(drivers, dummy.GetRef(), DriverStateControl(DriverStateControl::driverIdle, (uint16_t)lrintf(idleCurrentFactor * 100) << 4));
}

GCodeResult CanInterface::SetRemoteStandstillCurrentPercent(const CanDriversData<float>& data, const StringRef& reply) noexcept
Expand Down Expand Up @@ -979,7 +979,7 @@ pre(driver.IsRemote())
case 0:
if (gb.SeenAny("RS"))
{
if (!reprap.GetGCodes().LockMovementAndWaitForStandstill(gb))
if (!reprap.GetGCodes().LockAllMovementSystemsAndWaitForStandstill(gb))
{
return GCodeResult::notFinished;
}
Expand All @@ -993,7 +993,7 @@ pre(driver.IsRemote())
case 1:
if (gb.SeenAny("STERID"))
{
if (!reprap.GetGCodes().LockMovementAndWaitForStandstill(gb))
if (!reprap.GetGCodes().LockAllMovementSystemsAndWaitForStandstill(gb))
{
return GCodeResult::notFinished;
}
Expand Down
2 changes: 1 addition & 1 deletion src/CAN/CanInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace CanInterface

CanRequestId AllocateRequestId(CanAddress destination, CanMessageBuffer *buf) noexcept;
GCodeResult SendRequestAndGetStandardReply(CanMessageBuffer *buf, CanRequestId rid, const StringRef& reply, uint8_t *extra = nullptr) noexcept;
GCodeResult SendRequestAndGetCustomReply(CanMessageBuffer *buf, CanRequestId rid, const StringRef& reply, uint8_t *extra, CanMessageType replyType, function_ref<void(const CanMessageBuffer*) /*noexcept*/> callback) noexcept;
GCodeResult SendRequestAndGetCustomReply(CanMessageBuffer *buf, CanRequestId rid, const StringRef& reply, uint8_t *extra, CanMessageType replyType, function_ref_noexcept<void(const CanMessageBuffer*) noexcept> callback) noexcept;
void SendResponseNoFree(CanMessageBuffer *buf) noexcept;
void SendBroadcastNoFree(CanMessageBuffer *buf) noexcept;
void SendMessageNoReplyNoFree(CanMessageBuffer *buf) noexcept;
Expand Down
68 changes: 4 additions & 64 deletions src/CAN/CanMotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,7 @@ CanMessageBuffer *CanMotion::GetBuffer(const PrepParams& params, DriverId canDri

buf->next = movementBufferList;
movementBufferList = buf;

#if USE_REMOTE_INPUT_SHAPING
auto move = buf->SetupRequestMessage<CanMessageMovementLinearShaped>(0, CanId::MasterAddress, canDriver.boardAddress);
#else
auto move = buf->SetupRequestMessage<CanMessageMovementLinear>(0, CanInterface::GetCurrentMasterAddress(), canDriver.boardAddress);
#endif

// Common parameters
if (buf->next == nullptr)
Expand All @@ -136,86 +131,47 @@ CanMessageBuffer *CanMotion::GetBuffer(const PrepParams& params, DriverId canDri
else
{
// Save some maths by using the values from the previous buffer
#if USE_REMOTE_INPUT_SHAPING
move->accelerationClocks = buf->next->msg.moveLinearShaped.accelerationClocks;
move->steadyClocks = buf->next->msg.moveLinearShaped.steadyClocks;
move->decelClocks = buf->next->msg.moveLinearShaped.decelClocks;
#else
move->accelerationClocks = buf->next->msg.moveLinear.accelerationClocks;
move->steadyClocks = buf->next->msg.moveLinear.steadyClocks;
move->decelClocks = buf->next->msg.moveLinear.decelClocks;
#endif
}
move->initialSpeedFraction = params.initialSpeedFraction;
move->finalSpeedFraction = params.finalSpeedFraction;
#if USE_REMOTE_INPUT_SHAPING
move->numDriversMinusOne = canDriver.localDriver;
move->moveTypes = 0;
move->shaperAccelPhasesMinusOne = params.shapingPlan.accelSegments - 1;
move->shaperDecelPhasesMinusOne = params.shapingPlan.decelSegments - 1;
#else
move->pressureAdvanceDrives = 0;
move->numDrivers = canDriver.localDriver + 1;
move->zero = 0;
#endif

// Clear out the per-drive fields. Can't use a range-based FOR loop on a packed struct.
for (size_t drive = 0; drive < ARRAY_SIZE(move->perDrive); ++drive)
{
move->perDrive[drive].Init();
}
}
#if USE_REMOTE_INPUT_SHAPING
else if (canDriver.localDriver > buf->msg.moveLinearShaped.numDriversMinusOne)
{
buf->msg.moveLinearShaped.numDriversMinusOne = canDriver.localDriver;
}
#else
else if (canDriver.localDriver >= buf->msg.moveLinear.numDrivers)
{
buf->msg.moveLinear.numDrivers = canDriver.localDriver + 1;
}
#endif
return buf;
}

// This is called by DDA::Prepare for each active CAN DM in the move
#if USE_REMOTE_INPUT_SHAPING
void CanMotion::AddMovement(const PrepParams& params, DriverId canDriver, int32_t steps) noexcept
#else
void CanMotion::AddMovement(const PrepParams& params, DriverId canDriver, int32_t steps, bool usePressureAdvance) noexcept
#endif
{
CanMessageBuffer * const buf = GetBuffer(params, canDriver);
if (buf != nullptr)
{
#if USE_REMOTE_INPUT_SHAPING
buf->msg.moveLinearShaped.perDrive[canDriver.localDriver].iSteps = steps;
#else
buf->msg.moveLinear.perDrive[canDriver.localDriver].steps = steps;
if (usePressureAdvance)
{
buf->msg.moveLinear.pressureAdvanceDrives |= 1u << canDriver.localDriver;
}
#endif
}
}

#if USE_REMOTE_INPUT_SHAPING

void CanMotion::AddExtruderMovement(const PrepParams& params, DriverId canDriver, float extrusion, bool usePressureAdvance) noexcept
{
CanMessageBuffer * const buf = GetBuffer(params, canDriver);
if (buf != nullptr)
{
buf->msg.moveLinearShaped.perDrive[canDriver.localDriver].fDist = extrusion;
const auto mt = (usePressureAdvance) ? CanMessageMovementLinearShaped::MoveType::extruderWithPa : CanMessageMovementLinearShaped::MoveType::extruderNoPa;
buf->msg.moveLinearShaped.ChangeMoveTypeFromDefault(canDriver.localDriver, mt);
buf->msg.moveLinear.shapeAccelStart = params.shapingPlan.shapeAccelStart;
buf->msg.moveLinear.shapeAccelEnd = params.shapingPlan.shapeAccelEnd;
buf->msg.moveLinear.shapeDecelStart = params.shapingPlan.shapeDecelStart;
buf->msg.moveLinear.shapeDecelEnd = params.shapingPlan.shapeDecelEnd;
}
}

#endif

// This is called by DDA::Prepare when all DMs for CAN drives have been processed. Return the calculated move time in steps, or 0 if there are no CAN moves
uint32_t CanMotion::FinishMovement(const DDA& dda, uint32_t moveStartTime, bool simulating) noexcept
{
Expand All @@ -233,11 +189,7 @@ uint32_t CanMotion::FinishMovement(const DDA& dda, uint32_t moveStartTime, bool
do
{
CanMessageBuffer * const nextBuffer = buf->next; // must get this before sending the buffer, because sending the buffer releases it
#if USE_REMOTE_INPUT_SHAPING
CanMessageMovementLinear& msg = buf->msg.moveLinearShaped;
#else
CanMessageMovementLinear& msg = buf->msg.moveLinear;
#endif
if (msg.HasMotion())
{
msg.whenToExecute = moveStartTime;
Expand Down Expand Up @@ -363,11 +315,7 @@ void CanMotion::InternalStopDriverWhenProvisional(DriverId driver) noexcept

if (buf != nullptr)
{
#if USE_REMOTE_INPUT_SHAPING
buf->msg.moveLinearShaped.perDrive[driver.localDriver].steps = 0;
#else
buf->msg.moveLinear.perDrive[driver.localDriver].steps = 0;
#endif
}
}

Expand Down Expand Up @@ -467,19 +415,11 @@ void CanMotion::StopAll(const DDA& dda) noexcept
// We still send the messages so that the drives get enabled, but we set the steps to zero
for (CanMessageBuffer *buf = movementBufferList; buf != nullptr; buf = buf->next)
{
#if USE_REMOTE_INPUT_SHAPING
buf->msg.moveLinearShaped.accelerationClocks = buf->msg.moveLinearShaped.decelClocks = buf->msg.moveLinearShaped.steadyClocks = 0;
for (size_t drive = 0; drive < ARRAY_SIZE(buf->msg.moveLinearShaped.perDrive); ++drive)
{
buf->msg.moveLinearShaped.perDrive[drive].steps = 0;
}
#else
buf->msg.moveLinear.accelerationClocks = buf->msg.moveLinear.decelClocks = buf->msg.moveLinear.steadyClocks = 0;
for (size_t drive = 0; drive < ARRAY_SIZE(buf->msg.moveLinear.perDrive); ++drive)
{
buf->msg.moveLinear.perDrive[drive].steps = 0;
}
#endif
}
}
else if (stopList != nullptr)
Expand Down
5 changes: 0 additions & 5 deletions src/CAN/CanMotion.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ namespace CanMotion
{
void Init() noexcept;
void StartMovement() noexcept;
#if USE_REMOTE_INPUT_SHAPING
void AddMovement(const PrepParams& params, DriverId canDriver, int32_t steps) noexcept;
void AddExtruderMovement(const PrepParams& params, DriverId canDriver, float extrusion, bool usePressureAdvance) noexcept;
#else
void AddMovement(const PrepParams& params, DriverId canDriver, int32_t steps, bool usePressureAdvance) noexcept;
#endif
uint32_t FinishMovement(const DDA& dda, uint32_t moveStartTime, bool simulating) noexcept;
bool CanPrepareMove() noexcept;
CanMessageBuffer *GetUrgentMessage() noexcept;
Expand Down
19 changes: 8 additions & 11 deletions src/CAN/CommandProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,17 @@ static GCodeResult EutGetInfo(const CanMessageReturnInfo& msg, const StringRef&
extra = LastDiagnosticsPart;
{
const size_t driver = msg.type - (CanMessageReturnInfo::typeDiagnosticsPart0 + 1);
reply.lcatf("Driver %u: position %" PRIi32 ", %.1f steps/mm"
if (driver < NumDirectDrivers) // we have up to 7 drivers on the Duet 3 Mini but only 6 on the 6HC and 6XD
{
reply.lcatf("Driver %u: %.1f steps/mm"
#if HAS_SMART_DRIVERS
","
","
#endif
, driver, reprap.GetMove().GetEndPoint(driver), (double)reprap.GetPlatform().DriveStepsPerUnit(driver));
, driver, (double)reprap.GetPlatform().DriveStepsPerUnit(driver));
#if HAS_SMART_DRIVERS
SmartDrivers::AppendDriverStatus(driver, reply);
SmartDrivers::AppendDriverStatus(driver, reply);
#endif
}
}
break;

Expand Down Expand Up @@ -458,12 +461,6 @@ void CommandProcessor::ProcessReceivedMessage(CanMessageBuffer *buf) noexcept
reprap.GetMove().AddMoveFromRemote(buf->msg.moveLinear);
return; // no reply needed

# if USE_REMOTE_INPUT_SHAPING
case CanMessageType::movementLinearShaped:
reprap.GetMove().AddShapedMoveFromRemote(buf->msg.moveLinearShaped);
return; // no reply needed
# endif

case CanMessageType::stopMovement:
reprap.GetMove().StopDrivers(buf->msg.stopMovement.whichDrives);
return; // no reply needed
Expand Down Expand Up @@ -765,7 +762,7 @@ void CommandProcessor::ProcessReceivedMessage(CanMessageBuffer *buf) noexcept
#endif

default:
if (reprap.Debug(moduleCan))
if (reprap.Debug(Module::Can))
{
buf->DebugPrint("Rec: ");
}
Expand Down
Loading

0 comments on commit 82b1fee

Please sign in to comment.