Skip to content

Commit

Permalink
set a flag when Z stop is set
Browse files Browse the repository at this point in the history
As I see the fluidnc code, homing goes to the limit switches, which
the maslow wants to use when setting where the bit will cut. But
since the maslow belts need to be at different lengths based on the Z
distance from the mechanical limits, knowing if that has been set
requires an additional flag.

it is set false by default but set true when you manually set the
mechanical limit or when you restore the position.
  • Loading branch information
davidelang committed Nov 10, 2024
1 parent 0ce0f15 commit e4bacd5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions FluidNC/src/Maslow/Maslow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,12 @@ void Maslow_::runCalibration() {
}
stop();

//if the Z mechanical limit is not known, we can't run calibration
if (!zMechanicalLimitSet) {
log_error("Cannot run calibration until the Z position is known. Run it down to the stops and set Z stop");
sys.set_state(State::Idle);
return;
}
//if not all axis are homed, we can't run calibration, OR if the user hasnt entered width and height?
if (!allAxisExtended()) {
log_error("Cannot run calibration until all belts are extended fully");
Expand Down Expand Up @@ -1627,6 +1633,7 @@ void Maslow_::loadZPos() {
int zAxis = 2;
float* mpos = get_mpos();
mpos[zAxis] = targetZ;
zMechanicalLimitSet = true;
set_motor_steps_from_mpos(mpos);

log_info("Current z-axis position loaded as: " << targetZ);
Expand All @@ -1645,6 +1652,7 @@ void Maslow_::setZStop() {
int zAxis = 2;
float* mpos = get_mpos();
mpos[zAxis] = targetZ;
zMechanicalLimitSet = true;
set_motor_steps_from_mpos(mpos);

gc_sync_position();//This updates the Gcode engine with the new position from the stepping engine that we set with set_motor_steps
Expand Down
1 change: 1 addition & 0 deletions FluidNC/src/Maslow/Maslow.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct TelemetryData {
bool extendedTR;
bool extendedBL;
bool extendedBR;
bool zMechanicalLimitSet = false; //This is separate from homing because this is the mechanical stop of the machine while Z home is where the bit is at Z=0

bool extendingALL;
bool complyALL;
Expand Down

0 comments on commit e4bacd5

Please sign in to comment.