Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions src/CAN/CanInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1077,9 +1077,36 @@ GCodeResult CanInterface::ConfigureRemoteDriver(DriverId driver, GCodeBuffer& gb
Kinematics &_ecv_from kin = reprap.GetMove().GetKinematics();
if (kin.GetKinematicsType() == KinematicsType::hangprinter)
{
gb.MustSee('P');
size_t drivesCount = reprap.GetGCodes().GetVisibleAxes();
DriverId driverIds[drivesCount];
gb.GetDriverIdArray(driverIds, drivesCount);

gb.MustSee('T');
const float torque = gb.GetFValue();
return ((HangprinterKinematics&)kin).SetODrive3TorqueMode(driver, torque, reply);
float forces[drivesCount];
size_t forceCount = drivesCount;
gb.GetFloatArray(forces, forceCount, true);
if (forceCount != drivesCount)
{
reply.copy("M569.4 requires one T value per P");
return GCodeResult::error;
}

size_t driverIndex = drivesCount;
for (size_t i = 0; i < drivesCount; ++i)
{
if (driverIds[i] == driver)
{
driverIndex = i;
break;
}
}
if (driverIndex == drivesCount)
{
reply.copy("M569.4 driver not found in P list");
return GCodeResult::error;
}
return ((HangprinterKinematics&)kin).SetODrive3TorqueMode(driver, forces[driverIndex], reply);
}
}
#endif
Expand Down
Loading