Skip to content

Commit

Permalink
WIP: Allow prism printing volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimon committed Dec 21, 2022
1 parent 1664f51 commit 8ac3679
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/Movement/Kinematics/HangprinterKinematics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ void HangprinterKinematics::Init() noexcept
constexpr uint32_t DefaultFullStepsPerMotorRev[HANGPRINTER_MAX_AXES] = { 25, 25, 25, 25, 25, 25, 25, 25, 25};
ARRAY_INIT(anchors, DefaultAnchors);
numAnchors = DefaultNumAnchors;
anchorsSetup = LastTopRestDown;
printRadius = DefaultPrintRadius;
spoolBuildupFactor = DefaultSpoolBuildupFactor;
ARRAY_INIT(spoolRadii, DefaultSpoolRadii);
Expand Down Expand Up @@ -359,7 +360,9 @@ static bool isSameSide(float const v0[3], float const v1[3], float const v2[3],
return dot0*dot1 > 0.0F;
}

bool HangprinterKinematics::IsReachable(float axesCoords[MaxAxes], AxesBitmap axes) const noexcept /*override*/
// The last axe must be the one on the top
// TODO Validate this in HangprinterKinematics::Configure
bool HangprinterKinematics::IsReachablePyramid(float axesCoords[MaxAxes], AxesBitmap axes) const noexcept /*override*/
{
float const coords[3] = {axesCoords[X_AXIS], axesCoords[Y_AXIS], axesCoords[Z_AXIS]};

Expand All @@ -381,6 +384,23 @@ bool HangprinterKinematics::IsReachable(float axesCoords[MaxAxes], AxesBitmap ax
return reachable;
}

bool HangprinterKinematics::IsReachablePrism(float axesCoords[MaxAxes], AxesBitmap axes) const noexcept
{
// TODO Implement. We will need some sort of max height parameter since it's not implicit here.
return true;
}

bool HangprinterKinematics::IsReachable(float axesCoords[MaxAxes], AxesBitmap axes) const noexcept
{
switch (anchorsSetup) {
case LastTopRestDown:
default:
return IsReachablePyramid(axesCoords, axes);
case AllTop:
return IsReachablePrism(axesCoords, axes);
}
}

// Limit the Cartesian position that the user wants to move to returning true if we adjusted the position
LimitPositionResult HangprinterKinematics::LimitPosition(float finalCoords[], const float * null initialCoords,
size_t numVisibleAxes, AxesBitmap axesToLimit, bool isCoordinated, bool applyM208Limits) const noexcept
Expand Down
7 changes: 7 additions & 0 deletions src/Movement/Kinematics/HangprinterKinematics.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class HangprinterKinematics : public RoundBedKinematics
OBJECT_MODEL_ARRAY(anchors)
OBJECT_MODEL_ARRAY(anchorCoordinates)

bool IsReachablePyramid(float axesCoords[MaxAxes], AxesBitmap axes) const noexcept;
bool IsReachablePrism(float axesCoords[MaxAxes], AxesBitmap axes) const noexcept;

private:
// Basic facts about movement system
const char* ANCHOR_CHARS = "ABCDEFHIJ"; // Skip the G, since it is reserved in G-code
Expand All @@ -58,6 +61,9 @@ class HangprinterKinematics : public RoundBedKinematics
static constexpr size_t B_AXIS = 1;
static constexpr size_t C_AXIS = 2;
static constexpr size_t D_AXIS = 3;
// LastTopRestDown (default) has a single anchor on top and produces pyramid-shaped printing volumes
// AllTop has a all anchors on top and produces prism-shaped printing volumes
enum AnchorsSetup {LastTopRestDown, AllTop}; // Allowed setups for placing the anchors

void Init() noexcept;
void Recalc() noexcept;
Expand All @@ -69,6 +75,7 @@ class HangprinterKinematics : public RoundBedKinematics

size_t numAnchors;
float anchors[HANGPRINTER_MAX_AXES][3]; // XYZ coordinates of the anchors
AnchorsSetup anchorsSetup;
float printRadius;
// Line buildup compensation
float spoolBuildupFactor;
Expand Down

0 comments on commit 8ac3679

Please sign in to comment.